func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 1e6 + 5;   string s[N];   int n, k, fa[N], len[N], ch[N][26], root = 1, last = 1, tot = 1, times[N];   void insert(int x) {     int now = ++tot, pre = last;     last = now, len[now] = len[pre] + 1;     for (; pre && !ch[pre][x]; pre = fa[pre]) ch[pre][x] = now;     if (!pre)       fa[now] = root;     else {       int q = ch[pre][x];       if (len[q] == len[pre] + 1)         fa[now] = q;       else {         int nows = ++tot;         len[nows] = len[pre] + 1;         memcpy(ch[nows], ch[q], sizeof(ch[q]));         fa[nows] = fa[q], fa[q] = fa[now] = nows;         for (; pre && ch[pre][x] == q; pre = fa[pre]) ch[pre][x] = nows;       }     }   }   long long vis[N], sum[N];   void getcnt() {     for (int i = 1; i <= n; i++) {       int now = root;       for (int j = 0; j < s[i].length(); j++) {         now = ch[now][s[i][j] -  a ];         int t = now;         while (t && vis[t] != i) vis[t] = i, times[t]++, t = fa[t];       }     }   }   void dfs(int x) {     if (x == root || vis[x]) return;     vis[x] = 1;     dfs(fa[x]);     sum[x] += sum[fa[x]];   }   int main() {     ios::sync_with_stdio(0);     cin >> n >> k;     for (int i = 1; i <= n; i++) cin >> s[i];     for (int i = 1; i <= n; i++) {       last = 1;       for (int j = 0; j < s[i].length(); j++) insert(s[i][j] -  a );     }     getcnt();     for (int i = 1; i <= tot; i++)       sum[i] = (times[i] >= k) * (len[i] - len[fa[i]]);     memset(vis, 0, sizeof(vis));     for (int i = 1; i <= tot; i++) dfs(i);     for (int i = 1; i <= n; i++) {       long long ans = 0, now = root;       for (int j = 0; j < s[i].length(); j++)         now = ch[now][s[i][j] -  a ], ans += sum[now];       printf( %lld  , ans);     }   }   