#include #include #include using namespace std; using namespace atcoder; long long curn; long long op(long long a,long long b) {return a+b;} long long e() {return 0;} long long mapping(long long F,long long x){return F*x;} long long comp(long long F,long long G){return F*G;} long long id() {return 1;} long long chk(long long x){ return x<=curn;} int main(){ long long n,q; cin>>n>>q; vector a(n),init(n,1),csum(n+1,0); for(long long i=0;i>a[i],csum[i+1]=csum[i]+a[i]; lazy_segtree seg(init); long long t,l,r; for(long long 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<