WA in INPSTFIX? Can someone help?

Here’s my code: https://www.codechef.com/viewsolution/34082771