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

Submission status: Wrong Answer

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

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

ans = ''
ans += 'R'*dx; ans += 'U'*dy
ans += 'L'*dx; ans += 'D'*(dy+1)

ans += 'R'*(dx+1); ans += 'U'*(dy+1); ans += 'L'
ans += 'U'
ans += 'L'*(dx+1); ans += 'U'*(dy+1); ans += 'R'
print(ans)

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 - sx):
    print("U", end = "")
for i in range(tx - sx):
    print("L", end = "")
for i in range(ty - sy + 1):
    print("D", end = "")
for i in range(tx - sx + 1):
    print("R", end = "")
for i in range(ty - sy + 1):
    print("U", end = "")
print("LU", end = "")
for i in range(tx - sx + 1):
    print("L", end = "")
for i in range(ty - sy + 1):
    print("D", end = "")
print("R", end = "")
print()

Submission status: Wrong Answer

Solution code:
sx,sy,tx,ty=map(int,input().split())
a=(tx-sx)*"R"+(ty-sy)*"U"
a=a+a[::-1].replace("R","L").replace("U","D")
b="D"+(tx-sx+1)*"R"+(ty-sy+1)*"U"+"L"
b=b+b[::-1].translate(str.maketrans({"D":"U","U":"D","R":"L","L":"R"}))
print(a+b)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
from __future__ import unicode_literals
from __future__ import print_function
import sys
import itertools

def move(x,y):
    xs = "R"*x if x > 0 else "L"*(-x)
    ys = "U"*y if y > 0 else "D"*(-y)
    return (xs, ys)

def main():
    sx, sy, tx, ty = map(int,sys.stdin.read().split())
    x = tx - sx
    y = ty - sy

    xs, ys = move(x,y)
    ans = xs + ys
    xs, ys = move(-x,-y)
    ans += ys + xs

    xs, ys = move(x+1,y+1)
    ans += "U" + xs + ys + "R" 

    xs, ys = move(-x,-y)
    ans += "U" + ys + xs + "R" 

    sys.stdout.write(ans)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

yu = "U" * (ty - sy)
xr = "R" * (tx - sx)
yd = "D" * (ty - sy)
xl = "L" * (tx - sx)

print(yu + xr + yd + xl + "L" + yu + "U" + xr + "D" + "R" + "D" + yd + "D" + xl + "L" + "U")

Submission status: Wrong Answer

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

yu = "U" * (ty - sy)
xr = "R" * (tx - sx)
yd = "D" * (ty - sy)
xl = "L" * (tx - sx)

print(yu + xr + yd + xl + "L" + yu + "U" + xr + "R" + yd + "DD" + xl + "L" + "U")

Submission status: Wrong Answer

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

r = 'U' * ty + 'R' * tx + 'D' * ty + 'L' * (tx+1) + \
    'U' * (ty+1) + 'U' * (tx+1) + 'DR' + 'D' * (ty+1) + 'L' * (tx+1) + 'U'
print(r)

Submission status: Wrong Answer

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

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

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

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

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
sx, sy, tx, ty = (int(x) for x in raw_input().split())
first = "R" * (tx-sx) + "U" * (ty - sy)
second = "L" * (tx-sx) + "U" * (ty - sy)
third = "D" + "R" * (tx-sx+1) + "U" * (ty-sy+1) + "L"
fourth = "U" + "L" * (tx-sx+1) + "D" * (ty-sy+1) + "R"
print first + second + third + fourth

Submission status: Wrong Answer

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

for i in range(tx - sx):
    print('R')

for i in range(ty - sy):
    print('U')

for i in range(tx - sx):
    print('L')

for i in range(ty - sy):
    print('D')

print('L')

for i in range(ty - sy + 1):
    print('U')

for i in range(tx - sx + 1):
    print('R')

print('D')

print('R')

for i in range(ty - sy + 1):
    print('D')

for i in range(tx - sx + 1):
    print('L')

print('U')

Submission status: Wrong Answer

Solution code:
def main():
    t = input().split(" ")
    dx = int(t[2]) - int(t[0])
    dy = int(t[3]) - int(t[1])

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

main()

Submission status: Wrong Answer

Solution code:

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

ans = ""

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

print(ans)

Submission status: Wrong Answer

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

x=[]
y=[]

for i in range(c-a):
    x.append("R")
    y.append("L")

for i in range(d-b):
    x.append("U")
    y.append("D")

x2=["D","R"]+x+["U","L"]
y2=["U","L"]+x+["D","R"]

ans=x+y+x2+y2

print(''.join(ans))

Submission status: Wrong Answer

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

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

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'

print(ans)

Submission status: Wrong Answer

Solution code:
def m():
    sx, sy, tx, ty = map(int, input().split())
    X = tx-sx
    Y = ty-sy
    ans = ""
    for _ in range(X):
        ans += "R"

    for _ in range(Y):
        ans += "U"

    for _ in range(X):
        ans += "L"

    for _ in range(Y):
        ans += "D"
    ans += "D"

    for _ in range(X):
        ans += "R"
    ans += "R"
    ans += "U"

    for _ in range(Y):
        ans += "U"
    ans += "U"

    ans += "L" * (X+1)
    ans += "D" * (Y+1)
    ans += "R"

    return ans


print(m())

Submission status: Wrong Answer

Solution code:
l = input().split(' ')

y = int(l[3]) - int(l[1])
x = int(l[2]) - int(l[0])

def my_print(i,str):
    for j in range(i):
        print(str,end='')
"""
for i in range(x):
    print('U',end='')

for i in range(y):
    print('R',end='')

for i in range(x):
    print('D',end='')

for i in range(y+1):
    print('L',end='')

for i in range"
"""
my_print(y,'U')
my_print(x,'R')
my_print(y,'D')
my_print(x+1,'L')
my_print(y+1,'U')
my_print(x+1,'R')
my_print(1,'D')
my_print(1,'R')
my_print(y,'D')
my_print(x+1,'L')
my_print(1,'U')


print()

Submission status: Wrong Answer

Solution code:
x, y, u, v = map(int, input().split())
x=u-x
y=v-y

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

Submission status: Wrong Answer

Solution code:
x, y, u, v = map(int, input().split())
x=u-x
y=v-y

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

Submission status: Wrong Answer

Solution code:
x, y, u, v = map(int, input().split())
x=u-x
y=v-y

ans  = "L"+"U"*(y+1)+"R"*(x+1)+"D"
ans += "L"*x+"D"*y
ans += "R"*x+"U"*y
ans += "D" + "R"*(x+1)+"U"*(y+1)+"L"
print(ans)
print("UURDDLLUUURRDRDDDLLU")

Submission status: Wrong Answer

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

a = tx - sx
b = ty - sy

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

for i in range(a+1):
    kei = kei + 'L'
    
for i in range(a+1):
    kei = kei + 'D'
    
kei = kei + 'R'

print(kei)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = [0]*2
t = [0]*2
s[0],s[1],t[0],t[1] = map(int,input().split())
print('R'*(t[0]-s[0])+'U'*(t[1]-s[1])+'L'*(t[0]-s[0])+'D'*(t[1]-s[1])+\
'D'+'R'*(t[0]-s[0]+1)+'U'*(t[1]-s[1]+1)+'L'+'U'+'L'*(t[0]-s[0]+1)+'D'*(t[1]-s[1])+'R')

Submission status: Wrong Answer

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

gx = ''
gy = ''
bx = ''
by = ''

for i in range(0, tx-sx):
	gx = gx + 'R'
	bx = bx + 'L'
for i in range(0, ty-sy):
	gy = gy + 'U'
	by = by + 'D'

print gx + gy + bx + by + 'R' + gx + 'RU' + gy + 'LU' + bx + 'LD' + by + 'R'

Submission status: Wrong Answer

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

gx = ''
gy = ''
bx = ''
by = ''

for i in range(0, tx-sx):
	gx = gx + 'R'
	bx = bx + 'L'
for i in range(0, ty-sy):
	gy = gy + 'U'
	by = by + 'D'

print gx + gy + bx + by + 'D' + gx + 'RU' + gy + 'UL' + bx + 'LD' + by + 'R'

Submission status: Wrong Answer

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

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

print(route)

Submission status: Wrong Answer

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

dx = tx - sx
dy = ty - sy
ans = []
# 1th
for i in range(dy):
    ans.append("U")
for i in range(dx):
    ans.append("R")
# 2nd
for i in range(dy):
    ans.append("D")
for i in range(dx):
    ans.append("L")
# 3rd
ans.append("L")
for i in range(dy+1):
    ans.append("U")
for i in range(dx+1):
    ans.append("R")
ans.append("D")
# 4th
ans.append("R")
for i in range(dy+1):
    ans.append("D")
for i in range(dx+1):
    ans.append("L")
ans.append("U")

Submission status: Wrong Answer

Solution code:
sx,sy,tx,ty = map(int,input().split())
dx, dy = tx-sx, ty-sy
ans = ''
for i in range(2):
    for x in range(dx):
        if i==0:
            ans += 'R'
        else:
            ans += 'L'
    for y in range(dy):
        if i==0:
            ans += 'U'
        else:
            ans += 'D'
for i in range(2):
    if i==0:
        ans += 'L'
    else:
        ans += 'R'
    for y in range(dy+1):
        if i==0:
            ans += 'U'
        else:
            ans += 'D'
    for x in range(dx):
        if i==0:
            ans += 'R'
        else:
            ans += 'L'
    if i==0:
        ans += 'D'
    else:
        ans += 'U'
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:

inline = list(map(int,input().split()))
sx = inline[0]
sy = inline[1]
tx = inline[2]
ty = inline[3]

h = sy-ty
w = sx-tx

for i in range(abs(h)):
    if h > 0:
        print("D",end = "")
    else:
        print("U",end="")

for i in range(abs(w)):
    if w > 0:
        print("L",end = "")
    else:
        print("R",end="")

for i in range(abs(h)):
    if h < 0:
        print("D",end = "")
    else:
        print("U",end="")

for i in range(abs(w)):
    if w < 0:
        print("L",end = "")
    else:
        print("R",end="")

if h>0:
    print("U",end="")
else:
    print("D",end="")

for i in range(abs(w)+1):
    if w > 0:
        print("L",end = "")
    else:
        print("R",end="")
for i in range(abs(h)+1):
    if h > 0:
        print("D",end = "")
    else:
        print("U",end="")

if w<0:
    print("R",end="")
else:
    print("L",end="")

if h<0:
    print("U",end="")
else:
    print("D",end="")

for i in range(abs(w)+1):
    if w < 0:
        print("L",end = "")
    else:
        print("R",end="")
for i in range(abs(h)+1):
    if h < 0:
        print("D",end = "")
    else:
        print("U",end="")

if w>0:
    print("R")
else:
    print("L")

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

Solution code:
lis = list(map(int, input().split()))
a=lis[0]
b=lis[1]
c=lis[2]
d=lis[3]
x=c-a
y=d-b
 
for i in range(x):
    print('R', end='')
for i in range(y):
    print('U', end='')
for i in range(x):
    print('L', end='')
for i in range(y+1):
    print('D', end='')
for i in range(x+1):
    print('R', end='')
for i in range(y+2):
    print('U', end='')
for i in range(x+2):
    print('L', end='')
for i in range(y+1):
    print('D', end='')
print('R',end='')

Submission status: Wrong Answer

Solution code:
x, y, tx, ty = map(int, input().split())

x_diff = tx - x
y_diff = ty - y

first_x_diff = "R" * abs(x_diff) if x_diff > 0 else "L" * abs(x_diff)
first_y_diff = "U" * abs(y_diff) if y_diff > 0 else "D" * abs(y_diff)

first_diff = first_x_diff + first_y_diff
tmp_diff = first_diff.replace("R", "L")
tmp_diff = tmp_diff.replace("U", "D")
first_diff = first_diff + tmp_diff

second_x_diff = "R" * abs(x_diff+1) if x_diff > 0 else "L" * abs(x_diff+1)
second_y_diff = "U" * abs(y_diff+1) if y_diff > 0 else "D" * abs(y_diff+1)

second_diff = second_x_diff + second_y_diff
tmp_diff = second_diff.replace("R", "L")
tmp_diff = tmp_diff.replace("U", "D")
second_diff = second_diff + tmp_diff + "LDRU"

res = first_diff + second_diff
print(res)

Submission status: Wrong Answer

Solution code:
x, y, tx, ty = map(int, input().split())

x_diff = tx - x
y_diff = ty - y

first_x_diff = "R" * abs(x_diff) if x_diff > 0 else "L" * abs(x_diff)
first_y_diff = "U" * abs(y_diff) if y_diff > 0 else "D" * abs(y_diff)

first_diff = first_x_diff + first_y_diff
tmp_diff = first_diff.replace("R", "L")
tmp_diff = tmp_diff.replace("U", "D")
first_diff = first_diff + tmp_diff

second_x_diff = "R" * abs(x_diff+1) if x_diff > 0 else "L" * abs(x_diff+1)
second_y_diff = "U" * abs(y_diff+1) if y_diff > 0 else "D" * abs(y_diff+1)

second_diff = second_x_diff + second_y_diff+"RLUD"
tmp_diff = second_diff.replace("R", "L")
tmp_diff = tmp_diff.replace("U", "D")
second_diff = second_diff + tmp_diff

print(first_diff + second_diff)

Submission status: Wrong Answer

Solution code:
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

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


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
sx, sy, tx, ty = [int(x) for x in input().strip().split(' ')]
# A = (sx,sy)   B = (tx,ty)
S = ''
def move(a,b):
    global x,y,S
    if a-x>0:
        for i in range(a-x):
            x+=1
            S += 'R'
    else:
        for i in range(x-a):
            x-=1
            S += 'L'
    if b-y>0:
        for j in range(b-y):
            y+=1
            S += 'U'
    else:
        for j in range(y-b):
            y-=1
            S += 'D'

x,y=sx,sy
move(tx,y)
move(x,ty)
y+=1
S += 'U'
move(sx-1,y)
move(x,sy)
x += 1
S += 'R'
y -= 1
S += 'D'
move(tx+1,y)
move(x,ty+1)
print(S)

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=[int(x) for x in input().split()]
dx=tx-sx
dy=ty-sy
print("R"*dx+"U"*dy+"U"+"L"*(dx+1)+"D"*(dy+1)+"RD"+"R"*(dx+1)+"U"*(dy+1)+"L")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def main(sx, sy, tx, ty):
    answer = ''
    d_x = tx - sx
    d_y = ty - sy

    one_right = 'R' * d_x
    one_up    = 'U' * d_y
    answer += one_right + one_up

    one_down  = 'D' * d_y
    one_left  = 'L' * (d_x + 1)
    answer += one_down + one_left + 'L'

    two_up    = 'U' * (d_y + 1)
    two_right = 'R' * (d_x + 1)
    answer += two_up + two_right + 'DR'

    two_down  = 'D' * (d_y + 1)
    two_left  = 'L' * (d_x + 1)
    answer += two_down + two_left + 'U'

    return answer

# print(main(
#     0, 0, 1, 2
# ))

if __name__ == '__main__':
    sx, sy, tx, ty = [int(e) for e in input().split()]
    print(main(sx, sy, tx, ty))

Submission status: Wrong Answer

Solution code:
def route(sx, sy, tx, ty):
    dx = tx - sx
    dy = ty - sy
    dx2 = dx if dx >= 0 else -dx
    dy2 = dy if dy >= 0 else -dy
    buf = "R"*dx2 if dx >= 0 else "L"*dx2
    buf += "U"*dy2 if dy >= 0 else "D"*dy2
    return buf

def route2(sx, sy, tx, ty):
    dx = tx - sx
    dy = ty - sy
    if dx >= 0 and dy >= 0:
        buf = "L" + route(sx-1, sy, dx, dy+1) + "D"
    if dx >= 0 and dy < 0:
        buf = "U" + route(sx, sy+1, dx+1, dy) + "L"
    if dx < 0 and dy >= 0:
        buf = "D" + route(sx, sy-1, dx-1, dy) + "R"
    if dx < 0 and dy < 0:
        buf = "R" + route(sx+1, sy, dx, dy-1) + "U"
    return buf

if __name__ == "__main__":
    sx, sy, tx, ty = [int(i) for i in input().split()]
    r1 = route(sx, sy, tx, ty) + route(tx, ty, sx, sy)
    r2 = route2(sx, sy, tx, ty) + route2(tx, ty, sx, sy)
    print(r1 + r2)

Submission status: Wrong Answer

Solution code:
def route(sx, sy, tx, ty):
    dx = tx - sx
    dy = ty - sy
    dx2 = dx if dx >= 0 else -dx
    dy2 = dy if dy >= 0 else -dy
    buf = ""
    for i in range(dx2):
        if dx >= 0:
            buf += "R"
        else:
            buf += "L"
    for i in range(dy2):
        if dy >= 0:
            buf += "U"
        else:
            buf += "D"
    return buf

if __name__ == "__main__":
    sx, sy, tx, ty = [int(i) for i in input().split()]
    r1 = route(sx, sy, tx, ty) + route(tx, ty, sx, sy)
    r2 = "L" + route(sx-1, sy, tx, ty+1)\
             + "DR" + route(tx+1, ty, sx, sy-1) + "U"
    print(r1 + r2)

Submission status: Wrong Answer

Solution code:
def route(sx, sy, tx, ty):
    dx = tx - sx
    dy = ty - sy
    dx2 = dx if dx >= 0 else -dx
    dy2 = dy if dy >= 0 else -dy
    buf = ""
    for i in range(dx2):
        if dx >= 0:
            buf += "U"
        else:
            buf += "D"
    for i in range(dy2):
        if dy >= 0:
            buf += "R"
        else:
            buf += "L"
    return buf

if __name__ == "__main__":
    sx, sy, tx, ty = [int(i) for i in input().split()]
    r1 = route(sx, sy, tx, ty) + route(tx, ty, sx, sy)
    r2 = "L" + route(sx-1, sy, tx, ty+1)\
             + "DR" + route(tx+1, ty, sx, sy-1) + "U"
    print(r1 + r2)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
sx, sy, gx, gy = list(map(int, input().split()))
l = []
dx = gx - sx
dy = gy - sy
for i in range(dx):
	l.append('R')
for i in range(dy):
	l.append('U')
for i in range(dx):
	l.append('L')
for i in range(dy):
	l.append('D')
l.append('D')
for i in range(dx+1):
	l.append('R')
for i in range(dy):
	l.append('U')
l.append('L')
l.append('U')
for i in range(dx+1):
	l.append('L')
for i in range(dy+1):
	l.append('D')
l.append('R')
S = ''.join(l)
print(S)

Submission status: Wrong Answer

Solution code:
pos = list(map(int, input().split()))
sx = pos[0]
sy = pos[1]
tx = pos[2]
ty = pos[3]

dx = tx - sx
dy = ty - sy

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np

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

x = tx-sx
y = ty-tx

f=""
b=""

for i in range(x):
    f=f+"R"
    b=b+"L"
for i in range(y):
    f=f+"U"
    b=b+"D"


print f+b+"DR"+f+"UL"+"UL"+b+"DR"

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def commands(sx, sy, tx, ty):
    ans = ""
    ans += "R" * max(0, tx - sx)
    ans += "L" * max(0, sx - tx)
    ans += "U" * max(0, ty - sy)
    ans += "D" * max(0, sy - ty)
    return ans


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

res = ""
res += commands(sx, sy, tx, ty)
res += commands(tx, ty, sx, sy)
res += "L" + commands(sx - 1, sy, tx, ty + 1) + "D"
res += "R" + commands(tx + 1, ty, sx, sy - 1) + "U"

print res

Submission status: Wrong Answer

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

def LI(): return list(map(int, input().split()))
def II(): return int(input())
def LS(): return input().split()
def S(): return input()


def main():
    sx,sy,tx,ty = LI()
    r = ''
    x = tx-sx
    y = ty-sy
    r += 'U'*x
    r += 'R'*y
    r += 'U'
    r += 'L'*(y+1)
    r += 'D'*(x+1)
    r += 'R'

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

    return r


print(main())

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
sx, sy, tx, ty = map(int, input().split())
#sx < tx, sy < tyなので考えやすい 
#sの直右とtの直下、tの直右とsの直下, sの直左とtの直上, tの直左とsの直上をつなぐような感じでやればいい
#それぞれ、
#sからスタートしてtのx座標まで右に、そこからtのy座標まで上に
#tからスタートしてひとつ右にいき、そこからsのy座標のひとつ下まで（つまり一回多めに）下に、そこからsのx座標まで左に、そこからひとつ上へ行ってs座標に
#sからスタートしてひとつ左にいき、そこからtのy座標のひとつ上まで（つまり一回多めに）上に、そこからtのx座標まで右に、そこからひとつ下へ行ってt座標に
#tからスタートしてsのx座標まで左に、そこからsのy座標まで下に

moving_list = ''
moving_list += 'R'*(tx-sx)
moving_list += 'U'*(ty-sy)
#折り返し
moving_list += ('R'+'D'*(ty-sy+1))
moving_list += ('L'*(tx-sx)+'U')
#二回目
moving_list += ('L'+'U'*(ty-sy+1))
moving_list += ('R'*(tx-sx)+'D')
#二回目の折り返し
moving_list += 'H'*(tx-sx)
moving_list += 'D'*(ty-sy)


print(moving_list)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

dx, dy = tx - sx, ty - sy

sx = 'R' if dx >= 0 else 'L'
sy = 'U' if dy >= 0 else 'D'

first = sx * abs(dx) + sy * abs(dy)

trans = str.maketrans('UDRL', 'DULR')
def rev(s):
    return s.translate(trans)


print(first)

if dx!=0 and dy!=0:
    print(rev(first), end='')
    d = 'L' if dx > 0 else 'R'
    d2 = 'D' if dy>0 else 'U'
    print(d2, d, first, rev(d), rev(d2), sep='', end='')
    print(rev(d2+ d+ first+ rev(d)+ rev(d2)), sep='', end='')
    
else:
    d = 'R' if dx is 0 else 'U'
    second = d+ rev(first)+ rev(d)
    print(second, end='')
    
    print(rev(second), end='')
    d2 = first[0]
    print(d2, d*2, rev(d2), rev(first), rev(d2), rev(d)*2, rev(d2), sep='', end='')

Submission status: Wrong Answer

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

diff_x = tx - sx
diff_y = ty - sy

print('R'*diff_x + 'U'*diff_y + 'L'*diff_x + 'D'*(diff_y+1)
      + 'R'*(diff_x+1) + 'U'*(diff_y+2) + 'L'*(diff_x+2) + 'D'*(diff_y+1)
      + 'R')

Submission status: Wrong Answer

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

ans=""

def up():
    global ans
    global y
    ans+="U"
    y+=1

def down():
    global ans
    global y
    ans+="D"
    y-=1

def left():
    global ans
    global x
    ans+="L"
    x-=1


def right():
    global ans
    global x
    ans+="R"
    x+=1

x=sx
y=sy

while y!=ty:
    up()

while x!=tx:
    right()

while y!=sy:
    down()

while x!=sx:
    left()

left()
while y!=ty+1:
    up()

while x!=tx:
    right()

right()
while y!=sy-1:
    down()

while x!=sx:
    left()

up()

print ans

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

print(s)

Submission status: Wrong Answer

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