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

dx = tx - sx
dy = ty - sy

ans = []
for i in range(dx):
    ans.append("R")

for j in range(dy):
    ans.append("U")

for i in range(dx):
    ans.append("L")

for j in range(dy):
    ans.append("D")

ans.append("D")

for i in range(dx + 1):
    ans.append("R")

for j in range(dy + 1):
    ans.append("U")

ans.append("L")

ans.append("U")
for i in range(dx + 1):
    ans.append("L")

for j in range(dy + 1):
    ans.append("D")

ans.append("R")

print("".join(ans))

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

dx = tx-sx
dy = ty-sy
res =''

for _ in range(dx): res += 'R'
for _ in range(dy): res += 'U'
for _ in range(dx): res += 'L'
for _ in range(dy): res += 'D'

res += 'D'
for _ in range(dx+1): res += 'R'
for _ in range(dy+1): res += 'U'
res += "L"
res += "U"
for _ in range(dx+1): res += 'L'
for _ in range(dy+1): res += 'D'
res += 'R'
print(res)

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

hrz=tx-sx
vrt=ty-sy

a="U"*vrt
b="R"*hrz
c="D"*vrt
d="L"*hrz
ans1=a+b+c+d
a2=a+"U"
b2=b+"R"
c2=c+"D"
d2=d+"L"
ans2="L"+a2+b2+"DR"+c2+d2+"U"
print(ans1+ans2)

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

p1 = 'U' * (ty - sy) + 'R' * (tx - sx)
p2 = 'U' + 'L' * (tx - sx + 1) + 'D' * (ty - sy + 1) + 'R'
p3 = p1[::-1]
p4 = p2[::-1]

print(p1 + p2 + p3 + p4)

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

dx=tx-sx
dy=ty-sy

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

print(s)

Solution (Python):
sx, sy, tx, ty = map(int, input().split())
dy = ty - sy
dx = tx - sx
ans = dy*'U' + dx*'R' + 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):
x,y,X,Y=map(int,input().split())
a=X-x
b=Y-y
cnt=0
new_cnt=0
l=[]
L=[]
for i in range(a):
  l.append('R')
  cnt+=1

for i in range(b):
  l.append('U')
  new_cnt+=1

for i in l:
  if i=='R':
    l.append('L')
  elif i=='U':
    l.append('D')

l.append('D')
L.append('D')

for i in range(cnt+1):
  l.append('R')
  L.append('R')
  
for i in range(new_cnt+1):
  l.append('U')
  L.append('U')
l.append('L')
L.append('L')
l.append('U')
for i in L:
  if i=='R':
    l.append('L')
  elif i=='U':
    l.append('D')
l.append('R')

print(('').join(l))

Solution (Python):
sx,sy,tx,ty=map(int,input().split())
ans=""
d=(tx-sx)+(ty-sy)

for i in range(2*d):
    if i<=(tx-sx)-1:
        ans+="R"
    elif i<=d-1:
        ans+="U"
    elif i<=(d-1)+(tx-sx):
        ans+="L"
    else:
        ans+="D"


for j in range(2*(d+4)):
    if j==0:
        ans+="D"
    elif j<=(tx-sx)+2-1:
        ans+="R"
    elif j<=(d+4)-1-1:
        ans+="U"
    elif j<=(d+4)-1:
        ans+="L"
    elif j<=(d+4)-1+1:
        ans+="U"
    elif j<=(d+4)-1+1+(tx-sx+1):
        ans+="L"
    elif j<=2*(d+4)-1-1:
        ans+="D"
    else:
        ans+="R"
print(ans)

Solution (Python):
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


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

Solution (Python):
import sys





def RD(): return sys.stdin.read()


def II(): return int(input())


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


def MF(): return map(float,input().split())


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


def LF(): return list(map(float,input().split()))


def TI(): return tuple(map(int,input().split()))



from math import *


def main():
	a,b,c,d=MI()
	c-=a
	d-=b
	
	s="URDLLURDRDLU"
	li=[d,c,d,c,1,d+1,c+1,1,1,d+1,c+1,1]
	
	t=""
	for i in range(len(s)):
		t+=s[i]*li[i]
	print(t)
	




	

if __name__=="__main__":
	main()

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

Solution (Python):
coordinates = list(map(int,input().split()))
s = []
t = []

for i in range(len(coordinates)):
    if i < 2:
        s.append(coordinates[i])
    else:
        t.append(coordinates[i])




dx = t[0] - s[0]
dy = t[1] - s[1]

route = ""






for i in range(dx):
    route += "R"
for i in range(dy):
    route += "U"


for i in range(dx):
    route += "L"
for i in range(dy):
    route += "D"



route += "D"

for i in range(dx+1):
    route += "R"
for j in range(dy+1):
    route += "U"

route += "L"
route += "U"

for i in range(dx+1):
    route += "L"
for i in range(dy+1):
    route += "D"

route += "R"



print(route)

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

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

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

Solution (Python):
import sys
import math
import numpy as np
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(map(int,input().split()))
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
INF = 10**9
mod = 10**9+7

sx,sy,tx,ty = I()
a = ty-sy
b = tx-sx
ans1 = 'U'*a+'R'*b+'D'*a+'L'*(b+1)
ans2 = 'U'*(a+1)+'R'*(b+1)+'D'+'R'+'D'*(a+1)+'L'*(b+1)+'U'
print(ans1+ans2)

Solution (Python):
def solve():
    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)
    return 0

if __name__ == "__main__":
    solve()

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

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

ans = ""

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

TX -= SX
TY -= SY
SX = 0
SY = 0

res = ""

res += "U"*TY
res += "R"*TX
res += "D"*TY
res += "L"*(TX+1)
res += "U"*(TY+1)
res += "R"*(TX+1)
res += "D"
res += "R"
res += "D"*(TY+1)
res += "L"*(TX+1)
res += "U"

print(res)

Solution (Python):
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

a,b,c,d = inpl()
x = c-a
y = d-b
res = ''
res += 'U' * y + 'R' * x
res += 'D' * y + 'L' * x
res += 'L' + 'U' * (y+1) + 'R' * (x+1) + 'D'
res += 'R' + 'D' * (y+1) + 'L' * (x+1) + 'U'
print(res)

Solution (Python):
import sys
sys.setrecursionlimit(10**7) 
import math
from copy import copy, deepcopy
from copy import deepcopy as dcp
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right

from collections import deque


from collections import Counter

from itertools import accumulate,combinations,permutations

from heapq import heapify,heappop,heappush


from functools import lru_cache

from decimal import Decimal

def input(): 
    x=sys.stdin.readline()
    return x[:-1] if x[-1]=="\n" else x
def printl(li): _=print(*li, sep="\n") if li else None
def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds
def alp2num(c,cap=False): return ord(c)-97 if not cap else ord(c)-65
def num2alp(i,cap=False): return chr(i+97) if not cap else chr(i+65)
def matmat(A,B):
    K,N,M=len(B),len(A),len(B[0])
    return [[sum([(A[i][k]*B[k][j]) for k in range(K)]) for j in range(M)] for i in range(N)]
def matvec(M,v):
    N,size=len(v),len(M)
    return [sum([M[i][j]*v[j] for j in range(N)]) for i in range(size)]
def T(M):
    n,m=len(M),len(M[0])
    return [[M[j][i] for j in range(n)] for i in range(m)]
def main():
    mod = 1000000007
    

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






if __name__ == "__main__":
    main()

Solution (Python):
import sys









input = sys.stdin.readline

getS = lambda: input().strip()
getN = lambda: int(input())
getList = lambda: list(map(int, input().split()))
getZList = lambda: [int(x) - 1 for x in input().split()]

INF = 10 ** 20
MOD = 1000000007

def solve():
    sx, sy, tx, ty = getList()
    dx = tx - sx
    dy = ty - sy
    ans = []
    for i in range(dy):
        ans.append("U")
    for i in range(dx):
        ans.append("R")
    for i in range(dy):
        ans.append("D")
    for i in range(dx):
        ans.append("L")

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

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

def main():
    n = getN()
    for _ in range(n):
        solve()
if __name__ == "__main__":
    
    solve()

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

th1 = "R"*(c-a)
th2 = "U"*(d-b)
th3 = "L"*(c-a)
th4 = "D"*(d-b)
th5 = "D"+"R"*(c-a+1)+"U"*(d-b+1)+"L"
th6 = "U"+"L"*(c-a+1)+"D"*(d-b+1)+"R"

ans=th1+th2+th3+th4+th5+th6
print(ans)

Solution (Python):
x1,y1,x2,y2=map(int,input().split())
ans=[]
for i in range(y2-y1):
  ans.append('U')
for i in range(x2-x1):
  ans.append('R')
for i in range(y2-y1):
  ans.append('D')
for i in range(x2-x1):
  ans.append('L')
ans.append('L')
for i in range(y2-y1+1):
  ans.append('U')
for i in range(x2-x1+1):
  ans.append('R')
ans.append('D')
ans.append('R')
for i in range(y2-y1+1):
  ans.append('D')
for i in range(x2-x1+1):
  ans.append('L')
ans.append('U')
print(''.join(ans))

Solution (Python):
A,B,C,D=map(int,input().split())
P='R'*(C-A)
P+='U'*(D-B)
P+='L'*(C-A)
P+='D'*(D-B+1)
P+='R'*(C-A+1)
P+='U'*(D-B+1)
P+='L'
P+='U'
P+='L'*(C-A+1)
P+='D'*(D-B+1)
print(P+'R')

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

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


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

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

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

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

Solution (Python):
sx, sy, tx, ty, = [int(i) for i in input().split()]
x_diff = tx - sx
y_diff = ty - sy

output = ''

output += 'U'*y_diff
output += 'R'*x_diff
output += 'D'*y_diff
output += 'L'*x_diff


output += 'L'
output += 'U'*(y_diff+1)
output += 'R'*(x_diff+1)
output += 'D'
output += 'R'
output += 'D'*(y_diff+1)
output += 'L'*(x_diff+1)
output += 'U'

print(output)

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

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

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

print("".join(s))

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

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

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

print(ans)

Solution (Python):
s_x,s_y,t_x,t_y=map(int,input().split())

ans=''

hor = t_x - s_x
ver = t_y - s_y

ans='U'*ver + 'R'*hor + 'D'*ver + 'L'*hor + 'L' + 'U'*(ver+1) +'R'*(hor+1)+'D'+'R' + 'D'*(ver+1)+'L'*(hor+1)+'U' 

print(ans)

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

w = tx - sx
h = ty - sy

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

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

dist_x = tx - sx
dist_y = ty - sy

res = "R" * dist_x + "U" * dist_y + "L" * dist_x + "D" * dist_y + "D" + "R" * (dist_x + 1) + "U" * (dist_y + 1) + "L" + "U" + "L" * (dist_x + 1) + "D" * (dist_y + 1) + "R"
print(res)

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+1) + 'R'*(X+1) + 'U'*(Y+1) + 'LU' + 'L'*(X+1) + 'D'*(Y+1) + 'R')

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

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

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

diffx = tx-sx
diffy = ty-sy

st = ''
for i in range(2):
    if i == 0:
        st = st + 'U'*diffy+'R'*diffx+'D'*diffy+'L'*diffx
    if i ==1:
        st = st + 'L'+'U'*(diffy+1)+'R'*(diffx+1)+'D'+'R'+'D'*(diffy+1)+'L'*(diffx+1)+'U'
print(st)

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


cmd1 = 'R' * dx + 'U' * dy
cmd2 = 'L' * dx + 'D' * dy
cmd3 = 'D' + 'R' * (dx+1) + 'U' * (dy+1) + 'L'
cmd4 = 'U' + 'L' * (dx+1) + 'D' * (dy+1) + 'R'
ans = cmd1 + cmd2 + cmd3 + cmd4
print(ans)

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

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

print(A)

Solution (Python):
import sys

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

    horiz = tx - sx
    vert = ty - sy

    first_move = "U"*vert + "R"*horiz + "D"*vert + "L"*horiz
    second_move_go = "L" + "U"*(vert+1) + "R"*(horiz+1) + "D"
    second_move_back = "R" + "D"*(vert+1)+ "L"*(horiz+1) + "U" 
    print(first_move + second_move_go + second_move_back)

if __name__ == "__main__":
    main()

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

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

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

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

Solution (Python):
def calculate(cx1, cy1, cx2, cy2):

    Up = 'U'
    Right = 'R'
    Left = 'L'
    Down = 'D'

    h = abs(cy2 - cy1)
    w = abs(cx2 - cx1)

    if cx2 > cx1:
        if cy2 < cy1:
            Down = 'U'
            Up = 'D'
    else:
        if cy2 > cy1:
            Left = 'R'
            Right = 'L'
        else:
            Left = 'R'
            Right = 'L'
            Down = 'U'
            Up = 'D'

    return h * Up + w * Right + h * Down + (w + 1) * Left + (h + 1) * Up + (w + 1) * Right + Down + Right + (
            h + 1) * Down + (w + 1) * Left + Up


cx1, cy1, cx2, cy2 = -2, -2, 1, 1
cx1, cy1, cx2, cy2 = map(int,input().split())

print(calculate(cx1, cy1, cx2, cy2))

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

p=u-x
q=v-y

S="U"*q+"R"*p+"D"*q
S+="L"*(p+1)+"U"*(q+1)+"R"*(p+1)+"D"+"R"+"D"*(q+1)+"L"*(p+1)+"U"
print(S)

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

p=u-x
q=v-y

S="U"*q+"R"*p+"D"*q
S+="L"*(p+1)+"U"*(q+1)+"R"*(p+1)+"D"+"R"+"D"*(q+1)+"L"*(p+1)+"U"
print(S)

Solution (Python):
import copy

sx, sy, tx, ty = map(int, input().split())
p = [sx, sy]
g = []
b = []

for _ in range(1,tx - sx):
    g.append('R')
    b.append('L')
for _ in range(1,ty - sy):
    g.append('U')
    b.append('D')

b.reverse()

g1 = g
g1.insert(0,'R')
g1.append('U')
g2 = copy.deepcopy(g1)
g2.insert(0,'R')
g2.insert(0,'D')
g2.append('U')
g2.append('L')
b1 = b
b1.insert(0,'L')
b1.append('D')
b2 = copy.deepcopy(b1)
b2.insert(0,'L')
b2.insert(0,'U')
b2.append('D')
b2.append('R')

ans = []
ans.extend(g1)
ans.extend(b1)
ans.extend(g2)
ans.extend(b2)
ans = ''.join(ans)
print(ans)

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("".join(ans))

Solution (Python):
Sx, Sy, Tx, Ty = map(int, input().split())

Takasa = Ty-Sy
Haba = Tx-Sx

Ito = []

for i in range (0, Takasa):
	Ito.append('U')

for i in range (0, Haba):
	Ito.append('R')

for i in range (0, Takasa):
	Ito.append('D')

for i in range (0, Haba+1):
	Ito.append('L')

for i in range (0, Takasa+1):
	Ito.append('U')

for i in range (0, Haba+1):
	Ito.append('R')

Ito.append('DR')

for i in range (0, Takasa+1):
	Ito.append('D')

for i in range (0, Haba+1):
	Ito.append('L')

Ito.append('U')

print(*Ito, sep='')

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

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

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

print(ans)

Solution (Python):
def solve():
    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'
    return ans

print(solve())

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

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

print(res)

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

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

def get_path(moves):
  path = ''
  for y, x in moves:
    if y > 0:
      path += 'U' * y
    else:
      path += 'D' * -y
    if x > 0:
      path += 'R' * x
    else:
      path += 'L' * -x
  return path

first_moves = []
foward_y = ty - sy
foward_x = tx - sx
first_moves.append((foward_y, foward_x))
first_moves.append((-foward_y, -foward_x))

second_moves = []
foward_y = (ty + 1) - sy
foward_x = tx - (sx - 1)
second_moves.append((0, -1))
second_moves.append((foward_y, foward_x))
second_moves.append((-1, 0))
second_moves.append((0, 1))
second_moves.append((-foward_y, -foward_x))
second_moves.append((1, 0))

print(get_path(first_moves + second_moves))

Solution (Python):






from collections import deque




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

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

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

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

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)

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

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



if __name__ == '__main__':
    main()

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

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

Solution (Python):
sx,sy,tx,ty = map(int,input().split())
going1 = ''
returning1 = ''
going2 = ''
returning2 = '' 
a = tx - sx
b = ty - sy
going1 ='U' * b + 'R' * a
returning1 = 'D' * b + 'L' * a
going2 = 'L' + 'U' * (b + 1) + 'R' * (a + 1) + 'D'
returning2 = 'R' + 'D' * (b + 1) + 'L' * (a + 1) + 'U'
print(going1 + returning1 + going2 + returning2)

Solution (Python):
import math

import queue
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit


ipt = stdin.readline
setrecursionlimit(10**7)

def main():
    sx,sy,tx,ty = map(int,ipt().split())
    dx = tx-sx
    dy = ty-sy
    print("U"*dy+"R"*dx+"D"*dy+"L"*dx+"L"+"U"*(dy+1)+"R"*(dx+1)+"D"+"R"+"D"*(dy+1)+"L"*(dx+1)+"U")
    return

if __name__ == '__main__':
    main()

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

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

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

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

Solution (Python):
st = list(map(int,input().split()))
x = st[2] - st[0]
y = st[3] - st[1]
l1 = 'U'*y + 'R'*x
l2 = 'D'*y + 'L'*x
l3 = 'L' + 'U'*(y+1) + 'R'*(x+1) + 'D'
l4 = 'R' + 'D'*(y+1) + 'L'*(x+1) + 'U'
print(l1+l2+l3+l4)

Solution (Python):
import sys


import math
import collections

import bisect
import itertools
import fractions

import copy
import heapq
import decimal

import queue
import numpy as np

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7

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





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

    ans = []

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

    ans.extend(["L"])

    ans.extend(["U"] * (ty - sy + 1))
    ans.extend((["R"] * (tx - sx + 1)))

    ans.extend(["DR"])

    ans.extend(["D"] * ((ty - sy + 1)))
    ans.extend((["L"] * (tx - sx + 1)))

    ans.extend(["U"])

    print(*ans, sep="")


if __name__ == '__main__':
    main()

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


def inverse(line :str):
    ret = ""
    for c in line:
        if c == "U":
            ret += "D"
        elif c == "D":
            ret += "U"
        elif c == "R":
            ret += "L"
        else:
            ret += "R"
    
    return ret


str1out = ""
for dx in range(tx - sx):
    str1out += "R"

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

str1in = inverse(str1out)


str2out = "DR" + str1out + "UL"
str2in = "UL" + str1in + "DR"
print(str1out + str1in + str2out + str2in)

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

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

def Ans(U,D,R,L,tx,ty):
    tx = abs(tx)
    ty = abs(ty)
    ans = U*ty+R*tx+D*ty+L*tx 
    ans += L+U*(ty+1)+R*(tx+1)+D+R+D*(ty+1)+L*(tx+1)+U
    return ans

if tx >= 0 and ty >= 0:
    print(Ans("U","D","R","L",tx,ty))
elif tx < 0 and ty < 0:
    print(Ans("D","U","L","R",tx,ty))
elif tx >= 0 and ty <0:
    print(Ans("D","U","R","L",tx,ty))
else:
    print(Ans("U","D","L","R",tx,ty))

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

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

Solution (Python):
a,b,x,y=map(int,input().split())
ans="UD"[b>y]*abs(b-y)+"LR"[a<x]*abs(a-x)
ans+="UD"[b<y]*abs(b-y)+"LR"[a>x]*abs(a-x)
ans+="LR"[a>x]+"UD"[b>y]*(abs(b-y)+1)+"LR"[a<x]*(abs(a-x)+1)+"UD"[b<y]
ans+="LR"[a<x]+"UD"[b<y]*(abs(b-y)+1)+"LR"[a>x]*(abs(a-x)+1)+"UD"[b>y]
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+1)
ans += "U"*(y+1)
ans += "R"*(x+1)
ans += "D"
ans += "R"
ans += "D"*(y+1)
ans += "L"*(x+1)
ans += "U"
print(ans)