func_code_string: #include <bits/stdc++.h>   using namespace std;   int fx[] = {1, 0, 0, -1};   int fy[] = {0, -1, 1, 0};   int n, m;   int data[1002][1002], dist[1002][1002];   void bfs(int sx, int sy) {     for (int i = 0; i < 1002; i++) {       for (int j = 0; j < 1002; j++) dist[i][j] = INT_MAX;     }     queue<int> q;     q.push(sx);     q.push(sy);     dist[sx][sy] = 0;     while (!q.empty()) {       int u = q.front();       q.pop();       int v = q.front();       q.pop();       for (int i = 0; i < 4; i++) {         int x = u + fx[i];         int y = v + fy[i];         if (x >= 0 && x < n && y >= 0 && y < m && data[x][y] == 0 &&             dist[x][y] > dist[u][v] + 1) {           dist[x][y] = dist[u][v] + 1;           q.push(x);           q.push(y);         }       }     }   }   int main() {     int k;     scanf( %d , &n);     scanf( %d , &m);     scanf( %d , &k);     int sx, sy;     for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++) {         char ch;         cin >> ch;         if (ch ==  * )           data[i][j] = 1;         else if (ch ==  X ) {           sx = i;           sy = j;         }       }     }     if (k % 2 != 0) {       cout <<  IMPOSSIBLE n ;       return 0;     }     bfs(sx, sy);     vector<char> res;     while (k > 0) {       if (sx < n - 1 && dist[sx + 1][sy] < k) {         sx++;         res.push_back( D );       } else if (sy > 0 && dist[sx][sy - 1] < k) {         sy--;         res.push_back( L );       } else if (sy < m - 1 && dist[sx][sy + 1] < k) {         sy++;         res.push_back( R );       } else if (sx > 0 && dist[sx - 1][sy] < k) {         sx--;         res.push_back( U );       } else {         cout <<  IMPOSSIBLE n ;         return 0;       }       k--;     }     for (int i = 0; i < res.size(); i++) {       cout << res[i];     }     printf(  n );     return 0;   }   