#include<bits/stdc++.h>
using namespace std;
#define ll long long 
const ll N=5e5+5;
ll n,m,st[4*N];
void update(ll id,ll l,ll r,ll pos,ll val)
{
    if(r<pos||l>pos)return ;
    if(l==r)
    {
        st[id]+=val;
        return ;
    }
    ll mid=(l+r)/2;
    update(id*2,l,mid,pos,val);
    update(id*2+1,mid+1,r,pos,val);
    st[id]=max(st[id*2],st[id*2+1]);
}
ll get(ll id,ll l,ll r,ll u,ll v)
{
    if(u>r||v<l)return -1e18;
    if(l>=u&&r<=v)return st[id];
    ll mid=(l+r)/2;
    return max(get(id*2,l,mid,u,v),get(id*2+1,mid+1,r,u,v));
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    cin>>n>>m;
    while(m--)
    {
        ll k,x,y;
        cin>>k>>x>>y;
        if(k==0)
        {
            update(1,1,n,x,y);
        }
        else
        {
            cout<<get(1,1,n,x,y)<<"\n";
        }
    }
}