

code = """



# distutils: language=c++

# distutils: include_dirs=[/home/USERNAME/.local/lib/python3.8/site-packages/numpy/core/include, /opt/atcoder-stl]

# cython: boundscheck=False

# cython: wraparound=False





cimport numpy as np

cdef extern from "<atcoder/fenwicktree>" namespace "atcoder" nogil:

    cdef cppclass fenwick_tree[T]:

        fenwick_tree(int n)

        void add(int p, T x)

        T sum(int l, int r)



cdef class FenwickTree:

    cdef fenwick_tree[long] *_thisptr

    def __cinit__(self, np.ndarray[long, ndim=1] array):

        cdef int N = array.size

        self._thisptr = new fenwick_tree[long](N)

        for i in range(N):

            self.add(i, array[i])

    cpdef void add(self, int p, long x):

        self._thisptr.add(p, x)

    cpdef long sum(self, int l, int r):

        return self._thisptr.sum(l, r)

"""





import os, sys, getpass



if sys.argv[-1] == 'ONLINE_JUDGE':

    code = code.replace("USERNAME", getpass.getuser())

    open('atcoder.pyx','w').write(code)

    os.system('cythonize -i -3 -b atcoder.pyx')

    sys.exit(0)





from atcoder import FenwickTree

import numpy as np



N,Q = list(map(int,input().split()))

bit = FenwickTree(np.array(list(map(int,input().split())), dtype=np.int))



for i in range(Q):

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

    if a==0:

        bit.add(b,c)

    else:

        print((bit.sum(b,c)))


code = """



# distutils: language=c++

# distutils: include_dirs=[/home/USERNAME/.local/lib/python3.8/site-packages/numpy/core/include, /opt/atcoder-stl]

# cython: boundscheck=False

# cython: wraparound=False



from libc.stdio cimport getchar, printf

from libcpp.vector cimport vector

cdef inline vector[int] readint(int n) nogil:

    cdef int b, c

    cdef vector[int] *v = new vector[int]()

    for i in range(n):

        c = 0

        while 1:

            b = getchar() - 48

            if b < 0: break

            c = c * 10 + b

        v.push_back(c)

    return v[0]



cpdef vector[int] readInt(int n):

    return readint(n)

cdef extern from "<atcoder/fenwicktree>" namespace "atcoder" nogil:

    cdef cppclass fenwick_tree[T]:

        fenwick_tree(int n)

        void add(int p, T x)

        T sum(int l, int r)



cdef class FenwickTree:

    cdef fenwick_tree[long long] *_thisptr

    def __cinit__(self, int n):

        self._thisptr = new fenwick_tree[long long](n)

    cpdef void add(self, int p, long long x):

        self._thisptr.add(p, x)

    cpdef long long sum(self, int l, int r):

        return self._thisptr.sum(l, r)

"""





import os, sys, getpass



if sys.argv[-1] == 'ONLINE_JUDGE':

    code.replace("USERNAME", getpass.getuser())

    open('atcoder.pyx','w').write(code)

    os.system('cythonize -i -3 -b atcoder.pyx')

    sys.exit(0)





from atcoder import readInt, FenwickTree



n, q = readInt(2)

bit = FenwickTree(n)

*list(map(bit.add, list(range(n)), readInt(n))),

res = []

for i in range(q):

    t, u, v = readInt(3)

    if t: res.append(bit.sum(u, v))

    else: bit.add(u, v)

print(('\n'.join(map(str, res))))
code = """
# distutils: language=c++
# distutils: include_dirs=[/home/USERNAME/.local/lib/python3.8/site-packages/numpy/core/include, /opt/atcoder-stl]
# cython: boundscheck=False
# cython: wraparound=False
cimport numpy as np
cdef extern from "<atcoder/fenwicktree>" namespace "atcoder" nogil:
    cdef cppclass fenwick_tree[T]:
        fenwick_tree(int n)
        void add(int p, T x)
        T sum(int l, int r)
cdef class FenwickTree:
    cdef fenwick_tree[long] *_thisptr
    def __cinit__(self, np.ndarray[long, ndim=1] array):
        cdef int N = array.size
        self._thisptr = new fenwick_tree[long](N)
        for i in range(N):
            self.add(i, array[i])
    cpdef void add(self, int p, long x):
        self._thisptr.add(p, x)
    cpdef long sum(self, int l, int r):
        return self._thisptr.sum(l, r)
"""
import os, sys, getpass

if sys.argv[-1] == "ONLINE_JUDGE":
    code = code.replace("USERNAME", getpass.getuser())
    open("atcoder.pyx", "w").write(code)
    os.system("cythonize -i -3 -b atcoder.pyx")
    sys.exit(0)
from atcoder import FenwickTree
import numpy as np

N, Q = list(map(int, input().split()))
bit = FenwickTree(np.array(list(map(int, input().split())), dtype=np.int))
for i in range(Q):
    a, b, c = list(map(int, input().split()))
    if a == 0:
        bit.add(b, c)
    else:
        print((bit.sum(b, c)))

code = """
# distutils: language=c++
# distutils: include_dirs=[/home/USERNAME/.local/lib/python3.8/site-packages/numpy/core/include, /opt/atcoder-stl]
# cython: boundscheck=False
# cython: wraparound=False
from libc.stdio cimport getchar, printf
from libcpp.vector cimport vector
cdef inline vector[int] readint(int n) nogil:
    cdef int b, c
    cdef vector[int] *v = new vector[int]()
    for i in range(n):
        c = 0
        while 1:
            b = getchar() - 48
            if b < 0: break
            c = c * 10 + b
        v.push_back(c)
    return v[0]
cpdef vector[int] readInt(int n):
    return readint(n)
cdef extern from "<atcoder/fenwicktree>" namespace "atcoder" nogil:
    cdef cppclass fenwick_tree[T]:
        fenwick_tree(int n)
        void add(int p, T x)
        T sum(int l, int r)
cdef class FenwickTree:
    cdef fenwick_tree[long long] *_thisptr
    def __cinit__(self, int n):
        self._thisptr = new fenwick_tree[long long](n)
    cpdef void add(self, int p, long long x):
        self._thisptr.add(p, x)
    cpdef long long sum(self, int l, int r):
        return self._thisptr.sum(l, r)
"""
import os, sys, getpass

if sys.argv[-1] == "ONLINE_JUDGE":
    code.replace("USERNAME", getpass.getuser())
    open("atcoder.pyx", "w").write(code)
    os.system("cythonize -i -3 -b atcoder.pyx")
    sys.exit(0)
from atcoder import readInt, FenwickTree

n, q = readInt(2)
bit = FenwickTree(n)
*list(map(bit.add, list(range(n)), readInt(n))),
res = []
for i in range(q):
    t, u, v = readInt(3)
    if t:
        res.append(bit.sum(u, v))
    else:
        bit.add(u, v)
print(("\n".join(map(str, res))))

-cimport numpy as np +from libc.stdio cimport getchar, printf +from libcpp.vector cimport vector +cdef inline vector[int] readint(int n) nogil: +    cdef int b, c +    cdef vector[int] *v = new vector[int]() +    for i in range(n): +        c = 0 +        while 1: +            b = getchar() - 48 +            if b < 0: break +            c = c * 10 + b +        v.push_back(c) +    return v[0] +cpdef vector[int] readInt(int n): +    return readint(n) -    cdef fenwick_tree[long] *_thisptr -    def __cinit__(self, np.ndarray[long, ndim=1] array): -        cdef int N = array.size -        self._thisptr = new fenwick_tree[long](N) -        for i in range(N): -            self.add(i, array[i]) -    cpdef void add(self, int p, long x): +    cdef fenwick_tree[long long] *_thisptr +    def __cinit__(self, int n): +        self._thisptr = new fenwick_tree[long long](n) +    cpdef void add(self, int p, long long x): -    cpdef long sum(self, int l, int r): +    cpdef long long sum(self, int l, int r): -    code = code.replace("USERNAME", getpass.getuser()) +    code.replace("USERNAME", getpass.getuser()) -from atcoder import FenwickTree -import numpy as np +from atcoder import readInt, FenwickTree -N, Q = list(map(int, input().split())) -bit = FenwickTree(np.array(list(map(int, input().split())), dtype=np.int)) -for i in range(Q): -    a, b, c = list(map(int, input().split())) -    if a == 0: -        bit.add(b, c) +n, q = readInt(2) +bit = FenwickTree(n) +*list(map(bit.add, list(range(n)), readInt(n))), +res = [] +for i in range(q): +    t, u, v = readInt(3) +    if t: +        res.append(bit.sum(u, v)) -        print((bit.sum(b, c))) +        bit.add(u, v) +print(("\n".join(map(str, res))))