wrong answer for campon

question https://www.codechef.com/problems/CAMPON

my solution https://www.codechef.com/viewsolution/22074659

why is my solution wrong??
thanks in advance.

Here’s your solution which passes all the test cases with a very minor modification. I’d encourage you to figure that out yourselves.

https://www.codechef.com/viewsolution/22075381

Hint— Your previous program would run perfectly if the number of test cases is 1, but would fail if the number of test cases becomes more than 1. Think over it!