help in lr queries

can anyone tell me where i am wrong
solution link -https://www.codechef.com/viewsolution/16551151