// Slower C++ solution:
#include<bits/stdc++.h>

#define rep(i,a,b) for(int i=a;i<b;i++)

#define rrep(i,a,b) for(int i=a;i>=b;i--)

#define fore(i,a) for(auto &i:a)

#pragma GCC optimize ("-O3")

using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }

//---------------------------------------------------------------------------------------------------

#define def 0

template<class V, int NV> struct SegTree { //[l,r)

    V comp(V& l, V& r) { return l + r; };

    vector<V> val; SegTree() { val = vector<V>(NV * 2, def); }

    V get(int x,int y,int l=0,int r=NV,int k=1){if(r<=x||y<=l)return def;if(x<=l&&r<=y)return val[k];

    auto a=get(x,y,l,(l+r)/2,k*2);auto b=get(x,y,(l+r)/2,r,k*2+1);return comp(a,b);}

    void update(int i, V v) { i+=NV;val[i]=v;while(i>1)i>>=1,val[i]=comp(val[i*2],val[i*2+1]); }

    void add(int i, V v) { update(i, val[i + NV] + v); }};

/*---------------------------------------------------------------------------------------------------

????????????????????????????????? ??§?????§  

??????????????? ??§?????§ ???????´<_??? ?????? Welcome to My Coding Space!

???????????? ??? ?´_???`??????/??? ???i     

?????????????????????????????? ???  |???|     

????????? /?????? /??£??£??£??£/??????|  

??? ???_(__??????/???    ???/ .| .|????????????  

??? ????????????/????????????/??????u??????  

---------------------------------------------------------------------------------------------------*/







int N, Q;

SegTree<int, 1 << 17> st;

//---------------------------------------------------------------------------------------------------

void _main() {

    cin >> N >> Q;

    rep(i, 0, Q) {

        int c, x, y; cin >> c >> x >> y;

        if (c == 0) st.add(x - 1, y);

        else printf("%d\n", st.get(x - 1, y));

    }

}

// Faster C++ solution for the same problem (measured speedup: 2.0487341314169876x):
#include<bits/stdc++.h>

#define rep(i,a,b) for(int i=a;i<b;i++)

#define rrep(i,a,b) for(int i=a;i>=b;i--)

#define fore(i,a) for(auto &i:a)

#pragma GCC optimize ("-O3")

using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }

//---------------------------------------------------------------------------------------------------

#define INF INT_MAX/2

#define def 0

using V = int;

V comp(V& l, V& r) { return l + r; };

struct SegTree { //[l,r)

    int NV;

    vector<V> val;

    void init(int n) {

        NV = 1;

        while (NV < n) NV *= 2;

        val = vector<V>(NV * 2, def);

    }

    V get(int x, int y, int l, int r, int k) {

        if (r <= x || y <= l)return def; if (x <= l&&r <= y)return val[k];

        auto a = get(x, y, l, (l + r) / 2, k * 2); auto b = get(x, y, (l + r) / 2, r, k * 2 + 1); return comp(a, b);

    }

    V get(int x, int y) { return get(x, y, 0, NV, 1); }

    void update(int i, V v) { i += NV; val[i] = v; while (i>1)i >>= 1, val[i] = comp(val[i * 2], val[i * 2 + 1]); }

    void add(int i, V v) { update(i, val[i + NV] + v); }

    int operator[](int x) { return get(x, x + 1); }

};



struct Healthy2DSegTree {

    int NV;

    vector<SegTree> st;

    vector<vector<int>> index;

    

    void init(vector<vector<int>> &v) {

        int n = v.size();

        NV = 1; while (NV < n) NV *= 2;

        index.resize(2 * NV);

        rep(i, 0, n) fore(j, v[i]) index[i + NV].push_back(j);

        rrep(i, NV * 2 - 1, 1) {

            sort(index[i].begin(), index[i].end());

            index[i].erase(unique(index[i].begin(), index[i].end()), index[i].end());

            fore(j, index[i]) index[i / 2].push_back(j);

        }

        st.resize(2 * NV);

        rep(i, 1, NV * 2) st[i].init(index[i].size());

    }

    void update(int x, int y, V v) {

        assert(x < NV);

        x += NV;

        while (x) {

            int yy = lower_bound(index[x].begin(), index[x].end(), y) - index[x].begin();

            assert(yy != index[x].size());

            assert(y == index[x][yy]);

            st[x].update(yy, v);

            x >>= 1;

        }

    }

    void add(int x, int y, V v) {

        assert(x < NV);

        x += NV;

        while (x) {

            int yy = lower_bound(index[x].begin(), index[x].end(), y) - index[x].begin();

            assert(yy != index[x].size());

            assert(y == index[x][yy]);

            st[x].add(yy, v);

            x >>= 1;

        }

    }

    V get(int sx, int tx, int sy, int ty, int k, int l, int r) {

        if (r <= sx or tx <= l) return def;

        if (sx <= l and r <= tx) {

            int syy = lower_bound(index[k].begin(), index[k].end(), sy) - index[k].begin();

            int tyy = lower_bound(index[k].begin(), index[k].end(), ty) - index[k].begin();

            return st[k].get(syy, tyy);

        }

        int md = (l + r) / 2;

        V le = get(sx, tx, sy, ty, k * 2, l, md);

        V ri = get(sx, tx, sy, ty, k * 2 + 1, md, r);

        return comp(le, ri);

    }

    V get(int sx, int tx, int sy, int ty) {

        return get(sx, tx, sy, ty, 1, 0, NV);

    }

};

/*---------------------------------------------------------------------------------------------------

????????????????????????????????? ??§?????§  

??????????????? ??§?????§ ???????´<_??? ?????? Welcome to My Coding Space!

???????????? ??? ?´_???`??????/??? ???i     

?????????????????????????????? ???  |???|     

????????? /?????? /??£??£??£??£/??????|  

??? ???_(__??????/???    ???/ .| .|????????????  

??? ????????????/????????????/??????u??????  

---------------------------------------------------------------------------------------------------*/









int N, Q, com[101010], x[101010], y[101010];

//---------------------------------------------------------------------------------------------------

void _main() {

    cin >> N >> Q;

    rep(i, 0, Q) cin >> com[i] >> x[i] >> y[i];

    rep(i, 0, Q) x[i]--;



    vector<vector<int>> idx(N);

    rep(i, 0, Q) idx[x[i]].push_back(i);



    Healthy2DSegTree st;

    st.init(idx);



    rep(i, 0, Q) {

        if (com[i] == 0) st.add(x[i], i, y[i]);

        else {

            int ans = st.get(x[i], y[i], 0, Q);

            printf("%d\n", ans);

        }

    }

}