func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, k, a, b, q, d, ai, p, t, zb[200001], suma[800005], sumb[800005],       za[200001], res;   void build1(int a[], int v, int tl, int tr) {     if (tl == tr)       suma[v] = a[tl];     else {       int tm = (tl + tr) / 2;       build1(a, v * 2, tl, tm);       build1(a, v * 2 + 1, tm + 1, tr);       suma[v] = suma[v * 2] + suma[v * 2 + 1];     }   }   void build2(int a[], int v, int tl, int tr) {     if (tl == tr)       sumb[v] = a[tl];     else {       int tm = (tl + tr) / 2;       build2(a, v * 2, tl, tm);       build2(a, v * 2 + 1, tm + 1, tr);       sumb[v] = sumb[v * 2] + sumb[v * 2 + 1];     }   }   int sum1(int v, int tl, int tr, int l, int r) {     if (l > r) return 0;     if (l == tl && r == tr) return suma[v];     int tm = (tl + tr) / 2;     return sum1(v * 2, tl, tm, l, min(r, tm)) +            sum1(v * 2 + 1, tm + 1, tr, max(l, tm + 1), r);   }   int sum2(int v, int tl, int tr, int l, int r) {     if (l > r) return 0;     if (l == tl && r == tr) return sumb[v];     int tm = (tl + tr) / 2;     return sum2(v * 2, tl, tm, l, min(r, tm)) +            sum2(v * 2 + 1, tm + 1, tr, max(l, tm + 1), r);   }   void update1(int v, int tl, int tr, int pos, long long new_val) {     if (tl == tr)       suma[v] = new_val;     else {       int tm = (tl + tr) / 2;       if (pos <= tm)         update1(v * 2, tl, tm, pos, new_val);       else         update1(v * 2 + 1, tm + 1, tr, pos, new_val);       suma[v] = suma[v * 2] + suma[v * 2 + 1];     }   }   void update2(int v, int tl, int tr, int pos, long long new_val) {     if (tl == tr)       sumb[v] = new_val;     else {       int tm = (tl + tr) / 2;       if (pos <= tm)         update2(v * 2, tl, tm, pos, new_val);       else         update2(v * 2 + 1, tm + 1, tr, pos, new_val);       sumb[v] = sumb[v * 2] + sumb[v * 2 + 1];     }   }   int main() {     scanf( %d %d %d %d %d , &n, &k, &b, &a, &q);     for (int i = 0; i < n; i++) zb[i] = b;     for (int i = 0; i < n; i++) za[i] = a;     build1(za, 1, 0, n - 1);     build2(zb, 1, 0, n - 1);     for (int i = 0; i < q; i++) {       scanf( %d , &t);       if (t == 1) {         scanf( %d %d , &d, &ai);         d--;         za[d] -= ai;         zb[d] -= ai;         if (za[d] < 0) za[d] = 0;         if (zb[d] < 0) zb[d] = 0;         update1(1, 0, n - 1, d, za[d]);         update2(1, 0, n - 1, d, zb[d]);       } else {         scanf( %d , &p);         p--;         int size1 = p;         int size2 = n - k - p;         res = 0;         int resa = 0, resb = 0;         resa -= sum1(1, 0, n - 1, 0, size1 - 1);         resa += size1 * a;         resb -= sum2(1, 0, n - 1, n - size2, n - 1);         resb += size2 * b;         printf( %d n , resa + resb);       }     }   }   