WA in MFSS in June Challenge

The question is this:Contest Page | CodeChef
My solution is this:Solution: 47788167 | CodeChef

Someone pls help identify why i am getting WA in this,I tried a lot but although i tried with the test data+ i tried corner cases,yet it still continued giving me WA.

Will appreciate if someone helps me out with this. :slight_smile: