func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MX = 100 + 3;   int n, m, k;   bool mat[MX][MX], tmp[MX][MX];   void solve1() {     int q = (1 << m);     int cnt = 0;     int ans = 20;     for (int z = 0; z < q; z++) {       cnt = 0;       memset(tmp, false, sizeof(tmp));       for (int j = 0; j < m; j++) {         if (z & (1 << j)) tmp[0][j] = true;         if (tmp[0][j] != mat[0][j]) cnt++;       }       for (int i = 1; i < n; i++) {         int p = 0;         for (int j = 0; j < m; j++) {           tmp[i][j] = !tmp[i - 1][j];           if (tmp[i][j] != mat[i][j]) p++;         }         p = min(p, m - p);         cnt += p;       }       ans = min(cnt, ans);     }     if (ans > k)       cout << -1 << endl;     else       cout << ans << endl;     exit(0);   }   void swp() {     for (int i = 0; i < n; i++)       for (int j = 0; j < m; j++) tmp[i][j] = mat[i][j];     for (int i = 0; i < m; i++)       for (int j = 0; j < n; j++) mat[i][j] = tmp[j][i];     swap(n, m);   }   void solve2() {     int ans = 20;     int cnt = 0;     if (n > k) {       for (int i = 0; i < n; i++) {         cnt = 0;         memset(tmp, false, sizeof(tmp));         for (int j = 0; j < m; j++) tmp[i][j] = mat[i][j];         for (int k = 0; k < n; k++) {           if (k != i) {             int p = 0;             for (int j = 0; j < m; j++) {               tmp[k][j] = !tmp[i][j];               if (tmp[k][j] != mat[k][j]) p++;             }             p = min(p, m - p);             cnt += p;           }         }         ans = min(ans, cnt);       }     } else {       swp();       memset(tmp, false, sizeof(tmp));       for (int i = 0; i < n; i++) {         cnt = 0;         for (int j = 0; j < m; j++) tmp[i][j] = mat[i][j];         for (int k = 0; k < n; k++) {           if (k != i) {             int p = 0;             for (int j = 0; j < m; j++) {               tmp[k][j] = !tmp[i][j];               if (tmp[k][j] != mat[k][j]) p++;             }             p = min(p, m - p);             cnt += p;           }         }         ans = min(ans, cnt);       }     }     if (ans <= k)       cout << ans << endl;     else       cout << -1 << endl;     exit(0);   }   int main() {     cin >> n >> m >> k;     for (int i = 0; i < n; i++)       for (int j = 0; j < m; j++) cin >> mat[i][j];     if (n <= k && m <= k)       solve1();     else       solve2();     return 0;   }   