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:
def main():
    sx, sy, tx, ty = (int(i) for i in input().split())
    x, y = sx, sy
    goal_cnt = 0
    ans = ""
    finished = {(sx, sy)}
    while goal_cnt < 4:
        print(x, y)
        if goal_cnt % 2 == 0:
            if y < ty and (x, y+1) not in finished:
                y += 1
                ans = ans + "U"
            elif y > ty and (x, y-1) not in finished:
                y -= 1
                ans = ans + "D"
            elif x < tx and (x+1, y) not in finished:
                x += 1
                ans = ans + "R"
            elif x > tx and (x-1, y) not in finished:
                x -= 1
                ans = ans + "L"
            elif y == ty and (x, y+1) not in finished:
                y += 1
                ans = ans + "U"
            elif y == ty and (x, y-1) not in finished:
                y -= 1
                ans = ans + "D"
            elif x == tx and (x+1, y) not in finished:
                x += 1
                ans = ans + "R"
            elif x == tx and (x-1, y) not in finished:
                x -= 1
                ans = ans + "L"
            elif (x, y+1) not in finished:
                y += 1
                ans = ans + "U"
            elif (x, y-1) not in finished:
                y -= 1
                ans = ans + "D"
            elif (x+1, y) not in finished:
                x += 1
                ans = ans + "R"
            elif (x-1, y) not in finished:
                x -= 1
                ans = ans + "L"
            else:
                raise Exception("panic!")
            if x == tx and y == ty:
                goal_cnt += 1
                finished.discard((sx, sy))
                finished.add((tx, ty))
            else:
                finished.add((x, y))
        else:
            if y < sy and (x, y+1) not in finished:
                y += 1
                ans = ans + "U"
            elif y > sy and (x, y-1) not in finished:
                y -= 1
                ans = ans + "D"
            elif x < sx and (x+1, y) not in finished:
                x += 1
                ans = ans + "R"
            elif x > sx and (x-1, y) not in finished:
                x -= 1
                ans = ans + "L"
            elif y == sy and (x, y+1) not in finished:
                y += 1
                ans = ans + "U"
            elif y == sy and (x, y-1) not in finished:
                y -= 1
                ans = ans + "D"
            elif x == sx and (x+1, y) not in finished:
                x += 1
                ans = ans + "R"
            elif x == sx and (x-1, y) not in finished:
                x -= 1
                ans = ans + "L"
            elif (x, y+1) not in finished:
                y += 1
                ans = ans + "U"
            elif (x, y-1) not in finished:
                y -= 1
                ans = ans + "D"
            elif (x+1, y) not in finished:
                x += 1
                ans = ans + "R"
            elif (x-1, y) not in finished:
                x -= 1
                ans = ans + "L"
            else:
                raise Exception("panic!")
            if x == sx and y == sy:
                goal_cnt += 1
                finished.discard((tx, ty))
                finished.add((sx, sy))
            else:
                finished.add((x, y))
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
a,b,c,d = map(int,input().split())
r=str()
if c-a>0:
  r += 'R'*(c-a)
else:
  r +='L'*(a-c)
if d-b>0:
  r += 'U'*(d-b)
else:
  r += 'D'(b-d)
for i in range(len(r)):
  if r[i]=='R':
    r +='L'
  if r[i]=='L':
    r +='R'
  if r[i]=='U':
    r +='D'
  if r[i]=='D':
    r +='U' #一週目おわり
t=len(r)
if d-b>0:
  r += 'D'
else:
  r += 'U'
if c-a>0:
  r += 'R'*(c-a+1)
else:
  r +='L'*(a-c+1)
if d-b>0:
  r += 'U'*(d-b+1)
else:
  r += 'D'(b-d+1)
if c-a>0:
  r += 'L'
else:
  r +='R'
for i in range(t+1,len(r)):
  if r[i]=='R':
    r +='L'
  if r[i]=='L':
    r +='R'
  if r[i]=='U':
    r +='D'
  if r[i]=='D':
    r +='U'
print(r)

Submission status: Wrong Answer

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

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

move_x = "R" * dx
move_y = "U" * dy

f_move = move_x + move_y

if "R" in f_move:
  s_move = f_move.replace("R","L")
if "U" in s_move:
  s_move = s_move.replace("U","D")

t_move = "L" + "U" + f_move + "R" + "D"

ff_move = "R" + "D" + s_move + "L" + "U"

total = f_move + s_move + t_move + ff_move  
  
print(t_move)

Submission status: Wrong Answer

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

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

move_x = "R" * dx
move_y = "U" * dy

f_move = move_x + move_y

if "R" in f_move:
  s_move = f_move.replace("R","L")
if "U" in s_move:
  s_move = s_move.replace("U","D")

t_move = "L" + "U" + f_move + "D"

ff_move = "R" + "D" + s_move + "U"

total = f_move + s_move + t_move + ff_move  
  
print(total)

Submission status: Wrong Answer

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

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

move_x = "R" * dx
move_y = "U" * dy

f_move = move_x + move_y

if "R" in f_move:
  s_move = f_move.replace("R","L")
if "U" in s_move:
  s_move = s_move.replace("U","D")

t_move = "L" + "U" + f_move + "D"

if "R" in t_move:
  ff_move = t_move.replace("R","L")
if "U" in s_move:
  ff_move = ff_move.replace("U","D")

total = f_move + s_move + t_move + ff_move  
  
print(total)

Submission status: Wrong Answer

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

dx = tx - sx
dy = ty - sy

r = ''
for i in range(dy):
  r += 'U'

for i in range(dx):
  r += 'R'
  
for i in range(dy):
  r += 'D'

for i in range(dx):
  r += 'L'

r += 'L'
for i in range(dy + 1):
  r += 'U'
for i in range(dx + 1):
  r += 'R'
r += 'R'
for i in range(dy + 1):
  r += 'D'
for i in range(dx + 1):
  r += 'L'
r += 'U'

print(r)

Submission status: Wrong Answer

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

dx = tx - sx
dy = ty - sy

result = ''
result += 'R' * dx + 'U' * dy  # 1st Forth
result += 'L' * dx + 'D' * dy  # 1st Back
result += 'D' + 'R' * (dx + 1) + 'U' * (dy + 1)  # 2nd Forth
result += 'U' + 'L' * (dx + 1) + 'D' * (dy + 1)  # 2nd Back
print(result)

Submission status: Wrong Answer

Solution code:
sx,sy,tx,ty = map(int, input().split())
d = [tx-sx, ty-sy]
axis = [["R","L"], ["U", "D"]]
ans = []

for i in range(2):
    for j in range(d[0]):
        ans.append(axis[0][i])
    for j in range(d[1]):
        ans.append(axis[1][i])
ans.append("L")
for i in range(d[1]):
    ans.append(axis[1][0])
for i in range(d[0]+1):
    ans.append(axis[0][0])
ans.append("D")
ans.append("R")
for i in range(d[1]):
    ans.append(axis[1][1])
for i in range(d[0]+1):
    ans.append(axis[0][1])
ans.append("U")
a = "".join(ans)
print(a)

Submission status: Wrong Answer

Solution code:
A = list(map(int, input().split()))
s_1 = ''
if (int(A[0]) < 0) and (int(A[2]) < 0):
  a = abs(int(A[0])) - abs(int(A[2]))
elif (int(A[0]) < 0) and (int(A[2]) > 0):
  a = abs(int(A[0])) + abs(int(A[2]))
else:
  a = int(A[2]) -  int(A[0])
  
if (int(A[1]) < 0) and (int(A[3]) < 0):
  b = abs(int(A[1])) - abs(int(A[3]))
elif (int(A[1]) < 0) and (int(A[3]) > 0):
  b = abs(int(A[1])) + abs(int(A[3]))
else:
  b = int(A[3]) -  int(A[1])

for i in range(b):
  s_1 = s_1 + 'U'
for i in range(a):
  s_1 = s_1 + 'R'
  
for i in range(b):
  s_1 = s_1 + 'D'
for i in range(a):
  s_1 = s_1 + 'L'
  
s_1 = s_1 + 'L'
for i in range(b+1):
  s_1 = s_1 + 'U'
for i in range(a+1):
  s_1 = s_1 + 'R'
s_1 = s_1 + 'D'
  
s_1 = s_1 + 'L'
for i in range(b+1):
  s_1 = s_1 + 'D'
for i in range(a+1):
  s_1 = s_1 + 'L'
s_1 = s_1 + 'U'
print(s_1)

Submission status: Wrong Answer

Solution code:
A = list(map(int, input().split()))
s_1 = ''
if (int(A[0]) < 0) and (int(A[2]) < 0):
  a = abs(int(A[0])) - abs(int(A[2]))
elif (int(A[0]) < 0) and (int(A[2]) > 0):
  a = abs(int(A[0])) + abs(int(A[2]))
else:
  a = int(A[2]) -  int(A[0])
  
if (int(A[1]) < 0) and (int(A[3]) < 0):
  b = abs(int(A[1])) - abs(int(A[3]))
elif (int(A[1]) < 0) and (int(A[3]) > 0):
  b = abs(int(A[1])) + abs(int(A[3]))
else:
  b = int(A[3]) -  int(A[1])

for i in range(a):
  s_1 = s_1 + 'U'
for i in range(b):
  s_1 = s_1 + 'R'
  
for i in range(a):
  s_1 = s_1 + 'D'
for i in range(b):
  s_1 = s_1 + 'L'
  
s_1 = s_1 + 'L'
for i in range(a+1):
  s_1 = s_1 + 'U'
for i in range(b+1):
  s_1 = s_1 + 'R'
s_1 = s_1 + 'D'
  
s_1 = s_1 + 'L'
for i in range(a+1):
  s_1 = s_1 + 'D'
for i in range(b+1):
  s_1 = s_1 + 'L'
s_1 = s_1 + 'U'
print(s_1)

Submission status: Wrong Answer

Solution code:
A = list(map(int, input().split()))
s_1 = ''
if (int(A[0]) < 0) and (int(A[2]) < 0):
  a = abs(int(A[0])) - abs(int(A[2]))
elif (int(A[0]) < 0) and (int(A[2]) > 0):
  a = abs(int(A[0])) + abs(int(A[2]))
else:
  a = int(A[2]) -  int(A[0])
  
if (int(A[1]) < 0) and (int(A[3]) < 0):
  b = abs(int(A[1])) - abs(int(A[3]))
elif (int(A[1]) < 0) and (int(A[3]) > 0):
  b = abs(int(A[1])) + abs(int(A[3]))
else:
  b = int(A[3]) -  int(A[1])

for i in range(a):
  s_1 = s_1 + 'U'
for i in range(b):
  s_1 = s_1 + 'R'
  
for i in range(a):
  s_1 = s_1 + 'D'
for i in range(b):
  s_1 = s_1 + 'L'
s_1 = s_1 + 'L'
for i in range(a+1):
  s_1 = s_1 + 'U'
for i in range(b+1):
  s_1 = s_1 + 'R'
s_1 = s_1 + 'D'
for i in range(a+1):
  s_1 = s_1 + 'D'
for i in range(b+1):
  s_1 = s_1 + 'L'
print(s_1)

Submission status: Wrong Answer

Solution code:
sx, sy, tx, ty = [int(coodinate) for coodinate in input().split()]
d_x = tx - sx
d_y = ty - sy

route = []
route.append('U' * d_y + 'R' * d_x)
route.append('D' * d_y + 'L' * d_x)
route.append('L' + 'U' * (d_y + 1) +
    'R' * (d_x + 2))
route.append('D' * (d_y + 2) + 'L' * (d_x + 1)
    + 'U')

ans = ''.join(route)
print(ans)

Submission status: Wrong Answer

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 + 'L' + 'U' * (dy + 1) + 'R' * (dx + 1) + 'U' + 'R' + 'D' * (dy + 1) + 'L' * (dx + 1) + 'U')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline


def main():
    sx, sy, tx, ty = map(int, input().split())
    ans = ""
    for _ in range(ty-sy):
        ans += "U"
    for _ in range(tx-sx):
        ans += "R"

    for _ in range(ty-sy):
        ans += "D"
    for _ in range(tx-sx):
        ans += "L"

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

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

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

Solution code:
def c():
    sx, sy, tx, ty = map(int, input().split())
    dx = tx - sx
    dy = ty - sy

    # Path 1
    print("U" * dy + "R" * dx, end='')

    # Path 2
    print("D" * dy + "L" * dx, end='')

    # Path 3
    print("D" + "L" * (dx+1) + "U" * (dy+1) + "R", end='')

    # Path 4
    print("U" + "R" * (dx+1) + "D" * (dy+1) + "L", end='')


if __name__ == '__main__':
    c()

Submission status: Wrong Answer

Solution code:
def c():
    sx, sy, tx, ty = map(int, input().split())
    dx = tx - sx
    dy = ty - sy

    # Path 1
    print("U" * dy + "R" * dx)

    # Path 2
    print("D" * dy + "L" * dx)

    # Path 3
    print("D" + "L" * (dx+1) + "U" * (dy+1) + "R")

    # Path 4
    print("U" + "R" * (dx+1) + "D" * (dy+1) + "L")


if __name__ == '__main__':
    c()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,b,c,d=map(int,input().split())
x=c-a
y=d-b
#round1
if(x>0):
  for i in range(x):
    print("U",end="")
else:
  for i in range(-x):
    print("D",end="")
if(y>0):
  for i in range(y):
    print("R",end="")
else:
  for i in range(-y):
    print("L",end="")
    
#round2
if(x>0):
  for i in range(x):
    print("D",end="")
else:
  for i in range(-x):
    print("U",end="")
if(y>0):
  for i in range(y):
    print("L",end="")
else:
  for i in range(-y):
    print("R",end="")
    
#round3
if(x>0):
  if(y>0):
    print("L",end="")
  else:
    print("R",end="")
  for i in range(x+1):
    print("U",end="")
else:
  if(y>0):
    print("L",end="")
  else:
    print("R",end="")
  for i in range(-x+1):
    print("D",end="")
    
if(y>0):
  for i in range(y+1):
    print("R",end="")
  if(x>0):
    print("D",end="")
  else:
    print("U",end="")
else:
  for i in range(-y+1):
    print("L",end="")
  if(x>0):
    print("D",end="")
  else:
    print("U",end="")
    
#round4
if(x>0):
  if(y>0):
    print("R",end="")
  else:
    print("L",end="")
  for i in range(x+1):
    print("D",end="")
else:
  if(y>0):
    print("R",end="")
  else:
    print("L",end="")
  for i in range(-x+1):
    print("U",end="")
if(y>0):
  for i in range(y+1):
    print("L",end="")
  if(x>0):
    print("U",end="")
  else:
    print("D",end="")
else:
  for i in range(-y+1):
    print("R",end="")
  if(x>0):
    print("U",end="")
  else:
    print("D",end="")

Submission status: Wrong Answer

Solution code:
sx, sy, tx, ty = map(int, input().split())
xtmp = abs(sx - tx)
ytmp = abs(sy - ty)
ans = 'R' * xtmp
ans += 'U' * ytmp
tmp1 = ans
tmp1 = tmp1.replace('R', 'L')
tmp1 = tmp1.replace('U', 'D')
tmp2 = 'LU' + ans + 'RD'
tmp3 = 'RD' + tmp1 + 'LU'
print(ans + tmp1 + tmp2 + tmp3)

Submission status: Wrong Answer

Solution code:
sx, sy, tx, ty = map(int, input().split())
xtmp = abs(sx - tx)
ytmp = abs(sy - ty)
ans = 'R' * xtmp
ans += 'U' * ytmp
tmp1 = ans
tmp1 = tmp1[-1: -len(ans) - 1: -1]
tmp1 = tmp1.replace('R', 'L')
tmp1 = tmp1.replace('U', 'D')
tmp2 = 'LU' + ans + 'RD'
tmp3 = 'RD' + tmp1 + 'LU'
print(ans + tmp1 + tmp2 + tmp3)

Submission status: Wrong Answer

Solution code:
sx, sy, tx, ty = map(int, input().split())
xtmp = abs(sx - tx)
ytmp = abs(sy - ty)
ans = 'R' * xtmp
ans += 'U' * ytmp
tmp1 = ans
tmp1 = tmp1[-1: -len(ans) - 1: -1]
tmp2 = 'LU' + ans + 'RD'
tmp3 = 'RD' + tmp1 + 'LU'
print(ans + tmp1 + tmp2 + tmp3)

Submission status: Wrong Answer

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

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

x_dif = tx - sx
y_dif = ty - sy

first_loop = ('U' * y_dif) + ('R' * x_dif) + 'D' * y_dif + 'L' * x_dif
#second_loop
second_loop_1 = 'D' + 'R' * (x_dif + 1) + 'U' * (y_dif + 1) + 'L'
second_loop_2 = 'L' + 'U' * (y_dif + 1) + 'R' * (x_dif + 1) + 'D'
print(first_loop + second_loop_1 + second_loop_2)

Submission status: Wrong Answer

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

route1 = 'U' * ty + 'R' * tx
route2 = 'D' * ty + 'L' * tx
route3 = 'L' + 'U' * (ty + 1) + 'R' * (tx + 1) + 'D'
route4 = 'R' + 'D' * (ty + 1) + 'L' * (tx + 1) + 'U'

print(route1 + route2 + route3 + route4)

Submission status: Wrong Answer

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

length = ty - sy
width = tx - sx
u = "U"
l = "L"
r = "R"
d = "D"
ans = ''
ans += u*length + r*width
ans += l*width + d*length
ans += d + r*(width+1) + u*(length+1) + l
ans += u + l*(width+1) + d*(length+1) + r
print(ans)

Submission status: Wrong Answer

Solution code:
from sys import stdin
sx,sy,tx,ty = [int(x) for x in stdin.readline().rstrip().split()]
ans = ""
ans += (ty-sy)*"U"
ans += (tx-sx)*"R"
ans2 = ans.replace("R","tmp").replace("L","R").replace("tmp","L")
ans2 = ans2.replace("U","tmp").replace("D","U").replace("tmp","D")
ans = ans + "LU"+ans+"RD" + "RD" + ans2 + "LU"
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

tx-=sx
ty-=sy

ans=""

for i in range(tx):
  ans+="R"
for i in range(ty):
  ans+="U"
for i in range(tx):
  ans+="L"
for i in range(ty):
  ans+="D"

ans+="D"
for i in range(tx):
  ans+="R"
ans+="U"

ans+="R"
for i in range(ty):
  ans+="U"
ans+="L"

ans+="U"
for i in range(tx):
  ans+="L"
ans+="D"

ans+="L"
for i in range(ty):
  ans+="D"
ans+="R"

print(ans)

Submission status: Wrong Answer

Solution code:

import sys
input = sys.stdin.readline
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
# A = [ int(input()) for _ in range(N) ]
##############################

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

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans = "R" * dx + "U" * dy + "L" * dy + "D" * dx
ans += "DR" + "R" * dx + "U" * dy + "UL" + "UL" + "L" * dy + "D" * dx + "DR"
print(ans)

Submission status: Wrong Answer

Solution code:
from sys import stdin

SX, SY, TX, TY = map(int, stdin.readline().rstrip().split())


# S->T
# とりあえず上
print('U' * (TY - SY), end='')
print('R' * (TX - SX), end='')

# T->S
print('D' * (TY - SY), end='')
print('L' * (TX - SX), end='')

# S->T 2回目
# 左へ大回り
print('L', end='')
print('U' * (TY - SY + 1), end='')
print('R' * (TX - SX + 1), end='')
print('D', end='')

# T->S 2回目
# 右へ大回り
print('R', end='')
print('U' * (TY - SY + 1), end='')
print('L' * (TX - SX + 1), end='')
print('U')

Submission status: Wrong Answer

Solution code:
from sys import stdin

SX, SY, TX, TY = map(int, stdin.readline().rstrip().split())


# S->T
# とりあえず上
print('U' * (TY - SY), end='')
print('R' * (TX - SX), end='')

# T->S
print('D' * (TY - SY), end='')
print('L' * (TX - SX), end='')

# S->T 2回目
# 左へ大回り
print('L', end='')
print('U' * (TY - SY + 1), end='')
print('R' * (TX - SX + 1), end='')
print('D', end='')

# T->S 2回目
# 右へ大回り
print('R', end='')
print('U' * (TY - SY + 1), end='')
print('L' * (TX - SX + 1), end='')
print('U', end='')

Submission status: Wrong Answer

Solution code:
sx,sy,tx,ty= map(int, input().split())
a=""
for i in range(tx-sx):
  a+="R"
for i in range(ty-sy):
  a+="U"
for i in range(tx-sx):
  a+="L"
for i in range(tx-sx):
  a+="D"
a+="D"
for i in range(tx-sx+1):
  a+="R"
for i in range(ty-sy+1):
  a+="U"
a+="LU"
for i in range(tx-sx+1):
  a+="L"
for i in range(ty-sy+1):
  a+="D"
a+="R"
print(a)

Submission status: Wrong Answer

Solution code:
sx,sy,tx,ty= map(int, input().split())
a=""
for i in range(tx-sx):
  a+="R"
for i in range(ty-sy):
  a+="U"
for i in range(tx-sx):
  a+="L"
for i in range(tx-sx):
  a+="D"
a+="D"
for i in range(tx-sx+1):
  a+="R"
for i in range(ty-sy+1):
  a+="U"
a+="LU"
for i in range(tx-sx+1):
  a+="L"
for i in range(tx-sx+1):
  a+="D"
a+="R"
print(a)

Submission status: Wrong Answer

Solution code:
sx,sy,tx,ty= map(int, input().split())
a=""
for i in range(tx-sx):
  a+="R"
for i in range(ty-sy):
  a+="U"
for i in range(tx-sx):
  a+="L"
for i in range(tx-sx):
  a+="D"
a+="U"
for i in range(tx-sx+1):
  a+="R"
for i in range(ty-sy+1):
  a+="U"
a+="LU"
for i in range(tx-sx+1):
  a+="L"
for i in range(tx-sx+1):
  a+="D"
a+="R"
print(a)

Submission status: Wrong Answer

Solution code:
def main():
    sx,sy,tx,ty = map(int,input().split())
    path =''
    ly,lx = abs(ty-sy),abs(tx-sx)
    #s->t:上から出て左から入る
    path += 'U' * ly
    path += 'R' * lx
    #t->s:下から出て右から入る
    path += 'D' * ly
    path += 'L' * lx
    #s->t:左から出て上から入る
    path += 'L' + 'U' * (ly+1)
    path += 'R' * (lx+1) + 'D'
    #t->s:右から出て下から入る
    path += 'R' +'U'*(ly+1)
    path += 'L'*(lx+1) +'U'
    print(path)
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

x = tx - sx
y = ty - sy

print('U'*y+'R'*x+'U'+'L'*(x+1)+'D'*y+'R'*(x+1)+'U'*y+'R'+'D'*(y+1)+'L'*(x+1)+'U')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

out = ""
def p(s):
    global out
    out += s
# 1回目 行き
for i in range(ty-sy):
    p("U")
for i in range(tx-sx):
    p("R")

# 1回目 帰り
for i in range(ty-sy):
    p("D")
for i in range(tx-sx):
    p("L")

# 2回目 行き
p("L")
for i in range(ty-sy+1):
    p("U")
for i in range(tx-sx+1):
    p("R")

# 2回目 帰り
for i in range(ty-sy+1):
    p("D")
for i in range(tx-sx+1):
    p("L")
p("U")
print(out)

Submission status: Wrong Answer

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

h = tx - sx
w = ty - sy

s = ''
s += 'U'
s += 'U' * (h - 1)
s += 'R' * w
s += 'D'
s += 'D' * (h - 1)
s += 'L' * w
s += 'L'
s += 'U' * (h + 1)
s += 'R' * (w + 1)
s += 'D'
s += 'R'
s += 'D' * (h + 1)
s += 'L' * (w + 1)
s += 'U'

print(s)

Submission status: Wrong Answer

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

right1 = ["R" for _ in range(tx-sx)]
up1 = ["U" for _ in range(ty-sy)]
left1 = ["L" for _ in range(tx-sx)]
down1 = ["D" for _ in range(ty-sy)]
hoge = ["D"]
right2 = ["R" for _ in range(tx-sx+1)]
up2 = ["U" for _ in range(ty-sy+1)]
left2 = ["L"]
print("".join(right1+up1+left1+down1+hoge+right2+up2+left2))

Submission status: Wrong Answer

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

right1 = ["R" for _ in range(tx-sx)]
up1 = ["U" for _ in range(ty-sy)]
left1 = ["L" for _ in range(tx-sx)]
down1 = ["D" for _ in range(ty-sy)]
hoge = ["D"]
right2 = ["R" for _ in range(tx-sx+1)]
up2 = ["U" for _ in range(ty-sy+1)]
left2 = ["L" for _ in range(tx-sx+2)]
down2 = ["D" for _ in range(ty-sy)]
hoge2 = ["R"]
print("".join(right1+up1+left1+down1+hoge+right2+up2+left2+down2+hoge2))

Submission status: Wrong Answer

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

result = []
result.extend(['R' for _ in range(tx - sx)])
result.extend(['U' for _ in range(ty - sy)])
result.extend(['L' for _ in range(tx - sx)])
result.extend(['D' for _ in range(ty - sy + 1)])
result.extend(['R' for _ in range(tx - sx + 1)])
result.extend(['U' for _ in range(ty - sy + 1)])
result.extend(['L'])
result.extend(['U'])
result.extend(['L' for _ in range(tx - sy + 1)])
result.extend(['D' for _ in range(ty - sy + 1)])
result.extend(['R'])
print("".join(result))

Submission status: Wrong Answer

Solution code:
a,b,c,d = map(int,input().split())
x=c-a
y=d-b
print('R'*x+'U'*(y+1)+'L'*(x+1)+'D'*(y+1)+'R'+'U'*x+'R'*(x+1)+'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
s=""
s+="R"*x+"U"*y
s+="L"*x+"D"*y
s+="L"+"U"*(y+1)+"R"*(x+1)
s+="R"+"D"*(y+1)+"L"*(x+1)
print(s)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

holizontal = tx - sx
vertical = ty - sy

ans = ['L']
ans += ['U'] * (vertical + 1)
ans += ['R'] * (holizontal + 1)
ans += ['D']
ans += ['R'] * holizontal
ans += ['D'] * (vertical + 1)
ans += ['R'] * (holizontal + 1)
ans += ['U'] * (vertical + 1)
ans += ['L']
ans += ['D'] * vertical
ans += ['L'] * holizontal

print(''.join(ans))

Submission status: Wrong Answer

Solution code:
a,b,c,d = map(int, input().split())
x = c-a
y = d-b
y1=''
y2=''
for i in range(y):
  y1+='U'
  y2+='D'
x1=''
x2=''
for i in range(x):
  x1+='R'
  x2+='L'
print(y1+x1+y2+x2+'L'+y1+'UR'+x1+'DR'+y2+'DL'+y1+'U')

Submission status: Wrong Answer

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

tx -= sx
ty -= sy

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans_x = tx-sx
ans_y = ty-sx

x1 = []
x2 = []

for i in range(ans_y):
    x1.append("U")
for j in range(ans_x):
    x1.append("R")

x2.append("L")
for i in range(ans_y+1):
    x2.append("U")
for j in range(ans_x+1):
    x2.append("R")
x2.append("D")
    
y1 = x1.copy()
y1 = [s.replace("U", "D").replace("R","L") for s in y1]

y2 = x2.copy()
y2 = [s.replace("U","D").replace("R","L") for s in y2]

if y2[0] == "L":
    y2[0] = "R"
if y2[-1] == "D":
    y2[-1] = "U"

print("".join(x1+y1+x2+y2))

Submission status: Wrong Answer

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

ans_x = tx-sx
ans_y = ty-sx

x1 = []
x2 = []

for i in range(ans_y):
    x1.append("U")
for j in range(ans_x):
    x1.append("R")

x2.append("L")
for i in range(ans_y+1):
    x2.append("U")
for j in range(ans_x+1):
    x2.append("R")
else:
    x2.append("D")
    
y1 = x1.copy()
y1 = [s.replace("U", "D").replace("R","L") for s in y1]

y2 = x2.copy()
y2 = [s.replace("U","D").replace("R","L") for s in y2]

if y2[0] == "L":
    y2[0] = "R"
if y2[-1] == "D":
    y2[-1] = "U"

print("".join(x1+y1+x2+y2))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
sx,sy,tx,ty  = list(map(int,input().split()))
string = ""  
if sy == ty:
  string += "R"*(tx-sx)
  string += "D"+"L"*(tx-sx)+"U"
  string += "U"+"R"*(tx-sx)+"D"
  string += "RUU"+"L"*(tx-sx+2)+"DDR"
  if sx > tx:
    string.replace("R","X").replace("L","R").replace("X","L")
elif sy == ty:
  string += "U"*(tx-sx)
  string += "R"+"D"*(tx-sx)+"L"
  string += "L"+"U"*(tx-sx)+"R"
  string += "ULL"+"D"*(tx-sx+2)+"RRU"
  if sy > ty:
    string.replace("D","X").replace("U","D").replace("X","U")
else:
  g = []
  if sx<tx:
    g += ["R","L"]
  else:
    g += ["L","R"]
  
  if sy<ty:
    g += ["U","D"]
  else:
    g += ["D","U"]
  
  dx,dy = abs(tx-sx),abs(ty-sy)
  
  string += g[0]*dx+g[2]*dy
  string += g[3]*dy+g[1]*dx
  string += g[1]+g[0]+g[0]*dx+g[2]*dy+g[2]+g[3]
  string += g[2]+g[3]+g[3]*dy+g[1]*dx+g[1]+g[0]
  
print(string)