Jppppp @ 2022-03-16 16:34:11
qwq
#include<bits/stdc++.h>
#include<cstdlib>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/hash_policy.hpp>
#define For(i,a,b) for(int i(a);i<=b;++i)
#define int long long
using namespace std;
using namespace __gnu_pbds;
inline void read(int &x){
bool w=0; char ch;x=0; ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')w=1; ch=getchar();}
while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
if(w)x=-1*x;
}
inline void print(int x){
if(x<0){putchar('-');print(-x);return ;}
if(x>9)print(x/10); putchar(x%10+'0');
}
tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> T;
int n,m,k,ans,opt,ls=0,qwq=0,nown;
signed main(){
read(n);read(m);
For(i,1,n){
read(k);T.insert((k<<20ull)+i);
}
nown=n;
For(i,1+n,m+n){
read(opt);read(k);
k^=ans;
// cout<<"!"<<k<<endl;
if(opt==1)T.insert((k<<20)+i),nown++;
if(opt==2)T.erase(T.lower_bound(k<<20)),nown--;
if(opt==3)ans=T.order_of_key(k<<20)+1,qwq^=ans;;
if(opt==4)ans=*T.find_by_order(k-1),ans=(ans>>20),qwq^=ans;
if(opt==5)ans=*--T.lower_bound(k<<20),ans=(ans>>20),qwq^=ans;
if(opt==6)ans=*T.upper_bound((k<<20)+n+m),ans=(ans>>20),qwq^=ans;
// if(opt>=3){
// cout<<"!"<<ans<<endl;
// }
}
print(qwq);
}