Language: C++

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

template <class T> using V = vector<T>;
template <class S, class T> using P = pair<S, T>;

using ll = long long;
using ull = unsigned long long;
using vll = V<ll>;
using vvll = V<vll>;
using vvvll = V<vvll>;
using pl = P<ll, ll>;
using vpl = V<pl>;
using vvpl = V<vpl>;
using vs = V<string>;
using qll = queue<ll>;
using qpl = queue<pl>;
using mapll = map<ll, ll>;
using setll = set<ll>;
using pqll = priority_queue<ll>;

#define int ll
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pob pop_back()
#define pf push_front
#define pof pop_front()
#define sz size()
#define bgn begin()
#define en end()
#define emp empty()
#define fr front()
#define bk back()
#define res resize
#define tp top()
#define p_q priority_queue
#define inv inverse()

#define FOR(i,a,b) for(ll i=(a);i<=(ll)(b);i++)
#define rFOR(i,a,b) for(ll i=(b);i>=(ll)(a);i--)
#define REP(i,a) FOR((i),0,(ll)(a)-1)
#define REP0(i,a) FOR((i),0,(ll)(a))
#define REP1(i,a) FOR((i),1,(ll)(a))
#define rREP(i,a) rFOR((i),0,(ll)(a)-1)
#define rREP0(i,a) rFOR((i),0,(ll)(a))
#define rREP1(i,a) rFOR((i),1,(ll)(a))
#define IOTA(a,n) iota((a).bgn,(a).en,(n))
#define SORT(a) sort((a).bgn,(a).en)
#define rSORT(a) sort((a).rbegin(),(a).rend())
#define UNIQUE(a) (a).erase(unique((a).bgn,(a).en),(a).en)
#define BINS(a,b) binary_search((a).bgn,(a).en,(b))
#define LOWB(a,b) (lower_bound((a).bgn,(a).en,(b))-(a).bgn)
#define UPB(a,b) (upper_bound((a).bgn,(a).en,(b))-(a).bgn)
#define CNT(a,b) count((a).bgn,(a).en,b)
#define SUM(a) accumulate((a).bgn,(a).en,0)
#define REV(a) reverse((a).bgn,(a).en)
#define yn(a) cout <<((a)?"yes":"no")<<"\n";
#define Yn(a) cout <<((a)?"Yes":"No")<<"\n";
#define YN(a) cout <<((a)?"YES":"NO")<<"\n";
#define imp(a) cout <<((a)?"possible":"impossible")<<"\n";
#define Imp(a) cout <<((a)?"Possible":"Impossible")<<"\n";
#define IMP(a) cout <<((a)?"POSSIBLE":"IMPOSSIBLE")<<"\n";
#define dbg(a) cerr <<(#a)<<": "<<(a)<<"\n";
#define DigN2(a) ((llabs(a)==0)?(1):((ll)(log2(double(llabs(a))))+1))
#define DigN10(a) ((llabs(a)==0)?(1):((ll)(log10(double(llabs(a))))+1))
#define Dig2(a,b) (((a)>>(b))&1)
#define Dig10(a,b) (ll)(((a)/((ll)(pow(10.0,(double)(b)))))%10)
#define Pow2(a) ((ll)(1)<<(a))
#define Pow10(a) ((ll)(pow(10.0,double(a))))
#define powll(a,b) (ll)(pow((double)(a),(double)(b)))

#define li(...) ll __VA_ARGS__;Input(__VA_ARGS__);
#define si(...) string __VA_ARGS__;Input(__VA_ARGS__);
#define vli(size, ...) vll __VA_ARGS__;vInput(size,__VA_ARGS__);
#define vsi(size, ...) vs __VA_ARGS__;vInput(size,__VA_ARGS__);

const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
//const ll MOD = 924844033;
//const ll MOD = 9007199254740881;
const ll INF = 1LL << 60;//1.15e18
const double PI = acos(-1.0);
const string alp = "abcdefghijklmnopqrstuvwxyz";
const string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

void Input() {}
template <class Var, class... Args> void Input(Var& var, Args&... args) {
    cin >> var;
    Input(args...);
}

void vInit(ll size) {}
template <class T, class... Args> void vInit(ll size, V<T>& v, Args&... args) {
    v.res(size);
    vInit(size, args...);
}
void vInputNum(ll num) {}
template <class T, class... Args> void vInputNum(ll num, V<T>& v, Args&... args) {
    cin >> v[num];
    vInputNum(num, args...);
}
void vInput(ll size) {}
template <class... Args> void vInput(ll size, Args&... args) {
    vInit(size, args...);
    REP(i, size) vInputNum(i, args...);
}

template <class S, class T> ostream &operator<<(ostream &out, const P<S, T> &p) {
    return out << "[" << p.fi << ", " << p.se << "]";
}
 
template <class T> ostream &operator<<(ostream &out, V<T> &v) {
    if (v.emp) return out << "{}";
    else {
        auto itr = v.bgn;
        out << "{" << *itr;
        itr++;
        while (itr != v.en) {
            out << ", " << *itr;
            itr++;
        }
        out << "}";
        return out;
    }
}
 
template <class S, class T> ostream &operator<<(ostream &out, const map<S, T> &m) {
    if (m.emp) return out << "<[]>";
    else {
        auto itr = m.bgn;
        out << "< [" << (itr->fi) << ": " << (itr->se);
        itr++;
        while (itr != m.en) {
            out << "], [" << (itr->fi) << ": " << (itr->se);
            itr++;
        }
        out << "] >";
        return out;
    }
}
 
template <class T> ostream &operator<<(ostream &out, const set<T> &s) {
    if (s.emp) return out << "<>";
    else {
        auto itr = s.bgn;
        out << "<" << *itr;
        itr++;
        while (itr != s.en) {
            out << ", " << *itr;
            itr++;
        }
        out << ">";
        return out;
    }
}

ll gcd(ll a, ll b) { if (a < b) { a ^= b; b ^= a; a ^= b; } return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }

struct UFT {

public:
    ll tsize;
    ll mode;
    vll par;
    vll rank;
    UFT() {}
    UFT(const UFT &uft) {}
    UFT(ll tsizeget, ll modeget = 0){
        tsize = tsizeget;
        mode = modeget;
        par.assign(tsize, -1);
        if (!mode) rank.res(tsize, 0);
    }
    ll root(ll x) {
        return par[x] < 0 ? x : par[x] = root(par[x]);
    }
    bool isRoot(ll x) {
        return x == root(x);
    }
    bool same(ll x, ll y) {
        return root(x) == root(y);
    }
    void merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return;
        if (mode) {
            par[x] += par[y];
            par[y] = x;
        }
        else {
            if (rank[x] < rank[y]) {
                par[y] += par[x];
                par[x] = y;
            }
            else {
                par[x] += par[y];
                par[y] = x;
                if (rank[x] == rank[y]) rank[x]++;
            }
        }
    }
    ll size(ll x) {
        return -par[root(x)];
    }
};

ll isP(ll n) {
    if (n <= 1) return 0;
    FOR(i, 2, (ll)sqrt(n) + 1) {
        if (n%i == 0) return 0;
    }
    return 1;
}

vvll CombMemo(1000, vll(1000, -1));

ll Comb(ll n, ll k) {
    if ((n < 0) || (k < 0)) return 0;
    if (CombMemo[n][k] == -1) {
        if (n < k) CombMemo[n][k] = 0;
        else {
            if (n == 0) CombMemo[n][k] = 1;
            else if (k == 0) CombMemo[n][k] = 1;
            else if (n == k) CombMemo[n][k] = 1;
            else CombMemo[n][k] = Comb(n - 1, k - 1) + Comb(n - 1, k);
        }
    }
    return CombMemo[n][k];
}

void Solve();

signed main() { 
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(20) << fixed;
    Solve();
}

void Solve() {
  li(n,q);vli(n-1,a,b);vli(q,p,x);
  REP(i,n-1){a[i]--;b[i]--;}
  REP(i,q){p[i]--;}
  
  vvll c(n,vll(0));
  REP(i,n-1){
    c[a[i]].pb(b[i]);
    c[b[i]].pb(a[i]);
  }
  ll e(n,0);
  
  vll d(n);
  REP(i,q){
    d[p[i]]+=x[i];
  }
  
  queue<ll> s;
  
  s.push(0);
  ll t;
  
  while(!s.emp){
    t=s.front();
    e[t]=1;
    s.pop();
    REP(i,c[t].sz){
      d[c[t][i]]+=d[t];
      if(e[c[t][i]]){
        s.push(c[t][i]);
      }
    }
  }
  
  REP(i,n){
    cout << d[i] << " ";
  }
  
  return;
}









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

template <class T> using V = vector<T>;
template <class S, class T> using P = pair<S, T>;

using ll = long long;
using ull = unsigned long long;
using vll = V<ll>;
using vvll = V<vll>;
using vvvll = V<vvll>;
using pl = P<ll, ll>;
using vpl = V<pl>;
using vvpl = V<vpl>;
using vs = V<string>;
using qll = queue<ll>;
using qpl = queue<pl>;
using mapll = map<ll, ll>;
using setll = set<ll>;
using pqll = priority_queue<ll>;

#define int ll
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pob pop_back()
#define pf push_front
#define pof pop_front()
#define sz size()
#define bgn begin()
#define en end()
#define emp empty()
#define fr front()
#define bk back()
#define res resize
#define tp top()
#define p_q priority_queue
#define inv inverse()

#define FOR(i,a,b) for(ll i=(a);i<=(ll)(b);i++)
#define rFOR(i,a,b) for(ll i=(b);i>=(ll)(a);i--)
#define REP(i,a) FOR((i),0,(ll)(a)-1)
#define REP0(i,a) FOR((i),0,(ll)(a))
#define REP1(i,a) FOR((i),1,(ll)(a))
#define rREP(i,a) rFOR((i),0,(ll)(a)-1)
#define rREP0(i,a) rFOR((i),0,(ll)(a))
#define rREP1(i,a) rFOR((i),1,(ll)(a))
#define IOTA(a,n) iota((a).bgn,(a).en,(n))
#define SORT(a) sort((a).bgn,(a).en)
#define rSORT(a) sort((a).rbegin(),(a).rend())
#define UNIQUE(a) (a).erase(unique((a).bgn,(a).en),(a).en)
#define BINS(a,b) binary_search((a).bgn,(a).en,(b))
#define LOWB(a,b) (lower_bound((a).bgn,(a).en,(b))-(a).bgn)
#define UPB(a,b) (upper_bound((a).bgn,(a).en,(b))-(a).bgn)
#define CNT(a,b) count((a).bgn,(a).en,b)
#define SUM(a) accumulate((a).bgn,(a).en,0)
#define REV(a) reverse((a).bgn,(a).en)
#define yn(a) cout <<((a)?"yes":"no")<<"\n";
#define Yn(a) cout <<((a)?"Yes":"No")<<"\n";
#define YN(a) cout <<((a)?"YES":"NO")<<"\n";
#define imp(a) cout <<((a)?"possible":"impossible")<<"\n";
#define Imp(a) cout <<((a)?"Possible":"Impossible")<<"\n";
#define IMP(a) cout <<((a)?"POSSIBLE":"IMPOSSIBLE")<<"\n";
#define dbg(a) cerr <<(#a)<<": "<<(a)<<"\n";
#define DigN2(a) ((llabs(a)==0)?(1):((ll)(log2(double(llabs(a))))+1))
#define DigN10(a) ((llabs(a)==0)?(1):((ll)(log10(double(llabs(a))))+1))
#define Dig2(a,b) (((a)>>(b))&1)
#define Dig10(a,b) (ll)(((a)/((ll)(pow(10.0,(double)(b)))))%10)
#define Pow2(a) ((ll)(1)<<(a))
#define Pow10(a) ((ll)(pow(10.0,double(a))))
#define powll(a,b) (ll)(pow((double)(a),(double)(b)))

#define li(...) ll __VA_ARGS__;Input(__VA_ARGS__);
#define si(...) string __VA_ARGS__;Input(__VA_ARGS__);
#define vli(size, ...) vll __VA_ARGS__;vInput(size,__VA_ARGS__);
#define vsi(size, ...) vs __VA_ARGS__;vInput(size,__VA_ARGS__);

const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
//const ll MOD = 924844033;
//const ll MOD = 9007199254740881;
const ll INF = 1LL << 60;//1.15e18
const double PI = acos(-1.0);
const string alp = "abcdefghijklmnopqrstuvwxyz";
const string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

void Input() {}
template <class Var, class... Args> void Input(Var& var, Args&... args) {
    cin >> var;
    Input(args...);
}

void vInit(ll size) {}
template <class T, class... Args> void vInit(ll size, V<T>& v, Args&... args) {
    v.res(size);
    vInit(size, args...);
}
void vInputNum(ll num) {}
template <class T, class... Args> void vInputNum(ll num, V<T>& v, Args&... args) {
    cin >> v[num];
    vInputNum(num, args...);
}
void vInput(ll size) {}
template <class... Args> void vInput(ll size, Args&... args) {
    vInit(size, args...);
    REP(i, size) vInputNum(i, args...);
}

template <class S, class T> ostream &operator<<(ostream &out, const P<S, T> &p) {
    return out << "[" << p.fi << ", " << p.se << "]";
}
 
template <class T> ostream &operator<<(ostream &out, V<T> &v) {
    if (v.emp) return out << "{}";
    else {
        auto itr = v.bgn;
        out << "{" << *itr;
        itr++;
        while (itr != v.en) {
            out << ", " << *itr;
            itr++;
        }
        out << "}";
        return out;
    }
}
 
template <class S, class T> ostream &operator<<(ostream &out, const map<S, T> &m) {
    if (m.emp) return out << "<[]>";
    else {
        auto itr = m.bgn;
        out << "< [" << (itr->fi) << ": " << (itr->se);
        itr++;
        while (itr != m.en) {
            out << "], [" << (itr->fi) << ": " << (itr->se);
            itr++;
        }
        out << "] >";
        return out;
    }
}
 
template <class T> ostream &operator<<(ostream &out, const set<T> &s) {
    if (s.emp) return out << "<>";
    else {
        auto itr = s.bgn;
        out << "<" << *itr;
        itr++;
        while (itr != s.en) {
            out << ", " << *itr;
            itr++;
        }
        out << ">";
        return out;
    }
}

ll gcd(ll a, ll b) { if (a < b) { a ^= b; b ^= a; a ^= b; } return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }

struct UFT {

public:
    ll tsize;
    ll mode;
    vll par;
    vll rank;
    UFT() {}
    UFT(const UFT &uft) {}
    UFT(ll tsizeget, ll modeget = 0){
        tsize = tsizeget;
        mode = modeget;
        par.assign(tsize, -1);
        if (!mode) rank.res(tsize, 0);
    }
    ll root(ll x) {
        return par[x] < 0 ? x : par[x] = root(par[x]);
    }
    bool isRoot(ll x) {
        return x == root(x);
    }
    bool same(ll x, ll y) {
        return root(x) == root(y);
    }
    void merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return;
        if (mode) {
            par[x] += par[y];
            par[y] = x;
        }
        else {
            if (rank[x] < rank[y]) {
                par[y] += par[x];
                par[x] = y;
            }
            else {
                par[x] += par[y];
                par[y] = x;
                if (rank[x] == rank[y]) rank[x]++;
            }
        }
    }
    ll size(ll x) {
        return -par[root(x)];
    }
};

ll isP(ll n) {
    if (n <= 1) return 0;
    FOR(i, 2, (ll)sqrt(n) + 1) {
        if (n%i == 0) return 0;
    }
    return 1;
}

vvll CombMemo(1000, vll(1000, -1));

ll Comb(ll n, ll k) {
    if ((n < 0) || (k < 0)) return 0;
    if (CombMemo[n][k] == -1) {
        if (n < k) CombMemo[n][k] = 0;
        else {
            if (n == 0) CombMemo[n][k] = 1;
            else if (k == 0) CombMemo[n][k] = 1;
            else if (n == k) CombMemo[n][k] = 1;
            else CombMemo[n][k] = Comb(n - 1, k - 1) + Comb(n - 1, k);
        }
    }
    return CombMemo[n][k];
}

void Solve();

signed main() { 
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(20) << fixed;
    Solve();
}

void Solve() {
  li(n,q);vli(n-1,a,b);vli(q,p,x);
  REP(i,n-1){a[i]--;b[i]--;}
  REP(i,q){p[i]--;}
  
  vvll c(n,vll(0));
  REP(i,n-1){
    c[a[i]].pb(b[i]);
    c[b[i]].pb(a[i]);
  }
  vll e(n,0);
  
  vll d(n);
  REP(i,q){
    d[p[i]]+=x[i];
  }
  
  queue<ll> s;
  
  s.push(0);
  ll t;
  
  while(!s.emp){
    t=s.front();
    e[t]=1;
    s.pop();
    REP(i,c[t].sz){
      if(!e[c[t][i]]){
        d[c[t][i]]+=d[t];
        s.push(c[t][i]); 
      }
    }
  }
  
  REP(i,n){
    cout << d[i] << " ";
  }
  
  return;
}











Compiler output:
a.cc: In function 'void Solve()':
a.cc:254:11: error: expression list treated as compound expression in initializer [-fpermissive]
  254 |   ll e(n,0);
      |           ^
a.cc:268:6: error: invalid types 'll {aka long long int}[ll {aka long long int}]' for array subscript
  268 |     e[t]=1;
      |      ^
a.cc:272:11: error: invalid types 'll {aka long long int}[__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type {aka long long int}]' for array subscript
  272 |       if(e[c[t][i]]){
      |           ^
a.cc: At global scope:
a.cc:371:10: error: redefinition of 'const ll MOD'
  371 | const ll MOD = 1e9 + 7;
      |          ^~~
a.cc:79:10: note: 'const ll MOD' previously defined here
   79 | const ll MOD = 1e9 + 7;
      |          ^~~
a.cc:375:10: error: redefinition of 'const ll INF'
  375 | const ll INF = 1LL << 60;//1.15e18
      |          ^~~
a.cc:83:10: note: 'const ll INF' previously defined here
   83 | const ll INF = 1LL << 60;//1.15e18
      |          ^~~
a.cc:376:14: error: redefinition of 'const double PI'
  376 | const double PI = acos(-1.0);
      |              ^~
a.cc:84:14: note: 'const double PI' previously defined here
   84 | const double PI = acos(-1.0);
      |              ^~
a.cc:377:14: error: redefinition of 'const std::string alp'
  377 | const string alp = "abcdefghijklmnopqrstuvwxyz";
      |              ^~~
a.cc:85:14: note: 'const std::string alp' previously declared here
   85 | const string alp = "abcdefghijklmnopqrstuvwxyz";
      |              ^~~
a.cc:378:14: error: redefinition of 'const std::string ALP'
  378 | const string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
      |              ^~~
a.cc:86:14: note: 'const std::string ALP' previously declared here
   86 | const string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
      |              ^~~
a.cc:380:6: error: redefinition of 'void Input()'
  380 | void Input() {}
      |      ^~~~~
a.cc:88:6: note: 'void Input()' previously defined here
   88 | void Input() {}
      |      ^~~~~
a.cc:381:42: error: redefinition of 'template<class Var, class ... Args> void Input(Var&, Args& ...)'
  381 | template <class Var, class... Args> void Input(Var& var, Args&... args) {
      |                                          ^~~~~
a.cc:89:42: note: 'template<class Var, class ... Args> void Input(Var&, Args& ...)' previously declared here
   89 | template <class Var, class... Args> void Input(Var& var, Args&... args) {
      |                                          ^~~~~
a.cc:386:6: error: redefinition of 'void vInit(ll)'
  386 | void vInit(ll size) {}
      |      ^~~~~
a.cc:94:6: note: 'void vInit(ll)' previously defined here
   94 | void vInit(ll size) {}
      |      ^~~~~
a.cc:387:40: error: redefinition of 'template<class T, class ... Args> void vInit(ll, V<T>&, Args& ...)'
  387 | template <class T, class... Args> void vInit(ll size, V<T>& v, Args&... args) {
      |                                        ^~~~~
a.cc:95:40: note: 'template<class T, class ... Args> void vInit(ll, V<T>&, Args& ...)' previously declared here
   95 | template <class T, class... Args> void vInit(ll size, V<T>& v, Args&... args) {
      |                                        ^~~~~
a.cc:391:6: error: redefinition of 'void vInputNum(ll)'
  391 | void vInputNum(ll num) {}
      |      ^~~~~~~~~
a.cc:99:6: note: 'void vInputNum(ll)' previously defined here
   99 | void vInputNum(ll num) {}
      |      ^~~~~~~~~
a.cc:392:40: error: redefinition of 'template<class T, class ... Args> void vInputNum(ll, V<T>&, Args& ...)'
  392 | template <class T, class... Args> void vInputNum(ll num, V<T>& v, Args&... args) {
      |                                        ^~~~~~~~~
a.cc:100:40: note: 'template<class T, class ... Args> void vInputNum(ll, V<T>&, Args& ...)' previously declared here
  100 | template <class T, class... Args> void vInputNum(ll num, V<T>& v, Args&... args) {
      |                                        ^~~~~~~~~
a.cc:396:6: error: redefinition of 'void vInput(ll)'
  396 | void vInput(ll size) {}
      |      ^~~~~~
a.cc:104:6: note: 'void vInput(ll)' previously defined here
  104 | void vInput(ll size) {}
      |      ^~~~~~
a.cc:397:31: error: redefinition of 'template<class ... Args> void vInput(ll, Args& ...)'
  397 | template <class... Args> void vInput(ll size, Args&... args) {
      |                               ^~~~~~
a.cc:105:31: note: 'template<class ... Args> void vInput(ll, Args& ...)' previously declared here
  105 | template <class... Args> void vInput(ll size, Args&... args) {
      |                               ^~~~~~
a.cc:402:38: error: redefinition of 'template<class S, class T> std::ostream& operator<<(std::ostream&, P<S, T>&)'
  402 | template <class S, class T> ostream &operator<<(ostream &out, const P<S, T> &p) {
      |                                      ^~~~~~~~
a.cc:110:38: note: 'template<class S, class T> std::ostream& operator<<(std::ostream&, P<S, T>&)' previously declared here
  110 | template <class S, class T> ostream &operator<<(ostream &out, const P<S, T> &p) {
      |                                      ^~~~~~~~
a.cc:406:29: error: redefinition of 'template<class T> std::ostream& operator<<(std::ostream&, V<T>&)'
  406 | template <class T> ostream &operator<<(ostream &out, V<T> &v) {
      |                             ^~~~~~~~
a.cc:114:29: note: 'template<class T> std::ostream& operator<<(std::ostream&, V<T>&)' previously declared here
  114 | template <class T> ostream &operator<<(ostream &out, V<T> &v) {
      |                             ^~~~~~~~
a.cc:421:38: error: redefinition of 'template<class S, class T> std::ostream& operator<<(std::ostream&, const std::map<S, T>&)'
  421 | template <class S, class T> ostream &operator<<(ostream &out, const map<S, T> &m) {
      |                                      ^~~~~~~~
a.cc:129:38: note: 'template<class S, class T> std::ostream& operator<<(std::ostream&, const std::map<S, T>&)' previously declared here
  129 | template <class S, class T> ostream &operator<<(ostream &out, const map<S, T> &m) {
      |                                      ^~~~~~~~
a.cc:436:29: error: redefinition of 'template<class T> std::ostream& operator<<(std::ostream&, const std::set<T>&)'
  436 | template <class T> ostream &operator<<(ostream &out, const set<T> &s) {
      |                             ^~~~~~~~
a.cc:144:29: note: 'template<class T> std::ostream& operator<<(std::ostream&, const std::set<T>&)' previously declared here
  144 | template <class T> ostream &operator<<(ostream &out, const set<T> &s) {
      |                             ^~~~~~~~
a.cc:451:4: error: redefinition of 'll gcd(ll, ll)'
  451 | ll gcd(ll a, ll b) { if (a < b) { a ^= b; b ^= a; a ^= b; } return b ? gcd(b, a%b) : a; }
      |    ^~~
a.cc:159:4: note: 'll gcd(ll, ll)' previously defined here
  159 | ll gcd(ll a, ll b) { if (a < b) { a ^= b; b ^= a; a ^= b; } return b ? gcd(b, a%b) : a; }
      |    ^~~
a.cc:452:4: error: redefinition of 'll lcm(ll, ll)'
  452 | ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
      |    ^~~
a.cc:160:4: note: 'll lcm(ll, ll)' previously defined here
  160 | ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
      |    ^~~
a.cc:454:8: error: redefinition of 'struct UFT'
  454 | struct UFT {
      |        ^~~
a.cc:162:8: note: previous definition of 'struct UFT'
  162 | struct UFT {
      |        ^~~
a.cc:503:4: error: redefinition of 'll isP(ll)'
  503 | ll isP(ll n) {
      |    ^~~
a.cc:211:4: note: 'll isP(ll)' previously defined here
  211 | ll isP(ll n) {
      |    ^~~
a.cc:511:6: error: redefinition of 'vvll CombMemo'
  511 | vvll CombMemo(1000, vll(1000, -1));
      |      ^~~~~~~~
a.cc:219:6: note: 'vvll CombMemo' previously declared here
  219 | vvll CombMemo(1000, vll(1000, -1));
      |      ^~~~~~~~
a.cc:513:4: error: redefinition of 'll Comb(ll, ll)'
  513 | ll Comb(ll n, ll k) {
      |    ^~~~
a.cc:221:4: note: 'll Comb(ll, ll)' previously defined here
  221 | ll Comb(ll n, ll k) {
      |    ^~~~
a.cc:529:8: error: redefinition of 'int main()'
  529 | signed main() {
      |        ^~~~
a.cc:237:8: note: 'int main()' previously defined here
  237 | signed main() {
      |        ^~~~
a.cc:536:6: error: redefinition of 'void Solve()'
  536 | void Solve() {
      |      ^~~~~
a.cc:244:6: note: 'void Solve()' previously defined here
  244 | void Solve() {
      |      ^~~~~