first and second coins. A subscription charges them every day, and the charge grows: on day i (days start at 1) it takes i coins.
The money is always taken from the account that currently holds more; on a tie, from the first one. If that account has fewer than i coins, the charge fails and the subscription stops.
Return [day, rest1, rest2]: the day on which the charge failed and the balances of the first and second accounts at that moment.first=3, second=1 → [3, 0, 1]
Day 1: 1 is taken from account 1 (2 left). Day 2: account 1 is still larger, 2 is taken (0 left). Day 3: account 2 is larger but holds only 1 < 3, so the charge fails.
first=0, second=0 → [1, 0, 0]
On day 1 there is nothing to cover a charge of 1.
first=5, second=9 → [5, 1, 3]
first=3, second=1
[3, 0, 1]
Run checks the first 3 tests in your browser. Submit checks all 81 tests on the server, hidden ones included.