# Difference between the shortest and second shortest path in an Unweighted Bidirectional Graph

#include using namespace std;  void get_edges(int s, vector& edges, vector p){    if (s == -1)        return;    get_edges(p[s], edges, p);    edges.push_back(s);}  void dist_helper(vector graph, vector& d,                 int v1, int v2, int n){        vector v(n, 0);          queue q;    q.push(make_pair(0, 0));    v[0] = 1;          while (!q.empty()) {        auto a = q.front();        q.pop();        for (int i : graph[a.first]) {            if ((i == v1 && a.first == v2)                || (i == v2 && a.first == v1))                continue;            if (v[i] == 0) {                d[i] = 1 + a.second;                v[i] = 1;                q.push(make_pair(i, d[i]));            }        }    }}  void dist(vector graph, vector& d,          vector& p, int n){        vector v(n, 0);          queue q;    q.push(make_pair(0, 0));    v[0] = 1;          while (!q.empty()) {        auto a = q.front();        q.pop();        for (int i : graph[a.first]) {            if (v[i] == 0) {                p[i] = a.first;                d[i] = 1 + a.second;                v[i] = 1;                q.push(make_pair(i, d[i]));            }        }    }}  void findDifference(int n, int m, int arr[][2]){          vector graph(n, vector());    for (int i = 0; i < m; i++) {        int a, b;        a = arr[i][0];        b = arr[i][1];        graph[a - 1].push_back(b - 1);        graph[b - 1].push_back(a - 1);    }          vector p(n, -1);    vector d(n, 1e9);          dist(graph, d, p, n);              vector distances;    distances.push_back(d[n - 1]);      vector edges;          get_edges(n - 1, edges, p);          for (int i = 0; i + 1 < edges.size(); i++) {                        dist_helper(graph, d, edges[i], edges[i + 1], n);        distances.push_back(d[n - 1]);    }          sort(distances.begin(), distances.end());    if (distances.size() == 1)        cout