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(dy):
    ans+="U"
for j in range(dx):
    ans+="R"
for i in range(dy):
    ans+="D"
for j in range(dx):
    ans+="L"
ans+="L"
for i in range(dy+1):
    ans+="U"
for i in range(dx+1):
    ans+="R"
ans+="DR"
for i in range(dy+1):
    ans+="D"
for i in range(dx+1):
    ans+="L"
ans+="U"
print(ans)

Solution (Python):
x1,y1,x2,y2=map(int,input().split())
ans=""
ans+="U"*(y2-y1)
ans+="R"*(x2-x1)
ans+="D"*(y2-y1)
ans+="L"*(x2-x1)
ans+="L"
ans+="U"*(y2+1-y1)
ans+="R"*(x2+1-x1)
ans+="D"
ans+="R"
ans+="D"*(y2+1-y1)
ans+="L"*(x2+1-x1)
ans+="U"
print(ans)

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

ans = ''
if sy < ty:
  v = 'U' * (ty-sy)
  if sx < tx:
    h = 'R' * (tx-sx)
    ans += v + h
    v = 'D' * (ty-sy)
    h = 'L' * (tx-sx)
    ans += v + h
  else:
    h = 'L' * (tx-sx)
    ans += v + h
    v = 'D' * (ty-sy)
    h = 'R' * (tx-sx)
    ans += v + h
else:
  v = 'D' * (sy-ty)
  if sx < tx:
    h = 'R' * (tx-sx)
    ans += v + h
    v = 'U' * (ty-sy)
    h = 'L' * (tx-sx)
    ans += v + h
  else:
    h = 'L' * (tx-sx)
    ans += v + h
    v = 'U' * (ty-sy)
    h = 'R' * (tx-sx)
    ans += v + h
  
if sy < ty:
  v = 'U' * (ty-sy+1)
  if sx < tx:
    h = 'R' * (tx-sx+1)
    ans += 'L' + v + h + 'D'
    v = 'D' * (ty-sy+1)
    h = 'L' * (tx-sx+1)
    ans += 'R' + v + h + 'U'
  else:
    h = 'L' * (tx-sx+1)
    ans += 'R' + v + h + 'D'
    v = 'D' * (ty-sy+1)
    h = 'R' * (tx-sx+1)
    ans += 'L' + v + h + 'U'
else:
  v = 'D' * (sy-ty+1)
  if sx < tx:
    h = 'R' * (tx-sx+1)
    ans += 'L' + v + h + 'U'
    v = 'U' * (ty-sy+1)
    h = 'L' * (tx-sx+1)
    ans += 'R' + v + h + 'D'
  else:
    h = 'L' * (tx-sx+1)
    ans += 'R' + v + h + 'U'
    v = 'U' * (ty-sy+1)
    h = 'R' * (tx-sx+1)
    ans += 'L' + v + h + 'D'
print(ans)

Solution (Python):
import sys
def MI(): return map(int,sys.stdin.readline().rstrip().split())

a,b,c,d = MI()
x,y = c-a,d-b
ANS = ['R']*x + ['U']*y + ['L']*x + ['D']*(y+1) + ['R']*(x+1) + ['U']*(y+1) + ['L'] + ['U'] + ['L']*(x+1) + ['D']*(y+1) + ['R']
print(''.join(ANS))

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

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

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

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

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

print()

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

Solution (Python):
sx, sy, tx, ty = [int(w) for w in input().split()]
dx = tx-sx
dy = ty-sy
first = "U"*dy+"R"*dx+"D"*dy+"L"*dx
second = "L"+"U"*(dy+1)+"R"*(dx+1)+"D" +\
         "R"+"D"*(dy+1)+"L"*(dx+1)+"U"

print(first+second)

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

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

out = []
dx = tx - sx
dy = ty - sy
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' * 1)
print(''.join(out))

Solution (Python):
sx, sy , tx , ty = map(int , input().split())
dx = tx-sx
dy= ty-sy
now = ""
for i in range(0 ,dy):
	now= now+'U'
for i in range(0 , dx):
	now = now+'R'

for i in range(0 , dy):
	now = now+'D'
for i in range(0 , dx):
	now = now+'L'

now = now+'L'
for i in range(0 , dy+1):
	now = now+'U'
for i in range(0 , dx+1):
	now = now+'R'
now = now+'D'

now = now+'R'
for i in range(0 , dy+1):
	now = now+'D'
for i in range(0 , dx+1):
	now = now+'L'
now = now+'U'
print(now)

Solution (Python):
def main():
    import sys

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

    sx, sy, tx, ty = map(int, input().split())
    direction = ['U', 'R', 'D', 'L']
    path = ['']*4
    def inverse(s):
        ret = ''
        for x in s:
            if x == 'U':
                ret += 'D'
            if x == 'R':
                ret += 'L'
            if x == 'D':
                ret += 'U'
            if x == 'L':
                ret += 'R'
        return ret

    path[0] = 'R'*(tx-sx)+'U'*(ty-sy)
    path[2] = 'L'+'U'*(ty-sy+1)+'R'*(tx-sx+1)+'D'
    path[1] = inverse(path[0])
    path[3] = inverse(path[2])
    print(''.join(path))
    
        
    
if __name__ == '__main__':
    main()

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

print(ans)

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

x_diff = tx-sx
y_diff = ty-sy

up = 'U'*abs(y_diff)
down = 'D'*abs(y_diff)
left = 'L'*abs(x_diff)
right = 'R'*abs(x_diff)

ans = right+up+left+down
ans = ans+'DR'+right+up+'UL'+'UL'+left+down+'DR'

print(ans)

Solution (Python):
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


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

    S = [0] * 4
    S[0] = 'U' * (ty - sy + 1)
    S[1] = 'R' * (tx - sx + 1)
    S[2] = 'D' * (ty - sy + 1)
    S[3] = 'L' * (tx - sx + 1)
    S = ''.join(S)

    ans = ''.join([S[1:], S[:1], S[-1:], S[:-1]])
    print(ans)

    return


if __name__ == '__main__':
    main()

Solution (Python):

import sys
from collections import deque, defaultdict
from math import sqrt, factorial, gcd, ceil, atan, pi



import string

from bisect import bisect_left
MOD = int(1e9)+7
INF = float('inf')


def solve():
    
    a,b,x,y = [int(x) for x in input().split()]

    r = x - a
    u = y - b

    ans = ''

    ans += 'D'
    ans += 'R' * (r + 1)
    ans += 'U' * (u + 1)
    ans += 'L'
    ans += 'D' * u
    ans += 'L' * r

    ans += 'L'
    ans += 'U' * (u + 1)
    ans += 'R' * (r + 1)
    ans += 'D'
    ans += 'L' * r
    ans += 'D' * u

    print(ans)

t = 1

for case in range(1,t+1):
    ans = solve()


"""

azyxwvutsrqponmlkjihgfedcb

"""

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


    print(move)



if __name__ == '__main__':
    main()

Solution (Python):
A, B, X, Y = map(int, input().split())
P = X-A
Q = Y-B
print("R"*P+"U"*Q+"L"*P+"D"*Q+"L"+"U"*(Q+1)+"R"*(P+1)+"D"+\
"R"+"D"*(Q+1)+"L"*(P+1)+"U")

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

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

print(moji)

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):
import sys
sys.setrecursionlimit(10 ** 5)




readline = sys.stdin.readline

def process():
    sx, sy, tx, ty = map(int, readline().rstrip().split())
    dx = tx-sx
    dy = ty-sy

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

    return ans


print(process())

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

dx=tx-sx
dy=ty-sy
d={0:'R', 1:'U', 2:'L', 3:'D'}
dirc=[dx,dy,dx,dy]

def path(sign,x,y,z,w):
  return d[sign+1]*abs(z-x) + d[sign+2]*abs(y-w)

s=''
s+='R'
s+=path(-1, sx+1, sy, tx, ty-1)
s+='UU'
s+=path(1, tx,ty+1,sx-1,sy)
s+='RD'
s+=path(-1, sx,sy-1,tx+1,ty)
s+='LL'
s+=path(1, tx-1,ty,sx,sy+1)
s+='D'
print(s)

Solution (Python):
def resolve():
    sx, sy, tx, ty = [int(i) for i in input().split()]
    x = tx - sx
    y = ty - sy
    print("U" * y, "R" * x, sep="", end="")
    print("D" * y, "L" * x, sep="", end="")
    print("L", "U" * y, "U", "R" * x, "RD", sep="", end="")
    print("R", "D" * y, "DL", "L" * x, "U", sep="", end="")
    print()

resolve()

Solution (Python):


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


route_x = tx - sx
route_y = ty - sy
print('U' * route_y, end='') 
print('R' * route_x, end='') 


print('D' * route_y, end='') 
print('L' * route_x, end='') 


print('L', end='') 
print('U' * (route_y + 1), end='') 
print('R' * (route_x + 1), end='') 
print('D', end='') 


print('R', end='') 
print('D' * (route_y + 1), end='') 
print('L' * (route_x + 1), end='') 
print('U', end='')

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 9)

def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print(k.join(list(map(str, lst))))
INF = float('inf')

from collections import deque





def solve():
    sx, sy, tx, ty = MI()

    ans = deque([])
    
    ans.extend(['U']*abs(ty - sy))
    ans.extend(['R']*abs(tx - sx))

    
    ans.extend(['D']*abs(ty - sy))
    ans.extend(['L']*abs(tx - sx))

    
    ans.extend(['L'])
    ans.extend(['U']*(abs(ty - sy)+1))
    ans.extend(['R']*(abs(tx - sx)+1))
    ans.extend(['D'])

    
    ans.extend(['R'])
    ans.extend(['D'] * (abs(ty - sy)+1))
    ans.extend(['L'] * (abs(tx - sx)+1))
    ans.extend(['U'])

    
    printlist(ans, '')


if __name__ == '__main__':
    solve()

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 9)

def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print(k.join(list(map(str, lst))))
INF = float('inf')







def solve():
    sx, sy, tx, ty = MI()

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

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

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

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

    print(ans)

if __name__ == '__main__':
    solve()

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 9)

def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print(k.join(list(map(str, lst))))
INF = float('inf')

from collections import deque


import numpy as np    


def solve():
    sx, sy, tx, ty = MI()

    ans = deque([])
    
    ans.extend(['U']*abs(ty - sy))
    ans.extend(['R']*abs(tx - sx))

    
    ans.extend(['D']*abs(ty - sy))
    ans.extend(['L']*abs(tx - sx))

    
    ans.extend(['L'])
    ans.extend(['U']*(abs(ty - sy)+1))
    ans.extend(['R']*(abs(tx - sx)+1))
    ans.extend(['D'])

    
    ans.extend(['R'])
    ans.extend(['D'] * (abs(ty - sy)+1))
    ans.extend(['L'] * (abs(tx - sx)+1))
    ans.extend(['U'])

    
    printlist(ans, '')


if __name__ == '__main__':
    solve()

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

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

s = ''
for _ in range(ty - sy):
    s += 'U'

for _ in range(tx - sx):
    s += 'R'

for _ in range(ty - sy):
    s += 'D'

for _ in range(tx - sx):
    s += 'L'

s += 'L'

for _ in range(ty - sy + 1):
    s += 'U'

for _ in range(tx - sx + 1):
    s += 'R'

s += 'DR'

for _ in range(ty - sy + 1):
    s += 'D'

for _ in range(tx - sx + 1):
    s += 'L'

s += 'U'

print(s)

Solution (Python):
sx,sy,gx,gy = (int(x) for x in input().split())
ans = ''
if sx < gx and sy < gy:
  ans += 'R'*(gx-sx) + 'U'*((gy-sy)+1) + 'L'*((gx-sx)+1) + 'D'*((gy-sy)+1) + 'R'
  ans += 'D' + 'R'*((gx-sx)+1) + 'U'*((gy-sy)+1) + 'L'*((gx-sx)+1) + 'D'*(gy-sy)
elif sx < gx and sy > gy:
  ans += 'R'*(gx-sx) + 'U'*((gy-sy)+1) + 'L'*((gx-sx)+1) + 'D'*((gy-sy)+1) + 'R'
print (ans)

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

dx = tx - sx
dy = ty - sy
d1 = ['U']*dy + ['R']*dx
d2 = ['D']*dy + ['L']*dx
d3 = ['L'] + ['U']*(dy+1) + ['R']*(dx+1) + ['D']
d4 = ['R'] + ['D']*(dy+1) + ['L']*(dx+1) + ['U']

print(''.join(d1+d2+d3+d4))

Solution (Python):
from math import ceil,floor,comb,factorial,gcd,pow,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from copy import deepcopy
from time import time
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

sx, sy, tx, ty = MAP()
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')

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

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

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

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

print(ans)

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

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

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


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

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

for i in range(len(ans)):
  print(ans[i], end="")

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

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

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

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

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

Solution (Python):
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_nl = lambda: list(map(int, readline().split()))
in_na = lambda: map(int, read().split())
in_s = lambda: readline().rstrip().decode('utf-8')


def main():
    x1, y1, x2, y2 = in_nn()

    ans = 'R' * (x2 - x1) + 'U' * (y2 - y1)
    ans += 'L' * (x2 - x1) + 'D' * (y2 - y1)
    ans += 'L'
    ans += 'U' * (y2 - y1 + 1) + 'R' * (x2 - x1 + 1)
    ans += 'D'
    ans += 'R'
    ans += 'D' * (y2 - y1 + 1) + 'L' * (x2 - x1 + 1)
    ans += 'U'

    print(ans)


if __name__ == '__main__':
    main()

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


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

print(ans)

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

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

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

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

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

for i in range(ty - sy + 1):
    print("U", end = "")

for i in range(tx - sx + 1):
    print("R", end = "")

print("DR", end = "")

for i in range(ty - sy + 1):
    print("D", end = "")

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

print("U", end = "")

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())
dx = tx - sx
dy = ty - sy

if dx == 0:
    if dy > 0:
        d1 = "U"
        d2 = "D"
    else:
        d1 = "D"
        d2 = "U"
    dy = abs(dy)
    ans = d1 * dy
    ans += "R" + d2 * dy + "L"
    ans += "L" + d1 * dy + "R"
    ans += d1 + "RR" + d2 * (dy + 2) + "LL" + d1
    print(ans)
    
elif dy == 0:
    if dx > 0:
        d1 = "R"
        d2 = "L"
    else:
        d1 = "L"
        d2 = "R"
    dx = abs(dx)
    ans = d1 * dx
    ans += "U" + d2 * dx + "D"
    ans += "D" + d1 * dx + "U"
    ans += d1 + "UU" + d2 * (dx + 2) + "DD" + d1
    print(ans)

else:
    if dy > 0:
        d1 = "U"
        d2 = "D"
    else:
        d1 = "D"
        d2 = "U"
    if dx > 0:
        d3 = "R"
        d4 = "L"
    else:
        d3 = "L"
        d4 = "R"
    dx = abs(dx)
    dy = abs(dy)
    ans = d1 * dy + d3 * dx
    ans += d2 * dy + d4 * dx
    ans += d4 + d1 * (dy + 1) + d3 * (dx + 1) + d2
    ans += d3 + d2 * (dy + 1) + d4 * (dx + 1) + d1
    print(ans)

Solution (Python):

import sys


def solve(sx: int, sy: int, tx: int, ty: int):
    ans = []
    ans.append("R"*(tx-sx))
    ans.append("U"*(ty-sy))
    ans.append("L"*(tx-sx))
    ans.append("D"*(ty-sy+1))
    ans.append("R"*(tx-sx+1))
    ans.append("U"*(ty-sy+1))
    ans.append("L")
    ans.append("U")
    ans.append("L"*(tx-sx+1))
    ans.append("D"*(ty-sy+1))
    ans.append("R")
    return "".join(ans)


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    sx = int(next(tokens))  
    sy = int(next(tokens))  
    tx = int(next(tokens))  
    ty = int(next(tokens))  
    print(solve(sx, sy, tx, ty))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    
    main()

Solution (Python):
a,b,c,d=map(int,input().split())
x=c-a
y=d-b
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):
    ans.append("L")
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):
def main():
    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)


if __name__ == '__main__':
    main()

Solution (Python):
sx,sy,gx,gy=map(int,input().split())
s,t,u,v='','','DR','UL'
for i in range(gx-sx):
  s+='R'
  t+='L'
  u+='R'
  v+='L'
u+='U'
v+='D'
for i in range(gy-sy):
  s+='U'
  t+='D'
  u+='U'
  v+='D'
print(s+t+u+'L'+v+'R')

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

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

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

W = abs(sx-tx)
H = abs(sy-ty)
ans = ""

for i in range(W):
    ans += "R"
for i in range(H+1):
    ans += "U"
for i in range(W+1):
    ans += "L"
for i in range(H+1):
    ans += "D"
ans += "R"

for i in range(H):
    ans += "U"
for i in range(W+1):
    ans += "R"
for i in range(H+1):
    ans += "D"
for i in range(W+1):
    ans += "L"
ans += "U"

print(ans)

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

countx=tx-sx
county=ty-sy

ans=[]
for i in range(county):
    ans.append("U")
for i in range(countx):
    ans.append("R")

for i in range(county):
    ans.append("D")
for i in range(countx):
    ans.append("L")

ans.append("L")

for i in range(county+1):
    ans.append("U")
for i in range(countx+1):
    ans.append("R")
ans.append("D")

ans.append("R")

for i in range(county+1):
    ans.append("D")
for i in range(countx+1):
    ans.append("L")

ans.append("U")

Z=[str(a) for a in ans]
Z="".join(Z)
print(Z)

Solution (Python):
import sys
import numpy as np
import random
from decimal import Decimal
import itertools
import re
import bisect
from collections import deque, Counter
from functools import lru_cache
from numba import jit

sys.setrecursionlimit(10**9)
INF = 10**13
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
def SERIES(n): return np.fromstring(sys.stdin.buffer.read(), dtype=np.int32, sep=' ')
def GRID(h,w): return np.fromstring(sys.stdin.buffer.read(), dtype=np.int32, sep=' ').reshape(h,-1)[:,:w]
def GRIDfromString(h,w): return np.frombuffer(sys.stdin.buffer.read(), 'S1').reshape(h,-1)[:,:w]
MOD = 1000000007

def main():
	sx, sy, tx, ty = LI()
	print("R"*(tx-sx)+"U"*(ty-sy)+"L"*(tx-sx)+"D"*(ty-sy+1)+"R"*(tx-sx+1)+"U"*(ty-sy+1)+"L"+"U"+"L"*(tx-sx+1)+"D"*(ty-sy+1)+"R")



if __name__ == '__main__':
    main()

Solution (Python):
sx,sy,tx,ty = map(int, open(0).read().split())
dx = tx - sx
dy = ty - sy
ans = ['L'] + (['U']*(dy+1)) + (['R']*(dx+1)) + ['D','R'] + (['D']*(dy+1)) + (['L']*(dx+1)) + ['U'] + (['U']*(dy)) + (['R']*(dx)) + (['D']*(dy)) + (['L']*(dx))
print(''.join(ans))

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

sx,sy,tx,ty = list(map(int,input().split()))
right = tx - sx
up = ty - sy

go1 = 'R'*right + 'U'*up
back1 =""
for i in range(len(go1)):
    if go1[i] == 'R':
        back1 += 'L'
    elif go1[i] == 'U':
        back1 += 'D'
    elif go1[i] == 'L':
        back1 += 'R'
    elif go1[i] == 'D':
        back1 += 'U'
        
go2 = 'D' + 'R'*(right+1)+'U'*(up+1)+'L'

back2 =""
for i in range(len(go2)):
    if go2[i] == 'R':
        back2 += 'L'
    elif go2[i] == 'U':
        back2 += 'D'
    elif go2[i] == 'L':
        back2 += 'R'
    elif go2[i] == 'D':
        back2 += 'U'

print(go1+back1+go2+back2)

Solution (Python):
import sys, os, math, bisect, itertools, collections, heapq, queue

from decimal import Decimal
from collections import defaultdict, deque



sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)


MOD = 10 ** 9 + 7
MAX = float('inf')


def calcTwoPointDistance(x1, y1, x2, y2):
    return ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    sx, sy, tx, ty = il()

    move = []
    for _ in range(sy, ty):
        move.append('U')
    for _ in range(sx, tx):
        move.append('R')
    for _ in range(sy, ty):
        move.append('D')
    for _ in range(sx, tx):
        move.append('L')
    move.append('L')

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

    print(*move, sep='')


if __name__ == '__main__':
    main()

Solution (Python):

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

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

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

print(ans)

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

dx = tx - sx
dy = ty - sy
for _ in range(dx):
    ans.append('R')
for _ in range(dy):
    ans.append('U')
for _ in range(dx):
    ans.append('L')
for _ in range(dy):
    ans.append('D')
dx = tx - sx + 1
dy = ty - sy + 1
ans.append('D')
for _ in range(dx):
    ans.append('R')
for _ in range(dy):
    ans.append('U')
ans.append('L')
ans.append('U')
for _ in range(dx):
    ans.append('L')
for _ in range(dy):
    ans.append('D')
ans.append(('R'))
print(''.join(ans))

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

def main(sx,sy,tx,ty):
    ans=''
    ans=ans+'U'*(ty-sy)
    ans=ans+'R'*(tx-sx+1)
    ans=ans+'D'*(ty-sy+1)
    ans=ans+'L'*(tx-sx+1)
    ans=ans+'U'+'L'
    ans=ans+'U'*(ty-sy+1)
    ans=ans+'R'*(tx-sx+1)
    ans=ans+'D'*(ty-sy+1)
    ans=ans+'L'*(tx-sx)
    return ans

if __name__=='__main__':
    sx,sy,tx,ty=readinput()
    ans=main(sx,sy,tx,ty)
    print(ans)

Solution (Python):
import math


def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def solve():
    """
   CCC
   CAtD
   CABD
   CsBD
    DDD

    UUR
    DDL
    LUUURRD
    RDDDLLU

    """
    sx, sy, tx, ty = read_ints()
    return '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'


if __name__ == '__main__':
    print(solve())

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

del_x = tx - sx
del_y = ty - sy
ans = 'U' * del_y + 'R' * del_x + 'D' * del_y + 'L' * (del_x + 1)
ans += 'U' * (del_y + 1) + 'R' * (del_x + 1) + 'DR' + 'D' * (del_y + 1) + 'L' * (del_x + 1) + 'U'
print(ans)

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