AT_awc0003_c 特売セールの選択
Description
Takahashi will purchase all $ N $ items, one of each.
Each item has two prices: a "regular price" and a "sale price." The regular price of item $ i $ $ (1 \leq i \leq N) $ is $ A_i $ yen, and the sale price is $ B_i $ yen. It is guaranteed that the sale price is at most the regular price, that is, $ B_i \leq A_i $ .
Takahashi has one special discount coupon. With this coupon, he can choose **at most $ K $** items from the $ N $ items and purchase the chosen items at their sale prices. The remaining items that are not chosen will be purchased at their regular prices. Note that the same item cannot be chosen more than once, and it is also allowed to choose no items (i.e., choose $ 0 $ items).
When Takahashi optimally chooses which items to purchase at the sale price, find the minimum possible total cost of purchasing all $ N $ items.
Input Format
> $ N $ $ K $ $ A_1 $ $ B_1 $ $ A_2 $ $ B_2 $ $ \vdots $ $ A_N $ $ B_N $
- The first line contains an integer $ N $ representing the number of items and an integer $ K $ representing the maximum number of items that can be purchased at the sale price, separated by a space.
- The following $ N $ lines each contain, for the $ i $ -th line $ (1 \leq i \leq N) $ , the regular price $ A_i $ and the sale price $ B_i $ of item $ i $ , separated by a space.
Output Format
Print the minimum possible total cost of purchasing all $ N $ items as an integer on a single line. Note that the answer may not fit within a $ 32 $ -bit integer.
Explanation/Hint
### Constraints
- $ 1 \leq N \leq 2 \times 10^5 $
- $ 0 \leq K \leq N $
- $ 1 \leq B_i \leq A_i \leq 10^9 $
- All input values are integers.