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()
}

Python: class Board:
    def __init__(self,m):
        self.m = m
        self.x = 0
        self.y = 0
        self.d = 'e'

    def dir(self):
        return self.d

    def is_origin(self):
        return (self.x==0) and (self.y==0)
        
    def north_is_wall(self):
        if self.y == 0:
            return False
        else:
            if self.m[2*self.y-1][self.x] == '1':
                return True
            else:
                return False

    def east_is_wall(self):
        if self.x == 4:
            return False
        elif m[2*self.y][self.x] == '1':
            return True
        else:
            return False
    def west_is_wall(self):
        if self.x == 0:
            return False
        elif m[2*self.y][self.x-1] == '1':
            return True
        else:
            return False
    def south_is_wall(self):
#        print("x={},y={}".format(self.x,self.y))
        if self.y == 4:
            return False
        elif self.m[2*self.y+1][self.x] == '1':
            return True
        else:
            return False

    def go_north(self):
        if self.y == 0:
            raise "invalid"
        else:
            self.y -= 1
            self.d = 'n'
        print("U",end="")

    def go_south(self):
        if self.y == 5:
            raise "invalid"
        else:
            self.y += 1
            self.d = 's'
        print("D",end="")

    def go_east(self):
        if self.x == 4:
            raise "go_east"
        else:
            self.x += 1
            self.d = 'e'
        print("R",end="")

    def go_west(self):
        if self.x == 0:
            raise "go_west"
        else:
            self.x -= 1
            self.d = 'w'
        print("L",end="")


def run(m):
    b = Board(m)
    init = True
    while True:
        d = b.dir()
        if d == 'e':
            if   b.north_is_wall():
                b.go_north()
            elif b.east_is_wall():
                b.go_east()
            elif b.south_is_wall():
                b.go_south()
            else:
                b.go_west()
        elif d == 's':
            if   b.east_is_wall():
                b.go_east()
            elif b.south_is_wall():
                b.go_south()
            elif b.west_is_wall():
                b.go_west()
            else:
                b.go_north()
        elif d == 'w':
            if b.south_is_wall():
                b.go_south()
            elif b.west_is_wall():
                b.go_west()
            elif b.north_is_wall():
                b.go_north()
            else:
                b.go_east()
        elif d == 'n':
            if  b.west_is_wall():
                b.go_west()
            elif b.north_is_wall():
                b.go_north()
            elif b.east_is_wall():
                b.go_east()
            else:
                b.go_south()

        if (not init) and b.is_origin():
            print()
            break
        init = False

m = []
for _ in range(9):
    m.append(list(input()))

run(m)

Python: g=[[0]*5 for _ in[0]*5]
for i in range(9):
 e=input()
 for j in range(4+i%2):
  if int(e[j]):
   if i%2:g[i//2][j]+=4;g[i//2+1][j]+=1
   else:r=g[i//2];r[j]+=2;r[j+1]+=8
y,x=0,1
k=1
a='1'
while 1:
 k=k%4+2
 for _ in[0]*4:
  k+=1
  if g[y][x]&int(2**(k%4)):a+=str(k%4);break
 if k%2:x+=[1,-1][(k%4)>1]
 else:y+=[-1,1][(k%4)>0]
 if x+y==0:break
print(''.join('URDL'[int(c)]for c in a))

Python: import sys

loc = [3, 1]

def print_dir(h):
	if h == 0:
		print('R', end='')
	elif h == 1:
		print('D', end='')
	elif h == 2:
		print('L', end='')
	elif h == 3:
		print('U', end='')

dir = [[1, 0], [0, 1], [-1, 0], [0, -1]]
hand = 3

board = [[0 for _ in range(11)] for _ in range(11)]
for i, line in enumerate(sys.stdin):
	for j, c in enumerate(line.strip()):
		board[i+1][1 + (i+1)%2 + j*2] = int(c)

print("R", end='')

while loc != [1, 1]:
	for i in range(4):
		if board[loc[1]+dir[(hand+i)%4][1]][loc[0]+dir[(hand+i)%4][0]] == 1:
			loc[0] += dir[(hand+i)%4][0]*2
			loc[1] += dir[(hand+i)%4][1]*2
			if i == 1:
				print_dir((hand+1)%4)
			elif i == 2:
				print_dir((hand+2)%4)
				hand = (hand+1)%4
			elif i == 3:
				print_dir((hand+1)%4)
				print_dir((hand+2)%4)
				print_dir((hand+2)%4)
				print_dir((hand+3)%4)
				hand = (hand+2)%4
			elif i == 0:
				print_dir(hand%4)
				hand = (hand+3)%4

			break

print()

Python: table = [input() for i in range(9)]
def isWall(x,y,dir):
	# 右
    if dir == 0:
        return x < 4 and table[y][x] == '1'
    # 下
    elif dir == 1:
        return y < 8 and table[y + 1][x] == '1'
	# 左
    elif dir == 2:
        return x > 0 and table[y][x - 1] == '1'
	# 上
    elif dir == 3:
        return y > 0 and table[y - 1][x] == '1'
    
ans = ""
x = y = dir = 0

while 1:
    # 正面の壁
    dir = (dir + 3) % 4
    while not isWall(x,y,dir):
        # 伝う壁
        dir = (dir + 1) % 4
    # 移動
    if dir == 0:
        x += 1
        ans += 'R'
    elif dir == 1:
        y += 2
        ans += 'D'
    elif dir == 2:
        x -= 1
        ans += 'L'
    elif dir == 3:
        y -= 2
        ans += 'U'
    if x == 0 and y == 0:
        break
print(ans)