You have a backpack that can carry a maximum weight of . You will also be given a set of items, their weights and their values.
Determine the maximum total value of items that you can carry in your backpack.
The input will start with two integers: (), the number of items, and () the capacity of your backpack.
The next lines will each contain a pair of integers: (), the weight of item , and () the value of item .
Print the maximum total value of items that you can carry in your backpack.
3 5 3 1 2 1 2 2
You can take the 2nd and the 3rd items. Their combined weight is 4 (less than the capacity, 5) and their total value is 3.