def maximize_priority(W, packages):
dp = [0] * (W + 1)
for weight, value in packages:
for w in range(W, weight - 1, -1):
dp[w] = max(dp[w], dp[w - weight] + value)
return dp[W]
W = 50
packages = [(10, 60), (20, 100), (30, 120)]
print(maximize_priority(W, packages))
To embed this project on your website, copy the following code and paste it into your website's HTML: