here is the link to the problem -
https://www.codechef.com/MARCH20B/problems/ADASHOP2

I would appreciate if someone gives me the code for this problem along with explanation. Thank you.