import sys





class Bit:

    def __init__(self, n):

        self.size = n

        self.tree = [0] * (n + 1)



    def build(self, arr):

        #assert len(arr) <= n

        for i, a in enumerate(arr):

            self.add(i+1, a)



    def sum(self, i):

        s = 0

        while i > 0:

            s += self.tree[i]

            i -= i & -i

        return s



    def add(self, i, x):

        while i <= self.size:

            self.tree[i] += x

            i += i & -i



    def range_sum(self, l, r):

        #assert 0 <= l <= r <= self.n

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





def main():

    n, q = list(map(int, sys.stdin.buffer.readline().split()))

    bit = Bit(n)

    bit.build(list(map(int, sys.stdin.buffer.readline().split())))

    for x in sys.stdin.buffer.readlines():

        q, p, x = list(map(int, x.split()))

        if q:

            print((bit.range_sum(p, x)))

        else:

            bit.add(p+1, x)





if __name__ == "__main__":

    main()

import sys





class Bit:

    def __init__(self, n, arr):

        self.size = n

        self.tree = [0] + arr

        for i in range(1, n+1):

            if i + (i & -i) < n + 1:

                self.tree[i + (i & -i)] += self.tree[i]



    def sum(self, i):

        s = 0

        while i > 0:

            s += self.tree[i]

            i -= i & -i

        return s



    def add(self, i, x):

        while i <= self.size:

            self.tree[i] += x

            i += i & -i



    def range_sum(self, l, r):

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





def main():

    n, q = list(map(int, sys.stdin.buffer.readline().split()))

    bit = Bit(n, list(map(int, sys.stdin.buffer.readline().split())))

    for x in sys.stdin.buffer.readlines():

        q, p, x = list(map(int, x.split()))

        if q:

            print((bit.range_sum(p, x)))

        else:

            bit.add(p+1, x)





if __name__ == "__main__":

    main()

import sys


class Bit:
    def __init__(self, n):
        self.size = n
        self.tree = [0] * (n + 1)

    def build(self, arr):
        # assert len(arr) <= n
        for i, a in enumerate(arr):
            self.add(i + 1, a)

    def sum(self, i):
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s

    def add(self, i, x):
        while i <= self.size:
            self.tree[i] += x
            i += i & -i

    def range_sum(self, l, r):
        # assert 0 <= l <= r <= self.n
        return self.sum(r) - self.sum(l)


def main():
    n, q = list(map(int, sys.stdin.buffer.readline().split()))
    bit = Bit(n)
    bit.build(list(map(int, sys.stdin.buffer.readline().split())))
    for x in sys.stdin.buffer.readlines():
        q, p, x = list(map(int, x.split()))
        if q:
            print((bit.range_sum(p, x)))
        else:
            bit.add(p + 1, x)


if __name__ == "__main__":
    main()

import sys


class Bit:
    def __init__(self, n, arr):
        self.size = n
        self.tree = [0] + arr
        for i in range(1, n + 1):
            if i + (i & -i) < n + 1:
                self.tree[i + (i & -i)] += self.tree[i]

    def sum(self, i):
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s

    def add(self, i, x):
        while i <= self.size:
            self.tree[i] += x
            i += i & -i

    def range_sum(self, l, r):
        return self.sum(r) - self.sum(l)


def main():
    n, q = list(map(int, sys.stdin.buffer.readline().split()))
    bit = Bit(n, list(map(int, sys.stdin.buffer.readline().split())))
    for x in sys.stdin.buffer.readlines():
        q, p, x = list(map(int, x.split()))
        if q:
            print((bit.range_sum(p, x)))
        else:
            bit.add(p + 1, x)


if __name__ == "__main__":
    main()

-    def __init__(self, n): +    def __init__(self, n, arr): -        self.tree = [0] * (n + 1) - -    def build(self, arr): -        # assert len(arr) <= n -        for i, a in enumerate(arr): -            self.add(i + 1, a) +        self.tree = [0] + arr +        for i in range(1, n + 1): +            if i + (i & -i) < n + 1: +                self.tree[i + (i & -i)] += self.tree[i] -        # assert 0 <= l <= r <= self.n -    bit = Bit(n) -    bit.build(list(map(int, sys.stdin.buffer.readline().split()))) +    bit = Bit(n, list(map(int, sys.stdin.buffer.readline().split())))