func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     vector<pair<long long, long long> > f(n);     for (int i = 0; i < n; ++i) cin >> f[i].first >> f[i].second;     sort(f.begin(), f.end());     vector<long long> v(n);     v[n - 1] = f[n - 1].second;     for (int i = n - 2; i >= 0; --i) {       v[i] = v[i + 1];       long long mn = 0;       for (int j = i + 2; j < n; ++j) {         mn += f[j - 1].first - f[i].first;         if (mn + v[j] < v[i]) v[i] = mn + v[j];       }       if (mn + f[n - 1].first - f[i].first < v[i])         v[i] = mn + f[n - 1].first - f[i].first;       v[i] += f[i].second;     }     cout << v[0];   }   