Language: C++

#include <iostream>
#include <string>
using namespace std;
 
int a[12][12];
int dx[4]  = {1,0,-1,0};
int dy[4]  = {0,1,0,-1};
char dc[4] = {'R','D','L','U'};
 
//ツ篠ゥツ閉ェツづ個偲シツ暗債４ツマツスツづ個陛?づ個湘ウツ妥板づーツ陳イツづ猟づゥ
void cheakWall(int* wall , const int& px ,const int& py ,const int& d ){
    for(int i=0 ; i<4 ; ++i ){
        int mx = px + dx[(d+i)%4];
        int my = py + dy[(d+i)%4];
        wall[i] = a[my][mx];
    }
}
 
//ツ進ツづアツつセツ古シツつォツづーツ記ツ録
void record(string& s,int* wall,const int d){
    if( wall[1] ){
        s.push_back( dc[d] );
    }
}
 
//ツ進ツづ?void go(int& px, int& py, const int& d,int* wall, string& s){
    px += dx[d]*2;
    py += dy[d]*2;
    record( s , wall , d );
}
 
int main(){
    string s;
 
    //ツ配ツ療アツづ個渉可甘コツ可サ
    for(int y=0 ; y<12 ; ++y )
        for(int x=0 ; x<12 ; ++x )
            a[y][x] = 0;
 
    //ツ禿シツ療?    for(int i=0 ; i<9 ; ++i ){
        cin >> s;
        int y = i+1;
        int x = (i+1)%2 + 1;
        for(int j=0 ; j<(int)s.size() ; ++j , x+=2 ){
            a[y][x] = s[j] - '0';
        }
    }
 
    int px = 2, py = 0, d = 0;
    bool flag = false;
    s.clear();
 
    while( 1 ){
        if( px == 0 && py == 0 ) break;
 
        int wall[4]; 
        //ツ篠ゥツ閉ェツづ個偲シツづィツづ個湘ウツ妥?        cheakWall( wall , px , py , d );
 
        if( !wall[1] ){//ツ右ツつェツ陛?つカツづ。ツづ按つゥツづ?つスツづァ
            //ツ古シツつォツづーツ右ツ古シツつォツづ可嘉アツづゥ
            d = (d+1)%4;
            //ツ進ツづ?         go( px , py , d , wall , s );
            flag = false;
        }else{
            if( !wall[0] ){//ツ前ツつェツ陛?つカツづ。ツづ按つゥツづ?つスツづァ
                //ツ進ツづ?             go( px , py , d , wall , s );
                flag = false;
            }else{
                if( !wall[3] ){//ツ債カツつェツ陛?つカツづ。ツづ按つゥツづ?つスツづァ
                    if( flag == false ){
                        //ツ進ツづアツつセツ古シツつォツづーツ記ツ録
                        record( s , wall , d );
                    }
                    //ツ古シツつォツづーツ債カツ古シツつォツづ可嘉アツづゥ
                    d = (d+3)%4;
                    //ツ進ツづ?                 go( px , py , d , wall , s );
                    flag = false;
                }else{//ツ前ツ・ツ右ツ・ツ債カツつェツ陛?つセツづ?つスツづァ
                    flag = true;
                    //ツ進ツづアツつセツ古シツつォツづーツ記ツ録
                    record( s , wall , d );
                    //ツ古シツつォツづーツ右ツ古シツつォツづ可嘉アツづゥ
                    d = (d+3)%4;
                    //ツ進ツづアツつセツ古シツつォツづーツ記ツ録
                    s.push_back( dc[d] );
                }
            }
        }
    }
    cout << s << endl;
}

Compiler output:
a.cc:27:5: error: 'px' does not name a type
   27 |     px += dx[d]*2;
      |     ^~
a.cc:28:5: error: 'py' does not name a type
   28 |     py += dy[d]*2;
      |     ^~
a.cc:29:11: error: expected constructor, destructor, or type conversion before '(' token
   29 |     record( s , wall , d );
      |           ^
a.cc:30:1: error: expected declaration before '}' token
   30 | }
      | ^
a.cc: In function 'int main()':
a.cc:42:17: error: 'i' was not declared in this scope
   42 |         int y = i+1;
      |                 ^
a.cc: At global scope:
a.cc:51:5: error: 's' does not name a type
   51 |     s.clear();
      |     ^
a.cc:53:5: error: expected unqualified-id before 'while'
   53 |     while( 1 ){
      |     ^~~~~
a.cc:90:5: error: 'cout' does not name a type
   90 |     cout << s << endl;
      |     ^~~~
a.cc:91:1: error: expected declaration before '}' token
   91 | }
      | ^