Code for minimum Money Needed Failed all test cases

My code for Minimum money needed failled all test case. I don’t exactly know why. Please help

My code: https://ide.codingblocks.com/s/460865

you make the code cumbersome

there is my code you can check this