CATFEED Help Required

https://www.codechef.com/viewsolution/26824872
Problem: CATFEED
Contest: LTIME76B
Please review my solution. It did not get selected during the contest and am unable to find the mistake.

Check this out. :slightly_smiling_face: