func_code_string: #include <bits/stdc++.h>   using namespace std;   struct cell {     bool up, down, right, left;     int degree;     cell() { up = down = left = right = degree = 0; }     void reset() { up = down = left = right = degree = 0; }   };   struct qcell {     int x, y, degree;     qcell() {       x = y = -1;       degree = 0;     }     qcell(int xx, int yy, int deg) {       x = xx;       y = yy;       degree = deg;     }   };   char pitch[2001][2001];   cell info[2001][2001];   int n, m;   int empty_cells = 0;   bool update(int x, int y) {     int degree = 0;     if (x >= 0 && x < n && y >= 0 && y < m) {       degree = info[x][y].degree;       if (pitch[x][y] !=  . )         info[x][y].reset();       else {         info[x][y].up = (x - 1 >= 0 && pitch[x - 1][y] ==  . );         info[x][y].down = (x + 1 < n && pitch[x + 1][y] ==  . );         info[x][y].left = (y - 1 >= 0 && pitch[x][y - 1] ==  . );         info[x][y].right = (y + 1 < m && pitch[x][y + 1] ==  . );         info[x][y].degree = (info[x][y].up + info[x][y].down + info[x][y].left +                              info[x][y].right);       }     }     return degree != info[x][y].degree;   }   void do_push(int x, int y, queue<qcell> &q) {     if (x >= 0 && x < n && y >= 0 && y < m)       if (pitch[x][y] ==  . )         if (info[x][y].degree == 1) q.push(qcell(x, y, 1));   }   void occupy(int x, int y, queue<qcell> &q) {     int xx = x, yy = y;     char dir =  U ;     if (info[x][y].down) dir =  D ;     if (info[x][y].left) dir =  L ;     if (info[x][y].right) dir =  R ;     if (dir ==  U ) {       pitch[x][y] =  v ;       pitch[x - 1][y] =  ^ ;       xx = x - 1;     } else if (dir ==  D ) {       pitch[x][y] =  ^ ;       pitch[x + 1][y] =  v ;       xx = x + 1;     } else if (dir ==  L ) {       pitch[x][y] =  > ;       pitch[x][y - 1] =  < ;       yy = y - 1;     } else {       pitch[x][y] =  < ;       pitch[x][y + 1] =  > ;       yy = y + 1;     }     update(x, y);     update(xx, yy);     if (do_push) {       if (update(x - 1, y)) do_push(x - 1, y, q);       if (update(x + 1, y)) do_push(x + 1, y, q);       if (update(x, y - 1)) do_push(x, y - 1, q);       if (update(x, y + 1)) do_push(x, y + 1, q);       if (update(xx - 1, yy)) do_push(xx - 1, yy, q);       if (update(xx + 1, yy)) do_push(xx + 1, yy, q);       if (update(xx, yy - 1)) do_push(xx, yy - 1, q);       if (update(xx, yy + 1)) do_push(xx, yy + 1, q);     }     empty_cells -= 2;   }   int main() {     cin >> n >> m;     for (int i = 0; i < n; i++)       for (int j = 0; j < m; j++) {         cin >> pitch[i][j];         if (pitch[i][j] ==  . ) empty_cells++;       }     queue<qcell> q;     for (int i = 0; i < n; i++)       for (int j = 0; j < m; j++) {         update(i, j);         if (info[i][j].degree == 1) q.push(qcell(i, j, info[i][j].degree));       }     bool unique_sol = 1;     while (1) {       if (q.empty()) break;       qcell f = q.front();       q.pop();       if (info[f.x][f.y].degree == 0) {         if (pitch[f.x][f.y] ==  . ) {           unique_sol = false;           break;         }       } else         occupy(f.x, f.y, q);     }     if (unique_sol)       if (empty_cells != 0) unique_sol = 0;     if (!unique_sol)       cout <<  Not unique  << endl;     else       for (int i = 0; i < n; i++) {         for (int j = 0; j < m; j++) cout << pitch[i][j];         cout << endl;       }     return 0;   }   