Backpack with masses (dynamic programming)

+1
PY
py
OUTPUT