What is wrong with the code ? Please help.

Question link : BUYING2 Problem - CodeChef

Solution Link: CodeChef: Practical coding for everyone

Your approach is correct. It seems you are printing extra stuff like “Enter number of test cases: Enter no. of notes, price of sweet: Enter values of notes:”. Those lines are not needed.
I modified your solution a little and it got accepted. See here - https://www.codechef.com/viewsolution/23454337.