func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAXN = 2e5 + 3;   struct tree {     int l, r, minn, lazy;     long long sum;   } tre[MAXN << 2];   int n, m;   long long a[MAXN];   void build(int i, int l, int r) {     tre[i].l = l, tre[i].r = r;     tre[i].lazy = 0;     if (l == r) {       tre[i].minn = a[l];       tre[i].sum = a[l];       return;     }     int mid = l + r >> 1;     build(i << 1, l, mid);     build(i << 1 | 1, mid + 1, r);     tre[i].minn = min(tre[i << 1].minn, tre[i << 1 | 1].minn);     tre[i].sum = tre[i << 1].sum + tre[i << 1 | 1].sum;   }   void pushdown(int i) {     if (tre[i].lazy) {       tre[i << 1].minn = tre[i].lazy, tre[i << 1 | 1].minn = tre[i].lazy;       tre[i << 1].lazy = tre[i << 1 | 1].lazy = tre[i].lazy;       tre[i << 1].sum = 1ll * (tre[i << 1].r - tre[i << 1].l + 1) * tre[i].lazy;       tre[i << 1 | 1].sum =           1ll * (tre[i << 1 | 1].r - tre[i << 1 | 1].l + 1) * tre[i].lazy;       tre[i].lazy = 0;     }   }   int find_(int i, int l, int r, long long x) {     if (tre[i].l >= l && tre[i].r <= r) {       if (tre[i].minn > x) return 0;       if (tre[i].l == tre[i].r) {         if (tre[i].minn <= x) return tre[i].r;         return 0;       }       pushdown(i);       tre[i].minn = min(tre[i << 1].minn, tre[i << 1 | 1].minn);       tre[i].sum = tre[i << 1].sum + tre[i << 1 | 1].sum;       if (tre[i << 1].minn > x) return find_(i << 1 | 1, l, r, x);       return find_(i << 1, l, r, x);     }     if (tre[i].l == tre[i].r) return 0;     pushdown(i);     int ans = 0;     if (tre[i << 1].r >= l) ans = find_(i << 1, l, r, x);     if (!ans && tre[i << 1 | 1].l <= r) {       ans = find_(i << 1 | 1, l, r, x);     }     tre[i].minn = min(tre[i << 1].minn, tre[i << 1 | 1].minn);     tre[i].sum = tre[i << 1].sum + tre[i << 1 | 1].sum;     return ans;   }   void modify(int i, int l, int r, int delta) {     if (tre[i].l > r || tre[i].r < l) return;     if (tre[i].l >= l && tre[i].r <= r) {       tre[i].lazy = delta;       tre[i].minn = delta;       tre[i].sum = 1ll * (tre[i].r - tre[i].l + 1) * delta;       return;     }     pushdown(i);     modify(i << 1, l, r, delta);     modify(i << 1 | 1, l, r, delta);     tre[i].minn = min(tre[i << 1].minn, tre[i << 1 | 1].minn);     tre[i].sum = tre[i << 1].sum + tre[i << 1 | 1].sum;   }   bool flag;   void que(int i, long long &delta, int &tot) {     if (tre[i].l == tre[i].r) {       if (delta >= tre[i].sum) tot = max(tot, tre[i].r), delta -= tre[i].sum;       return;     }     pushdown(i);     tre[i].minn = min(tre[i << 1].minn, tre[i << 1 | 1].minn);     tre[i].sum = tre[i << 1].sum + tre[i << 1 | 1].sum;     if (tre[i << 1].sum <= delta) {       tot = max(tot, tre[i << 1].r);       delta -= tre[i << 1].sum;       que(i << 1 | 1, delta, tot);     } else {       que(i << 1, delta, tot);     }   }   void query(int i, int l, int r, long long &delta, int &tot) {     if (tre[i].l > r || tre[i].r < l || flag) return;     if (tre[i].l >= l && tre[i].r <= r) {       if (tre[i].sum <= delta) {         tot = max(tre[i].r, tot);         delta -= tre[i].sum;         return;       }       if (tre[i].l == tre[i].r) {         if (tre[i].sum <= delta) {           tot = max(tot, tre[i].r), delta -= tre[i].sum;         } else           flag = 1;         return;       }       flag = 1;       que(i, delta, tot);       pushdown(i);       tre[i].minn = min(tre[i << 1].minn, tre[i << 1 | 1].minn);       tre[i].sum = tre[i << 1].sum + tre[i << 1 | 1].sum;       return;     }     pushdown(i);     tre[i].minn = min(tre[i << 1].minn, tre[i << 1 | 1].minn);     tre[i].sum = tre[i << 1].sum + tre[i << 1 | 1].sum;     query(i << 1, l, r, delta, tot);     query(i << 1 | 1, l, r, delta, tot);   }   int main() {     scanf( %d%d , &n, &m);     for (int i = 1; i <= n; i++) scanf( %lld , &a[i]);     build(1, 1, n);     for (int i = 1; i <= m; i++) {       int x, op;       long long y;       scanf( %d%d%lld , &op, &x, &y);       if (op == 1) {         int tot = find_(1, 1, x, y);         if (!tot) continue;         modify(1, tot, x, y);       } else {         int an = 0;         while (x <= n) {           int tot = find_(1, x, n, y);           int tot1 = 0;           flag = 0;           query(1, tot, n, y, tot1);           if (tot == 0 || tot1 == 0) break;           an += tot1 - tot + 1, x = tot1 + 1;         }         printf( %d n , an);       }     }   }   