Problem:


Score : 300 points

Problem Statement

Dolphin resides in two-dimensional Cartesian plane, with the positive x-axis pointing right and the positive y-axis pointing up.

Currently, he is located at the point (sx,sy). In each second, he can move up, down, left or right by a distance of 1.

Here, both the x- and y-coordinates before and after each movement must be integers.

He will first visit the point (tx,ty) where sx < tx and sy < ty, then go back to the point (sx,sy), then visit the point (tx,ty) again, and lastly go back to the point (sx,sy).

Here, during the whole travel, he is not allowed to pass through the same point more than once, except the points (sx,sy) and (tx,ty).

Under this condition, find a shortest path for him.  

Constraints

-1000 ≤ sx < tx ≤ 1000 

-1000 ≤ sy < ty ≤ 1000 

sx,sy,tx and ty are integers.

Input

The input is given from Standard Input in the following format:

sx sy tx ty

Output

Print a string S that represents a shortest path for Dolphin.

The i-th character in S should correspond to his i-th movement.

The directions of the movements should be indicated by the following characters:  

U: Up

D: Down

L: Left

R: Right

If there exist multiple shortest paths under the condition, print any of them.

Sample Input 1

0 0 1 2

Sample Output 1

UURDDLLUUURRDRDDDLLU

One possible shortest path is:

Going from (sx,sy) to (tx,ty) for the first time: (0,0) → (0,1) → (0,2) → (1,2)

Going from (tx,ty) to (sx,sy) for the first time: (1,2) → (1,1) → (1,0) → (0,0)

Going from (sx,sy) to (tx,ty) for the second time: (0,0) → (-1,0) → (-1,1) → (-1,2) → (-1,3) → (0,3) → (1,3) → (1,2)

Going from (tx,ty) to (sx,sy) for the second time: (1,2) → (2,2) → (2,1) → (2,0) → (2,-1) → (1,-1) → (0,-1) → (0,0)

Sample Input 2

-2 -2 1 1

Sample Output 2

UURRURRDDDLLDLLULUUURRURRDDDLLDL



Sample input:
0 0 1 2


Sample output:
UURDDLLUUURRDRDDDLLU

Submission status: Accepted

Solution code:
Sx, Sy, Tx, Ty = map(int, input().split())

first_x = Tx - Sx
first_y = Ty - Sy

ans1_list = []

if first_y > 0:
	ans1_list.append('U'*first_y)
	if first_x > 0:
		ans1_list.append('R'*first_x)
	else:
		ans1_list.append('L'*first_x)


else:
	print('D'*first_y)
	if first_x > 0:
		ans1_list.append('R'*first_x)
	else:
		ans1_list.append('L'*first_x)

ans1_list_ = "".join(ans1_list)
#ans2_list_ = "".join(ans2_list)

count1_list = []

#ans_list = ans1_list_ + ans2_list_

for s in ans1_list_:
	if s == 'U':
		count1_list.append('D')
	elif s == 'D':
		count1_list.append('U')
	elif s == 'R':
		count1_list.append('L')
	elif s == 'L':
		count1_list.append('R')

ans1_list = ans1_list_ + "".join(count1_list)

ans2_list = []

if "".join(ans1_list)[0] == 'U':
	ans2_list.append('L')
	ans2_list.append('U')
	ans2_list.append("".join(ans1_list_))
	ans2_list.append('R')
	ans2_list.append('D')

elif "".join(ans1_list)[0] == 'R':
	ans2_list.append('U')
	ans2_list.append('R')
	ans2_list.append("".join(ans1_list_))
	ans2_list.append('D')
	ans2_list.append('L')

elif "".join(ans1_list)[0] == 'D':
	ans2_list.append('R')
	ans2_list.append('D')
	ans2_list.append("".join(ans1_list_))
	ans2_list.append('L')
	ans2_list.append('U')
elif "".join(ans1_list)[0] == 'L':
	ans2_list.append('D')
	ans2_list.append('L')
	ans2_list.append("".join(ans1_list_))
	ans2_list.append('U')
	ans2_list.append('R')

ans2_list_ = "".join(ans2_list)

count_list = []

ans_list = ans1_list + ans2_list_

for s in ans2_list_:
	if s == 'U':
		count_list.append('D')
	elif s == 'D':
		count_list.append('U')
	elif s == 'R':
		count_list.append('L')
	elif s == 'L':
		count_list.append('R')


count_ = "".join(count_list)
ans_list = "".join(ans_list) + count_

ans = ans_list
print(ans)

Submission status: Accepted

Solution code:
s = input()
l = s.split()
sx = int(l[0])
sy = int(l[1])
tx = int(l[2])
ty = int(l[3])
for i in range(tx - sx):
    print("R", end="")
for i in range(ty - sy):
    print("U", end="")
for i in range(tx - sx):
    print("L", end="")
for i in range(ty - sy):
    print("D", end="")
print("D", end="")
for i in range(tx - sx + 1):
    print("R", end="")
for i in range(ty - sy + 1):
    print("U", end="")
print("L", end="")
print("U", end="")
for i in range(tx - sx + 1):
    print("L", end="")
for i in range(ty - sy + 1):
    print("D", end="")
print("R", end="")

Submission status: Accepted

Solution code:
sx,sy,tx,ty = map(int,input().split())

width = tx-sx 
height = ty-sy
ans = ''
ans += 'U'*height
ans +='R'*width

ans += 'D'*height
ans += 'L'*width

ans +='L'
ans +='U'*(height+1)
ans +='R'*(width+1)
ans += 'D'

ans +='R'
ans +='D'*(height+1)
ans +='L'*(width+1)
ans += 'U'


print(ans)

Submission status: Accepted

Solution code:


sx,sy,tx,ty = list(map(int, input().split()))
for i in range(ty-sy):
    print('U', end='')
for i in range(tx-sx):
    print('R', end='')
for i in range(ty-sy):
    print('D', end='')
for i in range(tx-sx):
    print('L', end='')


print('L', end='')
for i in range(ty-sy+1):
    print('U', end='')
for i in range(tx-sx+1):
    print('R', end='')
print('D', end='')
print('R', end='')
for i in range(ty-sy+1):
    print('D', end='')
for i in range(tx-sx+1):
    print('L', end='')
print('U', end='')

Submission status: Accepted

Solution code:
sx, sy, tx, ty = [int(x) for x in raw_input().strip().split(" ")]
a = tx - sx
b = ty - sy
c = a + 1
d = b + 1
print('U'*b+'R'*a+'D'*b+'L'*c+'U'*d+'R'*c+'DR'+'D'*d+'L'*c+'U')

Submission status: Accepted

Solution code:
a,b,c,d=map(int, raw_input().split())
x,y=c-a,d-b
f='R'*(x) + 'U'*(y) + 'L'*(x) + 'D'*(y)
s='D' + 'R'*(x+1) + 'U'*(y+1) + 'L' + 'U' + 'L' * (x+1) + 'D'*(y+1) + 'R'
print f+s

Submission status: Accepted

Solution code:
import sys
inp=sys.stdin.readline()
sx,sy,tx,ty=map(lambda x: int(x), inp.split(' '))
ret=''
for i in range(ty-sy):
    ret=ret+'U'
for i in range(tx-sx):
    ret=ret+'R'
for i in range(ty-sy):
    ret=ret+'D'
for i in range(tx-sx+1):
    ret=ret+'L'
for i in range(ty-sy+1):
    ret=ret+'U'
for i in range(tx-sx+1):
    ret=ret+'R'
ret=ret+'DR'
for i in range(ty-sy+1):
    ret=ret+'D'
for i in range(tx-sx+1):
    ret=ret+'L'
ret=ret+'U'
print(ret)

Submission status: Accepted

Solution code:
sx,sy,tx,ty = map(int,input().split())
dx = tx - sx
dy = ty - sy
ans = []
ans.append('U'*dy)
ans.append('R'*dx)
ans.append('D'*dy)
ans.append('L'*(dx+1))

ans.append('U'*(dy+1))
ans.append('R'*(dx+1))
ans.append('D')
ans.append('R')
ans.append('D'*(dy+1))
ans.append('L'*(dx+1))
ans.append('U')

print(*ans,sep='')

Submission status: Accepted

Solution code:
a,b,c,d=map(int,raw_input().split())
x=c-a
y=d-b
print 'U'*y+'R'*x+'D'*y+'L'*x+'L'+'U'*y+'U'+'R'*x+'RD'+'R'+'D'*y+'D'+'L'*x+'LU'

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
sx, sy, tx, ty = map(int, input().split())
x = tx - sx
y = ty - sy
s = ''
s += 'U' * y + 'R' * x
s += 'D' * y + 'L' * x
s += 'L' + 'U' * (y+1) + 'R' * (x+1) + 'D'
s += 'R' + 'D' * (y+1) + 'L' * (x+1) + 'U'
print(s)

Submission status: Accepted

Solution code:
sx, sy, tx, ty = map(int, input().split())
dx = tx - sx
dy = ty - sy 
print("R"*dx + "U"*dy + "L"*dx + "D"*dy + "D" + "R"*(dx + 1) + "U"*(dy + 1) + "L" + "U" + "L"*(dx + 1) + "D"*(dy + 1) + "R")

Submission status: Accepted

Solution code:
x,y,xx,yy=map(int,raw_input().split())
w=xx-x;h=yy-y
s='U'*h+'R'*w+'D'*h+'L'*w+'L'+'U'*(h+1)+'R'*(w+1)+'DR'+'D'*(h+1)+'L'*(w+1)+'U'
print s

Submission status: Accepted

Solution code:

sx,sy,tx,ty = map( int, input().split() )
ruto = []

for i in range(0,tx-sx):
    ruto.append("R")
for i in range(0,ty-sy):
    ruto.append("U")
for i in range(0,tx-sx):
    ruto.append("L")
for i in range(0,ty-sy):
    ruto.append("D")

ruto.append("D")
for i in range(0,tx-sx+1):
    ruto.append("R")
for i in range(0,ty-sy+1):
    ruto.append("U")
ruto.append("L")
ruto.append("U")
for i in range(0,tx-sx+1):
    ruto.append("L")
for i in range(0,ty-sy+1):
    ruto.append("D")
ruto.append("R")




for i in range(0,len(ruto)):
    print(ruto[i],end="")

Submission status: Accepted

Solution code:
[sx, sy, tx, ty] = [ int(i) for i in raw_input().split()]

X = tx - sx
Y = ty - sy

res = ''
for i in xrange(X):
	res += 'R'
for i in xrange(Y):
	res += 'U'
for i in xrange(X):
	res += 'L'
for i in xrange(Y):
	res += 'D'

res += 'D'
for i in xrange(X+1):
	res += 'R'
for i in xrange(Y+1):
	res += 'U'
res += 'L'

res += 'U'
for i in xrange(X+1):
	res += 'L'
for i in xrange(Y+1):
	res += 'D'
res += 'R'

print res

Submission status: Accepted

Solution code:
from functools import partial
from sys import stdin

p = partial(print, end='')

sx, sy, tx, ty = map(int, stdin.readline().split())

dx = tx - sx
dy = ty - sy

p('R' * dx)
p('U' * dy)
p('L' * dx)
p('D' * (dy + 1))
p('R' * (dx + 1))
p('U' * (dy + 1))
p('LU')
p('L' * (dx + 1))
p('D' * (dy + 1))
print('R')

Submission status: Accepted

Solution code:
#!/usr/bin/python

import sys

def main(argv):
    for line in sys.stdin:
        sx, sy, tx, ty = line.rstrip("\n").split(" ")
        sx = int(sx)
        sy = int(sy)
        tx = int(tx)
        ty = int(ty)

        step = []
        x = sx
        y = sy
        while y < ty:
            step.append("U")
            y += 1
        while x < tx:
            step.append("R")
            x += 1
        while y > sy:
            step.append("D")
            y -= 1
        while x > sx:
            step.append("L")
            x -= 1
        step.append("L")
        x -= 1
        while y < ty + 1:
            step.append("U")
            y += 1
        while x < tx:
            step.append("R")
            x += 1
        step.append("D")
        y -= 1
        step.append("R")
        x += 1
        while y > sy - 1:
            step.append("D")
            y -= 1
        while x > sx:
            step.append("L")
            x -= 1
        step.append("U")
        y += 1

        print "".join(step)

if __name__ == "__main__":
    main(sys.argv)

Submission status: Accepted

Solution code:
sx, sy, tx, ty = map(int, input().split())

s = ''
s += 'U' * (ty - sy) + 'R' * (tx - sx)
s += 'D' * (ty - sy) + 'L' * (tx - sx)
s += 'L' + 'U' * (ty - sy + 1) + 'R' * (tx - sx + 1) + 'D'
s += 'R' + 'D' * (ty - sy + 1) + 'L' * (tx -sx + 1) + 'U'

print(s)

Submission status: Accepted

Solution code:
[sx,sy,tx,ty]=[int(i) for i in input().split()]
s="R"*(tx-sx)+"U"*(ty-sy)+"L"*(tx-sx)+"D"*(ty-sy)+"L"+"U"*(ty-sy+1)+"R"*(tx-sx+1)+"D"+"R"+"D"*(ty-sy+1)+"L"*(tx-sx+1)+"U"

print(s)

Submission status: Accepted

Solution code:

sx, sy, tx, ty = map(int, input().split())
X = tx - sx
Y = ty - sy

saitan = "U" * Y + "R" * X + "D" * Y + "L" * (X + 1) \
            + "U" * (Y + 1) + "R" * (1 + X) + "D" \
            + "R" + "D" * (Y + 1) + "L" * (1 + X) \
            + "U"

print(saitan)

Submission status: Accepted

Solution code:
sx, sy, tx, ty = map(int, input().split())

hight = ty - sy
width = tx - sx

res = ''

res += 'U' * hight
res += 'R' * width
res += 'D' * hight
res += 'L' * width
res += 'L'
res += 'U' * (hight + 1)
res += 'R' * (width + 1)
res += 'DR'
res += 'D' * (hight + 1)
res += 'L' * (width + 1)
res += 'U'

print(res)

Submission status: Accepted

Solution code:
sx,sy,tx,ty=map(int,raw_input().split())
dx = tx-sx
dy = ty-sy
print"U"*dy+"R"*dx+"D"*dy+"L"*-~dx+"U"*-~dy+"R"*-~dx+"DR"+"D"*-~dy+"L"*-~dx+"U"

Submission status: Accepted

Solution code:
(sx, sy, tx, ty) = [int(i) for i in input().split(" ")]
dx = tx - sx
dy = ty - sy

s  = ""
# go 1st
s += "R"*dx
s += "U"*dy

# go 2nd
s += "L"*dx
s += "D"*dy

# go 3rd
s += "D"
s += "R"*(dx + 1)
s += "U"*(dy + 1)
s += "L"

# go 4th
s += "U"
s += "L"*(dx + 1)
s += "D"*(dy + 1)
s += "R"

print(s)

Submission status: Accepted

Solution code:
def main():
    sx,sy,tx,ty = map(int,input().split())

    root = ""

    # first
    for n in range(tx - sx):
        root += "R"
    for n in range(ty - sy):
        root += "U"

    # first back
    for n in range(tx - sx):
        root += "L"
    for n in range(ty - sy):
        root += "D"

    # first
    root += "D"
    for n in range(tx - sx + 1):
        root += "R"
    for n in range(ty - sy + 1):
        root += "U"
    root += "L"

    # first back
    root += "U"
    for n in range(tx - sx + 1):
        root += "L"
    for n in range(ty - sy + 1):
        root += "D"
    root += "R"

    print(root)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
sx,sy,tx,ty=map(int,input().split())
dx,dy=tx-sx,ty-sy
s1='U'*dy+'R'*dx+'D'*dy+'L'*dx
s2='LU'+'U'*dy+'R'*dx+'RD'+'RD'+'D'*dy+'L'*dx+'LU'
print(s1+s2)

Submission status: Accepted

Solution code:

sx, sy, tx, ty = map(int, input().split())
ans = ""

dir_x = ["", "R", "L"]
dir_y = ["", "U", "D"]

dx = 1 if (tx - sx > 0) else -1
dy = 1 if (ty - sy > 0) else -1

ans += dir_x[dx] * abs(tx - sx)
ans += dir_y[dy] * abs(ty - sy)

ans += dir_x[-dx] * abs(tx - sx)
ans += dir_y[-dy] * abs(ty - sy)

ans += dir_y[-dy]
ans += dir_x[dx] * (abs(tx - sx) + 1)
ans += dir_y[dy] * (abs(ty - sy) + 1)
ans += dir_x[-dx]

ans += dir_y[dy]
ans += dir_x[-dx] * (abs(tx - sx) + 1)
ans += dir_y[-dx] * (abs(ty - sy) + 1)
ans += dir_x[dx]

print(ans)

Submission status: Accepted

Solution code:
sx, sy, tx, ty = map(int, input().split())
dx = tx - sx
dy = ty - sy
if dx >= 0:
	if dy >= 0:
		ans = "U"*dy + "R"*dx + "D"*dy + "L"*(dx+1) + "U"*(dy+1) + "R"*(dx+1) + "D" + "R" + "D"*(dy+1) + "L"*(dx+1) + "U"
	else:
		ans = "D"*dy + "R"*dx + "U"*dy + "L"*(dx+1) + "D"*(dy+1) + "R"*(dx+1) + "U" + "R" + "U"*(dy+1) + "L"*(dx+1) + "D"
else:
	if dy >= 0:
		ans = "U"*dy + "L"*dx + "D"*dy + "R"*(dx+1) + "U"*(dy+1) + "L"*(dx+1) + "D" + "L" + "D"*(dy+1) + "R"*(dx+1) + "U"
	else:
		ans = "D"*dy + "L"*dx + "U"*dy + "R"*(dx+1) + "D"*(dy+1) + "L"*(dx+1) + "U" + "L" + "U"*(dy+1) + "R"*(dx+1) + "D"
print(ans)

Submission status: Accepted

Solution code:
sx, sy, tx, ty = map(int, input().split())
result = ""
result = result+"R"*(tx-sx)
result = result+"U"*(ty-sy)
result = result+"L"*(tx-sx)
result = result+"D"*(ty-sy)
result = result+"D"
result = result+"R"*(tx-sx+1)
result = result+"U"*(ty-sy+1)
result = result+"L"
result = result+"U"
result = result+"L"*(tx-sx+1)
result = result+"D"*(ty-sy+1)
result = result+"R"
print(result)

Submission status: Accepted

Solution code:
sx, sy, tx, ty = map(int, input().split())

ans = 'R' * (tx - sx)
ans += 'U' * (ty - sy)
ans += 'L' * (tx - sx)
ans += 'D' * (ty - sy + 1)
ans += 'R' * (tx - sx + 1)
ans += 'U' * (ty - sy + 1)
ans += 'LU'
ans += 'L' * (tx - sx + 1)
ans += 'D' * (ty - sy + 1)
ans += 'R'

print(ans)

Submission status: Accepted

Solution code:
sx, sy, tx, ty = map(int, input().split())
w, h = tx-sx+1, ty-sy+1

print('U'*(h-1) + 'R'*w + 'D'*h + 'L'*w + 'UL' + 'U'*h + 'R'*w + 'D'*h + 'L'*(w-1))

Submission status: Accepted

Solution code:
sx, sy, tx, ty = [int(x) for x in raw_input().split()]

w = tx - sx
h = ty - sy

c = "U" * h + "R" * (w + 1) + "D" * (h + 1) + "L" * w
print c + "LULU" + c

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

sx, sy, tx, ty = map(int,input().split())

ans = ""

ans += "R" * (tx-sx)
ans += "U" * (ty-sy)

ans += "L" * (tx-sx)
ans += "D" * (ty-sy)

ans += "D"
ans += "R" * (tx-sx+1)
ans += "U" * (ty-sy+1)
ans += "L"

ans += "U"
ans += "L" * (tx-sx+1)
ans += "D" * (ty-sy+1)
ans += "R"

print(ans)

Submission status: Accepted

Solution code:
import sys
(sx, sy, tx, ty) = map(int, raw_input().split())

dx, dy = tx - sx, ty - sy


for i in xrange(dy):
    sys.stdout.write('U')
for i in xrange(dx):
    sys.stdout.write('R')
    
###

for i in xrange(dy):
    sys.stdout.write('D')
for i in xrange(dx):
    sys.stdout.write('L')

###


sys.stdout.write('L')

for i in xrange(dy + 1):
    sys.stdout.write('U')
for i in xrange(dx + 1):
    sys.stdout.write('R')
    
sys.stdout.write('D')

###
sys.stdout.write('R')

for i in xrange(dy + 1):
    sys.stdout.write('D')
for i in xrange(dx + 1):
    sys.stdout.write('L')
    
sys.stdout.write('U')
sys.stdout.write('\n')

Submission status: Accepted

Solution code:
a,b,c,d = map(int, input().split())

aa = c-a
bb = d-b
ans = ''
for i in range(bb):
	ans = ans + 'U'
for i in range(aa):
	ans = ans + 'R'
for i in range(bb):
	ans = ans + 'D'
for i in range(aa):
	ans = ans + 'L'

ans = ans + 'L'
for i in range(bb+1):
	ans = ans + 'U'
for i in range(aa+1):
	ans = ans + 'R'
ans = ans + 'D'
ans = ans + 'R'
for i in range(bb+1):
	ans = ans + 'D'
for i in range(aa+1):
	ans = ans + 'L'
ans = ans + 'U'

print(ans)

Submission status: Accepted

Solution code:
sx, sy, tx, ty = tuple(int(x) for x in input().split())

ans = ''
ans += 'U' * abs(ty - sy)
ans += 'R' * abs(tx - sx)
ans += 'D' * abs(ty - sy)
ans += 'L' * abs(tx - sx)
ans += 'L'
ans += 'U' * (abs(ty - sy) + 1)
ans += 'R' * (abs(tx - sx) + 1)
ans += 'D'
ans += 'R'
ans += 'D' * (abs(ty - sy) + 1)
ans += 'L' * (abs(tx - sx) + 1)
ans += 'U'

print(ans)

Submission status: Accepted

Solution code:
sx,sy,tx,ty = map(int,input().split())
tx -= sx
ty -= sy
ans = ""
ans += "U" * ty + "R" * tx
ans += "D" * ty + "L" * tx
ans += "L" + "U"*(ty+1) + "R"*(tx+1) + "D"
ans += "R" + "D"*(ty+1) + "L"*(tx+1) + "U"
print(ans)

Submission status: Accepted

Solution code:
sx, sy, tx, ty = [int(i) for i in input().split()]
dx = tx - sx
dy = ty - sy
print(''.join(("U" * dy, "R" * dx,
         "D" * dy, "L" * dx,
         "L", "U", "U" * dy, "R", "R" * dx, "D",
         "R", "D", "D" * dy, "L", "L" * dx, "U")))

Submission status: Accepted

Solution code:
sx,sy,tx,ty=map(int,raw_input().split())
dx=tx-ty;dy=ty-sy
ans=[]
for i in xrange(sx,tx):
    ans.append("R")
for i in xrange(sy,ty):
    ans.append("U")
for i in xrange(sx,tx):
    ans.append("L")
for i in xrange(sy,ty):
    ans.append("D")
ans.append("D")
for i in xrange(sx,tx+1):
    ans.append("R")
for i in xrange(sy,ty+1):
    ans.append("U")
ans.append("L")
ans.append("U")
for i in xrange(sx,tx+1):
    ans.append("L")
for i in xrange(sy,ty+1):
    ans.append("D")
ans.append("R")
print("".join(ans))

Submission status: Accepted

Solution code:
sx, sy, tx, ty = map(int, raw_input().split())
sx, sy, tx, ty = 0, 0, tx-sx, ty-sy

ans1 = 'R'*tx + 'U'*ty + 'L'*tx + 'D'*ty

ans2 = 'D' + 'R'*(tx+1) + 'U'*(ty+1) + 'L'

ans3 = 'U' + 'L'*(tx+1) + 'D'*(ty+1) + 'R'

print ans1 + ans2 + ans3

Submission status: Accepted

Solution code:
# coding=utf-8

import sys
stdin = sys.stdin
def na(): return map(int, stdin.readline().split())
def ns(): return stdin.readline().strip()

def main():
    sx,sy,tx,ty = na()
    # sx,sy,tx,ty=0,0,1,2
    ret = ""
    for i in range(tx-sx):
        ret += "R"
    for i in range(ty-sy):
        ret += "U"
    for i in range(tx-sx):
        ret += "L"
    for i in range(ty-sy):
        ret += "D"
    ret += "D"
    for i in range(tx-sx+1):
        ret += "R"
    for i in range(ty-sy+1):
        ret +="U"
    ret += "L"
    ret += "U"
    for i in range(tx-sx+1): ret += "L"
    for i in range(ty-sy+1): ret += "D"
    ret += "R"
    print(ret)
    pass


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
sx, sy, tx, ty = map(int, input().split())

ans = ""

ans += "U" * (ty - sy) + "R" * (tx - sx)
ans += "D" * (ty - sy) + "L" * (tx - sx)
ans += "L" + "U" * (ty - sy + 1) + "R" * (tx - sx + 1) + "D"
ans += "R" + "D" * (ty - sy + 1) + "L" * (tx - sx + 1) + "U"
print(ans)sx, sy, tx, ty = map(int, input().split())

ans = ""

ans += "U" * (ty - sy) + "R" * (tx - sx)
ans += "D" * (ty - sy) + "L" * (tx - sx)
ans += "L" + "U" * (ty - sy + 1) + "R" * (tx - sx + 1) + "D"
ans += "R" + "D" * (ty - sy + 1) + "L" * (tx - sx + 1) + "U"
print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())
s = 1
ans = 1
for i in range(1, n+1):
  s *= i
for i in range(2, n+1):
  k = 1
  while s % i == 0:
    s = s // i
    k += 1
  ans *= k
print(ans % (10 ** 9 + 7))

Submission status: Runtime Error

Solution code:
d={0:'R', 1:'U', 2:'L', 3:'D'}
dirc=[dx,dy,dx,dy]

def path(sign,x,y,z,w):
  return d[sign+1]*abs(z-x) + d[sign+2]*abs(y-w)

s=''
s+='R'
s+=path(-1, sx+1, sy, tx, ty-1)
s+='UU'
s+=path(1, tx,ty+1,sx-1,sy)
s+='RU'
s+=path(-1, sx,sy-1,tx+1,ty)
s+='LL'
s+=path(1, tx-1,ty,sx,sy+1)
s+='U'
print(s)

Submission status: Runtime Error

Solution code:
sx, sy, tx, ty=map(int,inpu().split())

dx=tx-sx
dy=ty-sy
d={0:'R', 1:'U', 2:'L', 3:'D'}
dirc=[dx,dy,dx,dy]

s=''
for j in range(4):
  s+=d[j]*(dirc[j]+i)
s+='D'
for j in range(2):
  s+=d[j]*(dirc[j]+1)
s+='L'
s+='U'
for j in range(2):
  s+=d[j+2]*(dirc[j+2]+1)
s+='R'
print(s)

Submission status: Runtime Error

Solution code:
sx, sy, tx, ty=map(int,inpu().split())

dx=tx-sx
dy=ty-sy
d={0:'R', 1:'U', 2:'L', 3:'D'}
dirc=[dx,dy,dx,dy]

s=''
for j in range(4)"
  s+=d[j]*(dirc[j]+i)
s+='D'
for j in range(2):
  s+=d[j]*(dirc[j]+1)
s+='L'
s+='U'
for j in range(2):
  s+=d[j+2]*(dirc[j+2]+1)
s+='R'
print(s)

Submission status: Runtime Error

Solution code:
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define uint unsigned int
#define ull  unsigned long long
typedef string str;
typedef long long ll;
typedef double db;
typedef pair<int, int> pii;
typedef map<int, int> mii;
typedef vector<int> vi;
typedef vector<bool> vb;
#define pb push_back
#define fi first
#define se second
#define in insert
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
const int INF = 1e9 + 5;
const int N = 2e5 + 123;
int main(){
    speed;
    int a, b, x, y;
    cin >> a >> b >> x >> y;
    int l = x - a;
    int r = y - b;
    if(l > 0){
        for(int i = 0; i < l; ++i){
            cout << 'R';
        }
        if(r > 0){
            for(int i = 0; i < r; ++i){
                cout << 'U';
            }
        }
        else{
            for(int i = 0; i < abs(r); ++i){
                cout << 'D';
            }
        }
        for(int i = 0; i < l; ++i){
            cout << 'L';
        }
        if(r > 0){
            for(int i = 0; i < abs(r); ++i){
                cout << 'D';
            }
        }
        else{
            for(int i = 0; i < r; ++i){
                cout << 'U';
            }
        }
    }
    else{
        for(int i = 0; i < abs(l); ++i){
            cout << 'L';
        }
        if(r > 0){
            for(int i = 0; i < r; ++i){
                cout << 'D';
            }
        }
        else{
            for(int i = 0; i < abs(r); ++i){
                cout << 'U';
            }
        }
        for(int i = 0; i < abs(l); ++i){
            cout << 'R';
        }
        if(r > 0){
            for(int i = 0; i < r; ++i){
                cout << 'U';
            }
        }
        else{
            for(int i = 0; i < abs(r); ++i){
                cout << 'D';
            }
        }
    }
}

Submission status: Runtime Error

Solution code:
N = int(input())
A = list(map(int, input().split()))

ans = 0
A_test = sorted(list(set(A)))

if N % 2 == 1:
    judge = [i for i in range(0,N,2)]
    if (A_test == judge) and (A.count(0) == 1):
        ans = 2**(N//2)
else:
    judge = [i for i in range(1,N,2)]
    if A_test == judge:
        ans = 2**(N//2)

ans = ans % (10**9 + 7)
print(ans)

Submission status: Runtime Error

Solution code:
sx, sy, tx, ty = map(int, input().split())
ofs = 1001
visited = [[0] * 2003 for _ in range(2003)]
stoij = {'U':[0, 1], 'D':[0,-1], 'L':[-1, 0], 'R':[1, 0]}

from collections import deque
def bfs(si, sj, gi, gj):
    q = deque([[si, sj, '']])
    visitedinbfs = [[0] * 2003 for _ in range(2003)]
    visitedinbfs[sj][si] = 1

    while q:
        i, j, s = q.popleft()
        if i == gi and j == gj:
            break

        for ns in ['U', 'D', 'L', 'R']:
            mi, mj = stoij[ns]
            ni, nj = i + mi, j + mj
            if ni < 0 or 2003 <= ni or nj < 0 or 2003 <= ni:
                continue
            if visitedinbfs[nj][ni] == 1 or visited[nj][ni] == 1:
                continue
            visitedinbfs[nj][ni] = 1
            q.append([ni, nj, s+ns])

    for ss in s:
        mi, mj = stoij[ss]
        si += mi
        sj += mj
        if si == gi and sj == gj:
            break
        visited[sj][si] = 1
    return s

ans =  bfs(sx+ofs, sy+ofs, tx+ofs, ty+ofs)
ans += bfs(tx+ofs, ty+ofs, sx+ofs, sy+ofs)
ans += bfs(sx+ofs, sy+ofs, tx+ofs, ty+ofs)
ans += bfs(tx+ofs, ty+ofs, sx+ofs, sy+ofs)
print(ans)

Submission status: Runtime Error

Solution code:
a,b,c,d=map(int,input().split())
x==c-a
y==d-b
print("U"*y+"R"*x+"D"*y+"L"*x+"L"+"U"*(y+1)*"R"*(x+1)+"D"+"R"+"D"*(y+1)+"L"*(x+1)+"U")

Submission status: Runtime Error

Solution code:
a,b,c,d=map(int,input().split())
x=c-a
y=d-b
print("U"*y+"R"*x+"D"*y+"L"*x+"L"+"U"*(y+1)*"R"*(x+1)+"D"+"R"+"D"*(y+1)+"L"*(x+1)+"U")

Submission status: Runtime Error

Solution code:
sx,sy,tx,ty=map(int, input().split()) #a1 a2 a3

m1=(tx-sx)*"R"+(ty-sy)*"U"
m2=(tx-sx)*"L"+(ty-sy)+"D"


print(m1+m2+"DR"+a+"ULUL"+m2+"DR")

Submission status: Runtime Error

Solution code:
sx, sy, tx, ty = map(int,input().split())

route = ''

updown_num = ty - sy # 0>なら goalは上方向
rightleft_num = tx - sx #0>ならgoalは右方向

#route1
for i in range(updown_num):
    route += 'U'
for i in range(rightleft_num):
    route += 'R'
route2
for i in range(updown_num):
    route += 'D'
for i in range(rightleft_num):
    route += 'L'
#route3
route += 'L'
for i in range(updown_num + 1):
    route += 'U'
for i in range(rightleft_num + 1):
    route += 'R'
route += 'D'
#route4
route += 'R'
for i in range(updown_num + 1):
    route += 'D'
for i in range(rightleft_num + 1):
    route += 'L'
route += 'U'

print(route)

Submission status: Runtime Error

Solution code:
sx,sy,tx,ty=map(int,input().split())
ans=[[] for _ in range(4)]

x=sx
y=sy

while y!=ty or x!=tx:
    if y<ty:
        y+=1
        ans[0].append("U")
        ans[1].append("D")
    elif x<tx:
        x+=1
        ans[0].append("R")
        ans[1].append("L")
       
x=sx-1
y=sy
ans[2].append("L")
ans[3].append("R")

while 1:
    if y<ty+1:
        y+=1
        ans[2].append("U")
        ans[3].append("D")
    elif x<tx:
        x+=1
        ans[2].append("R")
        ans[3].append("L")
    else:
        ans[2].append("D")
        ans[3].append("U")
        break


print(*ans[0],*ans[1],*ans[2],*ans[3],sep="")

Submission status: Runtime Error

Solution code:
sx,sy,tx,ty=map(int,input().split())
ans=[[] for _ in range(4)]

x=sx
y=sy

while y!=ty or x!=tx:
    if y<ty:
        y+=1
        ans[0].append("U")
        ans[1].append("D")
    elif x<tx:
        x+=1
        ans[0].append("R")
        ans[1].append("L")
       
x=sx-1
y=sy
ans[2].append("L")
ans[3].append("R")

while 1:
    if y<ty+1:
        y+=1
        ans[2].append("U")
        ans[3].append("D")
    elif x<tx:
        x+=1
        ans[2].append("R")
        ans[3].append("L")
    else:
        ans[2].append("D")
        ans[3].append("U")
        break


print(*ans[0],*ans[1],*ans[2],*ans[3],sep="")
print()

Submission status: Runtime Error

Solution code:
sx,sy,tx,ty=map(int,input().split())
x=tx-sx
y=ty-sy
print("U"*y+"R"*x+"D"*y+"L"*(x+1)+"U"*(y+1)+"R"*(x+1)+"DR"+"D"*(y+1)+"L"*(x+1)+"U"

Submission status: Runtime Error

Solution code:
def routing(x, y, z = 0):
    route = ""
    for i in range(2):
        if z:
            if dy:
                route += "D"
            else:
                route += "U"
        if x:
            route += "R"*(dx+z)
            x = not x
        else:
            route += "L"+(dx+z)
            x = not x
        if y:
            route += "U"*(dy+z)
            y = not y
        elif y:
            route += "D"*(dy+z)
            y = not y
        if z:
            if dx:
                route += "L"
            else:
                route += "R"
    return route

sx, sy, tx, ty = map(int, input().split())
route =""
dx = tx-sx
dy = ty-sy
x = dx>0
y = dy>0
route += routing(dx,dy)
route += routing(dx,dy,1)
print(route)

Submission status: Runtime Error

Solution code:
def routing(x, y, z = 0):
    route = ""
    for i in range(2):
        if z:
            if dy:
                route += "D"
            else:
                route += "U"
        if x:
            route += "R"*(dx+z)
            x = not x
        else:
            route += "L"+(dx+z)
            x = not x
        if y:
            route *= "U"*(dy+z)
            y = not y
        elif y:
            route *= "D"*(dy+z)
            y = not y
        if z:
            if dx:
                route += "L"
            else:
                route += "R"
    return route

sx, sy, tx, ty = map(int, input().split())
route =""
dx = tx-sx
dy = ty-sy
x = dx>0
y = dy>0
route += routing(dx,dy)
route += routing(dx,dy,1)
print(route)

Submission status: Runtime Error

Solution code:
sx,sy,tx,ty=map(int,input().split())
x=tx-sx
y=ty-sy
if x>0 and y>0:
    for k in range(y):
        print(u)
    for k in range(x+1):
        print(r)
    for k in range(y+1):
        print(d)
    for k in range(x+1):
        print(l)
    print(u)
    print(l)
    for k in range(y+1):
        print(u)
    for k in range(x+1):
        print(r)
    for k in range(y+1):
        print(d)
    print(l)

Submission status: Runtime Error

Solution code:
sx, sy, tx, ty = map(int, input().split())
s = ""
dx, dy = abs(tx - sx), abs(ty - sy)
dxy = dx + dy
for a in range(dx):
  s += "R"
for b in range(dy):
  s += "U"
for c in range(dx):
  s += "L"
for d in range(dy):
  s += "D"
s + = "D"
for e in range(dx + 1):
  s += "R"
for f in range(dy + 1):
  s + = "U"
s += "U"
for g in range(dx + 1):
  s += "L"
for h in range(dy + 1):
  s += "D"
s += "R"
print(s)

Submission status: Runtime Error

Solution code:
X=list(map(int,input().split()))
#X軸に並行
if X[2]-X[0]==0:
    if X[3]-X[1]>0:
        q=X[3]-X[1]
        U="U"
        D="D"
    else:
        q=X[1]-X[3]
        U="U"
        D="D"
    print(U*(q+1)+R*2+D*(q+2)+L*2+U+L+U*q+R*2+D*q+L)
#Y軸に並行
if X[3]-X[1]==0:
    if X[2]-X[0]>0:
        p=X[2]-X[0]
        R="R"
        L="L"
    else:
        p=X[0]-X[2]
        R="L"
        L="R"
    print(R*(p+1)+U*2+L*(p+2)+D*2+R+D+R*p+U*2+L*p+D)

if X[2]-X[0]!=0 and X[3]-X[1]!=0
    if X[2]-X[0]>0:
        p=X[2]-X[0]
        R="R"
        L="L"
    else:
        p=X[0]-X[2]
        R="L"
        L="R"
    if X[3]-X[1]>0:
        q=X[3]-X[1]
        U="U"
        D="D"
    else:
        q=X[1]-X[3]
        U="D"
        D="U"
    print(U*p+R*(q+1)+D*(p+1)+L*(q+1)+U+L+U*(p+1)+R*(q+1)+D*(p+1)+L*q)

Submission status: Runtime Error

Solution code:
X=list(map(int,input().split()))
#X軸に並行
if X[2]-X[0]==0:
    if X[3]-X[1]>0:
        q=X[3]-X[1]
        U="U"
        D="D"
    else:
        q=X[1]-X[3]
        U="U"
        D="D"
    print(U*(q+1)+R*2+D*(q+2)+L*2+U+L+U*q+R*2+D*q+L)
#Y軸に並行
if X[3]-X[1]==0:
    if X[2]-X[0]>0:
        p=X[2]-X[0]
        R="R"
        L="L"
    else:
        p=X[0]-X[2]
        R="L"
        L="R"
    print(R*(p+1)+U*2+L*(p+2)+D*2+R+D+R*p+U*2+L*p+D)

if X[2]-X[0]!=0 or X[3]-X[1]!=0
    if X[2]-X[0]>0:
        p=X[2]-X[0]
        R="R"
        L="L"
    else:
        p=X[0]-X[2]
        R="L"
        L="R"
    if X[3]-X[1]>0:
        q=X[3]-X[1]
        U="U"
        D="D"
    else:
        q=X[1]-X[3]
        U="D"
        D="U"
    print(U*p+R*(q+1)+D*(p+1)+L*(q+1)+U+L+U*(p+1)+R*(q+1)+D*(p+1)+L*q)

Submission status: Runtime Error

Solution code:
X=list(map(int.input().split()))
if X[2]-X[0]>0:
    p=X[2]-X[0]
    U="U"
    D="D"
else:
    p=X[0]-X[2]
    U="D"
    D="U"

if X[3]-X[1]>0:
    q=X[3]-X[1]
    R="R"
    L="L"
else:
    q=X[1]-X[3]
    R="L"
    L="R"
    
print(U*p+R*(q+1)+D*(p+1)+L*(q+1)+U+L+U*(p+1)+R*(q+1)+D*(p+1)+L*q)

Submission status: Runtime Error

Solution code:
X=list(map(int.input().split()))
ans=""
if X[2]-X[0]>0:
    p=X[2]-X[0]
    U="U"
    D="D"
else:
    p=X[0]-X[2]
    U="D"
    D="U"

if X[3]-X[1]>0:
    q=X[3]-X[1]
    R="R"
    L="L"
else:
    q=X[1]-X[3]
    R="L"
    L="R"
    
print(U*p+R*(q+1)+D*(p+1)+L*(q+1)+U+L+U*(p+1)+R*(q+1)+D*(p+1)+L*q