output_description: For each query of the latter type, print the answer.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N Q
      a_0 a_1 ... a_{N - 1}
      \textrm{Query}_0
      \textrm{Query}_1
      :
      \textrm{Query}_{Q - 1}
attempt: def segfunc(x, y):
      return x + y
  
  
  class SegmentTree:
      def __init__(self, A, n, ide_ele):
          self.ide_ele = ide_ele
          self.num = 2 ** (n - 1).bit_length()
          self.seg = [self.ide_ele] * 2 * self.num
          # set_val
          for i in range(n):
              self.seg[i + self.num - 1] = A[i]
          # built
          for i in range(self.num - 2, -1, -1):
              self.seg[i] = segfunc(self.seg[2 * i + 1], self.seg[2 * i + 2])
  
      def update(self, k, x):
          k += self.num - 1
          self.seg[k] = x
          while k:
              k = (k - 1) // 2
              self.seg[k] = segfunc(self.seg[k * 2 + 1], self.seg[k * 2 + 2])
  
      def query(self, p, q):
          if q <= p:
              return self.ide_ele
          p += self.num - 1
          q += self.num - 2
          res = self.ide_ele
          while q - p > 1:
              if p & 1 == 0:
                  res = segfunc(res, self.seg[p])
              if q & 1 == 1:
                  res = segfunc(res, self.seg[q])
                  q -= 1
              p = p // 2
              q = (q - 1) // 2
          if p == q:
              res = segfunc(res, self.seg[p])
          else:
              res = segfunc(segfunc(res, self.seg[p]), self.seg[q])
          return res
  
  
  N, Q = list(map(int, input().split()))
  A = list(map(int, input().split()))
  ST = SegmentTree(A, N, 0)
  for i in range(Q):
      n, p, x = list(map(int, input().split()))
      if n == 1:
          print(ST.query(p, x))
      else:
          A[p] += x
          ST.update(p, A[p])
  
problem_description: Statement
  
  You are given an array a_0, a_1, ..., a_{N-1} of length N. Process Q queries
  of the following types.
  
    * `0 p x`: a_p \gets a_p + x
    * `1 l r`: Print \sum_{i = l}^{r - 1}{a_i}.
samples: [{"input": "5 5\n    1 2 3 4 5\n    1 0 5\n    1 2 4\n    0 3 10\n    1 0 5\n    1 0 3", "output": "15\n    7\n    25\n    6"}]