func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 100012, H = 20;   vector<int> e[N], g[N];   stack<int> Z;   int n, m, tot, tim, low[N], rea[N], f[N], d[N];   int fa[N][H], k;   bool v[N];   void dfs(int fa, int now) {     low[now] = rea[now] = tim++;     v[now] = true;     Z.push(now);     int top = int(e[now].size());     for (int i = 0; i < top; ++i) {       int next = e[now][i];       if (next != fa) {         if (!v[next]) dfs(now, next);         low[now] = min(low[now], low[next]);       }     }     if (low[now] == rea[now]) {       int last = -1;       ++tot;       while (last != now) {         last = Z.top();         f[last] = tot;         Z.pop();       }     }   }   void work(int now, int p) {     fa[now][0] = p;     int top = int(g[now].size());     for (int j = 0; j < top; ++j)       if (fa[now][0] != g[now][j])         d[g[now][j]] = d[now] + 1, work(g[now][j], now);   }   void gao() {     for (int j = 1; j < H; ++j)       for (int i = 1; i <= tot; ++i) fa[i][j] = fa[fa[i][j - 1]][j - 1];   }   inline int find(int x, int y) {     if (d[x] < d[y]) swap(x, y);     for (int i = H - 1; i >= 0; --i)       if (d[fa[x][i]] >= d[y]) x = fa[x][i];     if (x == y) return x;     for (int i = H - 1; i >= 0; --i)       if (fa[x][i] != fa[y][i]) x = fa[x][i], y = fa[y][i];     return fa[x][0];   }   int main() {     scanf( %d%d , &n, &m);     int a, b;     for (int i = 1; i <= m; ++i) {       scanf( %d%d , &a, &b);       e[a].push_back(b);       e[b].push_back(a);     }     for (int i = 1; i <= n; ++i)       if (!v[i]) dfs(-1, i);     for (int a = 1; a <= n; ++a)       for (int j = 0, top = int(e[a].size()); j < top; ++j) {         b = e[a][j];         if (f[a] != f[b]) {           g[f[a]].push_back(f[b]);           g[f[b]].push_back(f[a]);         }       }     d[0] = 0;     d[f[1]] = 1;     work(f[1], 0);     gao();     scanf( %d n , &k);     for (int i = 1; i <= k; ++i) {       scanf( %d%d , &a, &b);       a = f[a];       b = f[b];       int c = find(a, b);       printf( %d n , d[a] + d[b] - 2 * d[c]);     }   }   