func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 2000010;   long long n, m, s, l;   vector<pair<long long, long long> > Adj[N];   long long Dis[N], Ans;   set<pair<long long, long long> > Res;   vector<pair<long long, pair<long long, long long> > > Edges;   void Dik() {     for (int i = 0; i <= n; i++) Dis[i] = 1e18;     Dis[s] = 0;     set<pair<long long, long long> > S;     S.insert({0, s});     while (!S.empty()) {       auto Cur = *S.begin();       S.erase(S.begin());       for (int i = 0; i < Adj[Cur.second].size(); i++) {         int to = Adj[Cur.second][i].first;         long long w = Adj[Cur.second][i].second;         if (Dis[to] > Cur.first + w) {           Dis[to] = Cur.first + w;           S.insert({Dis[to], to});         }       }     }   }   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     cin >> n >> m >> s;     for (int i = 0; i < m; i++) {       int a, b, w;       cin >> a >> b >> w;       Edges.push_back({w, {a, b}});       Adj[a].push_back({b, w});       Adj[b].push_back({a, w});     }     cin >> l;     if (l == 0) {       cout << 1 << endl;       return 0;     }     Dik();     for (int i = 1; i <= n; i++)       if (Dis[i] == l) Ans++;     for (int i = 0; i < Edges.size(); i++) {       int a = Edges[i].second.first;       int b = Edges[i].second.second;       long long w = Edges[i].first;       if (Dis[a] < l && Dis[a] + w > l && (w - (l - Dis[a])) + Dis[b] >= l) {         Ans++;       }       if (Dis[b] < l && Dis[b] + w > l && (w - (l - Dis[b])) + Dis[a] >= l) {         Ans++;       }       if (Dis[a] < l && Dis[a] + w > l && (w - (l - Dis[a])) + Dis[b] >= l) {         if (Dis[b] < l && Dis[b] + w > l && (w - (l - Dis[b])) + Dis[a] >= l) {           if (w - (l - Dis[a]) == (l - Dis[b])) Ans--;         }       }     }     cout << Ans << endl;     return 0;   }   