func_code_string: #include <bits/stdc++.h>   using namespace std;   inline char nc() {     return getchar();     static char buf[100000], *l = buf, *r = buf;     return l == r && (r = (l = buf) + fread(buf, 1, 100000, stdin), l == r)                ? EOF                : *l++;   }   template <class T>   void read(T &x) {     x = 0;     int f = 1, ch = nc();     while (ch <  0  || ch >  9 ) {       if (ch ==  - ) f = -1;       ch = nc();     }     while (ch >=  0  && ch <=  9 ) {       x = x * 10 -  0  + ch;       ch = nc();     }     x *= f;   }   int N, M, D, A[100050][50];   int cnt, id[100050][50];   pair<int, int> bel[5000050];   int head[5000050];   int head1[5000050];   struct edge {     int to, nex;     edge(int to = 0, int nex = 0) : to(to), nex(nex) {}   };   vector<edge> G;   vector<edge> G1;   inline void addedge(int u, int v) {     G.push_back(edge(v, head[u])), head[u] = G.size() - 1;   }   inline void addedge1(int u, int v) {     G1.push_back(edge(v, head1[u])), head1[u] = G1.size() - 1;   }   int dfn[5000050], low[5000050], dfc;   int sccno[5000050], val[5000050], scnt;   int vis[100050];   int stk[5000050], top;   void tarjan(int u) {     low[u] = dfn[u] = ++dfc;     stk[++top] = u;     for (int i = head[u]; ~i; i = G[i].nex) {       int v = G[i].to;       if (!dfn[v]) {         tarjan(v);         low[u] = min(low[u], low[v]);       } else if (!sccno[v]) {         low[u] = min(low[u], dfn[v]);       }     }     if (low[u] == dfn[u]) {       ++scnt;       while (true) {         int x = stk[top--];         sccno[x] = scnt;         int a = bel[x].first, b = bel[x].second;         if (A[a][b] && vis[a] != scnt) {           vis[a] = scnt;           ++val[scnt];         }         if (x == u) break;       }     }   }   void find_scc() {     for (int i = 1; i <= cnt; ++i)       if (!dfn[i]) {         tarjan(i);       }     memset(head1, -1, sizeof(head1));     for (int u = 1; u <= cnt; ++u) {       for (int i = head[u]; ~i; i = G[i].nex) {         int v = G[i].to;         if (sccno[u] != sccno[v]) {           addedge1(sccno[u], sccno[v]);         }       }     }   }   int f[5000050];   void dp(int u) {     if (f[u]) return;     for (int i = head1[u]; ~i; i = G1[i].nex) {       int v = G1[i].to;       dp(v);       f[u] = max(f[u], f[v]);     }     f[u] += val[u];   }   int solve() {     find_scc();     int u = sccno[id[1][0]];     dp(u);     return f[u];   }   char str[60];   int main() {     read(N), read(M), read(D);     for (int i = 1; i <= N; ++i) {       for (int j = 0; j < D; ++j) {         id[i][j] = ++cnt;         bel[cnt] = pair<int, int>(i, j);       }     }     memset(head, -1, sizeof(head));     for (int i = 1; i <= M; ++i) {       int u, v;       read(u), read(v);       for (int j = 1; j < D; ++j) {         addedge(id[u][j - 1], id[v][j]);       }       addedge(id[u][D - 1], id[v][0]);     }     for (int i = 1; i <= N; ++i) {       scanf( %s , str);       for (int j = 0; j < D; ++j) {         A[i][j] = str[j] ==  1 ;       }     }     printf( %d n , solve());     return 0;   }   