【题目来源】
【分析】
#树状数组
【代码】
#include<iostream>
#include<cstdio>
#include<algorithm>
#define ll long long
using namespace std;
const int maxn=5e5+5;
int n,m;
ll sum[maxn];
inline int lowbit(int x){
return x&-x;
}
void update(int x,int v){
for(;x<=n;x+=lowbit(x)){
sum[x]+=v;
}
}
ll query(int x){
ll r=0;
for(;x>0;x-=lowbit(x)){
r+=sum[x];
}
return r;
}
int main(){
scanf("%d%d",&n,&m);
for(int i=1;i<=n;i++){
int x;
scanf("%d",&x);
update(i,x);
}
for(int i=1;i<=m;i++){
int sgn,x,y;
scanf("%d%d%d",&sgn,&x,&y);
if(sgn==1){
update(x,y);
}else{
printf("%lld\n",query(y)-query(x-1));
}
}
return 0;
}