Paying Up causing an error

CodeChef: Practical coding for everyone.
Can anyone tell me which test case is giving me a wrong answer or where is an error in my code