AdvancedRating 1500
0/1 Knapsack
Items have weight and value; take each at most once. Maximise value with capacity W (W ≤ 10⁴).
Input
n W, then n lines 'weight value'.
Output
A number.
Sample 1
Input
3 50 10 60 20 100 30 120
Output
220
Sample 2
Input
1 5 10 10
Output
0
Output appears here