#include <bits/stdc++.h>
using namespace std;
using ll=long long;using ull=unsigned ll;
using vi=vector<int>;using vvi=vector<vi>;using vl=vector<ll>;
using P=pair<int,int>;using PL=pair<ll,ll>;
const int INF=1<<30,MOD=1000000007;const ll LINF=1ll<<60;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) _repi(i,0,n)
#define _repi(i,a,b) for(int i=a,i##_l=(b);i<i##_l;++i)
#define REP(...) _overload3(__VA_ARGS__,_repi,_rep,)(__VA_ARGS__)
#define REPR(i,n) for(int i=n-1;i>=0;--i)
#define REPARR(i,v) for(int i=0;i<v.size();++i)
#define all(v) (v).begin(),(v).end()
#define uniq(v) sort(all(v));v.erase(unique(all(v)),v.end())
#define bit(n) (1ll<<(n))
template<class T>bool chmax(T&a,const T&b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T&a,const T&b){if(a>b){a=b;return 1;}return 0;}
#define cut(n, Min, Max) max(min(n,Max),Min)
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define yes(n) cout<<((n)?"yes":"no")<<endl
#define poss(n) cout<<((n)?"":"im")<<"possible"<<endl
#define Poss(n) cout<<((n)?"P":"Imp")<<"ossible"<<endl
template<typename T>ostream&operator<<(ostream&o,const vector<T>&v){for(T i:v)o<<i<<' ';return o;}
template<typename T>istream&operator>>(istream&i,vector<T>&v){for(T&j:v)i>>j;return i;}
template<typename T>ostream&operator<<(ostream&o,const set<T>&v){for(T i:v)o<<i<<' ';return o;}
template<typename T,typename U>ostream&operator<<(ostream&o,const pair<T,U>&v){o<<v.first<<' '<<v.second;return o;}
int lg2(int n){
    REPR(i,31){
        if(n&bit(i)){
            return i;
        }
    }
    return -1;
}
int min_2pow(int n){
    int l=lg2(n);
    if(bit(l)<n)l++;
    return bit(l);
}
template<typename T>
struct segtree{
    int size;
    vector<T> tree;
    function<T(T,T)> func;
    T unit;
    segtree(int n, function<T(T,T)> func, T unit): func(func), unit(unit){
        size=min_2pow(n);
        tree=vector<T>(2*size-1, unit);
    }
    
    void put(int pos, const T&value){
        tree[size-1+pos]=value;
    }
void resolve(int pos){
    pos=size-1+pos;
    while(pos!=0){
        pos=(pos-1)/2;
        int child1=pos*2+1;
        int child2=child1+1;
        tree[pos]=func(tree[child1],tree[child2]);
    }
}
    void resolve(){
        REPR(i,size-1){ // bottom(but not leaves) first
            int child1=i*2+1;
            int child2=child1+1;
            tree[i]=func(tree[child1],tree[child2]);
        }
    }
    T get(const int&start, const int&end, int _search_node=0){ // (start,end]
        if(start>end)return unit;
        int row=lg2(_search_node+1);
        int node_width=bit(lg2(size)-row);
        int node_start=node_width*(_search_node-bit(row)+1);
        int node_end=node_start+node_width;
        if(end<=node_start || node_end<=start)return unit;
        if(start<=node_start && node_end<=end){ // all conains
            return tree[_search_node];
        }
        int child1=_search_node*2+1;
        int child2=child1+1;
        
        return func(get(start,end,child1), get(start,end,child2));
    }
};

int main(){
    int n,q;
    cin>>n>>q;
    segtree<int> st(n,[](int a,int b){return a+b;},0);
    REP(i,q){
        int c,x,y;
        cin>>c>>x>>y;
        x--;
        if(!c){
            st.put(x, st.tree[st.size-1+x]+y);
            st.resolve(x);
            //cerr<<"     "<<st.tree<<endl;
        }else{
            y--;
            cout<<st.get(x,y+1)<<endl;
        }
    }
    return 0;
}



Measured memory_bytes: 3828