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

#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;
vector<vector<int>> v(200000);
vector<ll> ans(200000,0LL);
// vector<bool> used(200000);


void search(int p,int parent){
	used[p] = true;
	for(int i = 0; i < v[p].size(); i++) {
		if (v[p][i] != parent){
			ans[v[p][i]] += ans[p];
			search(v[p][i],p);
		}
	}
}

int main(){
	int n,q;cin>>n>>q;
	int a,b;
	for(int i = 0; i < n - 1; i++) {
		cin>>a>>b;
		v[a - 1].pb(b - 1);
		v[b - 1].pb(a - 1);
	}
	for(int i = 0; i < q; i++) {
		ll a,b;cin>>a>>b;
		ans[a - 1LL] += b;
	}
	search(0, 0);

	for(int i = 0; i < n; i++) {
		cout << ans[i] << " ";
	}
	cout << endl;
	return 0;
}

Compiler output:
a.cc: In function 'void search(int, int)':
a.cc:21:9: error: 'used' was not declared in this scope
   21 |         used[p] = true;
      |         ^~~~
Language: C++

#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define debug(x) cerr << #x << " " << x << '\n'
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
const int INF = 0x3f3f3f3f, N = 2e5 + 5;
const ll LINF = 1e18 + 5;
int n, q;
ll val[N];
vector <int> G[N];
int in[N], out[N], id;
void dfs(int u,int fa)  
{
	in[u] = ++id;
	num[id] = u;
	for(auto v : G[u])
	{
		if(v==fa) continue;
		dfs(v,u);
	}
	out[u] = id;
}
void upd(int rt, int x)
{
	val[in[rt]] += x;
	val[out[rt]+1] -= x;
}
int main()
{
 	ios::sync_with_stdio(false);
 	cin.tie(0);
 	cin >> n >> q;
 	for(int i=1; i<n; i++)
 	{
 		int u, v;
 		cin >> u >> v;
 		G[u].pb(v);
 		G[v].pb(u);
 	}
 	dfs(1, 0);
 	while(q--)
 	{
 		int p, x;
 		cin >> p >> x;
 		upd(p, x);
 	}
 	for(int i=1; i<=n; i++) val[i] += val[i-1];
 	for(int i=1; i<=n; i++)
 		cout << val[num[i]] << " \n"[i==n];
	return 0;
}


Compiler output:
a.cc: In function 'void dfs(int, int)':
a.cc:20:9: error: 'num' was not declared in this scope; did you mean 'enum'?
   20 |         num[id] = u;
      |         ^~~
      |         enum
a.cc: In function 'int main()':
a.cc:54:29: error: 'num' was not declared in this scope; did you mean 'enum'?
   54 |                 cout << val[num[i]] << " \n"[i==n];
      |                             ^~~
      |                             enum
Language: C++

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

signed main()
{
    int N, Q; cin >> N >> Q;
    vector<pair<int, int>> E(N-1);
    vector<int> plus(N+1), ans(N+1); 
    for(int i = )
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:17: error: expected primary-expression before ')' token
   10 |     for(int i = )
      |                 ^
a.cc:10:18: error: expected ';' before '}' token
   10 |     for(int i = )
      |                  ^
      |                  ;
   11 | }
      | ~                 
a.cc:11:1: error: expected primary-expression before '}' token
   11 | }
      | ^
a.cc:10:18: error: expected ';' before '}' token
   10 |     for(int i = )
      |                  ^
      |                  ;
   11 | }
      | ~                 
a.cc:11:1: error: expected primary-expression before '}' token
   11 | }
      | ^
a.cc:10:18: error: expected ')' before '}' token
   10 |     for(int i = )
      |        ~         ^
      |                  )
   11 | }
      | ~                 
a.cc:11:1: error: expected primary-expression before '}' token
   11 | }
      | ^
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 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: In function 'void dfs(int, int)':
a.cc:12:17: error: expected ';' before ':' token
   12 |         dfs(u,v):
      |                 ^
      |                 ;
Language: C++

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

#define rep(i,n) for(ll i=0;i<(n);++i)
using ll = long long;
using pll = pair<ll,ll>;
constexpr ll INF = (1LL<<60);
constexpr ll MOD = (1e9+7);
//constexpr ll MOD = (998244353);
template<class T> bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}
#if loc||debg||local||debug
void dump(){cerr<<endl;}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){cerr<<h<<", ";dump(forward<Ts>(t)...);}
#else
template<class T,class... Ts> void dump(T&& h, Ts&&... t){}
#endif
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T> ostream &operator<<(ostream& os,vector<T>const& v){for(auto const& vi:v)os<<vi<<" ";return os;}
template<class T>vector<T> vec(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto vec(size_t a, Ts... ts){return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...));}
template<class T>vector<T> _vec(size_t a,T v){return vector<T>(a,v);}
template<class T, class... Ts>auto _vec(size_t a, Ts... ts){return vector<decltype(_vec<T>(ts...))>(a, _vec<T>(ts...));}

int main(){

  int n,q;
  cin>>n>>q;
  vector<vector<ll>> adj1(n);
  rep(i,n-1){
    ll a,b;
    cin>>a>>b;
    a--;b--;
    adj1[a].emplace_back(b);
    adj1[b].emplace_back(a);
  }
  vector<ll> ans(n);
  rep(i,n){
    ll p,x;
    cin>>p>>x;
    p--;
    ans[p]+=x;
  }

  ll root = 0;
  auto to_DAG = [](auto adj,int root){
    ll n = adj.size();
    queue<ll> que;
    vector<int> seen(n);
    vector<vector<ll>> dag(n);
    que.emplace(root);
    while(!que.size()){
      ll cur = que.top();
      que.pop();
      if(seen[cur])continue;
      seen[cur] = 1;
      for(auto nxt:adj[cur]){
        if(seen[nxt])continue;
        dag[cur].emplace_back(nxt);
      }
    }
    return dag;
  };

  auto adj2 = to_DAG(adj1,root);

  queue<ll> que;
  que.emplace(root);
  while(!que.empty()){
    ll cur = que.top();
    que.pop();
    for(auto nxt:adj2[cur]){
      ans[nxt] += ans[cur];
      que.emplace(nxt);
    }
  }

  for(auto a:ans)cout<<a<<endl;

}

Compiler output:
a.cc: In lambda function:
a.cc:54:20: error: 'class std::queue<long long int>' has no member named 'top'; did you mean 'pop'?
   54 |       ll cur = que.top();
      |                    ^~~
      |                    pop
a.cc: In function 'int main()':
a.cc:71:18: error: 'class std::queue<long long int>' has no member named 'top'; did you mean 'pop'?
   71 |     ll cur = que.top();
      |                  ^~~
      |                  pop
Language: Java

import java.util.*;
 
public class Main {
 
  public static ArrayList[] edge;
  public static long[] point;
  public static boolean[] visit;
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int q = sc.nextInt();
    point = new long[n];
    edge = new ArrayList[n];
    int[] c = new int[n];
    for(int i = 0; i < n - 1; i++) {
      int a = sc.nextInt() - 1;
      int b = sc.nextInt() - 1;
      if(c[a] == 0) {
        c[a] = 1;
        edge[a] = new ArrayList<Integer>();
      }
      if(c[b] == 0) {
        c[b] = 1;
        edge[b] = new ArrayList<Integer>();
      }      
      edge[a].add(b);
      edge[b].add(a);
    }
    
    for(int i = 0; i < q; i++) {
      int p = sc.nextInt() - 1;
      long x = sc.nextLong();
      point[p] += x;
    } 
 
    dfs(0, -1);
    StringBuilder sb = new StringBuilder();
    for(int i = 0; i < n; i++) {
      sb.apend(point[i] + " ");
    }
    System.out.println(sb);
  }
 
  public static void dfs(int v, int p) {
    ArrayList<Integer> list = edge[v];
    long x = point[v];
    for(int i = 0; i < list.size(); i++) {
      int t = list.get(i);
 
      if(t != p) {
        point[t] += x;
        dfs(t, v);
      }
    }
  }
}

Compiler output:
Main.java:39: error: cannot find symbol
      sb.apend(point[i] + " ");
        ^
  symbol:   method apend(String)
  location: variable sb of type StringBuilder
Note: Main.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
Language: Java

import java.util.*;
 
public class Main {
 
  public static ArrayList[] edge;
  public static long[] point;
  public static boolean[] visit;
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int q = sc.nextInt();
    point = new long[n];
    edge = new ArrayList[n];
    int[] c = new int[n];
    for(int i = 0; i < n - 1; i++) {
      int a = sc.nextInt() - 1;
      int b = sc.nextInt() - 1;
      if(c[a] == 0) {
        c[a] = 1;
        edge[a] = new ArrayList<Integer>();
      }
      if(c[b] == 0) {
        c[b] = 1;
        edge[b] = new ArrayList<Integer>();
      }      
      edge[a].add(b);
      edge[b].add(a);
    }
    
    for(int i = 0; i < q; i++) {
      int p = sc.nextInt() - 1;
      long x = sc.nextLong();
      point[p] += x;
    } 
 
    dfs(0, -1);
    StringBuilder sb = new StringBuilder();
    for(int i = 0; i < n; i++) {
      sb.add(point[i] + " ");
    }
    System.out.println(sb);
  }
 
  public static void dfs(int v, int p) {
    ArrayList<Integer> list = edge[v];
    long x = point[v];
    for(int i = 0; i < list.size(); i++) {
      int t = list.get(i);
 
      if(t != p) {
        point[t] += x;
        dfs(t, v);
      }
    }
  }
}

Compiler output:
Main.java:39: error: cannot find symbol
      sb.add(point[i] + " ");
        ^
  symbol:   method add(String)
  location: variable sb of type StringBuilder
Note: Main.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define rep(i,n) for(ll i=0;i<(n);i++)
void dfs(ll pre,ll tmp,ll sum){
  value[tmp]+=sum;
  for(auto out:g[tmp]) if(out!=pre) dfs(tmp,out,value[tmp]);
}
int main(){
  vector<ll> g[200005];
  ll value[200005]={0};
  ll n,q;
  rep(i,n-1){
    ll a,b;cin>>a>>b;a--;b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  rep(i,q){
    ll a,b;cin>>a>>b;a--;
    value[a]+=b;
  }
  dfs(-1,0,0);
  rep(i,n){
    cout<<value[i]<<' ';
  }
  cout<<endl;
}

Compiler output:
a.cc: In function 'void dfs(ll, ll, ll)':
a.cc:6:3: error: 'value' was not declared in this scope
    6 |   value[tmp]+=sum;
      |   ^~~~~
a.cc:7:16: error: 'g' was not declared in this scope
    7 |   for(auto out:g[tmp]) if(out!=pre) dfs(tmp,out,value[tmp]);
      |                ^
Language: Java

// https://atcoder.jp/contests/abc138/submissions/9369775
import java.util.*;

public class Main {

  public static ArrayList[] edge;
  public static long[] point;
  public static boolean[] visit;
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = Integer.parseInt(sc.next());
    int q = Integer.parseInt(sc.next());
    point = new long[n];
    visit = new boolean[n];
    edge = new ArrayList[n];
    for(int i = 0; i < n; i++) {
      edge[i] = new ArrayList<Integer>();
    }
    for(int i = 0; i < n - 1; i++) {
      int a = Integer.parseInt(sc.next()) - 1;
      int b = Integer.parseInt(sc.next()) - 1;
      edge[a].add(b);
      edge[b].add(a);
    }
    for(int i = 0; i < q; i++) {
      int p = Integer.parseInt(sc.next()) - 1;
      long x = sc.nextLong();
      point[p] += x;
    }

    dfs(0, -1);
    PrintWriter out = new PrintWriter(System.out);
    for(int i = 0; i < n; i++) {
      out.print(point[i] + " ");
    }
    out.flush();
  }

  public static void dfs(int v, int p) {
    ArrayList<Integer> list = edge[v];
    long x = point[v];
    for(int i = 0; i < list.size(); i++) {
      int t = list.get(i);

      if(!visit[t] && t != p) {
        point[t] += x;
        dfs(t, v);
      }
    }
  }
}


Compiler output:
Main.java:32: error: cannot find symbol
    PrintWriter out = new PrintWriter(System.out);
    ^
  symbol:   class PrintWriter
  location: class Main
Main.java:32: error: cannot find symbol
    PrintWriter out = new PrintWriter(System.out);
                          ^
  symbol:   class PrintWriter
  location: class Main
Note: Main.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
2 errors
Language: C++

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

void dfs(vector<vector<int>> &con, int num, vector<bool> &seen vector<int> &ope)
{
	seen.at(num) = true;
	for (int con_ele : con.at(num)) {
		if (seen.at(con_ele) == false) {
			ope.at(con_ele) += ope.at(num);
			dfs(con, con_ele, seen, ope);
		}
	}
};

int main()
{
	int n, q;
	cin >> n >> q;
	vector<vector<int>> points(n);
	for (int i = 0; i < n - 1; i++) {
		int a_in, b_in;
		cin >> a_in >> b_in;
		points.at(a_in - 1).push_back(b_in - 1);
		points.at(b_in - 1).push_back(a_in - 1);
	}
	vector<int> ope(n, 0);
	for (int i = 0; i < q; i++) {
		int p_in, x_in;
		cin >> p_in >> x_in;
		ope.at(p_in - 1) += x_in;
	}

	vector<bool> seen(n, false);
	dfs(points, 0, seen, ope);

	for (int ope_ele : ope) {
		cout << ope_ele << " ";
	}
	cout << endl;
}


Compiler output:
a.cc:4:64: error: expected ',' or '...' before 'vector'
    4 | void dfs(vector<vector<int>> &con, int num, vector<bool> &seen vector<int> &ope)
      |                                                                ^~~~~~
a.cc: In function 'void dfs(std::vector<std::vector<int> >&, int, std::vector<bool>&)':
a.cc:9:25: error: 'ope' was not declared in this scope
    9 |                         ope.at(con_ele) += ope.at(num);
      |                         ^~~
a.cc: In function 'int main()':
a.cc:34:12: error: too many arguments to function 'void dfs(std::vector<std::vector<int> >&, int, std::vector<bool>&)'
   34 |         dfs(points, 0, seen, ope);
      |         ~~~^~~~~~~~~~~~~~~~~~~~~~
a.cc:4:6: note: declared here
    4 | void dfs(vector<vector<int>> &con, int num, vector<bool> &seen vector<int> &ope)
      |      ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
signed main(){
  int N,Q; cin>>N>>Q;
  vii A(N);
  rep(_,0,N-1){
    int X,Y; cin>>X>>Y;
    A[X-1].push_back(Y-1);
    A[Y-1].push_back(X-1);
    }
  vi plus(N);
  rep(i,0,Q){
    int X,Y; cin>>X>>Y;
    plus[X-1]+=Y;
    }
  vi ans(N,-1);
  queue<int> q;
  q.push(0);
  while(q.size()>0){
    int K=q.front();
    q.pop();
    ans[K]=plus[K];
    rep(i,0,A[K].size()){
      if(ans[A[K][i]]==-1)
        q.push(A[K][i]]);
      else
        ans[K]+=ans[A[K][i]];
      }
    }
  rep(i,0,N) cout<<ans[i]<<" ";
  cout<<endl;
  }


Compiler output:
a.cc: In function 'int main()':
a.cc:36:23: error: expected ')' before ']' token
   36 |         q.push(A[K][i]]);
      |               ~       ^
      |                       )
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
signed main(){
  int N,Q; cin>>N>>Q;
  vii A(N);
  rep(_,0,N-1){
    int X,Y; cin>>X>>Y;
    A[X-1].push_back(Y-1);
    A[Y-1].push_back(X-1);
    }
  vi plus(N);
  rep(i,0,Q){
    int X,Y; cin>>X>>Y;
    plus[X-1]+=Y;
    }
  vi ans(N,-1);
  queue<int> q;
  q.push(0);
  while(q.size()>0){
    int K=q.front();
    q.pop();
    ans[K]=plus[K];
    rep(i,0,A[K].size()){
      if(ans[A[K][i]]==-1)
        Q.push(A[K][i]]);
      else
        ans[K]+=ans[A[K][i]];
      }
    }
  rep(i,0,N) cout<<ans[i]<<" ";
  cout<<endl;
  }


Compiler output:
a.cc: In function 'int main()':
a.cc:36:11: error: request for member 'push' in 'Q', which is of non-class type 'long long int'
   36 |         Q.push(A[K][i]]);
      |           ^~~~
a.cc:36:23: error: expected ')' before ']' token
   36 |         Q.push(A[K][i]]);
      |               ~       ^
      |                       )
Language: C++

import java.util.*;

public class Main {

  public static ArrayList[] edge;
  public static long[] point;
  public static boolean[] visit;
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int q = sc.nextInt();
    point = new long[n];
    visit = new boolean[n];
    edge = new ArrayList[n];
    ArrayList<Integer> l = new ArrayList<Integer>();
    for(int i = 0; i < n; i++) {
      edge[i] = l;
    }
    for(int i = 0; i < n - 1; i++) {
      int a = sc.nextInt() - 1;
      int b = sc.nextInt() - 1;
      edge[a].add(b);
      edge[b].add(a);
    }
    for(int i = 0; i < q; i++) {
      int p = sc.nextInt() - 1;
      long x = sc.nextLong();
      point[p] += x;
    }


    dfs(0, -1);
    for(int i = 0; i < n; i++) {
      System.out.print(point[i] + " ");
    }
  }

  public static void dfs(int v, int p) {
    visit[v] = true;
    ArrayList<Integer> list = edge[v];
    for(int i = 0; i < list.size(); i++) {
      int t = list.get(i);

      if (visit[t]) continue;
      if(t != p) {
        point[t] += point[v];
        dfs(t, v);
      }
    }
  }
}



Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.*;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: expected unqualified-id before 'public'
    3 | public class Main {
      | ^~~~~~
Language: C++

#include <stdio.h>
#include <math.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <queue>
#include <map>
#include <utility>

using namespace std;

#define ll long long

vector<ll> ppp;
vector<vector<ll>> nelist;
vector<ll> counter;
vector<ll> used;

void dfs(ll pi, ll point)
{
    if(used.at[pi] == 1) {
        // 見たものは見ない
        return;
    }
    used.at[pi] = 1;
    point += ppp[pi];
    counter.at(pi) = point;
    for (auto child : nelist.at(pi))
    {
        dfs(child, nextPoint);
    }
    return;
}

void solve()
{
    ll N, Q;
    cin >> N >> Q;
    vector<ll> a(N - 1), b(N - 1);

    // 頂点1が根

    nelist = vector<vector<ll>>(N);
    counter = vector<ll>(N, 0);
    ppp = vector<ll>(N, 0);
    used = vector<ll>(N, 0);

    for (ll i = 0; i < N - 1; i++)
    {
        cin >> a.at(i) >> b.at(i);
        a.at(i) -= 1;
        b.at(i) -= 1;
        nelist.at(a.at(i)).push_back(b.at(i));
    }

    for (ll i = 0; i < Q; i++)
    {
        ll pi, x;
        cin >> pi >> x;
        pi -= 1;
        ppp[pi] += x;
    }

    // used.at(0) = 1;
    dfs(0, 0);
    cout << counter.at(0);
    for (ll i = 1; i < N; i++)
    {
        cout << " " << counter.at(i);
    }
    cout << endl;

    return;
}

int main()
{
    solve();
    return 0;
}


Compiler output:
a.cc: In function 'void dfs(long long int, long long int)':
a.cc:22:15: error: invalid types '<unresolved overloaded function type>[long long int]' for array subscript
   22 |     if(used.at[pi] == 1) {
      |               ^
a.cc:26:12: error: invalid types '<unresolved overloaded function type>[long long int]' for array subscript
   26 |     used.at[pi] = 1;
      |            ^
a.cc:31:20: error: 'nextPoint' was not declared in this scope; did you mean 'nextdownl'?
   31 |         dfs(child, nextPoint);
      |                    ^~~~~~~~~
      |                    nextdownl
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,q;
  cin >> n >> q;
  int a,b;
  vector<set<int> >hen(n+1);
  int i;
  for(i=0;i<n-1;i++){
    cin >> a >> b;
    hen[a].insert(b);
  }
  vector<long>cnt(n+1);
  for(i=0;i<q;i++){
    cin >> a >> b;
    cnt[a] += b;
  }
  queue<int>stc;
  stc.push_back(1);
  int tmp = 1;
  while(!stc.empty()){
    tmp = stc.top();
    stc.pop();
    for(auto j:hen[tmp]){
      stc.push_back(j);
      cnt[j] += cnt[tmp];
    }
  }
  for(i=1;i<=n;i++){
    cout << cnt[i] << " ";
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:7: error: 'class std::queue<int>' has no member named 'push_back'
   19 |   stc.push_back(1);
      |       ^~~~~~~~~
a.cc:22:15: error: 'class std::queue<int>' has no member named 'top'; did you mean 'pop'?
   22 |     tmp = stc.top();
      |               ^~~
      |               pop
a.cc:25:11: error: 'class std::queue<int>' has no member named 'push_back'
   25 |       stc.push_back(j);
      |           ^~~~~~~~~
Language: C++

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

int main(){
  long long n, q; cin >> n >> q;
  vector<vector<long long>> e(n);
  for(int i = 0; i < n - 1; i++){
    long long a, b; cin >> a >> b;
    a--; b--;
    e.at(a).push_back(b);
    e.at(b).push_back(a);
  }
  vector<long long> count(n, 0);
  for(int i = 0; i < q; i++){
    long long p, x; cin >> p >> x;
    p--;
    count.at(p) += x;
  }
  vector<long long> out(n, -1);
  queue<long long> que;
  que.push(0);
  long long val = 0;
  while(!que.empty()){
    long long u = que.front();
    que.pop();
    for(int i : que.at(u)){
      if(out.at(i) != -1){
        val = out.at(i);
        continue;
      }
      que.push(i);
    }
    out.at(u) = val + count.at(u);

  }
  for(int i = 0; i < n; i++){
    cout << out.at(i) << " ";
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:21: error: 'class std::queue<long long int>' has no member named 'at'
   26 |     for(int i : que.at(u)){
      |                     ^~
Language: C++

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

int main(){
  long long n, q; cin >> n >> q;
  vector<vector<long long>> e(n);
  for(int i = 0; i < n - 1; i++){
    long long a, b; cin >> a >> b;
    a--; b--;
    e.at(a).push_back(b);
    e.at(b).push_back(a);
  }
  vector<long long> count(n, 0);
  for(int i = 0; i < q; i++){
    long long p, x; cin >> p >> x;
    p--;
    count.at(p) += x;
  }
  vector<long long> out(n, -1);
  queue<long long> que;
  que.push(0);
  long long val = 0;
  while(!que.empty()){
    long long u = que.top();
    que.pop();
    val += count.at(u);
    out.at(u) = val;
    for(int i : que.at(u)){
      if(out.at(i) != -1) continue;
      que.push(i);
    }
  }
  for(int i = 0; i < n; i++){
    cout << out.at(i) << " ";
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:23: error: 'class std::queue<long long int>' has no member named 'top'; did you mean 'pop'?
   24 |     long long u = que.top();
      |                       ^~~
      |                       pop
a.cc:28:21: error: 'class std::queue<long long int>' has no member named 'at'
   28 |     for(int i : que.at(u)){
      |                     ^~
Language: C++

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

int main(){
  long long n, q; cin >> n >> q;
  vector<vector<long long>> e(n);
  for(int i = 0; i < n - 1; i++){
    long long a, b; cin >> a >> b;
    a--; b--;
    e.at(a).push_back(b);
    e.at(b).push_back(a);
  }
  vector<long long> count(n, 0);
  for(int i = 0; i < q; i++){
    long long p, x; cin >> p >> x;
    p--;
    count.at(p) += x;
  }
  vector<long long> out(n, -1);
  queue<long long> que;
  que.push(0);
  long long val = 0;
  while(!que.empty()){
    long long u = que.front();
    que.pop();
    val += count.at(u);
    out.at(u) = val;
    for(int i : que.at(u)){
      if(out.at(i) != -1) continue;
      que.push(i);
    }
  }
  for(int i = 0; i < n; i++){
    cout << out.at(i) << " ";
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:21: error: 'class std::queue<long long int>' has no member named 'at'
   28 |     for(int i : que.at(u)){
      |                     ^~
Language: C++

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

int main(){
  long long n, q; cin >> n >> q;
  vector<vector<long long>> e(n);
  for(int i = 0; i < n - 1; i++){
    long long a, b; cin >> a >> b;
    a--; b--;
    e.at(a).push_back(b);
    e.at(b).push_back(a);
  }
  vector<long long> count(n, 0);
  for(int i = 0; i < q; i++){
    long long p, x; cin >> p >> x;
    p--;
    count.at(p) += x;
  }
  vector<long long> out(n, -1);
  queue<long long> pue;
  que.push(0);
  long long val = 0;
  while(!que.empty()){
    long long u = que.front();
    que.pop();
    val += count.at(u);
    out.at(u) = val;
    for(int i : que.at(u)){
      if(out.at(i) != -1) continue;
      que.push(i);
    }
  }
  for(int i = 0; i < n; i++){
    cout << out.at(i) << " ";
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:3: error: 'que' was not declared in this scope; did you mean 'pue'?
   21 |   que.push(0);
      |   ^~~
      |   pue
Language: C++

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

vector<int> vis[200010];
vector<int> ans;

void dfs(int v, int p=-1){
  for(int u : vis[v]){
    
    if(u==p) continue;

    ans[u] += ans[v];
    dfs(u,v);
  }
}


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

  for(i=0;i<n-1;++i){
    int a,b;
    cin >> a >> b;
    --a;
    --b;
    to[a].push_back(b);
    to[b].push_back(a);
  }

  ans.resize(n);
  for(i=0;i<q;i++){
    int p,x;
    cin >> p >> x;
    --p;
    ans[p] += x;
  }

  dfs(0);

  for(i=0;i<n;i++){
    cout << ans[i] << " ";
  }
  cout << "\n";

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:5: error: 'to' was not declared in this scope; did you mean 'tm'?
   27 |     to[a].push_back(b);
      |     ^~
      |     tm
Language: C++

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

int vis[200010];
int ans[200010];

void dfs(int v, int p=-1){
  for(int u : vis[v]){
    if(u==p) continue;

    ans[u] += ans[v];
    dfs(u,v);
  }
}


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

  for(i=0;i<n-1;++i){
    int a,b;
    cin >> a >> b;
    --a;
    --b;
    to[a].push_back(b);
    to[b].push_back(a);
  }

  ans.resize(n);
  for(i=0;i<q;i++){
    int p,x;
    cin >> p >> x;
    --p;
    ans[p] += x;
  }

  dfs(0);

  for(i=0;i<n;i++){
    cout << ans[i] << " ";
  }
  cout << "\n";

  return 0;
}

Compiler output:
a.cc: In function 'void dfs(int, int)':
a.cc:8:20: error: 'begin' was not declared in this scope
    8 |   for(int u : vis[v]){
      |                    ^
a.cc:8: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:8:20: error: 'end' was not declared in this scope
    8 |   for(int u : vis[v]){
      |                    ^
a.cc:8: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: In function 'int main()':
a.cc:26:5: error: 'to' was not declared in this scope; did you mean 'tm'?
   26 |     to[a].push_back(b);
      |     ^~
      |     tm
a.cc:30:7: error: request for member 'resize' in 'ans', which is of non-class type 'int [200010]'
   30 |   ans.resize(n);
      |       ^~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
signed main(){
  int N,Q; cin>>N>>Q;
  vii A(N);
  rep(i,0,N-1){
    int X,Y; cin>>X>>Y;
    A[X-1].push_back(Y-1);
  }
  vi ans(N);
 rep(a,0,Q){
   queue<int> X;
   int p,x; cin>>p>>x;
   X.push(p-1);
   bool F(N,1);
   F[p-1]=0;
   while(1){
     int K=X.front();
     X.pop();
     ans[K]+=x;
     rep(i,0,A[K].size()){
       if(F[A[K][i]]){
         X.push(A[K][i]);
         F[A[K][i]]=0;
       }
     }
     if(X.size()==0)
       break;
   }
 }
  rep(i,0,N) cout<<ans[i]<<" ";
  cout<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:14: error: expression list treated as compound expression in initializer [-fpermissive]
   27 |    bool F(N,1);
      |              ^
a.cc:28:5: error: invalid types 'bool[long long int]' for array subscript
   28 |    F[p-1]=0;
      |     ^
a.cc:34:12: error: invalid types 'bool[__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type {aka long long int}]' for array subscript
   34 |        if(F[A[K][i]]){
      |            ^
a.cc:36:11: error: invalid types 'bool[__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type {aka long long int}]' for array subscript
   36 |          F[A[K][i]]=0;
      |           ^
Language: C++

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

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, q;
  cin >> n >> q;
  vector<vector<int>> E(n);
  for(int i=0;i<n-1;i++){
    int l, r;
    cin >> l >> r;
    l--;r--;
    E[l].emplace_back(r);
    E[r].emplace_back(l);
  }
  vector<int> val(n, 0);
  for(int i=0;i<q;i++){
    int id, x;
    cin >> id >> x;
    val[id-1] += x;
  }
  vector<bool> visited(n, false);
  auto dfs = [&](auto&& f, int cur){
    visited[cur] = true;
    for(auto&& to:E[cur]){
      if(!visited[to]){
        val[to] += val[cur];
        dfs(f, to);
      }
    }
  }
  dfs(dfs, 0);
  for(auto&& x:val)
	cout << x << " ";
  cout << endl;
}

Compiler output:
a.cc: In lambda function:
a.cc:29:9: error: use of 'dfs' before deduction of 'auto'
   29 |         dfs(f, to);
      |         ^~~
a.cc: In function 'int main()':
a.cc:33:3: error: expected ',' or ';' before 'dfs'
   33 |   dfs(dfs, 0);
      |   ^~~
Language: Java

import java.util.*;

public class Main{
  static int[] ans;
  static Map<Integer, Integer> map;
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    String[] S = sc.nextLine().split(" ");
    int N = Integer.parseInt(S[0]);
    int Q = Integer.parseInt(S[1]);
    
    long[] par = new long[N+1];
    long[] ans = new long[N+1];
    
    for(int i = 0; i < N-1; i++){
      String[] T = sc.nextLine().split(" ");
      int A = Integer.parseInt(T[0]);
      int B = Integer.parseInt(T[1]);
      
      par[B] = A;
    }
    
    for(int i = 0; i < Q; i++){
      String[] T = sc.nextLine().split(" ");
      int X = Integer.parseInt(T[0]);
      int Y = Integer.parseInt(T[1]);
      ans[X] += Y;
    }
    
    for(int i = 1; i <= N; i++){
      ans[i] += ans[par[i]];
      if(i == N){
        System.out.println(ans[i]);
      }else{
        System.out.print(ans[i] + " ");
      }
    }
  }
}

Compiler output:
Main.java:31: error: incompatible types: possible lossy conversion from long to int
      ans[i] += ans[par[i]];
                       ^
1 error
Language: C++

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

int main(){
  int n, q;
  cin >> n >> q;
  vector<vector<int>> e(n);
  for(int i = 0; i < n - 1; i++){
    int a, b;
    cin >> a >> b;
    a--; b--;
    e.at(a).push_back(b); e.at(b).push_back(a);
  }
  vector<int> p(q, 0);
  for(int i = 0; i < q; i++){
    int pi, x;
    cin >> pi >> x;
    p.at(pi - 1) += x;
  }
  queue<int> que;
  que.push(0);
  vector<long int> out(n, -1);
  long int pu = 0;
  while(!que.empty()){
    int u = q.front();
    q.pop();
    out.at(i) = pu + p.at(i);
    for(int i : e.at(u)){
      if(out.at(i) != -1) continue;
      que.push(i);
    }
  }
  for(int i = 0; i < n; i++){
    cout << out.at(i) << " ";
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:15: error: request for member 'front' in 'q', which is of non-class type 'int'
   25 |     int u = q.front();
      |               ^~~~~
a.cc:26:7: error: request for member 'pop' in 'q', which is of non-class type 'int'
   26 |     q.pop();
      |       ^~~
a.cc:27:12: error: 'i' was not declared in this scope
   27 |     out.at(i) = pu + p.at(i);
      |            ^
Language: Java

import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Scanner;
class Main{


	static final int MOD = 1000000007;

	static	ArrayList<TreeNode> tree;
	static HashSet<Integer> set;
	static int[] ans;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力
		int n = sc.nextInt();
		int q = sc.nextInt();
//		tree = new ArrayList<TreeNode>();
		
//		for(int i = 0;i < n;i++){
//			TreeNode node = new TreeNode(i, 0);
//			tree.add(node);
//		}
		HashMap<Integer, Integer> map = new HashMap<>();
		
		for(int i = 0;i < n-1;i++){
			int a = sc.nextInt()-1;
			int b = sc.nextInt()-1;
//			tree.get(a).childlen.add(tree.get(b));			//子ノードの追加
//			tree.get(b).childlen.add(tree.get(a));			//子ノードの追加
			map.put(b, a);
		}
		
		long[] data = new long[n];
 		for(int i = 0;i < q;i++){
			int p = sc.nextInt()-1;
			int x = sc.nextInt();
//			tree.get(p).sum += x;
			data[p] += x;
			
		}
		

		
		System.out.println(data[0]);
 		
		for(int i = 1;i < n;i++){
			data[i] += data[map.get(i)];
			System.out.println(data[i]);
		}
		sc.close();





	}


}






Compiler output:
Main.java:10: error: cannot find symbol
	static	ArrayList<TreeNode> tree;
	      	          ^
  symbol:   class TreeNode
  location: class Main
1 error
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
using namespace std;

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[x];
    dfs(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:14:19: error: 'x' was not declared in this scope
   14 |     ans[b] += ans[x];
      |                   ^
Language: C++

#include <iostream>
#include <vector>
using namespace std;

const int maxn = 200000;
int n, m, p[maxn], add[maxn], a, b;
vector <int> v[maxn];

void dfs(int node, int pa){
    for (int i:v[node]){
        if (i != pa){
            add[i] += add[node];
            dfs(i, node);
        }
    }
}

int main() {
    cin >> n >> m;
    memset(add, 0, sizeof(add));
    for (int i = 0; i < n-1; i++){
        cin >> a >> b;
        v[a].push_back(b);
        v[b].push_back(a);
    }
    for (int i = 0; i < m; i++){
        cin >> a >> b;
        add[a] += b;
    }
    dfs(1, 0);
    for (int i = 1; i <= n; i++){
        if (i != 1) cout << " ";
        cout << add[i];
    }
    cout << "\n";
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:5: error: 'memset' was not declared in this scope
   20 |     memset(add, 0, sizeof(add));
      |     ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <vector>
  +++ |+#include <cstring>
    3 | using namespace std;
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];
    dfs(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:13: error: expected ';' before '}' token
   13 |     dfs(b,v)
      |             ^
      |             ;
   14 |   }
      |   ~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define SZ(x) ((int)(x).size())
#define debug(x) cerr << #x << ": " << x << '\n'
#define INF 999999999
typedef long long int Int;
typedef pair<int,int> P;
using ll = long long;
using VI = vector<int>;

int N,Q;
vector<vector<Int>> G(200010);
vector<Int> cost(200010);
vector<bool> visited(200010,false);

void bfs(int s){
    queue<int> que;que.push(s);
    visited[s] = true;
    while(!que.empty()){
        int v = que.front();que.pop();
        for(auto nv:G[v]){
            if(visited[nv] = false){
                que.push(nv);
                cost[nv] += cost[v];
                visited[nv] = true;
            }
        }
    }
}

int main(){
    cin >> N >> Q;
    rep(i,N-1){
        int a,b;cin >> a >> b;
        a--,b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    rep(i,Q){
        int p,x;cin >> p >> x;
        p--;
        cost[p]+=x;
    }
    bfs(0);
    rep(i,N-1) cout << cost[i] << " ";
    cout << cost[n-1] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:49:18: error: 'n' was not declared in this scope
   49 |     cout << cost[n-1] << endl;
      |                  ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
void dfs(vector<vector<int>> &G,int v,vector<long long> &ans,vector<bool> &seen){
  seen[v-1]=true;
  for(auto next : G[v-1]){
  if(seen[next-1]) continue;
    ans[next-1]+=ans[v-1];
    dfs(G,next,ans);
  }
}
int main(){
  int n,q;
  cin>>n>>q;
  vector<vector<int>> G(n,vector<int>(0));
  vector<long long> ans(n);
  vector<bool> seen(n,false);
  for(int i=0;i<n-1;i++){
    int a,b;
    cin>>a>>b;
    G[a-1].push_back(b);
  }
  for(int i=0;i<q;i++){
    int a,b;
    cin>>a>>b;
    ans[a-1]+=b;
  }
  dfs(G,1,ans,seen);
  for(int i=0;i<n;i++){
    cout<<ans[i]<<" ";
  }
  cout<<endl;
}


Compiler output:
a.cc: In function 'void dfs(std::vector<std::vector<int> >&, int, std::vector<long long int>&, std::vector<bool>&)':
a.cc:8:8: error: too few arguments to function 'void dfs(std::vector<std::vector<int> >&, int, std::vector<long long int>&, std::vector<bool>&)'
    8 |     dfs(G,next,ans);
      |     ~~~^~~~~~~~~~~~
a.cc:3:6: note: declared here
    3 | void dfs(vector<vector<int>> &G,int v,vector<long long> &ans,vector<bool> &seen){
      |      ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
void dfs(vector<vector<int>> &G,int v,vector<int> ans){
  for(auto next:G[v-1]){
    ans[next-1]+=ans[v-1];
    dfs(G,next,ans);
  }
}
int main(){
  vector<vector<int>> G(n,vector<int>(0));
  vector<int> ans(n);
  int n,q;
  cin>>n>>q;
  for(int i=0;i<n-1;i++){
    int a,b;
    cin>>a>>b;
    G[a].push_back(b);
  }
  for(int i=0;i<q;i++){
    int a,b;
    cin>>a>>b;
    ans[a]+=b;
  }
  dfs(G,0,ans);
  for(int i=0;i<n;i++){
    cout<<ans[i]<<" ";
  }
  cout<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:25: error: 'n' was not declared in this scope
   10 |   vector<vector<int>> G(n,vector<int>(0));
      |                         ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fi first
#define se second
int ki[10000000];
int sum[10000000];
vector<pair<int,int> > pi,pii;
signed main(){
  int a,b,c,e,d,f,g,h=1;
  cin>>a>>b;
  ki[1]=0;
  for(int i=0;i<a-1;i++){
    cin>>c>>e;
    pi.push_back(make_pair(min(c,e),max(c,e));
  }
  sort(pi.begin(),pi.end());
  for(int i=0;i<a-1;i++){
    ki[pi[i].se]=pi[i].fi;
  }
  for(int j=0;j<b;j++){
    cin>>d>>f;
    pii.push_back(make_pair(d,f));
  }
  sort(pii.begin(),pii.end());
  for(int i=0;i<b;i++){
    sum[pii[i].fi]+=pii[i].se;
  }
  for(int i=2;i<=a;i++){
    sum[i]+=sum[ki[i]];
  }
  for(int i=1;i<=a;i++){
    cout<<sum[i];
    if(i!=a) cout<<" ";
  }
  cout<<"\n";
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:46: error: expected ')' before ';' token
   15 |     pi.push_back(make_pair(min(c,e),max(c,e));
      |                 ~                            ^
      |                                              )
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<math.h>
using namespace std;
int n, q;
vector<vector<int>> graph;
vector<ll> ans;
 
struct leaf {
    int p;
    ll x;
};
 
int main() {
    cin >> n >> q;
    graph = vector<vector<int>>(n);
    ans = vector<int>(n, 0);
    for(int i = 0; i < n-1; ++i) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        graph.at(a).push_back(b);
    }
 
    queue<leaf> que;
 
    for(int i = 0; i < q; ++i) {
        leaf first;
        cin >> first.p >> first.x;
        first.p--;
        que.push(first);
    }
 
    while(!que.empty()) {
        leaf excute;
        excute = que.front();
        que.pop();
        ans.at(excute.p) += excute.x;
        if(graph.at(excute.p).size() != 0) {
            int len = graph.at(excute.p).size();
            for(int i = 0; i < len; ++i) {
                leaf next;
                next.p = graph.at(excute.p).at(i);
                next.x = excute.x;
                que.push(next);
            }
        }
    }
 
    for(int i = 0; i < n; ++i) {
        cout << ans.at(i) << " ";
    }
 
}

Compiler output:
a.cc:13:8: error: 'll' was not declared in this scope
   13 | vector<ll> ans;
      |        ^~
a.cc:13:10: error: template argument 1 is invalid
   13 | vector<ll> ans;
      |          ^
a.cc:13:10: error: template argument 2 is invalid
a.cc:17:5: error: 'll' does not name a type
   17 |     ll x;
      |     ^~
a.cc: In function 'int main()':
a.cc:23:11: error: cannot convert 'std::vector<int>' to 'int' in assignment
   23 |     ans = vector<int>(n, 0);
      |           ^~~~~~~~~~~~~~~~~
      |           |
      |           std::vector<int>
a.cc:35:33: error: 'struct leaf' has no member named 'x'
   35 |         cin >> first.p >> first.x;
      |                                 ^
a.cc:44:13: error: request for member 'at' in 'ans', which is of non-class type 'int'
   44 |         ans.at(excute.p) += excute.x;
      |             ^~
a.cc:44:36: error: 'struct leaf' has no member named 'x'
   44 |         ans.at(excute.p) += excute.x;
      |                                    ^
a.cc:50:22: error: 'struct leaf' has no member named 'x'
   50 |                 next.x = excute.x;
      |                      ^
a.cc:50:33: error: 'struct leaf' has no member named 'x'
   50 |                 next.x = excute.x;
      |                                 ^
a.cc:57:21: error: request for member 'at' in 'ans', which is of non-class type 'int'
   57 |         cout << ans.at(i) << " ";
      |                     ^~
Language: C++

#include <bits/stdc++.h>

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;
    }
    else{
      ans[u]+=ans[v];
    }
    dfs(u,v);
  }
}
  
int main(){
  int n,q;
  cin >> n >> q;
  for(int i=0;i<n-1;i++){
    int a,b;
    cin >> a >> b;
    --a; --b;
    to[a].push_back(b);
    to[b].push_back(a);
  }
  ans.resize(n);
  for(int i=0;i<q;i++){
    int p,x;
    cin >> p >> x;
    --p;
    ans[p]+=x;
  }
  dfs(0);
  for(int i=0;i<n;i++){
    cout << ans[i] << endl;
  }
}

Compiler output:
a.cc:6:15: error: expected ')' before ';' token
    6 | void dfs(int v;int p=-1){
      |         ~     ^
      |               )
a.cc:6:24: error: expected ',' or ';' before ')' token
    6 | void dfs(int v;int p=-1){
      |                        ^
Language: C++

#include <bits/stdc++.h>

#define rep(i, a, n)  for(ll i=a; i<n; i++)
#define per(i, a, n)  for(ll i=n-1; i>=a; i--)
#define fill0(n)  setfill('0') << right << setw(n)
#define all(x)  (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define LONGMAX 1e18
#define intMAX 1000000000
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod = 1e9+7;
int n,q;

// vector<vector<int>>graph(200200);
bool graph[200200][200200];
vector<ll>tmp(200200);
 
void dfs(int v, int p){
	 for(int i = 1; i < n+1; i++){
		 if(i == p) continue;
		 if(graph[v][i]){
			 tmp[i] += tmp[v];
			 dfs(i, v);
		 }
	 }
 }

int main(){
	cin >> n >> q;
	int a,b;
	for(int i = 1; i < n; i++){
		cin >> a >> b;
		// graph[a].push_back(b);
		graph[a][b] = true;
		graph[b][a] = true;
	}
	int p,x;
	for(int i = 0; i < q; i++){
		cin >> p >> x;
		tmp[p] += x;
	}
	dfs(1,0);
	for(int i = 1; i < n + 1; i++){
		cout << tmp[i] << " ";
	}

	return 0;
}


Compiler output:
/tmp/cc6hJTZ2.o: in function `dfs(int, int)':
a.cc:(.text+0x51): relocation truncated to fit: R_X86_64_PC32 against symbol `tmp' defined in .bss section in /tmp/cc6hJTZ2.o
a.cc:(.text+0x6b): relocation truncated to fit: R_X86_64_PC32 against symbol `tmp' defined in .bss section in /tmp/cc6hJTZ2.o
/tmp/cc6hJTZ2.o: in function `main':
a.cc:(.text+0x1a3): relocation truncated to fit: R_X86_64_PC32 against symbol `tmp' defined in .bss section in /tmp/cc6hJTZ2.o
a.cc:(.text+0x1f0): relocation truncated to fit: R_X86_64_PC32 against symbol `tmp' defined in .bss section in /tmp/cc6hJTZ2.o
/tmp/cc6hJTZ2.o: in function `__static_initialization_and_destruction_0()':
a.cc:(.text+0x25e): relocation truncated to fit: R_X86_64_PC32 against symbol `tmp' defined in .bss section in /tmp/cc6hJTZ2.o
a.cc:(.text+0x284): relocation truncated to fit: R_X86_64_PC32 against symbol `tmp' defined in .bss section in /tmp/cc6hJTZ2.o
collect2: error: ld returned 1 exit status
Language: C++

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

int count_up(vector<vector<int>> &vec, vector<int> &ans, int p, int x){
  ans.at(p) += x;
  if(vec.at(p).size()==0) return 0;
  else{
  	for(int i:vec.at(p)){
      count_up(vec, ans, i, x);
    }
    return 0;
  }
}
    
int main(){
  int n, q;
  cin >> n >> q;
  vector<vector<int>> vec(n);
  rep(i,n-1){
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    vec.at(a).push_back(b);
  }
  vector<long> ans(n);
  
  rep(i,q){
    int p, x;
    cin >> p >> x;
    p--;
    count_up(vec, ans, p, x);
  }
  
  rep(i,n){
    cout << ans.at(i) << " ";
  }

  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:19: error: invalid initialization of reference of type 'std::vector<int>&' from expression of type 'std::vector<long int>'
   33 |     count_up(vec, ans, p, x);
      |                   ^~~
a.cc:5:53: note: in passing argument 2 of 'int count_up(std::vector<std::vector<int> >&, std::vector<int>&, int, int)'
    5 | int count_up(vector<vector<int>> &vec, vector<int> &ans, int p, int x){
      |                                        ~~~~~~~~~~~~~^~~