Maximum Total from Optimal Activation Order
Activate elements in any order, each allowed only while the active count is below its limit and each adding its value to the total. When the active count reaches x, every element with limit at most x is permanently deactivated, so choose the order that maximizes the total.