criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include<bits/stdc++.h>
#define int long long
using namespace std;
int g[222222], s[222222] = {};
vector<int> e[222222];
void start(int now){
  for(auto&& i: e[now]) s[i] += s[now], dfs(i);
}
signed main(){
  int n, m, a, b;
  cin>>n>>m;
  for(auto&& i: g) i = -1;
  for(int i = 0; i < n - 1; i++)
    cin>>a>>b,
    a--, b--,
    g[b] = a,
    e[a].push_back(b);
  while(m--)
    cin>>a>>b,
    a--,
    s[a] += b;
  int start = 0;
  for(; g[i] != -1; i++);
  dfs(start);
  for(int i = 0; i < n; i++)
    cout<<s[i]<<' ';
  cout<<endl;
}


Compiler output:
a.cc: In function 'void start(long long int)':
a.cc:7:41: error: 'dfs' was not declared in this scope; did you mean 'ffs'?
    7 |   for(auto&& i: e[now]) s[i] += s[now], dfs(i);
      |                                         ^~~
      |                                         ffs
a.cc: In function 'int main()':
a.cc:23:11: error: 'i' was not declared in this scope
   23 |   for(; g[i] != -1; i++);
      |           ^
a.cc:24:3: error: 'dfs' was not declared in this scope; did you mean 'ffs'?
   24 |   dfs(start);
      |   ^~~
      |   ffs
Language: C++


#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <queue>
#include <algorithm>
#include<iostream>
#include<vector>
#include<map>
#include<string>
#include <iomanip>
#include<deque>
#include<stack>
#include<set>
#include <numeric>

using namespace std;
typedef unsigned int uint;
typedef long long ll;
//typedef pair<int, int> P;#include <stdio.h>
const int INF = 111111111;
const ll LLINF = 1e17 + 1;
const int DX[9] = { 0,0,1,-1, 1, 1, -1, -1, 0 }; // 4;４近傍
const int DY[9] = { 1,-1,0,0, 1, -1, 1, -1, 0 }; // 8:８近傍 9:(0,0)を含む
const int DIV = 1000000007; //10^9 + 7
const double PI = 3.14159265358979323846264338327950288;


ll gcd(ll a, ll b);

int main() {

	//==================================
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	//==================================
	
	// 入力の読み込み
	int N, Q;
	cin >> N >> Q;

	// edgeデータはN-1個
	vector<pair<int, int>> edge(N-1);
	for (int i = 0; i < edge.size(); i++) {
		cin >> edge[i].first >> edge[i].second;
	}

	// opデータはQ個
	vector<pair<int, int>> op(Q);
	for (int i = 0; i < op.size(); i++) {
		cin >> op[i].first >> op[i].second;
	}

	// ツリー
	struct Node {
	public:
		int depth;	// ツリーの深さ。ルートは0。
		int value;
		vector<Node*> children;

		Node() {
			depth = INT_MAX;
			value = 0;
			children.clear();
		}

		void AddValue(int delta) {
			value += delta;
			for (int i = 0; i < children.size(); i++)
				children[i]->AddValue(delta);
		}
	};

	// ノードの状態。
	// 最初の要素がルート。
	vector<Node*> node(N);
	for (int i = 0; i < node.size(); i++)
		node[i] = new Node();

	// ルートの深さは0。
	node[0]->depth = 0;

	// ツリーを構築
	for (int i = 0; i < edge.size(); i++) {
		int indexA = edge[i].first - 1;
		int indexB = edge[i].second - 1;

		Node* a = node[indexA];
		Node* b = node[indexB];

		Node* parent;
		Node* child;
		if (a->depth < b->depth) {
			parent = a;
			child = b;
		}
		else {
			parent = b;
			child = a;
		}

		parent->children.push_back(child);

		// 深さの設定。
		child->depth = parent->depth + 1;
	}

	// opのデータを処理
	for (int i = 0; i < op.size(); i++) {
		// サブツリーの値を加算
		node[op[i].first - 1]->AddValue(op[i].second);
	}

	// 出力
	for (int i = 0; i < node.size(); i++)
		cout << node[i]->value << ' ';
	
	// 解放
	for (int i = 0; i < node.size(); i++)
		delete node[i];
	node.clear();


}



Compiler output:
a.cc: In constructor 'main()::Node::Node()':
a.cc:63:33: error: 'INT_MAX' was not declared in this scope
   63 |                         depth = INT_MAX;
      |                                 ^~~~~~~
a.cc:16:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   15 | #include <numeric>
  +++ |+#include <climits>
   16 |
Language: C++

#include<iostream>
#include<vector>

std::vector<std::vector<int>> hen;//各頂点がどこに向かう辺を持つか
std::vector<int> parent;//各頂点の親
std::vector<int> num;
std::vector<int> add;

void dfs(int i,int prev,int cur_add){
    cur_add += add[i];
    num[i] = cur_add;
    for(auto j : hen[i]){
        if( j == prev)continue;
        dfs(j,i,cur_add);
    }
}



int main()
{
    int n,q;
    std::cin>>n>>q;
    int a[n-1],b[n-1];
    hen.resize(n);
    for(int i=0;i+1<n;i++){
        std::cin>>a[i]>>b[i];
        a[i]--;
        b[i]--;
        hen[a[i]].push_back(b[i]);
        hen[b[i]].push_back(a[i]);
    }
    parent.resize(n);
    num.resize(n);
    add.resize(n);
    for(int i=0;i<q;i++){
        int p,x;
        std::cin>>p>>x;
        p--;
        add[p] += x;
    }
    dfs(0,-1,0);
    for(int i=0;i<n;i++)std::cout<<num[i]<<" ";
    return 0;
}#include<iostream>
#include<vector>

std::vector<std::vector<int>> hen;//各頂点がどこに向かう辺を持つか
std::vector<int> parent;//各頂点の親
std::vector<int> num;
std::vector<int> add;

void dfs(int i,int prev,int cur_add){
    cur_add += add[i];
    num[i] = cur_add;
    for(auto j : hen[i]){
        if( j == prev)continue;
        dfs(j,i,cur_add);
    }
}



int main()
{
    int n,q;
    std::cin>>n>>q;
    int a[n-1],b[n-1];
    hen.resize(n);
    for(int i=0;i+1<n;i++){
        std::cin>>a[i]>>b[i];
        a[i]--;
        b[i]--;
        hen[a[i]].push_back(b[i]);
        hen[b[i]].push_back(a[i]);
    }
    parent.resize(n);
    num.resize(n);
    add.resize(n);
    for(int i=0;i<q;i++){
        int p,x;
        std::cin>>p>>x;
        p--;
        add[p] += x;
    }
    dfs(0,-1,0);
    for(int i=0;i<n;i++)std::cout<<num[i]<<" ";
    return 0;
}

Compiler output:
a.cc:45:2: error: stray '#' in program
   45 | }#include<iostream>
      |  ^
a.cc:45:3: error: 'include' does not name a type
   45 | }#include<iostream>
      |   ^~~~~~~
a.cc:49:18: error: redefinition of 'std::vector<int> parent'
   49 | std::vector<int> parent;//各頂点の親
      |                  ^~~~~~
a.cc:5:18: note: 'std::vector<int> parent' previously declared here
    5 | std::vector<int> parent;//各頂点の親
      |                  ^~~~~~
a.cc:50:18: error: redefinition of 'std::vector<int> num'
   50 | std::vector<int> num;
      |                  ^~~
a.cc:6:18: note: 'std::vector<int> num' previously declared here
    6 | std::vector<int> num;
      |                  ^~~
a.cc:51:18: error: redefinition of 'std::vector<int> add'
   51 | std::vector<int> add;
      |                  ^~~
a.cc:7:18: note: 'std::vector<int> add' previously declared here
    7 | std::vector<int> add;
      |                  ^~~
a.cc:53:6: error: redefinition of 'void dfs(int, int, int)'
   53 | void dfs(int i,int prev,int cur_add){
      |      ^~~
a.cc:9:6: note: 'void dfs(int, int, int)' previously defined here
    9 | void dfs(int i,int prev,int cur_add){
      |      ^~~
a.cc:64:5: error: redefinition of 'int main()'
   64 | int main()
      |     ^~~~
a.cc:20:5: note: 'int main()' previously defined here
   20 | int main()
      |     ^~~~
Language: C++

#include<iostream>
#include<vector>

std::vector<std::vector<int>> hen;//各頂点がどこに向かう辺を持つか
std::vector<int> parent;//各頂点の親
std::vector<int> num;
std::vector<int> add;

void dfs(int i,int prev,int cur_add){
    cur_add += add[i];
    num[i] = cur_add;
    for(auto j : hen[i])
        if( j == prev)continue;
        dfs(j,i,cur_add);
    }
}



int main()
{
    int n,q;
    std::cin>>n>>q;
    int a[n-1],b[n-1];
    hen.resize(n);
    for(int i=0;i+1<n;i++){
        std::cin>>a[i]>>b[i];
        a[i]--;
        b[i]--;
        hen[a[i]].push_back(b[i]);
        hen[b[i]].push_back(a[i]);
    }
    parent.resize(n);
    num.resize(n);
    add.resize(n);
    for(int i=0;i<q;i++){
        int p,x;
        std::cin>>p>>x;
        p--;
        add[p] += x;
    }
    dfs(0,-1,0);
    for(int i=0;i<n;i++)std::cout<<num[i]<<" ";
    return 0;
}

Compiler output:
a.cc: In function 'void dfs(int, int, int)':
a.cc:14:13: error: 'j' was not declared in this scope
   14 |         dfs(j,i,cur_add);
      |             ^
a.cc: At global scope:
a.cc:16:1: error: expected declaration before '}' token
   16 | }
      | ^
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
using namespace std;

vector<int>to[200005];
vector<int>ans;
void dfs(int v,int p=-1){
  for(int u:to[v]){
    if (u==p)continue;
    ans[u]+=ans[v];
    dfs(u,v);
  }
}

int main(){
  int n,q;
  cin>>n>>q;  
  rep(i,n-1){
    vector<int> a,b;
    cin>>a[i]>>b[i];
    --a;--b;
    to[a].push_back(b);
    to[b].push_back(a);
  }
  ans.resize(n);
  rep(i,q){
    int p,x;
    cin>>p>>x;
    --p;
    ans[p]+=x;
  }
  dfs(0);
  rep(i,n){
    cout<<ans[i]<<endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:5: error: no match for 'operator--' (operand type is 'std::vector<int>')
   21 |     --a;--b;
      |     ^~~
a.cc:21:9: error: no match for 'operator--' (operand type is 'std::vector<int>')
   21 |     --a;--b;
      |         ^~~
a.cc:22:7: error: no match for 'operator[]' (operand types are 'std::vector<int> [200005]' and 'std::vector<int>')
   22 |     to[a].push_back(b);
      |       ^
a.cc:23:7: error: no match for 'operator[]' (operand types are 'std::vector<int> [200005]' and 'std::vector<int>')
   23 |     to[b].push_back(a);
      |       ^
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
using namespace std;
typedef long long ll;
const int INF=1001001001;

vector<int>to[200005];
vector<int>ans;
void dfs(int v,int p=-1){
  for(int u:to[v]){
    if (u==p)continue;
    ans[u]+=ans[v];
    dfs(u,v);
  }
}

int main(){
  int n,q;
  cin>>n>>q;  
  rep(i,n-1){
    int a,b;
    cin>>a[i]>>b[i];
    --a;--b;
    to[a].push_back(b);
    to[b].push_back(a);
  }
  ans.resize(n);
  rep(i,q){
    int p,x;
    cin>>p[i]>>x[i];
    --p;
    ans[p]+=x;
  }
  dfs(0);
  rep(i,n){
    cout<<ans[i]<<endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:11: error: invalid types 'int[int]' for array subscript
   22 |     cin>>a[i]>>b[i];
      |           ^
a.cc:22:17: error: invalid types 'int[int]' for array subscript
   22 |     cin>>a[i]>>b[i];
      |                 ^
a.cc:30:11: error: invalid types 'int[int]' for array subscript
   30 |     cin>>p[i]>>x[i];
      |           ^
a.cc:30:17: error: invalid types 'int[int]' for array subscript
   30 |     cin>>p[i]>>x[i];
      |                 ^
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;

vector<int> to[200005];
vector<int> ans;

void dfs(int v,int p=-1){
  for(int b:to[v]){
    if(b==p)continue;
    ans[b] += ans[v];
    bfs(b,v);
  }
}

int main(){
  int n,q;
  cin >> n >> q;
  rep(i,n-1){
    int a,b;
    cin >> a >> b;
    a--; b--;
    to[a].push_back(b);
    to[b].push_back(a);
  }
  ans.resize(n);
  rep(i,q){
    int p,x;
    cin >> p >> x;
    p--;
    ans[p] += x;
  }
  dfs(0);
  rep(i,n) cout << ans[i] << endl;
}


Compiler output:
a.cc: In function 'void dfs(int, int)':
a.cc:13:5: error: 'bfs' was not declared in this scope; did you mean 'ffs'?
   13 |     bfs(b,v);
      |     ^~~
      |     ffs
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;

vector<int> to[20005];
vector<int> ans;

int bfs(int v,int p=-1){
  for(int b:to[v]){
    if(b==p)continue;
    ans[b] += ans[v];
  }
  bfs(b,v);
}

int main(){
  int n,q;
  cin >> n >> q;
  rep(i,n-1){
    int a,b;
    a--; b--;
    to[a].push_back(b);
    to[b].push_back(a);
  }
  ans.resize();
  rep(i,q){
    int p,x;
    cin >> p >> x;
    p--;
    ans[p] += x;
  }
  bfs(0);
  rep(i,n) cout << ans[i] << endl;
}

Compiler output:
a.cc: In function 'int bfs(int, int)':
a.cc:14:7: error: 'b' was not declared in this scope
   14 |   bfs(b,v);
      |       ^
a.cc:15:1: warning: no return statement in function returning non-void [-Wreturn-type]
   15 | }
      | ^
a.cc: In function 'int main()':
a.cc:26:13: error: no matching function for call to 'std::vector<int>::resize()'
   26 |   ans.resize();
      |   ~~~~~~~~~~^~
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:1013:7: note: candidate: 'void std::vector<_Tp, _Alloc>::resize(size_type) [with _Tp = int; _Alloc = std::allocator<int>; size_type = long unsigned int]'
 1013 |       resize(size_type __new_size)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:1013:7: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_vector.h:1034:7: note: candidate: 'void std::vector<_Tp, _Alloc>::resize(size_type, const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; size_type = long unsigned int; value_type = int]'
 1034 |       resize(size_type __new_size, const value_type& __x)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:1034:7: note:   candidate expects 2 arguments, 0 provided
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a[maxn];
const int maxn=2e5+6;
vector<int> e[maxn];
void dfs(int u,int fa)
{
	a[u]+=a[fa];
	for(int i=0;i<e[u].size();i++)
	{
		int v=e[u][i]; 
		if(v==fa) continue;
		dfs(v,u);
	}
}
int main()
{
    int n,q;cin>>n>>q;
    for(int i=1;i<n;i++)
    {
    	int x,y;cin>>x>>y;
    	e[y].push_back(x);
    	e[x].push_back(y);
	}
	while(q--)
	{
		int x;ll y;cin>>x>>y;
		a[x]+=y;
	}
	dfs(1,0);
	for(int i=1;i<=n;i++) cout<<a[i]<<" ";
	cout<<endl; 
}


Compiler output:
a.cc:4:6: error: 'maxn' was not declared in this scope
    4 | ll a[maxn];
      |      ^~~~
a.cc: In function 'void dfs(int, int)':
a.cc:9:9: error: 'a' was not declared in this scope
    9 |         a[u]+=a[fa];
      |         ^
a.cc: In function 'int main()':
a.cc:29:17: error: 'a' was not declared in this scope
   29 |                 a[x]+=y;
      |                 ^
a.cc:32:37: error: 'a' was not declared in this scope
   32 |         for(int i=1;i<=n;i++) cout<<a[i]<<" ";
      |                                     ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a[maxn];
const int maxn=2e5+6;
vector<int> e[maxn];

void dfs(int u,int fa)
{
	a[u]+=a[fa];
	for(int i=0;i<e[u].size();i++)
	{
		int v=e[u][i]; 
		if(v==fa) continue;
		dfs(v,u);
	}
}
int main()
{
    int n,q;
    cin>>n>>q;
    for(int i=1;i<n;i++)
    {
    	int x,y;cin>>x>>y;
    	e[y].push_back(x);
    	e[x].push_back(y);
    }
	while(q--)
	{
		int x;ll y;cin>>x>>y;
		a[x]+=y;
	}
	dfs(1,0);
for(int i=1;i<=n;i++) cout<<a[i]<<" ";
	cout<<endl; 
}


Compiler output:
a.cc:4:6: error: 'maxn' was not declared in this scope
    4 | ll a[maxn];
      |      ^~~~
a.cc: In function 'void dfs(int, int)':
a.cc:10:9: error: 'a' was not declared in this scope
   10 |         a[u]+=a[fa];
      |         ^
a.cc: In function 'int main()':
a.cc:31:17: error: 'a' was not declared in this scope
   31 |                 a[x]+=y;
      |                 ^
a.cc:34:29: error: 'a' was not declared in this scope
   34 | for(int i=1;i<=n;i++) cout<<a[i]<<" ";
      |                             ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define long long ll
const int maxn=2e5+6;
vector<int> e[maxn];
ll a[maxn];
void dfs(int u,int fa)
{
	a[u]+=a[fa];
	for(int i=0;i<e[u].size();i++)
	{
		int v=e[u][i]; 
		if(v==fa) continue;
		dfs(v,u);
	}
}
int main()
{
    int n,q;
    cin>>n>>q;
    for(int i=1;i<n;i++)
    {
    	int x,y;cin>>x>>y;
    	e[y].push_back(x);
    	e[x].push_back(y);
    }
	while(q--)
	{
		int x;ll y;cin>>x>>y;
		a[x]+=y;
	}
	dfs(1,0);
for(int i=1;i<=n;i++) cout<<a[i]<<" ";
	cout<<endl; 
}


Compiler output:
a.cc:6:1: error: 'll' does not name a type
    6 | ll a[maxn];
      | ^~
a.cc: In function 'void dfs(int, int)':
a.cc:9:9: error: 'a' was not declared in this scope
    9 |         a[u]+=a[fa];
      |         ^
a.cc: In function 'int main()':
a.cc:29:23: error: 'll' was not declared in this scope
   29 |                 int x;ll y;cin>>x>>y;
      |                       ^~
a.cc:29:36: error: 'y' was not declared in this scope
   29 |                 int x;ll y;cin>>x>>y;
      |                                    ^
a.cc:30:17: error: 'a' was not declared in this scope
   30 |                 a[x]+=y;
      |                 ^
a.cc:33:29: error: 'a' was not declared in this scope
   33 | for(int i=1;i<=n;i++) cout<<a[i]<<" ";
      |                             ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define long long ll;
const int maxn=2e5+6;
vector<int> e[maxn];
ll a[maxn];
void dfs(int u,int fa)
{
	a[u]+=a[fa];
	for(int i=0;i<e[u].size();i++)
	{
		int v=e[u][i]; 
		if(v==fa) continue;
		dfs(v,u);
	}
}
int main()
{
    int n,q;
    cin>>n>>q;
    for(int i=1;i<n;i++)
    {
    	int x,y;cin>>x>>y;
    	e[y].push_back(x);
    	e[x].push_back(y);
    }
	while(q--)
	{
		int x;ll y;cin>>x>>y;
		a[x]+=y;
	}
	dfs(1,0);
for(int i=1;i<=n;i++) cout<<a[i]<<" ";
	cout<<endl; 
}


Compiler output:
a.cc:6:1: error: 'll' does not name a type
    6 | ll a[maxn];
      | ^~
a.cc: In function 'void dfs(int, int)':
a.cc:9:9: error: 'a' was not declared in this scope
    9 |         a[u]+=a[fa];
      |         ^
a.cc: In function 'int main()':
a.cc:29:23: error: 'll' was not declared in this scope
   29 |                 int x;ll y;cin>>x>>y;
      |                       ^~
a.cc:29:36: error: 'y' was not declared in this scope
   29 |                 int x;ll y;cin>>x>>y;
      |                                    ^
a.cc:30:17: error: 'a' was not declared in this scope
   30 |                 a[x]+=y;
      |                 ^
a.cc:33:29: error: 'a' was not declared in this scope
   33 | for(int i=1;i<=n;i++) cout<<a[i]<<" ";
      |                             ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=2e5+6;
int e[maxn][maxn];
ll a[maxn];
void dfs(int u,int fa)
{
	a[u]+=a[fa];
	for(int i=0;i<e[u][n-1];i++)
	{
		int v=e[u][i]; 
		if(v==fa) continue;
		dfs(v,u);
	}
}
int main()
{
    int n,q;cin>>n>>q;
    for(int i=1;i<n;i++)
    {
    	int x,y;cin>>x>>y;
    	e[y][i-1]=x;
    	e[x][i-1]=y;
	}
	while(q--)
	{
		int x;ll y;cin>>x>>y;
		a[x]+=y;
	}
	dfs(1,0);
	for(int i=1;i<=n;i++) cout<<a[i]<<" ";
	cout<<endl; 
}


Compiler output:
a.cc: In function 'void dfs(int, int)':
a.cc:10:28: error: 'n' was not declared in this scope
   10 |         for(int i=0;i<e[u][n-1];i++)
      |                            ^
Language: C++

#include <bits/stdc++.h>
using namespace std;                                
struct node{
  int d;
  struct node* next;  
};
struct node* init(){
  struct node* n = (struct node*)malloc(sizeof(struct node));
  n->d = -1;
  n->next = NULL;   
  return n; 
}
void insert(struct node* n,int d){
  struct node* ne = (struct node*)malloc(sizeof(struct node));
  ne->d = d;
  ne->next = n->next;
  n->next = ne;   
}

void pl(int counter[],struct node* a[],int n,int p){
  if(n != p){
      counter[n] += counter[p];
  }
  struct node* n1 = a[n];
  while(n1->next != NULL){
    pl(counter,a,n1->next->d,n);
    n1 =n1->next;  
  }
}

int main(void){                                     
  int N,Q;
  cin >> N >> Q;
  struct node* ki[N];
  long int counter[N] = {};
  int min_pare = N;
  for(int i = 0; i < N;i++){
    ki[i] = init();  
  }
  for(int i = 1; i <= N-1;i++){
    int a,b;
    cin >> a >> b;
    if(min_pare > a) min_pare = a;
    insert(ki[a-1],b-1);  
  }
  for(int i = 0; i < Q;i++){
    int p,x;
    cin >> p >> x;
    counter[p-1] += x;  
  }
  pl(counter,ki,min_pare-1,min_pare-1);
  for(int i = 0; i < N;i++){
    cout << counter[i] << " ";  
  }

  cout << endl;
  return 0;                                         
}     


Compiler output:
a.cc: In function 'int main()':
a.cc:51:6: error: cannot convert 'long int*' to 'int*'
   51 |   pl(counter,ki,min_pare-1,min_pare-1);
      |      ^~~~~~~
      |      |
      |      long int*
a.cc:20:13: note:   initializing argument 1 of 'void pl(int*, node**, int, int)'
   20 | void pl(int counter[],struct node* a[],int n,int p){
      |         ~~~~^~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)

vetor<int> to[200005];
vector<int>  ans;
void dfs(int v, int p=-1){
	for (int u: to[v]) {
		if (u == p) continue;
		ans[u] += ans[v];
		dfs(u,v);
	}
}

int main() {
	int n, q;;
	cin >> n >>  q;
	rep(i, n-1) {
		int a, b;
		cin >> a >> b;
		--a, --b;
		to[a].push_back(b);
		to[b].push_back(a);

	}
	rep(i, q) {
		int p, x;
		cin >> p >> x;
		--p;
		ans[p] += x;
	}
	dfs(0);
	rep(i, n) {
		cout << ans[i] << endl;
	}
	return 0;
}

Compiler output:
a.cc:5:1: error: 'vetor' does not name a type
    5 | vetor<int> to[200005];
      | ^~~~~
a.cc: In function 'void dfs(int, int)':
a.cc:8:21: error: 'to' was not declared in this scope; did you mean 'tm'?
    8 |         for (int u: to[v]) {
      |                     ^~
      |                     tm
a.cc: In function 'int main()':
a.cc:22:17: error: 'to' was not declared in this scope; did you mean 'tm'?
   22 |                 to[a].push_back(b);
      |                 ^~
      |                 tm
Language: C++

#include <iostream>
#include <iomanip>
#include<math.h>
#include<list>
#include <algorithm>
#include<set>
#include<vector>
#include<math.h>
#include<map>
#include<string>
#include <numeric>
#include <queue>
#include <sstream>

using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = set<long long>;

template<typename T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }

template<typename T>
map<T, T> primeFactor(T n) {
	map<T, T> res;
	for (T i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			res[i] ++;
			n /= i;
		}
	}
	if (n != 1) res[n] = 1;
	return res;
}

template<typename T>
bool IsPrimeNumber(T num)
{
	if (num <= 2) return true;
	else if (num % 2 == 0) return false;

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			return false;
		}
	}

	return true;
}


#define in(x) cin >> x
#define out(x) cout << x
#define outn(x) cout << x << '\n'
#define outs(x) cout << x << ' '
#define rep(i,s,e) for(long i=s;i<e;i++)
#define repeq(i,s,e) for(long i=s;i<=e;i++)



void adder(vll& ans, vector<vll> v, vll cnt, ll root, ll x) {
	rep(i, 0, cnt[root]) {
		ans[v[root][i]] += x;
		adder(ans, v, cnt, v[root][i], x);
	}
}

int main() {

	ll n, q, p, x, tmp;
	bool flg = true;
	in(n);
	in(q);
	vll ans(n, 0), a(n - 1), b(n - 1);
	vector<vll> r(n, vll), c(n, vll);
	vll rCnt(n, 0), cCnt(n, 0);

	return 0;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:80:29: error: expected primary-expression before ')' token
   80 |         vector<vll> r(n, vll), c(n, vll);
      |                             ^
a.cc:80:40: error: expected primary-expression before ')' token
   80 |         vector<vll> r(n, vll), c(n, vll);
      |                                        ^
Language: Java

import java.io.IOException;
import java.util.ArrayList;
import java.util.Scanner;

public class ABC138D {

	static Node[] ns;

	public static void main(String[] args) throws IOException{
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int Q = sc.nextInt();
		ns = new Node[N];
		for(int i = 0;i < N;i++){
			ns[i] = new Node(i);
		}
		for(int i = 0;i < N-1;i++) {
			int a = sc.nextInt()-1;
			int b = sc.nextInt()-1;
			ns[a].add(ns[b]);
			ns[b].add(ns[a]);
		}
		DFS(ns[0],null);
		for(int i = 0;i < Q;i++) {
			int p = sc.nextInt();
			int x = sc.nextInt();
			ns[p-1].cnt += x;
		}
		sum(ns[0]);
		StringBuilder sb = new StringBuilder();
		for(Node n : ns) {
			sb.append(" ").append(n.cnt);
		}
		System.out.println(sb.toString());
	}

	private static void sum(Node n) {
		if(n.p != null) {
			n.cnt += n.p.cnt;
			for(Node c : n) {
				if(c != n.p) {
					sum(c);
				}
			}
		}
	}

	private static void DFS(Node n, Node p) {
		n.p = p;
		for(Node cc : n) {
			if(cc != p) {
				DFS(cc, n);
			}
		}
	}

	static class Node extends ArrayList<Node>{
		Node p;
		int id;
		int cnt = 0;
		Node(int id){
			this.id = id;
		}
	}
}

Compiler output:
Main.java:5: error: class ABC138D is public, should be declared in a file named ABC138D.java
public class ABC138D {
       ^
1 error
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define LOOP(i,o) for(i=0;i<o;i++)
#define ALL(a)  (a).begin(),(a).end()      
void mm(vector<vector<int>> &aa,vector<int> &dd,int x,int r){
  if(aa[x].size()==0){
    return ;
  }
  for(int c:aa[x]){
    mm(aa,dd,c,r);
    dd[c]+=r;
  }
  return ;
}
int main() {
  int n,q;
  cin>>n>>q;
  vector<vector<int>> aa(n+1);
  vector<int> dd(n+1);
  
      
  for(int i=1;i<n;i++){
    int a,b;
    cin>>a>>b;
    aa[a].push_back(b);
  }
  int i;
  LOOP(i,q){
    int h,k;
    cin>>h>>K;
    mm(aa,dd,h,k);
  }
  for(int i=1;i<=n;i++){
    if(i!=n){
      cout<<dd[i]<<" ";
    }
    else{
      cout<<dd[i]<<endl;
    }
  }
}
      
  
  


Compiler output:
a.cc: In function 'int main()':
a.cc:30:13: error: 'K' was not declared in this scope
   30 |     cin>>h>>K;
      |             ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define LOOP(i,o) for(i=0;i<o;i++)
#define ALL(a)  (a).begin(),(a).end()      
void mm(vector<vector<int>> &aa,vector<int> &dd,int x,int r){
  if(aa[x].size()==0){
    return 0;
  }
  for(int c:aa[x]){
    mm(aa,dd,c,r);
    dd[c]+=r;
  }
  return 0;
}
int main() {
  int n,q;
  cin>>n>>q;
  vector<vector<int>> aa(n+1);
  vector<int> dd(n+1);
  
      
  for(int i=1;i<n;i++){
    int a,b;
    cin>>a>>b;
    aa[a].push_back(b);
  }
  int i;
  LOOP(i,q){
    int h,k;
    cin>>h>>K;
    mm(aa,dd,h,k);
  }
  for(int i=1;i<=n;i++){
    if(i!=n){
      cout<<dd[i]<<" ";
    }
    else{
      cout<<dd[i]<<endl;
    }
  }
}
      
  
  


Compiler output:
a.cc: In function 'void mm(std::vector<std::vector<int> >&, std::vector<int>&, int, int)':
a.cc:7:12: error: return-statement with a value, in function returning 'void' [-fpermissive]
    7 |     return 0;
      |            ^
a.cc:13:10: error: return-statement with a value, in function returning 'void' [-fpermissive]
   13 |   return 0;
      |          ^
a.cc: In function 'int main()':
a.cc:30:13: error: 'K' was not declared in this scope
   30 |     cin>>h>>K;
      |             ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define LOOP(i,o) for(i=0;i<o;i++)
#define ALL(a)  (a).begin(),(a).end()      
void mm(vector<vector<int>> &aa,vector<int> &dd,int x,int r){
  if(aa[x].size()==0){
    return 0;
  }
  for(int c:aa[x]){
    mm(aa,dd,c,r);
    dd[c]+=r;
  }
  return 0;
}
int main() {
  int n,q;
  cin>>n>>q;
  vector<vector<int>> aa(n);
  vector<int> dd(n);
  p.at(0) = -1;
      
  for(int i=1;i<n;i++){
    int a,b;
    cin>>a>>b;
    aa[a].push_back(b);
  }
  

Compiler output:
a.cc: In function 'void mm(std::vector<std::vector<int> >&, std::vector<int>&, int, int)':
a.cc:7:12: error: return-statement with a value, in function returning 'void' [-fpermissive]
    7 |     return 0;
      |            ^
a.cc:13:10: error: return-statement with a value, in function returning 'void' [-fpermissive]
   13 |   return 0;
      |          ^
a.cc: In function 'int main()':
a.cc:20:3: error: 'p' was not declared in this scope
   20 |   p.at(0) = -1;
      |   ^
a.cc:26:4: error: expected '}' at end of input
   26 |   }
      |    ^
a.cc:15:12: note: to match this '{'
   15 | int main() {
      |            ^
Language: C++

#include <iostream>
#include <vector>
#include <queue>
using namespace std;
using Graph = vector<vector<int>>;

int main() {
    int N, Q; cin >> N >> Q;

    Graph G(N);
    vector<bool> visited(N,false);
    vector<int> counter(N, 0);
    for (int i = 0; i < N-1; ++i) {
        int a, b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    for (int i=0;i<Q;i++){
      int p,x;
      cin >> p >> x;
      p--;
      counter[p]+=x;
    }
    queue<int> que;
    que.push(0);
    visited[0]=true;

    // BFS 開始 
    while (!que.empty()) {
        int v = que.front();//front()は先頭を見るだけ、削除はしない
        que.pop();　//pop()で先頭を削除する

        for (int nv : G[v]) {
            if (visited[nv]) continue;
            que.push(nv);
            counter[nv]+=counter[v]
            visited[nv]=true
        }
    }
    for(int i=0;i<N;i++)
      cout << counter[i] << endl;
    return 0;
}

Compiler output:
a.cc:33:19: error: extended character 　 is not valid in an identifier
   33 |         que.pop();　//pop()で先頭を削除する
      |                   ^
a.cc: In function 'int main()':
a.cc:33:19: error: '\U00003000' was not declared in this scope
   33 |         que.pop();　//pop()で先頭を削除する
      |                   ^~
Language: C++

#include<iostream>
using namespace std;


int main(){
  int n,q,i;
  cin >> n >> q;

  int *a = new int[n-1];
  int *b = new int[n-1];
  int *p = new int[q];
  int *x = new int[q];
  int *result = new int[n];

  for(i=0;i<n;i++){
    result[i] = 0;
  }

  for(i=0;i<n-1;i++){
    cin >> a[i] >> b[i];
  }
  for(i=0;i<q;i++){
    cin >> p[i] >> x[i];
  }

  for(i=0;i<q;i++){
    result[p[i]-1] = result[p[i]-1]+x[i];

  }

  for(i=0;i<n-1;i++){
    result[b[i]-1]=result[b[i]-1]+result[a[i]-1];
  }
  for(i=0;i<n;i++){
    cout << result[i] << " ";
  }
  cout << "\n";


  delete[] a;
  delete[] b;
  delete[] q;
  delete[] x;
  delete[] result;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:42:12: error: type 'int' argument given to 'delete', expected pointer
   42 |   delete[] q;
      |            ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define REPL(i,m,n) for(ll i=(ll)(m); i<(ll)(n); i++)
#define repl(i,n) REP(i,0,n)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

ll ans[1000000];
vector< vector<ll> > childs(1000000); // N nodes

ll add_recursive(ll node_index, ll parent_number){
  ans[node_index] += parent_number;
  vector<ll>::iterator itr;
  for(itr = childs[node_index].begin(); itr != childs[node_index].end(); ++itr){
    add_recursive(*itr, ans[node_index]);
  }
  return 0;
}

ll main(){
  ll N;
  cin >> N;
  ll Q;
  cin >> Q;

  ll a;
  ll b;
  REP(i, 0, N-1){
    cin >> a;
    cin >> b;
    a = a-1;
    b = b-1;
    childs[a].push_back(b);
  }

  REP(i, 0, 1000000) { ans[i] = 0;}

  ll p;
  ll x;
  REP(i, 0, Q){
    cin >> p;
    cin >> x;
    p = p-1;
    ans[p] += x;
  }

  add_recursive(0, 0); // add x recursively from node p

  REP(i, 0, N){
    cout << ans[i] << " ";
  }
  cout << endl;

  return 0;
}


Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C

#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <math.h>
#include <cstdio>
using namespace std;
typedef long long int ll;
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}

int n,q;
vector<int>abc[200001];
int ans[200001]={0};

void dfs(int p,int x)
{
    ans[p]+=x;
    if(abc[p].size())
    for(int i=0;i<abc[p].size();i++)
    {
        dfs(abc[p][i],x);
    }
    
}
int main()
{
    
    cin>>n>>q;
    for(int i=1;i<n;i++)
    {
        int a,b;
        cin>>a>>b;
        a--;b--;
        abc[a].push_back(b);
    }
    for(int i=0;i<q;i++)
    {
        int p,x;
        cin>>p>>x;
        p--;
        dfs(p,x);
    }
    for(int i=0;i<n;i++)
        cout<<ans[i]<<" ";
    cout<<endl;
    return 0;
}


Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <queue>
#include <algorithm>
#include <cstring>
#define INF 500050
#define Max 0x3f3f3f3f
using namespace std;
int dis[INF],vis[INF];
int xi[INF],yi[INF],zi[INF],value[INF];
int n,m,x;
struct Fedge
{
	int next,to,dis;
}edge[INF];
int head[INF],cnt=0,time[INF];
void addedge(int from,int to,int dis)
{
	edge[++cnt].next = head[from];
	edge[cnt].to = to;
	edge[cnt].dis = dis;
	head[from] = cnt;
}
void init()
{
	for(int i=0; i<INF; i++)
		vis[i]=0,dis[i]=Max;
}
bool cmp(int a,int b)
{
	return a>b;
}
int dijstra(int start)
{
	init();
	queue<int> q;
	q.push(start);
	vis[start] = 1;
	dis[start] = 0;
	
	while(!q.empty())
	{
		int f = q.front();
		q.pop();vis[f]=0;
		for(int i=head[f]; i; i=edge[i].next)
		{
			int v = edge[i].to;
		 	if(!vis[v])
		 	{
		 		value[v] += value[f];
		 		vis[v] = 1;
		 		q.push(v);
			}
		}
	}
}
int main()
{
	int n,m;
	cin>>n>>m;
	for(int i=1; i<=n-1; i++) {
		int x,y;
		cin>>x>>y;
		addedge(x,y,0);
	}
	for(int i=1; i<=m; i++) {
		int x,y;
		cin>>x>>y;
		value[x] += y;
	}
	dijstra(1);
	for(int i=1; i<=n; i++) {
		cout<<value[i]<<" ";
	}
	return 0;
}


Compiler output:
a.cc:15:29: error: 'int time [500050]' redeclared as different kind of entity
   15 | int head[INF],cnt=0,time[INF];
      |                             ^
In file included from /usr/include/pthread.h:23,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
                 from /usr/include/c++/14/ext/atomicity.h:35,
                 from /usr/include/c++/14/bits/ios_base.h:39,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
   76 | extern time_t time (time_t *__timer) __THROW;
      |               ^~~~
a.cc: In function 'int dijstra(int)':
a.cc:55:1: warning: no return statement in function returning non-void [-Wreturn-type]
   55 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;


int Ki (vector<vector<int>> &S, vector<bool> &T, vector<int> &ans, stack<int> ＆U){
    if (U.size() == 0) {
        for (int i = 0; i < ans.size(); i++) {
            cout << ans.at(i) << " ";
        }
        return 0;
    }
    if (!T.at(U.top())) {
        int c;
        c = U.top();
        U.pop();
        T.at(c) = true;
        for (int i = 0; i < S.at(c).size(); i++) {
            U.push(S.at(c).at(i));
            ans.at(S.at(c).at(i)) += ans.at(c);
        }
        Ki (S, T, ans, U);
    }
    return 0;
}

int main() {
    stack<int> U;
    U.push(0);
    int N, Q;
    cin >> N >> Q;
    vector<int> ans(N, 0);
    vector<bool> T(N, false);
    vector<vector<int>> S(N);
    for (int i = 0; i < N - 1; i++) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        S.at(a).push_back(b);
        S.at(b).push_back(a);
    }
    for (int i = 0; i < Q; i++) {
        int d, e;
        cin >> d >> e;
        ans.at(d - 1) += e;
    }
    Ki (S, T, ans, U);
}


Compiler output:
a.cc: In function 'int Ki(std::vector<std::vector<int> >&, std::vector<bool>&, std::vector<int>&, std::stack<int>)':
a.cc:6:9: error: 'U' was not declared in this scope
    6 |     if (U.size() == 0) {
      |         ^
a.cc:12:15: error: 'U' was not declared in this scope
   12 |     if (!T.at(U.top())) {
      |               ^
Language: C++

#include <bits/stdc++.h>
using namespace std;


int Ki (vector<vector<int>> S, vector<bool> T, vector<int> ans, stack<int> U){
    if (U.empty() {
        for (int i = 0; i < ans.size(); i++) {
            cout << ans.at(i) << " ";
        }
        return 0;
    }
    if (!T.at(U.top())) {
        int c;
        c = U.top();
        U.pop();
        T.at(c) = true;
        for (int i = 0; i < S.at(c).size(); i++) {
            U.push(S.at(c).at(i));
            ans.at(S.at(c).at(i)) += ans.at(c);
        }
        Ki (S, T, ans, U);
    }
    return 0;
}

int main() {
    stack<int> U;
    U.push(0);
    int N, Q;
    cin >> N >> Q;
    vector<int> ans(N, 0);
    vector<bool> T(N, false);
    vector<vector<int>> S(N);
    for (int i = 0; i < N - 1; i++) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        S.at(a).push_back(b);
    }
    for (int i = 0; i < Q; i++) {
        int d, e;
        cin >> d >> e;
        ans.at(d - 1) += e;
    }
    Ki (S, T, ans, U);
}


Compiler output:
a.cc: In function 'int Ki(std::vector<std::vector<int> >, std::vector<bool>, std::vector<int>, std::stack<int>)':
a.cc:6:18: error: expected ';' before '{' token
    6 |     if (U.empty() {
      |                  ^~
      |                  ;
a.cc:6:16: warning: ignoring return value of 'bool std::stack<_Tp, _Sequence>::empty() const [with _Tp = int; _Sequence = std::deque<int, std::allocator<int> >]', declared with attribute 'nodiscard' [-Wunused-result]
    6 |     if (U.empty() {
      |         ~~~~~~~^~
In file included from /usr/include/c++/14/stack:63,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:160,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_stack.h:215:7: note: declared here
  215 |       empty() const
      |       ^~~~~
a.cc:12:5: error: expected primary-expression before 'if'
   12 |     if (!T.at(U.top())) {
      |     ^~
a.cc:11:6: error: expected ')' before 'if'
   11 |     }
      |      ^
      |      )
   12 |     if (!T.at(U.top())) {
      |     ~~
a.cc:6:8: note: to match this '('
    6 |     if (U.empty() {
      |        ^
a.cc:24:1: warning: no return statement in function returning non-void [-Wreturn-type]
   24 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;

#define f(i,a,b) for (int i = a; i < b; i++)
#define pb push_back
using vi = vector<int>;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
int n; cin>>n;
int q; cin>>q;
vi adj[n];
f(i,0,n-1) {
int a, b; cin>>a>>b;
adj[--a].pb(--b);
adj[b].pb(a);
}
vi ans(n,0);
function<void(int,int)> dfs = [&](int v, int p) {
if (p == -1) ans[v] += ans[p];
for (int v : adj[w]) if (w != p)
dfs(w,v);
};
f(_,0,q) {
int p, x; cin>>p>>x;
ans[--p]+=x;
}
dfs(0,-1);
f(i,0,n) cout << ans[i] << " ";
cout << endl;
return 0;
}

Compiler output:
a.cc: In lambda function:
a.cc:22:18: error: 'w' was not declared in this scope
   22 | for (int v : adj[w]) if (w != p)
      |                  ^
Language: C++

#include <bits/stdc++.h>
using namespace std;

#define f(i,a,b) for (int i = a; i < b; i++)
#define pb push_back
using vi = vector<int>;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
int n; cin>>n;
int q; cin>>q;
vi adj[n];
f(i,0,n-1) {
int a, b; cin>>a>>b;
adj[--a].pb(--b);
adj[b].pb(a);
}
vi ans(n,0);
function<void(int,int)> dfs = [&](int v, int p) {
if (p == -1) ans[v] += ans[p];
for (int v : adj[w]) if (w != p)
dfs(w,v);
};
f(_,0,q) {
int p, x; cin>>p>>x;
ans[--p]+=x;
}
dfs(0,-1);
f(i,0,n) cout << a[i] << " ";
cout << endl;
return 0;
}

Compiler output:
a.cc: In lambda function:
a.cc:22:18: error: 'w' was not declared in this scope
   22 | for (int v : adj[w]) if (w != p)
      |                  ^
a.cc: In function 'int main()':
a.cc:30:18: error: 'a' was not declared in this scope
   30 | f(i,0,n) cout << a[i] << " ";
      |                  ^
Language: C++

#include <bits/stdc++.h>
using namespace std;

#define f(i,a,b) for (int i = a; i < b; i++)
#define pb push_back;
using vi = vector<int>;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
int n; cin>>n;
int q; cin>>q;
vi adj[n];
f(i,0,n-1) {
int a, b; cin>>a>>b;
adj[--a].pb(--b);
adj[b].pb(a);
}
vi ans(n,0);
function<void(int,int)> dfs = [&](int v, int p) {
if (p == -1) ans[v] += ans[p];
for (int v : adj[w]) if (w != p)
dfs(w,v);
};
f(_,0,q) {
int p, x; cin>>p>>x;
ans[--p]+=x;
}
dfs(0,-1);
f(i,0,n) cout << a[i] << " ";
cout << endl;
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:12: error: statement cannot resolve address of overloaded function
    5 | #define pb push_back;
      |            ^
a.cc:16:10: note: in expansion of macro 'pb'
   16 | adj[--a].pb(--b);
      |          ^~
a.cc:5:12: error: statement cannot resolve address of overloaded function
    5 | #define pb push_back;
      |            ^
a.cc:17:8: note: in expansion of macro 'pb'
   17 | adj[b].pb(a);
      |        ^~
a.cc: In lambda function:
a.cc:22:18: error: 'w' was not declared in this scope
   22 | for (int v : adj[w]) if (w != p)
      |                  ^
a.cc: In function 'int main()':
a.cc:30:18: error: 'a' was not declared in this scope
   30 | f(i,0,n) cout << a[i] << " ";
      |                  ^
Language: C++

#include <iostream>
#include <assert.h>
#include <vector>
#include <algorithm>
//#include <functional>

struct vertex{
    std::vector<int32_t> children;
    int32_t cnt = 0;
};

//void update_children(std::vector<vertex>& vertex_list, int32_t start, int32_t val){
//    //std::cout << "update_called. start idx: " << start << std::endl;
//    if(vertex_list[start-1].children.empty()){
//        return;
//    }
//    for(auto& child : vertex_list[start-1].children){
//        //std::cout << "child idx: " << child << std::endl;
//        vertex_list[child - 1].cnt += val;
//        update_children(vertex_list, child, val);
//    }
//    return;
//}

void update_children(std::vector<vertex>& vertex_list, int32_t start, int32_t val){
    //std::cout << "update_called. start idx: " << start << std::endl;
    if(vertex_list[start-1].children.empty()){
        return;
    }
    for(auto& child : vertex_list[start-1].children){
        //std::cout << "child idx: " << child << std::endl;
        vertex_list[child - 1].cnt += val;
        update_children(vertex_list, child, val);
    }
    return;
}

int main(){
    int32_t N;
    int32_t Q;
    std::cin >> N >> Q;
    assert(2 <= N && N <= 2 * (10^5));
    assert(1 <= Q && Q <= 2 * (10^5));

    // Naiive
    // Build Tree -> for each operation, find pj;
    // -> find all the vrtices under pj
    // -> increment by xj
    // QxNxlog(n)
    // find Pj could be O(1) by creating indexable vertex list.

    std::vector<vertex> vertex_list(N);
    for(int32_t i = 1; i <= N -1; i++){
        int32_t p,c;
        std::cin >> p >> c;
        vertex_list[p-1].children.push_back(c);
    }
    //std::cout << "list created: len=" << vertex_list.size() << std::endl;

    for(int32_t j = 1; j <= Q; j++){
        int32_t n,w;
        std::cin >> n >> w;
        vertex_list[n-1].cnt += w;

        // update for each j.
        //vertex_list[n-1].cnt += w;
        //update_children(vertex_list, n, w);
    }

    // update child. start from the root to edge.   
    for(int32_t i = 0; i <= N-1; i++){
        for(auto& child : vertex_list[i].children){
            vertex_list[child - 1].cnt += vertex_list[i].cnt;
        }
    }
  
    for(auto& i : vertex_list){
        std::cout << i.cnt << " ";
    }

    return 0;
}
138

Compiler output:
a.cc:83:1: error: expected unqualified-id before numeric constant
   83 | 138
      | ^~~
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>

using namespace std;

int main(){
    int N, Q;
    cin >> N >> Q;

    vector<int> list[N];
    for(int i=0; i < N-1; i++){
        int a, b;
        cin >> a >> b;
        list[a-1].emplace_back(b-1);
    }
    int C[N]; memset(C, 0, sizeof(C));
    for(int i=0; i<Q; i++){
        int p, x;
        cin >> p >> x;
        C[p-1] +=x;
    }

    int score[N]; for(int i =0; i<N; i++)   score[i] = 0;
    queue<int> q;
    q.push(0);
    int now = 0;
    while(!q.empty()){
        int v = q.front(); q.pop();
        score[v] += C[v];
        for(int idx : list[v]){
            q.push(idx);
            score[idx] += score[v];
        }
    }
    for(int i = 0; i<N; i++){
        cout << score[i] << " ";
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:15: error: 'memset' was not declared in this scope
   18 |     int C[N]; memset(C, 0, sizeof(C));
      |               ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include<queue>
  +++ |+#include <cstring>
    5 |
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

vector< vector<int> > to;
vector<int> ans;

void dfs(int c,int p=-1){
  for(int u:to.at(c)){
    if(u==p){
      continue;
    }
    ans.at(u)+=ans.at(c);
    dfs(u,c);
  }
}
int main(){
  int n,q;
  cin >> n >> q;
  //v.resize(N);
  to.resize(200005)
  for(int i=0;i<n-1;i++){
    int a,b;
    cin >> a >> b;
    a--;
    b--;
    to.at(a).push_back(b);
    to.at(b).push_back(a);
  }
  ans.resize(n);
  for(int i=0;i<q;i++){
    int p,x;
    cin >> p >> x;
    p--;
    ans.at(p)+=x;
  }
  dfs(0);
  for(int i=0;i<n;i++){
    cout << ans.at(i) << endl;
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:20: error: expected ';' before 'for'
   21 |   to.resize(200005)
      |                    ^
      |                    ;
   22 |   for(int i=0;i<n-1;i++){
      |   ~~~               
a.cc:22:15: error: 'i' was not declared in this scope
   22 |   for(int i=0;i<n-1;i++){
      |               ^
Language: C++

#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const int Vmax = 200000;

vector<int> to(Vmax);
vector<int> ans;

void dfs(int v, int parent = -1) {
    for(int u : to[v]) {
        if(u == parent) {
            continue;
        }
        ans[u] += ans[v];
        dfs(u, v);
    }
}

int main() {
    int n, q;
    cin >> n >> q;
    ans.resize(n);

    rep(i, n-1) {
        int a, b;
        cin >> a >> b;
        a--;  b--;
        to[a].push_back(b);
        to[b].push_back(a);
    }
    
    rep(i, q) {
        int p, x;
        cin >> p >> x;
        p--;
        ans[p] += x;
    }

    dfs(0);

    rep(i, n) {
        cout << ans[i] << "\n";
    }
    
    return 0;
}

Compiler output:
a.cc: In function 'void dfs(int, int)':
a.cc:20:21: error: 'begin' was not declared in this scope; did you mean 'std::begin'?
   20 |     for(int u : to[v]) {
      |                     ^
      |                     std::begin
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/range_access.h:114:37: note: 'std::begin' declared here
  114 |   template<typename _Tp> const _Tp* begin(const valarray<_Tp>&) noexcept;
      |                                     ^~~~~
a.cc:20:21: error: 'end' was not declared in this scope; did you mean 'std::end'?
   20 |     for(int u : to[v]) {
      |                     ^
      |                     std::end
/usr/include/c++/14/bits/range_access.h:116:37: note: 'std::end' declared here
  116 |   template<typename _Tp> const _Tp* end(const valarray<_Tp>&) noexcept;
      |                                     ^~~
a.cc: In function 'int main()':
a.cc:38:15: error: request for member 'push_back' in 'to.std::vector<int>::operator[](((std::vector<int>::size_type)a))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   38 |         to[a].push_back(b);
      |               ^~~~~~~~~
a.cc:39:15: error: request for member 'push_back' in 'to.std::vector<int>::operator[](((std::vector<int>::size_type)b))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   39 |         to[b].push_back(a);
      |               ^~~~~~~~~