func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 1e5 + 5, M = 1e5 + 5, P = 105;   int n, m, p;   long long d[N];   int h[M], t[M];   long long a[M], s[M];   long long f[P][M];   int q[M];   long long Y(int j, int k) { return f[j - 1][k] + s[k]; }   int32_t main() {     cin >> n >> m >> p;     for (int i = 2; i <= n; ++i) {       cin >> d[i];       d[i] += d[i - 1];     }     for (int i = 1; i <= m; ++i) {       cin >> h[i] >> t[i];       a[i] = t[i] - d[h[i]];     }     sort(a + 1, a + 1 + m);     for (int i = 1; i <= m; ++i) s[i] = s[i - 1] + a[i];     memset(f[0], 0x3f, sizeof f[0]);     f[0][0] = 0;     for (int j = 1; j <= p; ++j) {       int hh = 0, tt = 0;       q[0] = 0;       for (int i = 1; i <= m; ++i) {         while (hh < tt &&                (Y(j, q[hh + 1]) - Y(j, q[hh])) <= a[i] * (q[hh + 1] - q[hh]))           hh++;         int k = q[hh];         f[j][i] = f[j - 1][k] + a[i] * (i - k) - (s[i] - s[k]);         while (hh < tt && (Y(j, q[tt]) - Y(j, q[tt - 1])) * (i - q[tt]) >=                               (Y(j, i) - Y(j, q[tt])) * (q[tt] - q[tt - 1]))           tt--;         q[++tt] = i;       }     }     cout << f[p][m] << endl;     return 0;   }   