Codechef long challange div 2 question 4(aug)

https://www.codechef.com/viewsolution/36543301

can anyone tell me why i’m got WA in this code.

still i am not getting my ans anyone here who can help to solve this.