class RangeSumQuery(object):



    def __init__(self, size):

        self.size = 1

        while self.size <= size:

            self.size *= 2

        self.data = [0] * (self.size*2+2)



    def add(self, idx, value):

        k = idx + self.size - 1

        self.data[k] += value

        while k > 0:

            k = (k - 1) / 2

            self.data[k] += value



    def get_sum(self, start, end):

        def query(k, left, right):

            if right <= start or end <= left:

                return 0

            if start <= left and right <= end:

                return self.data[k]

            vl = query(k*2+1, left, (left+right)/2)

            vr = query(k*2+2, (left+right)/2, right)

            return sum([vl, vr])

        return query(0, 0, self.size)





def main():

    n, q = list(map(int, input().split()))

    rsq = RangeSumQuery(n)

    for _ in range(q):

        com, x, y = list(map(int, input().split()))

        if com == 0:

            rsq.add(x, y)

        else:

            print(rsq.get_sum(x, y+1))



if __name__ == "__main__":

    main()
class RangeSumQuery(object):



    def __init__(self, size):

        self.size = 1

        while self.size <= size:

            self.size *= 2

        self.data = [0] * (self.size*2-1)



    def add(self, idx, value):

        k = idx + self.size - 1

        self.data[k] += value

        while k > 0:

            k = (k - 1) / 2

            self.data[k] += value



    def get_sum(self, start, end):

        def query(k, left, right):

            if right <= start or end <= left:

                return 0

            if start <= left and right <= end:

                return self.data[k]

            vl = query(k*2+1, left, (left+right)/2)

            vr = query(k*2+2, (left+right)/2, right)

            return vl + vr

        return query(0, 0, self.size)





def main():

    n, q = list(map(int, input().split()))

    rsq = RangeSumQuery(n)

    for _ in range(q):

        com, x, y = list(map(int, input().split()))

        if com == 0:

            rsq.add(x, y)

        else:

            print(rsq.get_sum(x, y+1))



if __name__ == "__main__":

    main()
class RangeSumQuery(object):
    def __init__(self, size):
        self.size = 1
        while self.size <= size:
            self.size *= 2
        self.data = [0] * (self.size * 2 + 2)

    def add(self, idx, value):
        k = idx + self.size - 1
        self.data[k] += value
        while k > 0:
            k = (k - 1) / 2
            self.data[k] += value

    def get_sum(self, start, end):
        def query(k, left, right):
            if right <= start or end <= left:
                return 0
            if start <= left and right <= end:
                return self.data[k]
            vl = query(k * 2 + 1, left, (left + right) / 2)
            vr = query(k * 2 + 2, (left + right) / 2, right)
            return sum([vl, vr])

        return query(0, 0, self.size)


def main():
    n, q = list(map(int, input().split()))
    rsq = RangeSumQuery(n)
    for _ in range(q):
        com, x, y = list(map(int, input().split()))
        if com == 0:
            rsq.add(x, y)
        else:
            print(rsq.get_sum(x, y + 1))


if __name__ == "__main__":
    main()

class RangeSumQuery(object):
    def __init__(self, size):
        self.size = 1
        while self.size <= size:
            self.size *= 2
        self.data = [0] * (self.size * 2 - 1)

    def add(self, idx, value):
        k = idx + self.size - 1
        self.data[k] += value
        while k > 0:
            k = (k - 1) / 2
            self.data[k] += value

    def get_sum(self, start, end):
        def query(k, left, right):
            if right <= start or end <= left:
                return 0
            if start <= left and right <= end:
                return self.data[k]
            vl = query(k * 2 + 1, left, (left + right) / 2)
            vr = query(k * 2 + 2, (left + right) / 2, right)
            return vl + vr

        return query(0, 0, self.size)


def main():
    n, q = list(map(int, input().split()))
    rsq = RangeSumQuery(n)
    for _ in range(q):
        com, x, y = list(map(int, input().split()))
        if com == 0:
            rsq.add(x, y)
        else:
            print(rsq.get_sum(x, y + 1))


if __name__ == "__main__":
    main()

-        self.data = [0] * (self.size * 2 + 2) +        self.data = [0] * (self.size * 2 - 1) -            return sum([vl, vr]) +            return vl + vr