criyle/codenet-compile-errors huggingface dataset:
Language: Java

import java.util.ArrayList;
import java.util.Scanner;

public class Main {
    ArrayList<edge> edges;
    ArrayList<ArrayList<Integer>>g_old;
    ArrayList<ArrayList<Integer>>g;
    int[] value;
    int[] map;
    int[] map2;
    public Main(int n){
        edges=new ArrayList<>();
        g_old=new ArrayList<>();
        g=new ArrayList<>();
        for(int i=0;i<n;i++){
            ArrayList<Integer> v1=new ArrayList<>();
            ArrayList<Integer> v2=new ArrayList<>();
            g.add(v1);
            g_old.add(v2);
        }
        value=new int[n];
        map=new int[n];
        map2=new int[n];
    }
    class edge{
        int from;
        int to;
        public edge(int from,int to){
            this.from=from;
            this.to=to;
        }
    }

    void addEdge(int v1,int v2){
        edge e1=new edge(v1,v2);
        edge e2=new edge(v2,v1);
        edges.add(e1);
        edges.add(e2);
        int m=edges.size();
        g_old.get(v1).add(m-2);
        g_old.get(v2).add(m-1);
    }
    void dfs(int cur){
        map2[cur]=1;
        for(int i=0;i<g_old.get(cur).size();i++){
            edge e=edges.get(g_old.get(cur).get(i));
            if(map2[e.to]==0){
                g.get(cur).add(e.to);
                dfs(e.to);
            }
        }
    }

Compiler output:
Main.java:52: error: reached end of file while parsing
    }
     ^
1 error
Language: Java



import java.util.ArrayList;
import java.util.Scanner;

public class Main {
    ArrayList<edge> edges;
    ArrayList<ArrayList<Integer>>g_old;
    ArrayList<ArrayList<Integer>>g;
    int[] value;
    int[] map;
    int[] map2;
    public D(int n){
        edges=new ArrayList<>();
        g_old=new ArrayList<>();
        g=new ArrayList<>();
        for(int i=0;i<n;i++){
            ArrayList<Integer> v1=new ArrayList<>();
            ArrayList<Integer> v2=new ArrayList<>();
            g.add(v1);
            g_old.add(v2);
        }
        value=new int[n];
        map=new int[n];
        map2=new int[n];
    }
    class edge{
        int from;
        int to;
        public edge(int from,int to){
            this.from=from;
            this.to=to;
        }
    }

    void addEdge(int v1,int v2){
        edge e1=new edge(v1,v2);
        edge e2=new edge(v2,v1);
        edges.add(e1);
        edges.add(e2);
        int m=edges.size();
        g_old.get(v1).add(m-2);
        g_old.get(v2).add(m-1);
    }
    void dfs(int cur){
        map2[cur]=1;
        for(int i=0;i<g_old.get(cur).size();i++){
            edge e=edges.get(g_old.get(cur).get(i));
            if(map2[e.to]==0){
                g.get(cur).add(e.to);
                dfs(e.to);
            }
        }
    }







    void op(int v,int value){
        map[v]=1;
        this.value[v]+=value;
        for(int i=0;i<g.get(v).size();i++){
            int e= g.get(v).get(i);
            if(map[e]==0){
                op(e,value);
            }
        }
        map[v]=0;
    }
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n,q;
        n=sc.nextInt();
        q=sc.nextInt();

        Main d=new Main(n);
        for(int i=0;i<n-1;i++){
            int a,b;
            a=sc.nextInt()-1;
            b=sc.nextInt()-1;
            d.addEdge(a,b);
        }
        d.dfs(0);
        for(int i=0;i<q;i++){
            int v,val;
            v=sc.nextInt()-1;
            val=sc.nextInt();
            d.op(v,val);
        }
        for(int i=0;i<n;i++){
            System.out.println(d.value[i]);
        }
    }
}


Compiler output:
Main.java:13: error: invalid method declaration; return type required
    public D(int n){
           ^
1 error
Language: C++

//code by lynmisakura.wish to be accepted
/****************************/
#include<iostream>
#include<math.h>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
#include<algorithm>
#include<bitset>
#include <climits>
#include<set>
#include<bitset>
using namespace std;
/***************************/
typedef long long ll;
typedef pair<int,int> pi;
typedef vector<pair<int,int>> vpi;

const long long Mod = 998244353;
const long long mod = 1000000007;
const long long INF = 10000000000000;

#define itn int
#define endl "\n"
#define pb push_back
#define mp make_pair
#define mins(x,y) x = min(x,y)
#define maxs(x,y) x = max(x,y)
#define all(x) (x).begin(),(x).end()
#define Rep(n) for(int i = 0;i < n;i++)
#define rep(i,n) for(int i = 0;i < n;i++)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll qp(ll a, ll b) { int ans = 1; do { if (b & 1)ans = 1ll * ans*a; a = 1ll * a*a; } while (b >>= 1); return ans; }
ll qp(ll a, ll b, int mo) { int ans = 1; do { if (b & 1)ans = 1ll * ans*a%mo; a = 1ll * a*a%mo; } while (b >>= 1); return ans; }

#define _GLIBCXX_DEBUG
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

#define MAX_N 200020
int par[MAX_N];
int main(void){
	
	int n,qe; scnaf("%d%d",&n,&qe);
	vector<vector<int>> T(n,vector<int>(0));
	rep(i,n-1){
		int a,b;scanf("%lld%lld",&a,&b);
		a--,b--;
		T[a].pb(b);T[b].pb(a);
	}
	vector<int> parent(n,-1);
	vector<ll> p(n,0LL);
	rep(i,qe){
		ll a,x;scanf("%lld%lld",&a,&x);
		a--;
		p[a] += x;
	}
	
	
	vector<ll> ans(n,0LL);
	
	
	queue<int> q;
	q.push(0);
	vector<int> check(n,0);
	check[0] = 1;
	q.push(0);
	parent[0] = 0;
	ans[0] = p[0];
	while(!q.empty()){
		int x = q.front(); q.pop();
		check[x] = 1;
		for(int i = 0;i < T[x].size();i++){
			if(check[T[x][i]] == 0){
				q.push(T[x][i]);
				ans[T[x][i]] = ans[x] + p[T[x][i]];
			}
		}
	}
	//rep(i,n) debug(p[i]);
	rep(i,n) printf("lld\n",ans[i]);
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:47:19: error: 'scnaf' was not declared in this scope; did you mean 'scanf'?
   47 |         int n,qe; scnaf("%d%d",&n,&qe);
      |                   ^~~~~
      |                   scanf
Language: C++

//code by lynmisakura.wish to be accepted
/****************************/
#include<iostream>
#include<math.h>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
#include<algorithm>
#include<bitset>
#include <climits>
#include<set>
#include<bitset>
using namespace std;
/***************************/
typedef long long ll;
typedef pair<int,int> pi;
typedef vector<pair<int,int>> vpi;

const long long Mod = 998244353;
const long long mod = 1000000007;
const long long INF = 10000000000000;

#define itn int
#define endl "\n"
#define pb push_back
#define mp make_pair
#define mins(x,y) x = min(x,y)
#define maxs(x,y) x = max(x,y)
#define all(x) (x).begin(),(x).end()
#define Rep(n) for(int i = 0;i < n;i++)
#define rep(i,n) for(int i = 0;i < n;i++)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll qp(ll a, ll b) { int ans = 1; do { if (b & 1)ans = 1ll * ans*a; a = 1ll * a*a; } while (b >>= 1); return ans; }
ll qp(ll a, ll b, int mo) { int ans = 1; do { if (b & 1)ans = 1ll * ans*a%mo; a = 1ll * a*a%mo; } while (b >>= 1); return ans; }

#define _GLIBCXX_DEBUG
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

#define MAX_N 200020
int par[MAX_N];
int main(void){
	
	int n,qe; scnaf("%d%d",&n,&qe);
	vector<vector<int>> T(n,vector<int>(0));
	rep(i,n-1){
		int a,b;scanf("%lld%lld".&a,&b);
		a--,b--;
		T[a].pb(b);T[b].pb(a);
	}
	vector<int> parent(n,-1);
	vector<ll> p(n,0LL);
	rep(i,qe){
		ll a,x;scanf("%lld%lld",&a,&x);
		a--;
		p[a] += x;
	}
	
	
	vector<ll> ans(n,0LL);
	
	
	queue<int> q;
	q.push(0);
	vector<int> check(n,0);
	check[0] = 1;
	q.push(0);
	parent[0] = 0;
	ans[0] = p[0];
	while(!q.empty()){
		int x = q.front(); q.pop();
		check[x] = 1;
		for(int i = 0;i < T[x].size();i++){
			if(check[T[x][i]] == 0){
				q.push(T[x][i]);
				ans[T[x][i]] = ans[x] + p[T[x][i]];
			}
		}
	}
	//rep(i,n) debug(p[i]);
	rep(i,n) printf("lld\n",ans[i]);
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:47:19: error: 'scnaf' was not declared in this scope; did you mean 'scanf'?
   47 |         int n,qe; scnaf("%d%d",&n,&qe);
      |                   ^~~~~
      |                   scanf
a.cc:50:42: error: expected unqualified-id before '&' token
   50 |                 int a,b;scanf("%lld%lld".&a,&b);
      |                                          ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define int long long
vector<pair<int,int> > a;
int b,c,w,q[100000],e,l=0;
int z[1000000]={};
  signed main(){
  cin>>b>>c;
  for(int i=0;i<b-1;i++){
    cin>>w>>e;
    a.push_back(make_pair(w,e));
    l=max(l,e);
  }
  for(int i=0;i<c;i++){
    cin>>w>>e;
    q[w-1]=q[w-1]+e;
  }
  z[0]=q[0];
  for(int i=0;i<b-1;i++){
    // cout<<"z[a[i]] 1 \n"<<q[a[i].second-1]<<"\n z[a[i] 2 \n"<<q[a[i].first-1]<<"\n";
    // cout<<"second first "<<a[i].second<<" "<<a[i].first<<"\n";
    z[a[i].second-1]=q[a[i].second-1]+q[a[i].first-1]+z[a[i].second-1];
    q[a[i].second-1]=z[a[i].second-1];
    //   cout<<"z[a[i] "<<z[a[i].second-1]<<"\n";
  }
  for(int i=0;i<b-1;i++){
    if(z[a[i].second-1]==0){
      z[a[i].second-1]=z[a[i].first-1];
    }
  }
  //  cout<<a[b-2].second<<"\n";

  for(int i=0;i<l;i++){
    cout<<z[i];
    if(i!=l-1) cout<<" ";
  }
  cout<<"\n";]
  return(0);
}
	


Compiler output:
a.cc: In function 'int main()':
a.cc:37:14: error: expected primary-expression before ']' token
   37 |   cout<<"\n";]
      |              ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define int long long
vector<pair<int,int> > a;
int b,c,w,q[100000],e;
int z[1000000]={}
  signed main(){
  cin>>b>>c;
  for(int i=0;i<b-1;i++){
    cin>>w>>e;
    a.push_back(make_pair(w,e));
  }
  for(int i=0;i<c;i++){
    cin>>w>>e;
    q[w-1]=q[w-1]+e;
  }
  z[0]=q[0];
  for(int i=0;i<b-1;i++){
    // cout<<"z[a[i]] 1 \n"<<q[a[i].second-1]<<"\n z[a[i] 2 \n"<<q[a[i].first-1]<<"\n";
    // cout<<"second first "<<a[i].second<<" "<<a[i].first<<"\n";
    z[a[i].second-1]=q[a[i].second-1]+q[a[i].first-1]+z[a[i].second-1];
    q[a[i].second-1]=z[a[i].second-1];
    //   cout<<"z[a[i] "<<z[a[i].second-1]<<"\n";
  }
  for(int i=0;i<b-1;i++){
    if(z[a[i].second-1]==0){
      z[a[i].second-1]=z[a[i].first-1];
    }
  }
  //  cout<<a[b-2].second<<"\n";

  for(int i=0;i<a[b-2].second;i++){
    cout<<z[i];
    if(i!=a[b-2].second-1) cout<<" ";
  }
  cout<<"\n";
}

Compiler output:
a.cc:7:3: error: expected ',' or ';' before 'signed'
    7 |   signed main(){
      |   ^~~~~~
Language: C++

//#define _GLIBCXX_DEBUG
#include <iostream>
#include <bits/stdc++.h>


using namespace std;
#define ll long long
#define ld long double
#define  P pair<ll,ll>
#define FOR(i,n,m) for(ll i=n; i<(ll)m;i++)
#define FORr(i,m,n) for(ll i=n; i>=(ll)m; i--)
#define FORm(i,m) for(auto i=m.begin();i!=m.end();i++)
#define sortAl(v) sort(v.begin(),v.end())
#define sortAlr(v) sort(v.begin(),v.end()); reverse(v.begin(),v.end())
#define cout(n) cout<<fixed<<setprecision(n)

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll n,q;
    cin>>n>>q;
    vector<vector<ll>> g(n+1);
    FOR(i,1,n){
      ll in,in1;
      cin>>in>>in1;
      g[in].push_back(in1);
    }

    vector<ll> ans(n+1);
    FOR(i,0,q){
      ll in,in2;
      cin>>in>>in2;
      ans[in]+=in2;
    }
    stack<ll> que;
    que.push(1);
    while(!que.empty()){
      ll src = que.back();
      que.pop();
      FOR(i,0,g[src].size()){
        ll to = g[src][i];
        ans[to] += ans[src];
        que.back(to);
      }
    }

    FOR(i,1,n+1){
      cout<<ans[i];
      if(i != n)cout<<" ";
      else cout<<endl;
    }

}


Compiler output:
a.cc: In function 'int main()':
a.cc:39:20: error: 'class std::stack<long long int>' has no member named 'back'
   39 |       ll src = que.back();
      |                    ^~~~
a.cc:44:13: error: 'class std::stack<long long int>' has no member named 'back'
   44 |         que.back(to);
      |             ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int a[1000000];
int ans[1000000];


int main()
{
    long long n,q,i,a,b;
    cin>>n>>q;
    arr[1]=1;
    for(i=0; i<n-1; i++)
    {
        cin>>a>>b;
        arr[b]=a;

    }
    for(i=0; i<q; i++)
    {
        cin>>a>>b;
        ans[a] = ans[a]+b;
    }
    for(i=2; i<=n; i++)
    {
        ans[i]=ans[i]+ans[arr[i]];
    }
    for(i=1; i<=n; i++)
    {
        cout<<ans[i]<<" ";
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:5: error: 'arr' was not declared in this scope
   11 |     arr[1]=1;
      |     ^~~
Language: C++

#include <iostream>
#include <iomanip>
#include <queue>
#include <deque>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <bitset>

#define REP(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define FILL(x, y) memset(x, y, sizeof(x))
#define pb push_back
#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define eprintf(...) 42
#endif

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

using namespace std;
using ll = long long;

const int kInf = 2e9;
const ll kLInf = 2e18;

int gcd (int a, int b) {
   return b ? gcd(b, a % b) : a;
}
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int N,Q;
bool tree[200010][200010];
int cnt[200010];
void REC(int node, int parent);
int main()
{
   cout << fixed << setprecision(10);
   cin >> N >> Q;
   int a,b;
   REP(i, N-1) {
      cin >> a >> b;
      tree[a-1][b-1] = 1;
   }
   REP(i, Q) {
      cin >> a >> b;
      cnt[a-1] += b;
   }
   REC(0, -1);
   REP(i, N) cout << cnt[i] << " ";
   cout << endl;
   return 0;
}

void REC(int node, int parent)
{
   eprintf("in REC(%d, %d)\n", node, parent);
   REP(i, N) {
      if (i == parent) continue;
      if (tree[node][i]) {
         cnt[i] += cnt[node];
         REC(i, node);
      }
   }
}


Compiler output:
/tmp/cc5YBq2K.o: in function `main':
a.cc:(.text+0x153): relocation truncated to fit: R_X86_64_PC32 against symbol `cnt' defined in .bss section in /tmp/cc5YBq2K.o
a.cc:(.text+0x174): relocation truncated to fit: R_X86_64_PC32 against symbol `cnt' defined in .bss section in /tmp/cc5YBq2K.o
a.cc:(.text+0x1b8): relocation truncated to fit: R_X86_64_PC32 against symbol `cnt' defined in .bss section in /tmp/cc5YBq2K.o
/tmp/cc5YBq2K.o: in function `REC(int, int)':
a.cc:(.text+0x276): relocation truncated to fit: R_X86_64_PC32 against symbol `cnt' defined in .bss section in /tmp/cc5YBq2K.o
a.cc:(.text+0x28d): relocation truncated to fit: R_X86_64_PC32 against symbol `cnt' defined in .bss section in /tmp/cc5YBq2K.o
a.cc:(.text+0x2a7): relocation truncated to fit: R_X86_64_PC32 against symbol `cnt' defined in .bss section in /tmp/cc5YBq2K.o
collect2: error: ld returned 1 exit status
Language: C++

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

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using Graph = vector<vector<int>>;
/* 4方向への隣接頂点への移動を表すベクトル */
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

const long long INF = 1LL << 60;
const int maxi = 1e6+10;

vector<int> value;
Graph G;
// d: 頂点 v の深さ
void dfs(const Graph &G,int now, int parent,int score) {
    value[now] += score;
    // for(auto nv : G[now]) {
    //     if (nv == parent) continue; 
    //     dfs(G,nv,now, value[now]);
    // }
    for (int i = 0; i < G[now].size(); i++) {
    if (G[now][i] == parent) continue;
    dfs(G[now][i], now, value[now]);
  }


}

int main(){
    // 頂点数と辺数
    int N, Q; 
    cin >> N >> Q;

    G.resize(N);
    for(int i = 0; i < N - 1; i++){
        int a, b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
        G[b].push_back(a);

    }
    for(int i = 0; i < Q; i++){
        int u, x;
        cin >> u >> x;
        u--;
        value[u] += x;
    }

    dfs(G,0,-1,0);

    for(int i = 0; i < N; i++){
        cout << value[i] << " ";
    }
    cout << endl;

}

Compiler output:
a.cc: In function 'void dfs(const Graph&, int, int, int)':
a.cc:25:8: error: invalid initialization of reference of type 'const Graph&' {aka 'const std::vector<std::vector<int> >&'} from expression of type 'const __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'const int'}
   25 |     dfs(G[now][i], now, value[now]);
      |     ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:17:23: note: in passing argument 1 of 'void dfs(const Graph&, int, int, int)'
   17 | void dfs(const Graph &G,int now, int parent,int score) {
      |          ~~~~~~~~~~~~~^
Language: C++

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

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using Graph = vector<vector<int>>;
/* 4方向への隣接頂点への移動を表すベクトル */
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

const long long INF = 1LL << 60;
const int maxi = 1e6+10;

vector<int> value;
Graph G;
// d: 頂点 v の深さ
void dfs(const Graph &G,int now, int parent,int score) {
    value[now] += score;
    // for(auto nv : G[now]) {
    //     if (nv == parent) continue; 
    //     dfs(G,nv,now, value[now]);
    // }
    for (int i = 0, i < G[now].size(); i++) {
    if (G[now][i] == parent) continue;
    dfs(G[now][i], now, value[now]);
  }


}

int main(){
    // 頂点数と辺数
    int N, Q; 
    cin >> N >> Q;

    G.resize(N);
    for(int i = 0; i < N - 1; i++){
        int a, b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
        G[b].push_back(a);

    }
    for(int i = 0; i < Q; i++){
        int u, x;
        cin >> u >> x;
        u--;
        value[u] += x;
    }

    dfs(G,0,-1,0);

    for(int i = 0; i < N; i++){
        cout << value[i] << " ";
    }
    cout << endl;

}

Compiler output:
a.cc: In function 'void dfs(const Graph&, int, int, int)':
a.cc:23:22: error: expected ';' before '<' token
   23 |     for (int i = 0, i < G[now].size(); i++) {
      |                      ^~
      |                      ;
a.cc:23:23: error: expected primary-expression before '<' token
   23 |     for (int i = 0, i < G[now].size(); i++) {
      |                       ^
a.cc:25:8: error: invalid initialization of reference of type 'const Graph&' {aka 'const std::vector<std::vector<int> >&'} from expression of type 'const __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'const int'}
   25 |     dfs(G[now][i], now, value[now]);
      |     ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:17:23: note: in passing argument 1 of 'void dfs(const Graph&, int, int, int)'
   17 | void dfs(const Graph &G,int now, int parent,int score) {
      |          ~~~~~~~~~~~~~^
Language: C++

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

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using G = vector<vector<int>>;
/* 4方向への隣接頂点への移動を表すベクトル */
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

const long long INF = 1LL << 60;
const int maxi = 1e6+10;

vector<int> value;
// d: 頂点 v の深さ
void dfs(const Graph &G,int now, int parent,int score) {
    value[now] += score;
    for(auto nv : G[now]) {
        if (nv == parent) continue; 
        dfs(G,nv,now, value[now]);
    }
}

int main(){
    // 頂点数と辺数
    int N, Q; 
    cin >> N >> Q;

    G.resize(N);
    for(int i = 0; i < N - 1; i++){
        int a, b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
        G[b].push_back(a);

    }
    for(int i = 0; i < Q; i++){
        int u, x;
        cin >> u >> x;
        u--;
        value[u] += x;
    }

    dfs(G,0,-1,0);

    for(int i = 0; i < N; i++){
        cout << value[i] << " ";
    }
    cout << endl;

}

Compiler output:
a.cc:16:16: error: 'Graph' does not name a type
   16 | void dfs(const Graph &G,int now, int parent,int score) {
      |                ^~~~~
a.cc: In function 'void dfs(const int&, int, int, int)':
a.cc:18:20: error: invalid types 'const int[int]' for array subscript
   18 |     for(auto nv : G[now]) {
      |                    ^
a.cc: In function 'int main()':
a.cc:29:6: error: expected unqualified-id before '.' token
   29 |     G.resize(N);
      |      ^
a.cc:34:10: error: structured binding declaration cannot have type 'G' {aka 'std::vector<std::vector<int> >'}
   34 |         G[a].push_back(b);
      |          ^~~
a.cc:34:10: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:34:11: error: conflicting declaration 'auto a'
   34 |         G[a].push_back(b);
      |           ^
a.cc:31:13: note: previous declaration as 'int a'
   31 |         int a, b;
      |             ^
a.cc:34:13: error: expected initializer before '.' token
   34 |         G[a].push_back(b);
      |             ^
a.cc:35:10: error: structured binding declaration cannot have type 'G' {aka 'std::vector<std::vector<int> >'}
   35 |         G[b].push_back(a);
      |          ^~~
a.cc:35:10: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:35:11: error: conflicting declaration 'auto b'
   35 |         G[b].push_back(a);
      |           ^
a.cc:31:16: note: previous declaration as 'int b'
   31 |         int a, b;
      |                ^
a.cc:35:13: error: expected initializer before '.' token
   35 |         G[b].push_back(a);
      |             ^
a.cc:45:10: error: expected primary-expression before ',' token
   45 |     dfs(G,0,-1,0);
      |          ^
Language: C++

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

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using Graph = vector<vector<int>>;
/* 4方向への隣接頂点への移動を表すベクトル */
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

const long long INF = 1LL << 60;
const int maxi = 1e6+10;

vector<int> value;
// d: 頂点 v の深さ
void dfs(const Graph &G,int now, int parent,int score) {
    value[now] += score;
    for(auto nv : G[now]) {
        if (nv == parent) continue; 
        dfs(G,nv,now, value[now]);
    }
}

int main(){
    // 頂点数と辺数
    int N, Q; 
    cin >> N >> Q;

    G.resize(N);
    for(int i = 0; i < N - 1; i++){
        int a, b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
        G[b].push_back(a);

    }
    for(int i = 0; i < Q; i++){
        int u, x;
        cin >> u >> x;
        u--;
        value[u] += x;
    }

    dfs(G,0,-1,0);

    for(int i = 0; i < N; i++){
        cout << value[i] << " ";
    }
    cout << endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:5: error: 'G' was not declared in this scope
   29 |     G.resize(N);
      |     ^
Language: C++

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

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using Graph = vector<vector<int>>;
/* 4方向への隣接頂点への移動を表すベクトル */
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

const long long INF = 1LL << 60;
const int maxi = 1e6+10;

vector<int> value;
// d: 頂点 v の深さ
void dfs(const Graph &G,int now, int parent,int score) {
    value[now] += score;
    for(auto nv : G[now]) {
        if (nv == v) continue; 
        dfs(G,nv,now, value[now]);
    }
}

int main(){
    // 頂点数と辺数
    int N, Q; 
    cin >> N >> Q;

    G.resize(N);
    for(int i = 0; i < N - 1; i++){
        int a, b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
        G[b].push_back(a);

    }
    for(int i = 0; i < Q; i++){
        int u, x;
        cin >> u >> x;
        u--;
        value[u] += x;
    }

    dfs(G,0,-1,0);

    for(int i = 0; i < N; i++){
        cout << value[i] << " ";
    }
    cout << endl;

}

Compiler output:
a.cc: In function 'void dfs(const Graph&, int, int, int)':
a.cc:19:19: error: 'v' was not declared in this scope; did you mean 'nv'?
   19 |         if (nv == v) continue;
      |                   ^
      |                   nv
a.cc: In function 'int main()':
a.cc:29:5: error: 'G' was not declared in this scope
   29 |     G.resize(N);
      |     ^
Language: C++

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

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using Graph = vector<vector<int>>;
/* 4方向への隣接頂点への移動を表すベクトル */
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

const long long INF = 1LL << 60;
const int maxi = 1e6+10;

vector<int> value;
// d: 頂点 v の深さ
void dfs(const Graph &G,int now, int parent,int score) {
    value[now] += score;
    for(auto nv : G[v]) {
        if (nv == v) continue; 
        dfs(G,nv,now, value[now]);
    }
}

int main(){
    // 頂点数と辺数
    int N, Q; 
    cin >> N >> Q;

    G.resize(N);
    for(int i = 0; i < N - 1; i++){
        int a, b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
        G[b].push_back(a);

    }
    for(int i = 0; i < Q; i++){
        cin >> u >> x;
        u--;
        value[u] += x;
    }

    dfs(G,0,-1,0);

    for(int i = 0; i < N; i++){
        cout << value[i] << " ";
    }
    cout << endl;

}

Compiler output:
a.cc: In function 'void dfs(const Graph&, int, int, int)':
a.cc:18:21: error: 'v' was not declared in this scope; did you mean 'nv'?
   18 |     for(auto nv : G[v]) {
      |                     ^
      |                     nv
a.cc: In function 'int main()':
a.cc:29:5: error: 'G' was not declared in this scope
   29 |     G.resize(N);
      |     ^
a.cc:39:16: error: 'u' was not declared in this scope
   39 |         cin >> u >> x;
      |                ^
a.cc:39:21: error: 'x' was not declared in this scope
   39 |         cin >> u >> x;
      |                     ^
Language: Java

import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
    
		// 整数の入力
		int n = sc.nextInt();
		int q = sc.nextInt();
        Parent[] parents = new Parent[n];
        parents[n - 1] = new Parent(n);
        int index = 0;
        for(int i = 0; i < n - 1; i++) {
          parents[i] = new Parent(i + 1);
          int value = sc.nextInt();
          parents[value - 1].addChild(sc.nextInt());
        }
        for(int i = 0; i < q; i++) {
          int parentNo = sc.nextInt();
          int score = sc.nextInt();
          Parent parent = parents[parentNo - 1];
          parents = parent.addCount(score, parents);
        }
        for(Parent parent : parents) {
          	// 出力
			System.out.println(parent.count);
        }
	}
  
  private static class Parent {
    public int count = 0;
    public int parent;
    public ArrayList<Integer> childs = new ArrayList<>();
    public Parent(int value) {
      this.parent = value;
    }
    public void addChild(int value) {
      childs.add(value);
    }
    public Parent[] addCount(int value, Parent[] parents) {
      parents[parent - 1].count += value;
      Parent[] master = parents;
      for (int child : childs) {
         matster = parents[child - 1].addCount(value, master);
      }
      return master;
    }
  }
}

Compiler output:
Main.java:43: error: cannot find symbol
         matster = parents[child - 1].addCount(value, master);
         ^
  symbol:   variable matster
  location: class Parent
1 error
Language: Java

import sys
from operator import itemgetter

n,q = [ int(x) for x in sys.stdin.readline().strip().split() ]
edge= [ [] for _ in range(n-1) ]
for i in range(n-1):
    edge[i] = [ int(x)-1 for x in sys.stdin.readline().strip().split() ]
edge.sort( key=itemgetter(0) )
c= [ 0 for _ in range(n) ]
for i in range(q):
    p,x= [ int(x) for x in sys.stdin.readline().strip().split() ]
    c[p-1]+= x
#
for a,b in edge: c[b]+= c[a]

print( *c )

Compiler output:
Main.java:1: error: '.' expected
import sys
          ^
Main.java:2: error: ';' expected
from operator import itemgetter
    ^
Main.java:2: error: '.' expected
from operator import itemgetter
                               ^
Main.java:4: error: ';' expected
n,q = [ int(x) for x in sys.stdin.readline().strip().split() ]
 ^
Main.java:13: error: illegal character: '#'
#
^
5 errors
Language: Java

import java.util.*;
import java.io.*;

public class Main {
    static Scanner sc = new Scanner();

    static List<List<Integer>> tree;
    static int[] score;
	public static void main(String[] args) {
        // Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int q = sc.nextInt();
        tree = new ArrayList<>();
        int max = 0;
        for (int i = 0; i < n; i++) {
            tree.add(new ArrayList<>());
        }
        for (int i = 0; i < n-1; i++) {
            int a = sc.nextInt()-1;
            int b = sc.nextInt()-1;
            tree.get(a).add(b);
        }
        score = new int[n];
        for (int i = 0; i < q; i++) {
            int p = sc.nextInt()-1;
            int x = sc.nextInt();
            score[p] += x;
        }
        dfs(0);
        for (int i = 0; i < n; i++) {
            System.out.print(score[i]);
            System.out.print(' ');
        }
    }
    static void dfs(int v) {
        for (int i : tree.get(v)) {
            score[i] += score[v];
            dfs(i);
        }
    }

    static class Scanner {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);
        StringTokenizer tokenizer;
 
        String next() throws IOException {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                tokenizer = new StringTokenizer(reader.readLine());
            }
            return tokenizer.nextToken();
        }
 
        int nextInt() throws IOException {
            return Integer.parseInt(next());
        }
 
        long nextLong() throws IOException {
            return Long.parseLong(next());
        }
    }
}

}



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

#include<stdio.h>


int main(){
  int n;
  int q;
  int i;
  int j;
  int a[200000];
  int b[200000]:
  int p[200000];
  int x[200000];
  int ans[200000]=0;
  
  scanf("%d %d",&n,&q);
  for(i=1;i<n;i++){
    scanf("%d %d",&a[i],&b[i]);
  }
  for(j=1;j<=n;j++){
    scanf("%d %d",&p[j],&x[j]);
    for(int k=0;k<n;k++){
      if(a[k]==p[j]){
        
      }
      ans[i]+=x[j];
  }
  
  
    
  for(i=1;i<=n;i++){
    scanf("%d",ans[i]);
  }
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:10:16: error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token
   10 |   int b[200000]:
      |                ^
main.c:10:16: error: expected expression before ':' token
main.c:13:19: error: invalid initializer
   13 |   int ans[200000]=0;
      |                   ^
main.c:17:26: error: 'b' undeclared (first use in this function)
   17 |     scanf("%d %d",&a[i],&b[i]);
      |                          ^
main.c:17:26: note: each undeclared identifier is reported only once for each function it appears in
main.c:20:20: error: 'p' undeclared (first use in this function)
   20 |     scanf("%d %d",&p[j],&x[j]);
      |                    ^
main.c:34:1: error: expected declaration or statement at end of input
   34 | }
      | ^
Language: C++

#include <bits/stdc++.h>

#define rep(i, n) for(int i=0; i<n; ++i)

using namespace std;
typedef long long ll; 

int main(void){
	
	int N, Q;
	cin >> N >> Q;
  
	vector<pair<int,int>> ab(N-1);
	vector<int> ans(N);
	rep(i, N-1)
		cin >> ab[i].first >> ab[i].second;
 
	sort(ab.begin(), ab.end());
  
	rep(i, Q){
		int a, b;
		cin >> p >> x;
		ans[i] += x;
	}
  
	rep(i, N-1)
		ans[ab[i].second-1] += ans[ab[i].first-1];
  
	for(int i=0;i<N;i++)
		cout << ans[i] << " ";
	
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:24: error: 'p' was not declared in this scope
   22 |                 cin >> p >> x;
      |                        ^
a.cc:22:29: error: 'x' was not declared in this scope
   22 |                 cin >> p >> x;
      |                             ^
Language: Java

import java.util.ArrayList;
import java.util.Scanner;




//D
public class Main {

	static int N;
	static int Q;
	static IntList[] v;
	static int[] ans;
	static int[] parent;
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);

		N=sc.nextInt();
		Q=sc.nextInt();
		v=new ArrayList[N+1];
		ans=new int[N+1];
		parent=new int[N+1];
		for(int i=1;i<=N;i++) {
			v[i]=new IntList(8);
		}
		for(int i=1;i<=N-1;i++) {
			int a=sc.nextInt();
			int b=sc.nextInt();
			v[a].add(b);
			parent[b]=a;

		}

		for(int i=0;i<Q;i++) {
			int p=sc.nextInt();
			int q=sc.nextInt();
			ans[p]+=q;
		}


		for(int i=2;i<=N;i++) {

			int pi=parent[i];
			// System.err.println("i pi "+i+" "+pi);

			if(pi!=0) {ans[i]+=ans[pi];}

		}

		for(int i=1;i<=N;i++) {
			System.out.print(ans[i]+" ");
		}
		System.out.println();
	}
}

class IntList{
    private int[] array;
    private int size = 0;
    public IntList() {
        array = new int[256];
    }

    public IntList(int size) {
        array = new int[size];
    }

    public void add(int a) {
        if(size == array.length) {
            int newSize = Math.min(Integer.MAX_VALUE, size*2);
            array = Arrays.copyOf(array, newSize);
        }
        array[size++] = a;
    }

    public void addAll(IntList list) {
        for (int i = 0; i < list.size(); i++) {
            this.add(list.get(i));
        }
        // TODO convert to copyOf
//        int[] a = list.getArray();
//        int numNew = a.length;
//        if(size + numNew > array.length) {
//            int length = array.length;
//            while (size + numNew < length) {
//                length *= 2;
//            }
//            array = Arrays.copyOf(array, length);
//        }
//        System.arraycopy(a, 0, array, size, numNew);
//        size += numNew;
    }

    public int get(int i) {
        if(i >= size) {
            throw new ArrayIndexOutOfBoundsException(String.format("size=%d, i=%d", i, size));
        }
        return array[i];
    }

    public int size(){
        return size;
    }

    public int[] getArray() {
        return array;
    }
}

Compiler output:
Main.java:21: error: incompatible types: ArrayList[] cannot be converted to IntList[]
		v=new ArrayList[N+1];
		  ^
Main.java:72: error: cannot find symbol
            array = Arrays.copyOf(array, newSize);
                    ^
  symbol:   variable Arrays
  location: class IntList
2 errors
Language: Java


import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner scan = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int q = Integer.parseInt(sc.next());
        Tree tree[] = new Tree[n+1];
        for(int i=0; i<n+1; i++) {
            tree[i] = new Tree();
            tree[i].value = 0;
            tree[i].tree = new Tree();
        }

        for(int i=0; i<n-1; i++) {
            int a = Integer.parseInt(sc.next());
            int b = Integer.parseInt(sc.next());
            tree[b].tree = tree[a];
        }

        for(int i=0; i<q; i++) {
            int p = Integer.parseInt(sc.next());
            int x = Integer.parseInt(sc.next());
            tree[p].value += x;
        }

        for(int i=0; i<n; i++) {
            if (tree[i+1].tree != null)
                tree[i+1].value += tree[i+1].tree.value;
            System.out.print(tree[i+1].value);
            if(i+1 < n)
                System.out.print(" ");
            else
                System.out.println();
        }
    }
}

class Tree {
    int value = 0;
    Tree tree;

    public Tree(){}
}


Compiler output:
Main.java:9: error: cannot find symbol
        int n = Integer.parseInt(sc.next());
                                 ^
  symbol:   variable sc
  location: class Main
Main.java:10: error: cannot find symbol
        int q = Integer.parseInt(sc.next());
                                 ^
  symbol:   variable sc
  location: class Main
Main.java:19: error: cannot find symbol
            int a = Integer.parseInt(sc.next());
                                     ^
  symbol:   variable sc
  location: class Main
Main.java:20: error: cannot find symbol
            int b = Integer.parseInt(sc.next());
                                     ^
  symbol:   variable sc
  location: class Main
Main.java:25: error: cannot find symbol
            int p = Integer.parseInt(sc.next());
                                     ^
  symbol:   variable sc
  location: class Main
Main.java:26: error: cannot find symbol
            int x = Integer.parseInt(sc.next());
                                     ^
  symbol:   variable sc
  location: class Main
6 errors
Language: C++

#include <iostream>
#include <string>
#include <cstring>
#include <set>
#include <queue>
#include <stack>

using namespace std;

#define maxN 200000

char edge[maxN][maxN];
int point[maxN];
int N, Q;

int make_tree(int n){
  for(int i=0;i<N; i++){
    if(edge[n][i] == 1){
      edge[i][n] = 0;
      make_tree(i);
    }
  }
  return 0;
}

int get_point(int n, int x){
  point[n] += x;
  for(int i=0;i<N; i++){
    if(edge[n][i] == 1){
      get_point(i,x);
    }
  }
  return 0;
}

int main(){

  cin >> N >> Q;
  memset(point, 0, sizeof(int)*N);
  memset(edge, 0, sizeof(int)*N);

  for(int i=0; i<N-1;i++){
    int a, b;
    cin >> a >> b;
    edge[a-1][b-1] = 1;
    edge[b-1][a-1] = 1;
  }

  make_tree(0);

  for(int i=0; i<Q;i++){
    int a;
    int b;
    cin >> a >> b;
    get_point(a-1,b);
  }

  for(int i=0; i<N; i++){
    cout << point[i] << " ";
  }
  cout << endl;

  return 0;
}


Compiler output:
/tmp/cc3GLspd.o: in function `make_tree(int)':
a.cc:(.text+0x6c): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/cc3GLspd.o
/tmp/cc3GLspd.o: in function `get_point(int, int)':
a.cc:(.text+0x9a): relocation truncated to fit: R_X86_64_PC32 against symbol `point' defined in .bss section in /tmp/cc3GLspd.o
a.cc:(.text+0xb7): relocation truncated to fit: R_X86_64_PC32 against symbol `point' defined in .bss section in /tmp/cc3GLspd.o
a.cc:(.text+0x102): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/cc3GLspd.o
/tmp/cc3GLspd.o: in function `main':
a.cc:(.text+0x11d): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/cc3GLspd.o
a.cc:(.text+0x139): relocation truncated to fit: R_X86_64_PC32 against symbol `Q' defined in .bss section in /tmp/cc3GLspd.o
a.cc:(.text+0x14a): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/cc3GLspd.o
a.cc:(.text+0x15f): relocation truncated to fit: R_X86_64_PC32 against symbol `point' defined in .bss section in /tmp/cc3GLspd.o
a.cc:(.text+0x16d): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/cc3GLspd.o
a.cc:(.text+0x215): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/cc3GLspd.o
a.cc:(.text+0x278): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: Java

import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Deque;
import java.util.Scanner;
public class Main {
	public static void main(String[] args)throws Exception{
		Scanner stdIn=new Scanner(System.in);
		int N=stdIn.nextInt();
		int Q=stdIn.nextInt();
		int ans[]=new int[N];
		ArrayList<ArrayList<Integer>> tree=new ArrayList<ArrayList<Integer>>();
		Deque<Integer> s1=new ArrayDeque<Integer>();
		Deque<Integer> s2=new ArrayDeque<Integer>();
		for(int i=0;i<N;i++){
			ArrayList<Integer> a=new ArrayList<Integer>();
			tree.add(a);
		}
		for(int i=0;i<N-1;i++){
			int a=stdIn.nextInt()-1;
			int b=stdIn.nextInt()-1;
			ArrayList<Integer> c=new ArrayList<Integer>();
			c=tree.get(a);
			c.add(b);
			tree.set(a,c);
			c=tree.get(b);
			c.add(a);
			tree.set(b,c);
		}
		for(int i=0;i<Q;i++){
			int a=stdIn.nextInt()-1;
			int b=stdIn.nextInt();
			ans[a]+=b;
		}
		for(int i=0;i<tree.get(0).size();i++){
			int a=tree.get(0).get(z);
			ans[a]+=ans[0];
			if(tree.get(a).size()>1){
				s1.add(0);
				s2.add(a);
			}
		}
		while(s1.size()!=0){
			int a=s1.poll();
			int b=s2.poll();
			for(int i=0;i<tree.get(b).size()i++){
				int x=tree.get(b).get(i);
				if(x!=a){
					ans[x]+=ans[b];
					if(tree.get(x).size()>1){
						s1.add(b);
						s2.add(x);
					}
				}
			}
		}
		for(int i=0;i<N;i++){
			System.out.println(ans[i]);
		}
	}
}

Compiler output:
Main.java:45: error: ';' expected
			for(int i=0;i<tree.get(b).size()i++){
			                                ^
1 error
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
#include <utility>
using namespace std;
int n,q;

vector< pair<int, int> > vc;
vector< pair<int, int> > vc2;

void plusv(int pj,int xj, int* x){
    x[pj-1]=x[pj-1]+xj;
        if(vc2[i].first==pj){
            plusv(vc2[i].second, xj, x);
        }else if(vc2[i].first < pj){
            vc2.erase(vc2.begin() + i);
        }else if(vc2[i].first > pj){
            break;
        }
    }
}

int main()
{
    cin >> n >> q;
    int x[n];
    for(int i = 0; i < n ; i++){
        x[i]=0;
    } 
    int n1,n2;
    for(int i = 0; i < n-1; i++){
        cin >> n1 >> n2;
        vc.push_back(pair<int,int>(n1,n2));

    }
    sort(vc.begin(), vc.end());
    int pj,xj;
    for(int i = 0; i < q; i++){
        vc2 = vc;
        cin >> pj >> xj;
        plusv(pj,xj,x);

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


Compiler output:
a.cc: In function 'void plusv(int, int, int*)':
a.cc:13:16: error: 'i' was not declared in this scope
   13 |         if(vc2[i].first==pj){
      |                ^
a.cc:18:13: error: break statement not within loop or switch
   18 |             break;
      |             ^~~~~
a.cc: At global scope:
a.cc:21:1: error: expected declaration before '}' token
   21 | }
      | ^
Language: C++

#define INF LLONG_MAX
#define ll  long long
#define ull unsigned long long
#define rep(i,n) for(int i=0; i<n; ++i)
#define MOD 1000000007
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if(a>b) {a=b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) { if(a<b) {a=b; return true;} return false;}

typedef struct {
  int parent;
  vector<int> child;
  int counter;
}node;

node tree[2*110000];
int  op[2*110000];

void update_counter(int root, int inc) {
  tree[root].counter += inc;
  for(int i:tree[root].child) {
    update_counter(i, inc);
  }
}

int main() {
  int N, Q; cin >> N >> Q;
  rep(i, N-1) {
    int a, b; cin >> a >> b;
    tree[a].child.push_back(b);
    tree[b].parent = a;
  }
  rep(i, Q) {
    int p, x;
    cin >> p >> x;
    op[p] += x;
  }
  rep(i, 2*110000) {
    if(op[i] != 0) update_counter(i, op[i]);
  }
  for(int i=1; i<=N; ++i){
    cout << tree[i].counter;
    if(i == N) cout << endl;
    else cout << " ";
  }
}

Compiler output:
a.cc:12:3: error: 'vector' does not name a type
   12 |   vector<int> child;
      |   ^~~~~~
a.cc: In function 'void update_counter(int, int)':
a.cc:21:24: error: 'struct node' has no member named 'child'
   21 |   for(int i:tree[root].child) {
      |                        ^~~~~
a.cc: In function 'int main()':
a.cc:27:13: error: 'cin' was not declared in this scope
   27 |   int N, Q; cin >> N >> Q;
      |             ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | #define INF LLONG_MAX
a.cc:30:13: error: 'struct node' has no member named 'child'
   30 |     tree[a].child.push_back(b);
      |             ^~~~~
a.cc:42:5: error: 'cout' was not declared in this scope
   42 |     cout << tree[i].counter;
      |     ^~~~
a.cc:42:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:43:24: error: 'endl' was not declared in this scope
   43 |     if(i == N) cout << endl;
      |                        ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | #define INF LLONG_MAX
Language: C++

#include <iostream>
#include <string>
#include <cstring>
#include <set>
#include <queue>
#include <stack>

using namespace std;

#define maxN 200000

int edge[maxN][maxN];
long long int point[maxN];
int N, Q;

int make_tree(int n){
  for(int i=0;i<N; i++){
    if(edge[n][i] == -1){
      edge[i][n] = 0;
      make_tree(i);
    }
  }
  return 0;
}

int get_point(int n, int x){
  point[n] += x;
  for(int i=0;i<N; i++){
    if(edge[n][i] == -1){
      get_point(i,x);
    }
  }
  return 0;
}

int main(){

  cin >> N >> Q;
  memset(point, 0, sizeof(int)*N);

  for(int i=0; i<N-1;i++){
    int a, b;
    cin >> a >> b;
    edge[a-1][b-1] = -1;
    edge[b-1][a-1] = -1;
  }

  make_tree(0);

  for(int i=0; i<Q;i++){
    int a
    long long int b;
    cin >> a >> b;
    get_point(a-1,b);
  }

  for(int i=0; i<N; i++){
    cout << point[i] << " ";
  }
  cout << endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:52:5: error: expected initializer before 'long'
   52 |     long long int b;
      |     ^~~~
a.cc:53:12: error: 'a' was not declared in this scope
   53 |     cin >> a >> b;
      |            ^
a.cc:53:17: error: 'b' was not declared in this scope
   53 |     cin >> a >> b;
      |                 ^
Language: C++

#include <iostream>
#include <string>
#include <cstring>
#include <set>
#include <queue>
#include <stack>

using namespace std;

#define maxN 200000

int edge[maxN][maxN];
int point[maxN];
queue<int> que;
int N, Q;

int make_tree(int n){
  for(int i=0;i<N; i++){
    if(edge[n][i] == -1){
      edge[i][n] = 0;
      make_tree(i);
    }
  }
  return 0;
}

int get_point(int n, int x){
  point[n] += x;
  for(int i=0;i<N; i++){
    if(edge[n][i] == -1){
      get_point(i,x);
    }
  }
  return 0;
}

int main(){

  cin >> N >> Q;
  memset(point, 0, sizeof(int)*N);

  for(int i=0; i<N-1;i++){
    int a, b;
    cin >> a >> b;
    edge[a-1][b-1] = -1;
    edge[b-1][a-1] = -1;
  }

  make_tree(0);

  for(int i=0; i<Q;i++){
    int a, b;
    cin >> a >> b;
    get_point(a-1,b);
  }

  for(int i=0; i<N; i++){
    cout << point[i] << " ";
  }
  cout << endl;

  return 0;
}


Compiler output:
/tmp/ccLBMWMc.o: in function `make_tree(int)':
a.cc:(.text+0x7b): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/ccLBMWMc.o
/tmp/ccLBMWMc.o: in function `get_point(int, int)':
a.cc:(.text+0xa9): relocation truncated to fit: R_X86_64_PC32 against symbol `point' defined in .bss section in /tmp/ccLBMWMc.o
a.cc:(.text+0xc6): relocation truncated to fit: R_X86_64_PC32 against symbol `point' defined in .bss section in /tmp/ccLBMWMc.o
a.cc:(.text+0x117): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/ccLBMWMc.o
/tmp/ccLBMWMc.o: in function `main':
a.cc:(.text+0x132): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/ccLBMWMc.o
a.cc:(.text+0x14e): relocation truncated to fit: R_X86_64_PC32 against symbol `Q' defined in .bss section in /tmp/ccLBMWMc.o
a.cc:(.text+0x15f): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/ccLBMWMc.o
a.cc:(.text+0x174): relocation truncated to fit: R_X86_64_PC32 against symbol `point' defined in .bss section in /tmp/ccLBMWMc.o
a.cc:(.text+0x21c): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/ccLBMWMc.o
a.cc:(.text+0x27f): relocation truncated to fit: R_X86_64_PC32 against symbol `Q' defined in .bss section in /tmp/ccLBMWMc.o
a.cc:(.text+0x2a1): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status