The output of this code right, but CodeChef shows the wrong answer. Anyone suggests the corrections in the given code.
https://www.codechef.com/viewsolution/30664817