func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAXN = (2e5 + 42);   const int MAXLOG = 20;   const int64_t inf = (int64_t)1e18;   int n, m, S;   vector<pair<int, int> > G[MAXN];   void read() {     cin >> n >> m >> S;     for (int i = 0; i < m; i++) {       int u, v, w;       cin >> u >> v >> w;       G[u].push_back({v, w});       G[v].push_back({u, w});     }   }   bool in_queue[MAXN];   vector<int> pars[MAXN], adj[MAXN];   int64_t dist[MAXN];   int par[MAXN][MAXLOG], d[MAXN];   int lca(int u, int v) {     if (d[u] < d[v]) swap(u, v);     for (int lg = MAXLOG - 1; lg >= 0; lg--)       if (d[par[u][lg]] >= d[v]) u = par[u][lg];     if (u == v) return u;     for (int lg = MAXLOG - 1; lg >= 0; lg--)       if (par[u][lg] != par[v][lg]) u = par[u][lg], v = par[v][lg];     return par[u][0];   }   void spfa(int st) {     for (int i = 0; i <= n; i++) dist[i] = inf, adj[i].clear(), in_queue[i] = 0;     queue<int> Q;     in_queue[st] = 1;     dist[st] = 0;     Q.push(st);     while (!Q.empty()) {       int u = Q.front();       in_queue[u] = 0;       Q.pop();       for (auto e : G[u]) {         int v = e.first, w = e.second;         if (dist[v] > dist[u] + w) {           dist[v] = dist[u] + w;           if (!in_queue[v]) Q.push(v);           in_queue[v] = 1;         }       }     }     for (int i = 1; i <= n; i++)       for (auto e : G[i])         if (dist[e.first] == dist[i] + e.second) pars[e.first].push_back(i);   }   int tr_sz[MAXN];   void dfs(int u) {     tr_sz[u] = 1;     for (int v : adj[u]) {       dfs(v);       tr_sz[u] += tr_sz[v];     }   }   void solve() {     spfa(S);     int ans = 0;     vector<pair<int64_t, int> > order;     for (int i = 1; i <= n; i++)       if (dist[i] < inf) order.push_back({dist[i], i});     sort(order.begin(), order.end());     for (int i = 0; i < MAXLOG; i++) par[S][i] = S;     for (pair<int64_t, int> e : order) {       if (e.second == S) continue;       int u = e.second;       int l = pars[u][0];       for (int anc : pars[u]) l = lca(l, anc);       par[u][0] = l;       d[u] = d[l] + 1;       adj[l].push_back(u);       for (int lg = 1; lg < MAXLOG; lg++)         par[u][lg] = par[par[u][lg - 1]][lg - 1];     }     dfs(S);     for (int i = 1; i <= n; i++)       if (dist[i] < inf && i != S) ans = max(ans, tr_sz[i]);     cout << ans <<   n ;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     read();     solve();     return 0;   }   