Giving roses equal to money have

Problem->https://hack.codingblocks.com/app/contests/1975/1003/problem

My code->https://ide.codingblocks.com/s/405991

Its giving correct ans on compiling it …but giving wrong ans when I submit.
kindly explain me how correct that??

hello @kaustub

u havent handled this condition->
image

What is difference between the 2 why cannot I use break?

sorry by mistake i wrote it here ignore that

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.