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: path = [[[] for i in range(5)] for i in range(5)]
for i in range(9):
    if i%2 == 0:
        a = [int(i) for i in list(input())]
        for j in range(4):
            if a[j] == 1:
                path[int(i/2)][j].append("R")
                path[int(i/2)][j+1].append("L")
    else:
        a = [int(i) for i in list(input())]
        for j in range(5):
            if a[j] == 1:
                path[int(i/2)][j].append("D")
                path[int(i/2)+1][j].append("U")

prev = "R"
p = "R"
x = 0
y = 0
while(1):
    if prev == "R":
        if "U" in path[x][y]:
            x -= 1
            prev = "U"
            p += "U"
        elif "R" in path[x][y]:
            y += 1
            prev = "R"
            p += "R"
        elif "D" in path[x][y]:
            x += 1
            prev = "D"
            p += "D"
        elif "L" in path[x][y]:
            y -= 1
            prev = "L"
            p += "L"
    elif prev == "L":
        if "D" in path[x][y]:
            x += 1
            prev = "D"
            p += "D"
        elif "L" in path[x][y]:
            y -= 1
            prev = "L"
            p += "L"
        elif "U" in path[x][y]:
            x -= 1
            prev = "U"
            p += "U"
        elif "R" in path[x][y]:
            y += 1
            prev = "R"
            p += "R"
    elif prev == "U":
        if "L" in path[x][y]:
            y -= 1
            prev = "L"
            p += "L"
        elif "U" in path[x][y]:
            x -= 1
            prev = "U"
            p += "U"
        elif "R" in path[x][y]:
            y += 1
            prev = "R"
            p += "R"
        elif "D" in path[x][y]:
            x += 1
            prev = "D"
            p += "D"
    elif prev == "D":
        if "R" in path[x][y]:
            y += 1
            prev = "R"
            p += "R"
        elif "D" in path[x][y]:
            x += 1
            prev = "D"
            p += "D"
        elif "L" in path[x][y]:
            y -= 1
            prev = "L"
            p += "L"
        elif "U" in path[x][y]:
            x -= 1
            prev = "U"
            p += "U"
    if x == 0 and y == 0:
        break
print(p[1:])

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+=2
 for _ in[0]*4:
  k+=1
  if g[y][x]&int(2**(k%4)):a+=[k%4];break
 if k%2:x+=-1**((k%4)>1)
 else:y+=2*((k%4)>0)-1
 if x+y==0:break
print(''.join('URDL'[c]for c in a))

Python: # AOJ 0037: Path on a Grid
# Python3 2018.6.27 bal4u

next = [[1,2,4,8],[4,8,1,2],[8,1,2,4],[2,4,8,1]]
tbl = [[0 for c in range(5)] for r in range(5)]

def move(k):
	global r, c, last, ans
	if k == 1:
		r -= 1
		last = 2
		ans += 'U'
	elif k == 2:
		c += 1
		last = 0
		ans += 'R'
	elif k == 4:
		r += 1
		last = 3
		ans += 'D'
	else:
		c -= 1
		last = 1
		ans += 'L'

for i in range(9):
	a = input()
	r = i >> 1
	if i & 1:
		for c in range(5):
			if a[c] == '1':
				tbl[r  ][c] |= 4
				tbl[r+1][c] |= 1
	else:
		for c in range(4):
			if a[c] == '1':
				tbl[r][c  ] |= 2
				tbl[r][c+1] |= 8

ans = ""
r, c, last = 0, 0, 0
while True:
	for i in range(4):
		if tbl[r][c] & next[last][i]:
			move(next[last][i])
			break;
	if r == 0 and c == 0: break
print(ans)

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+3
 for i in range(4):
  k=k+i
  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
f = sys.stdin

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

step = {(-1, 0 ):'L',(0, -1 ):'U',(1, 0 ):'R',(0, 1):'D'}
    
    
start = pre_loc = 1 + 1j
loc = 3 + 1j
print('R',end='')
while loc != start:
    for direct in [(pre_loc - loc) / 2 * 1j ** (i + 1) for i in range(4)]:
        if board[int(loc.imag + direct.imag)][int(loc.real + direct.real)]:
            pre_loc = loc
            loc += direct * 2
            print(step[(direct.real,direct.imag)],end='')
            break
print()