func_code_string: #include <bits/stdc++.h>   const long long int maxn = 2e7 + 5;   const long long mod = 1e9 + 7;   using namespace std;   long long int power(long long int a, long long int b) {     long long int res = 1;     while (b > 0) {       if (b % 2 == 1) res = res * a;       a = a * a;       b = b / 2;     }     return res;   }   long long po(long long x, long long y) {     long long res = 1;     x = x % mod;     while (y > 0) {       if (y & 1) res = ((res % mod) * (x % mod)) % mod;       y = y >> 1;       x = ((x % mod) * (x % mod)) % mod;     }     return res;   }   int dp[3001][3001];   int n;   vector<pair<long long int, long long int> > p(3001);   int fun(int i, int pp) {     if (i >= n) return 0;     if (dp[i][pp] != -1) return dp[i][pp];     return dp[i][pp] = min(p[i].second + fun(i + 1, i),                            abs(p[i].first - p[pp].first) + fun(i + 1, pp));   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     int t = 1;     while (t--) {       memset(dp, -1, sizeof(dp));       cin >> n;       for (int i = 0; i < n; i++) cin >> p[i].first >> p[i].second;       p.resize(n);       sort((p).begin(), (p).end());       cout << p[0].second + fun(1, 0) <<   n ;     }   }   