Showing wrong ans in racing horses

https://www.codechef.com/viewsolution/27723208