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: Wrong Answer

Solution code:
sx,sy,tx,ty=map(int,input().split())
x=tx-sx
y=ty-sy
s=""
if tx!=sx and ty!=sy:
  #内回り計算
  s+="R"*x
  s+="U"*y
  s+="D"*y
  s+="L"*x
  #外回り
  s+="L"
  s+="U"*(y+1)
  s+="R"*(x+1)
  s+="R"
  s+="D"*(y+1)
  s+="L"*(x+1)
elif tx==sx:
  s+="R"*x
  s+="D"+"L"*x+"U"
  s+="U"+"R"*x+"D"
  s+="R"
  s+="U"*2
  s+="L"*(x+2)
  s+="D"*2
  s+="R"
elif ty==sy:
  s+="U"*x
  s+="R"+"D"*x+"L"
  s+="L"+"U"*x+"R"
  s+="U"
  s+="R"*2
  s+="D"*(y+2)
  s+="L"*2
  s+="U"
print(s)

Submission status: Wrong Answer

Solution code:
sx, sy, gx, gy = map(int, input().split())

print("U"*(gy-sy)+"R"*(gx-sx)+"D"*(gy-sy)+"L"*(gx-sx)+"L"+"U"*(gy-sy+1)+"R"*(gx-sx+1)+"D"+"R"+"D"*(gy-sy+1)+"L"*(gx-sx+1)+"D")

Submission status: Wrong Answer

Solution code:
string=""
directionx=""



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

if dx>=0:
    directionx="R"
    directionxr="L"
else:
    directionx="L"
    directionxr="R"


if dy>=0:
    directiony="U"
    directionyr="D"
else:
    directiony="D"
    directionyr="U"
    
for _ in range (dx):
    string=string+directionx
for _ in range (dy):
    string=string+directiony
for _ in range (dx):
    string=string+directionxr
for _ in range (dy):
    string=string+directionyr

    
for _ in range (dx+2):
    string=string+directionx
for _ in range (dy+2):
    string=string+directiony
for _ in range (dx+2):
    string=string+directionxr
for _ in range (dy+2):
    string=string+directionyr

print(string)

Submission status: Wrong Answer

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

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

    print(ans)


if __name__ == '__main__':
    main()

# import sys
#
# sys.setrecursionlimit(10 ** 7)
#
# input = sys.stdin.readline
# rstrip()
# int(input())
# map(int, input().split())

Submission status: Wrong Answer

Solution code:
sx, sy, tx, ty = map(int, input().split())
ans = []
for _ in range(tx-sx):
    ans.append("R")
for _ in range(ty-sy):
    ans.append("D")
for _ in range(tx-sx):
    ans.append("L")
for _ in range(ty-sy):
    ans.append("U")
ans.append("U")
for _ in range(tx-sx+1):
    ans.append("R")
for _ in range(ty-sy+1):
    ans.append("D")
ans.append("L")
ans.append("D")
for _ in range(tx-sx+1):
    ans.append("L")
for _ in range(ty-sy+1):
    ans.append("U")
ans.append("R")
print("".join(ans))

Submission status: Wrong Answer

Solution code:
sx, sy, tx, ty = map(int, input().split())
route = ""
dx, dy = tx - sx, ty - sy
path1 = "R" * dx + "U" * dy
path2 = "L" * dx + "D" * dy
dx, dy = dx + 1, dy + 1
path3 = "D" + "R" * dx + "U" * dy + "L"
path4 = "U" + "L" * dx + "D" * dy + "R"
ans =path1 + path2 + path3 + path4
if ans.count("R")+ans.count("U") == ans.count("L") + ans.count("D"):
    print("Yes,", ans)
else:
    print("No,", ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans = ''
diff_x = tx - sx
diff_y = ty - sy
ans += 'R' * diff_x
ans += 'U' * diff_y * 2
ans += 'R' * diff_x
ans += 'D'
ans += 'R' * (diff_x + 1)
ans += 'U' * (diff_y + 1)
ans += 'L' * 2
ans += 'U' * (diff_y + 1)
ans += 'R' * (diff_x + 1)
ans += 'D'
print(ans)

Submission status: Wrong Answer

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

#直角にいく＆回り込むで２往復
dx,dy=tx-sx,ty-sy
one="R"*dx+"U"*dy
#print(one)
two=one[::-1].replace("R","L").replace("U","D")
#print(two)

three="D"+"R"*(dx+1)+"U"*(dy+1) +"L"
#print(three)
four=three[::-1]
four=four.replace("D","d").replace("R","r").replace("U","u").replace("L","l")
four=four.replace("d","U").replace("r","L").replace("u","D").replace("l","R")
#print(four)
print(one+two+three+four)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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("R" ,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: Wrong Answer

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

    ans1 = ["R"]*tx + ["U"]*ty
    ans2 = ["L"]*tx + ["D"]*ty
    ans3 = ["D"]+["R"]*(tx+1)+["U"]*(ty+1)+["L"]
    ans4 = ["U"] + ["L"]*(tx+1)+["R"]*(ty+1)+["R"]
    print("".join(ans1+ans2+ans3+ans4))

resolve()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

len_x = tx - sx
len_y = ty - sy

ans = []
for _ in range(len_x):
    ans.append("R")
for _ in range(len_y):
    ans.append("U")
for _ in range(len_x):
    ans.append("L")
for _ in range(len_y):
    ans.append("D")
    
ans.append("D")
for _ in range(len_x + 1):
    ans.append("R")
for _ in range(len_y + 2):
    ans.append("U")
for _ in range(len_x + 2):
    ans.append("L")
for _ in range(len_y + 1):
    ans.append("D")
ans.append("R")

print("".join(ans))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans = []

for x in range(tx-sx):
    ans.append('R')
for y in range(ty-sy):
    ans.append('U')
for x in range(tx-sx):
    ans.append('L')
for y in range(ty-sy):
    ans.append('D')
    
ans.append('D')

for x in range(tx-sx+1):
    ans.append('R')
for y in range(ty-sy+1):
    ans.append('U')
    
ans.append('U')

for x in range(tx-sx+1):
    ans.append('L')
for y in range(ty-sy+1):
    ans.append('D')
    
print(''.join(ans))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
walklist=[]
a,b,c,d=map(int,input().split())
x_diff=c-a
y_diff=d-b
walklist.append("U"*y_diff)
walklist.append("R"*x_diff)
walklist.append("D"*y_diff)
walklist.append("L"*(x_diff+1))
walklist.append("U"*(y_diff+1))
walklist.append("R"*(x_diff+2))
walklist.append("D"*(y_diff+2))
walklist.append("L"*(x_diff+1))
walklist.append("U")
print("".join(walklist))

Submission status: Wrong Answer

Solution code:
walklist=[]
a,b,c,d=map(int,input().split())
y_diff=c-a
x_diff=d-b
walklist.append("U"*y_diff)
walklist.append("R"*x_diff)
walklist.append("D"*y_diff)
walklist.append("L"*(x_diff+1))
walklist.append("U"*(y_diff+1))
walklist.append("R"*(x_diff+2))
walklist.append("D"*(y_diff+2))
walklist.append("L"*(x_diff+1))
walklist.append("U")
print("".join(walklist))

Submission status: Wrong Answer

Solution code:
sx,sy,tx,ty=map(int,input().split())
s=[]
dis_x=abs(tx-sx)
dis_y=abs(ty-sy)
for i in range(dis_x):
  s.append('R')
for i in range(dis_y):
  s.append('U')
for i in range(dis_x):
  s.append('L')
for i in range(dis_y):
  s.append('D')
s.append('L')
for i in range(dis_y+1):
  s.append('U')
for i in range(dis_x+1):
  s.append('R')
s.append('D')

print(''.join(s))

Submission status: Wrong Answer

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

r1 = 'R'*W + 'U'*H + 'H'*W + 'D'*H
r2 = 'D' + 'R'*(W+1) + 'U'*(H+1) + 'L' + 'U' + 'L'*(W+1) + 'D'*(H+1) +'R'
print(r1+r2)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
sx,sy,tx,ty=map(int,input().split())
x=tx-sx
y=ty-sy
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")
for k in range(x):
    print("L")

Submission status: Wrong Answer

Solution code:
sx,sy,tx,ty=map(int,input().split())
x=tx-sx
y=ty-sy
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: Wrong Answer

Solution code:
sx,sy,tx,ty=map(int,input().split())
x=tx-sx
y=ty-sy
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: Wrong Answer

Solution code:
# dijkstraで解く
# 格子上の最短経路，障害なし，なのでまっすぐ行って帰るを繰り返す

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

ans = ""

# s -> t
ans += "U" * dy
ans += "R" * dx

# t -> s
ans += "D" * dy
ans += "L" * dx

# 1マス外側 s -> t
ans += "L"
ans += "U" * (dy + 1)
ans += "R" * (dx + 1)
ans += "D"


# 1マス外側 t -> s
ans += "R"
ans +=" D" * (dy + 1)
ans += "L" * (dx + 1)
ans += "U"

print(ans)

Submission status: Wrong Answer

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

s_x, s_y, t_x, t_y = map(int, readline().split())
if s_x < 0 and t_x < 0:
    x = abs(t_x) - abs(s_x)
else:
    x = t_x - s_x
if s_y < 0 and t_y < 0:
    y = abs(t_y) - abs(s_y)
else:
    y = t_y - s_y
print('U' * y + 'R' * x + 'D' * y + 'L' * (x + 1) + 'U' * (y + 1) + 'R' * (x + 1) + 'D' + 'R' + 'D' * (y + 1) + 'L' * (x + 1) + 'U')

Submission status: Wrong Answer

Solution code:
a,b,c,d = map(int,(input().split()))
x = c-a
y = d-b
ans = []
if x > 0 and y > 0:
    for i in range(y):
        ans.append("U")
    ans.append("R")
    ans.append("U")
    for i in range(x+1):
        ans.append("L")
    for i in range(y+1):
        ans.append("D")
    ans.append("R")

    ans.append("R")
    for i in range(y):
        ans.append("U")
    ans.append("R")
    for i in range(y+1):
        ans.append("D")
    for i in range(x+1):
        ans.append("L")
    ans.append("U")

if x > 0 and y < 0:
    for i in range(-y):
        ans.append("D")
    ans.append("R")
    ans.append("D")
    for i in range(x+1):
        ans.append("L")
    for i in range(-y+1):
        ans.append("U")
    ans.append("R")

    ans.append("R")
    for i in range(-y):
        ans.append("D")
    ans.append("R")
    for i in range(-y+1):
        ans.append("U")
    for i in range(x+1):
        ans.append("L")
    ans.append("D")

if x < 0 and y > 0:
    for i in range(y):
        ans.append("U")
    ans.append("L")
    ans.append("U")
    for i in range(-x+1):
        ans.append("R")
    for i in range(y+1):
        ans.append("D")
    ans.append("L")

    ans.append("L")
    for i in range(y):
        ans.append("U")
    ans.append("L")
    for i in range(y+1):
        ans.append("D")
    for i in range(-x+1):
        ans.append("R")
    ans.append("U")

if x < 0 and y < 0:
    for i in range(-y):
        ans.append("D")
    ans.append("L")
    ans.append("D")
    for i in range(-x+1):
        ans.append("R")
    for i in range(-y+1):
        ans.append("U")
    ans.append("L")

    ans.append("L")
    for i in range(-y):
        ans.append("D")
    ans.append("L")
    for i in range(-y+1):
        ans.append("U")
    for i in range(-x+1):
        ans.append("R")
    ans.append("D")

if y==0:
    if x>0:
        for i in range(x):
            ans.append("R")
        ans.append("U")
        for i in range(x):
            ans.append("L")
        ans.append("D")

        ans.append("D")
        for i in range(x):
            ans.append("R")
        ans.append("U")
        ans.append("R")
        ans.append("D")
        ans.append("D")
        for i in range(x+2):
            ans.append("L")
        ans.append("U")
        ans.append("U")
        ans.append("R")
    if x<0:
        x = -x
        for i in range(x):
            ans.append("L")
        ans.append("U")
        for i in range(x):
            ans.append("R")
        ans.append("D")

        ans.append("D")
        for i in range(x):
            ans.append("L")
        ans.append("U")
        ans.append("L")
        ans.append("D")
        ans.append("D")
        for i in range(x+2):
            ans.append("R")
        ans.append("U")
        ans.append("U")
        ans.append("L")

if x==0:
    if y>0:
        for i in range(y):
            ans.append("U")
        ans.append("R")
        for i in range(y):
            ans.append("D")
        ans.append("L")

        ans.append("L")
        for i in range(y):
            ans.append("U")
        ans.append("R")
        ans.append("U")
        ans.append("L")
        ans.append("L")
        for i in range(y+2):
            ans.append("D")
        ans.append("R")
        ans.append("R")
        ans.append("U")
    if y<0:
        y = -y
        for i in range(y):
            ans.append("D")
        ans.append("R")
        for i in range(y):
            ans.append("U")
        ans.append("L")

        ans.append("L")
        for i in range(y):
            ans.append("D")
        ans.append("R")
        ans.append("D")
        ans.append("L")
        ans.append("L")
        for i in range(y+2):
            ans.append("U")
        ans.append("R")
        ans.append("R")
        ans.append("D")

output = "".join(ans)
print(output)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

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

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

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

print(ans)

Submission status: Wrong Answer

Solution code:
#coding: utf-8

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

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

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

print(ans)

Submission status: Wrong Answer

Solution code:
#coding: utf-8

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

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

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

print(ans)

Submission status: Wrong Answer

Solution code:
#coding: utf-8

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

ans += 'D'
for i in range(tx-sx+1):
    ans += 'R'
for i in range(ty-tx+1):
    ans += 'U'
ans += 'L'

ans += 'U'
for i in range(tx-sx+1):
    ans += 'L'
for i in range(ty-tx+1):
    ans += 'D'
ans += 'R'

print(ans)

Submission status: Wrong Answer

Solution code:
#coding: utf-8

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

ans += 'D'
for i in range(tx-sx+1):
    ans += 'R'
for i in range(ty-tx+1):
    ans += 'U'
ans += 'L'

ans += 'U'
for i in range(tx-sx+1):
    ans += 'L'
for i in range(ty-tx+1):
    ans += 'D'
ans += 'R'

print(ans)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
sx, sy, tx, ty = map(int, input().split())

ans = ""
dx = tx - sx
dy = ty - sy

for i in range(dx):
    ans += "R"
for i in range(dy):
    ans += "U"
for i in range(dx):
    ans += "L"
for i in range(dy + 1):
    ans += "D"
for i in range(dx + 1):
    ans += "R"
for i in range(dy + 1):
    ans += "U"
ans += "LU"
for i in range(dx + 1):
    ans += "L"
for i in range(dy + 1):
    ans += "U"
ans += "R"

print(ans)

Submission status: Wrong Answer

Solution code:
x1,y1,x2,y2 = (map(int,input().split()))
ans = ("R" * (x2 - x1)) + ("U" * (y2 - y1)) + ("L" * (x2 - x1)) + ("D" * (y2 - y1))  \
      + "U" + ("L" * (x2 - x1 + 1)) + ("D" * (y2 - y1 + 1)) + "R" + "D" \
      + ("R" * (x2 - x1 + 1)) + ("U" * (y2 - y1 + 1)) + "L"
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
import os

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    sx, sy, tx, ty = il()

    ret = ''
    for n in range(tx - sx): ret += 'R'
    for n in range(ty - sy): ret += 'U'
    for n in range(tx - sx): ret += 'L'
    for n in range(ty - sy): ret += 'D'

    ret += 'L'
    for n in range(ty - sy + 1): ret += 'U'
    for n in range(tx - sx + 1): ret += 'R'
    ret += 'D'
    ret += 'R'
    for n in range(tx - sx): ret += 'D'
    for n in range(ty - sy): ret += 'L'
    ret += 'U'

    print(ret)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
sx, sy, tx, ty = map(int, input().split())
w = tx - sx 
h = ty - sy 
ans = ""
for _ in range(h):
  ans += "U"
for _ in range(w):
  ans += "R"
for _ in range(h):
  ans += "D"
for _ in range(w):
  ans += "L"

print(ans)
ans += "L"
for _ in range(h+1):
  ans += "U"
for _ in range(w+1):
  ans += "R"
ans += "D"
ans += "R"
for _ in range(h+1):
  ans += "D"
for _ in range(w+1):
  ans += "L"
ans += "U"
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
sx, sy, tx, ty = map(int, input().split())
x = tx - sx
y = ty - sy
ans = ''
if x >= 0:
  ans += 'R'*x
else:
  ans += 'L'*-x

if y >= 0:
  ans += 'U'*y
else:
  ans += 'D'*-y
  
if x >= 0:
  ans += 'L'*x
else:
  ans += 'R'*-x

if y >= 0:
  ans += 'D'*y
else:
  ans += 'U'*-y
cycle = ans
ans += 'UR'
ans += cycle
ans += 'DL'
print(ans)

Submission status: Wrong Answer

Solution code:
w,x,y,z=list(map(int, input().split()))
a=[]
for i in range (abs(w)+abs(y)):
	a.append('U')
for i in range (abs(x)+abs(z)):
	a.append('R')
for i in range (abs(w)+abs(y)):
	a.append('D')
for i in range (abs(x)+abs(z)):
	a.append('L')

for i in range (abs(x)+abs(z)):
	a.append('L')
for i in range (abs(w)+abs(y)):
	a.append('U')
for i in range (abs(w)+abs(y)):
	a.append('U')
for i in range (abs(x)+abs(z)):
	a.append('R')
for i in range (abs(x)+abs(z)):
	a.append('R')
for i in range (abs(w)+abs(y)):
	a.append('D')
for i in range (abs(x)+abs(z)):
	a.append('R')
for i in range (abs(w)+abs(y)):
	a.append('D')
for i in range (abs(w)+abs(y)):
	a.append('D')
for i in range (abs(x)+abs(z)):
	a.append('L')
for i in range (abs(x)+abs(z)):
	a.append('L')
for i in range (abs(w)+abs(y)):
	a.append('U')
print(*a,sep='')

Submission status: Wrong Answer

Solution code:
# case への対応がだるいなと思ったら
# 右上方向しかない件について
Z = list(map(int, input().split()))
S, T = Z[:2], Z[2:]
dy, dx = [abs(T[i] - S[i]) for i in range(2)]
# first
result = ""
result += "U"*dy
result += "R"*dx
result += "D"*dy
result += "L"*dx
result += "L"
result += "U"*(dy + 1)
result += "R"*(dx + 1)
result += "D"
result += "R"
result += "D"*(dy + 1)
result += "L"*(dx + 1)
result += "U"
print(result)

Submission status: Wrong Answer

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

sx=S[0]
sy=S[1]
tx=S[2]
ty=S[3]
answer=[]
for i in range(ty-sy):
    answer.append("U")
for i in range(tx-sx):
    answer.append("R")
for i in range(ty-sy):
    answer.append("D")
for i in range(tx-sx):
    answer.append("L")
answer.append("D")
for i in range(tx-sx+1):
    answer.append("R")
for i in range(ty-sy+1):
    answer.append("U")
answer.append("L")
answer.append("U")
for i in range(tx-sx+1):
    answer.append("L")
for i in range(tx-sx+2):
    answer.append("D")
answer.append("R")
for s in answer:
    print(s,end="")

Submission status: Wrong Answer

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

sx=S[0]
sy=S[1]
tx=S[2]
ty=S[3]
answer=[]
for i in range(ty-sy):
    answer.append("U")
for i in range(tx-sx):
    answer.append("R")
for i in range(ty-sy):
    answer.append("D")
for i in range(tx-sx):
    answer.append("L")
answer.append("D")
for i in range(tx-sx+1):
    answer.append("R")
for i in range(ty-sy+2):
    answer.append("U")
for i in range(tx-sx+1):
    answer.append("L")
for i in range(tx-sx+2):
    answer.append("D")
answer.append("R")
for s in answer:
    print(s,end="")

Submission status: Wrong Answer

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

x = c - a
y = d - b

z = []
z += y * 'U'
z += x * 'R'
z += y * 'D'
z += (x + 1) * 'L'
z += (y + 1) * 'U'
z += (1 + x) * 'R'
z += 'U'
z += 'R'
z += (y + 1) * 'U'
z += (1 + x) *'L'
z += 'U'


print(''.join(z))

Submission status: Wrong Answer

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

sx=S[0]
sy=S[1]
tx=S[2]
ty=S[3]
answer=[]
for i in range(tx-sx):
    answer.append("R")
for i in range(ty-sy):
    answer.append("U")
for i in range(tx-sx):
    answer.append("L")
for i in range(ty-sy):
    answer.append("D")
answer.append("D")
for i in range(tx-sx+1):
    answer.append("R")
for i in range(ty-sy+2):
    answer.append("U")
for i in range(tx-sx+2):
    answer.append("L")
for i in range(tx-sx+1):
    answer.append("D")
answer.append("R")
for s in answer:
    print(s,end="")

Submission status: Wrong Answer

Solution code:
import sys

input = sys.stdin.readline

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

dfx = tx - sx
dfy = ty - sy

routes = ''

routes += 'U' * dfy
routes += 'R' * dfx
routes += 'D' * dfy
routes += 'L' * dfx

routes += 'L'
routes += 'U' * (dfy + 1)
routes += 'R' * (dfx + 1)
routes += 'D'

routes += 'R'
routes += 'U' * (dfy + 1)
routes += 'L' * (dfx + 1)
routes += 'U'

print(routes)

Submission status: Wrong Answer

Solution code:
sx, sy, tx, ty = map(int,input().split())
height = tx - sx
width = ty - sy 
# path1
path1 = ['U' for _ in range(height) ]
path1.extend([ 'R' for _ in range(width)])
# path2
path2 = ['D' for _ in range(height)]
path2.extend([ 'L' for _ in range(width)])
# path3
path3 = ['U' for _ in range(height+1)]
path3.extend([ 'R' for _ in range(width+1)])
path3.insert(0,'L')
path3.extend(['D'])
# path4
path4 = ['D' for _ in range(height+1)]
path4.extend([ 'L' for _ in range(width+1) ])
path4.insert(0,'R')
path4.extend(['U'])

path = path1
path.extend(path2)
path.extend(path3)
path.extend(path4)

print(''.join(path))

Submission status: Wrong Answer

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

u = 'U'
d = 'D'
r = 'R'
l = 'L'
x = tx - sx
y = ty - sy
result = []
# 1回目の行き
result += [u]*x
result += [r]*y
# 1回目の帰り
result += [d]*y
result += [l]*x

# 2回目の行き
result += [d]
result += [r]*(y+1)
result += [u]*(x+1)
result += [l]
# 2回目の帰り
result += [u]
result += [l]*(x+1)
result += [d]*(y+1)
result += [r]

print(''.join(result))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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: Wrong Answer

Solution code:
sx,sy,tx,ty=map(int,input().split())
dx,dy=tx-sx,ty-sy
route=["","","",""]
route[0]='U'*dy+'R'*dx
route[1]='D'*dy+'L'*dx
route[2]='L'+'U'*(dx+1)+'R'*(dy+1)+'D'
route[3]='R'+'D'*(dx+1)+'L'*(dy+1)+'U'
print("".join(route))

Submission status: Wrong Answer

Solution code:
sx,sy,tx,ty=map(int,input().split())
dx,dy=tx-sx,ty-sy
route=["","","",""]
route[0]='U'*dx+'R'*dy
route[1]='D'*dx+'L'*dy
route[2]='L'+'U'*(dx+1)+'R'*(dy+1)+'D'
route[3]='R'+'D'*(dx+1)+'L'*(dy+1)+'U'
print("".join(route))

Submission status: Wrong Answer

Solution code:
sx,sy,tx,ty=map(int,input().split())
dx,dy=tx-sx,ty-sy
route=["","","",""]
route[0]='U'*dx+'R'*dy
route[1]='D'*dx+'L'*dy
route[2]='L'+'U'*(dx+1)+'R'*(dy+1)+'D'
route[3]='R'+'U'*(dx+1)+'L'*(dy+1)+'U'
print("".join(route))

Submission status: Wrong Answer

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

x = ['R', 'L'] if tx - sx > 0 else ['L', 'R']
y = ['U', 'D'] if ty - tx > 0 else ['D', 'U']
abs_x = abs(tx - sx)
abs_y = abs(ty - sy)

i = 0
ans = ''
ans += y[0] * abs_y + x[0] * abs_x
ans += y[1] * abs_y + x[1] * abs_x
ans += x[1]
ans += y[0] * (abs_y + 1) + x[0] * (abs_x + 1)
ans += y[1]
ans += x[0]
ans += y[1] * (abs_y + 1) + x[1] * (abs_x + 1)
ans += y[0]
print(ans)

Submission status: Wrong Answer

Solution code:
sx,sy,tx,ty = map(int,input().split())
move = ["R","U","L","D"]
text = ""
x = abs(sx-tx)
y = abs(sy-ty)
a = tx-sx>=0
b = ty-sy>=0
ugoki = [x,0],[y,1],[x,2],[y,3], [1,3],[x+1,0],[y+1,1],[1,2],[1,1],[x+1,2],[y+1,3]
ugoki2= [x,2],[y,1],[x,0],[y,3], [1,3],[x+1,2],[y+1,1],[1,0],[1,1],[x+1,0],[y+1,3]
c = []
if a and b:
  c = ugoki
elif not a and not b:
  c = ugoki
elif not a and b:
  c = ugoki2
elif a and not b:
  c = ugoki2
for i in range(10):
  for n in range(c[i][0]):
    if (not a and not b) or (a and not b):
      text += move[(c[i][1]+2)%4]
    else:
      text += move[c[i][1]]
print(text)

Submission status: Wrong Answer

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

dx = (tx - sx)
dy = (ty - sy)

s = 'U' * dy + 'R' * dx

s += 'D' * dy + 'L' * dx

s += 'L' + 'U' * (dy+1) + 'R' * (dx+2)

s += 'R' + 'D' * (dy+1) + 'L' * (dx+2)

print(s)

Submission status: Wrong Answer

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

dx = (tx - sx)
dy = (ty - sy)

s = 'U' * dy + 'R' * dx

s += 'D' * dy + 'L' * dx

s += 'L' + 'U' * (dy+1) + 'R' * (dx+1)

s += 'R' + 'D' * (dy+1) + 'L' * (dx+1)

print(s)

Submission status: Wrong Answer

Solution code:
# https://atcoder.jp/contests/abc051/tasks/abc051_c
# 同じ座標を複数回通らないようにということなので、始点と終点の上下左右をすべて使うなかで最短経路を提示すれば良い。
# 一番単純なのは時計回りに動くと決め打ちで文字を出力することかな

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

dx = tx - sx
dy = ty - sy
U, D, L, R = 'UDLR'

ans = U * dy + R * dx + D * dy + L * dx + L + U * \
    (1 + dy) + R * (1 + dx) + U + R + D * (1 + dy) + L * (1 + dx) + U
print(ans)

Submission status: Wrong Answer

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