func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 100000 + 10;   const int maxm = 100 + 10;   const int inf = 0x3f;   long long f[maxm][maxn], D[maxn], H[maxn], T[maxn], q[maxn];   long long g[maxn];   int N, M, P;   long long A[maxn], S[maxn];   void init() {     sort(A + 1, A + 1 + M);     for (int i = (1); i <= (M); i++) {       S[i] = S[i - 1] + A[i];     }     memset(f, inf, sizeof(f));     memset(g, 0, sizeof(g));     memset(q, 0, sizeof(q));     f[0][0] = 0;   }   void solve() {     for (int i = (1); i <= (P); i++) {       for (int k = (1); k <= (M); k++) g[k] = f[i - 1][k] + S[k];       int l = 1, r = 1;       q[1] = 0;       for (int j = (1); j <= (M); j++) {         while (l < r && (g[q[l + 1]] - g[q[l]]) <= (A[j] * (q[l + 1] - q[l])))           l++;         f[i][j] = min(f[i - 1][j], g[q[l]] + A[j] * (j - q[l]) - S[j]);         while (l < r && ((g[q[r]] - g[q[r - 1]]) * (j - q[r]) >=                          (g[j] - g[q[r]]) * (q[r] - q[r - 1])))           r--;         q[++r] = j;       }     }     cout << f[P][M] << endl;   }   int main() {     cin >> N >> M >> P;     for (int i = (2); i <= (N); i++) {       int x;       scanf( %d , &x);       D[i] = D[i - 1] + x;     }     for (int i = (1); i <= (M); i++) {       int h, t;       scanf( %d%d , &h, &t);       A[i] = t - D[h];     }     init();     solve();   }   