func_code_string: #include <bits/stdc++.h>   using namespace std;   vector<vector<int> > edges(2e5 + 5);   bool vis[200005];   int lev[200005];   int n, m, a, b, mx;   void bfs(int node) {     int level = 0;     deque<pair<int, int> > dq;     dq.push_back({level, node});     vis[node] = 1;     while (!dq.empty()) {       node = dq.front().second, level = dq.front().first;       lev[node] = level;       dq.pop_front();       for (auto i : edges[node])         if (!vis[i]) dq.push_back({level + 1, i}), vis[node] = 1;     }     memset(vis, 0, sizeof vis), a = 0;   }   void dfs(int node) {     if (a >= lev[node]) return;     vis[node] = 1;     mx = max(mx, lev[node]);     for (auto i : edges[node])       if (!vis[i]) a++, dfs(i), a--;   }   int main() {     ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);     cin >> n >> m;     for (int i = 1; i < n; i++)       cin >> a >> b, edges[a].push_back(b), edges[b].push_back(a);     bfs(1);     dfs(m);     cout << mx * 2 << endl;     return 0;   }   