Language: C++

/#include <bits/stdc++.h>
using namespace std;
int main() {
	int N, Q, a, b;
	cin >> N >> Q;
	vector<vector<int>> branch(N);
	vector<int> score(N), searched(N);
	//木を生やす
	for (size_t i = 0; i < N - 1; i++)
	{
		cin >> a >> b;
		a--;
		b--;
		branch.at(a).push_back(b);
		branch.at(b).push_back(a);
	}
	//スコアを足しておく
	for (size_t i = 0; i < Q; i++)
	{
		cin >> a >> b;
		a--;
		score.at(a) += b;
	}
	//bfs
	queue<int> que;
	que.push(0);
	searched.at(0) = 1;
	while (!que.empty()) {
		for (size_t i = 0; i < branch.at(que.front()).size(); i++)
		{
			if (searched.at(branch.at(que.front()).at(i))==0)
			{
				que.push(branch.at(que.front()).at(i));
				//if (que.front() == 1&& branch.at(que.front()).at(i)==3)cout << "chk";
				//cout << score.at(que.front())<<"was added to"<< score.at(branch.at(que.front()).at(i));
				score.at(branch.at(que.front()).at(i)) += score.at(que.front());
				searched.at(branch.at(que.front()).at(i))++;
			}
		}
		que.pop();
	}
	for (size_t i = 0; i < N; i++)
	{
		cout << score.at(i) << endl;
	}
}

Compiler output:
a.cc:1:2: error: stray '#' in program
    1 | /#include <bits/stdc++.h>
      |  ^
a.cc:1:1: error: expected unqualified-id before '/' token
    1 | /#include <bits/stdc++.h>
      | ^
a.cc: In function 'int main()':
a.cc:5:9: error: 'cin' was not declared in this scope
    5 |         cin >> N >> Q;
      |         ^~~
a.cc:6:9: error: 'vector' was not declared in this scope
    6 |         vector<vector<int>> branch(N);
      |         ^~~~~~
a.cc:6:23: error: expected primary-expression before 'int'
    6 |         vector<vector<int>> branch(N);
      |                       ^~~
a.cc:7:16: error: expected primary-expression before 'int'
    7 |         vector<int> score(N), searched(N);
      |                ^~~
a.cc:9:14: error: 'size_t' was not declared in this scope
    9 |         for (size_t i = 0; i < N - 1; i++)
      |              ^~~~~~
a.cc:1:1: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
  +++ |+#include <cstddef>
    1 | /#include <bits/stdc++.h>
a.cc:9:28: error: 'i' was not declared in this scope
    9 |         for (size_t i = 0; i < N - 1; i++)
      |                            ^
a.cc:14:17: error: 'branch' was not declared in this scope
   14 |                 branch.at(a).push_back(b);
      |                 ^~~~~~
a.cc:18:14: error: 'size_t' was not declared in this scope
   18 |         for (size_t i = 0; i < Q; i++)
      |              ^~~~~~
a.cc:18:14: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
a.cc:18:28: error: 'i' was not declared in this scope
   18 |         for (size_t i = 0; i < Q; i++)
      |                            ^
a.cc:22:17: error: 'score' was not declared in this scope
   22 |                 score.at(a) += b;
      |                 ^~~~~
a.cc:25:9: error: 'queue' was not declared in this scope
   25 |         queue<int> que;
      |         ^~~~~
a.cc:25:15: error: expected primary-expression before 'int'
   25 |         queue<int> que;
      |               ^~~
a.cc:26:9: error: 'que' was not declared in this scope
   26 |         que.push(0);
      |         ^~~
a.cc:27:9: error: 'searched' was not declared in this scope
   27 |         searched.at(0) = 1;
      |         ^~~~~~~~
a.cc:29:22: error: 'size_t' was not declared in this scope
   29 |                 for (size_t i = 0; i < branch.at(que.front()).size(); i++)
      |                      ^~~~~~
a.cc:29:22: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
a.cc:29:36: error: 'i' was not declared in this scope
   29 |                 for (size_t i = 0; i < branch.at(que.front()).size(); i++)
      |                                    ^
a.cc:29:40: error: 'branch' was not declared in this scope
   29 |                 for (size_t i = 0; i < branch.at(que.front()).size(); i++)
      |                                        ^~~~~~
a.cc:36:33: error: 'score' was not declared in this scope
   36 |                                 score.at(branch.at(que.front()).at(i)) += score.at(que.front());
      |                                 ^~~~~
a.cc:42:14: error: 'size_t' was not declared in this scope
   42 |         for (size_t i = 0; i < N; i++)
      |              ^~~~~~
a.cc:42:14: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
a.cc:42:28: error: 'i' was not declared in this scope
   42 |         for (size_t i = 0; i < N; i++)
      |                            ^
a.cc:44:17: error: 'cout' was not declared in this scope
   44 |                 cout << score.at(i) << endl;
      |                 ^~~~
a.cc:44:25: error: 'score' was not declared in this scope
   44 |                 cout << score.at(i) << endl;
      |                         ^~~~~
a.cc:44:40: error: 'endl' was not declared in this scope
   44 |                 cout << score.at(i) << endl;
      |                                        ^~~~