树状数组
#include<bits/stdc++.h>
using namespace std;
int x,y,c[200005];
char str[20];
int inline read(){
int x=0,f=1;
char ch=getchar();
while(ch<‘0‘||ch>‘9‘)
ch=getchar();
while(ch>=‘0‘&&ch<=‘9‘){
x=x*10+ch-‘0‘;
ch=getchar();
}
return x*f;
}
inline void add(int x,int y){
while (x<=20005){
c[x]^=y;
x+=x&-x;
}
return;
}
inline int ask(int x){
int sum=0;
while (x){
sum^=c[x];
x-=x&-x;
}
return sum;
}
int main(){
while (~scanf("%s",str)){
if (str[0]==‘A‘||str[0]==‘R‘){
x=read();
add(x,x);
}
else if (str[0]==‘X‘){
x=read();
y=read();
if (x>y)
printf("0\n");
else
printf("%d\n",ask(x-1)^ask(y));
}
else return 0;
scanf("\n");
}
return 0;
}