Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10 ** 6)

# to enable variable use in global
global tree, point

# v : current node, f : parent node 
def dfs(v, f):
    for next_v in tree[v]:
        if next_v == f:
            continue
    
        point[next_v] += point[v]
        dfs(next_v, v)

n , q = map(int, input().split())
tree = [[] for _ in range(n)]
point = [0] * n
for _ in range(n - 1):
    a , b = map(int,input().split())
    tree[b - 1].append(a - 1)
    tree[a - 1].append(b - 1)

for _ in range(Q):
    p , x = map(int, input().split())
    p = x - 1
    point[p] += x

dfs(0, 0)
print(*point)

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 6)

# to enable variable use in global
global tree, point

# v : current node, f : parent node 
def dfs(v, f):
    global tree, point
    for next_v in tree[v]:
        if next_v == f:
            continue
    
        point[next_v] += point[v]
        dfs(next_v, v)

n , q = map(int, input().split())
tree = [[] for _ in range(n)]
point = [0] * n
for _ in range(n - 1):
    a , b = map(int,input().split())
    tree[b - 1].append(a - 1)
    tree[a - 1].append(b - 1)

for _ in range(q):
    p , x = map(int, input().split())
    point[p - 1] += x

dfs(0, 0)
print(*point)

Buggy python submission (verdict: Runtime Error):
n , q = map(int, input().split())
tree = [[] for _ in range(n)]
point = [0] * n
for _ in range(n - 1):
    a , b = map(int,input().split())
    tree[b - 1].append(a - 1)
    tree[a - 1].append(b - 1)

for _ in range(Q):
    p , x = map(int, input().split())
    p = x - 1
    point[p] += x

# v : current node, f : parent node 
def dfs(v, f):
    for next_v in tree[v]:
        if next_v == f:
            continue
    
        point[next_v] += point[v]
        dfs(next_v, v)

dfs(0, 0)
print(*point)

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 6)

# to enable variable use in global
global tree, point

# v : current node, f : parent node 
def dfs(v, f):
    global tree, point
    for next_v in tree[v]:
        if next_v == f:
            continue
    
        point[next_v] += point[v]
        dfs(next_v, v)

n , q = map(int, input().split())
tree = [[] for _ in range(n)]
point = [0] * n
for _ in range(n - 1):
    a , b = map(int,input().split())
    tree[b - 1].append(a - 1)
    tree[a - 1].append(b - 1)

for _ in range(q):
    p , x = map(int, input().split())
    point[p - 1] += x

dfs(0, 0)
print(*point)

Buggy python submission (verdict: Runtime Error):
# to enable variable use in global
global tree, point

# v : current node, f : parent node 
def dfs(v, f):
    global tree, point
    for next_v in tree[v]:
        if next_v == f:
            continue
    
        point[next_v] += point[v]
        dfs(next_v, v)

n , q = map(int, input().split())
tree = [[] for _ in range(n)]
point = [0] * n
for _ in range(n - 1):
    a , b = map(int,input().split())
    tree[b - 1].append(a - 1)
    tree[a - 1].append(b - 1)

for _ in range(Q):
    p , x = map(int, input().split())
    p = x - 1
    point[p] += x

dfs(0, 0)
print(*point)

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 6)

# to enable variable use in global
global tree, point

# v : current node, f : parent node 
def dfs(v, f):
    global tree, point
    for next_v in tree[v]:
        if next_v == f:
            continue
    
        point[next_v] += point[v]
        dfs(next_v, v)

n , q = map(int, input().split())
tree = [[] for _ in range(n)]
point = [0] * n
for _ in range(n - 1):
    a , b = map(int,input().split())
    tree[b - 1].append(a - 1)
    tree[a - 1].append(b - 1)

for _ in range(q):
    p , x = map(int, input().split())
    point[p - 1] += x

dfs(0, 0)
print(*point)

Buggy python submission (verdict: Runtime Error):
# to enable variable use in global
global tree, point

# v : current node, f : parent node 
def dfs(v, f):
    global tree, point
    for next_v in tree[v]:
        if next_v == f:
            continue
    
        point[next_v] += point[v]
        dfs(next_v, v)

n, q = list(map(int,input().split()))
# initialize global variables
tree = [[]*n for i in range(n)]
point = [0] * n

for _ in range(n-1):
    a, b = list(map(int, input().split()))

    tree[a-1].append(b-1)
    tree[b-1].append(a-1)

for _ in range(q):
    p, x = list(map(int, input().split()))

    point[p-1] += x

dfs(0, 0)
print(*point)

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 6)

# to enable variable use in global
global tree, point

# v : current node, f : parent node 
def dfs(v, f):
    global tree, point
    for next_v in tree[v]:
        if next_v == f:
            continue
    
        point[next_v] += point[v]
        dfs(next_v, v)

n , q = map(int, input().split())
tree = [[] for _ in range(n)]
point = [0] * n
for _ in range(n - 1):
    a , b = map(int,input().split())
    tree[b - 1].append(a - 1)
    tree[a - 1].append(b - 1)

for _ in range(q):
    p , x = map(int, input().split())
    point[p - 1] += x

dfs(0, 0)
print(*point)

Buggy python submission (verdict: Runtime Error):
# to enable variable use in global
global tree, point

# v : current node, f : parent node 
def dfs(v, f):
    for next_v in tree[v]:
        if next_v == f:
            continue
    
        point[next_v] += point[v]
        dfs(next_v, v)

n, q = list(map(int,input().split()))
# initialize global variables
tree = [[]*n for i in range(200010)]
point = [0] * n

for _ in range(n-1):
    a, b = list(map(int, input().split()))

    tree[a-1].append(b-1)
    tree[b-1].append(a-1)

for _ in range(q):
    p, x = list(map(int, input().split()))

    point[p-1] += x

dfs(0, 0)
print(*point)

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 6)

# to enable variable use in global
global tree, point

# v : current node, f : parent node 
def dfs(v, f):
    global tree, point
    for next_v in tree[v]:
        if next_v == f:
            continue
    
        point[next_v] += point[v]
        dfs(next_v, v)

n , q = map(int, input().split())
tree = [[] for _ in range(n)]
point = [0] * n
for _ in range(n - 1):
    a , b = map(int,input().split())
    tree[b - 1].append(a - 1)
    tree[a - 1].append(b - 1)

for _ in range(q):
    p , x = map(int, input().split())
    point[p - 1] += x

dfs(0, 0)
print(*point)

Buggy python submission (verdict: Runtime Error):
# to enable variable use in global
global tree, point

# v : current node, f : parent node 
def dfs(v, f):
    for next_v in tree[v]:
        if next_v == f:
            continue
    
        point[next_v] += point[v]
        dfs(next_v, v)

n, q = list(map(int,input().split()))
# initialize global variables
tree = [[]*n for i in range(n)]
point = [0] * n

for _ in range(n-1):
    a, b = list(map(int, input().split()))

    tree[a-1].append(b-1)
    tree[b-1].append(a-1)

for _ in range(q):
    p, x = list(map(int, input().split()))

    point[p-1] += x

dfs(0, 0)
print(*point)

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 6)

# to enable variable use in global
global tree, point

# v : current node, f : parent node 
def dfs(v, f):
    global tree, point
    for next_v in tree[v]:
        if next_v == f:
            continue
    
        point[next_v] += point[v]
        dfs(next_v, v)

n , q = map(int, input().split())
tree = [[] for _ in range(n)]
point = [0] * n
for _ in range(n - 1):
    a , b = map(int,input().split())
    tree[b - 1].append(a - 1)
    tree[a - 1].append(b - 1)

for _ in range(q):
    p , x = map(int, input().split())
    point[p - 1] += x

dfs(0, 0)
print(*point)

Buggy python submission (verdict: Runtime Error):
# to enable variable use in global
global tree, point

# v : current node, f : parent node 
def dfs(v, f):
    for next_v in tree[v]:
        if next_v == f:
            continue
    
        point[next_v] += point[v]
        dfs(next_v, v)

n, q = list(map(int,input().split()))
# initialize global variables
tree = [[] for i in range(n)]
point = [0] * n

for _ in range(n-1):
    a, b = list(map(int, input().split()))

    a -= 1
    b -= 1
    tree[a].append(b)
    tree[b].append(a)

for _ in range(q):
    p, x = list(map(int, input().split()))

    p -= 1
    point[p] += x

dfs(0, 0)
print(*point)

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 6)

# to enable variable use in global
global tree, point

# v : current node, f : parent node 
def dfs(v, f):
    global tree, point
    for next_v in tree[v]:
        if next_v == f:
            continue
    
        point[next_v] += point[v]
        dfs(next_v, v)

n , q = map(int, input().split())
tree = [[] for _ in range(n)]
point = [0] * n
for _ in range(n - 1):
    a , b = map(int,input().split())
    tree[b - 1].append(a - 1)
    tree[a - 1].append(b - 1)

for _ in range(q):
    p , x = map(int, input().split())
    point[p - 1] += x

dfs(0, 0)
print(*point)