Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
N = int(input())
G = [None for i in range(N)]
for i in range(N):
  temp = list(map(int, input().split()))
  G[i] = temp[1:]
  
INF = 2**31 -1

temp = 1
while temp < N:
  temp *= 2

lis = [INF for i in range(2*temp-1)]

def getSum(x):
  x += temp-1
  w_sum = lis[x]
  while x > 0:
    x = (x-1) // 2
    w_sum += lis[x]
  return w_sum

def add(a, b, x, k=0, l=0, r=temp):
  if r <= a or b <= l:
    return 0

  if a <= l and r <= b:
    lis[k] += x
    return 0
  
  add(a, b, k*2+1, l, (l+r)//2)
  add(a, b, k*2+2, (l+r)//2, r)
arr = [[0,0] for i in range(200010)]

def dfs(k, a=0):
  arr[0][k] = a
  a += 1
  for i in range(len(G[k])):
    dfs(G[k][i])
  arr[1][k] = a
  
dfs()
Q = int(intput())
for i in range(Q):
  querry = list(map(int, input().split()))
  if querry[0] == 0:
    add()
  else:
    print(getSum()




Fixed submission:
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(1000000)

class weightRtree:
    def __init__(self, num):
        self.num = num
        self.weight = [0] * (num+1) 
      
    def add(self, v, w):
        if v == 0:
            return 0
        while v <= self.num:
            self.weight[v] += w
            v += (-v) & v    

    def getSum(self, u):
        temp = 0
        while u > 0:
            temp += self.weight[u]
            u -= (-u) & u
        return temp

N = int(input())
left = [0] * N
right = [0] * N
Tree = [set(map(int, input().split()[1:])) for i in range(N)]

def DFS(count, source):
    count += 1
    left[source] = count
    for item in Tree[source]:
        count = DFS(count, item)
    count += 1
    right[source] = count
    return count

Object = weightRtree(DFS(1, 0))

Q = int(input())
for i in range(Q):
    alist = list(map(int, input().split()))
    if not alist[0]:
        Object.add(left[alist[1]], alist[2])
        Object.add(right[alist[1]], -alist[2])
    else:
        print(Object.getSum(right[alist[1]] - 1))

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
N = int(input())
G = [None for i in range(N)]
for i in range(N):
  temp = list(map(int, input().split()))
  G[i] = temp[1:]
  
INF = 2**31 -1

temp = 1
while temp < N:
  temp *= 2

lis = [INF for i in range(2*temp-1)]

def getSum(x):
  x += temp-1
  w_sum = lis[x]
  while x > 0:
    x = (x-1) // 2
    w_sum += lis[x]
  return w_sum

def add(a, b, x, k=0, l=0, r=temp):
  if r <= a or b <= l:
    return 0

  if a <= l and r <= b:
    lis[k] += x
    return 0
  
  add(a, b, k*2+1, l, (l+r)//2)
  add(a, b, k*2+2, (l+r)//2, r)

def dfs(k, a=0):
  arr[0][k] = a
  a += 1
  for i in range(len(G[k])):
    dfs(G[k][i])
  arr[1][k] = a
  
arr = [[0,0] for i in range(200010)]


  
dfs()
Q = int(input())
for i in range(Q):
  querry = list(map(int, input().split()))
  if querry[0] == 0:
    add(arr[0][querry[1]], arr[1][querry[1]],w)
  else:
    print(getSum(arr[0][querry[1]])


Fixed submission:
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(1000000)

class weightRtree:
    def __init__(self, num):
        self.num = num
        self.weight = [0] * (num+1) 
      
    def add(self, v, w):
        if v == 0:
            return 0
        while v <= self.num:
            self.weight[v] += w
            v += (-v) & v    

    def getSum(self, u):
        temp = 0
        while u > 0:
            temp += self.weight[u]
            u -= (-u) & u
        return temp

N = int(input())
left = [0] * N
right = [0] * N
Tree = [set(map(int, input().split()[1:])) for i in range(N)]

def DFS(count, source):
    count += 1
    left[source] = count
    for item in Tree[source]:
        count = DFS(count, item)
    count += 1
    right[source] = count
    return count

Object = weightRtree(DFS(1, 0))

Q = int(input())
for i in range(Q):
    alist = list(map(int, input().split()))
    if not alist[0]:
        Object.add(left[alist[1]], alist[2])
        Object.add(right[alist[1]], -alist[2])
    else:
        print(Object.getSum(right[alist[1]] - 1))

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
class weightRtree:
    def __init__(self, num):
        self.num = num
        self.weight = [0] * (num+1) 
      
    def add(self, v, w):
        if v == 0:
            return 0
        while v <= self.num:
            self.weight[v] += w
            v += (-v) & v    

    def getSum(self, u):
        temp = 0
        while u > 0:
            temp += self.weight[u]
            u -= (-u) & u
        return temp

N = int(input())
left = [0] * N
right = [0] * N
Tree = [set(map(int, input().split()[1:])) for i in range(N)]

def DFS(count, source):
    count += 1
    left[source] = count
    for item in Tree[source]:
        count = DFS(count, item)
    count += 1
    right[source] = count
    return count

Object = weightRtree(DFS(1, 0))

Q = int(input())
for i in range(Q):
    alist = list(map(int, input().split()))
    if not alist[0]:
        Object.add(left[alist[1]], alist[2])
        Object.add(right[alist[1]], -alist[2])
    else:
        print(Object.getSum(right[alist[1]] - 1))




Fixed submission:
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(1000000)

class weightRtree:
    def __init__(self, num):
        self.num = num
        self.weight = [0] * (num+1) 
      
    def add(self, v, w):
        if v == 0:
            return 0
        while v <= self.num:
            self.weight[v] += w
            v += (-v) & v    

    def getSum(self, u):
        temp = 0
        while u > 0:
            temp += self.weight[u]
            u -= (-u) & u
        return temp

N = int(input())
left = [0] * N
right = [0] * N
Tree = [set(map(int, input().split()[1:])) for i in range(N)]

def DFS(count, source):
    count += 1
    left[source] = count
    for item in Tree[source]:
        count = DFS(count, item)
    count += 1
    right[source] = count
    return count

Object = weightRtree(DFS(1, 0))

Q = int(input())
for i in range(Q):
    alist = list(map(int, input().split()))
    if not alist[0]:
        Object.add(left[alist[1]], alist[2])
        Object.add(right[alist[1]], -alist[2])
    else:
        print(Object.getSum(right[alist[1]] - 1))