func_code_string: #include <bits/stdc++.h>   using namespace std;   int read() {     char ch = getchar();     int x = 0, fl = 1;     for (; !isdigit(ch); ch = getchar())       if (ch ==  - ) fl = -1;     for (; isdigit(ch); ch = getchar()) x = (x << 3) + (x << 1) + (ch -  0 );     return x * fl;   }   const int N = 300005;   const long long INF = 1e18;   int n, m, s, dep[N], ff[N], fa[N][21], de[N];   long long dis[N];   bool vis[N];   vector<pair<int, int> > adj[N];   vector<int> bdj[N];   priority_queue<pair<long long, int> > q;   void dij() {     for (int i = 1; i <= n; i++) dis[i] = INF;     while (!q.empty()) q.pop();     dis[s] = 0LL;     q.push(make_pair(0LL, s));     while (!q.empty()) {       int x = q.top().second;       q.pop();       if (vis[x]) continue;       vis[x] = 1;       for (auto e : adj[x]) {         int y = e.first;         long long w = e.second;         if (dis[y] > dis[x] + w) {           dis[y] = dis[x] + w;           q.push(make_pair(-dis[y], y));         }       }     }   }   int lca(int x, int y) {     if (dep[x] < dep[y]) swap(x, y);     for (int i = 20; ~i; i--)       if (dep[fa[x][i]] >= dep[y]) x = fa[x][i];     for (int i = 20; ~i; i--)       if (fa[x][i] != fa[y][i]) x = fa[x][i], y = fa[y][i];     return (x == y) ? x : fa[x][0];   }   queue<int> Q;   int ver[N], nxt[N], fst[N], tot, siz[N], ans;   void addedge(int x, int y) {     ver[++tot] = y;     nxt[tot] = fst[x];     fst[x] = tot;   }   void dfs(int x) {     siz[x] = 1;     for (int i = fst[x]; i; i = nxt[i]) {       int y = ver[i];       dfs(y);       siz[x] += siz[y];     }   }   int main() {     n = read();     m = read();     s = read();     for (int i = 1; i <= m; i++) {       int x = read(), y = read(), w = read();       adj[x].push_back(make_pair(y, w));       adj[y].push_back(make_pair(x, w));     }     dij();     for (int x = 1; x <= n; x++) {       for (auto e : adj[x]) {         int y = e.first;         long long w = e.second;         if (dis[y] == dis[x] + w) {           bdj[x].push_back(y);           de[y]++;         }       }     }     memset(ff, -1, sizeof(ff));     dep[0] = 1;     for (int i = 1; i <= n; i++) {       if (!de[i] && dis[i] < INF) {         ff[i] = 0;         Q.push(i);       }     }     while (!Q.empty()) {       int x = Q.front();       Q.pop();       dep[x] = dep[ff[x]] + 1;       fa[x][0] = ff[x];       for (int i = 1; i <= 20; i++) fa[x][i] = fa[fa[x][i - 1]][i - 1];       for (auto y : bdj[x]) {         if (ff[y] == -1)           ff[y] = x;         else           ff[y] = lca(ff[y], x);         de[y]--;         if (!de[y]) Q.push(y);       }     }     for (int i = 1; i <= n; i++) addedge(ff[i], i);     dfs(0);     for (int i = 1; i <= n; i++)       if (i != s) ans = max(ans, siz[i]);     cout << ans <<   n ;     return 0;   }   