I have just started with code chef and got stuck on this problem
My solution code is:
https://www.codechef.com/viewsolution/37967236
It works fine on inputs given in the question but when submitted shows wrong answer.
It would be great help if someone told me what’s wrong in my code.