Help in PERFCONT

,

problem: PERFCONT Problem - CodeChef

code: CodeChef: Practical coding for everyone

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