Help with SPOJ ORDERS
I am not getting the logic to solve this. Please explain . Problem link- https://www.spoj.com/problems/ORDERS/
CF Edu Round 195 Solution Discussion