func_code_string: #include <bits/stdc++.h>   #pragma comment(linker,  /STACK:100000000 )   using namespace std;   int n;   char s[2000][2001];   bool A[2000][2000];   int C[2][2000];   int Z[2][2000];   bool F(int x, int y) { return (x >= 0 && y >= 0 && x < n && y < n); }   int main() {     cin >> n;     for (int(i) = (0); (i) < (n); ++(i)) {       scanf( %s , s[i]);       for (int(j) = (0); (j) < (n); ++(j))         if (s[i][j] ==  1 ) A[i][j] = 1;     }     int res = 0;     for (int(ii) = (n)-1; (ii) >= (1); --(ii)) {       int i = ii, j = 0;       while (F(i, j)) {         int p = C[0][j] + C[1][i];         p %= 2;         if (p != A[i][j]) {           res++;           C[0][j]++;           C[1][i]++;         }         i++;         j++;       }     }     for (int(jj) = (n)-1; (jj) >= (1); --(jj)) {       int j = jj, i = 0;       while (F(i, j)) {         int p = Z[0][j] + Z[1][i];         p %= 2;         if (p != A[i][j]) {           res++;           Z[0][j]++;           Z[1][i]++;         }         i++;         j++;       }     }     for (int(i) = (0); (i) < (n); ++(i)) {       int p = C[0][i] + C[1][i] + Z[0][i] + Z[1][i];       p %= 2;       if (p != A[i][i]) res++;     }     cout << res << endl;     return 0;   }   