func_code_string: #include <bits/stdc++.h>   using namespace std;   const int prime = 999983;   const int INF = 0x7FFFFFFF;   const long long INFF = 0x7FFFFFFFFFFFFFFF;   const double pi = acos(-1.0);   const double inf = 1e18;   const double eps = 1e-6;   const long long mod = 1e9 + 7;   long long qpow(long long a, long long b) {     long long s = 1;     while (b > 0) {       if (b & 1) s = s * a % mod;       a = a * a % mod;       b >>= 1;     }     return s;   }   long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }   int dr[2][4] = {1, -1, 0, 0, 0, 0, -1, 1};   using namespace std;   const int N = 2e5 + 5;   int n, m, q, to[N << 1], nxt[N << 1], ww[N << 1], head[N];   int vis[N], o[N], len, pre[N], id[N], mrk[N];   long long dis[N], sid[N], tr[N << 2];   vector<int> E[N];   priority_queue<pair<long long, int>, vector<pair<long long, int>>,                  greater<pair<long long, int>>>       Q;   void spfa(int s) {     memset(dis, 63, sizeof(dis));     memset(vis, 0, sizeof(vis));     Q.push(make_pair(dis[s] = 0, s));     pre[s] = 0;     while (!Q.empty()) {       int u = Q.top().second;       Q.pop();       if (vis[u]) continue;       vis[u] = 1;       for (int e = head[u]; e; e = nxt[e]) {         int v = to[e], w = ww[e];         if (dis[v] > dis[u] + w)           pre[v] = e, Q.push(make_pair(dis[v] = dis[u] + w, v));       }     }   }   void dfs(int u) {     for (int v : E[u]) {       if (!id[v]) id[v] = id[u];       dfs(v);     }   }   void modify(int x, int l, int r, int ql, int qr, long long v) {     if (l >= ql && r <= qr) {       tr[x] = min(tr[x], v);       return;     }     int mid = (l + r) >> 1;     if (ql <= mid) modify(x << 1, l, mid, ql, qr, v);     if (qr > mid) modify(x << 1 | 1, mid + 1, r, ql, qr, v);   }   long long query(int x, int l, int r, int p) {     if (l == r) return tr[x];     int mid = (l + r) >> 1;     if (p <= mid)       return min(tr[x], query(x << 1, l, mid, p));     else       return min(tr[x], query(x << 1 | 1, mid + 1, r, p));   }   int main() {     ios::sync_with_stdio(false);     cin >> n >> m >> q;     for (int i = 1, j = 1; i <= m; ++i) {       int u, v, w;       cin >> u >> v >> w;       to[++j] = v;       nxt[j] = head[u];       ww[j] = w;       head[u] = j;       to[++j] = u;       nxt[j] = head[v];       ww[j] = w;       head[v] = j;     }     spfa(n);     memcpy(sid, dis, sizeof(sid));     spfa(1);     for (int i = n; i > 1; i = to[pre[i] ^ 1]) {       o[++len] = i, mrk[pre[i] >> 1] = 1;     }     o[++len] = 1, reverse(o + 1, o + len + 1);     for (int i = 1; i <= len; ++i) {       id[o[i]] = i;     }     for (int i = 2; i <= n; ++i)       if (pre[i]) {         E[to[pre[i] ^ 1]].push_back(i);       }     dfs(1);     memset(tr, 63, sizeof(tr));     for (int i = 1; i <= n; ++i) {       for (int e = head[i]; e; e = nxt[e]) {         int u = i, v = to[e];         if (id[u] >= id[v] || mrk[e >> 1]) continue;         modify(1, 1, len, id[u], id[v] - 1, dis[u] + ww[e] + sid[v]);       }     }     while (q--) {       int x, y;       cin >> x >> y;       x <<= 1;       if (mrk[x >> 1]) {         if (id[to[x]] > id[to[x ^ 1]]) x ^= 1;         printf( %lld n , min(dis[n] - ww[x] + y, query(1, 1, len, id[to[x]])));       } else {         printf( %lld n , min(dis[n], min(dis[to[x]] + sid[to[x ^ 1]],                                          dis[to[x ^ 1]] + sid[to[x]]) +                                          y));       }     }   }   