func_code_string: #include <bits/stdc++.h>   using namespace std;   int grid[33][33];   int main() {     int test;     scanf( %d , &test);     for (int _T = 1; _T <= test; _T++) {       int n, m;       cin >> n >> m;       for (int i = 0; i < n; i++) {         for (int j = 0; j < m; j++) {           cin >> grid[i][j];         }       }       int ans = 0;       for (int dist = 0; dist < (n + m - 1) / 2; dist++) {         int cnt1 = 0, cnt2 = 0;         for (int i = 0; i < n; i++) {           for (int j = 0; j < m; j++) {             if (i + j == dist) {               cnt1 += (grid[i][j] == 0);               cnt2 += (grid[i][j] == 1);             }           }         }         for (int i = 0; i < n; i++) {           for (int j = 0; j < m; j++) {             if ((n - 1 - i) + (m - 1 - j) == dist) {               cnt1 += (grid[i][j] == 0);               cnt2 += (grid[i][j] == 1);             }           }         }         ans += min(cnt1, cnt2);       }       cout << ans <<   n ;     }   }   