func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 400010;   int h[N], ne[N], e[N], idx;   int n;   long long sz[N], dp[N], ans;   void add(int a, int b) { e[idx] = b, ne[idx] = h[a], h[a] = idx++; }   void dfs(int u, int fa) {     sz[u] = 1;     for (int i = h[u]; ~i; i = ne[i]) {       int j = e[i];       if (j == fa) continue;       dfs(j, u);       sz[u] += sz[j];     }   }   void dfs2(int u, int fa) {     for (int i = h[u]; ~i; i = ne[i]) {       int j = e[i];       if (j == fa) continue;       dp[j] = dp[u] + n - 2 * sz[j];       dfs2(j, u);     }   }   void init(int u, int fa) {     ans += sz[u];     for (int i = h[u]; ~i; i = ne[i]) {       int j = e[i];       if (j == fa) continue;       init(j, u);     }   }   int main() {     cin >> n;     memset(h, -1, sizeof h);     for (int i = 1; i < n; ++i) {       int a, b;       scanf( %d%d , &a, &b);       add(a, b), add(b, a);     }     dfs(1, 1);     init(1, 1);     dp[1] = ans;     dfs2(1, 1);     long long maxx = 0;     for (int i = 1; i <= n; ++i) maxx = max(maxx, dp[i]);     cout << maxx;     return 0;   }   