func_code_string: #include <bits/stdc++.h>   using namespace std;   const int K = 7;   const int N = 2005;   int a[K][N];   vector<int> s[N];   int d[N], n, k, p;   void read() {     cin >> n >> k;     for (int i = 0; i < int(k); ++i) {       for (int j = 0; j < int(n); ++j) {         cin >> p;         --p;         if (i == 0)           a[i][j] = p;         else           a[i][p] = j;       }     }   }   inline bool can_be_next(const vector<int>& a, const vector<int>& b) {     assert(a.size() == b.size());     for (int i = 0; i < int(a.size()); ++i) {       if (b[i] <= a[i]) return false;     }     return true;   }   void solve() {     for (int i = 0; i < int(n); ++i) {       s[i] = vector<int>(k - 1);       for (int j = 1; j < k; ++j) s[i][j - 1] = a[j][a[0][i]];     }     int res = 0;     for (int i = 0; i < int(n); ++i) {       d[i] = 1;       for (int j = 0; j < int(i); ++j)         if (can_be_next(s[j], s[i])) d[i] = max(d[j] + 1, d[i]);       res = max(res, d[i]);     }     cout << res << endl;   }   int main() {     read();     solve();     return 0;   }   