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


if __name__ == '__main__':
    main()

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

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

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

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

Solution (Python):

"""
Created on Mon Jun  1 13:02:30 2020

@author: NEC-PCuser
"""

SX, SY, TX, TY = map(int, input().split())

ans = ""

if TX - SX > 0 and TY - SY > 0:
    first = "R"
    second = "U"
    third = "L"
    forth = "D"
elif TX - SX < 0 and TY - SY > 0:
    first = "L"
    second = "U"
    third = "R"
    forth = "D"
elif TX - SX < 0 and TY - SY < 0:
    first = "L"
    second = "D"
    third = "R"
    forth = "U"
elif TX - SX > 0 and TY - SY < 0:
    first = "R"
    second = "D"
    third = "L"
    forth = "U"

for i in range (TX - SX):
    ans += first
for i in range (TY - SY):
    ans += second
for i in range (TX - SX):
    ans += third
for i in range (TY - SY):
    ans += forth
ans += forth
for i in range (TX - SX + 1):
    ans += first
for i in range (TY - SY + 1):
    ans += second
ans += third
ans += second
for i in range (TX - SX + 1):
    ans += third
for i in range (TY - SY + 1):
    ans += forth
ans += first

print(ans)

Solution (Python):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

x1,y1,x2,y2=MI()
dx=x2-x1
dy=y2-y1
for i in range(dx):
    print("R",end="")
for i in range(dy):
    print("U",end="")
for i in range(dx):
    print("L",end="")
for i in range(dy):
    print("D",end="")
print("L",end="")
for i in range(dy+1):
    print("U",end="")
for i in range(dx+1):
    print("R",end="")
print("D",end="")
print("R",end="")
for i in range(dy+1):
    print("D",end="")
for i in range(dx+1):
    print("L",end="")
print("U")

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

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

xdist = tx - sx
ydist = ty - sy

ans = "R" * xdist + "U" * ydist + "L" * xdist + "D" * ydist

ans += "L" + (ydist + 1) * "U" + "R" * (xdist + 1) + "D"
ans += "R" + (ydist + 1) * "D" + "L" * (xdist + 1) + "U"

print(ans)

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

route = []
dy = gy - sy
dx = gx - sx
route.append('U' * dy)
route.append('R' * dx)
route.append('D' * dy)
route.append('L' * (dx + 1))
route.append('U' * (dy + 1))
route.append('R' * (dx + 1))
route.append('DR')
route.append('D' * (dy + 1))
route.append('L' * (dx + 1))
route.append('U')
print(''.join(route))

Solution (Python):
from sys import stdin
def main():
    
    readline=stdin.readline
    sx,sy,tx,ty=map(int,readline().split())

    ans=""
    u=ty-sy
    v=tx-sx
    a=u*"U"
    b=v*"R"
    c=u*"D"
    d=v*"L"
    ans+=a+b+c+d
    ans+="L"+a+"U"+b+"R"+"D"
    ans+="R"+c+"D"+d+"L"+"U"
    print(ans)

if __name__=="__main__":
    main()

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

x = tx - sx
y = ty - sy

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

print(ans)

Solution (Python):
X = list(map(int, input().split()))
sx = X[0]
sy = X[1]
tx = X[2]
ty = X[3]
x = tx - sx
y = ty - sy
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):
sx,sy,tx,ty=map(int,input().split())
height=ty-sy
width=tx-sx
ans=""
ans+='U'*height+'R'*width+'D'*height+'L'*width
ans+='L'+'U'*(height+1)+'R'*(width+1)+'D'
ans+='R'+'D'*(height+1)+'L'*(width+1)+'U'
print(ans)

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy, copy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7



sx, sy, tx, ty = MAP()
X = tx - sx
Y = ty - sy

way1 = "R"*X + "U"*Y
way2 = "L"*X + "D"*Y
way3 = "L" + "U"*(Y+1) + "R"*(X+1) + "D"
way4 = "R" + "D"*(Y+1) + "L"*(X+1) + "U"

print(way1+way2+way3+way4)

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

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


print("".join(R))

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

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

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

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

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

move = ''
xz = abs(tx-sx)
yz = abs(ty-sy)
move += 'U'*yz + 'R'*xz + 'D'*yz + 'L'*xz
move += 'L'*1 + 'U'*(yz+1) + 'R'*(xz+1) + 'D'*1
move += 'R'*1 + 'D'*(yz+1) + 'L'*(xz+1) + 'U'*1
print(move)

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

Solution (Python):
x_s, y_s, x_t, y_t = map(int, input().split())
dist_x, dist_y = x_t - x_s, y_t - y_s

ans = ""
ans += ("R" * dist_x)
ans += ("U" * dist_y)
ans += ("L" * dist_x)
ans += ("D" * dist_y)
ans += "D"
ans += ("R" * (dist_x + 1))
ans += ("U" * (dist_y + 1))
ans += "LU"
ans += ("L" * (dist_x + 1))
ans += ("D" * (dist_y + 1))
ans += "R"

print(ans)

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

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

diff_x = abs(tx-sx)
diff_y = abs(ty-sy)


ans += "U" * diff_y + "R" * diff_x
ans += "D" * diff_y + "L" * diff_x


ans += "L" * 1 + "U" * (diff_y+1)

ans += "R" * (diff_x+1) + "D" * 1


ans += "R" * 1 + "D" * (diff_y+1)

ans += "L" * (diff_x+1) + "U" * 1

print(ans)

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

diff_x = abs(tx-sx)
diff_y = abs(ty-sy)


ans += "U" * diff_y + "R" * diff_x
ans += "D" * diff_y + "L" * diff_x


ans += "L" * 1 + "U" * (diff_y+1)

ans += "R" * (diff_x+1) + "D" * 1


ans += "R" * 1 + "D" * (diff_y+1)

ans += "L" * (diff_x+1) + "U" * 1

print(ans)

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


def read():
    sx, sy, tx, ty = map(int, input().strip().split())
    return sx, sy, tx, ty


def solve(sx, sy, tx, ty):
    dx = tx - sx
    dy = ty - sy
    q = deque()
    q.append("U" * dy)
    q.append("R" * dx)
    q.append("D" * dy)
    q.append("L" * dx)
    q.append("L" * 1)
    q.append("U" * (dy+1))
    q.append("R" * (dx+1))
    q.append("D" * 1)
    q.append("R" * 1)
    q.append("D" * (dy+1))
    q.append("L" * (dx+1))
    q.append("U" * 1)
    return "".join(q)


if __name__ == '__main__':
    inputs = read()
    print(solve(*inputs))

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

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

Solution (Python):
a,b,c,d = [int(x) for x in input().split()]
x = c-a
y = d-b

ans1=x*"R"+y*"U"
ans2=x*"L"+y*"D"
ans3="D"+(1+x)*"R"+(1+y)*"U"+"L"
ans4="U"+(1+x)*"L"+(1+y)*"D"+"R"


ans = ans1+ans2+ans3+ans4
print(ans)

Solution (Python):
"""
N = list(map(int,input().split()))
S = [str(input()) for _ in range(N)]
S = [list(map(int,list(input()))) for _ in range(h)] 
print(*S,sep="")
"""

import sys
sys.setrecursionlimit(10**6)
input = lambda: sys.stdin.readline().rstrip()
inf = float("inf") 

def reverse(temp):
    out = ""
    for x in temp:
        if x == "U":
            out += "D"
        elif x == "D":
            out += "U"
        elif x == "R":
            out += "L"
        else:
            out += "R"
    return out

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

A = ""
B = ""
C = ""
D = ""


if sy < ty:
    A += "U" * (ty-sy)
else:
    A += "D" * (sy-ty)
if sx < tx:
    A += "R" * (tx-sx)
else:
    A += "L" * (sx-tx)
B = reverse(A)

C+=B[-1]+A[0]+A+A[-1]+B[0]
D = reverse(C)


print(A+B+C+D)

Solution (Python):
sx, sy, tx, ty = map(int, input().split())
ver = ty - sy
hor = tx - sx
go1 = 'U'*ver+"R"*hor
back1 = "D"*ver+"L"*hor
go2 = "D"+"R"*(hor+1)+'U'*(ver+1)+"L"
back2 = "U"+"L"*(hor+1)+"D"*(ver+1)+"R"
print(go1+back1+go2+back2)

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

Solution (Python):

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

r1 = 'U'*dy + 'R'*dx
r2 = 'D'*dy + 'L'*dx

r3 = 'LU'+r1+'RD'
r4 = 'RD'+r2+'LU'

print(r1+r2+r3+r4)

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

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

def print_route(sx,sy,tx,ty,goback,route):
    if goback == 'go':
        for i in range(tx-sx):
            route += 'R'
        for j in range(ty-sy):
            route += 'U'
    elif goback == 'back':
        for i in range(tx-sx):
            route += 'L'
        for j in range(ty-sy):
            route += 'D'
    else:
        pass
    return route
    
route = ""
route = print_route(sx,sy,tx,ty,'go',route)
route = print_route(sx,sy,tx,ty,'back',route)
route += 'D'
route = print_route(sx,sy-1,tx+1,ty,'go',route)
route += 'LU'
route = print_route(sx-1,sy,tx,ty+1,'back',route)
route += 'R'
print(route)

Solution (Python):

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

dx = tx-sx
dy = ty-sy


path.append('U'*dy)
path.append('R'*dx)


path.append('D'*dy)
path.append('L'*dx)


path.append('L')
path.append('U'*(dy+1))
path.append('R'*(dx+1))
path.append('D')


path.append('R')
path.append('D'*(dy+1))
path.append('L'*(dx+1))
path.append('U')

print(''.join(path))

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

order = "L"

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

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

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

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

ans = ''


cnt_ud = abs(ty-sy)
cnt_rl = abs(sx-tx)
ans += 'U'*cnt_ud+'R'*cnt_rl


ans += 'D'*cnt_ud+'L'*cnt_rl


ans += 'L'+'U'*(cnt_ud+1)+'R'*(cnt_rl+1)+'D'


ans += 'R'+'D'*(cnt_ud+1)+'L'*(cnt_rl+1)+'U'

print(ans)

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

xd = tx - sx
yd = ty - sy

route1 = []
route1.append('R'*xd)
route1.append('U'*yd)

route2 = []
route2.append('L'*xd)
route2.append('D'*yd)

route3 = ['D']
route3.append('R' * (xd + 1))
route3.append('U' * (yd + 1))
route3.append('L')

route4 = ['U']
route4.append('L'*(xd+1))
route4.append('D'*(yd+1))
route4.append('R')

ans = ''.join(route1) + ''.join(route2) + ''.join(route3) + ''.join(route4)
print(ans)

Solution (Python):
import sys


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


def resolve():
    s1, s2, t1, t2 = map(int, input().split())
    l = []
    x = t1 - s1
    y = t2 - s2
    ans='R'*x+'U'*y+'L'*x+'D'*y
    ans+='D'+'R'*(x+1)+'U'*(y+1)+'L'
    ans+='U'+'L'*(x+1)+'D'*(y+1)+'R'
    print(ans)
resolve()

Solution (Python):
import sys


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


def resolve():
    s1, s2, t1, t2 = map(int, input().split())
    l = []
    yoko = t1 - s1
    tate = t2 - s2
    a,c,f,h='R','L','L','R'
    b,d,e,g='U','D','D','U'
    l.append(a*yoko+b*tate+c*yoko+d*tate)
    l.append(e+a*(yoko+1)+b*(tate+1)+f)
    l.append(g+c*(yoko+1)+d*(tate+1)+h)
    print(''.join(l))
resolve()

Solution (Python):
import sys


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


def resolve():
    s1, s2, t1, t2 = map(int, input().split())
    l = []
    yoko = t1 - s1
    tate = t2 - s2
    if yoko>0:
        a,c,f,h='R','L','L','R'
    else:
        yoko=-yoko
        a,c,f,h='L','R','R','L'
    if tate>0:
        b,d,e,g='U','D','D','U'
    else:
        tate=-tate
        b,d,e,g='D','U','U','D'
    l.append(a*yoko+b*tate+c*yoko+d*tate)
    l.append(e+a*(yoko+1)+b*(tate+1)+f)
    l.append(g+c*(yoko+1)+d*(tate+1)+h)
    print(''.join(l))
resolve()

Solution (Python):
import sys


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


def resolve():
    s1, s2, t1, t2 = map(int, input().split())
    l = []
    yoko = t1 - s1
    tate = t2 - s2
    if yoko>0:
        a='R'
        c='L'
        f='L'
        h='R'
    else:
        yoko=-yoko
        a='L'
        c='R'
        f='R'
        h='L'
    if tate>0:
        b='U'
        d='D'
        e='D'
        g='U'
    else:
        tate=-tate
        b='D'
        d='U'
        e='U'
        g='D'
    l.append(a*yoko+b*tate+c*yoko+d*tate)
    l.append(e+a*(yoko+1)+b*(tate+1)+f)
    l.append(g+c*(yoko+1)+d*(tate+1)+h)
    print(''.join(l))
resolve()

Solution (Python):
import sys


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


def resolve():
    s1, s2, t1, t2 = map(int, input().split())
    l = []
    yoko = t1 - s1
    tate = t2 - s2
    if yoko > 0 and tate > 0:
        l.append('R' * yoko + 'U' * tate)
        l.append('L' * yoko + 'D' * tate)
        l.append('D' + 'R' * (yoko + 1) + 'U' * (tate + 1) + 'L')
        l.append('U' + 'L' * (yoko + 1) + 'D' * (tate + 1) + 'R')
        print(''.join(l))
    elif yoko > 0 and tate < 0:
        tate = -tate
        l.append('R' * yoko + 'D' * tate)
        l.append('L' * yoko + 'U' * tate)
        l.append('U' + 'R' * (yoko + 1) + 'D' * (tate + 1) + 'L')
        l.append('D' + 'L' * (yoko + 1) + 'U' * (tate + 1) + 'R')
        print(''.join(l))
    elif yoko < 0 and tate > 0:
        yoko = -yoko
        l.append('L' * yoko + 'U' * tate)
        l.append('R' * yoko + 'D' * tate)
        l.append('D' + 'L' * (yoko + 1) + 'U' * (tate + 1) + 'R')
        l.append('U' + 'R' * (yoko + 1) + 'D' * (tate + 1) + 'L')
        print(''.join(l))
    else:
        yoko = -yoko
        tate = -tate
        l.append('L' * yoko + 'D' * tate)
        l.append('R' * yoko + 'U' * tate)
        l.append('U' + 'L' * (yoko + 1) + 'D' * (tate + 1) + 'R')
        l.append('D' + 'R' * (yoko + 1) + 'U' * (tate + 1) + 'L')
        print(''.join(l))
resolve()

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

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

ans=[]


sx1=sx
sy1=sy+1
tx1=tx-1
ty1=ty
ans.append('U')
ans.extend(['U']*(ty1-sy1))
ans.extend(['R']*(tx1-sx1))
ans.append('R')


sx2=sx+1
sy2=sy
tx2=tx
ty2=ty-1
ans.append('D')
ans.extend(['D']*(ty2-sy2))
ans.extend(['L']*(tx2-sx2))
ans.append('L')


sx3=sx
sy3=sy-1
tx3=tx+1
ty3=ty
ans.append('D')
ans.extend(['R']*(tx3-sx3))
ans.extend(['U']*(ty3-sy3))
ans.append('L')


sx4=sx-1
sy4=sy
tx4=tx
ty4=ty+1
ans.append('U')
ans.extend(['L']*(tx4-sx4))
ans.extend(['D']*(ty4-sy4))
ans.append('R')

print(''.join(ans))

Solution (Python):
sx, sy, tx, ty = map(int, input().split())
directions = ['U', 'D', 'L', 'R']

print(directions[0] * (ty - sy), end='')
print(directions[3] * (tx - sx), end='')
print(directions[1] * (ty - sy), end='')
print(directions[2] * (tx - sx), end='')
print(directions[2], end='')
print(directions[0] * (ty - sy + 1), end='')
print(directions[3] * (tx - sx + 1), end='')
print(directions[1], end='')
print(directions[3], end='')
print(directions[1] * (ty - sy + 1), end='')
print(directions[2] * (tx - sx + 1), end='')
print(directions[0])

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

print(ans)

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

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

dx = tx - sx
dy = ty - sy

res = ""


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

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



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

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

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

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

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

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

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

tx -= sx
ty -= sy

s = str()
s += 'R' * tx
s += 'U' * ty
s += 'L' * tx
s += 'D' * (ty + 1)
s += 'R' * (tx + 1)
s += 'U' * (ty + 1)
s += 'L'
s += 'U'
s += 'L' * (tx + 1)
s += 'D' * (ty + 1)
s += 'R'

print (s)

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

Solution (Python):
sx,sy,tx,ty = map(int,input().split())
ans = ''
s1 = (sx,sy+1)
s2 = (sx+1,sy)
s3 = (sx-1,sy)
s4 = (sx,sy-1)
t1 = (tx-1,ty)
t2 = (tx,ty-1)
t3 = (tx,ty+1)
t4 = (tx+1,ty)
l = [s1,t1,s2,t2,s3,t3,s4,t4]
for i in range(4):
    xs,ys = l[i*2]
    xt,yt = l[i*2+1]
    if i%2==0:
        if i == 0:
            ans += 'U'
        else:
            ans += 'L'
        ans += 'U'*(yt-ys)
        ans += 'R'*(xt-xs)
        if i == 0:
            ans += 'R'
        else:
            ans += 'D'
    else:
        if i == 1:
            ans += 'D'
        else:
            ans += 'R'
        ans += 'D'*(yt-ys)
        ans += 'L'*(xt-xs)
        if i == 1:
            ans += 'L'
        else:
            ans += 'U'
    
    
print(ans)

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

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

Solution (Python):


import sys






























def main():
    mod = 1000000007                
    inf = float('inf')              
    
    sys.setrecursionlimit(10**6)    
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
    
    sx, sy, tx, ty = mi()
    xdiff = tx - sx
    ydiff = ty - sy
    print('R'*xdiff+'U'*ydiff + 'L'*xdiff+'D'*ydiff + 'D'+'R'*(xdiff+1)+'U'*(ydiff+1)+'L' + 'U'+'L'*(xdiff+1)+'D'*(ydiff+1)+'R')


if __name__ == "__main__":
    main()

Solution (Python):

import sys
input = sys.stdin.readline









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

dx = Tx - Sx
dy = Ty - Sy
 
ans1 = "U"*dy + "R"*dx
ans2 = "D"*dy + "L"*dx
ans3 = "L" + "U"*(dy+1) + "R"*(dx+1) + "D"
ans4 = "R" + "D"*(dy+1) + "L"*(dx+1) + "U"
 
print(ans1 + ans2 + ans3 + ans4)

Solution (Python):

import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

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

if __name__ == '__main__':
    main()

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

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

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

print(res)

Solution (Python):
sx, sy, tx, ty = map(int, input().split())
x = tx - sx
y = ty - sy
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):
def main():
    sx, sy, tx, ty = map(int, input().split())
    move1 = []
    move2 = []
    for i in range(abs(sx-tx)):
        if sx > tx:
            move1.append("L")
        else:
            move1.append("R")

    for j in range(abs(sy-ty)):
        if sy > ty:
            move2.append("D")
        else:
            move2.append("U")

    move3 = [reverse(m) for m in move1]
    move4 = [reverse(m) for m in move2]
    
    move5 = [reverse(move2[0])] + move1
    move5.append(move1[-1])
    
    move6 = [move2[0]] + move2
    move6.append(reverse(move1[0]))

    move7 = [reverse(m) for m in move5]
    move8 = [reverse(m) for m in move6]

    move = move1 + move2 + move3 + move4 + move5 + move6 + move7 + move8
    move_str = ""

    for m in move:
        move_str += m
    print(move_str)    


def reverse(m):
    if m == "D":
        return "U"
    elif m == "U":
        return "D"
    elif m == "R":
        return "L"
    else:
        return "R"

    
    
if __name__ == '__main__':
    main()

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

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

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

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

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

dx = tx - sx
dy = ty - sy
path1 = 'U' * dy + 'R' * dx
path2 = 'D' * dy + 'L' * dx
path3 = 'L' + 'U' * (dy+1) + 'R' * (dx+1) + 'D'
path4 = 'R' + 'D' * (dy+1) + 'L' * (dx+1) + 'U'
print(path1 + path2 + path3 + path4)

Solution (Python):
import sys
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    sx, sy, tx, ty = map(int, readline().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)
if __name__ == '__main__':
    main()

Solution (Python):
import sys

stdin = sys.stdin
inf = 1 << 60
mod = 1000000007

sys.setrecursionlimit(10 ** 7)

ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

sx, sy, tx, ty = na()

ans = []
for i in range(abs(sx - tx)):
    ans.append('R')

for i in range(abs(sy - ty)):
    ans.append('U')

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

for i in range(abs(sy - ty)):
    ans.append('U')

for i in range(abs(sx - tx)):
    ans.append('R')

ans.append('U')

for i in range(abs(sx - tx) + 1):
    ans.append('L')

for i in range(abs(sy - ty) + 1):
    ans.append('D')

ans.append('R')

print(*ans, sep="")

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

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


print(m1+m2+"DR"+m1+"ULUL"+m2+"DR")

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

readline = sys.stdin.readline

def main():
    sx, sy, tx, ty = map(int, input().split())
    first = 'R'*(tx-sx) + 'U'*(ty-sy)
    second = 'L'*(tx-sx) + 'D'*(ty-sy)
    third = 'D' + 'R'*(tx-sx+1) + 'U'*(ty-sy+1) + 'L'
    forth = 'U' + 'L'*(tx-sx+1) + 'D'*(ty-sy+1) + 'R'
    ans = first + second + third + forth
    print(ans)

if __name__ == "__main__":
    main()

Solution (Python):

s_x, s_y, t_x, t_y = map(int, input().split())
ans = ""
ans += "R" * (t_x - s_x) + "U" * (t_y - s_y)
ans += "L" * (t_x - s_x) + "D" * (t_y - s_y)
ans += "D" + "R" * (t_x - s_x + 1) + "U" * (t_y - s_y + 1) + "L"
ans += "U" + "L" * (t_x - s_x + 1) + "D" * (t_y - s_y + 1) + "R"
print(ans)