#include #include #include using namespace std; using namespace atcoder; int curn; int op(int a,int b) {return a+b;} int e() {return 0;} int mapping(int F,int x){return F*x;} int comp(int F,int G){return F*G;} int id() {return 1;} int chk(int x){ return x<=curn;} int main(){ int n,q; cin>>n>>q; vector a(n),init(n,1),csum(n+1,0); for(int i=0;i>a[i],csum[i+1]=csum[i]+a[i]; lazy_segtree seg(init); int t,l,r; for(int i=0;i>t>>l>>r; curn=seg.all_prod()-l; l=seg.min_left(n,chk);l--; curn=seg.all_prod()-r; r=seg.min_left(n,chk); if(t==1){ seg.apply(l,r,0); seg.set(l,1); }else{ cout<