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

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

const int n=200000; //グラフの最大頂点数
vector<int> g[n];
int depth[n];
int parent[n];
int cost[n]={};

void dfs(int v, int p, int d){
  depth[v]=d;
  parent[v]=p;
  for(int i=0; i<g[v].size(); i++){
    if(g[v][i]==p) continue;
    dfs(g[v][i], v, d+1);
  }
}

void flow(int v, int x){
  cost[v]+=x;
  for(int i=0; i<g[v].size(); i++){
    if(depth[v]>=depth[g[v][i]]) continue;
    flow(g[v][i], x);
  }
}

void add_edge(int u, int v){
  g[u].push_back(v);
  g[v].push_back(u);
}

int main()
{
  int N, Q, root=0;
  cin >> N >> Q;
  for(int i=0; i<N-1; i++){
    int u, v;
    cin >> u >> v;
    add_edge(u-1, v-1);
  }
  dfs(root, -1, 0);

  for(int i=0; i<Q; i++){
    int p, x;
    cin >> p >> x;
    flow(p-1, x);
  }
  for(int i=0; i<N; i++){
    cout << cost[i] << " ";
  }
  cout << endl;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include<bits/stdc++.h>
      | ^~~~~~~
a.cc:5:1: error: 'vector' does not name a type
    5 | vector<int> g[n];
      | ^~~~~~
a.cc: In function 'void dfs(int, int, int)':
a.cc:13:18: error: 'g' was not declared in this scope
   13 |   for(int i=0; i<g[v].size(); i++){
      |                  ^
a.cc: In function 'void flow(int, int)':
a.cc:21:18: error: 'g' was not declared in this scope
   21 |   for(int i=0; i<g[v].size(); i++){
      |                  ^
a.cc: In function 'void add_edge(int, int)':
a.cc:28:3: error: 'g' was not declared in this scope
   28 |   g[u].push_back(v);
      |   ^
a.cc: In function 'int main()':
a.cc:35:3: error: 'cin' was not declared in this scope
   35 |   cin >> N >> Q;
      |   ^~~
a.cc:49:5: error: 'cout' was not declared in this scope; did you mean 'cost'?
   49 |     cout << cost[i] << " ";
      |     ^~~~
      |     cost
a.cc:51:3: error: 'cout' was not declared in this scope; did you mean 'cost'?
   51 |   cout << endl;
      |   ^~~~
      |   cost
a.cc:51:11: error: 'endl' was not declared in this scope
   51 |   cout << endl;
      |           ^~~~
Language: C++

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

/* #pragma */
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")


/*alias*/
#define F first
#define S second

#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define itn int

/*template*/
template<class T>inline bool amax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>inline bool amin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }

/* func */
int32_t GCD(int32_t a, int32_t b){return b ? GCD(b, a%b) : a;}
int64_t GCD(int64_t a, int64_t b){return b ? GCD(b, a%b) : a;}
int32_t LCM(int32_t a, int32_t b){return a * b / GCD(a, b);}
int64_t LCM(int64_t a, int64_t b){return a * b / GCD(a, b);}

/*struct*/
struct aaa {
	aaa() {
		cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20);
	};
}aaaaaaa;

/* const */
constexpr int32_t INF = 1001001001;
constexpr int64_t LINF = 1001001001001001001ll;
constexpr int32_t MOD = 1e9 + 7; //10^9
constexpr int64_t EPS = 1e-9;
constexpr int32_t dx[] = { 1, 1, 0, -1, -1, -1, 0, 1 }, dy[] = { 0, 1, 1, 1, 0, -1, -1, -1 };
//constexpr int32_t dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
//Counterclockwise from the 6o'clock direction
//Take the x-axis downward and the y-axis right


//g++ -std=c++14 -Wall --pedantic-errors -o template template.cpp
//g++ -std=c++14 -Wall --pedantic-errors template.cpp
//chcp 65001

/*global*/



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

//#define int int64_t
signed main()
{
	int n, q; cin >> n >> q;
	for(int i = 0, i_len = (int)n-1; i < i_len; ++i){
		int a, b;
		cin >> a >> b;
		--a;--b;
		to[a].emplace_back(b);
		to[b].emplace_back(a);		
	}
	//ans.resize(n);
	for(int i = 0, i_len = (int)q; i < i_len; ++i){
		int p, x;
		cin >> p >> x;
		--p;
		ans[p] += x;
	}
	dfs(0);

	for(int i = 0, i_len = (int)n; i < i_len; ++i){
		cout << ans[i] << '\n';
	}

}

Compiler output:
a.cc: In function 'void dfs(int, int)':
a.cc:63:20: error: invalid types 'int[int]' for array subscript
   63 |                 ans[u] += ans[v];
      |                    ^
a.cc:63:30: error: invalid types 'int[int]' for array subscript
   63 |                 ans[u] += ans[v];
      |                              ^
a.cc: In function 'int main()':
a.cc:84:20: error: invalid types 'int[int]' for array subscript
   84 |                 ans[p] += x;
      |                    ^
a.cc:89:28: error: invalid types 'int[int]' for array subscript
   89 |                 cout << ans[i] << '\n';
      |                            ^
Language: C

#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;
#define mp  std::make_pair
#define ll long long int
#define abs(n) ((n>0)?(n):((n)*(-1)))
#define CEIL(a,b) (((a) + ((b)-1)) / (b))
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
#define VREP_ll(v) for(std::vector<ll>::iterator itr = (v).begin(); itr != (v).end();itr++)
#define VREP_int(v) for(std::vector<int>::iterator itr = (v).begin(); itr != (v).end();itr++)
#define VALL(v) ((v).begin(),(v).end())
#define errln(v) cerr << (v) << endl;
#define println(v) cout << (v) << endl;

typedef struct{
	vector<int> leafs;
	int id,left,right,sum;
} node;

vector<node> nodes;
vector<int> ary;


void print_node(int id){
	printf("====== %d ======\n",id);
	printf("leafs : ");
	int size = nodes[id].leafs.size();
	REP(i,size){
		printf(" %d",nodes[id].leafs[i]);
	}
	printf("\nleft : %d\n",nodes[id].left);
	printf("right : %d\n",nodes[id].right);
	printf("sum : %d\n",nodes[id].sum);
}

int dfs(int id,int begin_no){
	int curr = begin_no;
	ary.push_back(id);
	nodes[id].left = curr++;
	int size = nodes[id].leafs.size();
	REP(i,size){
		curr = dfs(nodes[id].leafs[i],curr);
	}
	nodes[id].right = curr;
	ary.push_back(id);
	return nodes[id].right+1;
}

int main(int argc, const char * argv[]) {
	int n,q;
	cin >> n >> q;
	REP(i,n){
		node nd;
		nd.id = i;
		nodes.push_back(nd);
	}
	REP(i,n-1){
		int a,b;
		cin >> a >> b;
		nodes[a-1].leafs.push_back(b-1);
	}
	dfs(0,0);
	REP(i,q){
		int p,x;
		cin >> p >> x;
		int l,r;
		l = nodes[p-1].left;
		r =nodes[p-1].right;
		FOR(j,l,r){
			if(j==nodes[ary[j]].left){
				nodes[ary[j]].sum += x;
			}
		}
	}
	REP(i,n) {printf("%d ",nodes[i].sum);}
	return 0;
}



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

import java.util.*;
 
public class Main{
	public static void main(String[] args){
    	Scanner scan = new Scanner(System.in);
      	int n = scan.nextInt();
      	int q = scan.nextInt();
        HashMap<Integer, Integer> ls = new HashMap<>();	
      	for(int i = 0; i < n; i ++){
          	int pare = scan.nextInt();
          	int chir = scan.nextInt();
          	ls.add(chir, pare);
            }
      	int[] c = new int[n];
      	for(int i = 0; i < q; i ++){
        	int p = scan.nextInt();
          	int x = scan.nextInt();
          	c[p] +=  x;
        }
      	System.out.print(c[0] + " ");
      	for(int j = 1; j < n; j ++){
        	System.out.print(c[j] + c[ls.get(j)] + " ");
        }
        }
    }

Compiler output:
Main.java:12: error: cannot find symbol
          	ls.add(chir, pare);
          	  ^
  symbol:   method add(int,int)
  location: variable ls of type HashMap<Integer,Integer>
1 error
Language: Java

import java.util.*;

public class Main{
	public static void main(String[] args){
    	Scanner scan = new Scanner(System.in);
      	int n = scan.nextInt();
      	int q = scan.nextInt();
        HashMap<Integer, Integer> ls = new HashMap<>();	
      	for(int i = 0; i < n; i ++){
          	int pare = scan.nextInt();
          	int chir = scan.nextInt();
          	ls.add(chir, pare);
            }
      	int[] c = new int[n];
      	for(int i = 0; i < q; i ++){
        	int p = scan.nextInt();
          	int x = scan.nextInt();
          	c[p] +=  x;
        }
      	System.out.print(c[0] + " ");
      	for(int j = 1; j < n; j ++){
        	System.out.print(c[j] + ls.get(j) + " ");
        }
        }
    }
}	

Compiler output:
Main.java:26: error: class, interface, enum, or record expected
}	
^
1 error
Language: C++

#include <bits/stdc++.h>
#define int long long
#define rep(i, a, n) for(int (i) = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int (i) = (int)(a);(i) <= (int)(n);++(i))
#define repif(i, a, x) for(int (i) = (int)(a);(x);++(i))
#define repr(i, a, n) for(int (i) = ((int)(a)-1);(i) >= (int)(n);--(i))
#define reper(i, a, n) for(int (i) = (int)(a);(i) >= (int)(n);--(i))
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define SIZE(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
#define RNG(x, a, n) &((x)[a]), &((x)[n])
#define ADD(a, b) ((((a+MOD)%MOD)+((b+MOD)%MOD))%MOD)
#define MUL(a, b) ((((a)%MOD)*((b)%MOD))%MOD)
#define CEIL(x) ((int)ceil(((double)x)))
#define POW(x, y) ((int)pow(x, y))
#define UNIQUE(x) (x).erase(unique(ALL((x))), (x).end())
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl;
#define no cout << "no" << endl;
#define fcout cout << fixed << setprecision(10)
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define PI (acos(-1))
#define EPS (1e-10)
#define INF LLONG_MAX
#define MOD 1000000007
using VI = std::vector<int>;
using PII = std::pair<int, int>;
using SI = std::set<int>;
using MII = std::map<int, int>;
using TIII = std::tuple<int, int, int>;
using MCI = std::map<char, int>;
using VPII = std::vector<PII>;
using Complex = std::complex<double>;
using namespace std;


int N, Q;
int p[200010];
int c[200010];


signed main(){
    cin >> N >> Q;
    rep(i, 0, N-1){
        int a, b;
        cin >> a >> b;
        a--, b--;
        g[b] = a;
    }

    rep(i, 0, Q){
        int p, x;
        cin >> p >> x;
        p--;
        c[p] += x;
    }

    rep(i, 1, N) c[i] += c[p[i]];

    rep(i, 0, N-1) cout << c[i] << ' ';
    cout << c[N-1] << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:55:9: error: 'g' was not declared in this scope
   55 |         g[b] = a;
      |         ^
Language: Java

import java.util.*;

import Main.Job;

import java.io.*;

public class Main {
	private static void solve(){
		//Implement solution here.
		int n = ni();
		int[] a = new int[n - 1];
		int[] b = new int[n - 1];
		long[] c = new long[n];
		int q = ni();
		List<Edge> e = new ArrayList<>();
		for(int i = 0; i < n - 1; i++) {
			e.add(new Edge(ni(),ni()));
		}
		Comparator<Edge> comparator = Comparator.comparing(Edge::getFrom);
		e.sort(comparator);

		for(int i = 0; i < q; i++) {
			c[ni() - 1] += nl();
		}
		
		for(int i = 0; i < n - 1; i++) {
			c[e.get(i).to - 1] += c[e.get(i).from - 1];
		}
		
		for(int i = 0; i < n; i++) {
			System.out.print(c[i] + " ");
		}
	}

	static class Edge{
		private int from;
		private int to;
		public Edge(int from, int to) {
			this.from = from;
			this.to = to;
		}
		public long getFrom() {
			return this.from;
		}
	}
	//Switch input source (stdin/file)
	private static BufferedReader br  = new BufferedReader(new InputStreamReader(System.in));
	public static void main(String[] args){
		String debugDataPath = System.getenv("DD_PATH");        
		if(debugDataPath != null){
			try{
				br = new BufferedReader(new InputStreamReader(new FileInputStream(new File(debugDataPath))));
			}catch(Exception e){
				throw new RuntimeException(e);
			}
		} 
		solve();
	}

	//Input read utility
	private static StringTokenizer tokenizer = null;
	public static String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}
	//Get next single int
	private static int ni() {
		return Integer.parseInt(next());
	}
	//Get next single long
	private static long nl() {
		return Long.parseLong(next());
	}
	//Get next single double
	private static double nd() {
		return Double.parseDouble(next());
	}
	//Get next int array from one line
	private static int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}
	//Get next char array from one line
	private static char[] ns() {
		return next().toCharArray();
	}
	//Get next long array from one line
	private static long[] nal(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nl();
		return a;
	}
}

Compiler output:
Main.java:3: error: package Main does not exist
import Main.Job;
           ^
1 error
Language: C++

#include <bits/stdc++.h>

using namespace std;

class DKi {
public:
    void solve(std::istream &cin, std::ostream &cout) {
        int n, q;
        cin >> n >> q;
        map<int, vector<int>> ab_map;
        for (int i = 0; i < n - 1; ++i) {
            int a, b;
            cin >> a >> b;
            ab_map[a].emplace_back(b);
            ab_map[b].emplace_back(a);
        }
        vector<int> px_vec(n + 1, 0);
        for (int j = 0; j < q; ++j) {
            int p, x;
            cin >> p >> x;
            px_vec[p] += x;
        }
        vector<bool> seen(n + 1, false);
        vector<int> next_candidates;
        next_candidates.emplace_back(1);

        while (!next_candidates.empty()) {
            int candidate = next_candidates.back();
            next_candidates.pop_back();
            seen[candidate] = true;
            for (auto item : ab_map[candidate]) {
                if (seen[item] == true) continue;
                next_candidates.emplace_back(item);
                px_vec[item] += px_vec[candidate];
            }
        }

        for (int k = 1; k < n + 1; ++k) {
            cout << px_vec[k] << " ";
        }
        cout << endl;
    }

};


Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: Java

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int q = scan.nextInt();
		Tree tree = new Tree(n);
		for (int i = 0; i < n - 1; i++) {
			tree.array_a(i, scan.nextInt(), scan.nextInt());
		}
		for(int i=0;i<q;i++){
			tree.report(scan.nextInt(), scan.nextInt());
		}
		tree.memorial(n);
	}

}
class Tree {
	int memory[];
	int a[];
	int b[];

	public Tree(int n) {
		memory = new int[n];
		a = new int[n];
		b = new int[n];
	}

	public void array_a(int i, int a, int b) {
		this.a[i]= a-1;
		this.b[i] = b-1;
	}
	public void report(int i, int sc) {
		memory[i-1] =memory[i-1]+ sc;
	}
	public void memorial(int n) {
		for(int i=0;i<n;i++){
			memory[b[i]]=memory[b[i]]+memory[a[i]];
			System.out.println(memory[i]);
		}
	}
}

Compiler output:
Main.java:3: error: cannot find symbol
		Scanner scan = new Scanner(System.in);
		^
  symbol:   class Scanner
  location: class Main
Main.java:3: error: cannot find symbol
		Scanner scan = new Scanner(System.in);
		                   ^
  symbol:   class Scanner
  location: class Main
2 errors
Language: C++

#include <bits/stdc++.h>

using namespace std;

void dfs(auto& tree,auto& count, auto& ans, int parent, int node,int k)
{
    k += count.at(node);
    ans.at(node) = k;
    for(auto i:tree.at(node))
    {
        if(i == parent) continue;
        dfs(tree, ans, count, i, node, k);
    }
}

int main(void)
{
    int N,Q;
    cin >> N >> Q;
    vector<int> count(N),ans(N);
    vector<vector<int>> tree(N);
    for(int i = 1; i < N; i++)
    {
        int a,b; 
        cin >> a >> b; --a; --b; 
        tree.at(a).push_back(b);
        tree.at(b).push_back(a);
        
    }

    for(int i = 0; i < N; i++) count[i] = 0; 
    for(int i = 0; i < Q; i++)
    {
        int cnt;
        cin >> cnt; --cnt;
        cin >> count[cnt];
    }

    dfs(tree,couansnt,,-1,0,0);    

    for(int i = 0; i < N; i++)
    {
        cout << ans.at(i) << " ";
    }
    cout << endl;

}    

Compiler output:
a.cc:5:10: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts'
    5 | void dfs(auto& tree,auto& count, auto& ans, int parent, int node,int k)
      |          ^~~~
a.cc:5:21: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts'
    5 | void dfs(auto& tree,auto& count, auto& ans, int parent, int node,int k)
      |                     ^~~~
a.cc:5:34: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts'
    5 | void dfs(auto& tree,auto& count, auto& ans, int parent, int node,int k)
      |                                  ^~~~
a.cc: In function 'int main()':
a.cc:39:14: error: 'couansnt' was not declared in this scope; did you mean 'count'?
   39 |     dfs(tree,couansnt,,-1,0,0);
      |              ^~~~~~~~
      |              count
a.cc:39:23: error: expected primary-expression before ',' token
   39 |     dfs(tree,couansnt,,-1,0,0);
      |                       ^
Language: C++

#include <iostream>
#include <vector>

using namespace std;
typedef pair<int, int> ii;
struct node {
	int counter = 0;
	node* left = nullptr;
	node* right = nullptr;
};


int main()
{
	// input
	int n, q;
	cin >> n >> q;

	vector<node> nodes(n + 1);

	// adjacency lists
	vector<vector<int>> adj(n + 1);
	for (int i = 0; i < n - 1; ++i) {
		// edge n1,n2
		int n1, n2;
		cin >> n1 >> n2;
		adj[n1].push_back(n2);
		adj[n2].push_back(n1);
	}

	// build tree using BST
	vector<bool> visited(n+1, false);
	build_bst(nodes, visited, adj, 1);

	// Q operations
	for (int i = 0; i < q; ++i) {
		int subroot, count;
		cin >> subroot >> count;
		increase_count(&nodes[subroot], count);
	}

	// output
	for (auto node : nodes){
		cout << node.counter << endl;
	}
}

void increase_count(node * node, int count){
	if (node == nullptr){
		return;
	}
	node->counter += count;
	increase_count(node->left, count);
	increase_count(node->right, count);
}

void build_bst(vector<node> & nodes, vector<bool> & visited, vector<vector<int>> & adj, int n){
	visited[n] = true;
	for (auto neighbor : adj[n]){
		if (!visited[neighbor]){
			if (nodes[n].left == nullptr){
				nodes[n].left = &nodes[neighbor];
			} else {
				nodes[n].right = &nodes[neighbor];
			}
			build_bst(nodes, visited, adj, neighbor);
		}
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:9: error: 'build_bst' was not declared in this scope
   33 |         build_bst(nodes, visited, adj, 1);
      |         ^~~~~~~~~
a.cc:39:17: error: 'increase_count' was not declared in this scope
   39 |                 increase_count(&nodes[subroot], count);
      |                 ^~~~~~~~~~~~~~
Language: C++

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

	int value,add;
}tree[1000000];	vector<int> child[1000000];
void add(int a,int b){
	child[a].push_back(b);
}

void motify(int a,int value){
tree[a].add+=value;
}
void change(int nod,int opt){
	tree[nod].value=tree[nod].add+opt;
	for(int i=0;i<child[nod].size();i++){
		change(child[nod][i],opt+tree[nod].add);
	}
}
int main(){
	int n,m;
	cin>>n>>m;		int ai,bi;
	for(int i=1;i<=n-1;i++){
		scanf("%d%d",&ai,&bi);
		add(ai,bi);
	}
	for(int i=1;i<=m;i++){
			scanf("%d%d",&ai,&bi);
	motify(ai,bi);
	}
	change(1,0);
		for(int i=1;i<=n;i++){
		printf("%d ",tree[i].value);
	}
}#include<bits/stdc++.h>
using namespace std;
struct node{

	int value,add;
}tree[1000000];	vector<int> child[1000000];
void add(int a,int b){
	child[a].push_back(b);
}

void motify(int a,int value){
tree[a].add+=value;
}
void change(int nod,int opt){
	tree[nod].value=tree[nod].add+opt;
	for(int i=0;i<child[nod].size();i++){
		change(child[nod][i],opt+tree[nod].add);
	}
}
int main(){
	int n,m;
	cin>>n>>m;		int ai,bi;
	for(int i=1;i<=n-1;i++){
		scanf("%d%d",&ai,&bi);
		add(ai,bi);
	}
	for(int i=1;i<=m;i++){
			scanf("%d%d",&ai,&bi);
	motify(ai,bi);
	}
	change(1,0);
		for(int i=1;i<=n;i++){
		printf("%d ",tree[i].value);
	}
}

Compiler output:
a.cc:35:2: error: stray '#' in program
   35 | }#include<bits/stdc++.h>
      |  ^
a.cc:35:3: error: 'include' does not name a type
   35 | }#include<bits/stdc++.h>
      |   ^~~~~~~
a.cc:37:8: error: redefinition of 'struct node'
   37 | struct node{
      |        ^~~~
a.cc:3:8: note: previous definition of 'struct node'
    3 | struct node{
      |        ^~~~
a.cc:40:2: error: conflicting declaration 'int tree [1000000]'
   40 | }tree[1000000]; vector<int> child[1000000];
      |  ^~~~
a.cc:6:2: note: previous declaration as 'node tree [1000000]'
    6 | }tree[1000000]; vector<int> child[1000000];
      |  ^~~~
a.cc:40:29: error: redefinition of 'std::vector<int> child [1000000]'
   40 | }tree[1000000]; vector<int> child[1000000];
      |                             ^~~~~
a.cc:6:29: note: 'std::vector<int> child [1000000]' previously declared here
    6 | }tree[1000000]; vector<int> child[1000000];
      |                             ^~~~~
a.cc:41:6: error: redefinition of 'void add(int, int)'
   41 | void add(int a,int b){
      |      ^~~
a.cc:7:6: note: 'void add(int, int)' previously defined here
    7 | void add(int a,int b){
      |      ^~~
a.cc:45:6: error: redefinition of 'void motify(int, int)'
   45 | void motify(int a,int value){
      |      ^~~~~~
a.cc:11:6: note: 'void motify(int, int)' previously defined here
   11 | void motify(int a,int value){
      |      ^~~~~~
a.cc:48:6: error: redefinition of 'void change(int, int)'
   48 | void change(int nod,int opt){
      |      ^~~~~~
a.cc:14:6: note: 'void change(int, int)' previously defined here
   14 | void change(int nod,int opt){
      |      ^~~~~~
a.cc:54:5: error: redefinition of 'int main()'
   54 | int main(){
      |     ^~~~
a.cc:20:5: note: 'int main()' previously defined here
   20 | int main(){
      |     ^~~~
Language: C++

include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

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 >> 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;
  }
  return 0;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include <bits/stdc++.h>
      | ^~~~~~~
a.cc:10:1: error: 'vector' does not name a type
   10 | vector<int> to[200005];
      | ^~~~~~
a.cc:11:1: error: 'vector' does not name a type
   11 | vector<int> ans;
      | ^~~~~~
a.cc: In function 'void dfs(int, int)':
a.cc:13:16: error: 'to' was not declared in this scope
   13 |   for (int u : to[v]){
      |                ^~
a.cc:15:5: error: 'ans' was not declared in this scope
   15 |     ans[u] += ans[v];
      |     ^~~
a.cc: In function 'int main()':
a.cc:22:3: error: 'cin' was not declared in this scope
   22 |   cin >> N >> Q;
      |   ^~~
a.cc:27:5: error: 'to' was not declared in this scope
   27 |     to[a].push_back(b);
      |     ^~
a.cc:30:3: error: 'ans' was not declared in this scope
   30 |   ans.resize(N);
      |   ^~~
a.cc:39:5: error: 'cout' was not declared in this scope
   39 |     cout << ans[i] << endl;
      |     ^~~~
a.cc:39:23: error: 'endl' was not declared in this scope
   39 |     cout << ans[i] << endl;
      |                       ^~~~
Language: C++

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

int gcd(int a, int b)
{
    if (a == 0)
        return b;
    return gcd(b % a, a);
}

ll power(ll x, ll y)
{
    ll res = 1;

    while (y > 0) {

        if (y & 1)
            res = res * x;


        y = y >> 1;
        x = x * x;
    }
    return res;
}

vector<int> w[200010];

int a1[100000000];
int b1[100000000];
int c1[100000000];
int d1[100000000];
int e1[100000000];
int f1[100000000];
int g1[100000000];
int h1[100000000];
int i1[100000000];
int q1[100000000];
int k1[100000000];
int l1[100000000];


int vis[200010];

void dfs(int nxt , int prev , int val)
{
    vis[nxt] += val;
    for(int i=0;i<(int)w[nxt].size();i++)
        if(w[nxt][i]!=prev)
            dfs(w[nxt][i],nxt,vis[nxt]);
}

int main()
{
    int n,q;
    cin>>n>>q;
    for(int i=0;i<n-1;i++){
        int a,b;
        cin>>a>>b;
        w[a].push_back(b);
        w[b].push_back(a);
    }
    for(int i=0;i<q;i++){
        int p,x;
        cin>>p>>x;
        vis[p]+=x;
    }
    dfs(1,0,0);
    for(int i=1;i<=n;i++) cout<<vis[i]<<" ";
    cout<<'\n';
    return 0;
}


Compiler output:
/tmp/cchVoUNW.o: in function `dfs(int, int, int)':
a.cc:(.text+0x9d): relocation truncated to fit: R_X86_64_PC32 against symbol `vis' defined in .bss section in /tmp/cchVoUNW.o
a.cc:(.text+0xba): relocation truncated to fit: R_X86_64_PC32 against symbol `vis' defined in .bss section in /tmp/cchVoUNW.o
a.cc:(.text+0x116): relocation truncated to fit: R_X86_64_PC32 against symbol `vis' defined in .bss section in /tmp/cchVoUNW.o
/tmp/cchVoUNW.o: in function `main':
a.cc:(.text+0x2a9): relocation truncated to fit: R_X86_64_PC32 against symbol `vis' defined in .bss section in /tmp/cchVoUNW.o
a.cc:(.text+0x2c5): relocation truncated to fit: R_X86_64_PC32 against symbol `vis' defined in .bss section in /tmp/cchVoUNW.o
a.cc:(.text+0x305): relocation truncated to fit: R_X86_64_PC32 against symbol `vis' defined in .bss section in /tmp/cchVoUNW.o
collect2: error: ld returned 1 exit status
Language: C++

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

int gcd(int a, int b)
{
    if (a == 0)
        return b;
    return gcd(b % a, a);
}

ll power(ll x, ll y)
{
    ll res = 1;

    while (y > 0) {

        if (y & 1)
            res = res * x;


        y = y >> 1;
        x = x * x;
    }
    return res;
}

vector<int> w[200010];

int a1[100000000];
int b1[100000000];
int c1[100000000];
int d1[100000000];
int e1[100000000];
int f1[100000000];
int g1[100000000];
int h1[100000000];
int i1[100000000];
int j1[100000000];
int k1[100000000];
int l1[100000000];


int vis[200010];

void dfs(int nxt , int prev , int val)
{
    vis[nxt] += val;
    for(int i=0;i<(int)w[nxt].size();i++)
        if(w[nxt][i]!=prev)
            dfs(w[nxt][i],nxt,vis[nxt]);
}

int main()
{
    int n,q;
    cin>>n>>q;
    for(int i=0;i<n-1;i++){
        int a,b;
        cin>>a>>b;
        w[a].push_back(b);
        w[b].push_back(a);
    }
    for(int i=0;i<q;i++){
        int p,x;
        cin>>p>>x;
        vis[p]+=x;
    }
    dfs(1,0,0);
    for(int i=1;i<=n;i++) cout<<vis[i]<<" ";
    cout<<'\n';
    return 0;
}


Compiler output:
a.cc:39:17: error: 'int j1 [100000000]' redeclared as different kind of entity
   39 | int j1[100000000];
      |                 ^
In file included from /usr/include/features.h:523,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683,
                 from /usr/include/c++/14/cassert:43,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:33,
                 from a.cc:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:254:1: note: previous declaration 'double j1(double)'
  254 | __MATHCALL (j1,, (_Mdouble_));
      | ^~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i,n,m) for(int i=(n);i<(m);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
#define REPR(i,n) for(int i=(n);i>=0;i--)
#define all(vec) vec.begin(),vec.end()
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using P=pair<ll,ll>;
using PP=pair<ll,P>;
using vp=vector<P>;
using vpp=vector<PP>;
using vs=vector<string>;
#define fi first
#define se second
#define pb push_back
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
template<typename A,typename B>istream&operator>>(istream&is,pair<A,B> &p){is>>p.fi>>p.se;return is;}
template<typename A,typename B>ostream&operator<<(ostream&os,const pair<A,B> &p){os<<"("<<p.fi<<","<<p.se<<")";return os;}
template<typename T>istream&operator>>(istream&is,vector<T> &t){REP(i,t.size())is>>t[i];return is;}
template<typename T>ostream&operator<<(ostream&os,const vector<T>&t){os<<"{";REP(i,t.size()){if(i)os<<",";os<<t[i];}cout<<"}";return os;}
const ll MOD=1000000007LL;
const int INF=1<<30;
const ll LINF=1LL<<60;
int main(){
    int n,q;
    cin>>n>>q;
    vvi G(n);
    REP(i,n-1){
        int a,b;
        cin>>a>>b;
        a--;b--;
        G[a].pb(b);
        G[b].pb(a);
    }
    vi v(n);
    REP(i,q){
        int a,b;
        cin>>a>>b;
        a--;
        v[a]+=b;
    }
    vi f(n);
    queue<int> que;
    que.push(0);
    f[0]=true;
    while(que.size()){
        int t=que.front();que.pop();
        REP(i,G[t].size()){
            if(!f[G[t][i]){
                que.push(G[t][i]);
                v[G[t][i]]+=v[t];
                f[G[t][i]]=true;
            }
        }
    }
    REP(i,n){
        if(i)cout<<" ";cout<<v[i];
    }cout<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:54:26: error: expected ']' before ')' token
   54 |             if(!f[G[t][i]){
      |                          ^
      |                          ]
Language: C++

#include<iostream>
#include<algorithm>
#include<iomanip>
#include<map>
#include<set>
#include<stack>
#include<vector>
#include<numeric>
#include<bitset>
#include<cmath>
#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 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);
  }
  ans.resize(n); // 0で埋め尽くされる
  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:45:17: error: 'i' was not declared in this scope
   45 |     cout << ans[i] << endl;
      |                 ^
Language: C++

n, q = gets.chomp.split.map(&:to_i)

children = Array.new(n+1).map{[]}

(n-1).times do
  a, b = gets.chomp.split.map(&:to_i)
  children[a] << b
end

scores = Array.new(n+1).map{0}

q.times do
  point, x = gets.chomp.split.map(&:to_i)
  scores[point] += x
end

queue = [1]
while(queue.size > 0) do
  i = queue.shift
  
  children[i].each do |child|
    queue.push(child)
    scores[child] += scores[i]
  end
end

puts scores[1..-1].join(" ")


Compiler output:
a.cc:27:13: error: too many decimal points in number
   27 | puts scores[1..-1].join(" ")
      |             ^~~
a.cc:1:1: error: 'n' does not name a type
    1 | n, q = gets.chomp.split.map(&:to_i)
      | ^
a.cc:5:3: error: expected ')' before '-' token
    5 | (n-1).times do
      | ~ ^
      |   )
a.cc:12:1: error: 'q' does not name a type
   12 | q.times do
      | ^
Language: C++

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

vector<int> to;
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;
    to[a].push_back(b);
    to[b].push_back(a);
  }

  rep(i, Q) {
    int p, x;
    cin >> p >> x;
    ans[p] += x;
  }

  dfs(0);

  rep(i, N) { cout << ans[i] << endl; }
  return 0;
}

Compiler output:
a.cc: In function 'void dfs(int, int)':
a.cc:10:20: error: 'begin' was not declared in this scope
   10 |   for (int u : to[v]) {
      |                    ^
a.cc:10:20: note: suggested alternatives:
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166,
                 from a.cc:1:
/usr/include/c++/14/valarray:1238:5: note:   'std::begin'
 1238 |     begin(const valarray<_Tp>& __va) noexcept
      |     ^~~~~
In file included from /usr/include/c++/14/filesystem:53,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200:
/usr/include/c++/14/bits/fs_dir.h:608:3: note:   'std::filesystem::__cxx11::begin'
  608 |   begin(recursive_directory_iterator __iter) noexcept
      |   ^~~~~
a.cc:10:20: error: 'end' was not declared in this scope
   10 |   for (int u : to[v]) {
      |                    ^
a.cc:10:20: note: suggested alternatives:
/usr/include/c++/14/valarray:1265:5: note:   'std::end'
 1265 |     end(const valarray<_Tp>& __va) noexcept
      |     ^~~
/usr/include/c++/14/bits/fs_dir.h:613:3: note:   'std::filesystem::__cxx11::end'
  613 |   end(recursive_directory_iterator) noexcept
      |   ^~~
a.cc:14:14: error: expected ';' before '}' token
   14 |     dfs(u, v)
      |              ^
      |              ;
   15 |   }
      |   ~           
a.cc: In function 'int main()':
a.cc:25:11: 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'}
   25 |     to[a].push_back(b);
      |           ^~~~~~~~~
a.cc:26:11: 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'}
   26 |     to[b].push_back(a);
      |           ^~~~~~~~~
Language: C++

#include "stdafx.h"
#include<math.h>
#include<map>
#include<iostream>
#include <algorithm>
#include <string>
#include<vector>
#include<array>
#include<tuple>
#include<queue>
#include<stack>
#include<iomanip>
#include<bitset>
#include <list>
#include<numeric>
#include <fstream>
#include<set>
//AtCoderC++.cpp

using namespace std;

template<typename T>
inline T ceiling(T n, T d) {
	return n % d == 0 ? n / d : n / d + 1;
}


struct Node {
	int parent{ 0 };
	vector<int> children{ vector<int>() };
};

int main() {
	int N, Q; cin >> N >> Q;
	int f, t;
	auto tree = vector<Node>(N);
	for (size_t i = 0; i < Q; i++) {
		cin >> f >> t;
		tree[f - 1].children.push_back(t - 1);
		tree[t - 1].children.push_back(f - 1);
	}
	for (size_t i = 0; i < N; i++) {
		for (size_t j = 0; j < tree[i].children.size(); j++) {
			tree[tree[i].children[j]].parent = i;
		}
	}
}


Compiler output:
a.cc:1:10: fatal error: stdafx.h: No such file or directory
    1 | #include "stdafx.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define  REP(i, n) for(int i=0; i<(n); ++i)
#define  ALL(obj) (obj).begin(), (obj).end()
#define ll long long
#define ul unsigned long

signed main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, Q;
  cin >> N >> Q;
  vector<vector<int>> near;
  near.resize(N);
  REP(i,N-1)
  {
    int a, b;
    cin >> a >> b;
    near[a-1].push_back(b);
    near[b-1].push_back(a);
  }
  
  int count[N];
  REP(i, Q)
  {
    int p, x;
    cin >> p >> x;
    count[p-1] += x;
  }
  
  vector<bool> visited;
  visited.resize(N);
  REP(i,N) visited[i]=false;
  
  auto f = [&](auto g, vector<int>& todo, int& x)
  {
    for(int n:todo)
    {
      if(visited[n-1]) continue;
      count[n-1]+=x;
      visited[n-1]=true;
      g(near[n-1], count[n-1]);
    }
    return;
  };
  
  f(f, near[0], count[0]);
  
  REP(i,N) cout << count[i] << " ";
  cout << '\n';
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:12: error: use of deleted function 'main()::<lambda(auto:28, std::vector<int>&, int&)>::~<lambda>()'
   37 |   auto f = [&](auto g, vector<int>& todo, int& x)
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   38 |   {
      |   ~         
   39 |     for(int n:todo)
      |     ~~~~~~~~~~~~~~~
   40 |     {
      |     ~       
   41 |       if(visited[n-1]) continue;
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~
   42 |       count[n-1]+=x;
      |       ~~~~~~~~~~~~~~
   43 |       visited[n-1]=true;
      |       ~~~~~~~~~~~~~~~~~~
   44 |       g(near[n-1], count[n-1]);
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~
   45 |     }
      |     ~       
   46 |     return;
      |     ~~~~~~~ 
   47 |   };
      |   ~         
a.cc:37:14: note: 'main()::<lambda(auto:28, std::vector<int>&, int&)>::~<lambda>()' is implicitly deleted because the default definition would be ill-formed:
   37 |   auto f = [&](auto g, vector<int>& todo, int& x)
      |              ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define  REP(i, n) for(int i=0; i<(n); ++i)
#define  ALL(obj) (obj).begin(), (obj).end()
#define ll long long
#define ul unsigned long

signed main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, Q;
  cin >> N >> Q;
  vector<vector<int>> near;
  near.resize(N);
  REP(i,N-1)
  {
    int a, b;
    cin >> a >> b;
    near[a-1].push_back(b);
    near[b-1].push_back(a);
  }
  
  int count[N];
  REP(i, Q)
  {
    int p, x;
    cin >> p >> x;
    count[p-1] += x;
  }
  
  vector<bool> visited;
  visited.resize(N);
  REP(i,N) visited[i]=false;
  
  auto f = [&](auto g, vector<int>& todo, int& x)-> void
  {
    for(int n:todo)
    {
      if(visited[n-1]) continue;
      count[n-1]+=x;
      visited[n-1]=true;
      g(near[n-1], count[n-1]);
    }
    return;
  };
  
  f(f, near[0], count[0]);
  
  REP(i,N) cout << count[i] << " ";
  cout << '\n';
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:12: error: use of deleted function 'main()::<lambda(auto:28, std::vector<int>&, int&)>::~<lambda>()'
   37 |   auto f = [&](auto g, vector<int>& todo, int& x)-> void
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   38 |   {
      |   ~         
   39 |     for(int n:todo)
      |     ~~~~~~~~~~~~~~~
   40 |     {
      |     ~       
   41 |       if(visited[n-1]) continue;
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~
   42 |       count[n-1]+=x;
      |       ~~~~~~~~~~~~~~
   43 |       visited[n-1]=true;
      |       ~~~~~~~~~~~~~~~~~~
   44 |       g(near[n-1], count[n-1]);
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~
   45 |     }
      |     ~       
   46 |     return;
      |     ~~~~~~~ 
   47 |   };
      |   ~         
a.cc:37:14: note: 'main()::<lambda(auto:28, std::vector<int>&, int&)>::~<lambda>()' is implicitly deleted because the default definition would be ill-formed:
   37 |   auto f = [&](auto g, vector<int>& todo, int& x)-> void
      |              ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define  REP(i, n) for(int i=0; i<(n); ++i)
#define  ALL(obj) (obj).begin(), (obj).end()
#define ll long long
#define ul unsigned long

signed main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, Q;
  cin >> N >> Q;
  vector<vector<int>> near;
  near.resize(N);
  REP(i,N-1)
  {
    int a, b;
    cin >> a >> b;
    near[a-1].push_back(b);
    near[b-1].push_back(a);
  }
  
  int count[N];
  REP(i, Q)
  {
    int p, x;
    cin >> p >> x;
    count[p-1] += x;
  }
  
  vector<bool> visited;
  visited.resize(N);
  REP(i,N) visited[i]=false;
  
  auto f = [&f](vector<int>& todo, int& x)-> void
  {
    for(int n:todo)
    {
      if(visited[n-1]) continue;
      count[n-1]+=x;
      visited[n-1]=true;
      f(near[n-1], count[n-1]);
    }
    return;
  };
  
  f(near[0], count[0]);
  
  REP(i,N) cout << count[i] << " ";
  cout << '\n';
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:14: error: use of 'f' before deduction of 'auto'
   37 |   auto f = [&f](vector<int>& todo, int& x)-> void
      |              ^
a.cc: In lambda function:
a.cc:41:10: error: 'visited' is not captured
   41 |       if(visited[n-1]) continue;
      |          ^~~~~~~
a.cc:37:15: note: the lambda has no capture-default
   37 |   auto f = [&f](vector<int>& todo, int& x)-> void
      |               ^
a.cc:33:16: note: 'std::vector<bool> visited' declared here
   33 |   vector<bool> visited;
      |                ^~~~~~~
a.cc:42:7: error: 'count' is not captured
   42 |       count[n-1]+=x;
      |       ^~~~~
a.cc:37:15: note: the lambda has no capture-default
   37 |   auto f = [&f](vector<int>& todo, int& x)-> void
      |               ^
a.cc:25:7: note: 'int count [N]' declared here
   25 |   int count[N];
      |       ^~~~~
a.cc:43:7: error: 'visited' is not captured
   43 |       visited[n-1]=true;
      |       ^~~~~~~
a.cc:37:15: note: the lambda has no capture-default
   37 |   auto f = [&f](vector<int>& todo, int& x)-> void
      |               ^
a.cc:33:16: note: 'std::vector<bool> visited' declared here
   33 |   vector<bool> visited;
      |                ^~~~~~~
a.cc:44:7: error: use of 'f' before deduction of 'auto'
   44 |       f(near[n-1], count[n-1]);
      |       ^
a.cc:44:9: error: 'near' is not captured
   44 |       f(near[n-1], count[n-1]);
      |         ^~~~
a.cc:37:15: note: the lambda has no capture-default
   37 |   auto f = [&f](vector<int>& todo, int& x)-> void
      |               ^
a.cc:15:23: note: 'std::vector<std::vector<int> > near' declared here
   15 |   vector<vector<int>> near;
      |                       ^~~~
a.cc:44:20: error: 'count' is not captured
   44 |       f(near[n-1], count[n-1]);
      |                    ^~~~~
a.cc:37:15: note: the lambda has no capture-default
   37 |   auto f = [&f](vector<int>& todo, int& x)-> void
      |               ^
a.cc:25:7: note: 'int count [N]' declared here
   25 |   int count[N];
      |       ^~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define  REP(i, n) for(int i=0; i<(n); ++i)
#define  ALL(obj) (obj).begin(), (obj).end()
#define ll long long
#define ul unsigned long

signed main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, Q;
  cin >> N >> Q;
  vector<vector<int>> near;
  near.resize(N);
  REP(i,N-1)
  {
    int a, b;
    cin >> a >> b;
    near[a-1].push_back(b);
    near[b-1].push_back(a);
  }
  
  int count[N];
  REP(i, Q)
  {
    int p, x;
    cin >> p >> x;
    count[p-1] += x;
  }
  
  vector<bool> visited;
  visited.resize(N);
  REP(i,N) visited[i]=false;
  
  auto f = [&](vector<int>& todo, int& x)-> void
  {
    for(int n:todo)
    {
      if(visited[n-1]) continue;
      count[n-1]+=x;
      visited[n-1]=true;
      f(near[n-1], count[n-1]);
    }
    return;
  };
  
  f(near[0], count[0]);
  
  REP(i,N) cout << count[i] << " ";
  cout << '\n';
  return 0;
}

Compiler output:
a.cc: In lambda function:
a.cc:44:7: error: use of 'f' before deduction of 'auto'
   44 |       f(near[n-1], count[n-1]);
      |       ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define  REP(i, n) for(int i=0; i<(n); ++i)
#define  ALL(obj) (obj).begin(), (obj).end()
#define ll long long
#define ul unsigned long

signed main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, Q;
  cin >> N >> Q;
  vector<vector<int>> near;
  near.resize(N);
  REP(i,N-1)
  {
    int a, b;
    cin >> a >> b;
    near[a-1].push_back(b);
    near[b-1].push_back(a);
  }
  
  int count[N];
  REP(i, Q)
  {
    int p, x;
    cin >> p >> x;
    count[p-1] += x;
  }
  
  vector<bool> visited;
  visited.resize(N);
  REP(i,N) visited[i]=false;
  
  auto f = [&](vectro<int>& todo, int& x)-> void
  {
    for(int n:todo)
    {
      if(visited[n-1]) continue;
      count[n-1]+=x;
      visited[n-1]=true;
      f(near[n-1], count[n-1]);
    }
    return;
  };
  
  f(near[0], count[0]);
  
  REP(i,N) cout << count[i] << " ";
  cout << '\n';
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:16: error: 'vectro' has not been declared
   37 |   auto f = [&](vectro<int>& todo, int& x)-> void
      |                ^~~~~~
a.cc:37:22: error: expected ',' or '...' before '<' token
   37 |   auto f = [&](vectro<int>& todo, int& x)-> void
      |                      ^
a.cc: In lambda function:
a.cc:39:15: error: 'todo' was not declared in this scope
   39 |     for(int n:todo)
      |               ^~~~
a.cc:42:19: error: 'x' was not declared in this scope
   42 |       count[n-1]+=x;
      |                   ^
a.cc:44:7: error: use of 'f' before deduction of 'auto'
   44 |       f(near[n-1], count[n-1]);
      |       ^
a.cc: In function 'int main()':
a.cc:49:4: error: no match for call to '(main()::<lambda(int)>) (__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type&, int&)'
   49 |   f(near[0], count[0]);
      |   ~^~~~~~~~~~~~~~~~~~~
a.cc:37:12: note: candidate: 'main()::<lambda(int)>'
   37 |   auto f = [&](vectro<int>& todo, int& x)-> void
      |            ^
a.cc:37:12: note:   candidate expects 1 argument, 2 provided
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define  REP(i, n) for(int i=0; i<(n); ++i)
#define  ALL(obj) (obj).begin(), (obj).end()
#define ll long long
#define ul unsigned long

signed main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, Q;
  cin >> N >> Q;
  vector<vector<int>> near;
  nn.resize(N);
  REP(i,N-1)
  {
    int a, b;
    cin >> a >> b;
    near[a-1].push_back(b);
    near[b-1].push_back(a);
  }
  
  int count[N];
  REP(i, Q)
  {
    int p, x;
    cin >> p >> x;
    count[p-1] += x;
  }
  
  vector<bool> visited;
  visited.resize(N);
  REP(i,N) visited[i]=false;
  auto f = [&](vectro<int> &todo, int &x)-> void
  {
    for(int n:todo)
    {
      if(visited[n-1]) continue;
      count[n-1]+=x;
      visited[n-1]=true;
      f(near[n-1], count[n-1]);
    }
    return;
  };
  
  f(near[0], count[0]);
  
  REP(i,N) cout << count[i] << " ";
  cout << '\n';
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:3: error: 'nn' was not declared in this scope; did you mean 'yn'?
   16 |   nn.resize(N);
      |   ^~
      |   yn
a.cc:36:16: error: 'vectro' has not been declared
   36 |   auto f = [&](vectro<int> &todo, int &x)-> void
      |                ^~~~~~
a.cc:36:22: error: expected ',' or '...' before '<' token
   36 |   auto f = [&](vectro<int> &todo, int &x)-> void
      |                      ^
a.cc: In lambda function:
a.cc:38:15: error: 'todo' was not declared in this scope
   38 |     for(int n:todo)
      |               ^~~~
a.cc:41:19: error: 'x' was not declared in this scope
   41 |       count[n-1]+=x;
      |                   ^
a.cc:43:7: error: use of 'f' before deduction of 'auto'
   43 |       f(near[n-1], count[n-1]);
      |       ^
a.cc: In function 'int main()':
a.cc:48:4: error: no match for call to '(main()::<lambda(int)>) (__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type&, int&)'
   48 |   f(near[0], count[0]);
      |   ~^~~~~~~~~~~~~~~~~~~
a.cc:36:12: note: candidate: 'main()::<lambda(int)>'
   36 |   auto f = [&](vectro<int> &todo, int &x)-> void
      |            ^
a.cc:36:12: note:   candidate expects 1 argument, 2 provided