/* template.cpp {{{ */
#include <bits/stdc++.h>
using namespace std;
 
// #define int long long
#define GET_MACRO(a, b, c, d, NAME, ...) NAME
#define REP1(n) REP2(i_, n)
#define REP2(i, n) REP3(i, 0, n)
#define REP3(i, a, b) REP4(i, a, b, 1)
#define REP4(i, a, b, s) for (long long i = (a); i < (long long)(b); i += (long long)(s))
#define RREP1(n) RREP2(i_, n)
#define RREP2(i, n) RREP3(i, 0, n)
#define RREP3(i, a, b) RREP4(i, a, b, 1)
#define RREP4(i, a, b, s) for (long long i = (b) - 1; i >= (long long)(a);  i -= (long long)(s))
#define rep(...) GET_MACRO(__VA_ARGS__, REP4, REP3, REP2, REP1)(__VA_ARGS__)
#define rrep(...) GET_MACRO(__VA_ARGS__, RREP4, RREP3, RREP2, RREP1)(__VA_ARGS__)
#define fs first
#define sc second
#define all(c) std::begin(c), std::end(c)
#define pcnt(x) __builtin_popcountll(x)
#define each(x, c) for (auto &&x : c)
#define y0 y0_
#define y1 y1_
#define yn yn_
 
#define TMP_T template<typename T>
#define TMP_TU template<typename T, typename U>
#define TMP_Ts template<typename ...T>
#define TMP_NTs template<size_t N, typename ...T>
#define TMP_CT template<bool C, typename T = void>
 
#ifndef DEBUG
#define cerr no_output
struct NoOutput : ostream {
  TMP_T NoOutput &operator<<(const T &){ return *this; }
} no_output;
#endif
 
using uint = unsigned;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
TMP_T using PQL = priority_queue<T, vector<T>, greater<T>>;
TMP_T using PQG = priority_queue<T>;
TMP_CT using enable_if_t = typename enable_if<C, T>::type;
 
const ll LLINF = 1e18 + 10;
#ifndef int
const int INF = 1e9 + 10;
#else
const int INF = LLINF;
#endif
 
const int dx[] = {-1, 0, 1, 0, -1, 1, 1, -1};
const int dy[] = {0, -1, 0, 1, -1, -1, 1, 1};
 
TMP_T inline constexpr T sq(T x){ return x * x; }
TMP_TU inline T& chmin(T &x, U y){ if (x > y) x = y; return x; }
TMP_TU inline T& chmax(T &x, U y){ if (x < y) x = y; return x; }
 
TMP_NTs enable_if_t<(N >= sizeof...(T))> input_tuple(istream &, tuple<T...> &){}
TMP_NTs enable_if_t<(N < sizeof...(T))> input_tuple(istream &is, tuple<T...> &x){ is >> get<N>(x); input_tuple<N + 1, T...>(is, x); }
TMP_Ts ostream &operator>>(istream &is, tuple<T...> &x){ input_tuple<0, T...>(is, x); return is; }
TMP_TU ostream &operator>>(istream &is, pair<T, U> &x){ return is >> x.first >> x.second; }
TMP_NTs enable_if_t<(N >= sizeof...(T))> print_tuple(ostream &, const tuple<T...> &){}
TMP_NTs enable_if_t<(N < sizeof...(T))> print_tuple(ostream &os, const tuple<T...> &x){ os << (N > 0 ? " " : "") << get<N>(x); print_tuple<N + 1, T...>(os, x); }
TMP_Ts ostream &operator<<(ostream &os, const tuple<T...> &x){ print_tuple<0, T...>(os, x); return os; }
TMP_TU ostream &operator<<(ostream &os, const pair<T, U> &x){ return os << x.first << " " << x.second; }
 
#undef TMP_T
#undef TMP_TU
#undef TMP_Ts
#undef TMP_NTs
#undef TMP_CT
 
struct prepare {
  prepare(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(12);
    cerr << fixed << setprecision(12);
  }
} prepare_;
/* }}} */
/* fenwick_tree.cpp {{{ */
template<typename Traits>
class FenwickTree {
public:
  using value_type = typename Traits::value_type;
  FenwickTree(int n = 0, const Traits &traits = Traits()):
    traits(traits), n(n), val(n + 1, traits.initial()){}
  void update(int k, value_type x){
    k++;
    while (k <= n){
      val[k] = traits.merge(val[k], x);
      k += k & -k;
    }
  }
  value_type query(int k) const {
    value_type res = traits.initial();
    while (k > 0){
      res = traits.merge(res, val[k]);
      k -= k & -k;
    }
    return res;
  }
  value_type query(int l, int r) const {
    return traits.merge(query(r), traits.inverse(query(l)));
  }
private:
  Traits traits;
  int n;
  vector<value_type> val;
};

namespace fen {
template<typename T>
struct Sum {
  using value_type = T;
  value_type initial() const { return 0; }
  value_type merge(value_type x, value_type y) const { return x + y; }
  value_type inverse(value_type x) const { return -x; }
};

template<typename T>
struct Min {
  using value_type = T;
  value_type initial() const { return numeric_limits<value_type>::max(); }
  value_type merge(value_type x, value_type y) const { return min(x, y); }
  value_type inverse(value_type x) const { assert(false); }
};

template<typename T>
struct Max {
  using value_type = T;
  value_type initial() const { return numeric_limits<value_type>::min(); }
  value_type merge(value_type x, value_type y) const { return max(x, y); }
  value_type inverse(value_type x) const { assert(false); }
};
}

template<typename T> using FenwickTreeSum = FenwickTree<fen::Sum<T>>;
template<typename T> using FenwickTreeMin = FenwickTree<fen::Min<T>>;
template<typename T> using FenwickTreeMax = FenwickTree<fen::Max<T>>;
/* }}} */

signed main()
{
  int n, q;
  cin >> n >> q;
  FenwickTreeSum<int> tr(n);
  rep(q){
    int c, x, y;
    cin >> c >> x >> y;
    if (c == 0) tr.update(x - 1, y);
    else cout << tr.query(x - 1, y) << endl;
  }
}

Measured memory_bytes: 3348