func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAXN = 100010;   const int MAXK = 20;   int times[MAXN];   int dp[MAXN][MAXK];   int subtree[MAXN];   int marc[MAXN];   int prof[MAXN];   vector<int> graph[MAXN];   vector<pair<int, int>> arcs;   void init_dfs(int u) {     marc[u] = 1;     for (int v : graph[u]) {       if (marc[v]) continue;       dp[v][0] = u;       for (int i = 1; i < MAXK; ++i) dp[v][i] = dp[dp[v][i - 1]][i - 1];       prof[v] = prof[u] + 1;       init_dfs(v);     }   }   inline int lca(int a, int b) {     if (prof[a] > prof[b]) swap(a, b);     int d = prof[b] - prof[a];     for (int i = 0; i < MAXK; ++i)       if (d & (1 << i)) b = dp[b][i];     if (a == b) return a;     for (int i = MAXK - 1; i >= 0; --i)       if (dp[a][i] != dp[b][i]) {         a = dp[a][i];         b = dp[b][i];       }     return dp[a][0];   }   inline void add_path(int u, int v) {     ++times[u];     --times[v];   }   inline void add_arc(int u, int v) {     graph[u].push_back(v);     graph[v].push_back(u);     arcs.push_back({u, v});   }   void final_dfs(int u) {     marc[u] = 2;     subtree[u] = times[u];     for (int v : graph[u]) {       if (marc[v] == 2) continue;       final_dfs(v);       subtree[u] += subtree[v];     }   }   int main() {     int n;     scanf( %d , &n);     for (int i = 0; i < n - 1; ++i) {       int u, v;       scanf( %d%d , &u, &v);       add_arc(u, v);     }     init_dfs(1);     int k;     scanf( %d , &k);     for (int i = 0; i < k; ++i) {       int u, v;       scanf( %d%d , &u, &v);       int w = lca(u, v);       add_path(u, w);       add_path(v, w);     }     final_dfs(1);     for (auto [u, v] : arcs) {       if (prof[u] < prof[v]) swap(u, v);       printf( %d  , subtree[u]);     }     printf(  n );   }   