TLE求调
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MAXX = 5e5+5;
int n,m;
int a[MAXX];
int opt,x,y;
int ans;
signed main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin>>n>>m;
for(int i = 1;i <= n;i++){cin>>a[i];}
while(m--)
{
cin>>opt>>x>>y;
if(opt==1){a[x] += y;}
else
{
ans = 0;
for(int i = x;i <= y;i++)
{
ans += a[i];
}
cout<<ans<<endl;
}
}
return 0;
}