Help in PERFCONT

,

problem: https://www.codechef.com/problems/PERFCONT

code: https://www.codechef.com/viewsolution/16103356

when i test this code in my codeblocks editor w/ inputs and constraints as reqd, it works fine and gives o/p exactly as reqd. but as i test this code on codechef or ideone.com it shows incorrect o/p i.e. all “no” I cant figure out what am i doing wrong or what is the difference between the editors of codeblocks and codechef.

here is the ideone link