Solved ATM question on Code Chef