This documentation is automatically generated by online-judge-tools/verification-helper
#define PROBLEM "https://onlinejudge.u-aizu.ac.jp/problems/DSL_2_B"
#include "../../../template/template.hpp"
#include "../../../SegmentTree/BinaryIndexedTree.hpp"
int main(){
cin.tie(nullptr);
ios::sync_with_stdio(false);
int n,q;
cin >> n >> q;
BIT<int> seg(n);
while(q--){
int t,x,y;
cin >> t >> x >> y;
x--;
if(t == 0){
seg.add(x, y);
}else{
cout << seg.sum(x, y) << "\n";
}
}
}
#line 1 "test/aoj/DSL/DSL_2_B.test.cpp"
#define PROBLEM "https://onlinejudge.u-aizu.ac.jp/problems/DSL_2_B"
#line 1 "template/template.hpp"
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <bitset>
#include <cctype>
#include <climits>
#include <functional>
#include <cassert>
#include <numeric>
#include <cstring>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define per(i, n) for(int i = (n) - 1; i >= 0; i--)
using ll = long long;
#define vi vector<int>
#define vvi vector<vi>
#define vl vector<ll>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
constexpr int mod = 1000000007;
using namespace std;
template<class T, class U>
bool chmax(T &a, const U &b){ return a < b ? (a = b, 1) : 0; }
template<class T, class U>
bool chmin(T &a, const U &b){ return a > b ? (a = b, 1) : 0; }
#line 4 "test/aoj/DSL/DSL_2_B.test.cpp"
#line 1 "SegmentTree/BinaryIndexedTree.hpp"
template <class T>
struct BIT {
BIT(const int _n = 0) : n(_n), d(n){}
BIT(const vector<T> &v) : d(v), n(v.size()){
for(int i = 1; i <= n; i++){
const int j = i + (i & -i);
if(j <= n) d[j - 1] += d[i - 1];
}
}
T sum(const int l, const int r) const{
assert(0 <= l && l <= r && r <= n);
return sum(r) - sum(l);
}
T sum(int i) const{
T tot = 0;
while(i > 0){
tot += d[i - 1];
i -= i & -i;
}
return tot;
}
void add(int i, const T &x){
assert(0 <= i && i < n);
i++;
while(i <= n){
d[i - 1] += x;
i += i & -i;
}
}
private:
int n = 1;
vector<T> d;
};
#line 6 "test/aoj/DSL/DSL_2_B.test.cpp"
int main(){
cin.tie(nullptr);
ios::sync_with_stdio(false);
int n,q;
cin >> n >> q;
BIT<int> seg(n);
while(q--){
int t,x,y;
cin >> t >> x >> y;
x--;
if(t == 0){
seg.add(x, y);
}else{
cout << seg.sum(x, y) << "\n";
}
}
}