Racing Horses Problem

https://www.codechef.com/viewsolution/23830380
why this is given as wrong answer
to problem → HORSES Problem - CodeChef?
even when it pass the test case easily.

It a minor bug in your code. You forgot to put newline after printing the difference. Thats it.