#include #define ft first #define sc second #define lb lower_bound #define ub upper_bound #define pb push_back #define pt(sth) cout << sth << "\n" #define chmax(a, b) {if(ab) a=b;} #define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD using namespace std; typedef long long ll; typedef pair P; static const ll INF=1e18; static const ll MAX=1e5+7; static const ll MOD=1e9+7; class SegTree { public: vector dat; ll n, h; SegTree(ll _n) { n=1; h=1; while(_n>n) { n*=2; h++; } dat=vector(n*2-1); } void update(ll i, ll x) { i+=n-1; dat[i]+=x; while(i>0) { i=(i-1)/2; dat[i]+=x; } } ll _query(ll a, ll b, ll k, ll l, ll r) { if(r<=a||b<=l) return 0; if(a<=l&&r<=b) return dat[k]; else { ll s=_query(a, b, k*2+1, l, (l+r)/2); ll t=_query(a, b, k*2+2, (l+r)/2, r); return s+t; } } ll query(ll a, ll b) { return _query(a, b, 0, 0, n); } }; int main(void) { ll N; cin >> N; SegTree st(1e9); ll ans=0; for(ll i=0; i> q >> x >> y; if(q==0) st.update(x, y); if(q==1) ans+=st.query(x, y+1); } pt(ans); }