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

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vll = vector<vl>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1e9+7;
const ll INF = 2e15;
template<class T> void print(const T& t){ cout << t << endl; }
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; }
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}

int main(){
  ll n,q;
  cin>>n>>q;
  vll tree(n+1,vl(0));
  rep(i,n-1){
      ll a,b;
      cin>>a>>b;
      tree[a].pb(b);
  }
  vl points(n+1,0);
  rep(i,q){
      ll p,x;
      cin>>p>>x;
      points[p]+=x;
  }
  queue<ll> Q;
  Q.push(1);
  while(!Q.empty()){
      ll num=Q.front();
      Q.pop();
      rep(i,sz(tree[num])){
          points[tree[num][j]]+=points[num];
          Q.push(tree[num][j]);
      }
  }
  for(ll i=1;i<=n;i++){
      cout<<points[i]<<" ";
  }
  cout<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:44:28: error: 'j' was not declared in this scope
   44 |           points[tree[num][j]]+=points[num];
      |                            ^
Language: C++

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


void dfs(vector <bool>&seen, vector<vector<int>> &pair, vector<int> &sum, vector<int> &ans, int k){
  seen[k]=true;
  for(int i : pair[k]){
    if(seen[i]==true) continue;
    else {
      ans[i]=ans[k] + sum[i];
      dfs(seen, pair, sum, ans, i);
    }
  }
}

int main(){
  int n,m;
  cin>>n>>m;
  vector <vector<int>> pair(n);
  rep(i,n-1) {
    int a,b;
    cin>>a>>b;
    pair[a-1].push_back(b-1);
    pair[b-1].push_back(a-1);
  }
  vector<bool> seen (n,false);

   vector<int> sum(n,0);
  rep(i,m){
    int p,x;
    cin>>p>>x;
    sum[p-1]+=x;
  }
  vector<int> ans(n);

  dfs(seen, pair, sum, ans, 0);

 
  rep(i,n){
    cout<<a[i]<<" ";
  }

  

}

Compiler output:
a.cc: In function 'int main()':
a.cc:45:11: error: 'a' was not declared in this scope
   45 |     cout<<a[i]<<" ";
      |           ^
Language: C++

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


void dfs(vector <bool>&seen, vector<vector<int>> &pair, vector<int> &root, int k){
  seen[k]=true;
  for(int i : pair[k]){
    if(seen[i]==true) continue;
    else {
      root[i]=k;
      dfs(seen, pair, root, i);
    }
  }
}

int main(){
  int n,m;
  cin>>n>>m;
  vector <vector<int>> pair(n);
  rep(i,n-1) {
    int a,b;
    cin>>a>>b;
    pair[a-1].push_back(b-1);
    pair[b-1].push_back(a-1);
  }
  vector<bool> seen (n,false);
  vector<int> root(n,0);
  dfs(seen, pair, root, 0);

  vector<int> sum(n,0);
  rep(i,m){
    int p,x;
    cin>>p>>x;
    sum[p-1]+=x;
  }
  vector<int> ans(n);
  rep(i,n){
    ans[i]=ans[root[i]] + sum[i];
    cout<<ans[i]<<" "<<;
  }

  

}





Compiler output:
a.cc: In function 'int main()':
a.cc:44:24: error: expected primary-expression before ';' token
   44 |     cout<<ans[i]<<" "<<;
      |                        ^
Language: C++

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


void dfs(vector <bool>&seen, vector<vector<int>> &pair, vector<int> &root, int k){
  seen[k]=true;
  for(int i : pair[k]){
    if(seen[i]==true) continue;
    else {
      root[i]=k;
      dfs(seen, pair, root, i);
    }
  }
}

int main(){
  int n,m;
  cin>>n>>m;
  vector <vector<int>> pair(n);
  rep(i,n-1) {
    int a,b;
    cin>>a>>b;
    pair[a-1].push_back(b-1);
    pair[b-1].push_back(a-1);
  }
  vector<bool> seen (n,false);
  vector<int> root(n,0);
  dfs(seen, pair, root, 0);

  vector<int> sum(n,0);
  rep(i,m){
    int p,x;
    cin>>p>>x;
    sum[p-1]+=x;
  }
  vector<int> ans(n);
  rep(i,n){
    ans[i]=ans[root[i]] + sum[i];
    cout<<ans[i]<<" "<<;;
  }

  

}





Compiler output:
a.cc: In function 'int main()':
a.cc:44:24: error: expected primary-expression before ';' token
   44 |     cout<<ans[i]<<" "<<;;
      |                        ^
Language: Java

n,q=map(int,input().split())
X=[[] for _ in range(n)]
for i in range(n-1):
    a,b=map(int,input().split())
    X[a-1].append(b-1)

C=[0]*n

def dfs(p,x):
    C[p]+=x
    for i in X[p]:
        dfs(i,x)


for i in range(q):
    p,x=map(int,input().split())
    dfs(p-1,x)

print(*C)

Compiler output:
Main.java:1: error: class, interface, enum, or record expected
n,q=map(int,input().split())
^
1 error
Language: C++

// https://atcoder.jp/contests/abc138/tasks/abc138_d
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define DIV(a, b) ((a - 1) / b + 1)

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N, Q;
    cin >> N >> Q;
    vector<vector<int>> G(N + 1);
    REP(i, N - 1) {
        int a, b;
        cin >> a >> b;
        G[a].emplace_back(b);
     　 G[b].emplace_back(a);
    }
    vector<int> ans(N + 1);
    while(Q--) {
        int p, q;
        cin >> p >> q;
        ans[p] += q;
    }

    queue<int> que;
    que.push(1);
    while(!que.empty()) {
        int t = que.front();
        que.pop();
        for(auto &x : G[t]) {
            ans[x] += ans[t];
            que.push(x);
        }
    }
    FOR(i, 1, N + 1) {
        cout << ans[i] << (i == N ? "\n" : " ");
    }

    return 0;
}


Compiler output:
a.cc:22:6: error: extended character 　 is not valid in an identifier
   22 |      　 G[b].emplace_back(a);
      |      ^
a.cc: In function 'int main()':
a.cc:22:6: error: '\U00003000' was not declared in this scope
   22 |      　 G[b].emplace_back(a);
      |      ^~
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAX_N = 200000;
int N,D[MAX_N] = {};vector<int> v[MAX_N];
bool visit[MAX_N] = {};
void dfs(int s){
  visit[s] = true;
  for(int i=0;i<v[s].size();i++){
    if(!visit[v[s][i]]){
      D[v[s][i]] += D[s];
      dfs(v[s][i]);
    }
  }
}
int main(){
  int Q,i,a,b,p,x;scanf("%d%d",&N,&Q);
  for(i=0;i<N-1;i++){
    scanf("%d%d",&a,&b);a--;b--;
    v[a].push_back(b);
    v[b].push_back(a);
  }
  for(i=0;i<Q;i++){
    scanf("%d%d",&p,&x);p--;
    D[p] += x;
  }
  dfs(0);
  for(i=0;i<N;i++) printf("%d ",D[i]);
  printf("\n");
}

Compiler output:
a.cc: In function 'void dfs(int)':
a.cc:8:3: error: reference to 'visit' is ambiguous
    8 |   visit[s] = true;
      |   ^~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:80,
                 from a.cc:1:
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:6:6: note:                 'bool visit [200000]'
    6 | bool visit[MAX_N] = {};
      |      ^~~~~
a.cc:10:9: error: reference to 'visit' is ambiguous
   10 |     if(!visit[v[s][i]]){
      |         ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:6:6: note:                 'bool visit [200000]'
    6 | bool visit[MAX_N] = {};
      |      ^~~~~
Language: C

#include <stdio.h>

int counter[200000], ans[200000];
int n, q;
int a[200000], b[200000], p[200000], x[200000], c[200000];
int n_list[200000][20000], n_count[200000];


int DFS(int p_i, int x_i){
    ans[p_i] += x_i;
    int i;
    for(i = 0; i < n_count[p_i]; i++){
        DFS(n_list[p_i][i], x_i);
    }
    return 0;
}


int main(void){
    scanf("%d%d", &n, &q);
    int i, j;
    
    for(i = 0; i < n - 1; i++){
        scanf("%d%d", &a[i], &b[i]);
        a[i]--;
        b[i]--;
    }
    for(i = 0; i < q; i++){
        scanf("%d%d", &p[i], &x[i]);
        p[i]--;
    }
    
    for(i = 0; i < n; i++){
        n_count[i] = 0;
        c[i] = 0;
    }

    for(i = 0; i < n - 1; i++){
        n_list[a[i]][n_count[a[i]]] = b[i];
        n_count[a[i]]++;
    }

    for(i = 0; i < q; i++){
        c[p[i]] = x[i];
    }

    for(i = 0; i < n; i++){
        DFS(i, c[i]);
    }

    for(i = 0; i < n; i++){
        printf("%d", ans[i]);
        if(i == n - 1){
            break;
        }
        printf(" ");
    }
    printf("\n");

    return 0;
}

Compiler output:
/tmp/ccvp16Ip.o: in function `DFS':
main.c:(.text+0x92): relocation truncated to fit: R_X86_64_PC32 against symbol `n_count' defined in .bss section in /tmp/ccvp16Ip.o
/tmp/ccvp16Ip.o: in function `main':
main.c:(.text+0x249): relocation truncated to fit: R_X86_64_PC32 against symbol `n_count' defined in .bss section in /tmp/ccvp16Ip.o
main.c:(.text+0x2c5): relocation truncated to fit: R_X86_64_PC32 against symbol `n_count' defined in .bss section in /tmp/ccvp16Ip.o
main.c:(.text+0x32a): relocation truncated to fit: R_X86_64_PC32 against symbol `n_count' defined in .bss section in /tmp/ccvp16Ip.o
main.c:(.text+0x341): relocation truncated to fit: R_X86_64_PC32 against symbol `n_count' defined in .bss section in /tmp/ccvp16Ip.o
collect2: error: ld returned 1 exit status
Language: C

#include <stdio.h>

int counter[200000], ans[200000];
int n, q;
int a[200000], b[200000], p[200000], x[200000], c[200000];
int n_list[200000][200000], n_count[200000];


int DFS(int p_i, int x_i){
    ans[p_i] += x_i;
    int i;
    for(i = 0; i < n_count[p_i]; i++){
        DFS(n_list[p_i][i], x_i);
    }
    return 0;
}


int main(void){
    scanf("%d%d", &n, &q);
    int i, j;
    
    for(i = 0; i < n - 1; i++){
        scanf("%d%d", &a[i], &b[i]);
        a[i]--;
        b[i]--;
    }
    for(i = 0; i < q; i++){
        scanf("%d%d", &p[i], &x[i]);
        p[i]--;
    }
    
    for(i = 0; i < n; i++){
        n_count[i] = 0;
        c[i] = 0;
    }

    for(i = 0; i < n - 1; i++){
        n_list[a[i]][n_count[a[i]]] = b[i];
        n_count[a[i]]++;
    }

    for(i = 0; i < q; i++){
        c[p[i]] = x[i];
    }

    for(i = 0; i < n; i++){
        DFS(i, c[i]);
    }

    for(i = 0; i < n; i++){
        printf("%d", ans[i]);
        if(i == n - 1){
            break;
        }
        printf(" ");
    }
    printf("\n");

    return 0;
}

Compiler output:
/tmp/cc3DxjVO.o: in function `DFS':
main.c:(.text+0x92): relocation truncated to fit: R_X86_64_PC32 against symbol `n_count' defined in .bss section in /tmp/cc3DxjVO.o
/tmp/cc3DxjVO.o: in function `main':
main.c:(.text+0x249): relocation truncated to fit: R_X86_64_PC32 against symbol `n_count' defined in .bss section in /tmp/cc3DxjVO.o
main.c:(.text+0x2c5): relocation truncated to fit: R_X86_64_PC32 against symbol `n_count' defined in .bss section in /tmp/cc3DxjVO.o
main.c:(.text+0x32a): relocation truncated to fit: R_X86_64_PC32 against symbol `n_count' defined in .bss section in /tmp/cc3DxjVO.o
main.c:(.text+0x341): relocation truncated to fit: R_X86_64_PC32 against symbol `n_count' defined in .bss section in /tmp/cc3DxjVO.o
collect2: error: ld returned 1 exit status
Language: C

#include <stdio.h>

int counter[200000];
int n, q;
int a[200000], b[200000], p[200000], x[200000];
short int n_list[200000][10000], n_count[200000];


int DFS(int p_i, int x_i){
    counter[p_i] += x_i;
    int i;
    for(i = 0; i < n_count[p_i]; i++){
        DFS(n_list[p_i][i], x_i);
    }
    return 0;
}


int main(void){
    scanf("%d%d", &n, &q);
    int i, j;
    
    for(i = 0; i < n - 1; i++){
        scanf("%d%d", &a[i], &b[i]);
        a[i]--;
        b[i]--;
    }
    for(i = 0; i < q; i++){
        scanf("%d%d", &p[i], &x[i]);
        p[i]--;
    }
    
    for(i = 0; i < n; i++){
        counter[i] = 0;
        n_count[i] = 0;
    }


    for(i = 0; i < n - 1; i++){
        n_list[a[i]][n_count[a[i]]] = b[i];
        n_count[a[i]]++;
    }

    for(i = 0; i < q; i++){
        DFS(p[i], x[i]);
    }

    for(i = 0; i < n; i++){
        printf("%d", counter[i]);
        if(i == n - 1){
            break;
        }
        printf(" ");
    }
    printf("\n");

    return 0;
}

Compiler output:
/tmp/cc3t8VlT.o: in function `DFS':
main.c:(.text+0x8c): relocation truncated to fit: R_X86_64_PC32 against symbol `n_count' defined in .bss section in /tmp/cc3t8VlT.o
/tmp/cc3t8VlT.o: in function `main':
main.c:(.text+0x25c): relocation truncated to fit: R_X86_64_PC32 against symbol `n_count' defined in .bss section in /tmp/cc3t8VlT.o
main.c:(.text+0x2cf): relocation truncated to fit: R_X86_64_PC32 against symbol `n_count' defined in .bss section in /tmp/cc3t8VlT.o
main.c:(.text+0x319): relocation truncated to fit: R_X86_64_PC32 against symbol `n_count' defined in .bss section in /tmp/cc3t8VlT.o
main.c:(.text+0x32f): relocation truncated to fit: R_X86_64_PC32 against symbol `n_count' defined in .bss section in /tmp/cc3t8VlT.o
collect2: error: ld returned 1 exit status
Language: C

#include <stdio.h>

int counter[200000];
int n, q;
int a[200000], b[200000], p[200000], x[200000];
int n_list[200000][10000], n_count[200000];


int DFS(int p_i, int x_i){
    counter[p_i] += x_i;
    int i;
    for(i = 0; i < n_count[p_i]; i++){
        DFS(n_list[p_i][i], x_i);
    }
    return 0;
}


int main(void){
    scanf("%d%d", &n, &q);
    int i, j;
    
    for(i = 0; i < n - 1; i++){
        scanf("%d%d", &a[i], &b[i]);
        a[i]--;
        b[i]--;
    }
    for(i = 0; i < q; i++){
        scanf("%d%d", &p[i], &x[i]);
        p[i]--;
    }
    
    for(i = 0; i < n; i++){
        counter[i] = 0;
        n_count[i] = 0;
    }


    for(i = 0; i < n - 1; i++){
        n_list[a[i]][n_count[a[i]]] = b[i];
        n_count[a[i]]++;
    }

    for(i = 0; i < q; i++){
        DFS(p[i], x[i]);
    }

    for(i = 0; i < n; i++){
        printf("%d", counter[i]);
        if(i == n - 1){
            break;
        }
        printf(" ");
    }
    printf("\n");

    return 0;
}

Compiler output:
/tmp/cc4X9e5P.o: in function `DFS':
main.c:(.text+0x92): relocation truncated to fit: R_X86_64_PC32 against symbol `n_count' defined in .bss section in /tmp/cc4X9e5P.o
/tmp/cc4X9e5P.o: in function `main':
main.c:(.text+0x264): relocation truncated to fit: R_X86_64_PC32 against symbol `n_count' defined in .bss section in /tmp/cc4X9e5P.o
main.c:(.text+0x2c5): relocation truncated to fit: R_X86_64_PC32 against symbol `n_count' defined in .bss section in /tmp/cc4X9e5P.o
main.c:(.text+0x32a): relocation truncated to fit: R_X86_64_PC32 against symbol `n_count' defined in .bss section in /tmp/cc4X9e5P.o
main.c:(.text+0x341): relocation truncated to fit: R_X86_64_PC32 against symbol `n_count' defined in .bss section in /tmp/cc4X9e5P.o
collect2: error: ld returned 1 exit status
Language: C

#include <stdio.h>

int counter[200000];
int n, q;
int a[200000], b[200000], p[200000], x[200000];
int n_list[200000][200000], n_count[200000];


int DFS(int p_i, int x_i){
    counter[p_i] += x_i;
    int i;
    for(i = 0; i < n_count[p_i]; i++){
        DFS(n_list[p_i][i], x_i);
    }
    return 0;
}


int main(void){
    scanf("%d%d", &n, &q);
    int i, j;
    
    for(i = 0; i < n - 1; i++){
        scanf("%d%d", &a[i], &b[i]);
        a[i]--;
        b[i]--;
    }
    for(i = 0; i < q; i++){
        scanf("%d%d", &p[i], &x[i]);
        p[i]--;
    }
    
    for(i = 0; i < n; i++){
        counter[i] = 0;
        n_count[i] = 0;
    }


    for(i = 0; i < n - 1; i++){
        n_list[a[i]][n_count[a[i]]] = b[i];
        n_count[a[i]]++;
    }

    for(i = 0; i < q; i++){
        DFS(p[i], x[i]);
    }

    for(i = 0; i < n; i++){
        printf("%d", counter[i]);
        if(i == n - 1){
            break;
        }
        printf(" ");
    }
    printf("\n");

    return 0;
}

Compiler output:
/tmp/ccRsVDfP.o: in function `DFS':
main.c:(.text+0x92): relocation truncated to fit: R_X86_64_PC32 against symbol `n_count' defined in .bss section in /tmp/ccRsVDfP.o
/tmp/ccRsVDfP.o: in function `main':
main.c:(.text+0x264): relocation truncated to fit: R_X86_64_PC32 against symbol `n_count' defined in .bss section in /tmp/ccRsVDfP.o
main.c:(.text+0x2c5): relocation truncated to fit: R_X86_64_PC32 against symbol `n_count' defined in .bss section in /tmp/ccRsVDfP.o
main.c:(.text+0x32a): relocation truncated to fit: R_X86_64_PC32 against symbol `n_count' defined in .bss section in /tmp/ccRsVDfP.o
main.c:(.text+0x341): relocation truncated to fit: R_X86_64_PC32 against symbol `n_count' defined in .bss section in /tmp/ccRsVDfP.o
collect2: error: ld returned 1 exit status
Language: C++

#include <bits/stdc++.h>

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

using namespace std;

using ll = long long;
using P = pair<int, int>;

void calcChildrenCount(int i,
                       int x,
                       vector<vector<int>> &tree,
                       vector<ll> &sum) {
  sum.at(i) += (ll) x;
  for (int child : tree.at(i)) {
    calcChildrenCount(child, x, tree, sum);
  }
}

vector<int> getChildren(int i, vector<vector<int>> &tree) {
  vector<int> children;
  children.push_back(i);
  for (int child : tree.at(i)) {
    vector<int> children2 = getChildren(child, tree);
    rep(i, children2.size()) {
      children.push_back(children2.at(i));
    }
  }
  return children;
}

int main() {
  int n, q;
  cin >> n >> q;
  vector<P> ab(n - 1);
  rep(i, n - 1) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    ab.at(i) = make_pair(a, b);
  }
  vector<P> px(q);
  rep(i, q) {
    int p, x;
    cin >> p >> x;
    p--;
    px.at(i) = make_pair(p, x);
  }
  vector<vector<int>> t(n);
  rep(i, n - 1) {
    int a = ab.at(i).first;
    int b = ab.at(i).second;
    t.at(a).push_back(b);
  }
  vector<vector<int>> children(n);
  rep(i, n) {
    children.at(i) = getChildren(i, t);
  }
  vector<ll> sum(n, 0);
  for (auto v : px) {
    int p = v.first;
    int x = v.second;
    vector<int> c = 
    calcChildrenCount(p, x, t, sum);
  }
  for (int i = 0; i < sum.size(); i++) {
    if (i != 0) {
      cout << " ";
    }
    int x = sum.at(i);
    cout << x;
  }
  cout << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:65:22: error: conversion from 'void' to non-scalar type 'std::vector<int>' requested
   65 |     calcChildrenCount(p, x, t, sum);
      |     ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
Language: C++

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

#define ll long long

ll count[200010];
vector<vector<ll>> v(200010);

void DFS(ll p, ll x) {
  count[p] += x;
  
  for (int i = 0; i < v[p].size(); i++) {
    ll q = v[p][i];
    DFS(q, x);
  }
}


int main() {
  ll N, Q;
  cin >> N >> Q;
  
  
  // 木を作る
  for (int i = 0; i < N; i++) {
    ll a, b;
    cin >> a >> b;
    
    v[a].push_back(b);
  }
  
  
  // DFS
  for (int i = 0; i < Q; i++) {
    int p, x;
    cin >> p >> x;
    DFS(p, x);
  }
  
  
  // output
  for (int i = 1; i <= N; i++) {
    cout << count[i] << " ";
  }
  cout << endl;
  
}

Compiler output:
a.cc: In function 'void DFS(long long int, long long int)':
a.cc:10:3: error: reference to 'count' is ambiguous
   10 |   count[p] += x;
      |   ^~~~~
In file included from /usr/include/c++/14/algorithm:86,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: candidates are: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
  101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~~
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:4025:5: note:                 'template<class _IIter, class _Tp> typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)'
 4025 |     count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
      |     ^~~~~
a.cc:6:4: note:                 'long long int count [200010]'
    6 | ll count[200010];
      |    ^~~~~
a.cc: In function 'int main()':
a.cc:43:13: error: reference to 'count' is ambiguous
   43 |     cout << count[i] << " ";
      |             ^~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: candidates are: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
  101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~~
/usr/include/c++/14/bits/stl_algo.h:4025:5: note:                 'template<class _IIter, class _Tp> typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)'
 4025 |     count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
      |     ^~~~~
a.cc:6:4: note:                 'long long int count [200010]'
    6 | ll count[200010];
      |    ^~~~~
Language: C++

#include <iostream>
#include <vector>
#include <deque>
#include <algorithm>
#include <numeric>
#include <string>
#include <cstring>
#include <list>
#include <unordered_set>
#include <tuple>
#include <cmath>
#include <limits>
#include <type_traits>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <set>
#include <bitset>
#include <regex>
#include <random>
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
#define rep(i,n)for(ll i=0;i<n;++i)
#define exout(x) printf("%.10f\n", x)
const double pi = acos(-1.0);
const ll MOD = 1000000007;
const ll INF = 1e10;
const ll MAX_N = 1010;

//組み合わせの余りを求める
ll fac[MAX_N], finv[MAX_N], inv[MAX_N];

void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX_N; i++) {
		fac[i] = fac[i - 1] * i;
	}
}

// 二項係数計算
long long COM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	if (n > k * 2) {

	}
	return fac[n] / (fac[k] * fac[n - k]);
}

ll dp[201010][2];
ll dx[4] = { 0,0,-1,1 };
ll dy[4] = { -1,1,0,0 };
char c[10][10];
bool flag[10][10];
bool flag2[10][10];
vector<vector<ll>>tree;
ll cnt[202020];
bool flag[202020];

void dfs(ll x) {
	flag[x] = true;
	for (auto nv : tree[x]) {
		if (flag[nv] == false) {
			cnt[nv] += cnt[x];
			dfs(nv);
		}
	}
}

//long longしか使わない
//素数は1より大きい
//lower_boundは指定したkey以上の要素の一番左のイテレータをかえす
//upper_boundは指定したkeyより大きい要素の一番左のイテレータをかえす
int main() {
	ll n, q;
	cin >> n >> q;
	tree.resize(n);
	rep(i, n - 1) {
		ll a, b;
		cin >> a >> b;
		a--;
		b--;
		tree[a].push_back(b);
		tree[b].push_back(a);
	}
	rep(i, q) {
		ll p, x;
		cin >> p >> x;
		p--;
		cnt[p] += x;
	}
	dfs(0);
	rep(i, n) {
		cout << cnt[i] << endl;
	}
	return 0;
}


Compiler output:
a.cc:65:6: error: conflicting declaration 'bool flag [202020]'
   65 | bool flag[202020];
      |      ^~~~
a.cc:61:6: note: previous declaration as 'bool flag [10][10]'
   61 | bool flag[10][10];
      |      ^~~~
a.cc: In function 'void dfs(ll)':
a.cc:68:17: error: incompatible types in assignment of 'bool' to 'bool [10]'
   68 |         flag[x] = true;
      |         ~~~~~~~~^~~~~~
a.cc:70:30: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   70 |                 if (flag[nv] == false) {
      |                     ~~~~~~~~~^~~~~~~~
Language: C++

#include<bits/stdc++.h>
#include<cctype>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
#define all(v) (v).begin(),(v).end()
typedef long long int ll;
#define pi 3.1415926535897932384
#define E9 1000000000
#define eps 1e-4
#define pii pair<int,int>


int main(){
  int N, Q; cin >> N >> Q;
  vector<int> connect[N];
  rep(i,N-1){
    int a, b;
    cin >> a >> b;
    a--, b--;
    connect[b].push_back(a);
    connect[a].push_back(b);
  }
  
  int cnt[N] = {};
  rep(j,Q){
    int p, x;
    cin >> p >> x;
    p--;
    cnt[p] += x;
  }

  queue<int> q;
  bool passed[N] = {};
  q.push(0);
  while (!q.empty()){
    auto node = q.front(); q.pop();
    passed[node] = true;
    for (auto n : connect[node]){
      if (passed[n]==false) {
        tree[node].push_back(n);
        cnt[n] += cnt[node];
        q.push(n);
      }
    }
  }

  rep(i,N) {
    if (i>0) cout << " ";
    cout << cnt[i];
  }
  cout << endl;



  // cout << fixed << setprecision(10);
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:40:9: error: 'tree' was not declared in this scope; did you mean 'free'?
   40 |         tree[node].push_back(n);
      |         ^~~~
      |         free
Language: C++

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

vector<ll> dfs(vector<bool> &seen, graph &G, int v, int cnt, vector<ll> &point, vector<ll> &ans)
{
  seen[v] = true; // v を訪問済にする
  // v から行ける各頂点 next_v について
  cnt += point[v];
  ans[v] = cnt;
  for (auto next_v : G[v])
  {
    if (seen[next_v])
      continue;                            // next_v が探索済だったらスルー
    dfs(seen, G, next_v, cnt, point, ans); // 再帰的に探索
  }
  cnt -= point[v];
  return ans;
}
int main()
{
  int n, q;
  cin >> n >> q;
  graph g;
  rep(i, n-1, 1)
  {
    int a, b;
    cin >> a >> b;
    g[a - 1].push_back(b - 1);
    g[b - 1].push_back(a - 1);
  }
  vector<ll> score(n, 0);
  rep(i, q, 1)
  {
    int p, x;
    cin >> p >> x;
    score[p - 1] += x;
  }
  vector<ll> ans(n, 0);
  vector<bool> seen(n, false);
  int vi = 0;
  int ct = 0;
  vector<ll> answer = dfs(seen, g, vi, ct, score, ans);
  rep(i, n, 1)
  {
    cout << answer[i] << " ";
  }
  cout << endl;

Compiler output:
a.cc: In function 'int main()':
a.cc:51:16: error: expected '}' at end of input
   51 |   cout << endl;
      |                ^
a.cc:24:1: note: to match this '{'
   24 | {
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
vector<ll> q;
// 深さ優先探索
vector<bool> seen;
void dfs(const Graph &G, int v) {
    v = p[i];
    seen[v] = true; // v を訪問済にする
    q[v] += z[i];
    // v から行ける各頂点 next_v について
    for (auto next_v : G[v]) { 
        if (seen[next_v]) continue; // next_v が探索済だったらスルー
        dfs(G, next_v); // 再帰的に探索
    }
}

int main() {
    // 頂点数と辺数、s と t
    
    int N, M, s, t; cin >> N >> M;

    // グラフ入力受取
    Graph G(N);
    for (int i = 0; i < N; ++i) {
        int a, b;
        cin >> a >> b;
        G[a].push_back(b);
    }
    ll a[N]={};
    ll p[M]={};
    ll z[M]={};
    for(ll i=0; i<M; i++){
    cin>>p[i];
    cin>>z[i];}
    // 頂点 s をスタートとした探索
    seen.assign(N, false); // 全頂点を「未訪問」に初期化
    dfs(G, s);

    // t に辿り着けるかどうか
    for(ll i=0; i<n; i++){
    cout<<q[i]<<" ";}
}

Compiler output:
a.cc:4:8: error: 'll' was not declared in this scope
    4 | vector<ll> q;
      |        ^~
a.cc:4:10: error: template argument 1 is invalid
    4 | vector<ll> q;
      |          ^
a.cc:4:10: error: template argument 2 is invalid
a.cc: In function 'void dfs(const Graph&, int)':
a.cc:8:9: error: 'p' was not declared in this scope
    8 |     v = p[i];
      |         ^
a.cc:8:11: error: 'i' was not declared in this scope
    8 |     v = p[i];
      |           ^
a.cc:10:6: error: invalid types 'int[int]' for array subscript
   10 |     q[v] += z[i];
      |      ^
a.cc:10:13: error: 'z' was not declared in this scope
   10 |     q[v] += z[i];
      |             ^
a.cc: In function 'int main()':
a.cc:30:5: error: 'll' was not declared in this scope
   30 |     ll a[N]={};
      |     ^~
a.cc:31:7: error: expected ';' before 'p'
   31 |     ll p[M]={};
      |       ^~
      |       ;
a.cc:32:7: error: expected ';' before 'z'
   32 |     ll z[M]={};
      |       ^~
      |       ;
a.cc:33:11: error: expected ';' before 'i'
   33 |     for(ll i=0; i<M; i++){
      |           ^~
      |           ;
a.cc:33:17: error: 'i' was not declared in this scope
   33 |     for(ll i=0; i<M; i++){
      |                 ^
a.cc:34:10: error: 'p' was not declared in this scope
   34 |     cin>>p[i];
      |          ^
a.cc:35:10: error: 'z' was not declared in this scope
   35 |     cin>>z[i];}
      |          ^
a.cc:41:11: error: expected ';' before 'i'
   41 |     for(ll i=0; i<n; i++){
      |           ^~
      |           ;
a.cc:41:17: error: 'i' was not declared in this scope
   41 |     for(ll i=0; i<n; i++){
      |                 ^
a.cc:41:19: error: 'n' was not declared in this scope
   41 |     for(ll i=0; i<n; i++){
      |                   ^
Language: C++

#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
//using namespace boost::multiprecision;
typedef long long int ll;
typedef long double ld;
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; }
const long long INF = 1LL << 60;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}
bool pairCompareSecond(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.second < secondElof.second;
}
#define MAX_N 100100
#define MOD 998244353
// 四方向への移動ベクトル
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}

vector<ll> ki[1000000];
ll c[1000000];
ll ans[1000000];
bool visited[1000000];
void dfs(ll p,ll x){
    ans[p]=x+c[p];
    for (ll i=0;i<ki[p].size();i++){
        dfs(ki[p][i],x+c[p]);
    }
}

int main(){
    ll n,q;
    cin >> n >> q;
    fill(c,c+n,0);
    ll oya[n];
    fill(oya,oya+n,true;)
    for (ll i=0;i<n-1;i++){
        ll a,b;
        cin >> a >> b;
        a--;
        b--;
        oya[b]=false;
        ki[a].push_back(b);
    }
    for (ll i=0;i<q;i++){
        ll p,x;
        cin >> p >> x;
        p--;
        c[p]=c[p]+x;
    }
    for (ll i=0;i<n;i++){
        if (oya[i])dfs(i,0);
    }
    for (ll i=0;i<n;i++){
        cout << ans[i] << " ";
    }
    cout << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:24: error: expected ')' before ';' token
   40 |     fill(oya,oya+n,true;)
      |         ~              ^
      |                        )
a.cc:40:25: error: expected primary-expression before ')' token
   40 |     fill(oya,oya+n,true;)
      |                         ^
a.cc:41:17: error: 'i' was not declared in this scope
   41 |     for (ll i=0;i<n-1;i++){
      |                 ^
Language: C

#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define INF 100000000
#define rep(i,s,n) for (int i = (int)(s); i < (int)(n); i++)
#define mp make_pair
ll mod = 1000000007;
ll mod2 = 998244353;
vector<vector<int>> G(404040); 
vector<int> score(404040,0);
vector<int> ans(404040,-1);

int dfs(int x,int sum){
    if (ans[x]!=-1) return 0;
    sum+=score[x];
    ans[x] = sum;
    for (auto nex : G[x]){
        dfs(nex,sum);
    }
}

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

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

#include <bits/stdc++.h>
using namespace std;
  
int main() {
  long long n,q;
  cin>>n>>q;
  vector<vector<long long>>c(n+1);
  for(int i=0;i<n-1;i++){
    long long a,b;
    cin>>a>>b;
    c[a].push_back(b);
    c[b].push_back(a);
  }
  vector<long long>ans(n+1);
  for(int i=0;i<q;i++){
    int a,b;
    cin>>a>>b;
    ans[a]+=b;
  }
  vector<bool>p(n+1);
  queue<long long>qq;
  qq.push(1);
  while(!qq.empty()){
    long long x=qq.front();
    qq.pop();
    for(int i=0;i<c[x].size();i++){
      if(!p[c[x][i]]){
        p[c[x][i]]=true;
        q.push(c[x][i]);
        ans[c[x][i]]+=ans[x];
      }
    }
  }
  long long answer=0;
  for(int i=1;i<=n;i++) answer+=ans[i];
  cout<<answer<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:11: error: request for member 'push' in 'q', which is of non-class type 'long long int'
   29 |         q.push(c[x][i]);
      |           ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define pb emplace_back
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
#define PQ(T) priority_queue<T>
#define SPQ(T) priority_queue<T,vector<T>,greater<T>>
#define dame(a) {out(a);return 0;}
#define decimal cout<<fixed<<setprecision(15);
#define dupli(a) a.erase(unique(all(a)),a.end())
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef tuple<ll,ll,ll,ll> PPP;
typedef multiset<ll> S;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
using vvvvi=vector<vvvi>;
using vp=vector<P>;
using vvp=vector<vp>;
using vb=vector<bool>;
using vvb=vector<vb>;
const ll inf=1001001001001001001;
const ll INF=1001001001;
const ll mod=1000000007;
const double eps=1e-10;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())cout<<'('<<v[i].fi<<','<<v[i].se<<')';cout<<'\n';}
template<class T> void outvvp(T v){rep(i,v.size())outvp(v[i]);}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size())outv(v[i]);}
template<class T> bool isin(T x,T l,T r){return (l)<=(x)&&(x)<=(r);}
template<class T> void yesno(T b){if(b)out("yes");else out("no");}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
template<class T> void YESNO(T b){if(b)out("YES");else out("NO");}
template<class T> void noyes(T b){if(b)out("no");else out("yes");}
template<class T> void NoYes(T b){if(b)out("No");else out("Yes");}
template<class T> void NOYES(T b){if(b)out("NO");else out("YES");}
void outs(ll a,ll b){if(a>=inf-100)out(b);else out(a);}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll modpow(ll a,ll b){ll res=1;a%=mod;while(b){if(b&1)res=res*a%mod;a=a*a%mod;b>>=1;}return res;}
vvi g;
vi ans;
void dfs(int i,int p){
    for(ll x:g[i])if(x!=p){
        ans[x]+=ans[i];dfs(x,i);
    }
}
void solve(){
    ll n,q;cin>>n>>q;
    g=vvi(n);
    rep(i,n-1){
        ll a,b;cin>>a>>b;a--;b--;
        g[a].pb(b);
        g[b].pb(a);
    }
    ans=vi(n);
    rep(i,q){
        ll c,d;cin>>c>>d;
        ans[c-1]+=d;
    }
    dfs(0,-1);
    outv(ans);
}

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

#include <bits/stdc++.h>
#include <cstdlib>
#include <cmath>
#include <algorithm>
using namespace std;
using ll = long long;
using P = pair<int,ll>;
using Graph= vector<vector<ll>>; 
#define rep(i,n) for (ll i=0; i < (n); ++i)
#define rep2(i,n,m) for(ll i=n;i<=m;i++)
#define rep3(i,n,m) for(ll i=n;i>=m;i--)
#define pb push_back
#define eb emplace_back
#define ppb pop_back
#define mpa make_pair
const ll INF=1e18 ;
inline void chmax(ll& a,ll b){a=max(a,b);}
inline void chmin(ll& a,ll b){a=min(a,b);}

vector<ll> ans ;
vector<bool> seen ;
 void dfs(const Graph & G,ll v){
   seen[v]=true ;
   for(auto u: G[v] ){
   if(seen[u]) continue ;
   ans[u]+=ans[v] ;
   dfs(G,u) ;
 }
}
int main(){
ll n;cin>>n ;
 ll q ; cin>> q ;
 Graph g(n) ;
  rep(i,n-1){
    ll a,b ;
    cin>>a>>b ;
    a-- ;b-- ;
    g[a].pb(b) ;
    g[b].pb(a) ;
  }
  ans.resize() ;
  rep(i,q){
    int p,x ;
    cin>>p>> x ;
    p-- ;
    ans[p]+= x ;
  }
  
  seen.assign(n,false) ;
  
  dfs(g,0) ;
  rep(i,n) cout<<ans[i] <<endl ;
 return 0;
  }

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

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




Compiler output:
a.cc:1:1: error: 'vector' does not name a type
    1 | vector<int> to[200005];
      | ^~~~~~
a.cc:2:1: error: 'vector' does not name a type
    2 | vector<int> ans;
      | ^~~~~~
a.cc: In function 'void dfs(int, int)':
a.cc:5:15: error: 'to' was not declared in this scope
    5 |     for(int u:to[v]){
      |               ^~
a.cc:7:9: error: 'ans' was not declared in this scope
    7 |         ans[u]+=ans[v];
      |         ^~~
a.cc: In function 'int main()':
a.cc:14:5: error: 'cin' was not declared in this scope
   14 |     cin>>n>>q;
      |     ^~~
a.cc:19:9: error: 'to' was not declared in this scope
   19 |         to[a].push_back(b);
      |         ^~
a.cc:22:5: error: 'ans' was not declared in this scope
   22 |     ans.resize(n);
      |     ^~~
a.cc:31:9: error: 'cout' was not declared in this scope
   31 |         cout<<ans[i]<<' ';
      |         ^~~~
a.cc:33:5: error: 'cout' was not declared in this scope
   33 |     cout<<endl;
      |     ^~~~
a.cc:33:11: error: 'endl' was not declared in this scope
   33 |     cout<<endl;
      |           ^~~~
Language: C++

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


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

 void dfs(int v,int p=-1){

   for(int u:to[v])
  {
   if(u == p) continue;

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

  return ;
 }

int main(){

 int n,Q;
 cin>>n>>Q;

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

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

  dfs(0);
  for(int i=0;i<n;i++)
    cout<<a[i]<<" ";

    cout<<endl;

 return 0;
}






Compiler output:
a.cc: In function 'int main()':
a.cc:46:11: error: 'a' was not declared in this scope
   46 |     cout<<a[i]<<" ";
      |           ^
Language: C++

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


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

 void dfs(v,int p=-1){

   for(int u:to[v])
  {
   if(u == p) continue;

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

  return ;
 }

int main(){

 int n,Q;
 cin>>n>>Q;

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

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

  dfs(0);
  for(int i=0;i<n;i++)
    cout<<a[i]<<" ";

    cout<<endl;

 return 0;
}






Compiler output:
a.cc:9:7: error: variable or field 'dfs' declared void
    9 |  void dfs(v,int p=-1){
      |       ^~~
a.cc:9:11: error: 'v' was not declared in this scope
    9 |  void dfs(v,int p=-1){
      |           ^
a.cc:9:13: error: expected primary-expression before 'int'
    9 |  void dfs(v,int p=-1){
      |             ^~~
a.cc: In function 'int main()':
a.cc:44:3: error: 'dfs' was not declared in this scope; did you mean 'ffs'?
   44 |   dfs(0);
      |   ^~~
      |   ffs
a.cc:46:11: error: 'a' was not declared in this scope
   46 |     cout<<a[i]<<" ";
      |           ^
Language: C++

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

  ll n,q;
  vector<ll> to[200100100];
  vector<ll> cnt(n+10,0);

void counter(ll v, ll point){
  cnt[v]+=point;
  if(to[v].empty())return;
  rep(i,to[v].size()){
    counter(to[v][i],point);
  }
}

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

  for(ll i=1; i<=n; i++){
    if(i==n){
      cout<<cnt[i]<<endl;
      return 0;
    }
    cout<<cnt[i]<<" ";
  }
}

Compiler output:
/tmp/ccRf52Qp.o: in function `counter(long long, long long)':
a.cc:(.text+0x1a): relocation truncated to fit: R_X86_64_PC32 against symbol `cnt' defined in .bss section in /tmp/ccRf52Qp.o
/tmp/ccRf52Qp.o: in function `main':
a.cc:(.text+0x1f2): relocation truncated to fit: R_X86_64_PC32 against symbol `cnt' defined in .bss section in /tmp/ccRf52Qp.o
a.cc:(.text+0x236): relocation truncated to fit: R_X86_64_PC32 against symbol `cnt' defined in .bss section in /tmp/ccRf52Qp.o
/tmp/ccRf52Qp.o: in function `__static_initialization_and_destruction_0()':
a.cc:(.text+0x34b): relocation truncated to fit: R_X86_64_PC32 against symbol `cnt' defined in .bss section in /tmp/ccRf52Qp.o
a.cc:(.text+0x371): relocation truncated to fit: R_X86_64_PC32 against symbol `cnt' defined in .bss section in /tmp/ccRf52Qp.o
collect2: error: ld returned 1 exit status
Language: C++

#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>

using namespace std;

vector<bool> visited;
vector<long long int> X;
vector<long long int> P;


void dfs(vector<vector<int>> &G,int& v){
  visited[v] = true;
  for (int i = 0; i < G[v].size(); i++){
    if(!visited[G[v][i]]){
        P[G[v][i]]=X[G[v][i]]+P[v];
        dfs(G,G[v][i]);
    }
  }
}

int main(){

    int n,q;
    cin >> n >> q;

    visited = vector<bool>(n, 0);

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


    X.resize(n);
    P.resize(n);
    fill(X.begin(),X.end(),0);
    fill(P.begin(),P.end(),0);

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

    int a=0;
    P[0]=X[0];
    dfs(G,a);

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




    

}



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

#include<bits/stdc++.h>
using namespace std;
using Graph=vector<vector<int>>;
int main(){
int N,Q;
  cin>>N>>Q;
  Graph G(N);
  for(int i=0;i<N-2;i++){
  int a,b;
    cin>>a>>b; a--; b--;
    G[a].push_back(b);
    G[b].push_back(a);
   }map<int,int64_t>M;
  for(int i=0;i<Q;i++){
  int p; int64_t x; p--;
    M[p]=x;
  }vector<int64_t>X(N,-1);
  X.at(0)=0;
  if(M.count(0))
    X.at(0)+=M.at(0);
  queue<int>que;
  que.push(0);
  while(!que.empty()){
  int u=que.front();
    que.pop();
    for(auto v;G[u]){
    X.at(v)=X.at(u);
      if(M.count(v))
        X.at(v)+=M.at(v);
      que.push(v);
    }
  
  }for(int i=0;i<N;i++)
    cout<<X.at(i)<<endl;
   return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:9: error: declaration of 'auto v' has no initializer
   26 |     for(auto v;G[u]){
      |         ^~~~
a.cc:26:19: error: could not convert 'G.std::vector<std::vector<int> >::operator[](((std::vector<std::vector<int> >::size_type)u))' from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} to 'bool'
   26 |     for(auto v;G[u]){
      |                   ^
      |                   |
      |                   __gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type {aka std::vector<int>}
a.cc:26:20: error: expected ';' before ')' token
   26 |     for(auto v;G[u]){
      |                    ^
      |                    ;
Language: C++

#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
const ll MOD2=998244353;
const double PI=acos(-1);
const ll INF=1e15;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
struct edge{ll to,cost;};

const ll MXN=200000;
vl G[MXN];
vl ans(MXN,0);
vl d(MXN,0);

void dfs(ll x,ll y){
  ans[x]=y;
  ll k=G[x].size();
  if(k==0){
    continue;
  }
  if(k!=0){
    rep(i,k){
      if(ans[G[x][i]]==0){
        dfs(G[x][i],y+d[G[x][i]]);
      }
    }
  }
}

int main() {
  ll N,Q;
  cin >> N >> Q;
  vl a(N-1),b(N-1),p(Q),x(Q);
  rep(i,N-1){
    cin >> a[i] >> b[i];
    a[i]--;b[i]--;
    G[a[i]].push_back(b[i]);
    G[b[i]].push_back(a[i]);
  }
  rep(i,Q){
    cin >> p[i] >> x[i];
    p[i]--;
    d[p[i]]+=x[i];
  }
  /*rep(i,N){
    cout << d[i] << endl;
  }*/
  //ans[0]=d[0];
  dfs(0,d[0]);
  rep(i,N){
    cout << ans[i] << endl;
  }
}


Compiler output:
a.cc: In function 'void dfs(ll, ll)':
a.cc:27:5: error: continue statement not within a loop
   27 |     continue;
      |     ^~~~~~~~
Language: C++

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

int N,Q;
Graph G;

void dfs(int v, int p, vector<long long> &res) {
  if (p != -1) res[v] += res[p];
  for (auto e : G[v]) {
    if (e == p) continue;
    dfs(e, v, res);
  }
}

int main(){

  cin>>N>>Q;
  G.assign(N, vector<int>);
  
  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);

  }
    
  vector<long long> val(N, 0);
  for (int i=0;i<Q;i++) {
    int p,x;
    cin>>p>>x;
    --p;
    val[p]+=x;
  }
  dfs(0,-1,val);
  for(auto v : val)cout<<v<<" ";
  cout<<endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:26: error: expected primary-expression before ')' token
   19 |   G.assign(N, vector<int>);
      |                          ^