func_code_string: #include <bits/stdc++.h>   using namespace std;   int A[200005];   int lazy[600005], ma[600005], mi[600005];   long long sum[600005];   void push_up(int cur) {     sum[cur] = sum[cur * 2] + sum[cur * 2 + 1];     ma[cur] = max(ma[cur * 2], ma[cur * 2 + 1]);     mi[cur] = min(mi[cur * 2], mi[cur * 2 + 1]);   }   void push_down(int cur, int l, int r) {     if (lazy[cur] == 0) return;     int mid = (l + r) / 2;     sum[cur * 2] = (lazy[cur] * 1ll * (mid - l + 1));     ma[cur * 2] = mi[cur * 2] = lazy[cur];     lazy[cur * 2] = lazy[cur];     sum[cur * 2 + 1] = (lazy[cur] * 1ll * (r - mid));     ma[cur * 2 + 1] = mi[cur * 2 + 1] = lazy[cur];     lazy[cur * 2 + 1] = lazy[cur];     lazy[cur] = 0;   }   int __ma;   void build(int cur, int l, int r) {     lazy[cur] = 0;     __ma = max(__ma, cur);     if (l == r) {       sum[cur] = mi[cur] = ma[cur] = A[r];       return;     }     int mid = (l + r) / 2;     build(cur * 2, l, mid);     build(cur * 2 + 1, mid + 1, r);     push_up(cur);   }   void modify_toMax(int cur, int l, int r, int cl, int cr, int Ma) {     if (mi[cur] >= Ma) return;     if (l >= cl && r <= cr) {       if (ma[cur] <= Ma) {         ma[cur] = mi[cur] = Ma;         sum[cur] = Ma * 1ll * (r - l + 1);         lazy[cur] = Ma;         return;       }     }     push_down(cur, l, r);     int mid = (l + r) / 2;     if (cl <= mid) modify_toMax(cur * 2, l, mid, cl, cr, Ma);     if (cr > mid) modify_toMax(cur * 2 + 1, mid + 1, r, cl, cr, Ma);     push_up(cur);   }   long long query_sum(int cur, int l, int r, int cl, int cr) {     if (l >= cl && r <= cr) return sum[cur];     push_down(cur, l, r);     int mid = (l + r) / 2;     long long ans = 0;     if (cl <= mid) ans += query_sum(cur * 2, l, mid, cl, cr);     if (cr > mid) ans += query_sum(cur * 2 + 1, mid + 1, r, cl, cr);     return ans;   }   int query_firSmallInd(int cur, int l, int r, int cl, int cr, int Ma) {     if (mi[cur] > Ma) return -1;     if (l == r) {       if (ma[cur] <= Ma) return r;       return -1;     }     push_down(cur, l, r);     int mid = (l + r) / 2;     if (cl <= mid) {       int ind = query_firSmallInd(cur * 2, l, mid, cl, cr, Ma);       if (ind != -1) return ind;     }     if (cr > mid) return query_firSmallInd(cur * 2 + 1, mid + 1, r, cl, cr, Ma);     return -1;   }   int query_maxPresum(int cur, int l, int r, long long Ma) {     if (l == r) {       if (ma[cur] <= Ma) return r + 1;       return r;     }     push_down(cur, l, r);     int mid = (l + r) / 2;     if (sum[cur * 2] <= Ma)       return query_maxPresum(cur * 2 + 1, mid + 1, r, Ma - sum[cur * 2]);     return query_maxPresum(cur * 2, l, mid, Ma);   }   int main() {     int n, m;     scanf( %d%d , &n, &m);     for (int i = 1; i <= n; i += 1) scanf( %d , &A[i]);     build(1, 1, n);     int a, b, c;     for (int i = 1; i <= m; i += 1) {       scanf( %d%d%d , &a, &b, &c);       if (a == 1) {         modify_toMax(1, 1, n, 1, b, c);       } else {         int lef, rig, cur_ind = b, ans = 0;         while (cur_ind <= n) {           lef = query_firSmallInd(1, 1, n, cur_ind, n, c);           if (lef == -1) break;           long long pre = 0;           if (lef > 1) pre = query_sum(1, 1, n, 1, lef - 1);           rig = query_maxPresum(1, 1, n, pre + c);           --rig;           c -= query_sum(1, 1, n, lef, rig);           ans += (rig - lef + 1);           cur_ind = rig + 2;         }         printf( %d n , ans);       }     }     return 0;   }   