https://www.codechef.com/LRNDSA02/problems/ZCO12001

https://www.codechef.com/viewsolution/35762178
can anyone explain why this is giving WA. It is passing sample test cases.