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):
s = raw_input().split()
a= int(s[0]) 
b= int(s[1])
c= int(s[2])
d= int(s[3])

w = c-a 
h = d-b 
u ="U"
d = "D"
r = "R"
l = "L"

str = "U"*h + "R"*w + "D"*h + "L"*w + "L" + u*(h+1) + r*(w+1) + d + r + d*(h+1) + l*(w+1) + u  
print str

Solution (Python):
x, y, tx, ty = [int(i) for i in input().split()]
ans = []
for i in range(ty - y):
    ans.append('U')
for i in range(tx - x):
    ans.append('R')
for i in range(ty - y):
    ans.append('D')
for i in range(tx - x + 1):
    ans.append('L')
for i in range(ty - y + 1):
    ans.append('U')
for i in range(tx - x + 1):
    ans.append('R')
ans.append('DR')
for i in range(ty - y + 1):
    ans.append('D')
for i in range(tx - x + 1):
    ans.append('L')
ans.append('U')
ans = ''.join(ans)
print(ans)

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

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


ans += (tx - sx) * "R"

ans += (ty - sy) * "U"

ans += (tx - sx) * "L"

ans += (ty -sy) * "D"


ans += "D"
ans += ((tx - sx)+1) * "R"


ans += ((ty - sy)+1) * "U"
ans += "L"


ans += "U"
ans += ((tx - sx)+1) * "L"


ans += ((ty -sy)+1) * "D"
ans += "R"

print(ans)

Solution (Python):
from collections import defaultdict


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

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


if __name__ == '__main__':
    main()

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

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

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

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

print(ans)

Solution (Python):

import math

sx,sy,tx,ty = map(int, raw_input().split())
width = int(math.fabs(ty-sy))
height = int(math.fabs(tx-sx))

path = ''
for i in range(width):
    path += 'U'
for i in range(height):
    path += 'R'
for i in range(width):
    path += 'D'
for i in range(height):
    path += 'L'

path += 'L'
for i in range(width+1):
    path += 'U'
for i in range(height+1):
    path += 'R'
path += 'D'
path += 'R'
for i in range(width+1):
    path += 'D'
for i in range(height+1):
    path += 'L'
path += 'U'
    
print(path)

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

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

Solution (Python):
def main(sx, sy, tx, ty):
    answer = ''
    d_x = tx - sx
    d_y = ty - sy

    one_right = 'R' * d_x
    one_up    = 'U' * d_y
    answer += one_up + one_right

    one_down  = 'D' * d_y
    one_left  = 'L' * (d_x + 1)
    answer += one_down + one_left

    two_up    = 'U' * (d_y + 1)
    two_right = 'R' * (d_x + 1)
    answer += two_up + two_right + 'DR'

    two_down  = 'D' * (d_y + 1)
    two_left  = 'L' * (d_x + 1)
    answer += two_down + two_left + 'U'

    return answer





if __name__ == '__main__':
    sx, sy, tx, ty = [int(e) for e in input().split()]
    print(main(sx, sy, tx, ty))

Solution (Python):
def route_x(sx, tx):
    dx = tx - sx
    dx2 = dx if dx >= 0 else -dx
    buf = "R"*dx2 if dx >= 0 else "L"*dx2
    return buf

def route_y(sy, ty):
    dy = ty - sy
    dy2 = dy if dy >= 0 else -dy
    buf = "U"*dy2 if dy >= 0 else "D"*dy2
    return buf

def route(sx, sy, tx, ty):
    return route_x(sx, tx) + route_y(sy, ty)

def route2(sx, sy, tx, ty):
    dx = tx - sx
    dy = ty - sy
    if dx >= 0 and dy >= 0:
        buf = "L" + route_y(sy, ty+1) + route_x(sx-1, tx) + "D"
    if dx >= 0 and dy < 0:
        buf = "U" + route_x(sx, tx+1) + route_y(sy+1, ty) + "L"
    if dx < 0 and dy >= 0:
        buf = "D" + route_x(sx, tx-1) + route_y(sy-1, ty) + "R"
    if dx < 0 and dy < 0:
        buf = "R" + route_y(sy, ty-1) + route_x(sx+1, tx) + "U"
    return buf

if __name__ == "__main__":
    sx, sy, tx, ty = [int(i) for i in input().split()]
    r1 = route(sx, sy, tx, ty) + route(tx, ty, sx, sy)
    r2 = route2(sx, sy, tx, ty) + route2(tx, ty, sx, sy)
    print(r1 + r2)

Solution (Python):


sx, sy, tx, ty = map(int, raw_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(' '))
w,h = abs(sx-tx),abs(sy-ty)

res = 'U'*h+'R'*w+'D'*h+'L'*w
res += 'L'+'U'*(h+1)+'R'*(w+1)+'DR'+'D'*(h+1)+'L'*(w+1)+'U'
print(res)

Solution (Python):
sx, sy, gx, gy = list(map(int, input().split()))
l = []
dx = gx - sx
dy = gy - sy
for i in range(dx):
	l.append('R')
for i in range(dy):
	l.append('U')
for i in range(dx):
	l.append('L')
for i in range(dy):
	l.append('D')
l.append('D')
for i in range(dx+1):
	l.append('R')
for i in range(dy+1):
	l.append('U')
l.append('L')
l.append('U')
for i in range(dx+1):
	l.append('L')
for i in range(dy+1):
	l.append('D')
l.append('R')
S = ''.join(l)
print(S)

Solution (Python):

INF=10**10

def main():
    
    sx,sy,tx,ty=list(map(int,input().split()))
    dx,dy=tx-sx,ty-sy
   
    s=""
    s+="R"*dx+"U"*dy
    s+="L"*dx+"D"*dy
    s+="D"+"R"*(dx+1)+"U"*(dy+1)+"L"
    s+="U"+"L"*(dx+1)+"D"*(dy+1)+"R"
    print(s)
    
    
if __name__=="__main__":
    main()

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

Solution (Python):
pos = list(map(int, input().split()))
sx = pos[0]
sy = pos[1]
tx = pos[2]
ty = pos[3]

dx = tx - sx
dy = ty - sy

ans = ''
for i in range(dy):
    ans += 'U'
for i in range(dx):
    ans += 'R'
for i in range(dy):
    ans += 'D'
for i in range(dx+1):
    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):
sx, sy, tx, ty = [int(x) for x in input().split()]


dx = tx - sx
dy = ty - sy
route1 = "U" * dy + "R" * dx + "D" * dy + "L" * dx


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

print(route1 + route2)

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

Solution (Python):
nums = list(map(int, input().split()))
x = nums[2] -nums[0]
y = nums[3] - nums[1]
a = 'R' * x + 'U'* y
b = 'L' * x + 'D'* y
c = 'D' + 'R' * (x+1) + 'U'* (y+1) + 'L'
d = 'U' + 'L' * (x+1) + 'D'* (y+1) + 'R'
print(a+b+c+d)

Solution (Python):
point=input().split(" ")
sx=int(point[0])
sy=int(point[1])
tx=int(point[2])
ty=int(point[3])



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

print(a)

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

Solution (Python):
import math

line = input().split()
sx, sy, tx, ty = int(line[0]), int(line[1]), int(line[2]), int(line[3])

result = ""




if ty > sy:
    if tx > sx:
        result += "U" * (ty - sy)
        result += "R" * (tx - sx)
        result += "D" * (ty - sy)
        result += "L" * (tx - sx)
        result += "L" + "U"*(ty-sy + 1)
        result += "R"*(tx - sx + 1) + "D"
        result += "R" + "D"*(ty-sy + 1)
        result += "L"*(tx-sx + 1) + "U"
    else:
        result += "U" * (ty - sy)
        result += "L" * (tx - sx)
        result += "D" * (ty - sy)
        result += "R" * (tx - sx)
        result += "R" + "U" * (ty - sy + 1)
        result += "L" * (tx - sx + 1) + "D"
        result += "L" + "D" * (ty - sy + 1)
        result += "R" * (tx - sx + 1) + "U"

else:
    if tx > sx:
        result += "D" * (ty - sy)
        result += "R" * (tx - sx)
        result += "U" * (ty - sy)
        result += "L" * (tx - sx)
        result += "L" + "D" * (ty - sy + 1)
        result += "R" * (tx - sx + 1) + "U"
        result += "R" + "U" * (ty - sy + 1)
        result += "L" * (tx - sx + 1) + "D"
    else:
        result += "D" * (ty - sy)
        result += "L" * (tx - sx)
        result += "U" * (ty - sy)
        result += "R" * (tx - sx)
        result += "R" + "D" * (ty - sy + 1)
        result += "L" * (tx - sx + 1) + "U"
        result += "L" + "U" * (ty - sy + 1)
        result += "R" * (tx - sx + 1) + "D"

print(result)

Solution (Python):

sx, sy, tx, ty = map(int,input().split())
movelist = ['U','D','L','R']
moved = []
countX = tx - sx
countY = ty - sy

for y in range (0, countY):
    moved.append(movelist[0])

for x in range (0, countX):
    moved.append(movelist[3])


for y in range (0, countY):
    moved.append(movelist[1])

for x in range (0, countX):
    moved.append(movelist[2])



moved.append(movelist[2])

for y in range (0, countY+1):
    moved.append(movelist[0])

for x in range (0, countX+1):
    moved.append(movelist[3])

moved.append(movelist[1])


moved.append(movelist[3])

for y in range (0,countY+1):
    moved.append(movelist[1])

for x in range (0, countX+1):
    moved.append(movelist[2])

moved.append(movelist[0])

print("".join(moved))

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

s += 'R'*x
s += 'U'*y
s += 'L'*x
s += 'D'*y

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

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

ans = ''


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


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

print(ans)

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

ans = ''


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


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

print(ans)

Solution (Python):
sx,sy,tx,ty = [int(i) for i in raw_input().split(' ')]
x = tx-sx
y = ty-sy
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):
import numpy as np

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

x = tx-sx
y = ty-sy

f=""
b=""

for i in range(x):
    f=f+"R"
    b=b+"L"
for i in range(y):
    f=f+"U"
    b=b+"D"


print f+b+"DR"+f+"UL"+"UL"+b+"DR"

Solution (Python):
sx,sy,dx,dy=map(int,raw_input().split())
x=dx-sx
y=dy-sy
s=""
for i in xrange(x):
	s+="R"
for i in xrange(y):
	s+="U"
for i in xrange(x):
	s+="L"
for i in xrange(y):
	s+="D"
s+="D"
for i in xrange(x+1):
	s+="R"
for i in xrange(y+1):
	s+="U"
s+="L"
s+="U"
for i in xrange(x+1):
	s+="L"
for i in xrange(y+1):
	s+="D"
s+="R"
print s

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

Solution (Python):


sx,sy,tx,ty=map(int,raw_input().split())
x=tx-sx
y=ty-sy
print 'R'*x+'U'*y+'L'*x+'D'*y+'D'+'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())
dx=tx-sx
dy=ty-sy

ans=""

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

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

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

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

print(ans)

Solution (Python):




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

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

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+'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())
route = ''
x_diff = tx - sx
y_diff = ty - sy


for i in range(y_diff):
    route += 'U'
for i in range(x_diff):
    route += 'R'


for i in range(y_diff):
    route += 'D'
for i in range(x_diff):
    route += 'L'


route += 'L'
for i in range(y_diff+1):
    route += 'U'
for i in range(x_diff+1):
    route += 'R'
route += 'D'


route += 'R'
for i in range(y_diff+1):
    route += 'D'
for i in range(x_diff+1):
    route += 'L'
route += 'U'
print(route)

Solution (Python):



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

w = tx - sx
h = ty - sy

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

Solution (Python):

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

ans1 = ""
ans2 = ""

for i in range(dx):
    ans1 += "R"
    ans2 += "L"

for i in range(dy):
    ans1 += "U"
    ans2 += "D"

ans = ans1 + ans2
ans1 = "D"
ans2 = "U"

for i in range(dx + 1):
    ans1 += "R"
    ans2 += "L"

for i in range(dy + 1):
    ans1 += "U"
    ans2 += "D"

ans1 += "L"
ans2 += "R"

print(ans + ans1 + ans2)

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

Solution (Python):
def commands(sx, sy, tx, ty):
    ans = ""
    ans += "R" * max(0, tx - sx)
    ans += "L" * max(0, sx - tx)
    ans += "U" * max(0, ty - sy)
    ans += "D" * max(0, sy - ty)
    return ans


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

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

print res

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

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


def main():
    sx,sy,tx,ty = LI()
    r = ''
    x = ty-sy
    y = tx-sx
    r += 'U'*x
    r += 'R'*y
    r += 'U'
    r += 'L'*(y+1)
    r += 'D'*(x+1)
    r += 'R'

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

    return r


print(main())

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

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

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

Solution (Python):
sx,sy,tx,ty=map(int,raw_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):
U,D,R,L='UDRL';x,y,a,b=map(int,input().split());x,y=a-x,b-y;a,b=x+1,y+1;print(U*y+R*x+D*y+L*a+U*b+R*a+D+R+D*b+L*a+U)

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

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

if __name__ == '__main__':
    main()

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

Solution (Python):


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

dx, dy = tx - sx, ty - sy

sx = 'R'
sy = 'U'

trans = str.maketrans('UDRL', 'DULR')
def rev(s):
    return s.translate(trans)

first = sx * dx + sy * dy
print(first, end='')
print(rev(first), end='')

second = rev(sy) + sx + first + sy + rev(sx)
print(second, end='')
print(rev(second), end='')

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

vec = []
x, y = sx, sy
for i in range(ty - sy - 1):
    vec.append("U")
    y += 1

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

for i in range(ty - y):
    vec.append("U")
    y += 1

for i in range(tx - x):
    vec.append("R")
    x += 1

vec.append("R")
x += 1

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

for i in range(x - sx):
    vec.append("L")
    x -= 1

vec.append("U")
y += 1
vec.append("L")
x -= 1

for i in range(ty + 1 - y):
    vec.append("U")
    y += 1

for i in range(tx - x):
    vec.append("R")
    x += 1

vec.append("D")
y -= 1

vec.append("D")
y -= 1

for i in range(ty - sy - 1):
    vec.append("D")
    y -= 1

for i in range(tx - sx - 1):
    vec.append("L")
    x -= 1

for i in range(y - sy):
    vec.append("D")
    y -= 1

for i in range(x - sx):
    vec.append("L")
    x -= 1



for v in vec:
    print(v, end="")

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

dx, dy = tx - sx, ty - sy

sx = 'R' if dx >= 0 else 'L'
sy = 'U' if dy >= 0 else 'D'

first = sx * abs(dx) + sy * abs(dy)

trans = str.maketrans('UDRL', 'DULR')
def rev(s):
    return s.translate(trans)


print(first, end='')

if dx != 0 and dy != 0:
    print(rev(first), end='')
    d = 'R' if dx > 0 else 'L'
    d2 = 'D' if dy > 0 else 'U'
    second = d2 + d + first + rev(d2) + rev(d)
    print(second, end='')
    print(rev(second), end='')
    
else:
    d = 'R' if dx is 0 else 'U'
    second = d + rev(first) + rev(d)
    print(second, end='')
    
    print(rev(second), end='')
    d2 = first[0]
    print(d2, d * 2, rev(d2), rev(first), rev(d2), rev(d) * 2, rev(d2), sep='', end='')

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

diff_x = tx - sx
diff_y = ty - sy

print('R'*diff_x + 'U'*diff_y + 'L'*diff_x + 'D'*diff_y
      + 'D' + 'R'*(diff_x+1) + 'U'*(diff_y+1) + 'L'
      + 'U' + 'L'*(diff_x+1) + 'D'*(diff_y+1) + 'R')

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

Solution (Python):
import sys

sx,sy,tx,ty = map(int, raw_input().split())
for x in range(0,tx-sx):
 sys.stdout.write('R')
for x in range(0,ty-sy):
 sys.stdout.write('U')
for x in range(0,tx-sx):
 sys.stdout.write('L')
for x in range(0,ty-sy):
 sys.stdout.write('D')
sys.stdout.write('D')
for x in range(0,tx-sx+1):
 sys.stdout.write('R')
for x in range(0,ty-sy+1):
 sys.stdout.write('U')
sys.stdout.write('L')
sys.stdout.write('U')
for x in range(0,tx-sx+1):
 sys.stdout.write('L')
for x in range(0,ty-sy+1):
 sys.stdout.write('D')
sys.stdout.write('R')

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

first_x = Tx - Sx
first_y = Ty - Sy

ans1_list = []

if first_y > 0:
	ans1_list.append('U'*first_y)
	if first_x > 0:
		ans1_list.append('R'*first_x)
	else:
		ans1_list.append('L'*first_x)


else:
	print('D'*first_y)
	if first_x > 0:
		ans1_list.append('R'*first_x)
	else:
		ans1_list.append('L'*first_x)

ans1_list_ = "".join(ans1_list)


count1_list = []



for s in ans1_list_:
	if s == 'U':
		count1_list.append('D')
	elif s == 'D':
		count1_list.append('U')
	elif s == 'R':
		count1_list.append('L')
	elif s == 'L':
		count1_list.append('R')

ans1_list = ans1_list_ + "".join(count1_list)

ans2_list = []

if "".join(ans1_list)[0] == 'U':
	ans2_list.append('L')
	ans2_list.append('U')
	ans2_list.append("".join(ans1_list_))
	ans2_list.append('R')
	ans2_list.append('D')

elif "".join(ans1_list)[0] == 'R':
	ans2_list.append('U')
	ans2_list.append('R')
	ans2_list.append("".join(ans1_list_))
	ans2_list.append('D')
	ans2_list.append('L')

elif "".join(ans1_list)[0] == 'D':
	ans2_list.append('R')
	ans2_list.append('D')
	ans2_list.append("".join(ans1_list_))
	ans2_list.append('L')
	ans2_list.append('U')
elif "".join(ans1_list)[0] == 'L':
	ans2_list.append('D')
	ans2_list.append('L')
	ans2_list.append("".join(ans1_list_))
	ans2_list.append('U')
	ans2_list.append('R')

ans2_list_ = "".join(ans2_list)

count_list = []

ans_list = ans1_list + ans2_list_

for s in ans2_list_:
	if s == 'U':
		count_list.append('D')
	elif s == 'D':
		count_list.append('U')
	elif s == 'R':
		count_list.append('L')
	elif s == 'L':
		count_list.append('R')


count_ = "".join(count_list)
ans_list = "".join(ans_list) + count_

ans = ans_list
print(ans)

Solution (Python):
s = input()
l = s.split()
sx = int(l[0])
sy = int(l[1])
tx = int(l[2])
ty = int(l[3])
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="")

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

width = tx-sx 
height = ty-sy
ans = ''
ans += 'U'*height
ans +='R'*width

ans += 'D'*height
ans += 'L'*width

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

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


print(ans)

Solution (Python):


sx,sy,tx,ty = list(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):
    print('L', end='')


print('L', end='')
for i in range(ty-sy+1):
    print('U', end='')
for i in range(tx-sx+1):
    print('R', end='')
print('D', end='')
print('R', 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 = [int(x) for x in raw_input().strip().split(" ")]
a = tx - sx
b = ty - sy
c = a + 1
d = b + 1
print('U'*b+'R'*a+'D'*b+'L'*c+'U'*d+'R'*c+'DR'+'D'*d+'L'*c+'U')

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

Solution (Python):
import sys
inp=sys.stdin.readline()
sx,sy,tx,ty=map(lambda x: int(x), inp.split(' '))
ret=''
for i in range(ty-sy):
    ret=ret+'U'
for i in range(tx-sx):
    ret=ret+'R'
for i in range(ty-sy):
    ret=ret+'D'
for i in range(tx-sx+1):
    ret=ret+'L'
for i in range(ty-sy+1):
    ret=ret+'U'
for i in range(tx-sx+1):
    ret=ret+'R'
ret=ret+'DR'
for i in range(ty-sy+1):
    ret=ret+'D'
for i in range(tx-sx+1):
    ret=ret+'L'
ret=ret+'U'
print(ret)

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

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

print(*ans,sep='')

Solution (Python):
a,b,c,d=map(int,raw_input().split())
x=c-a
y=d-b
print 'U'*y+'R'*x+'D'*y+'L'*x+'L'+'U'*y+'U'+'R'*x+'RD'+'R'+'D'*y+'D'+'L'*x+'LU'

Solution (Python):

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

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

Solution (Python):
x,y,xx,yy=map(int,raw_input().split())
w=xx-x;h=yy-y
s='U'*h+'R'*w+'D'*h+'L'*w+'L'+'U'*(h+1)+'R'*(w+1)+'DR'+'D'*(h+1)+'L'*(w+1)+'U'
print s

Solution (Python):

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

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

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




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

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

X = tx - sx
Y = ty - sy

res = ''
for i in xrange(X):
	res += 'R'
for i in xrange(Y):
	res += 'U'
for i in xrange(X):
	res += 'L'
for i in xrange(Y):
	res += 'D'

res += 'D'
for i in xrange(X+1):
	res += 'R'
for i in xrange(Y+1):
	res += 'U'
res += 'L'

res += 'U'
for i in xrange(X+1):
	res += 'L'
for i in xrange(Y+1):
	res += 'D'
res += 'R'

print res

Solution (Python):
from functools import partial
from sys import stdin

p = partial(print, end='')

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

dx = tx - sx
dy = ty - sy

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

Solution (Python):


import sys

def main(argv):
    for line in sys.stdin:
        sx, sy, tx, ty = line.rstrip("\n").split(" ")
        sx = int(sx)
        sy = int(sy)
        tx = int(tx)
        ty = int(ty)

        step = []
        x = sx
        y = sy
        while y < ty:
            step.append("U")
            y += 1
        while x < tx:
            step.append("R")
            x += 1
        while y > sy:
            step.append("D")
            y -= 1
        while x > sx:
            step.append("L")
            x -= 1
        step.append("L")
        x -= 1
        while y < ty + 1:
            step.append("U")
            y += 1
        while x < tx:
            step.append("R")
            x += 1
        step.append("D")
        y -= 1
        step.append("R")
        x += 1
        while y > sy - 1:
            step.append("D")
            y -= 1
        while x > sx:
            step.append("L")
            x -= 1
        step.append("U")
        y += 1

        print "".join(step)

if __name__ == "__main__":
    main(sys.argv)

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

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

print(s)

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

print(s)

Solution (Python):

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

saitan = "U" * Y + "R" * X + "D" * Y + "L" * (X + 1) \
            + "U" * (Y + 1) + "R" * (1 + X) + "D" \
            + "R" + "D" * (Y + 1) + "L" * (1 + X) \
            + "U"

print(saitan)