Please explain me the code and logic. I am unable to come with solution
Please see this link https://discuss.codechef.com/t/chefadd-editorial/20550