func_code_string: #include <bits/stdc++.h>   using namespace std;   class BIT {     vector<int> tree;       public:     BIT(int n) : tree(n + 1, 0) {}     BIT(const vector<int>& Arg) {       tree.resize(Arg.size());       for (int i = 0; i < tree.size(); i++) increase(i, Arg[i]);     }     void increase(int i, int delta) {       for (; i < (int)tree.size(); i |= i + 1) tree[i] += delta;     }     int getsum(int left, int right) { return sum(right) - sum(left - 1); }     int sum(int ind) {       int sum = 0;       while (ind >= 0) {         sum += tree[ind];         ind &= ind + 1;         ind--;       }       return sum;     }   };   int main(int argc, char const* argv[]) {     int n, k, a, b, q;     scanf( %d %d , &n, &k);     scanf( %d %d , &a, &b);     scanf( %d , &q);     BIT bita(n + 10);     BIT bitb(n + 10);     for (int i = 0; i < q; i += 1) {       int op;       scanf( %d , &op);       if (op == 1) {         int di, ai;         scanf( %d %d , &di, &ai);         bitb.increase(di, min(b, ai));         bita.increase(di, min(a, ai));         int sb = bitb.getsum(di, di);         int sa = bita.getsum(di, di);         if (sb > b) bitb.increase(di, b - sb);         if (sa > a) bita.increase(di, a - sa);       } else {         int p;         scanf( %d , &p);         int nxt = p + k;         int s = 0;         if (p > 1) s += bitb.getsum(1, p - 1);         if (nxt <= n) s += bita.getsum(nxt, n);         printf( %d n , s);       }     }     return 0;   }   