Go: package main

import (
	"bufio"
	"os"
	"strings"
	"strconv"
	"fmt"
)

var points [5][5][4]bool

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	for i := 0; i < 9; i++ {
		y := i/2
		if i%2 == 0 {
			scanner.Scan()
			info := strings.Split(scanner.Text(), "")
			for k := range info {
				e, _ := strconv.Atoi(info[k])
				if e != 0 {
					points[y][k][1], points[y][k+1][3] = true, true
				}
			}
		} else {
			scanner.Scan()
			info := strings.Split(scanner.Text(), "")
			for k := range info {
				e, _ := strconv.Atoi(info[k])
				if e != 0 {
					points[y][k][2], points[y+1][k][0] = true, true
				}
			}
		}
	}
	x := 1
	y := 0
	dir := 1
	dx := []int{0, 1, 0, -1}
	dy := []int{-1, 0, 1, 0}
	ds := "URDL"
	fmt.Printf("%s", string(ds[dir]))
	for !(x == 0 && y == 0) {
		if points[y][x][(dir+3)%4] {
			dir = (dir+3)%4
		} else if points[y][x][dir] {

		} else if points[y][x][(dir+1)%4] {
			dir = (dir+1)%4
		} else {
			dir = (dir+2)%4
		}
		x += dx[dir]
		y += dy[dir]
		fmt.Printf("%s", string(ds[dir]))
	}
	fmt.Println()
}

C++: #include <iostream>
#include <string>

using namespace std;

const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
const string dir = "RDLU";

int main()
{
    string input;

    while (cin >> input) {
        bool map[5][5][4];

        // Initialization
        for (int i = 0; i < 5; i++)
            for (int j = 0; j < 5; j++)
                for (int k = 0; k < 4; k++)
                    map[i][j][k] = false;

        // Input (0,0) - (0,4)
        for (int i = 0; i < 4; i++) 
            if (input[i] == '1') {
                map[0][i][0] = true;
                map[0][i + 1][2] = true;
            }

        // Input Others
        for (int i = 0; i < 8; i++) {
            cin >> input;
            int lim;
            (i % 2) ? (lim = 4) : (lim = 5);

            for (int j = 0; j < lim; j++)
                if (input[j] == '1') {
                    if (i % 2) {
                        map[(i + 1) / 2][j][0] = true;
                        if (j)
                            map[(i + 1) / 2][j + 1][2] = true;
                    }
                    else {
                        map[i / 2][j][1] = true;
                        map[(i / 2) + 1][j][3] = true;
                    }
                }
        }

        // algorithm
        int x, y, d;

        x = y = d = 0;
        do {
            //cout << "(" << y << "," << x << "," << d << ")" << endl;
            if (map[y][x][d])
                ;
            else if (map[y][x][(d + 1) % 4]) 
                d = (d + 1) % 4;
            else if (map[y][x][(d + 3) % 4]) 
                d = (d + 3) % 4;

            map[y][x][d] = false;
            x += dx[d];
            y += dy[d];
            cout << dir[d];
        } while (x || y);

        cout << endl;
    }

    

    return 0;
}

C++: #include<iostream>

main(){
cout << "«ã¤èÍz"<<endll;
}

C++: #include<iostream>
#include<string>
using namespace std;
struct man{int x,y,d;};
int main(){
  string st[9];
  int i,j,k;
  for(i=0;i<9;i++) cin >> st[i];
  bool f=false,mo=false;
  man m;
  m.x=1;m.y=0;m.d=0;
  int c=0;
  cout << "R";
  while(1){
    c++;
    mo=false;
     
    if(m.x==1&&m.y==1&&m.d==2) {
      //cout << "L";
      break;
    }
    if(m.x==0&&m.y==1&&f) {
      //cout << "U";
      break;
    }
    f=true;
     
    //cout << m.x<<":"<<m.y<<":"<<m.d << endl;
    if(m.d==0){
      if(m.y>0){
    if(st[m.y*2-1][m.x]=='1') {
      cout << "U";
      m.d=3;
      continue;
    }
      }
      if(m.y<5){
    if(st[m.y*2][m.x]=='1') {
      m.x++;
      cout << "R";
      continue;
    }
      }
      if(m.y<4){
    if(st[m.y*2+1][m.x]=='1') {
      m.x++;
      m.y++;
      cout << "D";
      m.d=1;
      continue;
    }
      }
      m.y++;
      cout << "L";
      m.d=2;
      continue;
    }
     
    if(m.d==1){
      if(m.y<5){
    if(st[m.y*2][m.x-1]=='1') {
      cout <<"R";
      m.d=0;
      continue;
    }
      }
      if(m.x>0&&m.y<4){
    if(st[m.y*2+1][m.x-1]=='1') {
      m.y++;
      cout << "D" ;
      mo=true;
      continue;
    }
      }
      if(m.x>1&&m.y<5){
    if(st[m.y*2][m.x-2]=='1') {
      m.x--;
      m.y++;
      cout << "L";
      m.d=2;
      continue;
    }
      }
      m.x--;
      cout << "U";
      m.d=3;
      continue;
    }
    if(m.d==2){
      if(m.x>0){
    if(st[m.y*2-1][m.x-1]=='1') {
      cout << "D";
      m.d=1;
      continue;
    }
      }
      if(m.x>1&&m.y>0){
    if(st[(m.y-1)*2][m.x-2]=='1') {
      m.x--;
      cout << "L" ;
      mo=true;
      continue;
    }
      }
      if(m.x>0&&m.y>1){
    if(st[(m.y-1)*2-1][m.x-1]=='1') {
      m.x--;
      m.y--;
      cout << "U";
      m.d=3;
      continue;
    }
      }
      m.y--;
      cout << "R";
      m.d=0;
      continue;
    }
    if(m.d==3){
 
      if(m.y>0){
    if(st[(m.y-1)*2][m.x-1]=='1') {
      cout << "L";
      m.d=2;
      continue;
    }
      }
      if(m.y>1){
    if(st[(m.y-1)*2-1][m.x]=='1') {
      m.y--;
      cout << "U" ;
      mo=true;
      continue;
    }
      }
      if(m.y>0){
    if(st[(m.y-1)*2][m.x]=='1') {
      m.x++;
      m.y--;
      cout << "R";
      m.d=0;
      continue;
    }
      }
      m.x++;
      cout << "D";
      m.d=1;
      continue;
    }
    //if(!mo)m.d=(m.d+2)%4;
  }
   
  cout  << endl;
  return 0;
}

C++: #include<iostream>
#include<string>
#include<cstring>
using namespace std;

#define RIGHT 0
#define DOWN 1
#define LEFT 2
#define UP 3

int main(){
	bool cross[5][5][4];	// x,y,dir
	int px=0, py=0, dir = RIGHT;
	int d[4][2] = {{1,0}, {0,1}, {-1,0}, {0,-1}};
	string str;
	memset( cross, 0, sizeof(cross) );
	for( int i=0; i<4; i++ ){
		getline( cin, str );
		for( int j=0; j<4; j++ ){
			cross[j][i][RIGHT] = cross[j+1][i][LEFT] = (str[j]=='1');
		}
		getline( cin, str );
		for( int j=0; j<5; j++ ){
			cross[j][i][DOWN] = cross[j][i+1][UP] = (str[j]=='1');
		}
	}
	getline( cin, str );
	for( int j=0; j<4; j++ ){
		cross[j][4][RIGHT] = cross[j+1][4][LEFT] = (str[j]=='1');
	}
	do{
		for( int i=0; i<4; i++ ){
			if( cross[px][py][(dir+3+i)%4] ){
				dir = (dir+3+i)%4;
				px += d[dir][0];
				py += d[dir][1];
//				cout << (dir==RIGHT)?"R":((dir==DOWN)?"D":((dir==LEFT)?"L":"U"));
				if( dir == RIGHT ){
					cout << 'R';
				}else if( dir == DOWN ){
					cout << 'D';
				}else if( dir == LEFT ){
					cout << 'L';
				}else if( dir == UP ){
					cout << 'U';
				}
				break;
			}
		}
	}while( px!=0 || py!=0 );
	cout << endl;
	return 0;
}

C++: #include<iostream>
using namespace std;
#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n)   REP(i,0,n)
const int N=6;
const int dx[]={1,0,-1,0};
const int dy[]={0,1,0,-1};
const string op="RDLU";
enum{RIGHT=0,DOWN,LEFT,UP};
int m[N][N];
bool e[N][N][N];


string solve(){
  int y=0,x=1,r=RIGHT;
  string ret="";
  do{
    bool a=true;
    if (!e[y][x][(r+1)%4])r=(r+1)%4;
    while(e[y][x][r])ret+=op[r],r=(r+3)%4;
    if (e[y][x][(r+1)%4])ret+=op[r];
    y+=dy[r];
    x+=dx[r];
  }while(y != 0 || x != 1);
  return ret;
}

main(){
  rep(i,N)rep(j,N)rep(k,4)e[i][j][k]=false;
  rep(i,5){
    string tmp;
    cin>>tmp;
    rep(j,4)if (tmp[j] == '1')e[i][j+1][DOWN]=e[i+1][j+1][UP]=true;
    if (i == 4)break;
    cin>>tmp;
    rep(j,5)if (tmp[j] == '1')e[i+1][j][RIGHT]=e[i+1][j+1][LEFT]=true;
  }
  cout << solve() << endl;
}