func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 5e5 + 5;   const long long inf = 0x3f3f3f3f3f3f3f3f;   int n, m, q, u[N], v[N], w[N];   long long d[2][N];   bool vis[N];   vector<pair<long long, int> > g[N];   pair<long long, int> pre[N];   void dij(int s, long long d[]) {     for (int i = (1); i < (n + 1); i++) d[i] = inf, vis[i] = 0;     d[s] = 0;     priority_queue<pair<long long, int> > q;     q.push(pair<long long, int>(0, s));     while (!q.empty()) {       int u = q.top().second;       q.pop();       if (vis[u]) continue;       vis[u] = 1;       for (auto it : g[u]) {         if (d[u] + w[it.second] < d[it.first]) {           d[it.first] = d[u] + w[it.second];           pre[it.first] = pair<long long, int>(u, it.second);           q.push(pair<long long, int>(-d[it.first], it.first));         }       }     }   }   int k[N], e[N];   bool used[N], in[N];   vector<long long> ad[N], del[N];   long long mn[N];   int main() {     scanf( %d%d%d , &n, &m, &q);     for (int i = (1); i < (m + 1); i++) {       scanf( %d%d%d , &u[i], &v[i], &w[i]);       g[u[i]].push_back(pair<long long, int>(v[i], i));       g[v[i]].push_back(pair<long long, int>(u[i], i));     }     dij(n, d[1]);     dij(1, d[0]);     vector<int> vec;     for (int i = (2); i < (n + 1); i++) used[pre[i].second] = 1;     pre[1] = pair<long long, int>(0, 0);     for (int i = n; i >= 1; i = pre[i].first)       in[pre[i].second] = 1, vec.push_back(i);     int cnt = 0;     reverse(vec.begin(), vec.end());     for (auto v : vec) k[v] = ++cnt;     for (int i = (1); i < (n + 1); i++) {       if (d[0][i] == inf) continue;       if (!k[i]) {         int u = i;         for (; !k[u]; u = pre[u].first)           ;         for (int v = i; !k[v]; v = pre[v].first) k[v] = k[u];       }     }     for (int i = (1); i < (m + 1); i++) {       if (used[i]) continue;       int l = k[u[i]], r = k[v[i]];       if (l == r) continue;       if (l > r) swap(u[i], v[i]), swap(l, r);       ad[l].push_back(d[0][u[i]] + w[i] + d[1][v[i]]);       del[r].push_back(d[0][u[i]] + w[i] + d[1][v[i]]);     }     multiset<long long> S;     S.insert(inf);     for (int i = (1); i < (cnt); i++) {       for (auto v : del[i]) S.erase(S.find(v));       for (auto v : ad[i]) S.insert(v);       mn[i] = *(S.begin());     }     int x, y;     while (q--) {       scanf( %d%d , &x, &y);       long long ans = min(d[0][u[x]] + d[1][v[x]], d[0][v[x]] + d[1][u[x]]) + y;       if (!in[x]) {         ans = min(ans, d[0][n]);       } else {         ans = min(ans, mn[min(k[u[x]], k[v[x]])]);       }       printf( %lld n , ans);     }     return 0;   }   