func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 101000;   int n, m, k[N], g[50][50], cnt[50], tmp[50];   vector<pair<int, int> > v[N];   inline int gcd(int first, int second) {     return (!second) ? first : gcd(second, first % second);   }   inline void init() {     int i, j;     for (i = 1; i <= 40; ++i)       for (j = 1; j <= 40; ++j) g[i][j] = gcd(i, j);   }   inline bool insert(pair<int, int> p) {     int i;     for (i = 1; i <= 40; ++i)       if (cnt[i] && (p.second - tmp[i]) % g[k[p.first]][i]) return 0;     return tmp[k[p.first]] = p.second, ++cnt[k[p.first]], 1;   }   inline void erase(pair<int, int> p) {     --cnt[k[p.first]];     if (!cnt[k[p.first]]) tmp[k[p.first]] = 0;   }   inline void solve(int first) {     int i = 0, j = 0, ans = 0, t = 0;     memset(cnt, 0, sizeof(cnt));     while (j < v[first].size()) {       while (j < v[first].size() &&              j - i == v[first][j].first - v[first][i].first &&              insert(v[first][j]))         ++j;       ans = max(ans, j - i);       erase(v[first][i]), ++i;     }     cout << ans << endl;   }   int main() {     ios ::sync_with_stdio(false);     int i, j, first;     init();     cin >> n >> m;     for (i = 1; i <= n; ++i) {       cin >> k[i];       for (j = 1; j <= k[i]; ++j)         cin >> first, v[first].push_back(make_pair(i, j));     }     for (i = 1; i <= m; ++i) solve(i);     return 0;   }   