Shortest distance between two nodes in Graph by reducing weight of an edge by half

  #include using namespace std;  vector graph[100001];  vector edges;  void add_edge(int u, int v, int w){    graph[u].push_back({ v, w });    graph[v].push_back({ u, w });    edges.push_back({ u, v, w });}  vector dijsktras(int src, int N){            vector dis(N, INT_MAX);      vector vis(N, false);              priority_queue        pq;    pq.push({ 0, src });    dis[src] = 0;              while (!pq.empty()) {                  auto cur = pq.top();        pq.pop();                  int node = cur.second;        int weight = cur.first;                  if (vis[node])            continue;        vis[node] = true;                          for (auto child : graph[node]) {                                                              if (dis[child.first]                > child.second + weight) {                dis[child.first] = weight                                   + child.second;                                                  pq.push({ dis[child.first],                          child.first });            }        }    }          return dis;}  int shortestDistance(int N, int M,                     int A, int B){            vector disA = dijsktras(A, N);              vector disB = dijsktras(B, N);      int ans = disA[B];    for (auto edge : edges) {        int u = edge[0], v = edge[1];        int weight = edge[2];                          int cur = min(disA[u] + disB[v],                      disA[v] + disB[u])                  + (weight / 2);                          ans = min(ans, cur);    }          return ans;}  int main(){    int N = 9, M = 14, A = 0, B = 2;          add_edge(0, 1, 4);    add_edge(1, 2, 8);    add_edge(2, 3, 7);    add_edge(3, 4, 9);    add_edge(4, 5, 10);    add_edge(5, 6, 2);    add_edge(6, 7, 1);    add_edge(7, 0, 8);    add_edge(1, 7, 11);    add_edge(7, 8, 7);    add_edge(2, 8, 2);    add_edge(6, 8, 6);    add_edge(2, 5, 4);    add_edge(3, 5, 14);          cout