func_code_string: #include <bits/stdc++.h>   using namespace std;   const double PI = 2.0 * acos(0.0);   const double E = exp(1);   template <class T1>   void deb(T1 e) {     cout << e << endl;   }   template <class T1, class T2>   void deb(T1 e1, T2 e2) {     cout << e1 <<     << e2 << endl;   }   template <class T1, class T2, class T3>   void deb(T1 e1, T2 e2, T3 e3) {     cout << e1 <<     << e2 <<     << e3 << endl;   }   template <class T1, class T2, class T3, class T4>   void deb(T1 e1, T2 e2, T3 e3, T4 e4) {     cout << e1 <<     << e2 <<     << e3 <<     << e4 << endl;   }   template <class T1, class T2, class T3, class T4, class T5>   void deb(T1 e1, T2 e2, T3 e3, T4 e4, T5 e5) {     cout << e1 <<     << e2 <<     << e3 <<     << e4 <<     << e5 << endl;   }   template <class T1, class T2, class T3, class T4, class T5, class T6>   void deb(T1 e1, T2 e2, T3 e3, T4 e4, T5 e5, T6 e6) {     cout << e1 <<     << e2 <<     << e3 <<     << e4 <<     << e5 <<     << e6          << endl;   }   template <typename T>   inline T sqr(T n) {     return n * n;   }   inline double hypot(double x, double y) { return sqrt(sqr(x) + sqr(y)); }   template <typename T>   inline T pmod(T n, T m) {     return ((n % m) + m) % m;   }   template <typename T>   T power(T n, int p) {     return (p == 0) ? (T)(1) : (sqr(power(n, p >> 1)) * ((p & 1) * (n - 1) + 1));   }   template <typename T>   T bigmod(T n, int p, T m) {     return (p == 0)                ? (T)(1)                : ((sqr(bigmod(n, p >> 1, m)) % m) * ((p & 1) * (n - 1) % m + 1)) %                      m;   }   bool dp[21][(1 << 6)][11][11][11][11][11];   int row[6], col[23];   int r, c;   vector<int> save[10];   int calc(int mask) {     int cnt = 0;     int prv = 0;     for (int i = 0; i < r; i++) {       if (!prv && (mask & (1 << i))) {         cnt++;       }       prv = mask & (1 << i);     }     return cnt;   }   char grid[6][21];   int tmp[10];   bool complet = 0;   void rec(int now, int prv_maks, int r1, int r2, int r3, int r4, int r5) {     if (r1 < 0 || r2 < 0 || r3 < 0 || r4 < 0 || r5 < 0) return;     if (complet) return;     if (dp[now][prv_maks][r1][r2][r3][r4][r5]) return;     dp[now][prv_maks][r1][r2][r3][r4][r5] = 1;     if (now == c) {       if (r1 + r2 + r3 + r4 + r5 == 0) {         for (int i = 0; i < r; ++i) {           for (int j = 0; j < c; ++j) printf( %c , grid[i][j]);           printf(  n );         }         complet = 1;       }       return;     }     int mask = 0;     for (int i = 0; i < (int)save[col[now]].size(); i++) {       mask = save[col[now]][i];       tmp[0] = r1;       tmp[1] = r2;       tmp[2] = r3;       tmp[3] = r4;       tmp[4] = r5;       for (int j = 0; j < r; j++) {         if (!(prv_maks & (1 << j)) && (mask & (1 << j))) {           tmp[j]--;         }       }       for (int j = 0; j < r; j++) {         grid[j][now] = (mask & (1 << j)) ?  *  :  . ;       }       rec(now + 1, mask, tmp[0], tmp[1], tmp[2], tmp[3], tmp[4]);       if (complet) return;     }   }   int main() {     scanf( %d %d , &r, &c);     for (int i = 0; i < r; ++i) scanf( %d , &row[i]);     for (int i = 0; i < c; ++i) {       scanf( %d , &col[i]);     };     int lim = 1 << r;     for (int i = 0; i < (1 << r); i++) {       save[calc(i)].push_back(i);     }     rec(0, 0, row[0], row[1], row[2], row[3], row[4]);   }   