Implement prototype(items: list[tuple[int, int]], capacity: int) -> int and solve with the same signature. Each tuple is (weight, value) with positive integer weight and nonnegative integer value. Capacity is a nonnegative integer. Return the maximum total value with each item used at most once; unused capacity and an empty selection are allowed. Duplicate tuples represent separate items.
Examples: ([(2,3),(3,4),(4,5)], 6) returns 8; ([(2,3)], 4) returns 3.
Raise ValueError for negative capacity, nonpositive weight, or negative value. Prototype: enumerate subsets. Final: use O(nC) DP time and O(C) auxiliary space with dependency-safe updates. Preserve inputs, including on failure.
Complete the starter code, then run the checks.
Results and errors will appear here.