This documentation is automatically generated by online-judge-tools/verification-helper
#define PROBLEM "http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_B&lang=jp"
#include "../memo/macro.hpp"
#include "../data_structure/BIT.cpp"
signed main(void) {
ll n, q;
cin >> n >> q;
BIT bit(100010);
while(q--) {
ll t, x, y;
cin >> t >> x >> y;
if(t == 0) {
bit.update(x, y);
} else {
cout << bit.query(y) - bit.query(x-1) << endl;
}
}
return 0;
}
#line 1 "test/DSL2B_0.test.cpp"
#define PROBLEM "http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_B&lang=jp"
#line 1 "memo/macro.hpp"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<ll, ll>;
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
template<typename T> void chmin(T &a, const T &b) { a = min(a, b); }
template<typename T> void chmax(T &a, const T &b) { a = max(a, b); }
struct FastIO {FastIO() { cin.tie(0); ios::sync_with_stdio(0); }}fastiofastio;
const ll INF = 1LL<<60;
#line 1 "data_structure/BIT.cpp"
// BEGIN CUT
struct BIT {
int n;
vector<ll> bit;
BIT(int sz) {
n=1; while(n < sz) n*=2;
bit.assign(n+1, 0);
}
void update(int i, ll w) {
for(int x=i+1; x<(int)bit.size(); x += x&-x) bit[x] += w;
}
// [0,i]
ll query(int i) {
ll ret = 0;
for(int x=i+1; x>0; x -= x&-x) ret += bit[x];
return ret;
}
// 合計がw以上の最小の位置
int lower_bound(ll w) {
int x = 0;
for(int k=n; k>0; k>>=1) {
if(x+k <= n && bit[x+k] < w) {
w -= bit[x+k];
x += k;
}
}
return x;
}
};
// END CUT
#line 4 "test/DSL2B_0.test.cpp"
signed main(void) {
ll n, q;
cin >> n >> q;
BIT bit(100010);
while(q--) {
ll t, x, y;
cin >> t >> x >> y;
if(t == 0) {
bit.update(x, y);
} else {
cout << bit.query(y) - bit.query(x-1) << endl;
}
}
return 0;
}