func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MOD = 1000000007;   const int INF = 1000000001;   const long long int LLINF = 1000000000000000001LL;   struct ITree {     vector<long long int> T;     int p = 1;     ITree(int n) {       while (p < n) p *= 2;       T.resize(2 * p - 1, 0);     }     int par(int x) { return (x - 1) / 2; }     void Set(int l, long long int v) {       l += p - 1;       T[l] = v;       while (l > 0) {         l = par(l);         T[l] = T[2 * l + 1] + T[2 * l + 2];       }     }     long long int Query(int l, int r) {       l += p - 1;       r += p - 1;       long long int ans = T[l];       if (l < r) ans += T[r];       while (par(l) != par(r)) {         if (l % 2 == 1) ans += T[l + 1];         if (r % 2 == 0) ans += T[r - 1];         l = par(l);         r = par(r);       }       return ans;     }   };   int main() {     ios_base::sync_with_stdio(0);     int n, k, a, b, q;     cin >> n >> k >> a >> b >> q;     ITree treeA(n), treeB(n);     vector<long long int> A(n, 0);     while (q--) {       int type;       cin >> type;       if (type == 1) {         int day, add;         cin >> day >> add;         day--;         A[day] += add;         treeB.Set(day, min((long long int)b, A[day]));         treeA.Set(day, min((long long int)a, A[day]));       } else {         int l;         cin >> l;         l--;         int r = l + k - 1;         long long int ans = 0;         if (l > 0) ans += treeB.Query(0, l - 1);         if (r < n - 1) ans += treeA.Query(r + 1, n - 1);         cout << ans <<   n ;       }     }     return 0;   }   