func_code_string: #include <bits/stdc++.h>   using namespace std;   const int inf = ~0ull / 2;   const int maxn = 100100;   int seen[maxn];   int ind[maxn];   int par[maxn][22];   int bd[maxn];   int h[maxn];   vector<int> adj[maxn];   vector<int> adlist[maxn];   vector<int> tree[maxn];   vector<pair<int, int> > edges;   void dfs1(int root, int dad = -1) {     seen[root] = 1;     bd[root] = h[root];     for (auto v : adj[root]) {       if (!seen[v]) {         h[v] = h[root] + 1;         dfs1(v, root);         bd[root] = min(bd[v], bd[root]);         if (!(bd[v] > h[root])) {           adlist[root].push_back(v);           adlist[v].push_back(root);         } else {           edges.push_back(make_pair(root, v));         }       } else {         if (v != dad) {           adlist[root].push_back(v);           adlist[v].push_back(root);           bd[root] = min(bd[root], h[v]);         }       }     }   }   void dfs2(int root, int t) {     seen[root] = 2;     ind[root] = t;     for (auto v : adlist[root]) {       if (seen[v] == 1) {         dfs2(v, t);       }     }   }   void dfs3(int root, int dad) {     par[root][0] = dad;     for (auto v : tree[root]) {       if (v != dad) {         h[v] = h[root] + 1;         dfs3(v, root);       }     }   }   int dis(int x, int y) {     x = ind[x];     y = ind[y];     if (h[x] < h[y]) swap(x, y);     int X = x;     int Y = y;     int t = 20;     while (h[x] != h[y]) {       if (h[par[x][t]] >= h[y]) x = par[x][t];       t--;     }     if (x == y) return h[X] - h[x];     int A;     t = 20;     while (par[x][0] != par[y][0] and t >= 0) {       if (par[x][t] != par[y][t]) {         x = par[x][t];         y = par[y][t];       }       t--;     }     A = par[x][0];     return (h[X] + h[Y] - 2 * h[A]);   }   int main() {     ios::sync_with_stdio(false), cin.tie(0);     int n, m, k;     cin >> n >> m;     for (int i = 0; i < m; i++) {       int a, b;       cin >> a >> b;       a--, b--;       adj[a].push_back(b);       adj[b].push_back(a);     }     dfs1(0);     int t = 1;     for (int i = 0; i < n; i++) {       if (seen[i] == 1) {         dfs2(i, t);         t++;       }     }     for (auto e : edges) {       int x = e.first;       int y = e.second;       x = ind[x];       y = ind[y];       tree[x].push_back(y);       tree[y].push_back(x);     }     h[0] = 0;     h[1] = 1;     dfs3(1, 0);     fill(par[0], par[0] + 22, 0);     for (int i = 1; i < 22; i++)       for (int j = 1; j < t; j++) par[j][i] = par[par[j][i - 1]][i - 1];     cin >> k;     for (int i = 0; i < k; i++) {       int s, l;       cin >> s >> l;       s--, l--;       cout << dis(s, l) <<   n ;     }   }   