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




import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """0 0 1 2"""
        output = """UURDDLLUUURRDRDDDLLU"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """-2 -2 1 1"""
        output = """UURRURRDDDLLDLLULUUURRURRDDDLLDL"""
        self.assertIO(input, output)


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

    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)


if __name__ == "__main__":
    
    resolve()

Solution (Python):
sx, sy, tx, ty = [int(a) for a in input().split()]

dx = tx - sx
dy = ty - sy

txt = ""

txt += dy*"U" + dx*"R"

txt += dy*"D" + dx*"L"

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

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

print(txt)

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

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

print(sol)

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()


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

    """
    x, y = sx, sy
    for c in ans:
        if c == "U": y += 1
        if c == "D": y -= 1
        if c == "R": x += 1
        if c == "L": x -= 1
        print(x, y)
    """

if __name__ == "__main__":
    main()

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

dx = tx - sx
dy = ty - sy

res = ""

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

Solution (Python):




def solve(sx,sy,tx,ty):
  res = []
  dx = tx - sx
  dy = ty - sy
  
  assert dx > 0 and dy > 0
  
  res.extend(['R']*dx)
  res.extend(['U']*dy)
  res.extend(['L']*dx)
  res.extend(['D']*dy)

  
  res.append('D')
  res.extend(['R']*(dx+1))
  res.extend(['U']*(dy+1))
  res.append('L')

  res.append('U')
  res.extend(['L']*(dx+1))
  res.extend(['D']*(dy+1))
  res.append('R')
  return ''.join(res)


def main():
  sx,sy,tx,ty = map(int,input().split())
  print('{}'.format(solve(sx,sy,tx,ty)))

if __name__ == '__main__':
  main()

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

if __name__ == "__main__":
    main()

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

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

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

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

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

print(ans)

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

go = 'U' * (ty - sy) + 'R' * (tx - sx)
back = 'D' * (ty - sy) + 'L' * (tx - sx)
ans = go + back + 'LU' + go + 'RDRD' + back + 'LU'

print(ans)

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

dx = tx - sx
dy = ty - sy

mx = ["R", "L"]
my = ["U", "D"]

ans = mx[0]*dx + my[0]*dy
ans = ans + mx[1]*dx + my[1]*dy
ans = ans + my[1] + mx[0]*(dx + 1) + my[0]*(dy + 1) + mx[1]
ans = ans + my[0] + mx[1]*(dx + 1) + my[1]*(dy + 1) + mx[0]

print(ans)

Solution (Python):
a = list(map(int, input().split()))

num00 = a[3]-a[1]
num01 = a[2]-a[0]
ans = ['U']*num00
ans += ['R']*num01
ans += ['D']*num00
ans += ['L']*num01

ans += ['L']
ans += ['U']*(num00+1)
ans += ['R']*(num01+1)
ans += ['D']

ans += ['R']
ans += ['D']*(num00+1)
ans += ['L']*(num01+1)
ans += ['U']

print(*ans, sep='')

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

Solution (Python):
sx,sy, tx,ty = map(int, raw_input().split())
def f(sx,sy,tx,ty):
	path = ['D']
	path += ['R'] * (abs(tx - sx) + 1)
	path += ['U'] * (abs(ty - sy) + 1)
	path += ['L'] * (abs(tx - sx) + 1)
	path += ['D'] * (abs(ty - sy))
	return path

	
def g(sx,sy,tx,ty):
	path = []
	path += ['R'] * (abs(tx - sx))
	path += ['U'] * (abs(ty - sy) + 1)
	path += ['L'] * (abs(tx - sx)+1)
	path += ['D'] * (abs(ty - sy)+1) 
	return path + ['R']


print ''.join(f(sx,sy, tx,ty) + g(sx,sy,tx,ty))

Solution (Python):
sx,sy,tx,ty = map(int,input().split())
y_diff = ty-sy
x_diff = tx-sx
ans = ""
for i in range(y_diff):
    ans += "U"
for j in range(x_diff):
    ans += "R"
for k in range(y_diff):
    ans += "D"
for l in range(x_diff):
    ans += "L"
ans += "L"
for s in range(y_diff+1):
    ans += "U"
for t in range(x_diff+1):
    ans += "R"
ans += "DR"
for p in range(y_diff+1):
    ans += "D"
for q in range(x_diff+1):
    ans += "L"
ans+="U"
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):
sx,sy,tx,ty = map(int, input().split())

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

Solution (Python):
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())
def NIJIGEN(H): return [list(input()) for i in range(H)]
a,b,c,d=MAP()
x=c-a
y=d-b
ans=str()
ans+="R"*x+"U"*y
ans+="L"*x+"D"*y
ans+="L"+"U"*(y+1)+"R"*(x+1)+"D"
ans+="R"+"D"*(y+1)+"L"*(x+1)+"U"
print(ans)

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

Solution (Python):
SX,SY,TX,TY = (int(T) for T in 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):
a,b,c,d=map(int,input().split())

x=c-a
y=d-b

t=''
t+='R'*x
t+='U'*y
t+='L'*x
t+='D'*y
t+='D'
t+='R'*(x+1)
t+='U'*(y+1)
t+='L'
t+='U'
t+='L'*(x+1)
t+='D'*(y+1)
t+='R'

print(t)

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

dy = tx - sx
dx = ty - sy

ans = ''

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

print(ans)

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

Solution (Python):
def main():
    sx,sy,tx,ty=map(int,input().split())
    s=(sx,sy)
    t=(tx,ty)
    dif_y = abs(ty-sy)
    dif_x = abs(tx-sx)
    ans = "U"*dif_y+"R"*dif_x
    ans += "D"*dif_y+"L"*dif_x
    ans += "L"+"U"*(dif_y+1)+"R"*(dif_x+1)+"D"
    ans += "R"+"D"*(dif_y+1)+"L"*(dif_x+1)+"U"
    print(ans)

if __name__ == "__main__":
    main()

Solution (Python):


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

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

print(way)

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

ans+='R'*dx
ans+='U'*dy
ans+='L'*dx
ans+='D'*dy
ans+='DR'
ans+='R'*dx
ans+='U'*dy
ans+='ULUL'
ans+='L'*dx
ans+='D'*dy
ans+='DR'

print(ans)

Solution (Python):
import math
a,b,c,d=map(int,input().split())
ans=""
for i in range (c-a):
    ans+="R"
for i in range (d-b):
    ans+="U"
for i in range (c-a):
    ans+="L"
for i in range (d-b):
    ans+="D"
ans+="D"
for i in range (c-a+1):
    ans+="R"
for i in range (d-b+1):
    ans+="U"
ans+="LU"
for i in range (c-a+1):
    ans+="L"
for i in range (d-b+1):
    ans+="D"
ans+="R"
print(ans)

Solution (Python):

printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split()) 
ins = lambda : input().strip()
DBG = True 
BIG = 10**18
R = 10**9 + 7


def ddprint(x):
  if DBG:
    print(x)

sx,sy,tx,ty = inm()
p = 'L'
p += 'U'*(ty+1-sy)
p += 'R'*(tx+1-sx)
p += 'D'
p += 'L'*(tx-sx)
p += 'D'*(ty-sy)
p += 'R'*(tx-sx)
p += 'U'*(ty-sy)
p += 'R'
p += 'D'*(ty+1-sy)
p += 'L'*(tx+1-sx)
p += 'U'
print(p)

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

dx = tx-sx
dy = ty-sy

print(dy*"U"+dx*"R"+dy*"D"+dx*"L"+"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())
 
dx = abs(tx - sx)
dy = abs(ty - sy)

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

Solution (Python):
sx,sy,tx,ty=map(int,input().split())
x=tx-sx
y=ty-sy
if y>0:
    p,r='U','D'
else:
    p,r='D','U'
if x>0:
    q,s='R','L'
else:
    q,s='L','R'
l=[p]*y+[q]*x+[r]*y+[s]*x+[s]+[p]*(y+1)+[q]*(x+1)+[r]+[q]+[r]*(y+1)+[s]*(x+1)+[p]
print(''.join(l))

Solution (Python):
sx, sy, tx, ty = [int(s) for s in input().split(" ")]
diff = [tx - sx, ty - sy]

print("R" * diff[0] + "U" * diff[1] + "L" * diff[0] + "D" * diff[1] + "D" + "R" * (diff[0] + 1) + "U" * (diff[1] + 1) + "L" + "U" + "L" * (diff[0] + 1) + "D" * (diff[1] + 1) + "R")

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

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

print(ans)

Solution (Python):

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

    rx = tx - sx
    ry = ty - sy

    ans = []

    
    for _ in range(ry):
        ans.append('U')
    for _ in range(rx):
        ans.append('R')

    
    for _ in range(ry):
        ans.append('D')
    for _ in range(rx):
        ans.append('L')

    
    ans.append('L')
    for _ in range(ry+1):
        ans.append('U')
    for _ in range(rx+1):
        ans.append('R')
    ans.append('D')
    
    
    ans.append('R')
    for _ in range(ry+1):
        ans.append('D')
    for _ in range(rx+1):
        ans.append('L')
    ans.append('U')
    
    print(''.join(ans))


if __name__ ==  "__main__":
    main()

Solution (Python):





import math
import fractions
import sys
import bisect
import heapq  
import collections
from collections import Counter
from collections import deque
import pprint
import itertools

sr = lambda: input()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

"""nを素因数分解"""
"""2以上の整数n => [[素因数, 指数], ...]の2次元リスト"""


def factorization(n):
    arr = []
    temp = n
    if n == 1:
        return arr

    for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])

    if temp != 1:
        arr.append([temp, 1])

    if arr == []:
        arr.append([n, 1])

    return arr



def power(a, n, mod):
    x = 1
    while n:
        if n & 1:
            x *= a % mod
        n >>= 1
        a *= a % mod
    return x % mod



def kaijo(n, l, mod):
    if n == 0:
        return 1
    a = n
    tmp = n - 1
    while (tmp >= l):
        a = a * tmp % mod
        tmp -= 1
    return a


class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors


def main():

    inf = 10 ** 18
    mod = 10 ** 9 + 7

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

    print(*ans, sep='')





    return

if __name__ == '__main__':
    main()

Solution (Python):
sx,sy,tx,ty = ( int(x) for x in input().split() )

rx = tx - sx
ry = ty - sy

ans = []


for i in range( ry ):
    ans.append( 'U' )
for i in range( rx ):
    ans.append( 'R' )

for i in range( ry ):
    ans.append( 'D' )
for i in range( rx ):
    ans.append( 'L' )

ans.append( 'L' )
for i in range( ry + 1 ):
    ans.append( 'U' )
for i in range( rx + 1 ):
    ans.append( 'R' )
ans.append( 'D' )

ans.append( 'R' )
for i in range( ry + 1 ):
    ans.append( 'D' )
for i in range( rx + 1 ):
    ans.append( 'L' )
ans.append( 'U' )

print( ''.join(ans) )

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

Solution (Python):
sx,sy,tx,ty = map(int,input().split())
ans = ''
if tx - sx > 0:
  if ty - sy > 0:
    x = ['R','L','U','D']
  else:
    x = ['R','L','D','U']
else:
  if ty - sy > 0:
    x = ['L','R','U','D']
  else:
    x = ['L','R','D','U']
ans += x[0]*abs(tx-sx)
ans += x[2]*abs(sy-ty)
ans += x[1]*abs(tx-sx)
ans += x[3]*abs(ty-sy)
ans += x[3] + x[0]*(abs(tx-sx)+1)
ans += x[2]*(abs(ty-sy)+1) + x[1]
ans += x[2] + x[1]*(abs(tx-sx)+1)
ans += x[3]*(abs(ty-sy)+1) + x[0]
print(ans)

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

Solution (Python):
sx, sy, tx, ty = map(int, input().split())
xf, xb, yf, yb = 'R', 'L', 'U', 'D'
dx = abs(tx - sx)
dy = abs(ty - sy)

if tx < sx:
  xf, xb = 'L', 'R'
if ty < sy:
  yf, yb = 'D', 'U'

s = ""
if dx == 0:
  s += yf*dy
  s += xf
  s += yb*dy
  s += xb
  s += xb
  s += yf*dy
  s += xf
  s += yf
  s += xf*2
  s += yb*(dy+2)
  s += xb*2
  s *= yb
elif dy == 0:
  s += xf*dx
  s += yb
  s += xb*dx
  s += yf
  s += yf
  s += xf*dx
  s += yb
  s += xf
  s += yb*2
  s += xb(dx+2)
  s += yf*2
  s += xf
else:
  s += yf*dy
  s += xf*dx
  s += yb*dy
  s += xb*dx
  s += xb
  s += yf*(dy+1)
  s += xf*(dx+1)
  s += yb
  s += xf
  s += yb*(dy+1)
  s += xb*(dx+1)
  s += yf

print(s)

Solution (Python):

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

p1="U"*y+"R"*x
p2="D"*y+"L"*x
p3="L"+"U"*(y+1)+"R"*(x+1)+"D"
p4="R"+"D"*(y+1)+"L"*(x+1)+"U"

print(p1+p2+p3+p4)

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

iki=["U" for i in range(ty-sy)]+["R" for i in range(tx-sx)]
kaeri=["D" for i in range(ty-sy)]+["L" for i in range(tx-sx)]
iki2=["L"]+["U" for i in range(ty-sy+1)]+["R" for i in range(tx-sx+1)]+["D"]
kaeri2=["R"]+["D" for i in range(ty-sy+1)]+["L" for i in range(tx-sx+1)]+["U"]
ans=iki+kaeri+iki2+kaeri2
print(*ans,sep="")

Solution (Python):
sx, sy, tx, ty = map(int, input().split())
top = ty - sy
right = tx - sx
first = []

for _ in range(top):
    first.append('U')
for _ in range(right):
    first.append('R')


second = []
for char in first:
    if char == 'R':
        second.append('L')
    elif char == 'U':
        second.append('D')


third = ['L']
for _ in range(top + 1):
    third.append('U')
for _ in range(right + 1):
    third.append('R')
third.append('D')

forth = []
for char in third:
    if char == 'R':
        forth.append('L')
    elif char == 'U':
        forth.append('D')
    elif char == 'L':
        forth.append('R')
forth.append('U')






print(''.join(first) + ''.join(second) + ''.join(third) + ''.join(forth))

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

ans = []
ans = ans + ['R']*x
ans = ans + ['U']*y

ans = ans + ['L']*x
ans = ans + ['D']*y

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

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

print(''.join(ans))

Solution (Python):
sx,sy,tx,ty = map(int,input().split())
no1 = ''
for i in range(ty-sy):
    no1 += 'U'
for i in range(tx-sx):
    no1 += 'R'
no2 = ''
for i in range(ty-sy):
    no2 += 'D'
for i in range(tx-sx):
    no2 += 'L'
print(no1+no2+'LU'+no1+'RD'+'RD'+no2+'LU')

Solution (Python):
import math
import sys


def main():
    sx, sy, tx, ty = map(int, input().split())
    dx = tx - sx
    dy = ty - sy
    ax11 = [("R" if dx >= 0 else "L")] * abs(dx)
    ay11 = [("U" if dy >= 0 else "D")] * abs(dy)
    ax12 = [("L" if dx >= 0 else "R")] * abs(dx)
    ay12 = [("D" if dy >= 0 else "U")] * abs(dy)
    ax21 = [("D" if dy >= 0 else "U")] * 1 + \
        [("R" if dx >= 0 else "L")] * (abs(dx) + 1)
    ay21 = [("U" if dy >= 0 else "D")] * (abs(dy) + 1) + \
        [("L" if dx >= 0 else "R")] * 1
    ax22 = [("U" if dy >= 0 else "D")] * 1 + \
        [("L" if dx >= 0 else "R")] * (abs(dx) + 1)
    ay22 = [("D" if dy >= 0 else "U")] * (abs(dy) + 1) + \
        [("R" if dx >= 0 else "L")] * 1
    a1 = "".join(ax11 + ay11 + ax12 + ay12)
    a2 = "".join(ax21 + ay21 + ax22 + ay22)
    print(a1 + a2)


if __name__ == '__main__':
    main()

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

short_outward = []
short_return = []
long_outward = ["L"]
long_return = ["R"]

for i in range((ty-sy)):
    short_outward.append("U")

for i in range((tx-sx)):
    short_outward.append("R")


for i in range((ty-sy)):
    short_return.append("D")

for i in range((tx-sx)):
    short_return.append("L")


for i in range((ty-sy)+1):
    long_outward.append("U")

for i in range((tx-sx)+1):
    long_outward.append("R")

long_outward.append("D")



for i in range((ty-sy)+1):
    long_return.append("D")

for i in range((tx-sx)+1):
    long_return.append("L")

long_return.append("U")



list = short_outward+short_return+long_outward+long_return

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

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

Solution (Python):

sx, sy, tx, ty = map(int, input().split())
x = tx - sx
y = ty - sy
h = abs(sx - tx)
v = abs(sy - ty)
ans = [[1, 0]] * h + [[0, 1]] * v + [[-1, 0]] * h + [[0, -1]] * v
ans += [[0, -1]] + [[1, 0]] * -~h + [[0, 1]] * -~v + [[-1, 0]]
ans += [[0, 1]] + [[-1, 0]] * -~h + [[0, -1]] * -~v + [[1, 0]]
for i in ans:
    if i == [1, 0]:
        print("R", end="")
    elif i == [-1, 0]:
        print("L", end="")
    elif i == [0, 1]:
        print("U", end="")
    else:
        print("D", end="")
print("")

Solution (Python):

sx, sy, tx, ty = map(int, input().split())
x = tx - sx
y = ty - sy
h = abs(sx - tx)
v = abs(sy - ty)
ans = [[1, 0]] * h + [[0, 1]] * v + [[-1, 0]] * h + [[0, -1]] * v
ans += [[0, -1]] + [[1, 0]] * -~h + [[0, 1]] * -~v + [[-1, 0]]
ans += [[0, 1]] + [[-1, 0]] * -~h + [[0, -1]] * -~v + [[1, 0]]
if x < 0 and y < 0:
    ans = [*map(lambda x: [-x[0], -x[1]], ans)]
elif x < 0:
    ans = [*map(lambda x: [-x[1], x[0]], ans)]
elif y < 0:
    ans = [*map(lambda x: [x[1], -x[0]], ans)]

for i in ans:
    if i == [1, 0]:
        print("R", end="")
    elif i == [-1, 0]:
        print("L", end="")
    elif i == [0, 1]:
        print("U", end="")
    else:
        print("D", end="")
print("")

Solution (Python):

sx, sy, tx, ty = map(int, input().split())
x = tx - sx
y = ty - sy
h = abs(sx - tx)
v = abs(sy - ty)
if h * v > 0:
    ans = [[1, 0]] * h + [[0, 1]] * v + [[-1, 0]] * h + [[0, -1]] * v
    ans += [[0, -1]] + [[1, 0]] * -~h + [[0, 1]] * -~v + [[-1, 0]]
    ans += [[0, 1]] + [[-1, 0]] * -~h + [[0, -1]] * -~v + [[1, 0]]
elif h < 1:
    ans = [[0, 1]] * v
    ans += [[1, 0]] + [[0, -1]] * v + [[-1, 0]]
    ans += [[-1, 0]] + [[0, 1]] * v + [[1, 0]]
    ans += [[0, 1]] + [[1, 0]] * 2 + [[0, -1]] * \
        (v + 2) + [[-1, 0]] * 2 + [[0, 1]] * 2
elif v < 1:
    ans = [[1, 0]] * h
    ans += [[0, 1]] + [[-1, 0]] * h + [[0, -1]]
    ans += [[0, -1]] + [[1, 0]] * h + [[0, 1]]
    ans += [[1, 0]] + [[0, 1]] * 2 + [[-1, 0]] * \
        (h + 2) + [[0, -1]] * 2 + [[1, 0]] * 2

if x < 0 and y < 0:
    ans = [*map(lambda x: [-x[0], -x[1]], ans)]
elif x < 0:
    ans = [*map(lambda x: [-x[1], x[0]], ans)]
elif y < 0:
    ans = [*map(lambda x: [x[1], -x[0]], ans)]

for i in ans:
    if i == [1, 0]:
        print("R", end="")
    elif i == [-1, 0]:
        print("L", end="")
    elif i == [0, 1]:
        print("U", end="")
    else:
        print("D", end="")
print("")

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

ans = ''

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

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

ans += '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())

if tx > sx and ty > sy:mode=0
elif tx > sx and ty < sy:mode=1
elif tx < sx and ty > sy:mode=3
else: mode=2
  
directions=[('R','U'),('R','D'),('L','D'),('L','U'),('R','U'),('R','D'),('L','D'),('L','U')]

ans=[]
d_go,d_re = directions[mode],directions[mode+2]
dx,dy=abs(tx-sx),abs(ty-sy)
go1 = dx*d_go[0] + dy*d_go[1]
re1 = dx*d_re[0] + dy*d_re[1]
go2 = d_re[1]+(dx+1)*d_go[0] + (dy+1)*d_go[1] + d_re[0]
re2 = d_go[1]+(dx+1)*d_re[0] + (dy+1)*d_re[1] + d_go[0]

ans.extend(go1)
ans.extend(re1)
ans.extend(go2)
ans.extend(re2)

print(''.join(ans))

Solution (Python):

import sys

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


sys.setrecursionlimit(10**7)







INF = 1 << 50



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


if __name__ == "__main__":
    run()

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

Solution (Python):






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





ans = []
X = sx; Y = sy
for x in range(sx+1,tx+1):
    ans.append("R")
X = x
for y in range(sy+1,ty+1):
    ans.append("U")
Y = y
for x in reversed(range(sx,tx)):
    ans.append("L")
X = x
for y in reversed(range(sy,ty)):
    ans.append("D")
Y = y
Y -= 1
ans.append("D")
for x in range(sx+1,tx+2):
    ans.append("R")
X = x
for y in range(sy,ty+1):
    ans.append("U")
Y = y
X -= 1
ans.append("L")
Y += 1
ans.append("U")
for x in reversed(range(sx-1,tx)):
    ans.append("L")
X = x
for y in reversed(range(sy,ty+1)):
    ans.append("D")
Y = y
X += 1
ans.append("R")
print("".join(ans))

Solution (Python):
def resolve():
    '''
    code here
    '''
    sx, sy, tx, ty = [int(item) for item in input().split()]

    gx = tx - sx
    gy = ty - sy

    def r(num):
        return 'R'*num
    
    def l(num):
        return 'L'*num
    
    def u(num):
        return 'U'*num

    def d(num):
        return 'D'*num

    first_trail = l(1) + u(gy+1) + r(gx+1) + d(gy+1) + l(gx)
    second_trail = u(gy) + r(gx+1) + d(gy+1) + l(gx+1) + u(1)

    print(first_trail + second_trail)


if __name__ == "__main__":
    resolve()

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

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

dx = tx - sx
dy = ty - sy

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

print(ans)

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

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

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())
x1,y1=tx-sx,ty-sy
x2,y2=x1+2,y1+2

s="U"*y1
s+="R"*x1
s+="D"*y1
s+="L"*x1

s+="L"
s+="U"*(y2-1)
s+="R"*(x2-1)
s+="D"

s+="R"
s+="D"*(y2-1)
s+="L"*(x2-1)
s+="U"

print(s)

Solution (Python):
sx,sy,tx,ty=map(int,input().split())
x1,y1=tx-sx,ty-sy
x2,y2=x1+2,y1+2

s="U"*y1
s+="R"*x1
s+="D"*y1
s+="L"*x1

s+="L"
s+="U"*(y2-1)
s+="R"*(x2-1)
s+="D"

s+="R"
s+="D"*(y2-1)
s+="L"*(x2-1)
s+="U"

print(s)

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

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

if not ( -1000 <= sx <= 1000 and sx < tx <= 1000 ): sys.exit()
if not ( -1000 <= sy <= 1000 and sy < ty <= 1000 ): sys.exit()
if not ( isinstance(sx,int) and isinstance(sy,int) and isinstance(tx,int) and isinstance(ty,int)): sys.exit()

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

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

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

for i in range(tx-sx+1):
    ans+="L"
ans+="UL"

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

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

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

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

print(ans)

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

res = ''

for _ in range(ty-sy):
    res += 'U'
for _ in range(tx-sx):
    res += 'R'

for _ in range(ty-sy):
    res += 'D'
for _ in range(tx-sx):
    res += 'L'

res += 'LU'
for _ in range(ty-sy):
    res += 'U'
for _ in range(tx-sx):
    res += 'R'
res += 'RD'

res += 'RD'
for _ in range(ty-sy):
    res += 'D'
for _ in range(tx-sx):
    res += 'L'
res += 'LU'

print(res)