package main

import (
	"bufio"
	"bytes"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
	"strings"
)

//  長い入力を読む
func ReadLongLines(times int) ([]string, error) {
	result := make([]string, times)
	reader := bufio.NewReader(os.Stdin)
	buffer := bytes.NewBuffer(make([]byte, 0))
	readBytes := int64(2)
	for i := 0; i < times; i++ {
		for {
			readBuf, isPrefix, err := reader.ReadLine()
			// fmt.Printf("Reader.Read: %d\n", len(readBuf))
			readBytes += int64(len(readBuf) + 1)
			if err != nil {
				if err == io.EOF {
					fmt.Println("EOF")
					break
				} else {
					return result, err
				}
			}
			_, err = buffer.Write(readBuf)
			if err != nil {
				return result, err
			}
			// end of line
			if !isPrefix {
				result[i] = buffer.String()
				buffer.Reset()
				// reader = bufio.NewReader(os.Stdin)
				break
			}
		}
	}
	// 先読みしてしまうようなので、戻しておく
	os.Stdin.Seek(-int64(reader.Buffered()), os.SEEK_CUR)
	return result, nil
}

// 出力 for 競プロ
type Console struct {
	writer *bufio.Writer
}

func NewConsole() Console {
	return Console{bufio.NewWriter(os.Stdout)}
}
func (this *Console) Printf(format string, a ...interface{}) {
	fmt.Fprintf(this.writer, format, a...)
}
func (this *Console) Println(s string) {
	fmt.Fprintln(this.writer, s)
}
func (this *Console) Close() {
	this.Flush()
}
func (this Console) Flush() {
	this.writer.Flush()
}

func PrintList(list []int) {
	con := NewConsole()
	defer con.Flush()
	for i := range list {
		if i == 0 {
			con.Printf("%d", list[i])
		} else {
			con.Printf(" %d", list[i])
		}
	}
	con.Println("")
}

// var list []int

const DEF_VAL = 0



func Max(lhs int, rhs int) int {
	if lhs < rhs {
		return rhs
	} else {
		return lhs
	}
}
func Min(lhs int, rhs int) int {
	if lhs < rhs {
		return lhs
	} else {
		return rhs
	}
}

type Memo struct {
	list   []int
	valueList []int
	numValue  int
}

func NewMemo(n int) Memo {
	valueList := make([]int, n)
	list := make([]int, int(math.Ceil(float64(n)/float64(math.Floor(math.Sqrt(float64(n)))))))
	for i := range valueList {
		valueList[i] = DEF_VAL
	}
	for i := range list {
		list[i] = DEF_VAL
	}
	m := Memo{list, valueList, int(math.Floor(math.Sqrt(float64(n))))}
	return m
}

func (this *Memo) Add(index int, value int) {
	this.valueList[index] += value
	indices := this.GetIndexes(index, index)
	period := this.GetPeriod(index)
	sum := DEF_VAL
	for i := period[0]; i <= period[len(period)-1]; i++ {
		sum += this.valueList[i]
		
	}
	this.list[indices[0]] = sum
}

func (this *Memo) GetSum(begin int, end int) int {
	// begin - end のと index の境界は異なるので、最初と最後は走査しないと正しくない
	indices := this.GetIndexes(begin, end)
	// fmt.Printf("indices: %v GetSum(%d, %d) \n", indices, begin, end)
	sum := DEF_VAL
	if 3 <= len(indices) {
		for i := indices[1]; i < indices[len(indices)-1]; i++ {
			sum += this.list[i]
		}
	}
	beginEnd := Min(end, indices[0]*this.numValue+this.numValue-1)
	// fmt.Printf("begin - beginEnd: %d - %d\n", begin,  beginEnd)
	for i := begin; i <= beginEnd && i <= end; i++ {
		sum += this.valueList[i]
	}
	endBegin := indices[len(indices)-1]*this.numValue
	// fmt.Printf("endBegin: %d\n", endBegin)
	if 2 <= len(indices) {
		for i := endBegin; i <= end; i++ {
			sum += this.valueList[i]
		}
	}
	// fmt.Printf("endBegin - end: %d - %d\n", endBegin, end)
	// fmt.Printf("%d: %v\n", sum, this.valueList)
	// if begin == 49852-1 && end == 49974 - 1 {
	// 	sum := 0
	// 	for i := begin; i <= end; i++ {
	// 		sum += this.valueList[i]
	// 	}
	// 	fmt.Printf("Result: %d\n", sum)
	// 	fmt.Printf("indecies: %d - %d\n", indices[0], indices[len(indices)-1])
	// 	fmt.Printf("%v\n", indices)
	// }
	return sum
}

func (this *Memo) GetIndexes(begin int, end int) []int {
	// 範囲をカバーする minListのインデックスを計算する
	result := make([]int, 0)
	for i := begin; i < end / this.numValue * this.numValue + this.numValue; i += this.numValue {
		x := i / this.numValue
		result = append(result, x)
	}
	return result
}

func (this *Memo) GetPeriod(index int) []int {
	begin := index / this.numValue * this.numValue
	end := begin + this.numValue - 1
	result := make([]int, 0)
	for i := begin; i <= end && i < len(this.valueList); i++ {
		result = append(result, i)
	}
	return result
}

func main() {
	con := NewConsole()
	defer con.Close()

	var n, q int
	fmt.Scanf("%d %d", &n, &q)
	lines, _ := ReadLongLines(q)

	list := NewMemo(n)

	for i := 0; i < q; i++ {
		args := strings.Split(lines[i], " ")
		command := args[0]
		switch command {
		case "0":
			i, _ := strconv.Atoi(args[1])
			x, _ := strconv.Atoi(args[2])
			list.Add(i-1, x)
		case "1":
			s, _ := strconv.Atoi(args[1])
			t, _ := strconv.Atoi(args[2])
			sum := list.GetSum(s-1, t-1)
			// con.Printf("%d Find(%d, %d)\n", sum, s, t)
			con.Printf("%d\n", sum)
		}
	}
	// con.Printf("%d\n", list)
}



Measured memory_bytes: 13232