func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 255;   const int md = 1e9 + 7;   char c[N][N];   int as, n, m, d, mk, f[2][(1 << 17) + 1][2];   void upd(int &x, int y) {     x += y;     x >= md ? x -= md : 0;   }   int main() {     scanf( %d%d , &n, &m);     for (int i = 1; i <= n; i++) scanf( %s , c[i] + 1);     if (n < m) {       for (int i = 1; i <= n; i++)         for (int j = i; j <= m; j++) swap(c[i][j], c[j][i]);       swap(n, m);     }     mk = (1 << (m + 1)), f[0][0][0] = 1;     for (int i = 1; i <= n; i++) {       for (int j = 1; j <= m; j++) {         d ^= 1, memset(f[d], 0, sizeof(f[d]));         for (int s = 0, x, p, q, s0, s1, t; s < mk; s++) {           t = s;           x = j - 1, p = (s >> x) & 1, q = (s >> j) & 1, s0 = f[d ^ 1][s][0],           s1 = f[d ^ 1][s][1];           if (!s0 && !s1) continue;           if (p) t -= 1 << x;           if (q) t -= 1 << j;           if (c[i][j] ==  x ) {             upd(f[d][t][0], s0), upd(f[d][t][1], s1);             continue;           }           upd(f[d][s | 1 << x | 1 << j][0], s0);           upd(f[d][s | 1 << x | 1 << j][1], s1);           if (p || q)             upd(f[d][t | (q << x) | (p << j)][0], s0),                 upd(f[d][t | (q << x) | (p << j)][1], s1);           else             upd(f[d][t][1], s0);         }       }       d ^= 1, memset(f[d], 0, sizeof(f[d]));       for (int s = 0; s < mk; s++)         upd(f[d][(s << 1) & (mk - 1)][0], f[d ^ 1][s][0]),             upd(f[d][(s << 1) & (mk - 1)][1], f[d ^ 1][s][1]);     }     for (int s = 0; s < mk; s++) upd(as, f[d][s][0]), upd(as, f[d][s][1]);     printf( %d , as);   }   