func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, k, a[1005][1005], d[1005][1005], ans, D[10005];   pair<int, int> b[100005];   int ch(int x, int y) {     for (int i = 1; i <= k; i++) {       if (d[i][y] > d[i][x]) return 0;     }     return 1;   }   int main() {     cin >> n >> k;     for (int i = 1; i <= k; i++) {       for (int j = 1; j <= n; j++) cin >> a[i][j];       for (int j = 1; j <= n; j++) d[i][a[i][j]] = j;       for (int j = 1; j <= n; j++) b[a[i][j]].first = max(b[a[i][j]].first, j);     }     for (int j = 1; j <= n; j++) b[j].second = j;     sort(b + 1, b + n + 1);     for (int i = 1; i <= n; i++) {       int ma = 0;       int I = b[i].second;       for (int j = 1; j < i; j++) {         int J = b[j].second;         if (ch(I, J) && D[j] > ma) ma = D[j];       }       D[i] = ma + 1;       ans = max(ans, D[i]);     }     cout << ans << endl;     cin >> n;   }   