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):
sx,sy,tx,ty = map(int, input().split())
p1 = 'U'*(ty-sy) + 'R'*(tx-sx)
p2 = 'D'*(ty-sy) + 'L'*(tx-sx)
p3 = 'L' + 'U'*(ty-sy+1) + 'R'*(tx-sx+1) + 'D'
p4 = 'R' + 'D'*(ty-sy+1) + 'L'*(tx-sx+1) + 'U'
print(p1+p2+p3+p4)

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

Solution (Python):


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

if sx!=tx and sy!=ty:
    r1="R"*(tx-sx)+"U"*(ty-sy)+"L"*(sx-tx)+"D"*(sy-ty)
    r2="L"*(tx-sx)+"D"*(ty-sy)+"R"*(sx-tx)+"U"*(sy-ty)
    r3=("D" if (ty-sy)>0 else "U")+"R"*(tx-sx+1)+"U"*(ty-sy+1)+"L"*(sx-tx+1)+"D"*(sy-ty+1)+("L" if (tx-sx)>0 else "R")
    r4=("U" if (ty-sy)>0 else "D")+"L"*(tx-sx+1)+"D"*(ty-sy+1)+"R"*(sx-tx+1)+"U"*(sy-ty+1)+("R" if (tx-sx)>0 else "D")

elif sx==tx:
    r1="R"+"U"*(ty-sy)+"D"*(sy-ty)+"L"
    r2="L"+"D"*(ty-sy)+"U"*(sy-ty)+"R"
    r3="U"*(ty-sy)+"D"*(sy-ty)
    r4=("U" if (ty-sy)>0 else "D")+"R"*2+("D"*(ty-sy+2) if (ty-sy)>0 else "U"*(sy-ty+2))+"L"*2+("U" if (ty-sy)>0 else "U")

elif sy==ty:
    r1="D"+"R"*(tx-sx)+"L"*(sx-tx)+"U"
    r2="U"+"L"*(tx-sx)+"R"*(sx-tx)+"D"
    r3="R"*(tx-sx)+"L"*(sx-tx)
    r4=("R" if (tx-sx)>0 else "L")+"D"*2+("L"*(tx-sx+2) if (tx-sx)>0 else "R"*(sx-tx+2))+"U"*2+("R" if (tx-sx)>0 else "L")

print(r1+r2+r3+r4)

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

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

x = tx - sx
y = ty - sy

r = "R" * x
u = "U" * y
l = "L" * x
d = "D" * y

print("".join([r, u, l, d, "D", r, "R", "U", u, "L", "U", l, "L", "D", d, "R"]))

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


for i in range(tx-sx):
    print("R",end="")
for i in range(ty-sy):
    print("U",end="")


for i in range(tx-sx):
    print("L",end="")
for i in range(ty-sy):
    print("D",end="")


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


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

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

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

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

def solve(sx,sy,tx,ty):
  dx=tx-sx
  dy=ty-sy
  return '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(solve(sx,sy,tx,ty))

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

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


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

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

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

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

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
UP = 'U'
DOWN = 'D'
LEFT = 'L'
RIGHT = 'R'

START_CELL = 'S'
TARGET_CELL = 'T'

def main():
    sx, sy, tx, ty = list(map(int, input().split()))
    moves = [
        {'dir': RIGHT, 'dis': tx - sx},
        {'dir': UP, 'dis': ty - sy},

        {'dir': LEFT, 'dis': tx - sx},
        {'dir': DOWN, 'dis': ty - sy},

        {'dir': DOWN, 'dis': 1},
        {'dir': RIGHT, 'dis': tx - sx + 1},
        {'dir': UP, 'dis': ty - sy + 1},
        {'dir': LEFT, 'dis': 1},

        {'dir': UP, 'dis': 1},
        {'dir': LEFT, 'dis': tx - sx + 1},
        {'dir': DOWN, 'dis': ty - sy + 1},
        {'dir': RIGHT, 'dis': 1},
    ]

    for move in moves:
        print(move['dir'] * move['dis'], end='')


main()

Solution (Python):




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

route = ""

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

print(route)

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

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

print(ans)

Solution (Python):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

def main():
    sx, sy, tx, ty = map(int, input().split())
    ans = []

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

    print("".join(ans))


if __name__ == '__main__':
    main()

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

Solution (Python):
import collections
import itertools
import functools
import math

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

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

x = tx - sx
y = ty - sy

ans = 'U'*y + 'R'*x + '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):
def c():
    sx, sy, tx, ty = map(int, input().split())
    dx = tx - sx
    dy = ty - sy

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

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

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

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


if __name__ == '__main__':
    c()

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

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

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):
a,b,c,d=map(int,input().split())
y=c-a
x=d-b

if(x>0):
  for i in range(x):
    print("U",end="")
else:
  for i in range(-x):
    print("D",end="")
if(y>0):
  for i in range(y):
    print("R",end="")
else:
  for i in range(-y):
    print("L",end="")
    

if(x>0):
  for i in range(x):
    print("D",end="")
else:
  for i in range(-x):
    print("U",end="")
if(y>0):
  for i in range(y):
    print("L",end="")
else:
  for i in range(-y):
    print("R",end="")
    

if(x>0):
  if(y>0):
    print("L",end="")
  else:
    print("R",end="")
  for i in range(x+1):
    print("U",end="")
else:
  if(y>0):
    print("L",end="")
  else:
    print("R",end="")
  for i in range(-x+1):
    print("D",end="")
    
if(y>0):
  for i in range(y+1):
    print("R",end="")
  if(x>0):
    print("D",end="")
  else:
    print("U",end="")
else:
  for i in range(-y+1):
    print("L",end="")
  if(x>0):
    print("D",end="")
  else:
    print("U",end="")
    

if(x>0):
  if(y>0):
    print("R",end="")
  else:
    print("L",end="")
  for i in range(x+1):
    print("D",end="")
else:
  if(y>0):
    print("R",end="")
  else:
    print("L",end="")
  for i in range(-x+1):
    print("U",end="")
if(y>0):
  for i in range(y+1):
    print("L",end="")
  if(x>0):
    print("U",end="")
  else:
    print("D",end="")
else:
  for i in range(-y+1):
    print("R",end="")
  if(x>0):
    print("U",end="")
  else:
    print("D",end="")

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

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

Solution (Python):
import sys

stdin = sys.stdin

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

def main():
  sx, sy, tx, ty = na()

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

main()

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

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):
sx, sy, tx, ty = map(int, input().split())
xtmp = abs(sx - tx)
ytmp = abs(sy - ty)
ans = 'U' * ytmp
ans += 'R' * xtmp
tmp1 = ans
tmp1 = tmp1.replace('R', 'L')
tmp1 = tmp1.replace('U', 'D')
tmp2 = 'LU' + ans + 'RD'
tmp3 = 'RD' + tmp1 + 'LU'
print(ans + tmp1 + tmp2 + tmp3)

Solution (Python):
xs, ys, xt, yt = map(int, input().split())


for _ in range(xs, xt):
    print('R', end='')
for _ in range(ys, yt):
    print('U', end='')


for _ in range(xt, xs, -1):
    print('L', end='')
for _ in range(yt, ys, -1):
    print('D', end='')


print('D', end='')
for _ in range(xs, xt+1):
    print('R', end='')
for _ in range(ys-1, yt):
    print('U', end='')
print('L', end='')


print('U', end='')
for _ in range(xt, xs-1, -1):
    print('L', end='')
for _ in range(yt+1, ys, -1):
    print('D', end='')
print('R', end='')

print('')

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

dif_x = tx - sx
dif_y = ty - sy

ans = 'U' * dif_y + 'R' * dif_x + 'D' * dif_y + 'L' * (dif_x + 1)\
     + 'U' * (dif_y + 1) + 'R' * (dif_x + 1) + 'D' + 'R' + 'D' * (dif_y + 1) + 'L' * (dif_x + 1) + 'U'

print(ans)

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

s =''

distx = tx - sx 
disty = ty - sy 

act = ['U','D','L','R']


s += act[3]*distx + act[0]*disty


s += act[2]*distx + act[1]*disty


s += act[1] + act[3]*(distx + 1) + act[0]*(disty+1)+act[2]


s += act[0] + act[2]*(distx + 1) + act[1]*(disty+1)+act[3]

print(s)

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

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

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

ans=''
ans+=''.join(['U']*(d-b))
ans+=''.join(['R']*(c-a))
ans+=''.join(['D']*(d-b))
ans+=''.join(['L']*(c-a+1))
ans+=''.join(['U']*(d-b+1))
ans+=''.join(['R']*(c-a+1))
ans+='DR'
ans+=''.join(['D']*(d-b+1))
ans+=''.join(['L']*(c-a+1))
ans+='U'
print(ans)

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

ans = ""

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

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

result += "U" * abs(ty - sy)
result += "R" * abs(tx - sx)

result += "D" * abs(sy - ty)
result += "L" * abs(sx - tx)

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

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

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

x_dif = tx - sx
y_dif = ty - sy

first_loop = ('U' * y_dif) + ('R' * x_dif) + 'D' * y_dif + 'L' * x_dif

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

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

route1 = 'U' * y + 'R' * x
route2 = 'D' * y + 'L' * x
route3 = 'L' + 'U' * (y + 1) + 'R' * (x + 1) + 'D'
route4 = 'R' + 'D' * (y + 1) + 'L' * (x + 1) + 'U'

print(route1 + route2 + route3 + route4)

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

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

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'
ans = r1 + r2 + r3 + r4
print(ans)

Solution (Python):
import sys
input=sys.stdin.readline
sx,sy,tx,ty=map(int,input().split())
x=tx-sx
y=ty-sy
for i in range(y):
    print('U',end='')
for i in range(x):
    print('R',end='')
for i in range(y):
    print('D',end='')
for i in range(x):
    print('L',end='')
print('L',end='')
for i in range(y+1):
    print('U',end='')
for i in range(x+1):
    print('R',end='')
print('D',end='')
print('R',end='')
for i in range(y+1):
    print('D',end='')
for i in range(x+1):
    print('L',end='')
print('U')

Solution (Python):

sx,sy,tx,ty=map(int,input().split( ))
x=tx-sx
y=ty-sy
r1="U"*y+"R"*x
r2="R"+"D"*2+"L"*(x-1)+"D"*(y-1)+"L"*2+"U"
r3="R"+"U"*(y-1)+"R"*(x-1)+"U"
r4="U"+"L"*(x+1)+"D"*(y+1)+"R"
print(r1+r2+r3+r4)

Solution (Python):

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


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

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

print(ans)

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

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

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

tx-=sx
ty-=sy

ans=""

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

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

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

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

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

print(ans)

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

r1=["R"]*(tx-sx)

r1.append("U"*(ty-sy))

r1.append("L"*(tx - sx))

r1.append("D"*(ty - sy))

r1.append("D")

r1.append("R"*(tx-sx+1))

r1.append("U"*(ty-sy+1))

r1.append("LU")

r1.append("L"*(tx-sx+1))

r1.append("D"*(ty-sy+1))

r1.append("R")

print("".join(r1))

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

r1=["R"]

for i in range(tx-sx-1):
    r1.append("R")

for i in range(ty-sy):
    r1.append("U")

for i in range(tx - sx):
    r1.append("L")

for i in range(ty - sy):
    r1.append("D")

r1.append("D")

for i in range(tx-sx+1):
    r1.append("R")

for i in range(ty-sy+1):
    r1.append("U")

r1.append("LU")

for i in range(tx-sx+1):
    r1.append("L")

for i in range(ty-sy+1):
    r1.append("D")

r1.append("R")

print("".join(r1))

Solution (Python):
x0, y0, x1, y1 = map(int, input().split())
res = 'U' * (y1 - y0) + 'R' * (x1 - x0) + 'D' * (y1 - y0) + 'L' * (
    x1 - x0) + 'L' + 'U' * (y1 - y0 + 1) + 'R' * (
        x1 - x0 + 1) + 'D' + 'R' + 'D' * (y1 - y0 + 1) + 'L' * (x1 - x0 +
                                                                1) + 'U'
print(res)

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

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

x = tx - sx
y = ty - sy
ans = []
ans.append("U" * y)
ans.append("R" * x)
ans.append("D" * y)
ans.append("L" * (x + 1))
ans.append("U" * (y + 1))
ans.append("R" * (x + 1))
ans.append("D")
ans.append("R")
ans.append("D" * (y + 1))
ans.append("L" * (x + 1))
ans.append("U")
print("".join(ans))

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

result=deque()
A=B=C=D=0


for _ in range(sx,tx):
  result.append("R")
  A+=1


if sy!=ty:
  for _ in range(sy,ty):
    result.append("U")
    B+=1






result.append("L")
for _ in range(B-1):
  result.append("D")
  C+=1


for _ in range(A-1):
  result.append("L")
  D+=1


result.append("D")


result.append("D")
for _ in range(A+1):
  result.append("R")


for _ in range(B+1):
  result.append("U")


result.append("L")
result.append("U")


result.append("L")
result.append("L")
for _ in range(C):
  result.append("D")


for _ in range(D):
  result.append("L")


result.append("D")
result.append("D")
result.append("R")

print(*result,sep="")

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

invert = lambda T:(''.join(map(lambda x:dict([('R','L'),('L','R'),('U','D'),('D','U')])[x],list(T))))[::-1]
dist = lambda a,b:abs(a-b)
O = ""

O +=        "L" +  "U"*dist(sy  ,ty+1) + "R"*dist(sx-1,tx  )        + "D"
O += invert("U" +  "U"*dist(sy+1,ty  ) + "R"*dist(sx  ,tx-1)        + "R")
O +=        "R" + ("U"*dist(sy  ,ty-1) + "R"*dist(sx+1,tx  ))[::-1] + "U"
O += invert("D" + ("U"*dist(sy-1,ty  ) + "R"*dist(sx  ,tx+1))[::-1] + "L")

print(O)

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

def invert(T):
    d = dict([('R','L'),('L','R'),('U','D'),('D','U')])
    return (''.join(map(lambda x:d[x],list(T))))[::-1]

dist = lambda a,b:abs(a-b)
O = ""

O +=        "L" +  "U"*dist(sy  ,ty+1) + "R"*dist(sx-1,tx  )        + "D"
O += invert("U" +  "U"*dist(sy+1,ty  ) + "R"*dist(sx  ,tx-1)        + "R")
O +=        "R" + ("U"*dist(sy  ,ty-1) + "R"*dist(sx+1,tx  ))[::-1] + "U"
O += invert("D" + ("U"*dist(sy-1,ty  ) + "R"*dist(sx  ,tx+1))[::-1] + "L")

print(O)

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 \
      + "D" + "R" * (x + 1) + "U" * (y + 1) + "L" \
      + "U" + "L" * (x + 1) + "D" * (y + 1) + "R"

print(ans)

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


a = tx - sx
b = ty - sy

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

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




print("R" * W + "U" * H  + "L" * W + "D" * H + 
      "D" + "R" * (W + 1) + "U" * (H + 1)  + "L" +
      "U" + "L" * (W + 1) + "D" * (H + 1)  + "R")

Solution (Python):
a=list(map(int, input().split()));x,y=a[2]-a[0],a[3]-a[1];r,u=x<0,y<0;x,y=abs(x),abs(y);v,h=["U","D"],["R","L"];print(v[u]*y+h[r]*x+v[u^1]*y+h[r^1]*(x+1)+v[u]*(y+1)+h[r]*(x+1)+v[u^1]+h[r]+v[u^1]*(y+1)+h[r^1]*(x+1)+v[u])

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

Solution (Python):
sx,sy,X,Y = map(int,input().split())

ans = ""
ans += "U"*(Y-sy)
ans += "R"*(X-sx)
ans += "D"*(Y-sy)
ans += "L"*(X-sx)

ans += "L"+"U"*(Y-sy+1)
ans += "R"*(X-sx+1)+"D"
ans += "R" + "D"*(Y-sy+1)
ans += "L"*(X-sx+1)+"U"

print(ans)

Solution (Python):
sx,sy,tx,ty=map(int, input().split())
    
UD_dic={"U":ty-sy, "D":-(ty-sy)}
RL_dic={"R":tx-sx, "L":-(tx-sx)}

ans=""

ans+=max(UD_dic)*max(UD_dic.values())+max(RL_dic)*max(RL_dic.values())
ans+=min(UD_dic)*abs(min(UD_dic.values()))+min(RL_dic)*abs(min(RL_dic.values()))

ans+=min(RL_dic)+max(UD_dic)*(max(UD_dic.values())+1)+max(RL_dic)*(max(RL_dic.values())+1)+min(UD_dic)
ans+=max(RL_dic)+min(UD_dic)*abs(min(UD_dic.values())-1)+min(RL_dic)*abs(min(RL_dic.values())-1)+max(UD_dic)

print(ans)

Solution (Python):
from collections import Counter,defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

sx,sy,tx,ty = inpl()
ans = ''
ans += 'U' * (ty-sy) + 'R' * (tx-sx)
ans += '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):
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    sx,sy,tx,ty=map(int,input().split())
    x,y=tx-sx,ty-sy
    ans=''
    
    ans=ans+'R'*x+'U'*y+'L'*x+'D'*y
    
    ans=ans+'D'+'R'*(x+1)+'U'*(y+1)+'L'+'U'+'L'*(x+1)+'D'*(y+1)+'R'
    print(ans)
resolve()

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

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

Solution (Python):

import sys
input = sys.stdin.readline
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7



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

dy = ty-sy
dx = tx-sx

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

print(ans)

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

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

cx = gx - sx
cy = gy - sy

dx = abs(gx - sx)
dy = abs(gy - sy)

if cx >= 0 and cy >= 0:
  ans = 'U'*dy+'R'*dx+'D'*dy+'L'*dx
  ans += 'LU'+'U'*dy+'R'*dx+'RD'
  ans += 'RD'+'D'*dy+'L'*dx+'LU'
elif cx < 0 and cy >= 0:
  ans = 'U'*dy+'L'*dx+'D'*dy+'R'*dx
  ans += 'RU'+'U'*dy+'L'*dx+'LD'
  ans += 'LD'+'D'*dy+'R'*dx+'RU'
elif cx >= 0 and cy < 0:
  ans = 'D'*dy+'R'*dx+'U'*dy+'L'*dx
  ans += 'LD'+'D'*dy+'R'*dx+'RU'
  ans += 'RU'+'U'*dy+'L'*dx+'LD'
else:
  ans = 'D'*dy+'L'*dx+'U'*dy+'R'*dx
  ans += 'RD'+'D'*dy+'L'*dx+'LU'
  ans += 'LU'+'U'*dy+'R'*dx+'RD'
print(ans)

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

cx = gx - sx
cy = gy - sy

dx = abs(gx - sx)
dy = abs(gy - sy)

if cx >= 0 and cy >= 0:
  ans = 'U'*dy+'R'*dx+'D'*dy+'L'*dx
  ans += 'LU'+'U'*dy+'R'*dx+'RD'
  ans += 'RD'+'D'*dy+'L'*dx+'LU'
elif cx < 0 and cy >= 0:
  ans = 'U'*dy+'L'*dx+'D'*dy+'R'*dx
  ans += 'RU'+'U'*dy+'L'*dx+'LD'
  ans += 'LD'+'D'*dy+'R'*dx+'RU'
elif cx >= 0 and cy < 0:
  ans = 'D'*dy+'R'*dx+'U'*dy+'L'*dx
  ans += 'LD'+'D'*dy+'R'*dx+'RU'
  ans += 'RU'+'U'*dy+'L'*dx+'LD'
else:
  ans = 'D'*dy+'L'*dx+'U'*dy+'R'*dx
  ans += 'RD'+'D'*dy+'L'*dx+'LU'
  ans += 'LU'+'U'*dy+'R'*dx+'RD'
print(ans)

Solution (Python):
x, y, X, Y = map(int, input().split())
ans = ''
kyori_x = X - x
kyori_y = Y - y
ans += 'R' * kyori_x + 'U' * kyori_y
ans += 'L' * kyori_x + 'D' * kyori_y
ans += 'L' + 'U' * (kyori_y + 1) + 'R' * (kyori_x + 1) + 'D'
ans += 'R' + 'D' * (kyori_y + 1) + 'L' * (kyori_x + 1) + 'U'
print(ans)

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

print(D+R*XX+U*YY+L*XX+D*Y+R*X+U*YY+L*XX+D*YY+R)

Solution (Python):
sx, sy, tx, ty = map(int, input().split())
x = tx - sx
y = ty - sy
print("".join(["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())
s = ""
s += 'U' * (ty-sy) + 'R' * (tx-sx)
s += 'D' * (ty-sy) + 'L' * (tx-sx)
s += 'L' + 'U' * (ty-sy+1) + 'R' * (tx-sx+1) + 'D'
s += 'R' + 'D' * (ty-sy+1) + 'L' * (tx-sx+1) + 'U'
  
print(s)

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

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

x = gx-sx
y = gy-sy

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

print(ans)

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

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
ans += "DR" + "R" * dx + "U" * dy + "UL" + "UL" + "L" * dx + "D" * dy + "DR"
print(ans)

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

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

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

def p(s, num):
    print(s*num, end="")

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

    w, h = tx-sx, ty-sy

    p("R", w)
    p("U", h)
    p("L", w)
    p("D", h+1)
    p("R", w+1)
    p("U", h+1)
    p("L", 1)
    p("U", 1)
    p("L", w+1)
    p("D", h+1)
    p("R", 1)
    print()

if __name__ == "__main__":
    main()

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

Solution (Python):
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from functools import reduce




INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007


sx, sy, tx, ty = LI()

way1 = 'R' * (tx - sx) + 'U' * (ty - sy)
way2 = 'L' * (tx - sx) + 'D' * (ty - sy)
way3 = 'D' + 'R' * (tx - sx + 1) + 'U' * (ty - sy + 1) + 'L'
way4 = 'U' + 'L' * (tx - sx + 1) + 'D' * (ty - sy + 1) + 'R'


print(way1 + way2 + way3 + way4)

Solution (Python):
data = [int(i) for i in input().split()]

x = data[2] - data[0] 
y = data[3] - data[1]

print("R"*x+"U"*y+"L"*x+"D"*y+"DR"+"R"*x+"U"*y+"ULUL"+"L"*x+"D"*y+"DR")

Solution (Python):
data = [int(i) for i in input().split()]

x = data[2] - data[0] 
y = data[3] - data[1]

print("R"*x+"U"*y+"L"*x+"D"*y+"DR"+"R"*x+"U"*y+"ULUL"+"L"*x+"D"*y+"DR")