func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 105000;   const int M = 105;   int n, m, p;   long long hill[N];   long long a[N], s[N];   long long dp[N];   int top, tail;   long long duix[N], duiy[N];   int getint() {     char e = getchar();     int res = 0;     while (e <  0  || e >  9 ) e = getchar();     while ( 0  <= e && e <=  9 ) {       res = (res << 3) + (res << 1) + e -  0 ;       e = getchar();     }     return res;   }   int main() {     int i, j;     n = getint();     m = getint();     p = getint();     for (i = 2; i <= n; i++) hill[i] = getint();     for (i = 2; i <= n; i++) hill[i] += hill[i - 1];     for (i = 1; i <= m; i++) {       a[i] = -hill[getint()];       a[i] += getint();     }     sort(a + 1, a + m + 1);     for (i = 1; i <= m; i++) s[i] = a[i] + s[i - 1];     for (i = 1; i <= m; i++) dp[i] = i * a[i];     for (j = 2; j <= p; j++) {       top = 1;       tail = 0;       for (i = 1; i <= m; i++) {         long long nowx = i;         long long nowy = dp[i];         while (tail >= 2) {           double xla = duiy[tail] - duiy[tail - 1];           xla /= duix[tail] - duix[tail - 1];           double xlb = nowy - duiy[tail - 1];           xlb /= nowx - duix[tail - 1];           if (xla - xlb > -1e-10)             tail--;           else             break;         }         tail++;         duix[tail] = nowx;         duiy[tail] = nowy;       }       for (i = 1; i <= m; i++) {         dp[i] = duiy[top] - a[i] * duix[top];         while (top < tail && duix[top + 1] <= i) {           long long now = duiy[top + 1] - a[i] * duix[top + 1];           if (now <= dp[i]) {             top++;             dp[i] = now;           } else             break;         }         dp[i] += i * a[i];       }     }     printf( %I64d n , dp[m] - s[m]);     return 0;   }   