For this Question: Given a tree consisting of N nodes (from 1 to N) rooted at 1. You are given a node, your task is to calculate the sum of values of all nodes present at the same level that is of the given node.First line of input contains two space separated integers denoting the number of nodes N and the given node P. Next N-1 lines contains two space separated integers U and V, denoting an edge of the tree. 
Last line of input contains N space separated integers denoting value of each node.

Constraints:-
2 <= N <= 10<sup>4</sup>
1 <= P <= N
1 <= U, V <= N
1 <= value[i] <= 10<sup>5</sup>Print the sum of all the nodes present at the same level as the node P.Sample Input:-
5 4
1 2
1 3
3 4
3 5
2 4 8 16 32

Sample Output:-
48

Explanation:-
  1
 / \
2   3
   / \
  4   5
Nodes present at same level as node 5 are:- 4 and 5, I have written this Solution Code: from collections import deque

N,node = map(int,input().strip().split())

dic = {}
for i in range(N-1):
	n1,n2 = map(int,input().strip().split())
	if dic.get(n1):
		dic[n1].append(n2)
	else:
		dic[n1] = [n2]
	if dic.get(n2):
		dic[n2].append(n1)
	else:
		dic[n2] = [n1]

arr = [int(i) for i in input().strip().split()]
visited = set()

queue = deque()
queue.append(1)

def find_sum(node,queue):
	if node==1:
		return arr[0]

	flag = False
	while(queue):
		length = len(queue)
		while(length):
			nodes = queue.popleft()
			visited.add(nodes)
			if dic.get(nodes):
				for i in dic[nodes]:
					if i not in visited:
						queue.append(i)
						if i==node:
							flag = True
			length -= 1
		#print(queue)
		if flag:
			sumi = 0
			for i in queue:
				sumi += arr[i-1]
			return sumi

print(find_sum(node,queue)), In this Programming Language: Python, Now tell me if this Code is compilable or not?