func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long N = 100010, M = 100010, inf = 1e18;   long long m, n, p, d[N], a[M], f[M], sum[M], g[M], x[M], y[M];   inline long long read() {     char ch = getchar();     long long as = 0, f = 1;     for (; ch <  0  || ch >  9 ; ch = getchar())       if (ch ==  - ) f = -1;     for (; ch >=  0  && ch <=  9 ; ch = getchar()) as = as * 10 + ch -  0 ;     return as;   }   long long q[M << 1], l, r;   long long as = inf;   int main() {     long long h, t;     n = read();     m = read();     p = read();     for (long long i = 1; i < n; i++) d[i] = read();     for (long long i = n - 2; i; i--) d[i] += d[i + 1];     for (long long i = 1; i <= m; i++) {       h = read();       t = read();       a[i] = t + d[h];     }     sort(a + 1, a + m + 1);     for (long long i = 1; i <= m; i++) sum[i] = sum[i - 1] + a[i], f[i] = inf;     for (long long i = 1; i <= p; i++) {       memcpy(g, f, sizeof(g));       l = M;       r = M;       for (long long j = 0; j <= m; j++) y[j] = g[j] + sum[j];       q[r] = 0;       for (long long j = 1; j <= m; j++) {         while (r > l)           if ((y[q[l + 1]] - y[q[l]]) <= a[j] * (q[l + 1] - q[l]))             l++;           else             break;         f[j] = min(g[j], -a[j] * q[l] + y[q[l]] + a[j] * j - sum[j]);         while (r > l)           if ((y[q[r]] - y[q[r - 1]]) * (j - q[r]) >=               (y[j] - y[q[r]]) * (q[r] - q[r - 1]))             r--;           else             break;         r++;         q[r] = j;       }       as = min(as, f[m]);     }     printf( %lld , as);     return 0;   }   