Can someone explain me this problem?

solution - CodeChef: Practical coding for everyone