#![allow(unused_mut, non_snake_case,unused_imports)]
use std::iter;
use std::cmp::{max, min, Ordering};
use std::mem::{swap};
use std::collections::{HashMap,BTreeMap,HashSet,BTreeSet,BinaryHeap,VecDeque};
use std::iter::FromIterator;

//　高速 EOF要
//macro_rules! input {(source = $s:expr, $($r:tt)*) => {let mut iter = $s.split_whitespace();input_inner!{iter, $($r)*}};($($r:tt)*) => {let mut s = {use std::io::Read;let mut s = String::new();std::io::stdin().read_to_string(&mut s).unwrap();s};let mut iter = s.split_whitespace();input_inner!{iter, $($r)*}};}
//macro_rules! input_inner {($iter:expr) => {};($iter:expr, ) => {};($iter:expr, $var:ident : $t:tt $($r:tt)*) => {let $var = read_value!($iter, $t);input_inner!{$iter $($r)*}};}
//macro_rules! read_value {($iter:expr, ( $($t:tt),* )) => {( $(read_value!($iter, $t)),* )};($iter:expr, [ $t:tt ; $len:expr ]) => {(0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()};($iter:expr, chars) => {read_value!($iter, String).chars().collect::<Vec<char>>()};($iter:expr, usize1) => {read_value!($iter, usize) - 1};($iter:expr, $t:ty) => {$iter.next().unwrap().parse::<$t>().expect("Parse error")};}
// 低速 EOF不要
macro_rules! input {(source = $s:expr, $($r:tt)*) => {let mut iter = $s.split_whitespace();let mut next = || { iter.next().unwrap() };input_inner!{next, $($r)*}};($($r:tt)*) => {let stdin = std::io::stdin();let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));let mut next = move || -> String{bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect()};input_inner!{next, $($r)*}};}
macro_rules! input_inner {($next:expr) => {};($next:expr, ) => {};($next:expr, $var:ident : $t:tt $($r:tt)*) => {let $var = read_value!($next, $t);input_inner!{$next $($r)*}};}
macro_rules! read_value {($next:expr, ( $($t:tt),* )) => {( $(read_value!($next, $t)),* )};($next:expr, [ $t:tt ; $len:expr ]) => {(0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()};($next:expr, chars) => {read_value!($next, String).chars().collect::<Vec<char>>()};($next:expr, usize1) => {read_value!($next, usize) - 1};($next:expr, $t:ty) => {$next().parse::<$t>().expect("Parse error")};}

/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

#[derive(PartialEq, Debug, Clone)]
pub struct BIT{
    pub N:usize,
    pub bit:Vec<i64>
}
impl BIT{
    pub fn new(N:usize) -> BIT{
        let bit = vec![0_i64;N +1];
        return BIT{N,bit};
    }
    pub fn add(&mut self,x:i32,val:i64) {
        let mut x = x;
        while x <= self.N as i32{
            self.bit[x as usize] += val;
            x += x & -x;
        }
    }
    pub fn sum(&mut self,x:i32) -> i64{
        let mut x = x;
        let mut ret = 0;
        while x!=0{
            ret += self.bit[x as usize];
            x &= x-1;
        }
        return ret;
    }

    // [l,r]
    pub fn range_sum(&mut self,l:i32,r:i32) -> i64{
        return self.sum(r) - {if l <= 1{ 0 } else { self.sum(l-1)}};
    }
}


fn main(){
    input!(n:usize,q:usize,query:[(usize,i32,i32);q]);
    let query:Vec<(usize,i32,i32)> = query;
    let mut bit = BIT::new(n);
    for (com,x,y) in query {
        if com == 0 {
            bit.add(x, y as i64);
        } else {
            println!("{}", bit.range_sum(x, y));
        }
    }
}


Measured memory_bytes: 6976