What is wrong with this code?

https://www.codechef.com/problems/MAXDIFF

What is wrong with this solution?
https://www.codechef.com/viewsolution/24892168