RE in 479C EXAMS (codeforces)

I have been trying to solve the question -

And my solution is-

It seems that the compare function is responsible for this error as removing it gives an AC.
What possibly could be the reason…?

Please Read

1 Like

Thanks…:smiley: