func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 1e5 + 10;   int n, m, u, v, w, answer, capital, intree, l, dis[N];   vector<pair<int, int> > nei[N];   vector<pair<int, pair<int, int> > > edge;   bool done[N];   priority_queue<pair<int, int> > pq;   int main() {     cin >> n >> m >> capital;     capital--;     for (int i = 0; i < m; i++) {       cin >> u >> v >> w;       u--, v--;       nei[v].push_back(make_pair(u, w));       nei[u].push_back(make_pair(v, w));       edge.push_back(make_pair(w, make_pair(u, v)));     }     cin >> l;     done[capital] = true;     for (int i = 0; i < nei[capital].size(); i++) {       pq.push(make_pair(-nei[capital][i].second, nei[capital][i].first));     }     while (intree < n - 1) {       while (done[(pq.top()).second]) pq.pop();       pair<int, int> p = pq.top();       v = p.second;       dis[v] = -p.first;       done[v] = true;       for (int i = 0; i < nei[v].size(); i++) {         if (!done[nei[v][i].first])           pq.push(make_pair(-dis[v] - nei[v][i].second, nei[v][i].first));       }       intree++;     }     for (int i = 0; i < n; i++) {       answer += (dis[i] == l);     }     for (int i = 0; i < m; i++) {       pair<int, pair<int, int> > pa = edge[i];       for (int j = 1; j < pa.first; j++) {         if (min(dis[pa.second.first] + j, dis[pa.second.second] + pa.first - j) ==             l) {           answer++;         }       }     }     cout << answer;     return 0;   }   