func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 2e5 + 5;   const int inf = 1e9 + 7;   long long n, m, k, w;   long long dp1[maxn];   long long dp2[maxn];   int d1[maxn];   int d2[maxn];   long long a, b;   inline int low_bit(int x) { return x & (-x); }   inline void upd1(int p, int x) {     while (p <= n) {       dp1[p] += x;       p += low_bit(p);     }     return;   }   inline void upd2(int p, int x) {     while (p <= n) {       dp2[p] += x;       p += low_bit(p);     }     return;   }   inline int query1(int p) {     int sum = 0;     while (p > 0) {       sum += dp1[p];       p -= low_bit(p);     }     return sum;   }   inline int query2(int p) {     int sum = 0;     while (p > 0) {       sum += dp2[p];       p -= low_bit(p);     }     return sum;   }   inline int query(int p) {     return query1(p - 1) + query2(n) - query2(p + k - 1);   }   int main() {     long long ans = 0;     cin >> n >> k >> a >> b >> m;     for (int i = 1; i <= m; i++) {       int op;       scanf( %d , &op);       if (op == 1) {         int x, y;         scanf( %d%d , &x, &y);         int p1 = d1[x];         int p2 = d2[x];         int to1 = 0, to2 = 0;         to1 = b - p1;         to2 = a - p2;         upd1(x, y > to1 ? to1 : y);         upd2(x, y > to2 ? to2 : y);         d1[x] += y > to1 ? to1 : y;         d2[x] += y > to2 ? to2 : y;       } else {         int x;         scanf( %d , &x);         cout << query(x) << endl;       }     }     return 0;   }   