Can anyone help me with the problem NOTALLFL?

i am getting partially corrected answer
here is my code:
https://www.codechef.com/viewsolution/32007501
and here is link to the problem: