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 = list(map(int, input().split()))

ans = "L"

dx = tx - sx
dy = ty - sy

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

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

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

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

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 + 1) + 'R' * (tx - sx + 1) + 'D' * (ty - sy + 1) + 'L' + 'D' + 'L' * (tx - sx + 1) + 'U' * (ty - sy + 1) + 'R')

Submission status: Wrong Answer

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

for i in range(4):
    if i==2:
        ans+="L"
        dx+=1
        dy+=1
    elif i==3:
        ans+="DR"
    if dy>=0:
        print("U,i=",i)
        print(dy)
        ans+="U"*dy
        dy=dy*(-1)
    else:
        print("D,i=",i)
        print(dy)
        ans+="D"*(dy*(-1))
        dy=dy*(-1)
    if dx>=0:
        print("R,i=",i)
        print(dx)
        ans+="R"*dx
        dx=dx*(-1)
    else:
        print("L,i=",i)
        print(dx)
        ans+="L"*(dx*(-1))
        dx=dx*(-1)
ans+="U"
print(ans)

Submission status: Wrong Answer

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[3]-X[1]>0:
        p=X[3]-X[1]
        R="R"
        L="L"
    else:
        p=X[1]-X[3]
        R="L"
        L="R"
    if X[2]-X[0]>0:
        q=X[2]-X[0]
        U="U"
        D="D"
    else:
        q=X[0]-X[2]
        U="D"
        D="U"
    print(R*p+U*(q+1)+L*(p+1)+D*(q+1)+R+D+R*(p+1)+U*(q+1)+L*(p+1)+D*q)

Submission status: Wrong Answer

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

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

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

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

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

mov_x = tx - sx
mov_y = ty - sy

ans = ''
ans += 'R' * mov_x
ans += 'U' * mov_y
ans += 'L' * mov_x
ans += 'D' * mov_y
ans += 'D'
ans += 'R' * (mov_x + 2)
ans += 'U' * (mov_y + 2)
ans += 'L'
ans += 'U'
ans += 'L' * (mov_x + 2)
ans += 'D' * (mov_y + 2)
ans += 'R'
print(ans)

Submission status: Wrong Answer

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

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

mov_x = tx - sx
mov_y = ty - sy

ans = ''
ans += 'R' * mov_x
ans += 'U' * mov_y
ans += 'L' * mov_x
ans += 'D' * mov_y
ans += 'D'
ans += 'R' * (mov_x + 2)
ans += 'U' * (mov_y + 2)
ans += 'U'
ans += 'L' * (mov_x + 2)
ans += 'D' * (mov_y + 2)
ans += 'R'
print(ans)

Submission status: Wrong Answer

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

ans=""
y=ty-sy
x=tx-sx

#1往復目
ans +="U"*y
ans +="R"*x
ans +="D"*y
ans +="L"*x
#2往復目
ans +="L"
ans +="U"*y
ans +="R"*x
ans +="D"
ans +="R"
ans +="D"*y
ans +="L"*x
ans +="U"

print(ans)

Submission status: Wrong Answer

Solution code:
a,b,c,d = map(int, input().split())
#sを(0,0)にする
s = (a + (0 - a), b + (0 - b))
g = (c + (0 - a), d + (0 - b))

route = []

#turn1 ->g
route.append('R' * (g[0] - s[0]))
route.append('U' * (g[1] - s[1]))
#turn1 ->s
route.append('L' * (g[0] - s[0]))
route.append('D' * (g[1] - s[1]))
#turn2 ->g
route.append('D')
route.append('R' * (g[0] - s[0] + 2))
route.append('U' * (g[1] - s[1] + 1))
route.append('L')
#turn2 ->s
route.append('U')
route.append('L' * (g[0] - s[0] + 2))
route.append('D' * (g[1] - s[1] + 1))
route.append('R')

route = "".join(route)
print(route)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
sx, sy, tx, ty = map(int, input().split())
X = ["R", "L"]
Y = ["D", "U"]
if sx == tx or sy == ty:
    if sy == ty:
        X, Y = Y, X
        sy, ty = sx, tx
    dy = abs(ty - sy)
    d = sy < ty
    nd = sy > ty
    ans = Y[d]*(dy+1)+X[0]*2+Y[nd]*(dy+2)+X[1]*2+Y[d]+X[0]+Y[d]*dy+X[1]*2+Y[nd]*dy+X[0]
else:
    dx = abs(tx-sx)
    dy = abs(ty-sy)
    xd = sx < tx
    yd = sy < ty
    ans = Y[yd]*dy+X[xd]*dx+Y[not yd]*dy+X[not xd]*(dx+1)+Y[yd]*(dy+1)+X[xd]*(dx+1)+Y[not yd]+X[xd]+Y[not yd]*(dy+1)+X[not xd]*(dx+1)+Y[yd]
print(ans)

Submission status: Wrong Answer

Solution code:
sx, sy, tx, ty = map(int, input().split())
X = ["D", "U"]
Y = ["R", "L"]
if sx == tx or sy == ty:
    if sy == ty:
        X, Y = Y, X
        sy, ty = sx, tx
    dy = abs(ty - sy)
    d = sy < ty
    nd = sy > ty
    ans = Y[d]*(dy+1)+X[0]*2+Y[nd]*(dy+2)+X[1]*2+Y[d]+X[0]+Y[d]*dy+X[1]*2+Y[nd]*dy+X[0]
else:
    dx = abs(tx-sx)
    dy = abs(ty-sy)
    xd = sx < tx
    yd = sy < ty
    ans = Y[yd]*dy+X[xd]*dx+Y[not yd]*dy+X[not xd]*(dx+1)+Y[yd]*(dy+1)+X[xd]*(dx+1)+Y[not yd]+X[xd]+Y[not yd]*(dy+1)+X[not xd]*(dx+1)+Y[yd]
print(ans)

Submission status: Wrong Answer

Solution code:
SX, SY, TX, TY = map(int, input().split())
way1 = 'U' * (TX - SX) + 'R' * (TY - SY)
way2 = 'D' * (TX - SX) + 'L' * (TY - SY)
way3 = 'L' + 'U' * (TX - SX + 1) + 'R' * (TY - SY + 1) + 'D'
way4 = 'R' + 'D' * (TX - SX + 1) + 'L' * (TY - SY + 1) + 'U'
print(way1 + way2 + way3 + way4)

Submission status: Wrong Answer

Solution code:
sx, sy, tx, ty = map(int,input().split())
keiro = ""
for i in range(ty-sy):
    keiro += "U"
for i in range(tx-sx):
    keiro += "R"
keiro0 = keiro
keiro = ""
for i in range(ty-sy):
    keiro += "D"
for i in range(tx-sx):
    keiro += "L"
keiro1 = keiro

ans = keiro0+keiro1+"LU"+keiro0+"RDDR"+keiro1+"LU"

print(ans)

Submission status: Wrong Answer

Solution code:
import sys

input = sys.stdin.readline


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

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


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

dx = tx - sx -1
dy = ty - sy -1

txt = ""

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

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

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

print(txt)

Submission status: Wrong Answer

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

# return
ans += "U" * gx + "R" * gy
ans += "U" + "L" * (gx + 1) + "D" * (gy + 1) + "R"

print(ans)

Submission status: Wrong Answer

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

# return
ans += "U" * gx + "R" * gy
ans += "U" + "L" * (gx + 1) + "D" * gy + "R"

print(ans)

Submission status: Wrong Answer

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

go = ""
back = ""

if sx <= tx:
    for i in range(tx-sx):
        go += "R"
        back += "L"
else:
    for i in range(sx-tx):
        go += "L"
        back += "R"
        
if sy <= ty:
    for i in range(ty-sy):
        go += "U"
        back += "D"
else:
    for i in range(ty-sy):
        go += "D"
        back += "U"

go_2nd = ""
back_2nd = ""

if sx <= tx:
    if sy <= ty:
        go_2nd += "D"
        go_2nd += go
        go_2nd += "L"
        back_2nd += "U"
        back_2nd += back
        back_2nd += "R"
    else:
        go_2nd += "U"
        go_2nd += go
        go_2nd += "L"
        back_2nd += "D"
        back_2nd += back
        back_2nd += "R"
else:
    if sy <= ty:
        go_2nd += "U"
        go_2nd += go
        go_2nd += "R"
        back_2nd += "D"
        back_2nd += back
        back_2nd += "L"
    else:
        go_2nd += "D"
        go_2nd += go
        go_2nd += "R"
        back_2nd += "U"
        back_2nd += back
        back_2nd += "L"


print(go + back + go_2nd + back_2nd)

Submission status: Wrong Answer

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

ans = ''

ans +='R'*A + 'U'*B
ans +='L'*A + 'D'*B
ans +='L'+'U'*B+'U'+'R'*A +'R'
ans +='R'+'D'*B+'D'+'L'*A +'L'+'U'
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:


import numpy as np
import fractions as fra


sx,sy,ex,ey=map(int,input().split())
ex-=sx
ey-=sy
s=""
for i in range(ey):
    s+="U"
for i in range(ex):
    s+=("R")
for i in range(ey):
    s+=("D")
for i in range(ex):
    s+=("L")
s+=("D")
for i in range(ex+1):
    s+=("R")
for i in range(ey+1):
    s+=("U")
s+=("LD")
print(s)

Submission status: Wrong Answer

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

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

print(path)

Submission status: Wrong Answer

Solution code:
#ABC051C
x1,y1,x2,y2=map(int,input().split())
for i in range(x2-x1):
    print("R",end="")
for i in range(y2-y1):
    print("U",end="")
for i in range(x2-x1):
    print("L",end="")
for i in range(y2-y1):
    print("D",end="")
print("D",end="")
for i in range(x2-x1):
    print("R",end="")
print("RU",end="")
for i in range(y2-y1):
    print("U",end="")
print("UL",end="")
for i in range(x2-x1):
    print("L",end="")
print("LD",end="")
for i in range(y2-y1):
    print("D",end="")
print("R",end="")

Submission status: Wrong Answer

Solution code:
SX, SY, TX, TY = [int(n) for n in input().split()]

def main():
    xd = TX - SX
    yd = TY - SY
    first = ['R' * xd, 'U' * yd, 'L' * xd, 'D' * yd]
    second = ['U', 'R' * (xd + 1), 'U' * (yd + 1), 'L', 'U', 'L' * (xd + 1), 'D' * (yd + 1), 'R']

    ans = first + second
    print(''.join(ans))

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

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) + 'D' + 'R'*(tx-sx+1) + 'U'*(ty-tx+1)+ 'L' + 'U' + 'L'*(tx-sx+1) + 'D'*(ty-tx+1) + 'R'
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans = ""
#first
for i in range(up_num):
    ans += "U"
for i in range(right_num):
    ans += "R"
for i in range(up_num):
    ans += "D"
for i in range(right_num):
    ans += "L"
ans += "L"
for i in range(up_num):
    ans += "U"
ans += "URD"
for i in range(right_num):
    ans += "R"
ans += "RD"
for i in range(up_num):
    ans += "D"
for i in range(right_num):
    ans += "L"
ans += "U"

print(ans)

Submission status: Wrong Answer

Solution code:
sx, sy, tx, ty = map(int, input().split())
x, y = tx - sx, ty - sy
print(x, y)
u, d, l, r = "UDLR"
p = ""
p += u * y
p += r * x
p += d * y
p += l * x
p += l
p += u * (y + 1)
p += r * (x + 1)
p += d
p += r
p += d * (y + 1)
p += l * (x + 1)
p += u
print(p)

Submission status: Wrong Answer

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

ans=[]
x = tx-sx
y = ty-sy

# 行き
ans.append("R"*x) if x >0 else ans.append("L"*x)
ans.append("U"*y) if x >0 else ans.append("D"*y)

# 帰り
ans.append("L"*x) if x >0 else ans.append("R"*x)
ans.append("D"*y) if x >0 else ans.append("U"*y)

# 行き
ans.append("D"+"R"*(x+1)) if x >0 else ans.append("D"+"L"*(x+1))
ans.append("U"*(y+1)+"L") if x >0 else ans.append("U"*(y+1)+"R")

# 帰り

ans.append("U"+"L"*(x+1)) if x >0 else ans.append("U"+"R"*(x+1))
ans.append("D"*(y+1)+"L") if x >0 else ans.append("D"*(y+1)+"R")
print("".join(ans))

Submission status: Wrong Answer

Solution code:
def solve():
    SX, SY, TX, TY = map(int, input().split())
    # print(SX, SY, "->", TX, TY)

    # 上
    # (SX, SY + 1)
    # (TX, TY + 1)
    # 下
    # (SX, SY - 1)
    # (TX, TY - 1)
    # 左
    # (SX - 1, SY)
    # (TX - 1, TY)
    # 右
    # (SX + 1, SY)
    # (TX + 1, TY)

    right_to_bottom_from_start = "R" + "R" * abs((SX + 1) - TX) + "U" + "U" * abs(SY - (TY - 1))
    left_to_top_from_target = "L" + "L" * abs((TX - 1) - SX) + "D" + "D" * abs(TY - (SY + 1))
    left_to_top_from_start = "L" + "U" * abs((SY - 1) - (TY + 1)) + "R" * abs((SX - 1) - TX) + "D"
    right_to_bottom_from_target = "R" + "D" * abs(TY - (SY - 1)) + "L" * abs((TX + 1) - SX) + "U"

    return right_to_bottom_from_start + left_to_top_from_target + left_to_top_from_start + right_to_bottom_from_target


if __name__ == '__main__':
    res = solve()
    print(res)

Submission status: Wrong Answer

Solution code:
sx, sy, tx, ty = map(int, input().split())
x_dis = tx-sx
y_dis = ty-sy
go_string = ''
if x_dis < 0:
    go_string = go_string + 'L'*abs(x_dis)
if x_dis >= 0:
    go_string = go_string + 'R'*abs(x_dis)
if y_dis < 0:
    go_string = go_string + 'D'*abs(y_dis)
if y_dis >= 0:
    go_string = go_string + 'U'*abs(y_dis)
if 'L' in go_string and 'D' in go_string:
    string = go_string.replace('L', 'R').replace('D', 'U')
if 'L' in go_string and 'U' in go_string:
    string = go_string.replace('L', 'R').replace('U', 'D')
if 'R' in go_string and 'D' in go_string:
    string = go_string.replace('R', 'L').replace('D', 'U')
if 'R' in go_string and 'U' in go_string:
    string = go_string.replace('R', 'L').replace('U', 'D')
ans = go_string + string
print(ans)

Submission status: Wrong Answer

Solution code:
sx, sy, tx, ty = map(int, input().split())
x_dis = tx-sx
y_dis = ty-sy
go_string = ''
if x_dis < 0:
    go_string = go_string + 'L'*abs(x_dis)
if x_dis >= 0:
    go_string = go_string + 'R'*abs(x_dis)
if y_dis < 0:
    go_string = go_string + 'D'*abs(y_dis)
if y_dis >= 0:
    go_string = go_string + 'U'*abs(y_dis)
back_string = ''
if 'L' in go_string and 'D' in go_string:
    string = go_string.replace('L', 'R').replace('D', 'U')
    back_string = string[::-1]
if 'L' in go_string and 'U' in go_string:
    string = go_string.replace('L', 'R').replace('U', 'D')
    back_string = string[::-1]
if 'R' in go_string and 'D' in go_string:
    string = go_string.replace('R', 'L').replace('D', 'U')
    back_string = string[::-1]
if 'R' in go_string and 'U' in go_string:
    string = go_string.replace('R', 'L').replace('U', 'D')
    back_string = string[::-1]
ans = go_string + back_string
print(ans)

Submission status: Wrong Answer

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

yl = ty - sy
xl = tx - sx

ans = ''
ans += 'U'*yl
ans += 'R'*xl
ans += 'D'*yl
ans += 'L'*xl
ans += 'R'*(yl+1)
ans += 'R'*(xl+1)
ans += 'DR'
ans += 'D'*(yl+1)
ans += 'L'*(xl+1)
ans += 'U'

print(ans)

Submission status: Wrong Answer

Solution code:
s_x, s_y, t_x, t_y = map(int, input().split())
#点のインプット
for i in range(t_x - s_x):
  print("R", end="")
for i in range(t_y - s_y):
  print("U", end="")
for i in range(t_x - s_x):
  print("L", end="")
for i in range(t_y - s_y):
  print("D", end="")
t_x = t_x+1
t_y = t_y+1
s_x = s_x-1
s_y = s_y-1
print("D", end="")
for i in range(t_x - s_x):
  print("R", end="")
for i in range(t_y - s_y):
  print("U", end="")
print("LU", end="")
for i in range(t_x - s_x):
  print("L", end="")
for i in range(t_y - s_y):
  print("D", end="")
print("R", end="")

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

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

def bfs():
    now_list = []
    next_list = []
    goal_list = []
    now_list.append([])
    now_list[0] = ["", sx, sy]
    now_set = set()
    while len(goal_list) < 3:
        for route, x, y in now_list:
            for r, nx, ny in (("U",0,1), ("R",1,0), ("D",0,-1), ("L",-1,0)):
                nx += x
                ny += y
                # 目的地だった場合、goal_listに追加して後続処理へ
                if nx == tx and ny == ty:
                    goal_list.append(route+r)
                    if len(goal_list) < 4:
                        continue
                    for goal in goal_list:
                        print(goal, end="")
                    print()
                    return
                # 範囲外かチェック
                if sx >= tx or sy >= ty:
                    continue
                if (nx, ny) in now_set:
                    continue
                now_set.add((nx,ny))
                next_list.append([])
                next_list[-1] = [route+r, nx, ny]

        now_list = next_list
        next_list = []
    return

bfs()

Submission status: Wrong Answer

Solution code:
sx,sy,tx,ty=[int(i) for i in input().split()]
w=tx-sx
h=ty-sy
ans=''

ans+='R'*w
ans+='U'*h
ans+='L'*w
ans+='D'*h

ans+='D'*1
ans+='R'*(w+1)
ans+='U'*(h+1)
ans+='L'*1
ans+='U'*1
ans+='L'*(w+1)
ans+='D'*h
ans+='R'*1
print(ans)

Submission status: Wrong Answer

Solution code:
sx,sy,tx,ty=[int(i) for i in input().split()]
w=tx-sx
h=ty-sy
ans=''

ans+='R'*w
ans+='U'*h
ans+='L'*w
ans+='D'*h

ans+='D'*1
ans+='R'*(h+1)
ans+='U'*(h+1)
ans+='L'*1
ans+='U'*1
ans+='L'*(w+1)
ans+='D'*h
ans+='R'*1
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
sx,sy,tx,ty = map(int,input().split())
up_1 = ty-sy
right_1 = tx-sx
ans = "U"*up_1+"R"*right_1
key = ans[::-1]
ans += key.replace("U","D").replace("R","L")
up_2 = up_1+1
right_2 = right_1+1
flag = "L"+"U"*up_2+"R"*right_2+"D"
key_2 = flag[::-1]
ans += flag + key_2.replace("L","x").replace("R","L").replace("x","R").replace("D","y").replace("U","D").replace("y","U")
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

x = abs(sx-tx)
y = abs(sy-ty)

if sx < tx and sy < ty:
    str = "U"*x + "R"*y + "D"*x + "L"*y + "L" + "U"*(x+1) + "R"*(y+1) + "D" + "R" + "D"*(x+1) + "L"*(y+1) + "U"
elif sx > tx and sy < ty:
    str = "U"*x + "L"*y + "D"*x + "R"*y + "R" + "U"*(x+1) + "L"*(y+1) + "D" + "L" + "D"*(x+1) + "R"*(y+1) + "U"
elif sx < tx and sy > ty:
    str = "D"*x + "R"*y + "U"*x + "L"*y + "L" + "D"*(x+1) + "R"*(y+1) + "U" + "R" + "D"*(x+1) + "L"*(y+1) + "D"
elif sx > tx and sy > ty:
    str = "D"*x + "L"*y + "U"*x + "R"*y + "R" + "D"*(x+1) + "L"*(y+1) + "U" + "L" + "D"*(x+1) + "R"*(y+1) + "D"

print(str)

Submission status: Wrong Answer

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

x = abs(sx-tx)
y = abs(sy-ty)

str = "U"*x + "R"*y + "D"*x + "L"*y + "L" + "U"*(x+1) + "R"*(y+1) + "D" + "R" + "D"*(x+1) + "L"*(y+1) + "U"

print(str)

Submission status: Wrong Answer

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

output_txt = ''

#1st txt
x1 = tx -sx
if x1 >0:
    txt_x1 = 'R' * x1
else:
    txt_x1 = 'L' * x1
y1 = ty -sy
if y1 >0:
    txt_y1 = 'U' * y1
else:
    txt_y1 = 'D' * y1

#2nd txt
if x1 >0:
    txt_x2 = 'L' * x1
else:
    txt_x2 = 'R' * x1
if y1 >0:
    txt_y2 = 'D' * y1
else:
    txt_y2 = 'U' * y1

#3rd txt
if y1 >0:
    txt_3 = 'D' 
else:
    txt_3 = 'U'

if x1 >0:
    txt_3 += 'R' * x1 + 'R'
else:
    txt_3 += 'L' * x1 + 'L'

if y1 >0:
    txt_3 = 'U' * y1 + 'U'
else:
    txt_3 = 'D' * y1 + 'D'

if x1 >0:
    txt_3 += 'L'
else:
    txt_3 += 'R'


#4th txt
if y1 >0:
    txt_4 = 'U' 
else:
    txt_4 = 'D'

if x1 >0:
    txt_4 += 'L' * x1 + 'L'
else:
    txt_4 += 'R' * x1 + 'R'

if y1 >0:
    txt_4 = 'D' * y1 + 'D'
else:
    txt_4 = 'U' * y1 + 'U'

if x1 >0:
    txt_4 += 'R'
else:
    txt_4 += 'L'

output_txt = txt_x1 + txt_y1 + txt_x2 + txt_y2
print(output_txt+txt_3+txt_4)

Submission status: Wrong Answer

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

for i in range(tx-sx):
    result.append("R")
for i in range(tx-sx):
    result.append("U")

for i in range(tx-sx):
    result.append("L")
for i in range(tx-sx):
    result.append("D")
print("".join(result))

Submission status: Wrong Answer

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

for i in range(tx-sx):
    result.append("R")
for i in range(tx-sx):
    result.append("U")

for i in range(tx-sx+1):
    result.append("L")
for i in range(tx-sx+1):
    result.append("D")
print("".join(result))

Submission status: Wrong Answer

Solution code:
# python3 (3.4.3)
import sys
input = sys.stdin.readline

# main
Sx,Sy,Tx,Ty = map(int,input().split())

dx = Tx - Sx
dy = Ty - Sy

ans1 = "U"*dy + "R"*dx
ans2 = "D"*dy + "L"*dy
ans3 = "L" + "U"*(dy+1) + "R"*(dx+1) + "D"
ans4 = "R" + "D"*(dy+1) + "L"*(dy+1) + "U"

print(ans1 + ans2 + ans3 + ans4)

Submission status: Wrong Answer

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

x = tx-sx
y = ty-sy
ans = ""
out1 = "R"*x+"U"*y
return1 = "L"*x+"D"*y
out2a = "LU"
out2b = "RD"
return2a = "RD"
return2b = "LU"
print(out1+return1+out2a+out1+out2b+return2a+return1+return2b)

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

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

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

print(ans)