Problem:
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.

Incorrect submission (verdict: Wrong Answer):
import sys
import os

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, 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()
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]


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

    sx, sy, tx, ty = il()

    ret = ''
    for n in range(tx - sx): ret += 'R'
    for n in range(ty - sy): ret += 'U'
    for n in range(tx - sx): ret += 'L'
    for n in range(ty - sy): ret += 'D'

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

    print(ret)


if __name__ == '__main__':
    main()


Fixed, accepted submission:
import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict, deque

# import fractions

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)
# lcm = lambda x, y: (x * y) // fractions.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()