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

Solution (Python):
import sys
input = sys.stdin.readline

def main():
    sx,sy,tx,ty = map(int,input().split())
    dx = tx-sx
    dy = ty-sy
    
    ans = ["R"*dx + "U"*dy + "L"*dx + "D"*dy+"D"+"R"*(dx+1)+"U"*(dy+1)+"L"+"U"+"L"*(dx+1)+"D"*(dy+1)+"R"]
    
    print(*ans)
    
if __name__ == "__main__":
    main()

Solution (Python):
sx,sy,tx,ty=map(int,input().split())
dx=tx-sx
dy=ty-sy
R1='U'*dy+'R'*dx
R2='D'*dy+'L'*dx
R3='L'+'U'*(dy+1)+'R'*(dx+1)+'D'
R4='R'+'D'*(dy+1)+'L'*(dx+1)+'U'
print(R1+R2+R3+R4)

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

ans = ""

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 += "UR"
for i in range(right_num):
    ans += "R"
ans += "DRD"
for i in range(up_num):
    ans += "D"
for i in range(right_num):
    ans += "L"
ans += "LU"

print(ans)

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

dif_x = tx - sx
dif_y = ty - sy

route_one_forward = 'U'*dif_y + 'R'*dif_x
route_two_back = 'D'*dif_y + 'L'*dif_x
route_three_forward = 'L' + 'U'*(dif_y + 1) + 'R'*(dif_x + 1) + 'D'
route_four_back = 'R' + 'D'*(dif_y + 1) + 'L'*(dif_x + 1) + 'U'

route_all = route_one_forward + route_two_back + route_three_forward + route_four_back
print(route_all)

Solution (Python):
def two_int():
    N, K = map(int, input().split())
    return N,K

def one_int():
    return int(input())

def one_str():
    return input()

def many_int():
    return list(map(int, input().split()))

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



Y = abs(gy - sy)
X = abs(gx - sx)



output = ""
output += "U"*abs(Y)
output += "R"*abs(X)
output += "D"*abs(Y)
output += "L"*abs(X)

output += "L"

output += "U"*(abs(Y)+1)
output += "R"*(abs(X)+1)

output += "DR"

output += "D"*(abs(Y)+1)
output += "L"*(abs(X)+1)

output += "U"
print(output)

Solution (Python):
import sys
input = sys.stdin.readline
from operator import itemgetter
sys.setrecursionlimit(10000000)
INF = 10**30

def main():
    sx, sy, tx, ty = list(map(int, input().strip().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-sy):
        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)

if __name__ == '__main__':
    main()

Solution (Python):
a, b, c, d = map(int, input().split())
x, y = c - a, d - b

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

Solution (Python):


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


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


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

print(ans)

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

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

Solution (Python):

sx,sy,tx,ty = map(int, input().split())
x=-sx
y=-sy
sx+=x
sy+=y
tx+=x
ty+=y
tx=abs(tx)
ty=abs(ty)

ans=[]
ans+=['U']*ty
ans+=['R']*tx
ans+=['D']*ty
ans+=['L']*tx
ans+=['L']
ans+=['U']*(ty+1)
ans+=['R']*(tx+1)
ans+=['D']
ans+=['R']
ans+=['D']*(ty+1)
ans+=['L']*(tx+1)
ans+=['U']

print(''.join(ans))

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

dx = tx-sx
dy = ty-sy

ans = ""
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): ans += "D"

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

print(ans)

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

Solution (Python):


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

dx = tx - sx
dy = ty - sy

ans = ''

for a in range(dx):
    ans += 'R'

for b in range(dy + 1):
    ans += 'U'

for c in range(dx + 1):
    ans += 'L'

for d in range(dy + 1):
    ans += 'D'

ans += 'R'

ans += 'D'

for e in range(dx + 1):
    ans += 'R'

for f in range(dy + 1):
    ans += 'U'

for g in range(dx + 1):
    ans += 'L'

for h in range(dy):
    ans += 'D'

print(ans)

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

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

Solution (Python):
a,b,c,d=map(int,input().split());x,y=c-a,d-b;u,d,l,r="UDLR";print(u*y+r*x+d*y+l*x+l+u*(y+1)+r*(x+1)+d+r+d*(y+1)+l*(x+1)+u)

Solution (Python):
sx, sy, tx, ty = map(int, input().split())
x, y = tx - sx, ty - sy
if x > 0 and y > 0:
  u, d, l, r = "UDLR"
else:
  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)

Solution (Python):
a,b,c,d=map(int,input().split())
X=c-a
Y=d-b
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')

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

answer = ""

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

print(answer)

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

path1 = 'R' * dx + 'U' * dy
path2 = 'L' * dx + 'D' * dy
path3 = 'D' + 'R' * (dx + 1) + 'U' * (dy + 1) + 'L'
path4 = 'U' + 'L' * (dx + 1) + 'D' * (dy + 1) + 'R'

answer = path1 + path2 + path3 + path4
print(answer)

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


def plus_x_arrange(first_x, second_x):
    add_x = ''
    while first_x < second_x:
        add_x += 'R'
        first_x += 1
    return add_x

def plus_y_arrange(first_y, second_y):
    add_y = ''
    while first_y < second_y:
        add_y += 'U'
        first_y += 1
    return add_y

def minus_x_arrange(first_x, second_x):
    add_x = ''
    while first_x < second_x:
        add_x += 'L'
        first_x += 1
    return add_x

def minus_y_arrange(first_y, second_y):
    add_y = ''
    while first_y < second_y:
        add_y += 'D'
        first_y += 1
    return add_y


if sx < tx and sy < ty:
    answer += plus_y_arrange(sy, ty)
    answer += plus_x_arrange(sx, tx)
    answer += minus_y_arrange(sy, ty)
    answer += minus_x_arrange(sx, tx)
    answer += 'L'
    answer += plus_y_arrange(sy, ty)
    answer += 'U'
    answer += 'R'
    answer += plus_x_arrange(sx, tx)
    answer += 'D'
    answer += 'R'
    answer += minus_y_arrange(sy, ty)
    answer += 'D'
    answer += 'L'
    answer += minus_x_arrange(sx, tx)
    answer += 'U'

elif sx < tx and sy == ty:
    answer += plus_x_arrange(sx, tx)
    answer += 'D'
    answer += minus_x_arrange(sx, tx)
    answer += 'U'
    answer += 'U'
    answer += plus_x_arrange(sx, tx)
    answer += 'D'
    answer += 'R'
    answer += 'D'
    answer += 'D'
    answer += 'L'
    answer += minus_x_arrange(sx, tx)
    answer += 'L'
    answer += 'U'
    answer += 'U'
    answer += 'R'

elif sx < tx and sy > ty:
    answer += plus_x_arrange(sx, tx)
    answer += minus_y_arrange(sy, ty)
    answer += minus_x_arrange(sx, tx)
    answer += plus_y_arrange(sy, ty)
    answer += 'U'
    answer += plus_x_arrange(sx, tx)
    answer += 'R'
    answer += 'D'
    answer += minus_y_arrange(sy, ty)
    answer += 'L'
    answer += 'D'
    answer += minus_x_arrange(sx, tx)
    answer += 'L'
    answer += 'U'
    answer += plus_y_arrange(sy, ty)
    answer += 'R'

elif sx == tx and sy > ty:
    answer += minus_y_arrange(sx, tx)
    answer += 'R'
    answer += plus_y_arrange(sx, tx)
    answer += 'L'
    answer += 'L'
    answer += minus_y_arrange(sx, tx)
    answer += 'R'
    answer += 'D'
    answer += 'R'
    answer += 'R'
    answer += 'U'
    answer += plus_y_arrange(sx, tx)
    answer += 'U'
    answer += 'L'
    answer += 'L'
    answer += 'D'

elif sx > tx and sy > ty:
    answer += minus_x_arrange(sx, tx)
    answer += minus_y_arrange(sy, ty)
    answer += plus_x_arrange(sx, tx)
    answer += plus_y_arrange(sy, ty)
    answer += 'U'
    answer += minus_x_arrange(sx, tx)
    answer += 'L'
    answer += 'D'
    answer += minus_y_arrange(sy, ty)
    answer += 'R'
    answer += 'D'
    answer += plus_x_arrange(sx, tx)
    answer += 'R'
    answer += 'U'
    answer += plus_y_arrange(sy, ty)
    answer += 'L'

elif sx > tx and sy == ty:
    answer += minus_x_arrange(sx, tx)
    answer += 'U'
    answer += plus_x_arrange(sx, tx)
    answer += 'D'
    answer += 'D'
    answer += minus_x_arrange(sx, tx)
    answer += 'U'
    answer += 'L'
    answer += 'U'
    answer += 'U'
    answer += 'R'
    answer += plus_x_arrange(sx, tx)
    answer += 'R'
    answer += 'D'
    answer += 'D'
    answer += 'L'
    
elif sx > tx and sy < ty:
    answer += minus_x_arrange(sx, tx)
    answer += plus_y_arrange(sy, ty)
    answer += plus_x_arrange(sx, tx)
    answer += minus_y_arrange(sy, ty)
    answer += 'D'
    answer += minus_x_arrange(sx, tx)
    answer += 'L'
    answer += 'U'
    answer += plus_y_arrange(sy, ty)
    answer += 'R'
    answer += 'U'
    answer += plus_x_arrange(sx, tx)
    answer += 'R'
    answer += 'D'
    answer += minus_y_arrange(sy, ty)
    answer += 'L'

else:
    answer += plus_y_arrange(sx, tx)
    answer += 'R'
    answer += minus_y_arrange(sx, tx)
    answer += 'L'
    answer += 'L'
    answer += plus_y_arrange(sx, tx)
    answer += 'R'
    answer += 'U'
    answer += 'R'
    answer += 'R'
    answer += 'D'
    answer += minus_y_arrange(sx, tx)
    answer += 'D'
    answer += 'L'
    answer += 'L'
    answer += 'U'

print(answer)

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

path1 = 'R' * dx + 'U' * dy
path2 = 'L' * dx + 'D' * dy
path3 = 'D' + 'R' * (dx + 1) + 'U' * (dy + 1) + 'L'
path4 = 'U' + 'L' * (dx + 1) + 'D' * (dy + 1) + 'R'

answer = path1 + path2 + path3 + path4
print(answer)

Solution (Python):
sx, sy, tx, ty = map(int,input().split())
a1 = "U"*(ty-sy)+"R"*(tx-sx)
a2 = "D"*(ty-sy)+"L"*(tx-sx)
a3 = "L"+"U"*(ty-sy+1)+"R"*(tx-sx+1)+"D"
a4 = "R"+"D"*(ty-sy+1)+"L"*(tx-sx+1)+"U"
print(a1+a2+a3+a4)

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

Solution (Python):

import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf')
ans = "" ;count = 0 ;pro = 1

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

ans+="R"*(c-a)+"U"*(d-b)
ans+="L"*(c-a)+"D"*(d-b)

ans+="D"+"R"*(c-a+1)+"U"*(d-b+1)+"L"
ans+="U"+"L"*(c-a+1)+"D"*(d-b+1)+"R"


print(ans)

Solution (Python):
def solve():
    SX, SY, TX, TY = map(int, input().split())
    

    
    
    
    
    
    
    
    
    
    
    
    

    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 - (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)

Solution (Python):
x1,y1,x2,y2 =map(int,input().split())
def_x=x2-x1
def_y=y2-y1

print("U"*def_y+"R"*def_x+"D"*def_y+"L"*def_x+
      "L"+
      "U"*(def_y+1)+"R"*(def_x+1)+
      "D"+"R"+
      "D"*(def_y+1)+"L"*(def_x+1)+"U")

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

print(ans)

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

Solution (Python):
def c_back_and_forth():
    sx, sy, tx, ty = [int(i) for i in input().split()]
    
    ans = ''
    
    ans += 'U' * abs(ty - sy) + 'R' * abs(tx - sx)
    
    ans += 'D' * abs(ty - sy) + 'L' * abs(tx - sx)
    
    ans += ('L' + 'U' * (abs(ty - sy) + 1)
            + 'R' * (abs(tx - sx) + 1) + 'D')
    
    ans += ('R' + 'D' * (abs(ty - sy) + 1)
            + 'L' * (abs(tx - sx) + 1) + 'U')
    return ans

print(c_back_and_forth())

Solution (Python):
import sys

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

def main():
    dx = tx - sx + 1
    dy = ty - sy + 1
    u, r, d, l = list('URDL')
    
    res = ''
    res += u * (dy - 1)
    res += r * dx
    res += d * dy
    res += l * dx
    res += u + l
    res += u * dy
    res += r * dx
    res += d * dy
    res += l * (dx - 1)
    return res

if __name__ == '__main__':
    ans = main()
    print(ans)

Solution (Python):
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
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
ans += flag + key_2.replace("L","x").replace("R","L").replace("x","R").replace("D","y").replace("U","D").replace("y","U")
print(ans)

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

Solution (Python):
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+1)
ans += 'U'*(yl+1)
ans += 'R'*(xl+1)
ans += 'DR'
ans += 'D'*(yl+1)
ans += 'L'*(xl+1)
ans += 'U'

print(ans)

Solution (Python):
import sys
sys.setrecursionlimit(10**6)
if sys.platform in (['ios','darwin','win32']):
	sys.stdin=open('Untitled.txt')
input = sys.stdin.readline
def INT(): return int(input())
def MAP(): return [int(s) for s in input().split()]

sx, sy, tx, ty = MAP()

ans = []
for i in range(2):
	dx, dy = tx-sx, ty-sy
	if i==1: ans.append("L")
	ans.extend(["U"]*(dy+i)+["R"]*(dx+i))
	if i==1: ans.extend(["D","R"])
	ans.extend(["D"]*(dy+i)+["L"]*(dx+i))
	if i==1: ans.append("U")
	

print(''.join(ans))

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

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

Solution (Python):
import sys
input = sys.stdin.readline
sx, sy, tx, ty = map(int, input().split())
f = []
s = []
r = 0
u = 0
for i in range(abs(tx - sx)):
  if sx < tx:
    f.append("R")
    r = 1
  else: f.append("L")
for i in range(abs(ty - sy)):
  if sy < ty:
    f.append("U")
    u = 1
  else: f.append("D")
if u:
  s.append("D")
else:
  s.append("U")
for i in range(abs(tx - sx) + 1):
  if sx < tx:
    s.append("R")
  else: s.append("L")
for i in range(abs(ty - sy) + 1):
  if sy < ty:
    s.append("U")
  else: s.append("D")
if r:
  s.append("L")
else: s.append("R")
f2 = []
s2 = []
for x in f:
  if x == "U": f2.append("D")
  elif x == "D": f2.append("U")
  elif x == "R": f2.append("L")
  else: f2.append("R")
for x in s:
  if x == "U": s2.append("D")
  elif x == "D": s2.append("U")
  elif x == "R": s2.append("L")
  else: s2.append("R")
print("".join(f + f2 + s + s2))

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

a = tx - sx
b = ty - sy

ans = str()


ans += 'R' * a
ans += 'U' * b
ans += 'L' * a
ans += 'D' * b

ans += 'D'
ans += 'R' * (a+1)
ans += 'U' * (b+1)
ans += 'L' 

ans += 'U'
ans += 'L' * (a+1)
ans += 'D' * (b+1)
ans += 'R'

print(ans)

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

dx = tx - sx
dy = ty - sy

ans = ""

ans += "R" * dx + "U" * dy 


ans += "L" * dx + "D" * dy


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


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

print(ans)

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

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


print(ans)

Solution (Python):
[sx, sy, tx, ty]=list(map(int,input().split()))
a1=["R"]*(tx-sx)+["U"]*(ty-sy)+["L"]*(tx-sx)+["D"]*(ty-sy)
a2=["D"]+["R"]*(tx-sx+1)+["U"]*(ty-sy+1)+["L"]+["U"]+["L"]*(tx-sx+1)+["D"]*(ty-sy+1)+["R"]
ans=a1+a2
for i in range(len(ans)):
	print(ans[i],end="")

Solution (Python):
import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    sx, sy, tx, ty = list(map(int, readline().split()))
    ans = []
    for j in range(2):
        if j != 0:
            ans.append("D" if tx - sx >= 0 else "U")
            ans.append("R" if tx - sx >= 0 else "L")

        for i in range(abs(tx - sx)):
            ans.append("R" if tx - sx >= 0 else "L")
        for i in range(abs(ty - sy)):
            ans.append("U" if tx - sx >= 0 else "D")

        if j != 0:
            ans.append("U" if tx - sx >= 0 else "D")
            ans.append("L" if tx - sx >= 0 else "R")
            ans.append("U" if tx - sx >= 0 else "D")
            ans.append("L" if tx - sx >= 0 else "R")

        for i in range(abs(tx - sx)):
            ans.append("L" if tx - sx >= 0 else "R")
        for i in range(abs(ty - sy)):
            ans.append("D" if tx - sx >= 0 else "U")

        if j != 0:
            ans.append("D" if tx - sx >= 0 else "U")
            ans.append("R" if tx - sx >= 0 else "L")
    print("".join(ans))


if __name__ == '__main__':
    solve()

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

dx = tx - sx
dy = ty - sy

def _dflip(c):
    return {
        'U': 'R',
        'R': 'U',
        'D': 'L',
        'L': 'D',
    }[c]

def dflip(s):
    return ''.join(map(_dflip, s))

def g(dx, dy):
    return 'R' * dx + 'U' * (dy+1) + 'L' * (dx+1) + 'D' * (dy+1) + 'R'

def f(dx, dy):
    if dx > 0 and dy > 0:
        return g(dx, dy) + dflip(g(dy, dx))
    if dy == 0:
        return 'R' * dx + 'U' + 'L' * dx + 'DD' + 'R' * (dx) + 'URUU' + 'L' * (dx+2) + 'DDR'
    if dx == 0:
        return dflip(f(dy, dx))

print(f(dx, dy))

Solution (Python):
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

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")

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

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

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

Solution (Python):
sx , sy ,tx ,ty = map(int,input().split())
for _ in range(ty - sy):
    print("U",end = "")
for _ in range(tx - sx):
    print("R",end = "")
for _ in range(ty - sy):
    print("D",end = "")
for _ in range(tx - sx):
    print("L",end = "")

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

Solution (Python):
import sys
sx, sy, tx, ty = [int(i) for i in sys.stdin.readline().split()]
diff_y = abs(ty - sy)
diff_x = abs(tx - sx)
res = "L"
res += (diff_y + 1) * "U"
res += (diff_x + 1) * "R"
res += "D"
res += (diff_x) * "L"
res += (diff_y + 1) * "D"
res += (diff_x + 1) * "R"
res += (diff_y + 1) * "U"
res += "L"
res += (diff_y) * "D"
res += diff_x * "L"
print(res)

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

Solution (Python):

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

ans = ""

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

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

print(ans)

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

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

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

print(ans)

Solution (Python):
if __name__ == '__main__':
    sx,sy,tx,ty=list(map(int,input().split()))
    dif_x=tx-sx
    dif_y=ty-sy
    path=[]

    path.append("R"*abs(dif_x))
    path.append("U"*abs(dif_y))
    path.append("L"*abs(dif_x))
    path.append("D"*abs(dif_y))
    path.append("D")
    path.append("R" * (abs(dif_x) + 1))
    path.append("U" * (abs(dif_y) + 1))
    path.append("L")
    path.append("U")
    path.append("L" * (abs(dif_x) + 1))
    path.append("D" * (abs(dif_y) + 1))
    path.append("R")
    print("".join(path))

Solution (Python):

x1, y1, x2, y2 = map(int,input().split())
s = ''
a1 = 'R' * (x2 - x1)
b1 = 'U' * (y2 - y1)
a2 = 'L' * (x2 - x1)
b2 = 'D' * (y2 - y1)
a3 = 'D' + 'R' * (x2 - x1 + 1)
b3 = 'U' * (y2 - y1 + 1) + 'L'
a4 = 'U' + 'L' * (x2 - x1 + 1)
b4 = 'D' * (y2 - y1 + 1) + 'R'
s = a1 + b1 + a2 + b2 + a3 + b3 + a4 + b4
print(s)

Solution (Python):
def rotate(s,deg):
    if deg==180:
        return s.translate(str.maketrans({'U': 'D', 'D': 'U', 'L':'R', 'R':'L'}))
    elif deg==90:
        return s.translate(str.maketrans({'U': 'L', 'D': 'R', 'L':'D', 'R':'U'}))
    elif deg==-90:
        return s.translate(str.maketrans({'U': 'R', 'D': 'L', 'L':'U', 'R':'D'}))
def mirror(s,direc):
    if direc=="x":
        return s.translate(str.maketrans({'L':'R', 'R':'L'})) 
    elif direc=="y":
        return s.translate(str.maketrans({'U': 'D', 'D': 'U'}))
def solver1(x,y):
    go="R"*x+"U"*y
    back=rotate(go,180)
    go2="DR"+go+"UL"
    back2="UL"+back+"DR"
    return go+back+go2+back2

a,b,c,d=map(int,input().split())
xf=c-a
yf=d-b
x=abs(c-a)
y=abs(d-b)
print(solver1(x,y))

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

Solution (Python):
import sys
from collections import defaultdict, Counter, deque
from itertools import accumulate, permutations, combinations
from operator import itemgetter
from bisect import bisect_left, bisect_right, bisect
from heapq import heappop, heappush
from fractions import gcd
from math import ceil, floor, sqrt, cos, sin, pi
from copy import deepcopy




def main():
    sx,sy,tx,ty = map(int, input().split())
    dx = ("R","L") if sx <= tx else ("L","R")
    dy = ("U","D") if sy <= ty else ("D","U")
    lx = abs(sx-tx)
    ly = abs(sy-ty)

    ans = ""
    for i in range(2):
        ans += dy[i]*ly
        ans += dx[i]*lx
   
    for i in range(2):
        inv = (i+1)%2
        ans += dx[inv]
        ans += dy[i]*(ly+1)
        ans += dx[i]*(lx+1)
        ans += dy[inv]

    print(ans)
    
    
if __name__ == '__main__':
    main()

Solution (Python):
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 += 'D'*diff_y
ans += 'L'*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)

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

x_dis = c - a
y_dis = d - b

for i in range(y_dis):
    print('U', end='')

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

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

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

for i in range(y_dis+1):
    print('U', end='')

for i in range(x_dis+1):
    print('R', end='')

print('D', end='')
print('R', end='')

for i in range(y_dis+1):
    print('D', end='')

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

print('U')

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

res1 = 'R' * x + 'U' * y
res2 = 'L' * x + 'D' * y
res3 = 'D' + 'R' + res1 + 'U' + 'L'
res4 = 'U' + 'L' + res2 + 'D' + 'R'

res = res1 + res2 + res3 + res4

print(res)

Solution (Python):
sx, sy, tx, ty = map(int, input().split())
ans=""
dx=tx-sx
dy=ty-sy
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)

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

w = tx - sx
h = ty - sy

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

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

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

print(ans)

Solution (Python):
from sys import stdin

sx,sy,tx,ty = [int(x) for x in stdin.readline().rstrip().split()]

s = ""

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

print(s)

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

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

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

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

print("".join(ans))

Solution (Python):
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+1)
ans+='R'*1
print(ans)

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

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

res1 = 'R' * x + 'U' * y
res2 = 'L' * x + 'D' * y
res3 = 'D' + 'R' + res1 + 'U' + 'L'
res4 = 'U' + 'L' + res2 + 'D' + 'R'

res = res1 + res2 + res3 + res4

print(res)

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

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