func_code_string: #include <bits/stdc++.h>   using namespace std;   const int inf = 2000000000;   static inline int Rint() {     struct X {       int dig[256];       X() {         for (int i =  0 ; i <=  9 ; ++i) dig[i] = 1;         dig[ - ] = 1;       }     };     static X fuck;     int s = 1, v = 0, c;     for (; !fuck.dig[c = getchar()];)       ;     if (c ==  - )       s = 0;     else if (fuck.dig[c])       v = c ^ 48;     for (; fuck.dig[c = getchar()]; v = v * 10 + (c ^ 48))       ;     return s ? v : -v;   }   template <typename T>   static inline void cmax(T& a, const T& b) {     if (b > a) a = b;   }   template <typename T>   static inline void cmin(T& a, const T& b) {     if (b < a) a = b;   }   char buff[1024][1024];   char temp[1024][1024];   int n, m;   int sol_row(int u, int v, int a, int b) {     for (int j = 0; j < m; ++j) {       int match1 = 1, match2 = 1;       int p[2];       if (j % 2 == 0)         p[0] = u, p[1] = v;       else         p[0] = a, p[1] = b;       for (int i = 0; i < n; ++i)         if (buff[i][j] !=  0 ) {           if (buff[i][j] != p[i % 2]) match1 = 0;           if (buff[i][j] != p[1 - i % 2]) match2 = 0;         }       if (!match1 && !match2) return 0;       for (int i = 0; i < n; ++i) {         if (match1)           temp[i][j] = p[i % 2];         else           temp[i][j] = p[1 - i % 2];       }     }     return 1;   }   int sol_col(int u, int v, int a, int b) {     for (int i = 0; i < n; ++i) {       int match1 = 1, match2 = 1;       int p[2];       if (i % 2 == 0)         p[0] = u, p[1] = v;       else         p[0] = a, p[1] = b;       for (int j = 0; j < m; ++j)         if (buff[i][j] !=  0 ) {           if (buff[i][j] != p[j % 2]) match1 = 0;           if (buff[i][j] != p[1 - j % 2]) match2 = 0;         }       if (!match1 && !match2) return 0;       for (int j = 0; j < m; ++j) {         if (match1)           temp[i][j] = p[j % 2];         else           temp[i][j] = p[1 - j % 2];       }     }     return 1;   }   int main() {     n = Rint(), m = Rint();     for (int i = (0); i < (n); ++i) scanf( %s , buff[i]);     int pattern[4] = { 1 ,  2 ,  3 ,  4 };     int solved = 0;     do {       if (sol_row(pattern[0], pattern[1], pattern[2], pattern[3])) {         solved = 1;         break;       }       if (sol_col(pattern[0], pattern[1], pattern[2], pattern[3])) {         solved = 1;         break;       }     } while (next_permutation(pattern, pattern + 4));     if (solved)       for (int i = 0; i < n; ++i) puts(temp[i]);     else       puts( 0 );     return 0;   }   