Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline


def plus_score(tree, index, point):
    tree[index][0] += point
    if len(tree[index][1]) == 0:
        return
    for t in tree[index][1]:
        plus_score(tree, t, point)


def main():
    N, Q = [int(x) for x in input().strip().split()]
    data = []
    for _ in range(N-1):
        data.append([int(x) for x in input().strip().split()])

    operate = [0] * (N+1)
    for _ in range(Q):
        node, point = [int(x) for x in input().strip().split()]
        operate[node] += point

    tree = [[0, []] for _ in range(N+1)]
    for d in data:
        tree[d[0]][1].append(d[1])

    for node, op in enumerate(operate):
        if op > 0:
            plus_score(tree, node, op)

    ans = [x[0] for x in tree]
    print(*ans[1:])


if __name__ == "__main__":
    main()


Fixed submission:
import sys
from collections import deque
input = sys.stdin.readline


def main():
    N, Q = [int(x) for x in input().strip().split()]
    data = []
    for _ in range(N-1):
        data.append([int(x) for x in input().strip().split()])

    operate = [0] * (N+1)
    for _ in range(Q):
        node, point = [int(x) for x in input().strip().split()]
        operate[node] += point

    tree = [[] for _ in range(N+1)]
    for d in data:
        tree[d[0]].append(d[1])
        tree[d[1]].append(d[0])

    stack = deque()
    stack.append((0,1))  # スタートノード
    while len(stack) > 0:
        parent_node, proc_node = stack.popleft()
        operate[proc_node] += operate[parent_node]
        for child_node in tree[proc_node]:
            if child_node == parent_node:
                continue
            stack.append((proc_node, child_node))

    print(*operate[1:])


if __name__ == "__main__":
    main()

Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline


def plus_score(tree, index, point):
    tree[index][0] += point
    if len(tree[index][1]) == 0:
        return
    for t in tree[index][1]:
        plus_score(tree, t, point)


def main():
    N, Q = [int(x) for x in input().strip().split()]
    data = []
    for _ in range(N-1):
        data.append([int(x) for x in input().strip().split()])
    operate = []
    for _ in range(Q):
        operate.append([int(x) for x in input().strip().split()])

    tree = [ [0,[]] for _ in range(N+1)]
    for d in data:
        tree[d[0]][1].append(d[1])

    for op in operate:
        plus_score(tree, op[0], op[1])

    ans = [x[0] for x in tree]
    print(*ans[1:])


if __name__ == "__main__":
    main()


Fixed submission:
import sys
from collections import deque
input = sys.stdin.readline


def main():
    N, Q = [int(x) for x in input().strip().split()]
    data = []
    for _ in range(N-1):
        data.append([int(x) for x in input().strip().split()])

    operate = [0] * (N+1)
    for _ in range(Q):
        node, point = [int(x) for x in input().strip().split()]
        operate[node] += point

    tree = [[] for _ in range(N+1)]
    for d in data:
        tree[d[0]].append(d[1])
        tree[d[1]].append(d[0])

    stack = deque()
    stack.append((0,1))  # スタートノード
    while len(stack) > 0:
        parent_node, proc_node = stack.popleft()
        operate[proc_node] += operate[parent_node]
        for child_node in tree[proc_node]:
            if child_node == parent_node:
                continue
            stack.append((proc_node, child_node))

    print(*operate[1:])


if __name__ == "__main__":
    main()