Codechef Judge giving wrong answer

I was trying to solve this easy problem:

So i made a solution and submitted it, getting a WA. Tried doing some things differently but still WA.

So i saw one of the solution, but it doing almost exactly what i was doing. So tried again still WA.

So finally out of frustration, i submitted the code that was earlier accepted and that gave WA.

Idk what i am missing, here are the link to both the submissions:
WA :

Your solution is wrong.
Try case


It seems the test cases were weak at the time of the contest, but this case was added later at practice section.