样例能过
#include <bits/stdc++.h>
#define long long int
using namespace std;
const int N=5e5+10;
int tree[N],n,m;
int lowbit(int x){
return x&-x;
}
void add(int x,int k){
for(int i=x;i<=n;i+=lowbit(i)){//i=x:找到节点x i+=lowbit(i):找父节点
tree[i]+=k; //沿途的所有节点都要加上k
}
}
int quary(int x){
int sum=0;
for(int i=x;i>=1;i-=lowbit(i)) sum+=tree[i];
return sum;
}
int main(){
cin>>n>>m;
for(int i=1;i<=m;i++){
char t;
cin>>t;
if(t=='x'){
int x,k;
cin>>x>>k;
add(x,k);
}else{
int x,y;
cin>>x>>y;
int tt,qq;
tt=quary(y);
qq=quary(x-1);
cout<<tt-qq<<endl;
}
}
return 0;
}