func_code_string: #include <bits/stdc++.h>   using namespace std;   const int M = 100000 + 10;   int d[M];   long long int pred[M];   long long int a[M];   long long int dp[110][M];   long long int pres[M];   long long int dq[M];   long long int yk(int i, int k) {     long long int val = dp[i][k] + pres[k];     return val;   }   int main() {     int n, m, p;     cin >> n >> m >> p;     for (int i = 2; i <= n; i++) {       cin >> d[i];       pred[i] = pred[i - 1] + d[i];     }     for (int i = 1; i <= m; i++) {       int h, t;       cin >> h >> t;       int val = t - pred[h];       a[i] = val;     }     sort(a + 1, a + m + 1);     for (int i = 1; i <= m; i++) {       pres[i] = pres[i - 1] + a[i];     }     for (int i = 1; i <= m; i++) {       dp[1][i] = (i - 0) * a[i] - (pres[i] - pres[0]);     }     for (int i = 2; i <= p; i++) {       int s = 0;       int t = 0;       for (int j = 1; j <= m; j++) {         while ((t - s) >= 2 &&                (yk(i - 1, dq[t - 1]) - yk(i - 1, dq[t - 2])) * (j - dq[t - 1]) >                    (yk(i - 1, j) - yk(i - 1, dq[t - 1])) *                        (dq[t - 1] - dq[t - 2])) {           t--;         }         dq[t] = j;         t++;         while ((t - s) >= 2 &&                dp[i - 1][dq[s]] - dq[s] * a[j] + pres[dq[s]] >                    dp[i - 1][dq[s + 1]] - dq[s + 1] * a[j] + pres[dq[s + 1]]) {           s++;         }         dp[i][j] =             dp[i - 1][dq[s]] + (j - dq[s]) * a[j] - (pres[j] - pres[dq[s]]);       }     }     cout << dp[p][m] << endl;     return 0;   }   