Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

import sys
from itertools import accumulate

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

N = INT()
A = LIST()
B = LIST()

def solve(N):
    dp = list2d(4, N+1, -INF)
    for i in range(N+1):
        dp[0][i] = i
    for i in range(3):
        a, b = A[i], B[i]
        for j in range(N+1):
            dp[i+1][j] = max(dp[i+1][j], dp[i][j])
            if j+a <= N:
                dp[i][j+a] = max(dp[i][j+a], dp[i][j] + b)
                dp[i+1][j+a] = max(dp[i+1][j+a], dp[i][j] + b)
    return dp[3][N]

N2 = solve(N)
A, B = B, A
ans = solve(N2)
print(ans)


Fixed submission:
# -*- coding: utf-8 -*-

import sys
from itertools import accumulate

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

N = INT()
A = LIST()
B = LIST()

S1 = []
S2 = []
for i in range(3):
    if A[i] < B[i]:
        S1.append(i)
    else:
        S2.append(i)
        A[i], B[i] = B[i], A[i]

def calc(cnt, i):
    d, m = divmod(cnt, A[i])
    return d * B[i] + m

def count(S, N):
    if len(S) == 0:
        return N
    elif len(S) == 1:
        return calc(N, S[0])
    elif len(S) == 2:
        res = 0
        for x in range(N+1):
            y = N - x
            if y < 0:
                break
            cnt = calc(x, S[0]) + calc(y, S[1])
            res = max(res, cnt)
        return res
    else:
        res = 0
        for x in range(N+1):
            for y in range(N+1):
                z = N - x - y
                if z < 0:
                    break
                cnt = calc(x, S[0]) + calc(y, S[1]) + calc(z, S[2])
                res = max(res, cnt)
        return res

N2 = count(S1, N)
ans = count(S2, N2)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

H,W=MAP()
grid=[]
for i in range(H):
    grid.append(list(input()))

L=list2d(H, W, 0)
R=list2d(H, W, 0)
D=list2d(H, W, 0)
U=list2d(H, W, 0)

for i in range(H):
    cnt=0
    for j in range(W):
        if grid[i][j]=='#':
            cnt=0
        else:
            cnt+=1
        L[i][j]=cnt
for i in range(H):
    cnt=0
    for j in range(W-1, -1, -1):
        if grid[i][j]=='#':
            cnt=0
        else:
            cnt+=1
        R[i][j]=cnt
for i in range(W):
    cnt=0
    for j in range(H):
        if grid[j][i]=='#':
            cnt=0
        else:
            cnt+=1
        D[j][i]=cnt
for i in range(W):
    cnt=0
    for j in range(H-1, -1, -1):
        if grid[j][i]=='#':
            cnt=0
        else:
            cnt+=1
        U[j][i]=cnt

ans=0
for i in range(H):
    for j in range(W):
        if grid[i][j]!='#':
            ans=max(ans, L[i][j]+R[i][j]+D[i][j]+U[i][j]-3)
print(ans)


Fixed submission:
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

H,W=MAP()
grid=[]
for i in range(H):
    grid.append(list(input()))

L=list2d(H, W, 0)
R=list2d(H, W, 0)
D=list2d(H, W, 0)
U=list2d(H, W, 0)

for i in range(H):
    cnt=0
    for j in range(W):
        if grid[i][j]=='#':
            cnt=0
        else:
            cnt+=1
        L[i][j]=cnt
for i in range(H):
    cnt=0
    for j in range(W-1, -1, -1):
        if grid[i][j]=='#':
            cnt=0
        else:
            cnt+=1
        R[i][j]=cnt
for i in range(W):
    cnt=0
    for j in range(H):
        if grid[j][i]=='#':
            cnt=0
        else:
            cnt+=1
        D[j][i]=cnt
for i in range(W):
    cnt=0
    for j in range(H-1, -1, -1):
        if grid[j][i]=='#':
            cnt=0
        else:
            cnt+=1
        U[j][i]=cnt

ans=0
for i in range(H):
    for j in range(W):
        if grid[i][j]!='#':
            ans=max(ans, L[i][j]+R[i][j]+D[i][j]+U[i][j]-3)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

R,G,B,N=MAP()

cnt=0
for x in range(3001):
    for y in range(3001):
        z=(N-R*x-G*y)/B
        # zが0以上の整数になっていればOK
        if z>=0 and z.is_integer():
            cnt+=1
print(cnt)


Fixed submission:
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

R,G,B,N=MAP()

cnt=0
for x in range(3001):
    for y in range(3001):
        z=(N-R*x-G*y)/B
        # zが0以上の整数になっていればOK
        if z>=0 and z.is_integer():
            cnt+=1
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

K,A,B=MAP()

rate=B/A
cnt=A-1
bis=A
while cnt<=K-2:
    bis=(bis//A)*A*rate+bis%A
    cnt+=2
if cnt==K-1:
    bis+=1

print(max(int(bis), K+1))


Fixed submission:
# -*- coding: utf-8 -*-

"""
参考：https://emtubasa.hateblo.jp/entry/2019/02/12/003250
・問題の意味読み違えてた。
　A*2枚のビスケットがあったら2円分換金していいと思ってた。
　どうりでビスケット増え過ぎると思った。
"""

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

K,A,B=MAP()

rate=B/A
rest=K-(A-1)
bis=A

bis+=(B-A)*(rest//2)+(rest%2)

print(max(bis, K+1))
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians
if sys.version_info.minor >= 5: from math import gcd
else: from fractions import gcd 
from heapq import heappop, heappush, heapify, heappushpop
from bisect import bisect_left, bisect_right
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from functools import reduce, partial
from fractions import Fraction
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def ceil(a, b=1): return int(-(-a // b))
def round(x): return int((x*2+1) // 2)
def fermat(x, y, MOD): return x * pow(y, MOD-2, MOD) % MOD
def lcm(x, y): return (x * y) // gcd(x, y)
def lcm_list(nums): return reduce(lcm, nums, 1)
def gcd_list(nums): return reduce(gcd, nums, nums[0])
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N, K = MAP()
hN = LIST()

# dp[足場番号] = そこまで行くための最小コスト
dp = [INF] * (N)
dp[0] = 0
for i in range(N):
    for j in range(1, K+1):
        if i+j < N:
            # j個先に跳ぶ
            dp[i+j] = min(dp[i] + abs(hN[i+j]-hN[i]), dp[i+j])
print(dp[N-1])


Fixed submission:
# -*- coding: utf-8 -*-

import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians
if sys.version_info.minor >= 5: from math import gcd
else: from fractions import gcd 
from heapq import heappop, heappush, heapify, heappushpop
from bisect import bisect_left, bisect_right
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from functools import reduce, partial
from fractions import Fraction
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def ceil(a, b=1): return int(-(-a // b))
def round(x): return int((x*2+1) // 2)
def fermat(x, y, MOD): return x * pow(y, MOD-2, MOD) % MOD
def lcm(x, y): return (x * y) // gcd(x, y)
def lcm_list(nums): return reduce(lcm, nums, 1)
def gcd_list(nums): return reduce(gcd, nums, nums[0])
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N, K = MAP()
hN = LIST()

# dp[足場番号] = そこまで行くための最小コスト
dp = [INF] * (N)
dp[0] = 0
for i in range(N):
    for j in range(1, K+1):
        if i+j < N:
            # j個先に跳ぶ
            dp[i+j] = min(dp[i] + abs(hN[i+j]-hN[i]), dp[i+j])
print(dp[N-1])
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians
if sys.version_info.minor >= 5: from math import gcd
else: from fractions import gcd 
from heapq import heappop, heappush, heapify, heappushpop
from bisect import bisect_left, bisect_right
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from functools import reduce, partial
from fractions import Fraction
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def ceil(a, b=1): return int(-(-a // b))
def round(x): return int((x*2+1) // 2)
def fermat(x, y, MOD): return x * pow(y, MOD-2, MOD) % MOD
def lcm(x, y): return (x * y) // gcd(x, y)
def lcm_list(nums): return reduce(lcm, nums, 1)
def gcd_list(nums): return reduce(gcd, nums, nums[0])
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N, W = MAP()
wN, vN = [0]*N, [0]*N
for i in range(N):
    wN[i], vN[i] = MAP()

# dp[何個目までから選ぶか][これまでに選んだ荷物の重さ] = これまでに選んだ荷物の価値
dp = [[0] * (W+1) for i in range(N+1)]

for i in range(N):
    for j in range(W+1):
        # 真下には常に送る
        dp[i+1][j] = max(dp[i+1][j], dp[i][j])
        if j + wN[i] <= W:
            # 重さが制限内なら右下にも送る
            dp[i+1][j+wN[i]] = max(dp[i+1][j+wN[i]], dp[i][j] + vN[i])
print(dp[N][W])


Fixed submission:
# -*- coding: utf-8 -*-

import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians
if sys.version_info.minor >= 5: from math import gcd
else: from fractions import gcd 
from heapq import heappop, heappush, heapify, heappushpop
from bisect import bisect_left, bisect_right
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from functools import reduce, partial
from fractions import Fraction
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def ceil(a, b=1): return int(-(-a // b))
def round(x): return int((x*2+1) // 2)
def fermat(x, y, MOD): return x * pow(y, MOD-2, MOD) % MOD
def lcm(x, y): return (x * y) // gcd(x, y)
def lcm_list(nums): return reduce(lcm, nums, 1)
def gcd_list(nums): return reduce(gcd, nums, nums[0])
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N, W = MAP()
wN, vN = [0]*N, [0]*N
for i in range(N):
    wN[i], vN[i] = MAP()

# dp[何個目までから選ぶか][これまでに選んだ荷物の重さ] = これまでに選んだ荷物の価値
dp = [[0] * (W+1) for i in range(N+1)]

for i in range(N):
    for j in range(W+1):
        # 真下には常に送る
        dp[i+1][j] = max(dp[i+1][j], dp[i][j])
        if j + wN[i] <= W:
            # 重さが制限内なら右下にも送る
            dp[i+1][j+wN[i]] = max(dp[i+1][j+wN[i]], dp[i][j] + vN[i])
print(dp[N][W])
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

N = INT()
nodes = [[] for i in range(N)]
for i in range(N-1):
    a, b = MAP()
    a -= 1; b -= 1
    nodes[a].append(b)
    nodes[b].append(a)

# dp1[i] := 頂点iを白にしてその先の全体を塗り分ける通り数
dp1 = [1] * N
# dp2[i] := 頂点iを黒にしてその先の全体を塗り分ける通り数
dp2 = [1] * N
def rec(u, prev):
    for v in nodes[u]:
        if v != prev:
            rec(v, u)
            # 白 <= 白+黒 の遷移
            dp1[u] *= dp1[v] + dp2[v]
            dp1[u] %= MOD
            # 黒 <= 白 の遷移 
            dp2[u] *= dp1[v]
            dp2[u] %= MOD

rec(0, -1)
ans = (dp1[0]+dp2[0]) % MOD
print(ans)


Fixed submission:
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

N = INT()
nodes = [[] for i in range(N)]
for i in range(N-1):
    a, b = MAP()
    a -= 1; b -= 1
    nodes[a].append(b)
    nodes[b].append(a)

# dp1[i] := 頂点iを白にしてその先の全体を塗り分ける通り数
dp1 = [1] * N
# dp2[i] := 頂点iを黒にしてその先の全体を塗り分ける通り数
dp2 = [1] * N
def rec(u, prev):
    for v in nodes[u]:
        if v != prev:
            rec(v, u)
            # 白 <= 白+黒 の遷移
            dp1[u] *= dp1[v] + dp2[v]
            dp1[u] %= MOD
            # 黒 <= 白 の遷移 
            dp2[u] *= dp1[v]
            dp2[u] %= MOD

rec(0, -1)
ans = (dp1[0]+dp2[0]) % MOD
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

from math import factorial, sqrt

# 約数の個数
def num_div(num):
    total = 1
    # 終点はルート切り捨て+1
    end = int(sqrt(num)) + 1
    for i in range(2, end+1):
        cnt = 0
        # 素因数分解：小さい方から割れるだけ割って指数をカウント
        while num % i == 0:
            num //= i
            cnt += 1
        # 指数+1をかけていくと約数をカウントできる
        total *= (cnt + 1)
        # 最後までそのまま来たやつは素数なので2つ
        if i == end and total == 1:
            return 2
    return total

# 約数の列挙
def num_div_set(N):
    # 1とその数はデフォで入れとく
    s = {1, N}
    # 終点はルート切り捨て+1
    end = int(sqrt(N)) + 1
    for i in range(2, end+1):
        # 割り切れるなら、iとN/iを追加
        if N % i == 0:
            s.add(i)
            s.add(N // i)
    return s

N = int(input())

num = factorial(N)

cnt = 0
for i in num_div_set(num):
        if num_div(i) == 75:
            cnt += 1
print(cnt)


Fixed submission:
# -*- coding: utf-8 -*-

"""
解説参考
・まず素因数分解で階乗全部バラす
・そこからいい感じの組み合わせを探して数える
"""

N = int(input())

# 階乗の素因数分解：ひとつずつ分解したものを合算
e = [0] * (N+1)
# 階乗の各値ループ
for i in range(2, N+1):
    num = i
    # 素因数分解するループ
    for j in range(2, N+1):
        while num % j == 0:
            num //= j
            e[j] += 1

# 約数75(各指数+1をかける)を取りうる素因数の組み合わせを探していく
nums = set()
# 指数が4, 4, 2
for p in range(2, N+1):
    for q in range(2, N+1):
        for r in range(2, N+1):
            if (e[p] >= 4 and e[q] >= 4 and e[r] >= 2
                    and p != q and q != r and r != p):
                nums.add(pow(p, 4) * pow(q, 4) * pow(r, 2))
# 指数が14, 4 or 24, 2
for p in range(2, N+1):
    for q in range(2, N+1):
        if e[p] >= 14 and e[q] >= 4 and p != q:
            nums.add(pow(p, 14) * pow(q, 4))
        if e[p] >= 24 and e[q] >= 2 and p != q:
            nums.add(pow(p, 24) * pow(q, 2))
# 指数が74
for p in range(2, N+1):
    if e[p] >= 74:
        nums.add(pow(p, 74))  

print(len(nums))
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

N,T = map(int, input().split())

cNtN = [[0] * 2 for i in range(N)]
for i in range(N):
    cNtN[i][0], cNtN[i][1] = map(int, input().split())

min_c = float('inf')
for i in range(N):
    if cNtN[i][1] <= T and cNtN[i][0] < min_C:
        min_c = cNtN[i][0]

if min_c == float('inf'):
    print('TLE')
else:
    print(min_c)

Fixed submission:
# -*- coding: utf-8 -*-

N,T = map(int, input().split())

cNtN = [[0] * 2 for i in range(N)]
for i in range(N):
    cNtN[i][0], cNtN[i][1] = map(int, input().split())

for i in range(N):
    if cNtN[i][1] > T:
        cNtN[i][0] = float('inf')

min_c = float('inf')
for i in range(len(cNtN)):
    min_c = min(min_c, cNtN[i][0])

if min_c == float('inf'):
    print('TLE')
else:
    print(min_c)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

"""
部分点狙い
・アームを細かく割ってどこでも行けるようにする
"""

N = int(input())
xN, yN = [0] * N, [0] * N
xN[0], yN[0] = map(int, input().split())
od_ev = (abs(xN[0]) + abs(yN[0])) % 2
max_len = abs(xN[0]) + abs(yN[0])
for i in range(1, N):
    xN[i], yN[i] = map(int, input().split())
    # まず大前提として偶奇が合うかどうか
    if od_ev != (abs(xN[i]) + abs(yN[i])) % 2:
        print(-1)
        exit()
    # 最大距離の記録
    max_len = max(abs(xN[i]) + abs(yN[i]), max_len)

print(max_len)
print(*([1] * max_len))
for i in range(N):
    ans = ''
    # 必要な場所への移動
    if xN[i] < 0:
        ans += 'L' * abs(xN[i])
    elif xN[i] > 0:
        ans += 'R' * xN[i]
    if yN[i] < 0:
        ans += 'D' * abs(yN[i])
    elif yN[i] > 0:
        ans += 'U' * yN[i]
    # 余った長さを適当に動かす
    for i in range(max_len - len(ans)):
        if i % 2:
            ans += 'L'
        else:
            ans += 'R'
    print(ans)


Fixed submission:
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N=INT()
XY=[[None] for i in range(N)]
x,y=MAP()
XY[0]=(x, y)
od_ev=(abs(x)+abs(y))%2
for i in range(1, N):
    x,y=MAP()
    # まず大前提として偶奇が合うかどうか
    if od_ev!=(abs(y)+abs(x))%2:
        print(-1)
        exit()
    XY[i]=(x, y)

# アームの作成(2冪で構成する)
arms=[]
for i in range(31, -1, -1):
    arms.append(2**i)
if od_ev==0: arms.append(1)
print(len(arms))
print(*arms)

for i in range(N):
    ans=['']*len(arms)
    x,y=XY[i]
    # 斜めに交差するu座標とv座標を使う
    u=x+y
    v=x-y
    for j, arm in enumerate(arms):
        # uとvの正負の応じて、動かす方向を決める
        if u>=0 and v>=0:
            ans[j]='R'
            u-=arm
            v-=arm
        elif u>=0 and v<0:
            ans[j]='U'
            u-=arm
            v+=arm
        elif u<0 and v>=0:
            ans[j]='D'
            u+=arm
            v-=arm
        elif u<0 and v<0:
            ans[j]='L'
            u+=arm
            v+=arm
    print(''.join(ans))