func_code_string: #include <bits/stdc++.h>   using namespace std;   vector<pair<int, int> > a[100500];   int d[100500];   int main() {     int n, m, cap;     scanf( %d%d%d , &n, &m, &cap);     cap--;     for (int i = 0; i < (m); i++) {       int x, y, w;       scanf( %d%d%d , &x, &y, &w);       x--, y--;       a[x].push_back(pair<int, int>(y, w));       a[y].push_back(pair<int, int>(x, w));     }     int l;     scanf( %d , &l);     const int INF = 1100000000;     for (int i = 0; i < (n); i++) d[i] = INF;     d[cap] = 0;     set<pair<int, int> > s;     s.insert(pair<int, int>(d[cap], cap));     while (!s.empty()) {       int v = s.begin()->second;       s.erase(s.begin());       for (typeof((a[v]).begin()) it = (a[v]).begin(); it != (a[v]).end(); ++it) {         int u = it->first;         int w = it->second;         if (d[u] >= INF || d[u] >= d[v] + w) {           if (d[u] < INF) s.erase(s.find(pair<int, int>(d[u], u)));           d[u] = d[v] + w;           s.insert(pair<int, int>(d[u], u));         }       }     }     int ans = 0;     for (int i = 0; i < (n); i++)       for (typeof((a[i]).begin()) it = (a[i]).begin(); it != (a[i]).end(); ++it) {         int u = i;         int v = it->first;         int w = it->second;         int x = d[v] - d[u] + w;         assert(0 <= x && x <= w + w);         if (0 < x && x < w + w) {           if (d[u] < l && l + l <= 2 * d[u] + x) ans++;           if (d[v] < l && l + l <= 2 * d[v] + w + w - x) ans++;           if (l + l == 2 * d[u] + x && l + l == 2 * d[v] + w + w - x) ans--;         } else {           if (min(d[u], d[v]) < l && l < max(d[u], d[v])) ans++;         }       }     ans >>= 1;     for (int i = 0; i < (n); i++) ans += d[i] == l;     printf( %d n , ans);     return 0;   }   