criyle/codenet-compile-errors huggingface dataset:
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:6:7: error: expected initializer before 'G'
    6 | Graph G;
      |       ^
a.cc: In function 'void dfs(int, int, std::vector<long long int>&)':
a.cc:10:17: error: 'G' was not declared in this scope
   10 |   for (auto e : G[v]) {
      |                 ^
a.cc: In function 'int main()':
a.cc:19:3: error: 'G' was not declared in this scope
   19 |   G.assign(N, vector<int>);
      |   ^
a.cc:19:26: error: expected primary-expression before ')' token
   19 |   G.assign(N, vector<int>);
      |                          ^
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:1:1: error: 'include' does not name a type
    1 | include <bits/stdc++.h>
      | ^~~~~~~
a.cc:3:15: error: 'vector' does not name a type
    3 | using Graph = vector<vector <int>>;
      |               ^~~~~~
a.cc:6:7: error: expected initializer before 'G'
    6 | Graph G;
      |       ^
a.cc:8:24: error: 'vector' has not been declared
    8 | void dfs(int v, int p, vector<long long> &res) {
      |                        ^~~~~~
a.cc:8:30: error: expected ',' or '...' before '<' token
    8 | void dfs(int v, int p, vector<long long> &res) {
      |                              ^
a.cc: In function 'void dfs(int, int, int)':
a.cc:9:16: error: 'res' was not declared in this scope
    9 |   if (p != -1) res[v] += res[p];
      |                ^~~
a.cc:10:17: error: 'G' was not declared in this scope
   10 |   for (auto e : G[v]) {
      |                 ^
a.cc:12:15: error: 'res' was not declared in this scope
   12 |     dfs(e, v, res);
      |               ^~~
a.cc: In function 'int main()':
a.cc:18:3: error: 'cin' was not declared in this scope
   18 |   cin>>N>>Q;
      |   ^~~
a.cc:19:3: error: 'G' was not declared in this scope
   19 |   G.assign(N, vector<int>);
      |   ^
a.cc:19:15: error: 'vector' was not declared in this scope
   19 |   G.assign(N, vector<int>);
      |               ^~~~~~
a.cc:19:22: error: expected primary-expression before 'int'
   19 |   G.assign(N, vector<int>);
      |                      ^~~
a.cc:31:10: error: expected primary-expression before 'long'
   31 |   vector<long long> val(N, 0);
      |          ^~~~
a.cc:36:5: error: 'val' was not declared in this scope
   36 |     val[p]+=x;
      |     ^~~
a.cc:38:12: error: 'val' was not declared in this scope
   38 |   dfs(0,-1,val);
      |            ^~~
a.cc:39:20: error: 'cout' was not declared in this scope
   39 |   for(auto v : val)cout<<v<<" ";
      |                    ^~~~
a.cc:40:3: error: 'cout' was not declared in this scope
   40 |   cout<<endl;
      |   ^~~~
a.cc:40:9: error: 'endl' was not declared in this scope
   40 |   cout<<endl;
      |         ^~~~
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
#include<stdio.h>
#include<cstring>
#include<math.h>
#include<map>
#include<bitset>
#include<iomanip>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
int n, q;
int a[200000][200000];
long long x[200000] = {0};
bool visited[200000];
long long p[200000] = {0};

void dfs(int t) {
  visited[t] = true;
  for(int i = 0; i < n; i++) {
    if(a[t][i] == 1 && visited[i] == false) {
      p[i] += p[t] + x[i];
      dfs(i);
    }
  }
}

int main() {
  rep(i, n) {
    visited[i] = false;
  }
  cin >> n >> q;
  for(int i = 0; i < n - 1; i++) {
    int x, y;
    cin >> x >> y;
    a[x-1][y-1] = 1;
    a[y-1][x-1] = 1;
  }
  for(int i = 0; i < q; i++) {
    int t1, t2;
    cin >> t1 >> t2;
    x[t1 - 1] += t2;
  }

  p[0] = x[0];

  dfs(0);
  for(int i = 0; i < n; i++) {
    cout << p[i];
    if(i != n - 1) cout << " ";
    else cout << endl;
  }

  return 0;
}

Compiler output:
/tmp/ccHo1tBc.o: in function `dfs(int)':
a.cc:(.text+0x13): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/ccHo1tBc.o
a.cc:(.text+0x5f): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/ccHo1tBc.o
a.cc:(.text+0x7e): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/ccHo1tBc.o
a.cc:(.text+0x97): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/ccHo1tBc.o
a.cc:(.text+0xb0): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/ccHo1tBc.o
a.cc:(.text+0xcf): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/ccHo1tBc.o
/tmp/ccHo1tBc.o: in function `main':
a.cc:(.text+0x111): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/ccHo1tBc.o
a.cc:(.text+0x246): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/ccHo1tBc.o
a.cc:(.text+0x26b): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/ccHo1tBc.o
a.cc:(.text+0x285): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/ccHo1tBc.o
a.cc:(.text+0x28c): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
#include<stdio.h>
#include<cstring>
#include<math.h>
#include<map>
#include<bitset>
#include<iomanip>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
int n, q;
int a[200000][200000];
vector<int> b[200000];
int x[200000] = {0};
int visited[200000] = {0};
int p[200000] = {0};

void dfs(int t) {
  visited[t] = 1;
  for(int i = 0; i < n; i++) {
    if(a[t][i] == 1 && visited[i] == 0) {
      p[i] += p[t] + x[i];
      dfs(i);
    }
  }
}

int main() {
  cin >> n >> q;
  for(int i = 0; i < n - 1; i++) {
    int x, y;
    cin >> x >> y;
    a[x-1][y-1] = 1;
  }
  for(int i = 0; i < q; i++) {
    int t1, t2;
    cin >> t1 >> t2;
    x[t1 - 1] += t2;
  }

  p[0] = x[0];

  dfs(0);
  for(int i = 0; i < n; i++) {
    cout << p[i];
    if(i != n - 1) cout << " ";
    else cout << endl;
  }

  return 0;
}

Compiler output:
/tmp/cc9PrETp.o: in function `dfs(int)':
a.cc:(.text+0x1b): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/cc9PrETp.o
a.cc:(.text+0x72): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/cc9PrETp.o
a.cc:(.text+0x8d): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/cc9PrETp.o
a.cc:(.text+0xa5): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/cc9PrETp.o
a.cc:(.text+0xbd): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/cc9PrETp.o
a.cc:(.text+0xd9): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/cc9PrETp.o
/tmp/cc9PrETp.o: in function `main':
a.cc:(.text+0x1ef): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/cc9PrETp.o
a.cc:(.text+0x210): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/cc9PrETp.o
a.cc:(.text+0x228): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/cc9PrETp.o
a.cc:(.text+0x22e): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/cc9PrETp.o
a.cc:(.text+0x255): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
#include<stdio.h>
#include<cstring>
#include<math.h>
#include<map>
#include<bitset>
#include<iomanip>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
int n, q;
int a[200000][200000];
int x[200000] = {0};
int visited[200000] = {0};
int p[200000] = {0};

void dfs(int t) {
  visited[t] = 1;
  for(int i = 0; i < n; i++) {
    if(a[t][i] == 1 && visited[i] == 0) {
      p[i] += p[t] + x[i];
      dfs(i);
    }
  }
}

int main() {
  cin >> n >> q;
  for(int i = 0; i < n - 1; i++) {
    int x, y;
    cin >> x >> y;
    a[x-1][y-1] = 1;
  }
  for(int i = 0; i < q; i++) {
    int t1, t2;
    cin >> t1 >> t2;
    x[t1 - 1] += t2;
  }

  p[0] = x[0];

  dfs(0);
  for(int i = 0; i < n; i++) {
    cout << p[i];
    if(i != n - 1) cout << " ";
    else cout << endl;
  }

  return 0;
}

Compiler output:
/tmp/ccVTgJcr.o: in function `dfs(int)':
a.cc:(.text+0x1b): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/ccVTgJcr.o
a.cc:(.text+0x72): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/ccVTgJcr.o
a.cc:(.text+0x8d): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/ccVTgJcr.o
a.cc:(.text+0xa5): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/ccVTgJcr.o
a.cc:(.text+0xbd): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/ccVTgJcr.o
a.cc:(.text+0xd9): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/ccVTgJcr.o
/tmp/ccVTgJcr.o: in function `main':
a.cc:(.text+0x1ef): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/ccVTgJcr.o
a.cc:(.text+0x210): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/ccVTgJcr.o
a.cc:(.text+0x228): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/ccVTgJcr.o
a.cc:(.text+0x22e): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/ccVTgJcr.o
a.cc:(.text+0x255): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
#include<stdio.h>
#include<cstring>
#include<math.h>
#include<map>
#include<bitset>
#include<iomanip>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
int n, q;
int a[200000][200000];
int x[200000] = {0};
int visited[200000] = {0};
int p[200000] = {0};
// int counter[200000] = {0};

void dfs(int t) {
  visited[t] = 1;
  for(int i = 0; i < n; i++) {
    if(a[t][i] == 1 && visited[i] == 0) {
      p[i] += p[t] + x[i];
      dfs(i);
    }
  }
}

int main() {
  cin >> n >> q;
  for(int i = 0; i < n - 1; i++) {
    int x, y;
    cin >> x >> y;
    a[x-1][y-1] = 1;
  }
  for(int i = 0; i < q; i++) {
    int temp, temp2;
    cin >> temp >> temp2;
    x[temp - 1] += temp2;
  }

  p[0] = x[0];

  dfs(0);
  for(int i = 0; i < n; i++) {
    cout << p[i];
    if(i != n - 1) cout << " ";
    else cout << endl;
  }

  return 0;
}

Compiler output:
/tmp/ccNdEJ8H.o: in function `dfs(int)':
a.cc:(.text+0x1b): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/ccNdEJ8H.o
a.cc:(.text+0x72): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/ccNdEJ8H.o
a.cc:(.text+0x8d): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/ccNdEJ8H.o
a.cc:(.text+0xa5): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/ccNdEJ8H.o
a.cc:(.text+0xbd): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/ccNdEJ8H.o
a.cc:(.text+0xd9): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/ccNdEJ8H.o
/tmp/ccNdEJ8H.o: in function `main':
a.cc:(.text+0x1ef): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/ccNdEJ8H.o
a.cc:(.text+0x210): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/ccNdEJ8H.o
a.cc:(.text+0x228): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/ccNdEJ8H.o
a.cc:(.text+0x22e): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/ccNdEJ8H.o
a.cc:(.text+0x255): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
#include<stdio.h>
#include<cstring>
#include<math.h>
#include<map>
#include<bitset>
#include<iomanip>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
int n, q;
int a[200000][200000];
int x[200000] = {0};
int visited[200000] = {0};
int p[200000] = {0};
// int counter[200000] = {0};

void dfs(int t) {
  visited[t] = 1;
  for(int i = 0; i < n; i++) {
    if(a[t][i] == 1 && visited[i] == 0) {
      p[i] += p[t] + x[i];
      dfs(i);
    }
  }
}

int main() {
  cin >> n >> q;
  for(int i = 0; i < n - 1; i++) {
    int x, y;
    cin >> x >> y;
    a[x-1][y-1] = 1;
  }
  for(int i = 0; i < q; i++) {
    int temp, temp2;
    cin >> temp >> temp2;
    x[temp - 1] += temp2;
  }

  p[0] = x[0];

  dfs(0);
  for(int i = 0; i < n; i++) {
    cout << p[i];
    if(i != n - 1) cout << " ";
    else cout << endl;
  }

  return 0;
}

Compiler output:
/tmp/ccLZYAoi.o: in function `dfs(int)':
a.cc:(.text+0x1b): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/ccLZYAoi.o
a.cc:(.text+0x72): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/ccLZYAoi.o
a.cc:(.text+0x8d): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/ccLZYAoi.o
a.cc:(.text+0xa5): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/ccLZYAoi.o
a.cc:(.text+0xbd): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/ccLZYAoi.o
a.cc:(.text+0xd9): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/ccLZYAoi.o
/tmp/ccLZYAoi.o: in function `main':
a.cc:(.text+0x1ef): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/ccLZYAoi.o
a.cc:(.text+0x210): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/ccLZYAoi.o
a.cc:(.text+0x228): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/ccLZYAoi.o
a.cc:(.text+0x22e): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/ccLZYAoi.o
a.cc:(.text+0x255): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
#include<stdio.h>
#include<cstring>
#include<math.h>
#include<map>
#include<bitset>
#include<iomanip>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
int n, q;
int a[200000][200000];
int x[200000] = {0};
int visited[200000] = {0};
int p[200000] = {0};
// int counter[200000] = {0};

void dfs(int t) {
  visited[t] = 1;
  for(int i = 0; i < n; i++) {
    if(a[t][i] == 1 && visited[i] == 0) {
      p[i] += p[t] + x[i];
      dfs(i);
    }
  }
}

int main() {
  cin >> n >> q;
  for(int i = 0; i < n - 1; i++) {
    int x, y;
    cin >> x >> y;
    a[x-1][y-1] = 1;
  }
  for(int i = 0; i < q; i++) {
    int temp, temp2;
    cin >> temp >> temp2;
    x[temp - 1] += temp2;
  }

  p[0] = x[0];

  dfs(0);
  for(int i = 0; i < n; i++) {
    cout << p[i];
    if(i != n - 1) cout << " ";
    else cout << endl;
  }

  return 0;
}

Compiler output:
/tmp/ccGWez3r.o: in function `dfs(int)':
a.cc:(.text+0x1b): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/ccGWez3r.o
a.cc:(.text+0x72): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/ccGWez3r.o
a.cc:(.text+0x8d): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/ccGWez3r.o
a.cc:(.text+0xa5): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/ccGWez3r.o
a.cc:(.text+0xbd): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/ccGWez3r.o
a.cc:(.text+0xd9): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/ccGWez3r.o
/tmp/ccGWez3r.o: in function `main':
a.cc:(.text+0x1ef): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/ccGWez3r.o
a.cc:(.text+0x210): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/ccGWez3r.o
a.cc:(.text+0x228): relocation truncated to fit: R_X86_64_PC32 against symbol `x' defined in .bss section in /tmp/ccGWez3r.o
a.cc:(.text+0x22e): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/ccGWez3r.o
a.cc:(.text+0x255): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include<bits/stdc++.h>
#include<string>
#include<vector>
using namespace std;
typedef pair<int, int>P;
typedef long long ll;
#define rep(i,n)for(ll 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
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;
//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]++;
}

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

ll dx[8] = { 0,0,-1,1 };
ll dy[8] = { -1,1,0,0 };
ll dp[1010][1010];
ll land[101][101];
bool flag[101][101];
ll h, w;

void dfs(ll y, ll x) {
	flag[y][x] = false;
	for (ll dx = -1;dx <= 1;++dx) {
		for (ll dy = -1;dy <= 1;++dy) {
			if (0 <= y + dy && y + dy < h && 0 <= x + dx && x + dx < w && flag[y + dy][x + dx]) {
				dfs(y + dy, x + dx);
			}
		}
	}
	return;
}

vector<ll>to[10101010];
vector<ll>ans(1010101);
vector<bool>visited(1010101);

void dfs(ll v, ll pv) {
	visited[v] = true;
	if (v != 0)ans[v] += ans[pv];
	for (auto nv : to[v]) {
		if (visited[nv] == false)dfs(nv, v);
	}
}

//long longしか使わない
int main() {
	ll n, q;
	cin >> n >> q;
	vector<ll>a(n - 1), b(n - 1);
	rep(i, n - 1) {
		cin >> a[i] >> b[i];
		a[i]--;
		b[i]--;
		to[a[i]].push_back(b[i]);
		to[b[i]].push_back(a[i]);
	}
	vector<ll>p(q), x(q);
	rep(i, q) {
		cin >> p[i] >> x[i];
		p[i]--;
		ans[p[i]] += x[i];
	}
	dfs(0, 0);
	rep(i, n - 1) {
		cout << ans[i] << endl;
	}
	return 0;
}


Compiler output:
a.cc:91:6: error: redefinition of 'void dfs(ll, ll)'
   91 | void dfs(ll v, ll pv) {
      |      ^~~
a.cc:75:6: note: 'void dfs(ll, ll)' previously defined here
   75 | void dfs(ll y, ll x) {
      |      ^~~
Language: C++

#include <bits/stdc++.h>
#include <numeric>
#define ll long long

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define irep(itr, st) for (auto itr = (st).begin(); itr != (st).end(); ++itr)
#define irrep(itr, st) for (auto itr = (st).rbegin(); itr != (st).rend(); ++itr)

#define pb emplace_back
#define mp make_pair


using namespace std;

const ll MOD = 998244353;
const ll INF = (ll)1000000007 * 1000000007;

#ifdef DEBUG
#define PRINT(A) std::cout << (#A) << ":" << (A) << std::endl;
#else
#define PRINT(A)
#endif

typedef pair<ll, ll> P;

template <class T> inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template <class T> inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

int R, C, N, M, K, Q;

vector<int> v[200005];
vector<int> res;

void dfs(int node, int p = 0){
    PRINT(node)
    PRINT(res[node])
    for(int i:v[node]){
        if(i == p) continue;
        res[i += res[node];
        dfs(i, node);
    }
    return;
}

signed main() {
    //cout << fixed << setprecision(10);
    cin >> N >> Q;

    rep(i, N-1){
        int from,to; cin >> from >> to;
        from --;
        to --;
        v[from].pb(to);
        v[to].pb(from);
    }
    res.assign(N,0); 
    rep(i,Q){
        int node, val; cin >> node >> val;
        res[--node] += val;
    }
    dfs(0);

    rep(i, N){
        cout << res[i] << " ";
    }
    cout << endl;

    //cout << max << endl;
}


Compiler output:
a.cc: In function 'void dfs(int, int)':
a.cc:54:27: error: expected ']' before ';' token
   54 |         res[i += res[node];
      |                           ^
      |                           ]
a.cc:54:27: warning: ignoring return value of 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = int; _Alloc = std::allocator<int>; reference = int&; size_type = long unsigned int]', declared with attribute 'nodiscard' [-Wunused-result]
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:1128:7: note: declared here
 1128 |       operator[](size_type __n) _GLIBCXX_NOEXCEPT
      |       ^~~~~~~~
Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define REPD(i,a,b) for (int i=(a);i<(b);i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef set<int> si;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<int, int> pi;
typedef queue<pi> qpi;
typedef pair<ll, ll> pll;
typedef queue<pll> qpll;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
const int mod = 1000000007;
const int INF = 1001001001;
// 小数点　<< fixed << setprecision(0) <<
// sort降順　sort(ALL(),greater<int>());
// 円周率　M_PI
// 文字判定　isupper islower
// 順列　do {} while(next_permutation(ALL(X)));
// 最大値　LLONG_MAX
// a内でx以上　auto iter = lower_bound(ALL(a), x);
// a内でxより大きい　auto iter = upper_bound(ALL(a), x);
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
struct edge {
    int from; //出発点
    int to;   //到達点
    int cost; //移動コスト
};
typedef struct edge se;
typedef vector<edge> ve;
unsigned euclidean_gcd(unsigned a, unsigned b) {
  if(a < b) return euclidean_gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

void dfs(vvi g,int v, int &time,vb &seen,vi &first_time,vi &last_time) {
  first_time[v]=++time;
  seen[v]=true;
  for(auto next_v:g[v]) {
    if(seen[next_v]) continue;
    dfs(g,next_v,time,seen,first_time,last_time);
  }
  last_time[v]=++time;
}



int main() {
  int n,q;
  cin >> n >> q;
  vvll ab(n);
  REP(i,n-1) {
    int a,b;
    cin >> a >> b;
    a--;
    b--;
    ab[a].push_back(b);
    ab[b].push_back(a);
  }
  vll ans(n,0);
  REP(i,q) {
    int p,x;
    cin >> p >> x;
    p--;
    ans[p]+=x;
  }
  auto f=[&](auto f,int c, int p)->void{
    for(auto y:ab[c]) {
      if(y!=p) {
        ans[y]+=ans[c];
        f(f,y,c);
      }
    }
  }
  f(f,0,-1);
  REP(i,n) {
    cout << ans[i] << " ";
  }
  cout << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:90:3: error: expected ',' or ';' before 'f'
   90 |   f(f,0,-1);
      |   ^
Language: C++

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

ll n,q, num, val;
vector<vector<ll>> a;
vector<ll> ans;

void dfs(int num){
  ans[num] += val;
  queue<ll> q;
  for(int i=0; i <a[num].size(); i++){
    q.push(a[num][i]);
    int t=q.front();
    q.pop();
    dfs(t);
  }
}

int main(){
  cin >> n >>q;
  a=vector<vector<int>>(n);
  rep(i,n-1){
    int x,y;
    cin >> x >> y;
    x--;
    y--;
    a[x].push_back(y);
  }
  
  ans = vector<ll>(n);
  rep(i,q){
    cin >> num >> val;
    num--;
    dfs(num);
  }
  rep(i,n) cout << ans[i] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:26: error: no match for 'operator=' (operand types are 'std::vector<std::vector<long long int> >' and 'std::vector<std::vector<int> >')
   23 |   a=vector<vector<int>>(n);
      |                          ^
In file included from /usr/include/c++/14/vector:72,
                 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/vector.tcc:210:5: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = std::vector<long long int>; _Alloc = std::allocator<std::vector<long long int> >]'
  210 |     vector<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/vector.tcc:211:42: note:   no known conversion for argument 1 from 'std::vector<std::vector<int> >' to 'const std::vector<std::vector<long long int> >&'
  211 |     operator=(const vector<_Tp, _Alloc>& __x)
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/14/vector:66:
/usr/include/c++/14/bits/stl_vector.h:766:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = std::vector<long long int>; _Alloc = std::allocator<std::vector<long long int> >]'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:766:26: note:   no known conversion for argument 1 from 'std::vector<std::vector<int> >' to 'std::vector<std::vector<long long int> >&&'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |                 ~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:788:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = std::vector<long long int>; _Alloc = std::allocator<std::vector<long long int> >]'
  788 |       operator=(initializer_list<value_type> __l)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:788:46: note:   no known conversion for argument 1 from 'std::vector<std::vector<int> >' to 'std::initializer_list<std::vector<long long int> >'
  788 |       operator=(initializer_list<value_type> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
Language: C++

#include <bits/stdc++.h> using namespace std; const int MAXN = 1000 * 100 * 2 + 100; vector <int> gr[MAXN]; int holder[MAXN]; int check[MAXN]; int sum[MAXN]; void dfs(int, int); int main() { 	int n, q; 	cin >> n >> q; 	for (int i = 1; i < n; i++) { 		int a, b; 		cin >> a >> b; 		gr[a].push_back(b); 		gr[b].push_back(a); 	} 	for (int i = 0; i < q; i++) { 		int p, x; 		cin >> p >> x; 		holder[p] += x; 	} 	dfs(1, holder[1]); 	for (int i = 1; i <= n; i++) { 		cout << sum[i] << ' '; 	} 	cout << endl; 	return 0; } void dfs(int v, int sumTilNow) { 	check[v] = 1; 	sum[v] = sumTilNow; 	for (int u: gr[v]) { 		if(check[u] == 0) { 			dfs(u, sumTilNow + holder[u]); 		} 	} }

Compiler output:
a.cc:1:26: warning: extra tokens at end of #include directive
    1 | #include <bits/stdc++.h> using namespace std; const int MAXN = 1000 * 100 * 2 + 100; vector <int> gr[MAXN]; int holder[MAXN]; int check[MAXN]; int sum[MAXN]; void dfs(int, int); int main() {  int n, q;       cin >> n >> q;  for (int i = 1; i < n; i++) {           int a, b;               cin >> a >> b;          gr[a].push_back(b);             gr[b].push_back(a);     }       for (int i = 0; i < q; i++) {           int p, x;               cin >> p >> x;          holder[p] += x;         }       dfs(1, holder[1]);      for (int i = 1; i <= n; i++) {          cout << sum[i] << ' ';  }       cout << endl;   return 0; } void dfs(int v, int sumTilNow) {    check[v] = 1;   sum[v] = sumTilNow;     for (int u: gr[v]) {            if(check[u] == 0) {                     dfs(u, sumTilNow + holder[u]);          }       } }
      |                          ^~~~~
/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>
#define v vector
using namespace std;
typedef long long ll;
v<bool> searched;
v<ll> b; 
v<v<int>> g;
v<ll> ans;
void dfs(ll, int);
int main(){
    int n, q;
    cin >> n >> q;
    g.resize(n);
    b.resize(n);
    searched.resize(n);
    ans.resize(n);
    for(int i = 0; i < n - 1; i++){
        int a, b;
        scanf("%d %d", &a, &b);
        g[a - 1].push_back(b - 1);
        g[b - 1].push_back(a - 1);
    }
    for(int i = 0; i < q; i++){
        ll x, y;
        scanf("%lld %lld", &x, &y);
        b[x - 1] += y;
    }
    dfs(0, 0);
    for(int i = 0; i < n; i++){
        printf("%lld ", ans[i]);
    }
}
void dfs(ll parent_pnt, int c){
    if(searched[c]) return
    searched[c] = true;
    ans[c] = parent_pnt + b[c]
    for(int child : g[c]){
        dfs(ans[c], child);
    }
    return;
}


Compiler output:
a.cc: In function 'void dfs(ll, int)':
a.cc:35:17: error: return-statement with a value, in function returning 'void' [-fpermissive]
   35 |     searched[c] = true;
      |     ~~~~~~~~~~~~^~~~~~
a.cc:36:31: error: expected ';' before 'for'
   36 |     ans[c] = parent_pnt + b[c]
      |                               ^
      |                               ;
   37 |     for(int child : g[c]){
      |     ~~~
Language: C++

#include <bits/stdc++.h>
#define vector v
using namespace std;
typedef long long ll;
v<bool> searched;
v<ll> b; 
v<v<int>> graph;
v<ll> ans;
void dfs(ll, int);
int main(){
    int n, q;
    cin >> n >> q;
    graph.resize(n);
    b.resize(n);
    searched.resize(n);
    ans.resize(n);
    for(int i = 0; i < n - 1; i++){
        int a, b;
        scanf("%d %d", &a, &b);
        graph[a - 1].push_back(b - 1);
        graph[b - 1].push_back(a - 1);
    }
    for(int i = 0; i < q; i++){
        ll x, y;
        scanf("%lld %lld", &x, &y);
        b[x - 1] += y;
    }
    dfs(0, 0);
    for(int i = 0; i < n; i++){
        printf("%lld ", ans[i]);
    }
}
void dfs(ll parent_pnt, int current){
    if(searched[current]) return;
    searched[current] = true;
    ans[current] = parent_pnt + b[current];
    for(int child : graph[current]){
        dfs(ans[current], child);
    }
    return;
}


Compiler output:
a.cc:5:1: error: 'v' does not name a type
    5 | v<bool> searched;
      | ^
a.cc:6:1: error: 'v' does not name a type
    6 | v<ll> b;
      | ^
a.cc:7:1: error: 'v' does not name a type
    7 | v<v<int>> graph;
      | ^
a.cc:8:1: error: 'v' does not name a type
    8 | v<ll> ans;
      | ^
a.cc: In function 'int main()':
a.cc:13:5: error: 'graph' was not declared in this scope; did you mean 'isgraph'?
   13 |     graph.resize(n);
      |     ^~~~~
      |     isgraph
a.cc:14:5: error: 'b' was not declared in this scope
   14 |     b.resize(n);
      |     ^
a.cc:15:5: error: 'searched' was not declared in this scope
   15 |     searched.resize(n);
      |     ^~~~~~~~
a.cc:16:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   16 |     ans.resize(n);
      |     ^~~
      |     abs
a.cc: In function 'void dfs(ll, int)':
a.cc:34:8: error: 'searched' was not declared in this scope
   34 |     if(searched[current]) return;
      |        ^~~~~~~~
a.cc:35:5: error: 'searched' was not declared in this scope
   35 |     searched[current] = true;
      |     ^~~~~~~~
a.cc:36:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   36 |     ans[current] = parent_pnt + b[current];
      |     ^~~
      |     abs
a.cc:36:33: error: 'b' was not declared in this scope
   36 |     ans[current] = parent_pnt + b[current];
      |                                 ^
a.cc:37:21: error: 'graph' was not declared in this scope; did you mean 'isgraph'?
   37 |     for(int child : graph[current]){
      |                     ^~~~~
      |                     isgraph
Language: C++

#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <numeric>
#include <cmath>

#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
using P = pair<ll, ll>;

template<class T> inline bool chmin(T& a,T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a,T b) {if (a < b) {a = b; return true;} return false;}

const ll MOD = 1000000007;
const int INF = 1<<30;
//const ll INF = (ll)1e18 + 1;

using Graph = vector<vector<int>>;

int main(){
  int N, Q; cin >> N >> Q;
  Graph G(N);
  rep(i, N - 1){
    int a, b; cin >> a >> b;
    a--, b--;
    G[a].push_back(b);
  }

  queue<int> que;
  vector<int> ans(N, 0);
  vector<int> seen(N, 0);
  vector<int> ctr(n, 0);
  rep(i, Q){
    int p, x; cin >> p >> x;
    p--;
    ctr[p] += x;
  }

  que.push(0);
  seen[0] = 1;
  ans[0] = ctr[0];
  while (!que.empty()){
    int v = que.front(); que.pop();
    for (int nv: G[v]){
      if (seen[nv] == 1) continue;
      ans[nv] = ans[v] + ctr[nv];
      seen[nv] = 1;
      que.push(nv);
    }
  }

  rep(i, N) cout << ans[i] << endl;

}


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

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

#define REP(i, n) for(ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for(ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for(ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for(ll i = a; i >= (ll)(b); i--)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

#define INF 1000000000000
#define MOD 10000007 
#define MAXR 100000

bool graph[MAXR][MAXR] = {false};
int score[MAXR] = {0};

void dfs(int n, int p, int x) {
    score[p] += x;
    FOR(i, 1, n) if(graph[p][i]) dfs(n, i, x);
}

signed main() {
    int N, Q; cin >> N >> Q;
    FOR(i, 1, N - 1) {
        int a, b; cin >> a >> b;
        graph[a][b] = true;
    }
    REP(j, Q) {
        int p, x; cin >> p >> x;
        dfs(N, p, x);
    }
    FOR(i, 1, N) {
        cout << score[i] << " ";
    }
    cout << endl;
}

Compiler output:
/tmp/ccHNkcIr.o: in function `dfs(int, int, int)':
a.cc:(.text+0x21): relocation truncated to fit: R_X86_64_PC32 against symbol `score' defined in .bss section in /tmp/ccHNkcIr.o
a.cc:(.text+0x3e): relocation truncated to fit: R_X86_64_PC32 against symbol `score' defined in .bss section in /tmp/ccHNkcIr.o
/tmp/ccHNkcIr.o: in function `main':
a.cc:(.text+0x1a0): relocation truncated to fit: R_X86_64_PC32 against symbol `score' defined in .bss section in /tmp/ccHNkcIr.o
collect2: error: ld returned 1 exit status
Language: C++

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

#define REP(i, n) for(ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for(ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for(ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for(ll i = a; i >= (ll)(b); i--)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

#define INF 1000000000000
#define MOD 10000007 
#define MAXR 100000

int N, Q;
bool graph[MAXR][MAXR] = {false};
int score[MAXR] = {0};

void dfs(int p, int x) {
    score[p] += x;
    FOR(i, 1, N) if(graph[p][i]) dfs(i, x);
}

signed main() {
    cin >> N >> Q;
    FOR(i, 1, N - 1) {
        int a, b; cin >> a >> b;
        graph[a][b] = true;
    }
    REP(j, Q) {
        int p, x; cin >> p >> x;
        dfs(p, x);
    }
    FOR(i, 1, N) {
        cout << score[i] << " ";
    }
    cout << endl;
}

Compiler output:
/tmp/cc9rH7JC.o: in function `dfs(int, int)':
a.cc:(.text+0x1e): relocation truncated to fit: R_X86_64_PC32 against symbol `score' defined in .bss section in /tmp/cc9rH7JC.o
a.cc:(.text+0x3b): relocation truncated to fit: R_X86_64_PC32 against symbol `score' defined in .bss section in /tmp/cc9rH7JC.o
/tmp/cc9rH7JC.o: in function `main':
a.cc:(.text+0x1a6): relocation truncated to fit: R_X86_64_PC32 against symbol `score' defined in .bss section in /tmp/cc9rH7JC.o
collect2: error: ld returned 1 exit status
Language: C++

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

#define REP(i, n) for(ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for(ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for(ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for(ll i = a; i >= (ll)(b); i--)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

#define INF 1000000000000
#define MOD 10000007 
#define MAXR 100000

int N, Q;
bool graph[MAXR][MAXR];
int score[MAXR] = {0};

void dfs(int p, int x) {
    score[p] += x;
    FOR(i, 1, N) if(graph[p][i]) dfs(i, x);
}

signed main() {
    cin >> N >> Q;
    FOR(i, 1, N - 1) {
        int a, b; cin >> a >> b;
        graph[a][b] = true;
    }
    REP(j, Q) {
        int p, x; cin >> p >> x;
        dfs(p, x);
    }
    FOR(i, 1, N) {
        cout << score[i] << " ";
    }
    cout << endl;
}

Compiler output:
/tmp/ccna8bIs.o: in function `dfs(int, int)':
a.cc:(.text+0x1e): relocation truncated to fit: R_X86_64_PC32 against symbol `score' defined in .bss section in /tmp/ccna8bIs.o
a.cc:(.text+0x3b): relocation truncated to fit: R_X86_64_PC32 against symbol `score' defined in .bss section in /tmp/ccna8bIs.o
/tmp/ccna8bIs.o: in function `main':
a.cc:(.text+0x1a6): relocation truncated to fit: R_X86_64_PC32 against symbol `score' defined in .bss section in /tmp/ccna8bIs.o
collect2: error: ld returned 1 exit status
Language: C++

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

#define REP(i, n) for(ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for(ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for(ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for(ll i = a; i >= (ll)(b); i--)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

#define INF 1000000000000
#define MOD 10000007 
#define MAXR 100000

int N, Q;
bool graph[200010][200010];
int score[200010] = {0};

void dfs(int p, int x) {
    score[p] += x;
    FOR(i, 1, N) if(graph[p][i]) dfs(i, x);
}

signed main() {
    cin >> N >> Q;
    FOR(i, 1, N - 1) {
        int a, b; cin >> a >> b;
        graph[a][b] = true;
    }
    REP(j, Q) {
        int p, x; cin >> p >> x;
        dfs(p, x);
    }
    FOR(i, 1, N) {
        cout << score[i] << " ";
    }
    cout << endl;
}

Compiler output:
/tmp/ccawZqXH.o: in function `dfs(int, int)':
a.cc:(.text+0x1e): relocation truncated to fit: R_X86_64_PC32 against symbol `score' defined in .bss section in /tmp/ccawZqXH.o
a.cc:(.text+0x3b): relocation truncated to fit: R_X86_64_PC32 against symbol `score' defined in .bss section in /tmp/ccawZqXH.o
/tmp/ccawZqXH.o: in function `main':
a.cc:(.text+0x1a6): relocation truncated to fit: R_X86_64_PC32 against symbol `score' defined in .bss section in /tmp/ccawZqXH.o
collect2: error: ld returned 1 exit status
Language: C++

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

#define REP(i, n) for(ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for(ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for(ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for(ll i = a; i >= (ll)(b); i--)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

#define INF 1000000000000
#define MOD 10000007 
#define MAXR 100000

ll N, Q;
bool graph[200010][200010];
int score[200010] = {0};

void dfs(ll p, ll x) {
    score[p] += x;
    FOR(i, 1, N) if(graph[p][i]) dfs(i, x);
}

signed main() {
    cin >> N >> Q;
    FOR(i, 1, N - 1) {
        ll a, b; cin >> a >> b;
        graph[a][b] = true;
    }
    REP(j, Q) {
        ll p, x; cin >> p >> x;
        dfs(p, x);
    }
    FOR(i, 1, N) {
        cout << score[i] << " ";
    }
    cout << endl;
}

Compiler output:
/tmp/cc66Q6hU.o: in function `dfs(long long, long long)':
a.cc:(.text+0x1f): relocation truncated to fit: R_X86_64_PC32 against symbol `score' defined in .bss section in /tmp/cc66Q6hU.o
a.cc:(.text+0x3f): relocation truncated to fit: R_X86_64_PC32 against symbol `score' defined in .bss section in /tmp/cc66Q6hU.o
/tmp/cc66Q6hU.o: in function `main':
a.cc:(.text+0x1a5): relocation truncated to fit: R_X86_64_PC32 against symbol `score' defined in .bss section in /tmp/cc66Q6hU.o
collect2: error: ld returned 1 exit status
Language: C++

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

#define REP(i, n) for(ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for(ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for(ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for(ll i = a; i >= (ll)(b); i--)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

#define INF 1000000000000
#define MOD 10000007 
#define MAXR 100000

ll N, Q;
bool graph[200010][200010];
int score[200010] = {0};

void dfs(int p, int x) {
    score[p] += x;
    FOR(i, 1, N) if(graph[p][i]) dfs(i, x);
}

signed main() {
    cin >> N >> Q;
    FOR(i, 1, N - 1) {
        ll a, b; cin >> a >> b;
        graph[a][b] = true;
    }
    REP(j, Q) {
        ll p, x; cin >> p >> x;
        dfs(p, x);
    }
    FOR(i, 1, N) {
        cout << score[i] << " ";
    }
    cout << endl;
}

Compiler output:
/tmp/ccmML4rS.o: in function `dfs(int, int)':
a.cc:(.text+0x1e): relocation truncated to fit: R_X86_64_PC32 against symbol `score' defined in .bss section in /tmp/ccmML4rS.o
a.cc:(.text+0x3b): relocation truncated to fit: R_X86_64_PC32 against symbol `score' defined in .bss section in /tmp/ccmML4rS.o
/tmp/ccmML4rS.o: in function `main':
a.cc:(.text+0x1a1): relocation truncated to fit: R_X86_64_PC32 against symbol `score' defined in .bss section in /tmp/ccmML4rS.o
collect2: error: ld returned 1 exit status
Language: C++

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

int main() {
    int n,q;cin>>n>>q;
    vector<int> g[n];
    for (int i=0;i<n-1;i++) {
        int a,b;cin>>a>>b;
        a--,b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    int c[n]{};
    for (intt i=0;i<q;i++) {
        int a,b;cin>>a>>b;
        a--;
        c[a]+=b;
    }
    queue<int> qu;
    qu.push(0);
    int vis[n]{};
    while (!qu.empty()) {
        int a=qu.front();
        qu.pop();
        vis[a]=1;
        for (int b:g[a])
            if (!vis[b]) {
                b+=c[a];
                qu.push(b);
            }
    }
    for (int i=0;i<n;i++) {
        if (i!=0)
            cout<<' ';
        cout<<i;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:10: error: 'intt' was not declared in this scope; did you mean 'int'?
   15 |     for (intt i=0;i<q;i++) {
      |          ^~~~
      |          int
a.cc:15:19: error: 'i' was not declared in this scope
   15 |     for (intt i=0;i<q;i++) {
      |                   ^
Language: C++

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

int main() {
    int n,q;cin>>n>>q;
    vector<int> g[n];
    for (int i=0;i<n-1;i++) {
        int a,b;cin>>a>>b;
        a--,b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    int c[n]{};
    for (intt i=0;i<q;i++) {
        int a,b;cin>>a>>b;
        a--;
        c[a]+=b;
    }
    queue<int> q;
    q.push(0);
    int vis[n]{};
    while (!q.empty()) {
        int a=q.front();
        q.pop();
        vis[a]=1;
        for (int b:g[a])
            if (!vis[b]) {
                b+=c[a];
                q.push(b);
            }
    }
    for (int i=0;i<n;i++) {
        if (i!=0)
            cout<<' ';
        cout<<i;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:10: error: 'intt' was not declared in this scope; did you mean 'int'?
   15 |     for (intt i=0;i<q;i++) {
      |          ^~~~
      |          int
a.cc:15:19: error: 'i' was not declared in this scope
   15 |     for (intt i=0;i<q;i++) {
      |                   ^
a.cc:20:16: error: conflicting declaration 'std::queue<int> q'
   20 |     queue<int> q;
      |                ^
a.cc:6:11: note: previous declaration as 'int q'
    6 |     int n,q;cin>>n>>q;
      |           ^
a.cc:21:7: error: request for member 'push' in 'q', which is of non-class type 'int'
   21 |     q.push(0);
      |       ^~~~
a.cc:23:15: error: request for member 'empty' in 'q', which is of non-class type 'int'
   23 |     while (!q.empty()) {
      |               ^~~~~
a.cc:24:17: error: request for member 'front' in 'q', which is of non-class type 'int'
   24 |         int a=q.front();
      |                 ^~~~~
a.cc:25:11: error: request for member 'pop' in 'q', which is of non-class type 'int'
   25 |         q.pop();
      |           ^~~
a.cc:30:19: error: request for member 'push' in 'q', which is of non-class type 'int'
   30 |                 q.push(b);
      |                   ^~~~