//*
#include <bits/stdc++.h>
//*/
/*
#include <iostream>
#include <vector>
#include <string.h>
//*/
#define FOR(i,bg,ed) for(ll i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007

#define int long long
#ifdef int
    const long long INF = LLONG_MAX / 10;
#else
    const int INF = 1010101010;
#endif

using namespace std;
typedef long long ll;
typedef vector<vector<ll>> mat;
typedef pair<int, int> P;
//typedef pair<double, double> P;


//Range Sum Query(RSQ)????????????????????°??¨
struct SegmentTree
{
private:
    int n;
    vector<int> node;

public:
    //?????????v(vector)????????°???????????¨??§??¨?????????
    SegmentTree(vector<int> v)
    {
        //???????????????????????°??????????????????????????\????????????????°??????????????????????n??¨??????
        //?????°???????????¨??¨?????§????????????????????°???2n-1??§??????
        int sz = v.size();
        n = 1;
        while (n < sz) n *= 2;
        node.resize(2 * n - 1, 0);

        //????????????????????\???????????¨????????????????????????????????????
        //?????????????????¨??????????????????????????????????????°??????
        REP(i,sz) node[i+(n-1)] = v[i];
        for (int i=n-2; i>=0; i--) {
            //????????°??¨?????????????????????????????¨??????????????????????????????
            node[i] = node[2*i+1] + node[2*i+2];
        }
    }

    void update(int x, int val)
    {
        //??????????????????????????¢???????????????
        x += n - 1;

        //??????????????????????????´??°?????????????????¨??????????????£?????´??°????????????
        node[x] = val;
        while (x > 0) {
            //x=0??§????????????????????????
            x = (x - 1) / 2;
            node[x] = node[2*x+1] + node[2*x+2];
        }
    }

    //?????????
    void add(int k, int val)
    {
        k += n - 1;
        node[k] += val;

        while (k > 0) {
            k = (k - 1) / 2;
            node[k] = node[2*k+1] + node[2*k+2];
        }
    }

    //????±???????[a,b)???????´????????°????????????????
    //k:=?????????????????????????????????????????????
    //????±??????????[l,r)????????????
    int getsum(int a, int b, int k = 0, int l = 0, int r = -1)
    {
        //?????????????????????????????¨??????????±??????????[0,n)
        if (r < 0) r = n;

        //????±?????????¨????±???????????????????????????????????????±??????????????????????????????
        //????????°??¨?????????????????£????????????
        if (r <= a || b <= l) return 0;

        //????±??????????????±???????????????¨????¢???????????±????????????????????¨?????????????
        if (a <= l && r <= b) return node[k];

        //????±??????????????±???????????????¨????¢????????????????????????¢?´¢?????????
        //????????????vl???????????????vr??¨????????????
        //??°??????????±???????????????¨???????±???????????????????????????????
        int vl = getsum(a, b, 2 * k + 1, l, (l + r) / 2);
        int vr = getsum(a, b, 2 * k + 2, (l + r) / 2, r);
        return vl + vr;
    }
};

signed main()
{
    int n, q;

    cin >> n >> q;
    vector<int> a(n, 0);

    SegmentTree st(a);
    REP(i,q) {
        int com, x, y;
        cin >> com >> x >> y;
        if (com == 0) {
            st.add(x - 1, y);
        } else {
            cout << st.getsum(x - 1, y) << endl;
        }
    }
}

Measured memory_bytes: 6564