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 = map(int, input().split())
    x = tx - sx
    y = ty - sy
    s = "R"*x + "U"*y
    s += s.translate(str.maketrans({"U": "D",
                                    "D": "U", "L": "R", "R": "L"}))
    tmp = "D" + "R"*(x+1) + "U"*(y+1) + "L"
    s += tmp + tmp.translate(str.maketrans({"U": "D",
                                            "D": "U", "L": "R", "R": "L"}))
    print(s)


if __name__ == "__main__":
    main()

Solution (Python):
def main():
    sx, sy, tx, ty = map(int, input().split())
    x = tx - sx
    y = ty - sy
    s = ""
    s += "R"*x
    s += "U"*y
    s += s.translate(str.maketrans({"U": "D",
                                    "D": "U", "L": "R", "R": "L"}))
    tmp = ""
    tmp += "D"
    tmp += "R"*(x+1)
    tmp += "U"*(y+1)
    tmp += "L"
    s += tmp + tmp.translate(str.maketrans({"U": "D",
                                            "D": "U", "L": "R", "R": "L"}))
    print(s)


if __name__ == "__main__":
    main()

Solution (Python):
def main():
    sx, sy, tx, ty = map(int, input().split())
    x = tx - sx
    y = ty - sy
    s = ""
    for i in range(2):
        tmp = ""
        if i:
            tmp += "D"
            tmp += "R"*(x+1)
            tmp += "U"*(y+1)
            tmp += "L"

        else:
            tmp += "R"*x
            tmp += "U"*y
        s += tmp + tmp.translate(str.maketrans({"U": "D",
                                                "D": "U", "L": "R", "R": "L"}))
    print(s)


if __name__ == "__main__":
    main()

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

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+'U'*-~y+'R'*-~x+'DR'+'D'*-~y+'L'*-~x+'U')

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

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

print(ans)

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

dx = tx - sx
dy = ty - sy

xdir = "R" if dx >= 0 else "L"
xdir_r = "L" if dx >= 0 else "R"
ydir = "U" if dy >= 0 else "D"
ydir_r = "D" if dy >= 0 else "U"

ans = ans_r = ""
ans_2 = ans_2_r = ""
ans += xdir * abs(dx) + ydir * abs(dy)
ans_r += xdir_r * abs(dx) + ydir_r * abs(dy)

ans_2 += ydir_r + xdir * (abs(dx) + 1) + ydir * (abs(dy) + 1) + xdir_r
ans_2_r += ydir + xdir_r * (abs(dx) + 1) + ydir_r * (abs(dy) + 1) + xdir
print(ans + ans_r + ans_2 + ans_2_r)

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

dx, dy = tx - sx, ty - sy

first = 'U' * dy + 'R' * dx
second = 'D' * dy + 'L' * dx
third = 'L' + 'U' * (dy + 1) + 'R' * (dx + 1) + 'D'
forth = 'R' + 'D' * (dy + 1) + 'L' * (dx + 1) + 'U'

print(first + second + third + forth)

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(*ans, sep='')

Solution (Python):
sx,sy,gx,gy = list(map(int,input().split()))
dx,dy=gx-sx,gy-sy
out = []
out.append("R"*dx)
out.append("U"*dy)
out.append("L"*dx)
out.append("D"*dy)
out.append("D")
out.append("R"*(dx+1))
out.append("U"*(dy+1))
out.append("L")
out.append("U")
out.append("L"*(dx+1))
out.append("D"*(dy+1))
out.append("R")
print("".join(out))

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

print(st1 + ts1 + st2 + ts2)

Solution (Python):
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())
ans = ''
if sx > tx:
    R = 'L'
    L = 'R'
else:
    R = 'R'
    L = 'L'
if sy > ty:
    U = 'D'
    D = 'U'
else:
    U = 'U'
    D = 'D'
if sx == tx:
    ans += U * (abs(ty-sy))
    ans += L
    ans += D * (abs(ty-sy))
    ans += R * 2
    ans += U * (abs(ty-sy))
    ans += L
    ans += U
    ans += R * 2
    ans += D * (abs(ty-sy)+2)
    ans += L * 2
    ans += U
elif sy == ty:
    ans += R * (abs(tx-sx))
    ans += U
    ans += L * (abs(tx-sx))
    ans += D * 2
    ans += R * (abs(tx-sx))
    ans += U
    ans += R
    ans += D * 2
    ans += L * (abs(tx-sx)+2)
    ans += U * 2
    ans += R
else:
    ans += U * (abs(ty-sy))
    ans += R * (abs(tx-sx))
    ans += U
    ans += L * (abs(tx-sx)+1)
    ans += D * (abs(ty-sy)+1)
    ans += R * (abs(tx-sx)+1)
    ans += U * (abs(ty-sy))
    ans += R
    ans += D * (abs(ty-sy)+1)
    ans += L * (abs(tx-sx)+1)
    ans += U
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+1-sy)+'R'*(tx+1-sx)+'D'+'R'+'D'*(ty+1-sy) \
      +'L'*(tx+1-sx)+'U')

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

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

x=tx-sx
y=ty-sy
ans=[]
for i in range(y):
    ans.append("U")
for i in range(x):
    ans.append("R")
for i in range(y):
    ans.append("D")
for i in range(x+1):
    ans.append("L")
for i in range(y+1):
    ans.append("U")
for i in range(x+1):
    ans.append("R")
ans.append("D")
ans.append("R")
for i in range(y+1):
    ans.append("D")
for i in range(x+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
print('R'*x+'U'*y+'L'*x+'D'*(y+1)+'R'*(x+1)+'U'*(y+1)+'L'+'U'+'L'*(x+1)+'D'*(y+1)+'R')

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

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

    
    ans += "U" * gapy
    ans += "R" * gapx
    ans += "D" * gapy
    ans += "L" * gapx

    
    ans += "L"
    ans += "U" * (gapy + 1)
    ans += "R" * (gapx + 1)
    ans += "D"
    ans += "R"
    ans += "D" * (gapy + 1)
    ans += "L" * (gapx + 1)
    ans += "U"

    print(ans) 


if __name__ == "__main__":
    main()

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

ans = []

if tx > sx:
    ans.append('R'*(tx-sx))     
    ans.append('L'*(tx-sx))     
    ans.append('R'*(tx-sx+1))   
    ans.append('L')             
    ans.append('L'*(tx-sx+1))   
    ans.append('R')             
else:
    ans.append('L'*(sx-tx))     
    ans.append('R'*(sx-tx))     
    ans.append('L'*(sx-tx+1))   
    ans.append('R')             
    ans.append('R'*(sx-tx+1))   
    ans.append('L')             

if ty > sy:
    ans.insert(1,'U'*(ty-sy))   
    ans.insert(3,'D'*(ty-sy))   
    ans.insert(4,'D')           
    ans.insert(6,'U'*(ty-sy+1)) 
    ans.insert(8,'U')           
    ans.insert(10,'D'*(ty-sy+1))
else:
    ans.insert(1,'D'*(sy-ty))   
    ans.insert(3,'U'*(sy-ty))   
    ans.insert(4,'U')           
    ans.insert(6,'D'*(sy-ty+1)) 
    ans.insert(8,'D')           
    ans.insert(10,'U'*(sy-ty+1))

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

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

tx_sx = tx - sx
ty_sy = ty - sy


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 += "DR"

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

dx = tx - sx
dy = ty - sy

route1 = 'R' * dx + 'U' * dy
route2 = 'L' * dx + 'D' * dy
route3 = 'L' + 'U' * (dy + 1) + 'R' * (dx + 1) + 'D'
route4 = 'R' + 'D' * (dy + 1) + 'L' * (dx + 1) + 'U'

ans = route1 + route2 + route3 + route4
print(ans)

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

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

print(ans)

Solution (Python):
import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def main():
    sx, sy, tx, ty = LI()
    tx -= sx
    ty -= sy
    x = abs(tx)
    y = abs(ty)
    r,l,u,d = "r","l","u","d"
    ans = ""

    if tx != 0 and ty != 0:
        ans = r*x+u*y+l*x+d*(y+1)+r*(x+1)+u*(y+1)+l+u+l*(x+1)+d*(y+1)+r

        if tx<0:
            ans = ans.replace(r, "L")
            ans = ans.replace(l, "R")
        if ty<0:
            ans = ans.replace(u,"D")
            ans = ans.replace(d,"U")
            
        ans = ans.upper()
        
    else:
        x = max(x,y)
        ans = r*x+u+l*x+d*2+r*x+u+r+u*2+l*(x+2)+d*2+r

        if ty>0:
            ans = ans.replace(r,"U").replace(l,"D").replace(u,"L").replace(d,"R")
        elif tx<0:
            ans = ans.replace(r,"L").replace(l,"R")
        elif ty<0:
            ans = ans.replace(r,"D").replace(l,"U").replace(u,"R").replace(d,"L")
        ans = ans.upper()

    print(ans)
main()

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

Solution (Python):
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    sx, sy, tx, ty = LI()

    dx = tx - sx
    dy = ty - sy
    ans_f0 = 'U' * dy + 'R' * dx
    ans_b0 = 'D' * dy + 'L' * dx
    ans_f1 = 'L' + 'U' * (dy + 1) + 'R' * (dx + 1) + 'D'
    ans_b1 = 'R' + 'D' * (dy + 1) + 'L' * (dx + 1) + 'U'

    print(ans_f0 + ans_b0 + ans_f1 + ans_b1)

if __name__ == '__main__':
    resolve()

Solution (Python):
import math
from math import gcd,pi,sqrt
INF = float("inf")

import sys
sys.setrecursionlimit(10**6)
import itertools
from collections import Counter,deque
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]


def main():
    sx,sy,ex,ey = i_map()

    fp = "U"*(ey-sy)
    fr = "R"*(ex-sx)
    fd = "D"*(ey-sy)
    fl = "L"*(ex-sx)
    f = fp+fr+fd+fl

    fl = "L"
    sp = "U"*(ey-sy+1)
    fr = "R"*(ex-sx+1)
    fd = "D"
    sr = "R"
    sd = "D"*(ey-sy+1)
    sl = "L"*(ex-sx+1)
    p = "U"
    s = fl+sp+fr+fd+sr+sd+sl+p

    print(f+s)











if __name__=="__main__":
    main()

Solution (Python):
import sys



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


def input_int():
    return int(input())


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


def main():
    sx, sy, tx, ty = input_int_list()
    dx, dy = tx - sx, ty - sy
    ans = "R" * dx + "U" * dy + "L" * dx + "D" * dy + "L" + "U" * (dy + 1) + "R" * (dx + 1) + "DR" + "D" * (dy + 1) + "L" * (dx + 1) + "U"
    print(ans)
    return


if __name__ == "__main__":
    main()

Solution (Python):
import sys
from sys import exit
from collections import deque
from bisect import bisect_left, bisect_right, insort_left, insort_right
from heapq import heapify, heappop, heappush
from itertools import product, permutations, combinations, combinations_with_replacement
from functools import reduce
from math import gcd, sin, cos, tan, asin, acos, atan, degrees, radians

sys.setrecursionlimit(10**6)
INF = 10**20
eps = 1.0e-20
MOD = 10**9+7

def lcm(x,y):
    return x*y//gcd(x,y)
def lgcd(l):
    return reduce(gcd,l)
def llcm(l):
    return reduce(lcm,l)
def powmod(n,i,mod):
    return pow(n,mod-1+i,mod) if i<0 else pow(n,i,mod)
def div2(x):
    return x.bit_length()
def div10(x):
    return len(str(x))-(x==0)
def perm(n,mod=None):
    ans = 1
    for i in range(1,n+1):
        ans *= i
        if mod!=None:
            ans %= mod
    return ans
def intput():
    return int(input())
def mint():
    return map(int,input().split())
def lint():
    return list(map(int,input().split()))
def ilint():
    return int(input()), list(map(int,input().split()))
def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1])
def lprint(l, sep='\n'):
    for x in l:
        print(x, end=sep)
def ston(c, c0='a'):
    return ord(c)-ord(c0)
def ntos(x, c0='a'):
    return chr(x+ord(c0))
class counter(dict):
    def __init__(self, *args):
        super().__init__(args)
    def add(self,x,d=1):
        self.setdefault(x,0)
        self[x] += d
    def list(self):
        l = []
        for k in self:
            l.extend([k]*self[k])
        return l
class comb():
    def __init__(self, n, mod=None):
        self.l = [1]
        self.n = n
        self.mod = mod
    def get(self,k):
        l,n,mod = self.l, self.n, self.mod
        k = n-k if k>n//2 else k
        while len(l)<=k:
            i = len(l)
            l.append(l[i-1]*(n+1-i)//i if mod==None else (l[i-1]*(n+1-i)*powmod(i,-1,mod))%mod)
        return l[k]
def pf(x):
    C = counter()
    p = 2
    while x>1:
        k = 0
        while x%p==0:
            x //= p
            k += 1
        if k>0:
            C.add(p,k)
        p = p+2-(p==2) if p*p<x else x
    return C

sx,sy,tx,ty=mint()
ans=[]
dx,dy=tx-sx,ty-sy
R,L,U,D='R','L','U','D'
ans.extend([R]*dx)
ans.extend([U]*dy)
ans.extend([L]*dx)
ans.extend([D]*(dy+1))
ans.extend([R]*(dx+1))
ans.extend([U]*(dy+1))
ans.extend([L,U])
ans.extend([L]*(dx+1))
ans.extend([D]*(dy+1))
ans.extend([R])
lprint(ans,'')

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

Solution (Python):

sx, sy, tx, ty = [int(i) for i in input().split()]

dx = tx - sx
dy = ty - sy


r1 = 'U' * dy + 'R' * dx


r2 = 'D' * dy + 'L' * dx


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


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

print(r1 + r2 + r3 + r4)

Solution (Python):
sx,sy,tx,ty = map(int,input().split())
ans = []
ans_out2 = ["D"]
ans_re2 = ["U"]

def solve(sx,sy,tx,ty):
    for i in range(tx-sx):
        ans.append("R")
    for i in range(ty-sy):
        ans.append("U")
    for i in range(tx-sx):
        ans.append("L")
    for i in range(ty-sy):
        ans.append("D")

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

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

    list = ans+ans_out2+ans_re2

    return list
  
ans_list = solve(sx,sy,tx,ty)
    
for i in range(len(ans_list)):
    print(ans_list[i],end="")

Solution (Python):
def addRoute(i, c):
  t = ''
  for _ in range(i):
    t += c
  return t

pos=list(map(int, input().split()))
ud = pos[3] - pos[1]
rl = pos[2] - pos[0]
s = ''

s += addRoute(ud, 'U')
s += addRoute(rl, 'R')
s += addRoute(ud, 'D')
s += addRoute(rl, 'L')
s += 'L'
s += addRoute(ud+1, 'U')
s += addRoute(rl+1, 'R')
s += 'DR'
s += addRoute(ud+1, 'D')
s += addRoute(rl+1, 'L')
s += 'U'
print(s)

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

Solution (Python):

url = "https://atcoder.jp//contests/abc051/tasks/abc051_c"
def search_route(f, t):
    route = ''
    y = t[1] - f[1]
    tmp_y = 'U'*y if y >= 0 else 'D'*(y*-1)
    x = t[0] - f[0]
    tmp_x = 'R'*x if x >= 0 else 'L'*(x*-1)
    route = tmp_y + tmp_x
    return route


def main():
    t = list(map(int, input().split()))
    route = search_route(t[:2], t[2:]) + search_route(t[2:], t[:2])
    tmp = t[:]
    t[0] -= 1
    t[3] += 1
    route_2 = 'L' + search_route(t[:2], t[2:]) + 'D'
    t = tmp
    t[1] -= 1
    t[2] += 1
    route_2 = route_2 + 'R' + search_route(t[2:], t[:2]) + 'U'

    print(route+route_2)


if __name__ == '__main__':
    main()

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

w = tx - sx
h = ty - sy

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

print(*ans)

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

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

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

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

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

first = "U"*(ty-sy) + "R"*(tx-sx)
second = "D"*(ty-sy) + "L"*(tx-sx)
third = "L" + "U"*(ty-sy+1) + "R"*(tx-sx+1) + "D"
fourth = "R" + "D"*(ty-sy+1) + "L"*(tx-sx+1) + "U"

print(first+second+third+fourth)

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

higth = ty - sy
width = tx - sx

ans = ''
ans += 'U' * higth
ans += 'R' * width
ans += 'D' * higth
ans += 'L' * width
ans += 'L' + 'U' * (higth + 1)
ans += 'R' * (width + 1) + 'D'
ans += 'R' + 'D' * (higth + 1)
ans += 'L' * (width + 1) + 'U'
print(ans)

Solution (Python):
xy = list(map(int, input().split()))
print("U"*(xy[3]-xy[1]) + "R"*(xy[2]-xy[0]) + "D"*(xy[3]-xy[1]) + "L"*(xy[2]-xy[0]+1) + "U"*(xy[3]-xy[1]+1) + "R"*(xy[2]-xy[0]+1) + "D" + "R"+ "D"*(xy[3]-xy[1]+1) + "L"*(xy[2]-xy[0]+1) + "U")

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

Solution (Python):



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

"""
方針
sx < tx , sy < tyなので
進路としては
1sx,syから右にtx,syまで移動後上にtx,tyまで移動
2tx,tyから左にsx,tyまで移動後下にsx,syまで移動
3下に1移動、右にtx+1,sy-1まで移動、上にtx+1,tyまで移動、左に1移動
4上に1移動、左にsx-1,ty+1まで移動、下にsx-1,syまで移動、右に1移動

"""

up = 'U'
down = 'D'
left = 'L'
right = 'R'

def solve(sx, sy, tx, ty):
    deltax = tx - sx
    deltay = ty - sy
    movelog = ''
    movelog += up * deltay + right * deltax
    movelog += down * deltay + left * deltax
    movelog += down + right * (deltax + 1) + up * (deltay + 1) + left
    movelog += up + left * (deltax + 1) + down * (deltay + 1) + right

    return movelog

if __name__ == "__main__":
    main()

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

Ans1 = []
Ans2 = []
dx = tx - sx
dy = ty - sy
cnt = abs(dx) + abs(dy)
if dy > 0:
    for i in range(dy):
        Ans1.append("U")
        Ans2.append("D")
else:
    for i in range(-dy):
        Ans1.append("D")
        Ans2.append("U")
if dx > 0:
    for i in range(dx):
        Ans1.append("R")
        Ans2.append("L")
else:
    for i in range(-dx):
        Ans1.append("L")
        ANs2.append("R")

add1 = ["L","U"]
add2 = ["R","D"]

print("".join(Ans1) ,end="")
print("".join(Ans2) ,end="")

if Ans1[0] == "U":
    print("".join(add1),end="")
    print("".join(Ans1) ,end="")
    print("".join(add2),end = "")
    print("".join(add2),end="")
    print("".join(Ans2) ,end="")
    print("".join(add1))
else:
    print("".join(add2),end="")
    print("".join(Ans1) ,end="")
    print("".join(add1),end="")
    print("".join(add1),end="")
    print("".join(Ans2) ,end="")
    print("".join(add2))

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

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


for _ in range(sx, tx):
    print('R', end='')
for _ in range(sy, ty):
    print('U', end='')


for _ in range(sx, tx):
    print('L', end='')
for _ in range(sy, ty):
    print('D', end='')


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


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

Solution (Python):
p,q,x,y=map(int,input().split())
x-=p
y-=q
u='U'*y+'R'*x
d='D'*y+'L'*x+'LU'
print(u+d+u+'RDRD'+d)

Solution (Python):
p,q,x,y=map(int,input().split())
x-=p
y-=q
print('U'*y+'R'*x+'D'*y+'L'*x+'L'+'U'*-~y+'R'*-~x+'D'+'R'+'D'*-~y+'L'*-~x+'U')

Solution (Python):
p,q,r,s=map(int,input().split())
x=r-p
y=s-q
uy='U'*y
print(uy+'R'*x+'D'*y+'L'*x+'L'+uy+'U'+'R'*(x+1)+'D'+'R'+'D'*(y+1)+'L'*(x+1)+'U')

Solution (Python):
p,q,r,s=map(int,input().split())
x=r-p
y=s-q
print('U'*y+'R'*x+'D'*y+'L'*x+'L'+'U'*(y+1)+'R'*(x+1)+'D'+'R'+'D'*(y+1)+'L'*(x+1)+'U')

Solution (Python):
SX,SY,TX,TY=map(int,input().split())
x=TX-SX
y=TY-SY
print(''.join(['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())
vx=TX-SX
vy=TY-SY
print('U'*vy+'R'*vx+'D'*vy+'L'*vx+'L'+'U'*(vy+1)+'R'*(vx+1)+'D'+ 'R'+'D'*(vy+1)+'L'*(vx+1)+'U')

Solution (Python):
SX,SY,TX,TY=map(int,input().split())
dt={'U':'D','D':'U','L':'R','R':'L'}
def f(s):
 t=''
 for a in s:t+=dt[a]
 return t

vx=TX-SX
vy=TY-SY

ans1='U'*vy+'R'*vx
ans1+=f(ans1)
ans2='L'+'U'*(vy+1)+'R'*(vx+1)+'D'
ans2+=f(ans2)

print(ans1+ans2)

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

dt={'U':'D','D':'U','L':'R','R':'L'}

def f(s):
    t=''
    for a in s:
        t+=dt[a]
    return t

vx=TX-SX
vy=TY-SY

ans1=''
ans1=('U' if 0<=vy else 'D')*abs(vy)
ans1+=('R' if 0<=vx else 'L')*abs(vx)
ans1+=f(ans1)

ans2=''
ans2=('R' if 0<=-vx else 'L')
ans2+=('U' if 0<=vy else 'D')*abs(vy+1)
ans2+=('R' if 0<=vx else 'L')*abs(vx+1)
ans2+=('U' if 0<=-vy else 'D')
ans2+=f(ans2)
print(ans1+ans2)

Solution (Python):
A,B,C,D = map(int,input().split())
XX = C - A
YY = D - B
if XX >= 0:
  ans1 = 'R'*XX
  ans11 = 'L'*XX
elif XX < 0:
  ans1 = 'L'*abs(XX)
  ans11 = 'R'*abs(XX)
if YY >= 0:
  ans2 = 'U'*YY
  ans22 = 'D'*YY
elif YY < 0:
  ans2 = 'D'*abs(YY)
  ans22 = 'U'*abs(YY)
ans3 = ans1 + ans2
ans4 = ans11 + ans22

if XX >= 0 and YY >= 0:
  ans5 = 'L'+ ans2 +'U' +'R' + ans1 +'D'
  ans55 = 'R' + ans22 + 'D' + 'L' + ans11 + 'U'
elif XX < 0 and YY >= 0:
  ans5 = 'R' + ans2 + 'U' + 'L' + ans1 + 'D'
  ans55 = 'L' + ans22 + 'D' + 'R' + ans11 + 'U'
elif XX >=0 and YY <0:
  ans5 = 'L' + ans2 + 'D' + 'R' + ans1 +'U'
  ans55 = 'R' + ans22 + 'U' + 'L' + ans11 + 'D'
else:
  ans5 = 'R' + ans2 +'D' + 'L' + ans1 + 'U'
  ans55 = 'L' + ans22 + 'U' + 'R' + ans11 + 'D'
print(ans3+ans4+ans5+ans55)

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

moves = ''


moves += 'U' * dy
moves += 'R' * dx

moves += 'D' * dy
moves += 'L' * dx


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


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

print(moves)

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

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

for _ in range(yoko):
    print("R", end="")
for _ in range(tate):
    print("U", end="")
for _ in range(yoko):
    print("L", end="")
for _ in range(tate):
    print("D", end="")


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

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

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

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

    dy = ty - sy
    dx = tx - sx

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

    print(cmd)

if __name__ == "__main__":
    main()

Solution (Python):
import sys, re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left, bisect_right
from functools import reduce
from decimal import Decimal, getcontext

def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []

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

    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('D', end='')
    print('R', end='')
    
    for _ in range(ty-sy+1):
        print('D', end='')

    for _ in range(tx-sx+1):
        print('L', end='')

    print('U', end='')

    print()

if __name__ == '__main__':
    main()

Solution (Python):
sx,sy,tx,ty=map(int,input().split())
xdiff=tx-sx
ydiff=ty-sy
move=[]
move.append("D")
move+="R"*(xdiff+1)
move+="U"*(ydiff+1)
move+="L"
move+="U"
move+="L"*(xdiff+1)
move+="D"*(ydiff+1)
move+="R"
move+="R"*xdiff
move+="U"*ydiff
move+="L"*xdiff
move+="D"*ydiff
print(*move,sep="")