Greedy Algo- Balife doubt

sir one of my testcase does not pass? where i am making mistake.

@udaycodingblocks, please share ur code here http://ide.codingblocks.com/

i have submitted the code twice . sir now have a look at my code. where i am making mistake?

@udaycodingblocks,
its not visible to me share your code here http://ide.codingblocks.com/

here is my code of balife doubt

@udaycodingblocks,
ive corrected the code https://ide.codingblocks.com/s/656956 and commented

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.