[Wrong answer] Paying up

I tried this program on my compiler and i got correct output…but here i am getting wrong answer.
Can anyone please tell me why am i getting wrong answer.
Here is the link to the solution → CodeChef: Practical coding for everyone