func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     long long int n, f, a, b;     vector<pair<long long int, long long int> > v;     cin >> n >> f;     int i;     for (i = 0; i < n; i++) {       cin >> a >> b;       v.push_back(make_pair(a, b));     }     long long int ans = 0;     vector<long long int> t;     for (i = 0; i < n; i++) {       ans = ans + min(v[i].first, v[i].second);       long long int mins =           min(v[i].first * 2, v[i].second) - min(v[i].first, v[i].second);       t.push_back(mins);     }     sort(t.begin(), t.end());     for (i = n - 1; i >= 0; i--) {       if (t[i] > 0 && f != 0) {         ans = ans + t[i];         f--;       }       if (f == 0) break;     }     cout << ans;   }   