#include <stdio.h> #define ll long long #define N 100100 ll a[N], tree[N]; int lowbit(int x) { return x & -x; } void add(int now, ll val) { for(int i = now; i < N; i += lowbit(i)) { tree[i] += val; } } ll query(int now) { ll res = 0; for(int i = now; i > 0; i -= lowbit(i)) { res += tree[i]; } return res; } int main() { int n, q; if(scanf("%d %d", &n, &q) != EOF) { for(int i = 1; i <= n; i++) { if(scanf("%lld", &a[i]) == EOF) { printf("error2\n"); return 1; } } for(int i = 1; i <= n; i++) { add(i, a[i]); } while(q--) { int p, x, y; if(scanf("%d %d %d", &p, &x, &y) != EOF) { if(p == 1) { add(x, -a[x]); a[x] += y; add(x, a[x]); } else if(p == 2) { printf("%lld\n", query(y) - query(x - 1)); } else printf("error4\n"); } else printf("error3\n"); } } else printf("error1\n"); return 0; }