At coder problem


I am not being able to solve this question even after seing the editorial ,please help