Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
div=10**9+7
def modinv(a, m=div):
    b = m
    u = 1
    v = 0
    while b:
        t = a//b
        a -= t*b 
        a = a^b
        b = a^b
        a = a^b
        u -= t*v
        u = u^v
        v = u^v
        u = u^v
    u %= m 
    if u < 0: u += m
    return u

N,A,B,C=list(map(int,input().split()))
fact=[1]*(2*N+1)
res = 0
invAB = modinv(A+B)
reveven = (modinv(100-C)*100) % div
memoA = [1]*(N+1)
memoB = [1]*(N+1)

for i in range(1, 2*N + 1): fact[i] = fact[i-1]*i % div
# print(fact)
def ncr(n, r): return fact[n]*modinv(fact[r]*fact[n-r]%div)%div

for i in range(1, N+1): 
    memoA[i] = (memoA[i-1]*A*invAB) % div
    memoB[i] = (memoB[i-1]*B*invAB) % div

for i in range(N, 2*N):
    kitai1 = (
        ((ncr(i-1, N-1)*memoA[N]) % div)*memoB[i-N] + 
        ((ncr(i-1, N-1)*memoB[N]) % div)*memoA[i-N]) % div
    res += kitai1*reveven*i % div

print(res % div)


Fixed submission:
div=10**9+7
def modinv(a, m=div):
    b = m
    u = 1
    v = 0
    while b:
        t = a//b
        a -= t*b 
        a = a^b
        b = a^b
        a = a^b
        u -= t*v
        u = u^v
        v = u^v
        u = u^v
    u %= m 
    if u < 0: u += m
    return u

N,A,B,C=list(map(int,input().split()))
ncr_memo = {}

def ncr(n, r):
    if r == 0: return 1
    if n in ncr_memo:
        return ncr_memo[n]
    if n-1 in ncr_memo:
        ncr_memo[n] = (ncr_memo[n-1]*n*modinv(n-(N-1))) % div
        return ncr_memo[n]
    orn = n

    res = 1
    for i in range(1, r+1):
        res = res*n*modinv(i, div) % div
        n = n-1
    res %= div
    ncr_memo[orn] = res
    return res

for i in range(N, 2*N):
    ncr(i-1, N-1)

res = 0
inv100 = modinv(A+B)

reveven = (modinv(100-C)*100) % div
memoA = [1]*(N+1)
memoB = [1]*(N+1)

for i in range(1, N+1): memoA[i] = (memoA[i-1]*A*inv100) % div
for i in range(1, N+1): memoB[i] = (memoB[i-1]*B*inv100) % div

for i in range(N, 2*N):
    kitai1 = (
        (((ncr(i-1, N-1)*memoA[N]))*memoB[i-N]) + 
        (((ncr(i-1, N-1)*memoB[N]))*memoA[i-N])) % div
    res += kitai1*reveven*i % div

print(res  % div)
Buggy python submission (verdict: Time Limit Exceeded):
N,M,K=map(int, input().split())
div=10**9+7
def ncr(n, r):
    res = 1
    for i in range(1, r+1):
        res = res*n//i
        n = n-1
    return res % div

result = 0
comb = ncr(N*M-2, K-2)
for d in range(1, N):
    result += d*comb*M*M*(N-d)

for d in range(1, M):
    result += d*comb*(M-d)*N*N

print(result % div)


Fixed submission:
N,M,K=map(int, input().split())
div=10**9+7

def modinv(a, m):
    b = m
    u = 1
    v = 0
    while (b):
        t = a // b
        a -= t * b 
        a = a^b
        b = a^b
        a = a^b
        u -= t * v
        u = u^v
        v = u^v
        u = u^v
    u %= m 
    if (u < 0): u += m
    return u

def ncr(n, r):
    res = 1
    for i in range(1, r+1):
        res = res*n*modinv(i, div) % div
        n = n-1
    return res % div

result = 0
comb = ncr(N*M-2, K-2)
for d in range(1, N):
    result += d*comb*M*M*(N-d)

for d in range(1, M):
    result += d*comb*(M-d)*N*N

print(result % div)
Buggy python submission (verdict: Runtime Error):
N,K=map(int, input().split())

class UnionFindTree:
    def __init__(self, n):
        self.nodes = list(range(n+10))
    def find(self, x):
        if self.nodes[x] == x:
            return x
        parent = self.find(self.nodes[x])
        self.nodes[x] = parent
        return parent
    def unite(self, a, b):
        a = self.find(a)
        b = self.find(b)
        if a == b:
            return
        self.nodes[a] = self.nodes[b]
    def is_same(self, a, b):
        return self.find(a) == self.find(b)

uf = UnionFindTree(N)
for i in range(K):
    i,j,k=map(int, input().split())
    uf.unite(i,j)

st = set()
for i in range(1,N+1):
    par = uf.find(i)
    st.add(par)

print(len(st))


Fixed submission:
import sys
sys.setrecursionlimit(10000000)
N,K=map(int, input().split())

class UnionFindTree:
    def __init__(self, n):
        self.nodes = list(range(n+10))
    def find(self, x):
        if self.nodes[x] == x:
            return x
        parent = self.find(self.nodes[x])
        self.nodes[x] = parent
        return parent
    def unite(self, a, b):
        a = self.find(a)
        b = self.find(b)
        if a == b:
            return
        self.nodes[a] = self.nodes[b]
    def is_same(self, a, b):
        return self.find(a) == self.find(b)

uf = UnionFindTree(N)
for i in range(K):
    i,j,k=map(int, input().split())
    uf.unite(i,j)

st = set()
for i in range(1,N+1):
    par = uf.find(i)
    st.add(par)

print(len(st))

Buggy python submission (verdict: Runtime Error):
N,K=map(int, input().split())

class UnionFindTree:
    def __init__(self, n):
        self.nodes = list(range(n+1))
    def find(self, x):
        if self.nodes[x] == x:
            return x
        parent = self.find(self.nodes[x])
        self.nodes[x] = parent
        return parent
    def unite(self, a, b):
        a = self.find(a)
        b = self.find(b)
        if a == b:
            return
        self.nodes[a] = self.nodes[b]
    def is_same(self, a, b):
        return self.find(a) == self.find(b)

uf = UnionFindTree(N)
for i in range(K):
    i,j,k=map(int, input().split())
    uf.unite(i,j)

st = set()
for i in range(1,N+1):
    par = uf.find(i)
    st.add(par)

print(len(st))


Fixed submission:
import sys
sys.setrecursionlimit(10000000)
N,K=map(int, input().split())

class UnionFindTree:
    def __init__(self, n):
        self.nodes = list(range(n+10))
    def find(self, x):
        if self.nodes[x] == x:
            return x
        parent = self.find(self.nodes[x])
        self.nodes[x] = parent
        return parent
    def unite(self, a, b):
        a = self.find(a)
        b = self.find(b)
        if a == b:
            return
        self.nodes[a] = self.nodes[b]
    def is_same(self, a, b):
        return self.find(a) == self.find(b)

uf = UnionFindTree(N)
for i in range(K):
    i,j,k=map(int, input().split())
    uf.unite(i,j)

st = set()
for i in range(1,N+1):
    par = uf.find(i)
    st.add(par)

print(len(st))
Buggy python submission (verdict: Runtime Error):
import collections
N=int(input())
inarr=[[int(j) for j in input().split()] for i in range(N-1)]
nodes={}
class Node:
    def __init__(self, parent, children, value):
        self.parent = parent
        self.children = children
        self.value = value
    
    def __str__(self):
        return "NODE[v={},par={},chld={}]".format(self.value,self.parent.value if self.parent else "none",list(map(lambda x: x.value, self.children)))

for i,j in inarr:
    if not i in nodes:
        nodes[i] = Node(None, [], i)
        if not j in nodes:
            nodes[j] = Node(nodes[i], [], j)
            nodes[i].children.append(nodes[j])
        else:
            nodes[i].parent = nodes[j]
            nodes[j].children.append(nodes[i])
    else:
        if not j in nodes:
            nodes[j] = Node(nodes[i], [], j)
            nodes[i].children.append(nodes[j])
        else:
            if not nodes[i].parent:
                nodes[i].parent = nodes[j]
                nodes[j].children.append(nodes[i])
            elif not nodes[j].parent:
                nodes[j].parent = nodes[i]
                nodes[i].children.append(nodes[j])
            else:
                print("error")

visited = {1: True}
queue = collections.deque([[1, 0]])
while queue:
    i, d = queue.popleft()
    for node in nodes[i].children:
        if not node.value in visited:
            visited[node.value] = True
            queue += [[node.value, d + 1]]
    if nodes[i].parent and not nodes[i].parent.value in visited:
        visited[nodes[i].parent.value] = True
        queue += [[nodes[i].parent.value, d + 1]]

# print("i: {} d: {}".format(i,d))

visited = {i: True}
queue = collections.deque([[i, 0]])
while queue:
    i, d = queue.popleft()
    for node in nodes[i].children:
        if not node.value in visited:
            visited[node.value] = True
            queue += [[node.value, d + 1]]
    if nodes[i].parent and not nodes[i].parent.value in visited:
        visited[nodes[i].parent.value] = True
        queue += [[nodes[i].parent.value, d + 1]]

# print(list(map(str,nodes.values())))
# print("i: {} d: {}".format(i,d))
print('Second' if (d + 1) % 3 == 2 else 'First')


Fixed submission:
import collections
N=int(input())
inarr=[[int(j) for j in input().split()] for i in range(N-1)]
nodes={}
if N == 1:
    print("First")
    exit()

for i,j in inarr:
    if not i in nodes: nodes[i] = [j]
    else: nodes[i].append(j)
    if not j in nodes: nodes[j] = [i]
    else: nodes[j].append(i)

visited = {1}
queue = collections.deque([[1, 0]])
while queue:
    i, d = queue.popleft()
    for node in nodes[i]:
        if not node in visited:
            visited.add(node)
            queue += [[node, d + 1]]

# print("i: {} d: {}".format(i,d))

visited = {i}
queue = collections.deque([[i, 0]])
while queue:
    i, d = queue.popleft()
    for node in nodes[i]:
        if not node in visited:
            visited.add(node)
            queue += [[node, d + 1]]

# print(list(map(str,nodes.values())))
# print("i: {} d: {}".format(i,d))
print('Second' if (d + 1) % 3 == 2 else 'First')
Buggy python submission (verdict: Time Limit Exceeded):
INTMAX = 9223372036854775807
def LI(): return [int(x) for x in input().split()]
def II(): return int(input())

N,K=LI()
INL=LI()
dp = [INTMAX]*N
dp[0] = 0

for i in range(0,N):
    for j in range(1,K+1):
        k = i+j
        if k < N:
            dp[k] = min(dp[k], dp[i]+abs(INL[k]-INL[i]))

# print(dp)
print(dp[N-1])


Fixed submission:
INTMAX = 9223372036854775807
def LI(): return [int(x) for x in input().split()]
def II(): return int(input())

N,K=LI()
INL=LI()
dp = [INTMAX]*N
dp[0] = 0

for i in range(0,N):
    for j in range(1,K+1):
        k = i+j
        if k < N:
            dp[k] = min(dp[k], dp[i]+abs(INL[k]-INL[i]))

# print(dp)
print(dp[N-1])
Buggy python submission (verdict: Runtime Error):
def LI(): return [int(x) for x in input().split()]
def II(): return int(input())

N,W=LI()
INL = [tuple(LI()) for i in range(N)]
DP=[[10**18]*10001 for _ in range(N+1)]
DP[0][0] = 0

for i, (w, v) in enumerate(INL, 1):
    for j in range(100001):
        INL[i][j] = INL[i-1][j]
        if j + v <= 100000:
            INL[i][j+v] = INL[i-1][j]+w

res = 0
for v, w in enumerate(INL[N]):
    if w <= W:
        res = max(res, v)

print(res)


Fixed submission:
def LI(): return [int(x) for x in input().split()]
def II(): return int(input())

N,W=LI()
INL = [tuple(LI()) for i in range(N)]
DP=[[10**18]*100001 for _ in range(N+1)]
DP[0][0] = 0

for i, (w, v) in enumerate(INL, 1):
    # print(i,w,v)
    for j in range(100001):
        DP[i][j] = min(DP[i-1][j], DP[i][j])
        if (j+v) <= 100000:
            DP[i][j+v] = min(DP[i-1][j+v], DP[i-1][j]+w)

res = 0
for v, w in enumerate(DP[N]):
    if w <= W:
        res = max(res, v)

# print(DP[1][0], DP[1][10])
print(res)
Buggy python submission (verdict: Time Limit Exceeded):
S=input()
T=input()
memo = [[0]*(len(T)+1) for _ in range(len(S)+1)]

for i in range(1, len(S)+1):
    for j in range(1, len(T)+1):
        if S[i-1] == T[j-1]:
            memo[i][j] = memo[i-1][j-1] + 1
        else:
            memo[i][j] = max(memo[i-1][j], memo[i][j-1])
 
ans = ''
i = len(S)
j = len(T)
while i > 0 and j > 0:
    if memo[i][j] == memo[i-1][j]:
        i-=1
    elif memo[i][j] == memo[i][j-1]:
        j-=1
    else:
        i-=1
        j-=1
        ans = ans + S[i]

ans = ''.join(reversed(ans))
print(ans)

Fixed submission:
S=input()
T=input()
memo = [[0]*(len(T)+1) for _ in range(len(S)+1)]

for i in range(1, len(S)+1):
    for j in range(1, len(T)+1):
        if S[i-1] == T[j-1]:
            memo[i][j] = memo[i-1][j-1] + 1
        else:
            memo[i][j] = max(memo[i-1][j], memo[i][j-1])
 
ans = ''
i = len(S)
j = len(T)
while i > 0 and j > 0:
    if memo[i][j] == memo[i-1][j]:
        i-=1
    elif memo[i][j] == memo[i][j-1]:
        j-=1
    else:
        i-=1
        j-=1
        ans = ans + S[i]

ans = ''.join(reversed(ans))
print(ans)
Buggy python submission (verdict: Runtime Error):
def LI(): return [int(x) for x in input().split()]
def TI(): return tuple(LI())
def II(): return int(input())

N,M=LI()

MP={}
for _ in range(M):
    fr, to = TI()
    if not fr in MP:
        MP[fr] = []
    MP[fr].append(to)

RESL=[-1]*(N+1)
def dfs(n):
    if RESL[n] != -1:
        return RESL[n]
    else:
        res = 0
        if n in MP:
            for to in MP[n]:
                res = max(res, dfs(to))
            res += 1
        RESL[n] = res
        return res
for i in range(1, N+1): dfs(i)
# print(RESL)
print(max(RESL))


Fixed submission:
import sys
sys.setrecursionlimit(10**7)

def LI(): return [int(x) for x in input().split()]
def TI(): return tuple(LI())
def II(): return int(input())

N,M=LI()

MP={}
for _ in range(M):
    fr, to = TI()
    if not fr in MP:
        MP[fr] = []
    MP[fr].append(to)

RESL=[-1]*(N+1)
def dfs(n):
    if RESL[n] != -1:
        return RESL[n]
    else:
        res = 0
        if n in MP:
            for to in MP[n]:
                res = max(res, dfs(to))
            res += 1
        RESL[n] = res
        return res
for i in range(1, N+1): dfs(i)
# print(RESL)
print(max(RESL))
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
DVSR = 1000000007
def LI(): return [int(x) for x in input().split()]
H,W=LI()
MP=[input() for _ in range(H)]
MEMO=[[(-1,0)]*W for _ in range(H)]
MEMO[0][0] = (0,1)
QU=deque([])

QU.append((0,0,0))
IT=[(1,0),(0,1)]
while QU:
    i,j,cost = QU.popleft()
    cost+=1
    pat = MEMO[i][j][1]
    for dy, dx in IT:
        ny, nx = i+dy, j+dx
        if ny < H and ny >= 0 and nx < W and nx >= 0 and MP[ny][nx] == '.':
            cost2, pat2 = MEMO[ny][nx]
            if cost2 == -1:
                MEMO[ny][nx] = (cost, pat)
                QU.append((ny,nx,cost))
            elif cost2 == cost:
                _pat = (pat+pat2)%DVSR
                MEMO[ny][nx] = (cost,_pat)

print(MEMO[H-1][W-1][1])

Fixed submission:
from collections import deque
import sys
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 1000000007
def POW(x, y): return pow(x, y, DVSR)
def INV(x, d=DVSR): return pow(x, d - 2, d)
def DIV(x, y, d=DVSR): return (x * INV(y, d)) % d
def LI(): return [int(x) for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()
def II(): return int(input())

H,W=LI()

MP=[input() for _ in range(H)]
MEMO=[[(-1,0)]*W for _ in range(H)]
MEMO[0][0] = (0,1)
QU=deque([])

QU.append((0,0,0))
IT=[(1,0),(0,1)]
while QU:
    i,j,cost = QU.popleft()
    cost+=1
    pat = MEMO[i][j][1]
    for dy, dx in IT:
        ny, nx = i+dy, j+dx
        if ny < H and ny >= 0 and nx < W and nx >= 0 and MP[ny][nx] == '.':
            cost2, pat2 = MEMO[ny][nx]
            if cost2 == -1:
                # print('i:{},j:{},ny:{},nx:{},cost:{},pat:{}'.format(i,j,ny,nx,cost,pat))
                MEMO[ny][nx] = (cost, pat)
                QU.append((ny,nx,cost))
            elif cost2 == cost:
                _pat = (pat+pat2)%DVSR
                MEMO[ny][nx] = (cost,_pat)
                # print('i:{},j:{},ny:{},nx:{},cost:{},pat:{}'.format(i,j,ny,nx,cost,_pat))
                # QU.append((ny,nx,cost,pat))
# for li in MEMO:
    # print(li)
print(MEMO[H-1][W-1][1])
Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 1000000007
def POW(x, y): return pow(x, y, DVSR)
def INV(x, d=DVSR): return pow(x, d - 2, d)
def DIV(x, y, d=DVSR): return (x * INV(y, d)) % d
def LI(): return [int(x) for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()
def II(): return int(input())

N=II()
INL=list(map(float, LS()))
DP=[0.0]*(N+1)
DP[0]=1.0

for p in INL:
    for i in reversed(range(N)):
        DP[i+1] = DP[i+1]*(1.0-p) + DP[i]*p

# print(DP)
print(DP[N//2+1])

Fixed submission:
import sys
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 1000000007
def POW(x, y): return pow(x, y, DVSR)
def INV(x, d=DVSR): return pow(x, d - 2, d)
def DIV(x, y, d=DVSR): return (x * INV(y, d)) % d
def LI(): return [int(x) for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()
def II(): return int(input())

N=II()
INL=list(map(float, LS()))
DP=[0.0]*(N+1)
DP[0]=1.0

for p in INL:
    for i in reversed(range(N)):
        DP[i+1] = DP[i+1]*(1.0-p) + DP[i]*p

# print(DP)
print(DP[N//2+1])

Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 1000000007
def POW(x, y): return pow(x, y, DVSR)
def INV(x, d=DVSR): return pow(x, d - 2, d)
def DIV(x, y, d=DVSR): return (x * INV(y, d)) % d
def LI(): return [int(x) for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()
def II(): return int(input())

N=II()
INL=list(map(float, LS()))
DP=[0.0]*(N+1)
DP[0]=1.0

for p in INL:
    for i in reversed(range(N)):
        DP[i+1] = DP[i+1]*(1.0-p) + DP[i]*p

# print(DP)
print(sum(DP[N//2+1]))

Fixed submission:
import sys
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 1000000007
def POW(x, y): return pow(x, y, DVSR)
def INV(x, d=DVSR): return pow(x, d - 2, d)
def DIV(x, y, d=DVSR): return (x * INV(y, d)) % d
def LI(): return [int(x) for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()
def II(): return int(input())

N=II()
INL=list(map(float, LS()))
DP=[0.0]*(N+1)
DP[0]=1.0

for p in INL:
    for i in reversed(range(N)):
        DP[i+1] = DP[i+1]*(1.0-p) + DP[i]*p

# print(DP)
print(DP[N//2+1])
Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
MOD = 1000000007
def POW(x, y): return pow(x, y, MOD)
def INV(x, m=MOD): return pow(x, m - 2, m)
def DIV(x, y, m=MOD): return (x * INV(y, m)) % m
def LI(): return [int(x) for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()
def II(): return int(input())

N,K=LI()
INL=LI()
DP=[False]*(K+1)

for i in range(0,K+1):
    for v in INL:
        if v+i <= K:
            DP[v+i] = DP[v+i] or not DP[i]

# print(DP)
print('First' if DP[K] else 'Second')


Fixed submission:
import sys
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
MOD = 1000000007
def POW(x, y): return pow(x, y, MOD)
def INV(x, m=MOD): return pow(x, m - 2, m)
def DIV(x, y, m=MOD): return (x * INV(y, m)) % m
def LI(): return [int(x) for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()
def II(): return int(input())

N,K=LI()
INL=LI()
DP=[False]*(K+1)

for i in range(0,K+1):
    for v in INL:
        if v+i <= K:
            DP[v+i] = DP[v+i] or not DP[i]

# print(DP)
print('First' if DP[K] else 'Second')
Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int, input().split())
tmp=M//N
ma=1
for i in range(1, tmp+1):
    if not M % i:
        ma = max(i, ma)
print(ma)


Fixed submission:
from math import sqrt
N,M=map(int, input().split())
tmp=int(sqrt(M))
ma=1
for i in range(1, tmp+1):
    if not M % i:
        div = M//i
        ma = max(i if i*N <= M else 0, ma, div if div*N <= M else 0)
print(ma)

Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int, input().split())
tmp=M//N
ma=1
for i in range(1, tmp+1):
    if not M % i:
        ma = max(i, ma)
print(ma)


Fixed submission:
from math import sqrt
N,M=map(int, input().split())
tmp=int(sqrt(M))
ma=1
for i in range(1, tmp+1):
    if not M % i:
        div = M//i
        ma = max(i if i*N <= M else 0, ma, div if div*N <= M else 0)
print(ma)
Buggy python submission (verdict: Runtime Error):
inp = [[int(x) for x in input().split()] for _ in range(int(input()))]
inpsum = sum(map(lambda ij: abs(ij[0]+ij[1]) % 2, inp))
if not (inpsum == len(inp) or inpsum == 0):
    print(-1)
    exit(0)

seeds = ([] if inpsum == len(inp) else [1]) + [1 << i for i in range(0, 32)]
# print(inp)

print(' '.join(map(str, reversed(seeds))))

for x, y in inp:
    for k in reversed(seeds):
        res = ''
        if abs(x) > abs(y):
            if x > 0:
                res = 'R'
                x -= k
            else:
                res = 'L'
                x += k
        else:
            if y > 0:
                res = 'U'
                y -= k
            else:
                res = 'D'
                y += k
        # print((x,y))
        print(res, end='')
    print('')


Fixed submission:
for s in input():
    if s == '9': print('1', end='')
    else: print('9', end='')
print('')
Buggy python submission (verdict: Runtime Error):
inp = [[int(x) for x in input().split()] for _ in range(int(input()))]
inpsum = sum(map(lambda ij: abs(ij[0]+ij[1]) % 2, inp))
if not (inpsum == len(inp) or inpsum == 0):
    print(-1)
    exit(0)

# print(inp)

max_abs = max(*map(lambda ij: abs(ij[0])+abs(ij[1]), inp))
print(max_abs)
print(' '.join(['1']*max_abs))

for i, j in inp:
    tmp = max_abs
    res = ''
    res += ('L' if i < 0 else 'R')*abs(i)
    res += ('D' if j < 0 else 'U')*abs(j)
    res += 'LR' * ((max_abs - len(res)) // 2)
    print(res)


Fixed submission:
inp = [[int(x) for x in input().split()] for _ in range(int(input()))]
inpsum = sum(map(lambda ij: abs(ij[0]+ij[1]) % 2, inp))
if not (inpsum == len(inp) or inpsum == 0):
    print(-1)
    exit(0)

seeds = ([] if inpsum == len(inp) else [1]) + [1 << i for i in range(0, 32)]
# print(inp)

print(len(seeds))
print(' '.join(map(str, reversed(seeds))))

for x, y in inp:
    for k in reversed(seeds):
        res = ''
        if abs(x) > abs(y):
            if x > 0:
                res = 'R'
                x -= k
            else:
                res = 'L'
                x += k
        else:
            if y > 0:
                res = 'U'
                y -= k
            else:
                res = 'D'
                y += k
        # print((x,y))
        print(res, end='')
    print('')
Buggy python submission (verdict: Runtime Error):
i,j=map(int, input())
print(i-j+1)

Fixed submission:
i,j=map(int, input().split())
print(i-j+1)
Buggy python submission (verdict: Runtime Error):
N,C=map(int, input().split())
inarr=[[int(i) for i in input().split()] for _ in range(N)]
maxes1=[(0, 0)]*N
maxes2=[(0, 0)]*N
cums=[0]*(N+1)
cum = 0
cummax1 = (0, 0)
cummax2 = (0, 0)
for i, [a, v] in enumerate(inarr):
    cum += v
    if (cum - a) > cummax1[0]:
        cummax1 = (cum - a, a)
    if (cum - 2*a) > cummax2[0]:
        cummax2 = (cum - 2*a, a)
    maxes1[i]=cummax1
    maxes2[i]=cummax2
    cums[i+1]=cum

resmax = 0
for i, [b, v] in enumerate(inarr):
    oasum1, x = (0, 0) if i == 0 else maxes1[i-1]
    oasum2, x = (0, 0) if i == 0 else maxes2[i-1]
    ob = cums[N] - cums[i]
    resmax = max(resmax, ob + oasum1 - 2*(C-b), ob + oasum2 - (C-b))

print(max(resmax, maxes1[N-1][0], 0))


Fixed submission:
import sys
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
MOD = 1000000007
def POW(x, y): return pow(x, y, MOD)
def INV(x, m=MOD): return pow(x, m - 2, m)
def DIV(x, y, m=MOD): return (x * INV(y, m)) % m
def LI(): return [int(x) for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()

print(input().count('o')*100+700)