import numpy as np

from numba import njit, i8, jitclass

import sys



spec = [

    ("size", i8),

    ("tree", i8[:])

]





@jitclass(spec)

class Bit:

    def __init__(self, n, arr):

        self.size = n

        self.tree = np.array([0] + arr, np.int64)

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

            x = i + (i & -i)

            if x < n + 1:

                self.tree[x] += 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, arr):

        self.size = n

        self.tree = [0] + arr

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

            x = i + (i & -i)

            if x < n + 1:

                self.tree[x] += 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 numpy as np
from numba import njit, i8, jitclass
import sys

spec = [("size", i8), ("tree", i8[:])]


@jitclass(spec)
class Bit:
    def __init__(self, n, arr):
        self.size = n
        self.tree = np.array([0] + arr, np.int64)
        for i in range(1, n + 1):
            x = i + (i & -i)
            if x < n + 1:
                self.tree[x] += 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, arr):
        self.size = n
        self.tree = [0] + arr
        for i in range(1, n + 1):
            x = i + (i & -i)
            if x < n + 1:
                self.tree[x] += 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 numpy as np -from numba import njit, i8, jitclass -spec = [("size", i8), ("tree", i8[:])] - -@jitclass(spec) -        self.tree = np.array([0] + arr, np.int64) +        self.tree = [0] + arr