class Fenwick_Tree:

    def __init__(self, n):

        self._n = n

        self.data = [0] * n

    

    def add(self, p, x):

        assert 0 <= p < self._n

        p += 1

        while p <= self._n:

            self.data[p - 1] += x

            p += p & -p

    

    def sum(self, l, r):

        assert 0 <= l <= r <= self._n

        return self._sum(r) - self._sum(l)

    

    def _sum(self, r):

        s = 0

        while r > 0:

            s += self.data[r - 1]

            r -= r & -r

        return s





def main():

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

    fw = Fenwick_Tree(n)

    for i, a in enumerate(map(int, input().split())): fw.add(i, a)

    for _ in range(q):

        t, a, b = list(map(int, input().split()))

        if t == 0:

            fw.add(a, b)

        else:

            print((fw.sum(a, b)))



if __name__ == "__main__":

    main()

import sys



class Fenwick_Tree:

    def __init__(self, n):

        self._n = n

        self.data = [0] * n

    

    def add(self, p, x):

        assert 0 <= p < self._n

        p += 1

        while p <= self._n:

            self.data[p - 1] += x

            p += p & -p

    

    def sum(self, l, r):

        assert 0 <= l <= r <= self._n

        return self._sum(r) - self._sum(l)

    

    def _sum(self, r):

        s = 0

        while r > 0:

            s += self.data[r - 1]

            r -= r & -r

        return s





def main():

    input = sys.stdin.readline

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

    fw = Fenwick_Tree(n)

    for i, a in enumerate(map(int, input().split())): fw.add(i, a)

    for _ in range(q):

        t, a, b = list(map(int, input().split()))

        if t == 0:

            fw.add(a, b)

        else:

            print((fw.sum(a, b)))



if __name__ == "__main__":

    main()





class Fenwick_Tree:
    def __init__(self, n):
        self._n = n
        self.data = [0] * n

    def add(self, p, x):
        assert 0 <= p < self._n
        p += 1
        while p <= self._n:
            self.data[p - 1] += x
            p += p & -p

    def sum(self, l, r):
        assert 0 <= l <= r <= self._n
        return self._sum(r) - self._sum(l)

    def _sum(self, r):
        s = 0
        while r > 0:
            s += self.data[r - 1]
            r -= r & -r
        return s


def main():
    n, q = list(map(int, input().split()))
    fw = Fenwick_Tree(n)
    for i, a in enumerate(map(int, input().split())):
        fw.add(i, a)
    for _ in range(q):
        t, a, b = list(map(int, input().split()))
        if t == 0:
            fw.add(a, b)
        else:
            print((fw.sum(a, b)))


if __name__ == "__main__":
    main()

import sys


class Fenwick_Tree:
    def __init__(self, n):
        self._n = n
        self.data = [0] * n

    def add(self, p, x):
        assert 0 <= p < self._n
        p += 1
        while p <= self._n:
            self.data[p - 1] += x
            p += p & -p

    def sum(self, l, r):
        assert 0 <= l <= r <= self._n
        return self._sum(r) - self._sum(l)

    def _sum(self, r):
        s = 0
        while r > 0:
            s += self.data[r - 1]
            r -= r & -r
        return s


def main():
    input = sys.stdin.readline
    n, q = list(map(int, input().split()))
    fw = Fenwick_Tree(n)
    for i, a in enumerate(map(int, input().split())):
        fw.add(i, a)
    for _ in range(q):
        t, a, b = list(map(int, input().split()))
        if t == 0:
            fw.add(a, b)
        else:
            print((fw.sum(a, b)))


if __name__ == "__main__":
    main()

+import sys + + +    input = sys.stdin.readline