Buggy python submission (verdict: Runtime Error):
#!/usr/bin/python3

import math
import sys


DEBUG = False


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


def dprint(*value, sep=' ', end='\n'):
    if DEBUG:
        print(*value, sep=sep, end=end)


def solve(N, A):
    par = abs(A[0][0] + A[0][1]) % 2
    for (x, y) in A:
        if abs(x + y) % 2 != par:
            return None

    m = [1] * (20 + par)
    S = []

    for (x, y) in A:
        assert abs(x) <= 10
        assert abs(y) <= 10
        s = []
        if x >= 0:
            for _ in range(x):
                s.append('R')
        else:
            for _ in range(-x):
                s.append('L')

        if y >= 0:
            for _ in range(y):
                s.append('U')
        else:
            for _ in range(-y):
                s.append('D')

        while len(s) < len(m):
            s.append('R')
            s.append('L')

        S.append(''.join(s))

    return (m, S)


def main():
    N = int(inp())
    A = []
    for _ in range(N):
        x, y = [int(e) for e in inp().split()]
        A.append((x, y))

    ans = solve(N, A)
    if ans is None:
        print('-1')
        return

    m, s = ans
    print(len(m))
    print(*m)
    for t in s:
        print(t)


if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/python3

import math
import sys


DEBUG = False


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


def dprint(*value, sep=' ', end='\n'):
    if DEBUG:
        print(*value, sep=sep, end=end)


def solve(N, A):
    par = abs(A[0][0] + A[0][1]) % 2
    for (x, y) in A:
        if abs(x + y) % 2 != par:
            return None

    M = [2 ** i for i in range(31, -1, -1)]
    if par == 0:
        M.append(1)
    S = []

    for x, y in A:
        u = x + y
        v = x - y
        if par == 0:
            u += 1
            v += 1

        s = []
        for i in range(32):
            if u > 0:
                uv = 1
                u -= M[i]
            else:
                uv = -1
                u += M[i]

            if v > 0:
                vv = 1
                v -= M[i]
            else:
                vv = -1
                v += M[i]

            if (uv, vv) == (-1, -1):
                s.append('L')
            elif (uv, vv) == (1, 1):
                s.append('R')
            elif (uv, vv) == (-1, 1):
                s.append('D')
            else:
                s.append('U')

        assert u == 0
        assert v == 0

        if par == 0:
            s.append('L')

        S.append(''.join(s))

    return (M, S)



def main():
    N = int(inp())
    A = []
    for _ in range(N):
        x, y = [int(e) for e in inp().split()]
        A.append((x, y))

    ans = solve(N, A)
    if ans is None:
        print('-1')
        return

    m, s = ans
    print(len(m))
    print(*m)
    for t in s:
        print(t)


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
#!/usr/bin/python3

import math
import sys


DEBUG = False


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


def dprint(*value, sep=' ', end='\n'):
    if DEBUG:
        print(*value, sep=sep, end=end)


def solve(N, A):
    par = abs(A[0][0] + A[0][1]) % 2
    for (x, y) in A:
        if abs(x + y) % 2 != par:
            return None

    m = [1] * (10 + par)
    S = []

    for (x, y) in A:
        assert abs(x) <= 10
        assert abs(y) <= 10
        s = []
        if x >= 0:
            for _ in range(x):
                s.append('R')
        else:
            for _ in range(-x):
                s.append('L')

        if y >= 0:
            for _ in range(y):
                s.append('U')
        else:
            for _ in range(-y):
                s.append('D')

        while len(s) < len(m):
            s.append('R')
            s.append('L')

        S.append(''.join(s))

    return (m, S)


def main():
    N = int(inp())
    A = []
    for _ in range(N):
        x, y = [int(e) for e in inp().split()]
        A.append((x, y))

    ans = solve(N, A)
    if ans is None:
        print('-1')
        return

    m, s = ans
    print(len(m))
    print(*m)
    for t in s:
        print(t)


if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/python3

import math
import sys


DEBUG = False


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


def dprint(*value, sep=' ', end='\n'):
    if DEBUG:
        print(*value, sep=sep, end=end)


def solve(N, A):
    par = abs(A[0][0] + A[0][1]) % 2
    for (x, y) in A:
        if abs(x + y) % 2 != par:
            return None

    M = [2 ** i for i in range(31, -1, -1)]
    if par == 0:
        M.append(1)
    S = []

    for x, y in A:
        u = x + y
        v = x - y
        if par == 0:
            u += 1
            v += 1

        s = []
        for i in range(32):
            if u > 0:
                uv = 1
                u -= M[i]
            else:
                uv = -1
                u += M[i]

            if v > 0:
                vv = 1
                v -= M[i]
            else:
                vv = -1
                v += M[i]

            if (uv, vv) == (-1, -1):
                s.append('L')
            elif (uv, vv) == (1, 1):
                s.append('R')
            elif (uv, vv) == (-1, 1):
                s.append('D')
            else:
                s.append('U')

        assert u == 0
        assert v == 0

        if par == 0:
            s.append('L')

        S.append(''.join(s))

    return (M, S)



def main():
    N = int(inp())
    A = []
    for _ in range(N):
        x, y = [int(e) for e in inp().split()]
        A.append((x, y))

    ans = solve(N, A)
    if ans is None:
        print('-1')
        return

    m, s = ans
    print(len(m))
    print(*m)
    for t in s:
        print(t)


if __name__ == '__main__':
    main()