wrong answer for campon

question CAMPON Problem - CodeChef

my solution CodeChef: Practical coding for everyone

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!