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())
s = ""

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

Solution (Python):
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate
import sys
import bisect
import string
import math
import time


def I(): return int(input())


def MI(): return map(int, input().split())


def S(): return input()


def MS(): return map(str, input().split())


def LI(): return [int(i) for i in input().split()]


def LI_(): return [int(i)-1 for i in input().split()]


def StoI(): return [ord(i)-97 for i in input()]


def ItoS(nn): return chr(nn+97)


def input(): return sys.stdin.readline().rstrip()


def show(*inp, end='\n'):
    if show_flg:
        print(*inp, end=end)


YN = {False: 'No', True: 'Yes'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**10
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()

nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']


show_flg = True
show_flg = False



def main():
    sx, sy, tx, ty = MI()
    out = []
    
    out.append('U' * (ty - sy))
    out.append('R' * (tx - sx))
    out.append('D' * (ty - sy))
    out.append('L' * (tx - sx))
    
    out.append('L')
    out.append('U' * ((ty - sy) + 1))
    out.append('R' * ((tx - sx) + 1))
    out.append('D')
    out.append('R')
    out.append('D' * ((ty - sy) + 1))
    out.append('L' * ((tx - sx) + 1))
    out.append('U')

    print(''.join(out))


if __name__ == '__main__':
    main()

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

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

first_U_times = ty - sy
for _ in range(first_U_times):
    ans.append('U')
first_R_times = tx - sx
for _ in range(first_R_times):
    ans.append('R')
for _ in range(first_U_times):
    ans.append('D')
for _ in range(first_R_times):
    ans.append('L')

ans.append('L')
for _ in range(first_U_times+1):
    ans.append('U')
for _ in range(first_R_times+1):
    ans.append('R')
ans.append('D')

ans.append('R')
for _ in range(first_U_times+1):
    ans.append('D')
for _ in range(first_R_times+1):
    ans.append('L')
ans.append('U')

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

Solution (Python):
import sys

input = sys.stdin.readline


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

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


if __name__ == "__main__":
    main()

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

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

x=x2-x1
y=y2-y1

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

Solution (Python):

ln = list(map(int, input().split(' ')))
disX = ln[2] - ln[0]
disY = ln[3] - ln[1]
output=''
u='U'
d='D'
r='R'
l='L'

for i in range(disY):
    output+= u
for i in range(disX):
    output+= r
for i in range(disY):
    output+= d
for i in range(disX):
    output+= l

output+= l+u
for i in range(disY):
    output+= u
for i in range(disX):
    output+= r
output+= r+d +r+d
for i in range(disY):
    output+= d
for i in range(disX):
    output+= l
output+= l+u
print(output)

Solution (Python):

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

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

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

Solution (Python):
sX,sY,tX,tY = list(map(int,input().split()))
ans = ""
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

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):
import sys
readline = sys.stdin.readline

def main():
    sx, sy, tx, ty = map(int, readline().rstrip().split())
    r1 = 'U' * (ty-sy) + 'R' * (tx-sx)
    r2 = 'D' * (ty-sy) + 'L' * (tx-sx)
    r3 = 'L' + 'U' * (ty-sy+1) + 'R' * (tx-sx+1) + 'D'
    r4 = 'R' + 'D' * (ty-sy+1) + 'L' * (tx-sx+1) + 'U'
    print(r1 + r2 + r3 + r4)

if __name__ == '__main__':
    main()

Solution (Python):
sx, sy, tx, ty = map(int, input().split())
distance_x, distance_y = tx-sx, ty-sy
x_now, y_now = sx, sy
up, down, right, left = 'U', 'D', 'R', 'L'


print(up*distance_y+""+right*distance_x,end="")

print(down*distance_y+""+left*distance_x,end="")

print("L"+""+up*(distance_y+1)+""+right*(distance_x+1)+""+"D",end="")

print("R"+""+down*(distance_y+1)+""+left*(distance_x+1)+""+"U")

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

if sx < tx:
    flag1 = -1
else:
    flag1 = 1

if sy < ty:
    flag2 = 1
else:
    flag2 = -1

def print_root(x1, y1, x2, y2):

    if y1 < y2:
        print("U" * (y2 - y1), end = "")
    else:
        print("D" * (y1 - y2), end = "")

    if x1 < x2:
        print("R" * (x2 - x1), end = "")
    else:
        print("L" * (x1 - x2), end = "")
    
print_root(sx, sy, tx, ty)
print_root(tx, ty, sx, sy)

print_root(sx, sy, sx + flag1, sy)
print_root(sx + flag1, sy, tx, ty + flag2)
print_root(tx, ty + flag2, tx, ty)

print_root(tx, ty, tx - flag1, ty)
print_root(tx - flag1, ty, sx, sy - flag2)
print_root(sx, sy - flag2, sx, sy)
print()

Solution (Python):
sx,sy,tx,ty = list(map(int, input().split()))
lst1 = []
lst2 = []
lst3 = []
lst4 = []

lst1.append("D")
lst1 += ["R" for i in range(tx-sx+1)]
lst1 += ["U" for i in range(ty-sy+1)]
lst1.append("L")

lst2.append("U")
lst2 += ["L" for i in range(tx-sx+1)]
lst2 += ["D" for i in range(ty-sy+1)]
lst2.append("R")

lst3 += ["R" for i in range(tx-sx)]
lst3 += ["U" for i in range(ty-sy)]

lst4 += ["L" for i in range(tx-sx)]
lst4 += ["D" for i in range(ty-sy)]

lst = lst1+lst2+lst3+lst4

print("".join(lst))

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

x = tx-sx
y = ty-sy

s = ['U']*y + ['R']*(x+1) + ['D']*(y+1) + ['L']*(x+1) + ['U'] + ['R']*x + ['U']*(y+1) + ['L']*(x+1) + ['D']*(y+1) + ['R']
print(''.join(s))

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

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


for i in range(tx-sx):
    route += "R"

for i in range(ty-sy):
    route += "U"


for i in range(abs(sx-tx)):
    route += "L"

for i in range(abs(sy-ty)):
    route += "D"


route += "D"
for i in range((tx+1)-sx):
    route += "R"

for i in range(ty-(sy-1)):
    route += "U"

route += "L"


route += "U"
for i in range(abs((sx-1)-tx)):
    route += "L"

for i in range(abs(sy-(ty+1))):
    route += "D"

route += "R"

print(route)

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

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

Solution (Python):
def abc051_c():
  sx, sy, tx, ty = map(int, input().split())
  
  path = ''
  
  path += 'R' * abs(tx - sx)
  path += 'U' * (abs(ty - sy) + 1)
  path += 'L' * (abs(tx - sx) + 1)
  path += 'D' * (abs(ty - sy) + 1)
  path += 'R'
  
  path += 'D'
  path += 'R' * (abs(tx - sx) + 1)
  path += 'U' * (abs(ty - sy) + 1)
  path += 'L' * (abs(tx - sx) + 1)
  path += 'D' * abs(ty - sy)
  
  if tx < sx:
    path.replace('R','X').replace('L','R').replace('X','L')
  if ty < sx:
    path.replace('U','Y').replace('D','U').replace('Y','D')
  print(path)

abc051_c()

Solution (Python):
if __name__ == '__main__':
	sx, sy, tx, ty = map(int, input().split())
	u1 = ty - sy
	r2 = tx - sx

	root = 'U' * u1 + 'R' * r2 + 'D' * u1 + 'L' * (r2+1)
	root2 = 'U' * (u1+1) + 'R' * (r2+1) + 'D' + 'R' + 'D' * (u1+1) + 'L' * (r2+1) + 'U'
	print(root + root2)

Solution (Python):



import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()


def resolve():
    sx,sy,tx,ty=map(int,input().split())
    tate=ty-sy
    yoko=tx-sx

    for _ in range(tate):
        print('U',sep='',end='')
    for _ in range(yoko+1):
        print('R',sep='',end='')
    for _ in range(tate+1):
        print('D',sep='',end='')
    for _ in range(yoko+1):
        print('L',sep='',end='')
    for _ in range(1):
        print('U',sep='',end='')
    for _ in range(1):
        print('L',sep='',end='')
    for _ in range(tate+1):
        print('U',sep='',end='')
    for _ in range(yoko+1):
        print('R',sep='',end='')
    for _ in range(tate+1):
        print('D',sep='',end='')
    for _ in range(yoko):
        print('L',sep='',end='')
    print()




resolve()

Solution (Python):

import sys
import fractions

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

sx, sy, tx, ty = lr()

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)

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

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

s=""

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

print(s)

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

s=""

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

print(s)

Solution (Python):
def main():
  sx, sy, tx, ty = (int(_) for _ in input().split())
  dx, dy = tx - sx, ty - sy
  ret = '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(ret)
  return

if __name__ == '__main__':
  main()

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

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

first  = (c-a)*"R"+(d-b)*"U"
second = (c-a)*"L"+(d-b)*"D"
third  = "D"+(c-a+1)*"R"+(d-b+1)*"U"+"L" 
fourth = "U"+(c-a+1)*"L"+(d-b+1)*"D"+"R"

ans=first+second+third+fourth
print(ans)

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

  s+="R"
  s+="U"*2
  s+="L"*(x+2)
  s+="D"*2
  s+="R"
elif ty==sy:
  s+="U"*x
  s+="R"+"D"*x+"L"
  s+="L"+"U"*x+"R"
  s+="U"
  s+="R"*2
  s+="D"*(y+2)
  s+="L"*2
  s+="U"
"""
print(s)

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

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

print(r)

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

print("U"*(gy-sy)+"R"*(gx-sx)+"D"*(gy-sy)+"L"*(gx-sx)+"L"+"U"*(gy-sy+1)+"R"*(gx-sx+1)+"D"+"R"+"D"*(gy-sy+1)+"L"*(gx-sx+1)+"U")

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


def solve():
    sx, sy, tx, ty = map(int, rl().split())
    dx, dy = tx - sx, 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)


if __name__ == '__main__':
    solve()

Solution (Python):
import math  
import bisect  
import queue  


if __name__ == '__main__':
    sx, sy, tx, ty = map(int, input().split())

    ans = []

    for _ in range(ty - sy):
        ans.append('U')
    for _ in range(tx - sx):
        ans.append('R')

    for _ in range(ty - sy):
        ans.append('D')
    for _ in range(tx - sx):
        ans.append('L')

    ans.append('L')
    for _ in range(ty - sy):
        ans.append('U')
    ans.append('U')
    ans.append('R')
    for _ in range(tx - sx):
        ans.append('R')
    ans.append('D')

    ans.append('R')
    for _ in range(ty - sy):
        ans.append('D')
    ans.append('D')
    ans.append('L')
    for _ in range(tx - sx):
        ans.append('L')
    ans.append('U')

    print(''.join(ans))

Solution (Python):
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


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

    xdif = tx - sx
    ydif = ty - sy

    res = ""

    res += "U" * ydif
    res += "R" * xdif
    res += "D" * ydif
    res += "L" * xdif

    res += "L"
    res += "U" * (ydif + 1)
    res += "R" * (xdif + 1)
    res += "D"
    res += "R"
    res += "D" * (ydif + 1)
    res += "L" * (xdif + 1)
    res += "U"

    print(res)


if __name__ == '__main__':
    main()

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

dx = (tx - sx)
dy = (ty - sy)
l1 = 'U' * dy + 'R' * dx
l2 = 'D' * dy + 'L' * dx
l3 = 'D' + 'R' * (dx + 1) + 'U' * (dy + 1) + 'L'
l4 = 'U' + 'L' * (dx + 1) + 'D' * (dy + 1) + 'R'

print(l1 + l2 + l3 + l4)

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

print(ans)

Solution (Python):
string=""
directionx=""



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

if dx>=0:
    directionx="R"
    directionxr="L"
else:
    directionx="L"
    directionxr="R"


if dy>=0:
    directiony="U"
    directionyr="D"
else:
    directiony="D"
    directionyr="U"
    
for _ in range (dx):
    string=string+directionx
for _ in range (dy):
    string=string+directiony
for _ in range (dx):
    string=string+directionxr
for _ in range (dy):
    string=string+directionyr

string=string+directionyr
for _ in range (dx+1):
    string=string+directionx
for _ in range (dy+1):
    string=string+directiony
string=string+directionxr
string=string+directiony
for _ in range (dx+1):
    string=string+directionxr
for _ in range (dy+1):
    string=string+directionyr
string=string+directionx
    
print(string)

Solution (Python):
m1, m2, n1, n2 = map(int, input().split())
n = n1-m1
m = n2-m2
ans = ""
go = "U"*m+"R"*n
back = "D"*m+"L"*n
a1 = "LU"
a2 = "RDRD"
a3 = "LU"
print(go+back+a1+go+a2+back+a3)

Solution (Python):
x, y, X, Y = map(int, input().split())
L, R, U, D = "L", "R", "U", "D"
print("".join([R]*(X-x)+[U]*(Y-y)+[L]*(X-x)+[D]*(Y-y)+[D]+[R]*(X-x+1)+[U]*(Y-y+1)+[L, U]+[L]*(X-x+1)+[D]*(Y-y+1)+[R]))

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


if __name__ == '__main__':
    main()

Solution (Python):
X = [int(e) for e in input().split()]
sx=X[0]
sy=X[1]
tx=X[2]
ty=X[3]
k=0
dy = ty - sy
dx = tx - 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)

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

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

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())
route = ""
dx, dy = tx - sx, ty - sy
path1 = "R" * dx + "U" * dy
path2 = "L" * dx + "D" * dy
dx, dy = dx + 1, dy + 1
path3 = "D" + "R" * dx + "U" * dy + "L"
path4 = "U" + "L" * dx + "D" * dy + "R"
ans =path1 + path2 + path3 + path4
print( ans)

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

dx = tx-sx
dy = ty-sy


ans = 'U'*dy+'R'*dx + '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):
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())

n = tx - sx
m = ty - sy

ans = 'R' * n + 'U' * m + 'L' * n + 'D' * m + 'L' + 'U' * (m+1) + 'R' * (n+1) + 'D' + 'R' + 'D' * (m+1) + 'L' * (n+1) + 'U'
print(ans)

Solution (Python):
import sys

a, b, c, d = map(int, sys.stdin.readline().split())

def main():
  dx = c - a
  dy = d - b
  res = 'U' * dy + 'R' * (dx + 1) + 'D' * (dy + 1) + 'L' * (dx + 1)
  res += 'UL'
  res += 'U' * (dy + 1) + 'R' * (dx + 1) + 'D' * (dy + 1) + 'L' * dx
  print(res)
   
if __name__ == '__main__':
  main()

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

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(dx):
  ans += "L"

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

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

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

print(ans)

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


dx,dy=tx-sx,ty-sy
one="R"*dx+"U"*dy

two=one.replace("R","L").replace("U","D")


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

four=three
four=four.replace("D","d").replace("R","r").replace("U","u").replace("L","l")
four=four.replace("d","U").replace("r","L").replace("u","D").replace("l","R")

print(one+two+three+four)

Solution (Python):
u="U"
d="D"
l="L"
r="R"

sx,sy,tx,ty=map(int,input().split())
dx=tx-sx
dy=ty-sy
ans=""
ans+=r*dx
ans+=u*dy
ans+=l*dx
ans+=d*dy

ans+=d

ans+=r*dx+r
ans+=u*dy+u

ans+=l
ans+=u

ans+=l*dx+l
ans+=d*dy+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)+'LU'+'U'*(ty-sy)+'R'*(tx-sx)+'RDRD'+'D'*(ty-sy)+'L'*(tx-sx)+'LU')

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):
def resolve():
    sx, sy, tx, ty = map(int, input().split())
    tx, ty = (tx-sx), (ty-sy)
    sx, sy = 0, 0

    ans1 = ["R"]*tx + ["U"]*ty
    ans2 = ["L"]*tx + ["D"]*ty
    ans3 = ["D"]+["R"]*(tx+1)+["U"]*(ty+1)+["L"]
    ans4 = ["U"] + ["L"]*(tx+1)+["D"]*(ty+1)+["R"]
    print("".join(ans1+ans2+ans3+ans4))
resolve()

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

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

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

print("".join(ans))

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

len_x = tx-sx
len_y = ty-sy

s = "U"*len_y+"R"*len_x+"D"*len_y+"L"*len_x
s += "L"
s += "U"*(len_y+1)
s += "R"*(len_x+1)
s += "D"
s += "R"
s += "D"*(len_y+1)
s += "L"*(len_x+1)
s += "U"

print(s)

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



print("".join(ans))

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

Solution (Python):
def main():
    sx, sy, tx, ty = map(int, input().split())
    answer = "U" * (ty - sy) + "R" * (tx - sx) + "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)


if __name__ == '__main__':
    main()

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

len_x = tx - sx
len_y = ty - sy

ans = []
for _ in range(len_x):
    ans.append("R")
for _ in range(len_y):
    ans.append("U")
for _ in range(len_x):
    ans.append("L")
for _ in range(len_y):
    ans.append("D")
    
ans.append("D")
for _ in range(len_x + 1):
    ans.append("R")
for _ in range(len_y + 1):
    ans.append("U")
ans.append("L")
ans.append("U")
for _ in range(len_x + 1):
    ans.append("L")
for _ in range(len_y + 1):
    ans.append("D")
ans.append("R")

print("".join(ans))

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

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

Solution (Python):
sx,sy,tx,ty = map(int,input().split())
ans = ''
u = 'U'*(ty-sy)
r = 'R'*(tx-sx)
d = 'D'*(ty-sy)
l = 'L'*(tx-sx+1)
u2 = 'U'*(ty-sy+1)
r2 = 'R'*(tx-sx+1)
d2 = 'D'
r3 = 'R'
d3 = 'D'*(ty-sy+1)
l2 = 'L'*(tx-sx+1)
print(u+r+d+l+u2+r2+d2+r3+d3+l2+'U')

Solution (Python):
a,b,c,d=map(int,input().split())
x=c-a
y=d-b
s=""
for i in range(y):
  s+="U"
for i in range(x):
  s+="R"
for i in range(y):
  s+="D"
for i in range(x+1):
  s+="L"
for i in range(y+1):
  s+="U"
for i in range(x+1):
  s+="R"
s+="DR"
for i in range(y+1):
  s+="D"
for i in range(x+1):
  s+="L"
s+="U"
print(s)

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

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


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

def go():
    out = []
    x, y = sx, sy
    while y < ty:
        out.append('U'); y += 1
    while x < tx:
        out.append('R'); x += 1
    while y > sy:
        out.append('D'); y -= 1
    while x > sx:
        out.append('L'); x -= 1
    out.append('L'); x -= 1
    while y <= ty:
        out.append('U'); y += 1
    while x < tx:
        out.append('R'); x += 1
    out.append('D'); y -= 1
    out.append('R'); x += 1
    while y >= sy:
        out.append('D'); y -= 1
    while x > sx:
        out.append('L'); x -= 1
    out.append('U');
    return ''.join(out)

print(go())

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

ans = []

for x in range(tx-sx):
    ans.append('R')
for y in range(ty-sy):
    ans.append('U')
for x in range(tx-sx):
    ans.append('L')
for y in range(ty-sy):
    ans.append('D')
    
ans.append('D')

for x in range(tx-sx+1):
    ans.append('R')
for y in range(ty-sy+1):
    ans.append('U')
    
ans.append('L')
ans.append('U')

for x in range(tx-sx+1):
    ans.append('L')
for y in range(ty-sy+1):
    ans.append('D')
    
ans.append('R')
    
print(''.join(ans))

Solution (Python):
import sys
IS = lambda: sys.stdin.readline().rstrip()
II = lambda: int(IS())
MII = lambda: list(map(int, IS().split()))

def main():
    sx, sy, tx, ty = MII()
    x1 = tx-sx
    y1 = ty-sy
    go1 = 'U'*y1 + 'R'*x1
    bk1 = 'D'*y1 + 'L'*x1
    go2 = 'L'+'U'+go1+'R'+'D'
    bk2 = 'R'+'D'+bk1+'L'+'U'
    print(go1+bk1+go2+bk2)

if __name__ == '__main__':
    main()

Solution (Python):
import sys
IS = lambda: sys.stdin.readline().rstrip()
II = lambda: int(IS())
MII = lambda: list(map(int, IS().split()))

def main():
    sx, sy, tx, ty = MII()
    x1 = tx-sx
    y1 = ty-sy
    go1 = 'U'*y1 + 'R'*x1
    bk1 = 'D'*y1 + 'L'*x1
    go2 = 'L'+'U'+go1+'R'+'D'
    bk2 = 'R'+'D'+bk1+'L'+'U'
    print(go1+bk1+go2+bk2)

if __name__ == '__main__':
    main()

Solution (Python):
import sys
in1 = sys.stdin.readlines()



sx, sy, tx, ty = map(int, in1[0].split())

lx = tx - sx
ly = ty - sy

print('U'*ly+'R'*lx+'D'*ly+'L'*lx+'L'+'U'*(ly+1)+'R'*(lx+1)+'DR'+'D'*(ly+1)+'L'*(lx+1)+'U')

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+1):
    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):
import sys

a, b, c, d = map(int, sys.stdin.readline().split())

def main():
  dy, dx = d - b, c - a
  res = 'U' * dy + 'R' * (dx + 1) + 'D' * (dy + 1) + 'L' * (dx + 1)
  res += 'UL'
  res += 'U' * (dy + 1) + 'R' * (dx + 1) + 'D' * (dy + 1) + 'L' * dx
  print(res) 
if __name__ == '__main__':
  main()

Solution (Python):
A, B, C, D = map(int, input().split())

x = C-A
y = D-B
first = 'U'*y+'R'*x
second = 'D'+"L"*(x-1)+'D'*(y-1)+'L'
third = 'LU'+first+'RD'
last = 'RD'+second+'LU'

print(first+second+third+last)

Solution (Python):

import math
import heapq
import bisect
import numpy as np
from collections import Counter, deque
import itertools


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

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