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

#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
typedef long long ll;
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;
#include<string>
#include<vector>
using namespace std;
typedef pair<int, int>P;
//max=({});
//条件式が真ならwhileの中身を回し続ける
//printf("%d\n", ans);

//pairの入力
//vector<pair<ll, ll>>work(n);
//rep(i, n) {
//	ll a, b;
//	cin >> a >> b;
//	work[i] = make_pair(a, b);
//for(auto p:mp)(mapの探索)
//printf("%.10f\n",なんちゃら)
//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

//素因数分解
map<ll, ll>ins;
void facterize(ll n) {
	ll a = 2;
	while (n >= a * a) {
		if (n % a == 0) {
			ins[a]++;
			ins[a] = ins[a] % 1000000007;
			n /= a;
		}
		else {
			a++;
		}
	}
	ins[n]++;
}

vector<ll>relation[20], money(20, 1);
int dp[110][110];

int keta(int x) {
	int y = 0;
	while (x > 0) {
		y++;
		x /= 10;
	}
	return y;
}

int dy[] = { 0, 0, 1, -1,1,1,-1,-1 };
int dx[] = { 1, -1, 0, 0,1,-1,1,-1 };
vector<int>to[10101010];
vector<int>ans(n);

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

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


Compiler output:
a.cc:74:16: error: 'n' was not declared in this scope; did you mean 'yn'?
   74 | vector<int>ans(n);
      |                ^
      |                yn
Language: C++

#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
typedef long long ll;
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;
#include<string>
#include<vector>
using namespace std;
typedef pair<int, int>P;
//max=({});
//条件式が真ならwhileの中身を回し続ける
//printf("%d\n", ans);

//pairの入力
//vector<pair<ll, ll>>work(n);
//rep(i, n) {
//	ll a, b;
//	cin >> a >> b;
//	work[i] = make_pair(a, b);
//for(auto p:mp)(mapの探索)
//printf("%.10f\n",なんちゃら)
//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

//素因数分解
map<ll, ll>ins;
void facterize(ll n) {
	ll a = 2;
	while (n >= a * a) {
		if (n % a == 0) {
			ins[a]++;
			ins[a] = ins[a] % 1000000007;
			n /= a;
		}
		else {
			a++;
		}
	}
	ins[n]++;
}

vector<ll>relation[20], money(20, 1);
int dp[110][110];

int keta(int x) {
	int y = 0;
	while (x > 0) {
		y++;
		x /= 10;
	}
	return y;
}

int dy[] = { 0, 0, 1, -1,1,1,-1,-1 };
int dx[] = { 1, -1, 0, 0,1,-1,1,-1 };
vector<int>to[10101010];

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) {
		cin >> a >> b;
		--a;
		--b;
		to[a].push_back(b);
		to[b].push_back(a);
	}
	vector<int>ans(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:78:17: error: 'ans' was not declared in this scope; did you mean 'ins'?
   78 |                 ans[u] += ans[v];
      |                 ^~~
      |                 ins
a.cc: In function 'int main()':
a.cc:87:24: error: 'a' was not declared in this scope
   87 |                 cin >> a >> b;
      |                        ^
a.cc:87:29: error: 'b' was not declared in this scope
   87 |                 cin >> a >> b;
      |                             ^
Language: C++

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

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

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

int main(){
    int n,q;cin>>n>>q;
    rep(i,n-1){
        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 'int main()':
a.cc:37:2: error: expected '}' at end of input
   37 | }
      |  ^
a.cc:17:11: note: to match this '{'
   17 | int main(){
      |           ^
Language: C++

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

vector <long long> edges[200010];
long long num[200010];

void dfs(int i,int p){
  for(int j:edges[i]) if (!j==p){
    num[j]+=num[i];
    dfs(j,i);
  }
}

int main(){
long long N;
  long long Q;
  cin>>N>>Q;
  for(int i=0; i<N; i++){
int a,b;
    cin>>a>>b;
    edges[a-1].push_back(b-1);
    edges[b-1].push_back(a-1);
  }
  for(int i=0; i<N; i++){
int p,x;
    cin>>p>>x;
    num[p-1]+=x;
  }
  
  dfs(0,-1);
  for(int i=0; i<N; i++){
    cout<<num[i]<<"\n"
      cout<<endl;
  }
}
  
  

Compiler output:
a.cc: In function 'int main()':
a.cc:32:23: error: expected ';' before 'cout'
   32 |     cout<<num[i]<<"\n"
      |                       ^
      |                       ;
   33 |       cout<<endl;
      |       ~~~~
Language: C++

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

vector <long long> edges[200010];
long long num[200010];

void dfs(int i,int p){
  for(int j:edges[i]) if (!j==p){
    num[j]+=num[i];
    dfs(j,i);
  }
}

int main(){
long long N;
  long long Q;
  cin>>N>>Q;
  for(int i=0; i<N; i++){
int a,b;
    cin>>a>>b;
    edges[a-1].push_back(b-1);
    edges[b-1].push_back(a-1);
  }
  for(int i=0; i<N; i++){
int p,x;
    cin>>p>>x;
    sum[p-1]+=x;
  }
  
  dfs(0,-1);
  for(int i=0; i<N; i++){
    cout<<num[i]<<"\n"
      cout<<endl;
  }
}
  
  

Compiler output:
a.cc: In function 'int main()':
a.cc:27:5: error: 'sum' was not declared in this scope; did you mean 'num'?
   27 |     sum[p-1]+=x;
      |     ^~~
      |     num
a.cc:32:23: error: expected ';' before 'cout'
   32 |     cout<<num[i]<<"\n"
      |                       ^
      |                       ;
   33 |       cout<<endl;
      |       ~~~~
Language: C++

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

vector <long long> edges[200010];
long long num[200010];

void dfs(int i,int p){
  for(int j:edges[i]) if (!j==p){
    num[j]+=num[i];
    dfs(j,i);
  }

int main(){
long long N;
  long long Q;
  cin>>N>>Q;
  for(int i=0; i<N; i++){
int a,b;
    cin>>a>>b;
    edges[a-1].push_back(b-1);
    edges[b-1].push_back(a-1);
  }
  for(int i=0; i<N; i++){
int p,x;
    cin>>p>>x;
    sum[p-1]+=x;
  }
  
  dfs(0,-1);
  for(int i=0; i<N; i++){
    cout<<num[i]<<"\n"
      cout<<endl;
  }
}
  
  

Compiler output:
a.cc: In function 'void dfs(int, int)':
a.cc:13:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   13 | int main(){
      |         ^~
a.cc:13:9: note: remove parentheses to default-initialize a variable
   13 | int main(){
      |         ^~
      |         --
a.cc:13:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:13:11: error: a function-definition is not allowed here before '{' token
   13 | int main(){
      |           ^
a.cc:34:2: error: expected '}' at end of input
   34 | }
      |  ^
a.cc:7:22: note: to match this '{'
    7 | void dfs(int i,int p){
      |                      ^
Language: C++

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

vector <long long> edges[200010];
long long num[200010];

void dfs(int i,int p){
  for(int j:edges[i]) if (!j==p){
    num[j]+=num[i];
    dfs(j,i);
  }

int main(){
long long N;
  long long Q;
  cin>>N>>Q;
  for(int i=0; i<N; i++){
int a,b;
    cin>>a>>b;
    edges[a-1].push_back(b-1);
    edges[b-1].push_back(a-1);
  }
  for(int i=0; i<N; i++){
int p,x;
    cin>>p>>x;
    sum[p-1]+=x;
  }
  
  dfs(0,-1);
  for(int i=0; i<N; i++){
    cout<<num[i]<<"\n"
  }
}
  
  

Compiler output:
a.cc: In function 'void dfs(int, int)':
a.cc:13:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   13 | int main(){
      |         ^~
a.cc:13:9: note: remove parentheses to default-initialize a variable
   13 | int main(){
      |         ^~
      |         --
a.cc:13:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:13:11: error: a function-definition is not allowed here before '{' token
   13 | int main(){
      |           ^
a.cc:33:2: error: expected '}' at end of input
   33 | }
      |  ^
a.cc:7:22: note: to match this '{'
    7 | void dfs(int i,int p){
      |                      ^
Language: C++

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

vector <long long> edges[200010];
long long num[200010];

void dfs(int i,int p){
  for(int j:edges[i]) if (!j==p){
    num[j]+=num[i];
    dfs(j,i);
  }

int main(){
long long N;
  long long Q;
  cin>>N>>Q;
  for(int i=0; i<N; i++){
int a,b;
    cin>>a>>b;
    edges[a-1].push_back(b-1);
    edges[b-1].push_back(a-1);
  }
  for(int i=0; i<N; i++){
int p,x;
    cin>>p>>x;
    sum[p-1]+=x;
  }
  
  dfs(0,-1);
  for(int i=0; i<N; i++){
    cout<<num[i]<<"\n"
  }
}
  
  

Compiler output:
a.cc:1:9: fatal error: bits/stdc.++h: No such file or directory
    1 | #include<bits/stdc.++h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

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

vector <long long> edges[200010];
long long num[200010];

void dfs(int i,int p){
  for(int j:edges[i]) if (!j==p){
    num[j]+=num[i];
    dfs(j,i);
  }

int main(){
long long N;
  long long Q;
  cin>>N>>Q;
  for(int i=0; i<N; i++){
int a,b;
    cin>>a>>b;
    edges[a-1].push_back(b-1);
    edges[b-1].push_back(a-1);
  }
  for(int i=0; i<N; i++){
int p,x;
    cin>>p>>x;
    sum[p-1]+=x;
  }
  
  dfs(0,-1);
  for(int i=0; i<N; i++){
    cout<<num[i]<<"\n"
  }
}
  

Compiler output:
a.cc: In function 'void dfs(int, int)':
a.cc:13:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   13 | int main(){
      |         ^~
a.cc:13:9: note: remove parentheses to default-initialize a variable
   13 | int main(){
      |         ^~
      |         --
a.cc:13:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:13:11: error: a function-definition is not allowed here before '{' token
   13 | int main(){
      |           ^
a.cc:33:2: error: expected '}' at end of input
   33 | }
      |  ^
a.cc:7:22: note: to match this '{'
    7 | void dfs(int i,int p){
      |                      ^
Language: C++

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

vector <long long> edges[200010];
long long num[200010];

void dfs(int i,int p){
  for(int j:edges[i]) if (!j==p){
    num[j]+=num[i];
    dfs(j,i);
  }

int main(){
long long N;
  long long Q;
  cin>>N>>Q;
  for(int i=0; i<N; i++){
int a,b;
    cin>>a>>b;
    edges[a-1].push_back(b-1);
    edges[b-1].push_back(a-1);
  }
  for(int i=0; i<N; i++){
int p,x;
    cin>>p>>x;
    sum[p-1]+=x;
  }
  
  dfs(0,-1);
  for(int i=0; i<N; i++){
    cout<<num[i]<<"\n"
  }
  
  

Compiler output:
a.cc: In function 'void dfs(int, int)':
a.cc:13:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   13 | int main(){
      |         ^~
a.cc:13:9: note: remove parentheses to default-initialize a variable
   13 | int main(){
      |         ^~
      |         --
a.cc:13:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:13:11: error: a function-definition is not allowed here before '{' token
   13 | int main(){
      |           ^
a.cc:32:4: error: expected '}' at end of input
   32 |   }
      |    ^
a.cc:7:22: note: to match this '{'
    7 | void dfs(int i,int p){
      |                      ^
Language: C++

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

vector <long long> edges[200010];
long long num[200010];

void dfs(int i,int p){
  for(int j:edges[i]) if (!j==p){
    num[j]+=num[i];
    dfs(j,i);
  }

int main(){
long long N;
  long long Q;
  cin>>N>>Q;
  for(int i=0; i<N; i++){
int a,b;
    cin>>a>>b;
    edges[a-1].push_back(b-1);
    edges[b-1].push_back(a-1);
  }
  for(int i=0; i<N; i++){
int p,x;
    cin>>p>>x;
    sum[p-1]+=x;
  }
  
  dfs(0,-1);
  for(int i=0; i<N; i++){
    cout<<num[i]<<"\n"
  }
  
  

Compiler output:
a.cc:1:9: fatal error: bits/stdc.++h: No such file or directory
    1 | #include<bits/stdc.++h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int N, Q;
vector<int> edges(200000);
int64_t num[2000000];

void dfs(int i, int p) {
    for(int j : edges[i]) {
        if(j != p) {
            num[j] += num[i];
            dfs(j, i);
        }   
     }
}

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

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

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

    dfs(0, -1);
    for(int i = 0; i < N; i++) cout << num[i] << " ";

    return 0;
}

Compiler output:
a.cc: In function 'void dfs(int, int)':
a.cc:9:24: error: 'begin' was not declared in this scope
    9 |     for(int j : edges[i]) {
      |                        ^
a.cc:9:24: 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:9:24: error: 'end' was not declared in this scope
    9 |     for(int j : edges[i]) {
      |                        ^
a.cc:9:24: 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:23:22: error: request for member 'push_back' in 'edges.std::vector<int>::operator[](((std::vector<int>::size_type)(a - 1)))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   23 |         edges[a - 1].push_back(b - 1);
      |                      ^~~~~~~~~
a.cc:24:22: error: request for member 'push_back' in 'edges.std::vector<int>::operator[](((std::vector<int>::size_type)(b - 1)))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   24 |         edges[b - 1].push_back(a - 1);
      |                      ^~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int N, Q;
vector<ll> ans(2000000);
vector<int> ab(2000000);
vector<int> p(Q), x(Q);
void dfs(int S, int P) {
    for(int z: ab[S]) {
        if(z != P) {
            ans[z] += ans[S];
            dfs(z, S); 
        }
    }
}
int main() {

    cin >> N >> Q;

    for(int i = 0; i < N - 1; i++) {
        int a,b;
        cin >> a >> b; a--; b--;
        ab[a].push_back(b);
        ab[b].push_back(a);
    }
 
    for(int i = 0; i < Q; i++) {
        cin >> p[i] >> x[i];
        p[i]--;
    }

    for(int i = 0; i < Q; i++) {
        ans[p[i]] += x[i];
    }

    dfs(0, -1);

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

    return 0;

}

Compiler output:
a.cc: In function 'void dfs(int, int)':
a.cc:9:20: error: 'begin' was not declared in this scope
    9 |     for(int z: ab[S]) {
      |                    ^
a.cc:9: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:9:20: error: 'end' was not declared in this scope
    9 |     for(int z: ab[S]) {
      |                    ^
a.cc:9: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:23:15: error: request for member 'push_back' in 'ab.std::vector<int>::operator[](((std::vector<int>::size_type)a))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   23 |         ab[a].push_back(b);
      |               ^~~~~~~~~
a.cc:24:15: error: request for member 'push_back' in 'ab.std::vector<int>::operator[](((std::vector<int>::size_type)b))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   24 |         ab[b].push_back(a);
      |               ^~~~~~~~~
Language: C++

#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){return b!=0?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}

int main(){
    ll n,q,a,b;
    cin>>n>>q;
    vector<vector<ll>> adj(n);
    rep(i,n-1){
        cin>>a>>b;
        a--; b--;
        adj[a].push_back(b);
        adj[b].push_back(a);
    }
    vector<ll> cnt(n,0),vis(n,0);
    rep(i,q){
        cin>>a>>b;
        a--;
        cnt[a]+=b;
    }
    queue<ll> q;
    q.push(0);
    while(!q.empty()){
        ll f=q.front(); q.pop();
        rep(i,adj[f].size()){
            if(!vis[adj[f][i]]){
                q.push(adj[f][i]);
                vis[adj[f][i]]=1;
                cnt[adj[f][i]]+=cnt[f];
            }
        }
    }
    rep(i,n) cout<<cnt[i]<<' ';
    cout<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:15: error: conflicting declaration 'std::queue<long long int> q'
   25 |     queue<ll> q;
      |               ^
a.cc:10:10: note: previous declaration as 'll q'
   10 |     ll n,q,a,b;
      |          ^
a.cc:26:7: error: request for member 'push' in 'q', which is of non-class type 'll' {aka 'long long int'}
   26 |     q.push(0);
      |       ^~~~
a.cc:27:14: error: request for member 'empty' in 'q', which is of non-class type 'll' {aka 'long long int'}
   27 |     while(!q.empty()){
      |              ^~~~~
a.cc:28:16: error: request for member 'front' in 'q', which is of non-class type 'll' {aka 'long long int'}
   28 |         ll f=q.front(); q.pop();
      |                ^~~~~
a.cc:28:27: error: request for member 'pop' in 'q', which is of non-class type 'll' {aka 'long long int'}
   28 |         ll f=q.front(); q.pop();
      |                           ^~~
a.cc:31:19: error: request for member 'push' in 'q', which is of non-class type 'll' {aka 'long long int'}
   31 |                 q.push(adj[f][i]);
      |                   ^~~~
Language: C++

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> P;

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

vector <int> ki[200100];
vector <int> ans(200100,0);

void dfs(int i, int p){
  for (int j; v[i])){
    if (j == p) continue;
    ans[j] += ans[i];
    dfs(j, i);
  }
}

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


Compiler output:
a.cc: In function 'void dfs(int, int)':
a.cc:20:15: error: 'v' was not declared in this scope
   20 |   for (int j; v[i])){
      |               ^
a.cc:20:19: error: expected ';' before ')' token
   20 |   for (int j; v[i])){
      |                   ^
      |                   ;
a.cc:20:20: error: expected primary-expression before ')' token
   20 |   for (int j; v[i])){
      |                    ^
a.cc: In function 'int main()':
a.cc:34:13: error: request for member 'pushback' in 'ki.std::vector<long long int>::operator[](((std::vector<long long int>::size_type)(a - 1)))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'}
   34 |     ki[a-1].pushback(b-1);
      |             ^~~~~~~~
a.cc:35:13: error: request for member 'pushback' in 'ki.std::vector<long long int>::operator[](((std::vector<long long int>::size_type)(b - 1)))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'}
   35 |     ki[b-1].pushback(a-1);
      |             ^~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;

Graph G(N);
int cnt[200010] = {0}; 

void dfs(Graph &G,int p, int x){
  cnt[p] += x;
  for(int nv : G[p]){
    dfs(G, nv, x);
  }
}

int main(){
  int N, Q; cin >> N >> Q; 
  for(int i = 0; i < N; i++){
    int a, b; cin >> a >> b;
    a--; b--; //0スタートの木に変える
    G[a].push_back(b);
  }
  for(int i = 0; i < Q; i++){
    int p, x; cin >> p >> x;
    p--; x--;
    dfs(G, p, x);
  }
  for(int i = 0; i < N; i++){
    cout << cnt[i] << " ";
  }
}
  

Compiler output:
a.cc:5:9: error: 'N' was not declared in this scope
    5 | Graph G(N);
      |         ^
Language: C++

#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int n;
vector<int> v[200010];
vector<int> ans(20010,0);
void dfs(int i, int p = -1){
    for(int j : v[i]){
        if(j==p) continue;
        ans[j]+=ans[i];
        dfs(j,i);
    }
}

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

Compiler output:
a.cc: In function 'int main()':
a.cc:37:17: error: expected primary-expression before '=' token
   37 |         ans[p]+==x;
      |                 ^
Language: C++

#include <bits/stdc++.h>
 
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
#define lol long long
#define SUM(n) ((n)+1)*(n)/2　//1〜nまでの総和を求める式
#define mp make_pair
#define fi first
#define se second
#define pu push_back
#define SYOU(x) setprecision(x+1) //小数点桁数を指定する
#define abs(x,y) (max(x,y)-min(x,y))
#define all(v) v.begin(),v.end()
#define UPDight(a,b) (a+b-1)/b //小数点切り上げ 
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MOD=int(1e9)+7; 
using namespace std;
using pii = pair<int,int>;
typedef vector<int> vit;

int n, q;
vit edge[200005];
vector<lol> ans(200005, 0);
bool isvisited[200005] = {false};

void count(int p ,int x){
  if(isvisited[p]) return;
  sum[p] += x;
  isvisited[p] = true;
  rep(i, edge[p].size() ){
    count(edge[p][i] , sum[p]);
  }
  return;
}

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

  cin >> n >> q;
  int a, b;
  rep(i, n - 1){
    cin >> a >> b;
    edge[a].pu(b);
    edge[b].pu(a);
  }
  rep(i, q){
    cin >> a >> b;
    ans[a] += b;
  }
  count(1, 0);
  reps(i, n - 1){
    cout << ans[i] << " ";
  }
  cout << ans[n] << '\n';
  return 0;
}


Compiler output:
a.cc:6:28: error: extended character 　 is not valid in an identifier
    6 | #define SUM(n) ((n)+1)*(n)/2　//1〜nまでの総和を求める式
      |                            ^
a.cc: In function 'void count(int, int)':
a.cc:29:3: error: 'sum' was not declared in this scope
   29 |   sum[p] += x;
      |   ^~~
Language: C++

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

void dfs(vector<vector<ll> >& g,ll v,ll p,ll x,vector<ll>& con) //V子、P親
{
  con[v]+=x;
  for(auto next:g[v])
    if(next == p) continue;
      dfs(g,next,v,con[v],con);
}


int main()
{ 
  ll n,q;
  cin >> n >> q;
 vector<vector<ll> >  Ginf(n);
 REP(i,n-1)
 {
   ll a,b;
   cin >> a >> b;
   a--;
   b--;
   Ginf[a].push_back(b);
   Ginf[b].push_back(a);
 }
  vector<ll> con(n,0);
  
  REP(i,q)
  {
    ll p,x;
    cin >> p >> x;
    p--;
    con[p]=+x;
  }
  dfs(Ginf,0,-1,0,con);
  
 REP(i,n)
   cout << con[i] <<" ";
}

Compiler output:
a.cc: In function 'void dfs(std::vector<std::vector<long long int> >&, long long int, long long int, long long int, std::vector<long long int>&)':
a.cc:13:10: error: cannot resolve overloaded function 'next' based on conversion to type 'long long int'
   13 |       dfs(g,next,v,con[v],con);
      |       ~~~^~~~~~~~~~~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
#define erep(i,n) for(int i = 0;i<=n;i++)
#define rep1(i,n) for(int i = 1;i<n;i++)
#define erep1(i,n) for(int i = 1;i<=n;i++)
typedef long long ll;
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstring vector<string>
#define vdouble vector<double>
#define vll vector<ll>
#define vbool vector<bool>
#define INF 100000000000000009
#define int long long
using P = pair<int,int>;

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;
  vvint to(n,vint(0));
  rep(i,n-1){
    int a,b;
    cin >> a >> b;
    a--;
    b--;
    to[a].push_back(b);
    to[b].push_back(a);
  }
  vint ans(n);

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

  dfs(0);

  rep(i,n){
    if(i) cout << " ";
    cout << ans[i];
  }
  cout << endl;

}

Compiler output:
a.cc: In function 'void dfs(long long int, long long int)':
a.cc:19:14: error: 'to' was not declared in this scope; did you mean 'tm'?
   19 |   for(int u: to[v]){
      |              ^~
      |              tm
a.cc:21:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   21 |     ans[u] += ans[v];
      |     ^~~
      |     abs
At global scope:
cc1plus: error: '::main' must return 'int'
Language: C++

#include <bits/stdc++.h>
     
using namespace std;
typedef long long ll;
const int nmax=200001; 
vector<int> V[nmax];
ll count1[nmax];
int N,Q;
ll ans[nmax];
void print_vector_int(vector<int> & S){
    int i,n;
    n = S.size();
    for(i=0;i<n;i++){
        if (i != 0) {
            cout << " ";
        }
        cout << S[i];
    }
    cout << endl;
}

void DFS(vector<int> *Tree,int start,int p){
    int i,n;
    // cout << "I am " << start << endl;
    if (p>=0){
        count1[start] += count1[p];
    }
    n = Tree[start].size();
    for(i=0;i<n;i++){
        if (Tree[start][i] != p){
            DFS(Tree,Tree[start][i],start);
        }
    }
    if (p<0){
        for(i=1;i<=N;i++){
            if(i!=1){
                cout << " ";
            }
            cout << count1[i];
        }
        cout << endl;
    }
}

void solve(){
    DFS(V,1,-1);
}

int main() {
    int i,j; 
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> N >> Q; 
    // cout << N << " " << Q << endl;
    i=0; 
    for(i=1; i<= N-1; i++){
        int x,y;
        cin >> x >> y;
        V[x].push_back(y);
        V[y].push_back(x);
    }
    //for(i=1; i<= N; i++){
    //    cout << i << " ";
    //    print_vector_int(V[i]);
    //}
    for(i=1;i<=N;i++){
        count1[i] = 0;
    }
    for(i=1;i<=Q;i++){
        int p,q;
        cin >> p >> q;
        count1[p] = count1[p] + q;
    }
    solve();
}



[myoden@ubuntu002 D]$ 


Compiler output:
a.cc:78:8: error: stray '@' in program
   78 | [myoden@ubuntu002 D]$
      |        ^
a.cc:78:1: error: expected unqualified-id before '[' token
   78 | [myoden@ubuntu002 D]$
      | ^
Language: C

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

int main(){
    int n, x;
    cin >> n >> x;
    vector<vector<int>> a(n - 1, vector<int> (2));
    vector<vector<int>> p(x, vector<int> (2));
    vector<int> count(n, 0);
    int tmp;    

    for(int i = 0; i < n - 1; i++){
        cin >> a.at(i).at(0) >> a.at(i).at(1);
    }
    for(int i = 0; i < x; i++){
        cin >> p.at(i).at(0) >> p.at(i).at(1);
    }

    for(int i = 0; i < x; i++){
        count.at(p.at(i).at(0) - 1) += p.at(i).at(1); 
    }

    for(int i = 0; i < n - 1; i++){
        count.at(a.at(i).at(1) - 1) += count.at(a.at(i).at(0) - 1);
    }

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

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

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

// 木上の探索
vector<int> depth;
vector<int> subtree_size;
int oya[214514];
void dfs(const Graph &G, int v, int p, int d) {
    depth[v] = d;
    for (auto nv : G[v]) {
    	oya[v]=p;
        if (nv == p) continue; // nv が親 p だったらダメ
        dfs(G, nv, v, d+1);
    }
}
int ans[214514];
pair<pair<int,int>,int> pp[214514];
int main() {
    // 頂点数 (木なので辺数は N-1 で確定)
    int N; cin >> N;
    int q; cin>>q;
    // グラフ入力受取
    Graph G(N);
    for (int i = 0; i < N-1; ++i) {
        int a, b;
        cin >> a >> b;
        a-=1;
        b-=1;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    // 探索
    int root = 0; // 仮に頂点 0 を根とする
    depth.assign(N, 0);
    dfs(G, root, -1, 0);
    
    for(int i=0;i<N;i++){
    	pp[i].first.first=depth[i];
    	pp[i].first.second=i;
    	pp[i].second=oya[i];
    }	
    for(int i=0;i<q;i++){
    	int p,x;
    	cin>>p>>x;
    	p-=1;
    	ans[p]+=x;
    }	
    sort(pp,pp+N);
    for(int i=1;i<N;i++)ans[pp[i].first.second]+=ans[pp[i].second];
    for(int i=0;i<N;i++)cout<<ans[i]<<" ";
}


Compiler output:
a.cc: In function 'int main()':
a.cc:50:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   50 |     sort(pp,pp+N);
      |     ^~~~
      |     short
Language: C++

#include <bits/stdc++.h>
#include <stdio.h>
#include <math.h>
using namespace std;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using ll = long long int;
 
 
void dfs_2(ll r, ll x, const vi &query, const vector<bool> &ald, const vvi &tree, vi &res){
    ald[r] = true;
    x += query[r];
    res[r] += x;
    for (auto p : tree[r]) { 
        if(ald[p] == true){continue;}
        dfs_2(p, x, query, ald, tree, res);
    }
    return;
}
 
int main(){
    ll N, Q;
    cin >> N >> Q;
    vvi vec(N+1, vi(0));
    for(int i=0; i<N-1; i++){
      int a, b; cin >> a >> b;
      vec[a].emplace_back(b);
      vec[b].emplace_back(a);
    }
    vi query(N+1, 0);
    for(int i=0; i<Q; i++){
        int a, b;
        cin >> a >> b;
        query[a] += b;
    }
 
    vi res(N+1, 0);
    vector<bool> ald_2(N+1, false);
 
    dfs_2(1, 0, query, ald_2, vec, res);
 
    for(int i=1; i<N+1; i++){
        cout << res[i] << " ";
    }
}

Compiler output:
a.cc: In function 'void dfs_2(ll, ll, const vi&, const std::vector<bool>&, const vvi&, vi&)':
a.cc:11:10: error: lvalue required as left operand of assignment
   11 |     ald[r] = true;
      |     ~~~~~^
Language: C++

#include <bits/stdc++.h>
#include <stdio.h>
#include <math.h>
using namespace std;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using ll = long long int;


void dfs_2(ll r, ll x, vi query, vector<bool> &ald, vvi tree, vi &res){
    ald[r] = true;
    x += query[r];
    res[r] += x;
    for (auto p : tree[r] { 
        if(ald[p] == false){
        dfs_2(p, x, query, ald, tree, res);
        }
    }
    return;
}

int main(){
    ll N, Q;
    cin >> N >> Q;
    vvi vec(N+1, vi(0));
    for(int i=0; i<N-1; i++){
      int a, b; cin >> a >> b;
      vec[a].emplace_back(b);
      vec[b].emplace_back(a);
    }
    vi query(N+1, 0);
    for(int i=0; i<Q; i++){
        int a, b;
        cin >> a >> b;
        query[a] += b;
    }

    vi res(N+1, 0);
    vector<bool> ald_2(N+1, false);

    for(int i=1; i<N+1; i++){
        cout << res[i] << " ";
    }
}

Compiler output:
a.cc: In function 'void dfs_2(ll, ll, vi, std::vector<bool>&, vvi, vi&)':
a.cc:14:26: error: expected ')' before '{' token
   14 |     for (auto p : tree[r] {
      |         ~                ^~
      |                          )
Language: C++

#include "bits/stdc++.h"
using namespace std;
// #define endl '\n'
#define int long long

const int MXN = 200005;
const int MXK = 20;

vector<int> adj[MXN];
int par[MXN][MXK];
int n, q;

int depth[MXN];

void dfs(int node, int last, int dep) {
	depth[node] = dep;
	par[node][0] = last;
	for (int i=1; i<MXK; i++) {
		int p = par[node][i-1];
		if (p != -1) {
			par[node][i] = par[p][i-1];
		}
	}
	for (int i=0; i<adj[node].size(); i++) {
		int o = adj[node][i];
		if (o == last) continue;
		dfs(o, node, dep+1);
	}
}

bool dep(int a, int b) {
	return depth[a] > depth[b];
}

int kth_parent(int n, int k) {
	for (int i=0; i<MXK; i++) {
		if ((1 << i) & k) {
			n = par[n][i];
		}
	}
	return n;
}

int lca(int a, int b) {
	if (depth[a] > depth[b]) {
		swap(a, b);
	}
	b = kth_parent(b, depth[b] - depth[a]);
	if (a == b) return a;
	for (int i=MXK-1; i>=0; i--) {
		if (par[a][i] != par[b][i]) {
			a = par[a][i];
			b = par[b][i];
		}
	}
	return par[a][0];
}

signed main() {

	cin >> n >> q;
	for (int i=0; i<MXN; i++) {
		for (int j=0; j<MXK; j++) {
			par[i][j] = -1;
		}
	}
	for (int i=1; i<n; i++) {
		int a, b;
		cin >> a >> b;
		adj[a].push_back(b);
		adj[b].push_back(a);
	}
	dfs(1, -1, 0);
	
	for (int i=0; i<q; i++) {
		
		int x;
		cin >> x;
		vector<int> inc;
		for (int j=0; j<x; j++) {
			int y;
			cin >> y;
			if (y != 1) inc.push_back(par[y][0]);
		}
		sort(inc.begin(), inc.end(), dep);
		int cr = inc[0];
		bool ok = true;
		for (int i=1; i<inc.size() && ok; i++) {
			int l = lca(cr, inc[i]);
			if (l == cr) continue;
			else if (l == inc[i]) cr = inc[i];
			else ok = false;
		}
		if (ok) {
			cout << "YES" << endl;
		}
		else {
			cout << "NO" << endl;
		}
		
		
	}
	
}

 

Compiler output:
a.cc:106:1: error: extended character   is not valid in an identifier
  106 |  
      | ^
a.cc:106:1: error: '\U000000a0' does not name a type
  106 |  
      | ^
Language: C++

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

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

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:
cc1plus: error: '::main' must return 'int'
Language: C++

#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(), a.end()
#define maxs(x, y) (x = max(x, y))
#define mins(x, y) (x = min(x, y))
#define pb push_back
#define sz(x) (int)(x).size()
#define PQ(T) priority_queue<T, v(T), greater<T>>
#define bn(x) ((1 << x) - 1)
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int int;
typedef unsigned uint;
typedef unsigned long long uint;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<int> vl;
typedef vector<P> vp;
const double eps = 1e-10;
const int LINF = 1001002003004005006int;
const int INF = 1001001001;
const int mod = 1000000007;

vector<vector<int>> p(202020, vector<int>());
vector<int> ans(202020, 0);
vector<bool> pop(202020, false); 

void ki_plus(int i){
    pop[i] = true;
    if(p[i].size()){
        for(int j : p[i]){
            if(!pop[j]){
                ans[j] += ans[i];
                ki_plus(j);
            }
        }
    }
}

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

    rep(i, n-1){
        int a, b;
        cin >> a >> b;
        p[a].push_back(b);
        p[b].push_back(a);
    }

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

    ki_plus(1);

    rep(i, n){
        cout << ans[i+1] << endl;
    }

    return 0;
}

Compiler output:
a.cc:18:19: error: multiple types in one declaration
   18 | typedef long long int int;
      |                   ^~~
a.cc:18:23: error: declaration does not declare anything [-fpermissive]
   18 | typedef long long int int;
      |                       ^~~
a.cc:20:28: error: conflicting declaration 'typedef long long unsigned int uint'
   20 | typedef unsigned long long uint;
      |                            ^~~~
a.cc:19:18: note: previous declaration as 'typedef unsigned int uint'
   19 | typedef unsigned uint;
      |                  ^~~~
a.cc:27:18: error: unable to find numeric literal operator 'operator""int'
   27 | const int LINF = 1001002003004005006int;
      |                  ^~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;

vvll G2(200100, vll(0));
vll counter(200100, 0);

void query(int p, int x){
  for(int i = 0; i < G2.at(p).size(); i++){
    int next = G2.at(p).at(i);
    counter.at(next) += x;
    if(G2.at(next).size() > 0) query(next, x);
  }
}

int main(){
  ll N, Q;
  cin >> N >> Q;
  priority_queue<Pll, vector<Pll>, greater<Pll>> G1;
  for(int i = 0; i < N-1; i++){
    ll a, b;
    cin >> a >> b;
    a--; b--;
    G1.push(make_pair(a,b));
  }

  vector<bool> flag(N, true);
  flag.at(0) = false;
  
  while(!G1.empty()){
    int a = G1.front().first;
    int b = G1.front().second;
    G1.pop();
    if(!flag.at(a) && flag.at(b)){
      G2.at(a).push_back(b);
      flag.at(b) = false;
    }
    else if(!flag.at(b) && flag.at(a)){
      G2.at(b).push_back(a);
      flag.at(a) = false;
    }
    else if(flag.at(a) && flag.at(b)){
      G1.push(make_pair(a, b));
    }
  }
  

  
  vll p(Q), x(Q);
  for(int i = 0; i < Q; i++){
    cin >> p.at(i) >> x.at(i);
    p.at(i)--;
    counter.at(p.at(i)) += x.at(i);
    query(p.at(i), x.at(i));
  }

  for(int i = 0; i < N; i++){
    cout << counter.at(i);
    if(i == N-1) cout << endl;
    else cout << ' ';
  }

}

Compiler output:
a.cc: In function 'int main()':
a.cc:42:16: error: 'class std::priority_queue<std::pair<long long int, long long int>, std::vector<std::pair<long long int, long long int> >, std::greater<std::pair<long long int, long long int> > >' has no member named 'front'
   42 |     int a = G1.front().first;
      |                ^~~~~
a.cc:43:16: error: 'class std::priority_queue<std::pair<long long int, long long int>, std::vector<std::pair<long long int, long long int> >, std::greater<std::pair<long long int, long long int> > >' has no member named 'front'
   43 |     int b = G1.front().second;
      |                ^~~~~
Language: C++


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

ll n,q,p,x,a,b;

vector<bool>seen;
ll counter[200010];
void dfs(const Graph &G, int v,int par) {
    seen[v] = true; // v を訪問済にする
    if (par>=0){
    counter[v]+=counter[par];
    }

    // v から行ける各頂点 next_v について
    for (ll next_v : G[v]) { 
        if (seen[next_v]) continue; // next_v が探索済だったらスルー
        dfs(G, next_v,v); // 再帰的に探索
    }
}

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

  //グラフの作成
  Graph G(n);
  for(int i=0;i<n-1;i++){
    cin >> a >> b;
    a--;
    b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  //カウンタの初期化
  counter.resize(n);
  for(int i=0;i<q;i++){
    cin >> p >> x;
    p--;
    counter[p]=x;
  }
  seen.assign(n,false);
  dfs(G,0,-1);
  for(int i=0;i<q;i++){
    cout << counter[i] << endl;
  }
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:11: error: request for member 'resize' in 'counter', which is of non-class type 'll [200010]' {aka 'long long int [200010]'}
   39 |   counter.resize(n);
      |           ^~~~~~
Language: C

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = ll(1e12);
const ll mod = ll(1e9) + 1;
#define rep0(i,n) for(ll (i) = 0; (i) < (n); ++(i))
#define rrep0(i,n) for(ll (i) = (n) - 1; (i) >= 0; --(i))
#define rep1(i,n) for(ll (i) = 1; (i) <= (n); ++(i))
#define rrep1(i,n) for(ll (i) = (n); (i) >= 1; --(i))
#define nfor(i,a,b) for(ll (i) = (a); (i) < (b); ++(i))
#define pf(x) cout << (x) << endl
#define all(x) (x).begin(),(x).end()

ll gcd(ll a,ll b){
    if(a < b)swap(a, b);
    if(b == 0) return a;
    return gcd(b,a%b);
}

ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b;
}

ll factorial(ll n){
    ll t = 1;
    rep1(i, n){
        t *= i;
        t %= mod;
    }
    return t;
}

ll power(ll a, ll b){
    a %= mod;
    if(b == 0){
        return 1;
    }
    ll ans = power(a, b / 2);
    ans = ans * ans % mod;
    if(b % 2 == 1){
        ans = ans * a % mod;
    }
    return ans;
}

ll combination(ll a, ll b){
    if((a == b) || (b == 0)){
        return 1;
    }
    if(a < b) return 0;
    ll ans = 1;
    for(ll i = 0; i < b; i++) {
        ans *= (a - i);
        ans %= mod;
        ans *= power(i + 1, mod - 2);
        ans %= mod;
    }
    return ans;
}

int main(){
    ll n,q;
    cin >> n >> q;
    vector<queue<ll>> e(n);
    vector<ll> v(n,0);
    vector<bool> c(n,false);
    c[0] = true;
    rep0(i, n - 1){
        ll a,b;
        cin >> a >> b;
        e[a - 1].push(b - 1);
        e[b - 1].push(a - 1);
    }
    rep0(i, q){
        ll p,x;
        cin >> p >> x;
        v[p - 1] += x;
    }
    queue<ll> to;
    to.push(0);
    while (!to.empty()) {
        ll from = to.front();
        to.pop();
        while (!e[from].empty()) {
            if(c[e[from].front()]){
                e[from].pop();
                continue;
            }
            v[e[from].front()] += v[from];
            to.push(e[from].front());
            c[e[from].front()] = true;
            e[from].pop();
        }
    }
    rep0(i, n)pf(v[i]);
    return 0;
}


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

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

int main() {
    int N, Q, p, q, x, y;
    cin>>N>>Q;
    vector<int> Root(N, 0);
    vector<int> Node(Q, 0);
    vector<int> Ans(N, 0);

    REP(i, 0, N-1){
        cin >> p >> q;
        if()
        Root[q-1] = p-1;
    }
    Root[0] = 0;
    REP(i, 0, Q){
        cin >> y >> x;
        Node[y-1] += x;
    }
    REP(j, 0, N){
        if(j == 0) Ans[j] = Node[j];
        else Ans[j] = Node[j] + Ans[Root[j]];        
        cout << Ans[j] << " ";
    }
    cout << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:12: error: expected primary-expression before ')' token
   14 |         if()
      |            ^
Language: Java

import java.util.*;
import java.lang.*;

public class abc{
	static Tree tree;
	static boolean[] visited;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int q = sc.nextInt();
		tree = new Tree(n);
		for (int i = 0; i < n - 1; i++) {
			tree.union(sc.nextInt() - 1, sc.nextInt() - 1);
		}
		for (int i = 0; i < q; i++) {
			tree.node[sc.nextInt() - 1].value += sc.nextInt();
		}
		visited = new boolean[n];
		visited[0] = true;
		dfs(0);
		for (int i = 0; i < n - 1; i++) {
			System.out.print(tree.node[i].value + " ");
		}
		System.out.println(tree.node[n - 1].value);
	}
	static void dfs(int n) {
		visited[n] = true;
		for (int key : tree.node[n].list) {
			if (!visited[key]) {
				visited[key] = true;
				tree.node[key].value += tree.node[n].value;
				dfs(key);
			}
		}
	}
}

class Node {
	ArrayList<Integer> list;
	int value;
	Node() {
		list = new ArrayList<>();
		value = 0;
	}
}

class Tree {
	Node[] node;
	Tree(int n) {
		node = new Node[n];
		for (int i = 0; i < n; i++) {
			node[i] = new Node();
		}
	}
	void union(int n, int m) {
		node[n].list.add(m);
		node[m].list.add(n);
	}
}

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

#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<int,int>;

int n,q;
vector<bool>seen(n);
void dfs(const Graph &G,int v,vector<int>&cnt){
    seen[v] = true;
    for(auto nv : G[v]){
        if(nv<v)continue;
        if(seen[nv])continue;
        cnt[nv] += cnt[v];
        dfs(G,nv,cnt);
    }
}

int main(){
    cin>>n>>q;
    Graph G(n);
    rep(i,n-1){
        int a,b;cin>>a>>b;
        a--;b--;
        G[a].push_back(b);
    }
    vector<int>cnt(n,0);
    rep(i,q){
        int p,x;cin>>p>>x;
        p--;
        cnt[c] += x;
    }
    seen.assign(n,false);
    dfs(G,0,cnt);
  rep(i,n)cout<<cnt[i]<<" ";
}



Compiler output:
a.cc: In function 'int main()':
a.cc:57:13: error: 'c' was not declared in this scope
   57 |         cnt[c] += x;
      |             ^