敌兵布阵
using namespace std;
int c[100000],n;
int lowbit(int i)
{
return i&(-i);
}
int add(int j,int n1 )
{while(j<=n){
c[j]+=n1;
j=j+lowbit(j);}
return 0;}
int sum(int x)
{int s=0;
while(x>0)
{s+=c[x];
x-=lowbit(x);}
return s;
}
int main()
{
int t,i,j,x,y;
cin>>t;
for(i=0;i<t;i++)
{
memset(c, 0, sizeof(c));
cin>>n;
for(j=1;j<=n;j++)
{cin>>x;
add(j,x);
}
char d[10];
printf("Case %d:\n", i+1);
while(scanf("%s", d))
{
if(d[0] == 'E') break;
scanf("%d %d", &x, &y);
if(d[0] == 'A') add(x, y);
else if(d[0] == 'S') add(x, -y);
else printf("%d\n", sum(y)-sum(x-1));
}
}
return 0;}