Given NNN items each with weight wiw_iwi and value viv_ivi, and a knapsack capacity WWW, find the maximum total value achievable.
First line: NNN WWW. Next NNN lines: wiw_iwi viv_ivi.
Maximum total value.
1≤N≤1031 \le N \le 10^31≤N≤103, 1≤W≤1051 \le W \le 10^51≤W≤105
4 7 1 1 3 4 4 5 5 7
9
Take items 2 and 3 for total value 4+5=94 + 5 = 94+5=9