func_code_string: #include <bits/stdc++.h>   using namespace std;   ostream &operator<<(ostream &out, string str) {     for (char c : str) out << c;     return out;   }   template <class L, class R>   ostream &operator<<(ostream &out, pair<L, R> p) {     return out <<  (  << p.first <<  ,   << p.second <<  ) ;   }   template <class T>   auto operator<<(ostream &out, T a) -> decltype(a.begin(), out) {     out <<  { ;     for (auto it = a.begin(); it != a.end(); it = next(it))       out << (it != a.begin() ?  ,   :   ) << *it;     return out <<  } ;   }   void dump() { cerr <<   n ; }   template <class T, class... Ts>   void dump(T a, Ts... x) {     cerr << a <<  ,  ;     dump(x...);   }   template <class T>   int size(T &&a) {     return a.size();   }   using LL = long long;   using PII = pair<int, int>;   mt19937 _gen(chrono::system_clock::now().time_since_epoch().count());   int rd(int a, int b) { return uniform_int_distribution<int>(a, b)(_gen); }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     int t;     cin >> t;     for (int _t = 0; _t < t; _t++) {       int n, m;       cin >> n >> m;       vector<vector<int>> v(n, vector<int>(m));       for (int i = 0; i < n; i++)         for (int j = 0; j < m; j++) cin >> v[i][j];       vector<int> ord(m);       vector<int> mx(m);       for (int j = 0; j < m; j++) {         ord[j] = j;         for (int i = 0; i < n; i++) mx[j] = max(mx[j], v[i][j]);       }       sort(ord.begin(), ord.end(), [&](int a, int b) { return mx[a] > mx[b]; });       vector<int> rev;       for (int i = 0; i < min(n, m); i++) rev.emplace_back(ord[i]);       vector<vector<int>> t(n, vector<int>(size(rev)));       for (int i = 0; i < n; i++)         for (int j = 0; j < size(rev); j++) t[i][j] = v[i][rev[j]];       m = size(rev);       int p = (1 << n);       vector<vector<int>> dp(m, vector<int>(p));       vector<vector<int>> sum(m, vector<int>(p));       auto mymod = [&](int val) {         if (val >= n) return val - n;         return val;       };       for (int j = 0; j < m; j++) {         for (int k = 0; k < p; k++) {           for (int r = 0; r < n; r++) {             int sumka = 0;             for (int i = 0; i < n; i++) {               if (k & (1 << mymod(i + r))) sumka += t[i][j];             }             sum[j][k] = max(sum[j][k], sumka);           }           false;         }       }       for (int j = 0; j < m; j++) {         if (j != 0) dp[j] = dp[j - 1];         for (int k = 0; k < p; k++) {           if (j == 0)             dp[j][k] = sum[j][k];           else {             for (int l = k; l > 0; l = (l - 1) & k) {               dp[j][k] = max(dp[j][k], dp[j - 1][k ^ l] + sum[j][l]);             }           }         }         false;       }       cout << dp[m - 1][p - 1] <<   n ;     }   }   