func_code_string: #include <bits/stdc++.h>   using namespace std;   const int inf = 1000000007;   const long long linf = 1000000000000000000LL;   const double eps = 0.000001;   const double pi = 3.14159265358979323846;   template <class T>   T abs(T k) {     return k >= 0 ? k : -k;   }   template <class T>   T sqr(T n) {     return n * n;   }   template <class T>   T gcd(T a, T b) {     return b ? gcd(b, a % b) : a;   }   template <class T>   T mod(T a, T b) {     return (a % b + b) % b;   }   template <class T>   T addmod(T a, T b, T c) {     return (T)((long long)(a + b) % c);   }   template <class T>   T mulmod(T a, T b, T c) {     return (T)((long long)a * b % c);   }   template <class T>   T powmod(T a, T b, T c) {     return (T)(b ? sqr((long long)powmod(a, b >> 1, c)) % c * (b & 1 ? a : 1) % c                  : 1);   }   template <class T>   void maxe(T &a, T b) {     a = max(a, b);   }   template <class T>   void mine(T &a, T b) {     a = min(a, b);   }   template <class T>   void mode(T &a, T b) {     a = mod(a, b);   }   template <class T>   void addmode(T &a, T b, T c) {     a = addmod(a, b, c);   }   template <class T>   void mulmode(T &a, T b, T c) {     a = mulmod(a, b, c);   }   template <class T>   void powmode(T &a, T b, T c) {     a = powmod(a, b, c);   }   void fileio_in_out() {     freopen( .in ,  r , stdin);     freopen( .out ,  w , stdout);   }   void fileio_txt() {     freopen( input.txt ,  r , stdin);     freopen( output.txt ,  w , stdout);   }   const int N = 111111;   int test;   int n, m, k;   long long ans;   long long d[N], h[N], t[N], s[N], st[N];   long long dp[111][N];   int q[N], head, tail;   long long f1(int i, int j, int k) { return dp[i][k] + st[k] - t[j] * k; }   long long f2(int i, int j, int k) {     return ((dp[i][j] + st[j]) - (dp[i][k] + st[k])) / (j - k);   }   long long getans() {     sort(t + 1, t + 1 + m);     for (int i = 1; i <= m; i++) {       st[i] = st[i - 1] + t[i];       dp[1][i] = t[i] * i - st[i];     }     for (int i = 2; i <= k; i++) {       head = tail = 0;       for (int j = 1; j <= m; j++) {         while (head < tail && f1(i - 1, j, q[head]) >= f1(i - 1, j, q[head + 1]))           head++;         while (head < tail &&                f2(i - 1, q[tail - 1], q[tail]) >= f2(i - 1, q[tail], j))           tail--;         dp[i][j] = t[j] * j - st[j] + f1(i - 1, j, q[head]);         q[++tail] = j;       }     }     return dp[k][m];   }   int main() {     scanf( %d%d%d , &n, &m, &k);     for (int i = 2; i <= n; i++) {       scanf( %I64d , &d[i]);       s[i] = s[i - 1] + d[i];     }     for (int i = 1; i <= m; i++) {       scanf( %I64d%I64d , &h[i], &t[i]);       t[i] -= s[h[i]];     }     ans = getans();     printf( %I64d n , ans);     return 0;   }   