func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long MAX = 2e6 + 99;   const long long INF = 1e12;   const long long mod = 1e9 + 7;   set<pair<long long, long long>> dif;   set<pair<long long, long long>>::iterator it;   long long N, M, row[1000], col[1000], mark[500][500], imp[500][500],       arr[500][500];   void dfs() {     row[1] = 0;     for (long long A = 1; A <= M; A++) {       if (mark[1][A])         col[A] = 1 - row[1];       else         col[A] = row[1];     }     for (long long A = 2; A <= N; A++) {       if (mark[A][1])         row[A] = 1 - col[1];       else         row[A] = col[1];     }     dif.clear();     for (long long A = 2; A <= N; A++)       for (long long B = 2; B <= M; B++)         if (abs(col[B] - row[A]) != mark[A][B]) dif.insert(make_pair(A, B));     return;   }   void out_() {     cout <<  YES n ;     for (long long A = 1; A <= N; A++) cout << row[A];     cout <<   n ;     for (long long A = 1; A <= M; A++) cout << col[A];     exit(0);   }   signed main() {     ios_base::sync_with_stdio(false);     cin >> N >> M;     for (long long A = 1; A <= N; A++)       for (long long B = 1; B <= M; B++) cin >> arr[A][B];     for (long long A = 1; A <= N; A++) {       for (long long B = 1; B <= M; B++) {         if (!arr[A][B])           mark[A][B] = 1;         else           mark[A][B] = 0;       }     }     for (long long A = 1; A <= M; A++) imp[1][A] = 1;     for (long long A = 1; A <= N; A++) imp[A][1] = 1;     dfs();     if (dif.empty()) out_();     for (long long A = 1; A <= N; A++) {       for (long long B = 1; B <= M; B++) {         mark[A][B] = 1 - mark[A][B];         if (imp[A][B]) {           dfs();           if (dif.empty())             out_();           else {             it = dif.end();             it--;             if (dif.begin()->first == A and it->first == A) {               for (auto A : dif) mark[A.first][A.second] ^= 1;               out_();             }           }         }       }     }     cout <<  NO ;     return 0;   }   