Language: C++

#include<algorithm>
#include<cstring>
#include<string>
#include<cassert>
#include<cmath>
#include<climits>
#include<iomanip>
#include<stack>
#include<unordered_map>
#include<bitset>
#include<limits>
#include<complex>
#include<array>
#include <iostream>

using namespace std;
#define rep(i,m,n) for(int (i)=(int)(m);i<(int)(n);i++)
#define REP(i,n) rep(i,0,n)
#define ll long long
#define ull unsigned long 

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

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

Compiler output:
a.cc:22:6: error: variable or field 'dfs' declared void
   22 | void dfs(vector<vector<ll>>& g,ll v,ll p,ll x,vector<ll>& con) //V子、P親
      |      ^~~
a.cc:22:10: error: 'vector' was not declared in this scope
   22 | void dfs(vector<vector<ll>>& g,ll v,ll p,ll x,vector<ll>& con) //V子、P親
      |          ^~~~~~
a.cc:15:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
   14 | #include <iostream>
  +++ |+#include <vector>
   15 | 
a.cc:22:17: error: 'vector' was not declared in this scope
   22 | void dfs(vector<vector<ll>>& g,ll v,ll p,ll x,vector<ll>& con) //V子、P親
      |                 ^~~~~~
a.cc:22:17: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
a.cc:19:12: error: expected primary-expression before 'long'
   19 | #define ll long long
      |            ^~~~
a.cc:22:24: note: in expansion of macro 'll'
   22 | void dfs(vector<vector<ll>>& g,ll v,ll p,ll x,vector<ll>& con) //V子、P親
      |                        ^~
a.cc:19:12: error: expected primary-expression before 'long'
   19 | #define ll long long
      |            ^~~~
a.cc:22:32: note: in expansion of macro 'll'
   22 | void dfs(vector<vector<ll>>& g,ll v,ll p,ll x,vector<ll>& con) //V子、P親
      |                                ^~
a.cc:19:12: error: expected primary-expression before 'long'
   19 | #define ll long long
      |            ^~~~
a.cc:22:37: note: in expansion of macro 'll'
   22 | void dfs(vector<vector<ll>>& g,ll v,ll p,ll x,vector<ll>& con) //V子、P親
      |                                     ^~
a.cc:19:12: error: expected primary-expression before 'long'
   19 | #define ll long long
      |            ^~~~
a.cc:22:42: note: in expansion of macro 'll'
   22 | void dfs(vector<vector<ll>>& g,ll v,ll p,ll x,vector<ll>& con) //V子、P親
      |                                          ^~
a.cc:22:47: error: 'vector' was not declared in this scope
   22 | void dfs(vector<vector<ll>>& g,ll v,ll p,ll x,vector<ll>& con) //V子、P親
      |                                               ^~~~~~
a.cc:22:47: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
a.cc:19:12: error: expected primary-expression before 'long'
   19 | #define ll long long
      |            ^~~~
a.cc:22:54: note: in expansion of macro 'll'
   22 | void dfs(vector<vector<ll>>& g,ll v,ll p,ll x,vector<ll>& con) //V子、P親
      |                                                      ^~
a.cc: In function 'int main()':
a.cc:34:2: error: 'vector' was not declared in this scope
   34 |  vector<vector<ll>>  Ginf(n);
      |  ^~~~~~
a.cc:34:2: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
a.cc:19:12: error: expected primary-expression before 'long'
   19 | #define ll long long
      |            ^~~~
a.cc:34:16: note: in expansion of macro 'll'
   34 |  vector<vector<ll>>  Ginf(n);
      |                ^~
a.cc:41:4: error: 'Ginf' was not declared in this scope; did you mean 'sinf'?
   41 |    Ginf[a].push_back(b);
      |    ^~~~
      |    sinf
a.cc:19:12: error: expected primary-expression before 'long'
   19 | #define ll long long
      |            ^~~~
a.cc:44:10: note: in expansion of macro 'll'
   44 |   vector<ll> con(n,0);
      |          ^~
a.cc:51:5: error: 'con' was not declared in this scope; did you mean 'cos'?
   51 |     con[p]=+x;
      |     ^~~
      |     cos
a.cc:53:7: error: 'Ginf' was not declared in this scope; did you mean 'sinf'?
   53 |   dfs(Ginf,0,-1,0,con);
      |       ^~~~
      |       sinf
a.cc:53:19: error: 'con' was not declared in this scope; did you mean 'cos'?
   53 |   dfs(Ginf,0,-1,0,con);
      |                   ^~~
      |                   cos
a.cc:53:3: error: 'dfs' was not declared in this scope; did you mean 'ffs'?
   53 |   dfs(Ginf,0,-1,0,con);
      |   ^~~
      |   ffs