func_code_string: #include <bits/stdc++.h>   using namespace std;   long long n, m, p;   int q[100010];   long long f[106][100010], D[100010], sum[100010], A[100010], g[100010];   int main() {     scanf( %lld %lld %lld , &n, &m, &p);     for (int i = 2; i <= n; i++) scanf( %lld , &D[i]), D[i] += D[i - 1];     long long H, T;     for (int i = 1; i <= m; i++) {       scanf( %lld %lld , &H, &T);       A[i] = T - D[H];     }     sort(A + 1, A + 1 + m);     for (int i = 1; i <= m; i++) sum[i] = A[i] + sum[i - 1];     memset(f, 0x3f, sizeof(f));     f[0][0] = 0;     for (int i = 1; i <= p; i++) {       int l = 1, r = 1;       q[1] = 0;       for (int j = 1; j <= m; j++) g[j] = f[i - 1][j] + sum[j];       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]) - sum[j]);         if (g[j] >= 0x3f3f3f3f3f3f3f3fll) continue;         while (l < r && (g[j] - g[q[r]]) * (q[r] - q[r - 1]) <=                             (g[q[r]] - g[q[r - 1]]) * (j - q[r]))           r--;         q[++r] = j;       }     }     cout << f[p][m] << endl;     return 0;   }   