Problem
You have piles of stones, where piles[i] is the size of pile i. You must do exactly `k` operations. In one operation, pick any pile and remove floor(pile / 2) stones from it. You may pick the same pile more than once.
Return the minimum possible total number of stones left after k operations.
Example 1
- Input
- piles = [5, 4, 9], k = 2
- Output
- 12
Example 2
- Input
- piles = [4, 3, 6, 7], k = 3
- Output
- 12
In the first example, halve the 9 (remove 4, leaving 5), then halve one of the 5s (remove 2, leaving 3): 3 + 4 + 5 = 12.
Constraints
1 <= piles.length <= 10^51 <= piles[i] <= 10^41 <= k <= 10^5