#include using namespace std; #define ALL(x) x.begin(),x.end() #define rep(i,n) for(int i=0;i<(n);i++) #define debug(v) cout<<#v<<":";for(auto x:v){cout<bool chmax(T &a,const T &b){if(abool chmin(T &a,const T &b){if(b struct SegmentTree{ using F=function; int sz; vector seg; const F f; const Monoid gen; SegmentTree(int n,const F f,const Monoid &gen):f(f),gen(gen){ sz=1; while(sz0;k--) seg[k]=f(seg[2*k],seg[2*k+1]); } void update(int k,const Monoid &x){ k+=sz; seg[k]=x; while(k>>=1) seg[k]=f(seg[2*k],seg[2*k+1]); } // [a,b) Monoid query(int a,int b){ Monoid L=gen,R=gen; for(a+=sz,b+=sz;a>=1,b>>=1){ if(a&1) L=f(L,seg[a++]); if(b&1) R=f(seg[--b],R); } return f(L,R); } Monoid operator[](const int &k)const { return seg[k+sz]; } }; signed main(){ cin.tie(0); ios::sync_with_stdio(0); int n,q;cin>>n>>q; vector a(n),b(n-1); rep(i,n) cin>>a[i]; rep(i,n-1){ b[i]=a[i]-a[i+1]; } SegmentTree seg(n-1,[](int a,int b){return a+b;},0); rep(i,n-1){ if(b[i]==0) seg.set(i,0); else seg.set(i,1); } seg.build(); while(q--){ int type;cin>>type; if(type==1){ int l,r;ll x;cin>>l>>r>>x;l--,r--; if(l){ ll re=b[l-1]-x; if(re==0 and b[l-1]!=0) seg.update(l-1,0); if(re!=0 and b[l-1]==0) seg.update(l-1,1); b[l-1]=re; } if(r>l>>r;l--,r--; cout<