[HORSES] Not sure why my solution is not accepted

Problem: https://www.codechef.com/problems/HORSES
My solution: Solution: 58437908 | CodeChef

I am a beginner in C++ and I have no idea why my solution is not accepted. Please help.