human
What is a the Python code you requested given the following:
Bashar was practicing for the national programming contest. Because of sitting too much in front of the computer without doing physical movements and eating a lot Bashar became much fatter. Bashar is going to quit programming after the national contest and he is going to become an actor (just like his father), so he should lose weight.

In order to lose weight, Bashar is going to run for k kilometers. Bashar is going to run in a place that looks like a grid of n rows and m columns. In this grid there are two one-way roads of one-kilometer length between each pair of adjacent by side cells, one road is going from the first cell to the second one, and the other road is going from the second cell to the first one. So, there are exactly (4 n m - 2n - 2m) roads.

Let's take, for example, n = 3 and m = 4. In this case, there are 34 roads. It is the picture of this case (arrows describe roads):


Bashar wants to run by these rules:

  * He starts at the top-left cell in the grid.

  * In one move Bashar may go up (the symbol 'U'), down (the symbol 'D'), left (the symbol 'L') or right (the symbol 'R'). More formally, if he stands in the cell in the row i and in the column j, i.e. in the cell (i, j) he will move to: 
    * in the case 'U' to the cell (i-1, j).

    * in the case 'D' to the cell (i+1, j).

    * in the case 'L' to the cell (i, j-1).

    * in the case 'R' to the cell (i, j+1).

  * He wants to run exactly k kilometers, so he wants to make exactly k moves.

  * Bashar can finish in any cell of the grid.

  * He can't go out of the grid so at any moment of the time he should be on some cell.

  * Bashar doesn't want to get bored while running so he must not visit the same road twice. But he can visit the same cell any number of times. 


Bashar asks you if it is possible to run by such rules. If it is possible, you should tell him how should he run.

You should give him a steps to do and since Bashar can't remember too many steps, a should not exceed 3000. In every step, you should give him an...
The above is tricky. Write me a correct solution in PYTHON3.
assistant
#Here is the Python code you requested.

from sys import stdin
from bisect import bisect_left as bl
from bisect import bisect_right as br

def input():
    return stdin.readline()[:-1]

def intput():
    return int(input())

def sinput():
    return input().split()

def intsput():
    return map(int, sinput())

class RangedList:
    def __init__(self, start, stop, val=0):
        self.shift = 0 - start
        self.start = start
        self.stop = stop
        self.list = [val] * (stop - start)

    def __setitem__(self, key, value):
        self.list[key + self.shift] = value

    def __getitem__(self, key):
        return self.list[key + self.shift]

    def __repr__(self):
        return str(self.list)

    def __iter__(self):
        return iter(self.list)

# Code
n, m, k = intsput()

largest = 4 * n * m - 2 * m - 2 * n

if k > largest:
    print("NO")
    exit()

print("YES")

path = []

if n > 1:
    path.append([n - 1, 'D'])
    path.append([n - 1, 'U'])
for right in range(m - 1):
    path.append([1, 'R'])
    if n > 1:
        path.append([n - 1, 'DLR'])
        path.append([n - 1, 'U'])
if m > 1:
    path.append([m - 1, 'L'])

answers = []
ran = 0
target = 0
while True:
    nxt = path[target]
    if ran + nxt[0] * len(nxt[1]) <= k:
        answers.append(nxt)
        ran += nxt[0] * len(nxt[1])
        target += 1
        if target == len(path):
            break
    else:
        left = k - ran
        fulls = left // len(nxt[1])
        if fulls:
            answers.append([fulls, nxt[1]])
        left -= fulls * len(nxt[1])
        if left:
            answers.append([1, nxt[1][:left]])
        break

print(len(answers))
for x in answers:
    print(*x)