manage the inventory , need help

https://www.codechef.com/EYRC2021/problems/INV_PY