Can someone explain how to solve this problem .
problem link https://www.codechef.com/LOCJUN17/problems/PRATABHI
refer this -https://discuss.codechef.com/questions/104044/solution-for-pratabhi-loc-jun-17