func_code_string: #include <bits/stdc++.h>   using namespace std;   vector<int> in[101000];   int n, m, k, curt;   int up[101000], t[101000], tout[101000], ans[101000];   int jmp[101000][20];   char used[101000];   void dfs(int v, int p) {     if (used[v]) return;     used[v] = 1;     t[v] = curt++;     up[v] = t[v];     for (unsigned int i = 0; i < in[v].size(); i++)       if (used[in[v][i]]) {         if (p != in[v][i]) up[v] = min(up[v], t[in[v][i]]);       } else {         dfs(in[v][i], v);         up[v] = min(up[v], up[in[v][i]]);       }   }   void dfs2(int v, int cur) {     if (used[v]) return;     used[v] = 1;     ans[v] = cur;     for (unsigned int i = 0; i < in[v].size(); i++)       if (!used[in[v][i]] && !((t[v] < t[in[v][i]] && up[in[v][i]] > t[v]) ||                                (t[v] > t[in[v][i]] && up[v] > t[in[v][i]])))         dfs2(in[v][i], cur);     for (unsigned int i = 0; i < in[v].size(); i++)       if (!used[in[v][i]] && ((t[v] < t[in[v][i]] && up[in[v][i]] > t[v]) ||                               (t[v] > t[in[v][i]] && up[v] > t[in[v][i]])))         dfs2(in[v][i], cur + 1);   }   void getLCA(int v, int p) {     if (used[v]) return;     used[v] = 1;     t[v] = curt++;     jmp[v][0] = p;     for (int i = 1; i <= 18; ++i) jmp[v][i] = jmp[jmp[v][i - 1]][i - 1];     for (unsigned int i = 0; i < in[v].size(); i++)       if (in[v][i] != p) getLCA(in[v][i], v);     tout[v] = curt++;   }   char upp(int a, int b) { return t[a] <= t[b] && tout[a] >= tout[b]; }   int lca(int a, int b) {     if (upp(a, b)) return a;     if (upp(b, a)) return b;     for (int i = 18; i >= 0; --i)       if (!upp(jmp[a][i], b)) a = jmp[a][i];     return jmp[a][0];   }   int main(void) {     cin >> n >> m;     for (int i = 0; i < m; i++) {       int q, w;       cin >> q >> w;       in[q].push_back(w);       in[w].push_back(q);     }     dfs(1, -1);     memset(used, 0, sizeof(used));     curt = 0;     dfs2(1, 0);     curt = 0;     memset(used, 0, sizeof(used));     getLCA(1, 1);     cin >> k;     for (int i = 0; i < k; i++) {       int q, w;       cin >> q >> w;       int l = lca(q, w);       cout << ans[q] + ans[w] - 2 * ans[l] << endl;     }     return 0;   }   