Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
s = int(input())
l=[s]
i=1
def func(a):
  if a%2==0:
    return(a/2)
  else:
    return(3*a+1)

def Collatz(s):
  i+=1
  l.append(func(s))
  if not len(l) == len(set(l)):
    print(i)
    break
  else:
    continue

Collatz(s)

Fixed submission:
s = int(input())
l=[s]
i=1
def func(a):
  if a%2==0:
    return(a/2)
  else:
    return(3*a+1)

while (len(l)==len(set(l))):
  i+=1
  s = func(s)
  l.append(s)
print(i)

Buggy python submission (verdict: Runtime Error):
s = map(int, input().split())
l=[s]
i=1
def func(a):
  if a%2==0:
    return(a/2)
  else:
    return(3*a+1)

def Collatz(s):
  i+=1
  l.append(func(s))
  if not len(l) == len(set(l)):
    print(i)
    break
  else:
    continue

Collatz(s)

Fixed submission:
s = int(input())
l=[s]
i=1
def func(a):
  if a%2==0:
    return(a/2)
  else:
    return(3*a+1)

while (len(l)==len(set(l))):
  i+=1
  s = func(s)
  l.append(s)
print(i)

Buggy python submission (verdict: Runtime Error):
s = map(int, input().split())
l=[s]
i=1
def func(a):
  if a%2==0:
    return a/2
  else:
    return 3s+1

def Collatz(s):
    i+=1
	l.append(func(s))
	if not len(l) == len(set(l)):
        print(i)
        break
    else:
        continue
Collatz(s)

Fixed submission:
s = int(input())
l=[s]
i=1
def func(a):
  if a%2==0:
    return(a/2)
  else:
    return(3*a+1)

while (len(l)==len(set(l))):
  i+=1
  s = func(s)
  l.append(s)
print(i)

Buggy python submission (verdict: Runtime Error):
s = map(int, input().split()
l=[s]
i=1
def func(a):
  if a%2==0:
    return a/2
  else:
    return 3s+1

def Collatz(s):
    i+=1
	l.append(func(s))
	if not len(l) == len(set(l)):
        print(i)
        break
    else:
        continue

Fixed submission:
s = int(input())
l=[s]
i=1
def func(a):
  if a%2==0:
    return(a/2)
  else:
    return(3*a+1)

while (len(l)==len(set(l))):
  i+=1
  s = func(s)
  l.append(s)
print(i)
Buggy python submission (verdict: Runtime Error):
import itertools
import numpy as np
N = input(N)
digit = len(N)
ans = 0
if int(N) < 357:
    print(ans)
else:
    for i in range(3, len(N)):
        ans += 3**i - 3 * 2**i + 3
    for v in itertools.product('753', repeat=digit):
        if (len(set(list(v)))==3) & (int(''.join(list(v))) <= int(N)):
            ans +=1
    print(ans)

Fixed submission:
import itertools
import numpy as np
N = input()
digit = len(N)
ans = 0
if int(N) < 357:
    print(ans)
else:
    for i in range(3, len(N)):
        ans += 3**i - 3 * 2**i + 3
    for v in itertools.product('753', repeat=digit):
        if (len(set(list(v)))==3) & (int(''.join(list(v))) <= int(N)):
            ans +=1
    print(ans)

Buggy python submission (verdict: Runtime Error):
import itertools
import numpy as np
N = input(N)
digit = len(N)
ans = 0
if int(N) < 357:
    print(ans)
else:
    for i in range(3, len(N)):
        ans += 3**i - 3 * 2**i + 3
    print(ans)
    for v in itertools.product('753', repeat=digit):
        if (len(set(list(v)))==3) & (int(''.join(list(v))) <= int(N)):
            ans +=1
    print(ans)

Fixed submission:
import itertools
import numpy as np
N = input()
digit = len(N)
ans = 0
if int(N) < 357:
    print(ans)
else:
    for i in range(3, len(N)):
        ans += 3**i - 3 * 2**i + 3
    for v in itertools.product('753', repeat=digit):
        if (len(set(list(v)))==3) & (int(''.join(list(v))) <= int(N)):
            ans +=1
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N, M = map(int,input().split())
P_Y_list = np.array([input().split() for _ in range(0, M)], dtype='int')
col_1 = P_Y_list[:,0]
years = [np.sort(P_Y_list[np.where(col_1==i)][:,1]) for i in set(col_1)]
for l in P_Y_list:
    #left = str(l[0]).zfill(6)
    #right = str(np.where(years[list(set(col_1)).index(l[0])]==l[1])[0][0]+1).zfill(6)
    print((str(l[0]).zfill(6))+(str(np.where(years[list(set(col_1)).index(l[0])]==l[1])[0][0]+1).zfill(6)))

Fixed submission:
import numpy as np
N, M = map(int,input().split())
P_Y_list = np.array([input().split() for _ in range(0, M)], dtype='int')
counts = (np.zeros(N+1)).astype(int)
id_list = []

sort_ind = np.argsort(P_Y_list[:,1])
sorted_P_Y = P_Y_list[sort_ind]

for p, y in sorted_P_Y:
    counts[p] += 1
    id_list.append(str(p).zfill(6) + str(counts[p]).zfill(6))
id_list = np.array(id_list)
id_list = id_list[np.argsort(sort_ind)]
for id in id_list:
    print(id)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N, M = map(int,input().split())
P_Y_list = np.array([input().split() for _ in range(0, M)], dtype='int')
years = [np.sort(P_Y_list[np.where(P_Y_list[:,0]==i)][:,1]) for i in set(P_Y_list[:, 0])]
for l in P_Y_list:
    left = str(l[0]).zfill(6)
    right = str(np.where(years[list(set(P_Y_list[:,0])).index(l[0])]==l[1])[0][0]+1).zfill(6)
    print(left+right)

Fixed submission:
import numpy as np
N, M = map(int,input().split())
P_Y_list = np.array([input().split() for _ in range(0, M)], dtype='int')
counts = (np.zeros(N+1)).astype(int)
id_list = []

sort_ind = np.argsort(P_Y_list[:,1])
sorted_P_Y = P_Y_list[sort_ind]

for p, y in sorted_P_Y:
    counts[p] += 1
    id_list.append(str(p).zfill(6) + str(counts[p]).zfill(6))
id_list = np.array(id_list)
id_list = id_list[np.argsort(sort_ind)]
for id in id_list:
    print(id)

Buggy python submission (verdict: Runtime Error):
N, M = map(int,input().split())
P_Y_list = np.array([input().split() for _ in range(0, M)], dtype='int')
years = [np.sort(P_Y_list[np.where(P_Y_list[:,0]==i)][:,1]) for i in set(P_Y_list[:, 0])]
for l in P_Y_list:
    left = str(l[0]).zfill(6)
    right = str(np.where(years[list(set(P_Y_list[:,0])).index(l[0])]==l[1])[0][0]+1).zfill(6)
    print(left+right)

Fixed submission:
import numpy as np
N, M = map(int,input().split())
P_Y_list = np.array([input().split() for _ in range(0, M)], dtype='int')
counts = (np.zeros(N+1)).astype(int)
id_list = []

sort_ind = np.argsort(P_Y_list[:,1])
sorted_P_Y = P_Y_list[sort_ind]

for p, y in sorted_P_Y:
    counts[p] += 1
    id_list.append(str(p).zfill(6) + str(counts[p]).zfill(6))
id_list = np.array(id_list)
id_list = id_list[np.argsort(sort_ind)]
for id in id_list:
    print(id)
Buggy python submission (verdict: Runtime Error):
import numpy as np
x1_, y_1, x_2, y_2 = map(int, input().split())

x_4 = x_1 - (y_2 - y_1)
y_4 = y_1 + (x_2 - x_1)
x_3 = x_4 - (y_1 - y_4)
y_3 = y_4 + (x_1 - x_4)
 
print(x_3, y_3, x_4, y_4)

Fixed submission:
x_1, y_1, x_2, y_2 = map(int, input().split())

x_4 = x_1 - (y_2 - y_1)
y_4 = y_1 + (x_2 - x_1)
x_3 = x_4 - (y_1 - y_4)
y_3 = y_4 + (x_1 - x_4)
 
print(x_3, y_3, x_4, y_4)
Buggy python submission (verdict: Runtime Error):
s = input()
count = 0
for i in range(3):
  if s[i] == 'o':
    count+=1
pront(count*100 + 700)

Fixed submission:
s = input()
count = 0
for i in range(3):
  if s[i] == 'o':
    count+=1
print(count*100 + 700)
Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input())
travels = np.array([input().split() for _ in range(N)], dtype=int)
travels = np.insert(travels, 0, [0, 0, 0], axis=0)
travels = travels[travels[:,0].argsort(), :]
able = True
for i in range(np.shape(travels)[1]-1):
    dist = travels[i+1,:] - travels[i,:]
    time = dist[0]
    x = abs(dist[1])
    y = abs(dist[2])
    if x+y>time:
        able = False
        break
    elif x+y%2==0 and time%2!=0:
        able = False
        break
    elif x+y%2!=0 and time%2==0:
        able = False
        break
if able:
    print('Yes')
else:
    print('No')

Fixed submission:
import numpy as np
N = int(input())
travels = np.array([input().split() for _ in range(N)], dtype=int)
travels = np.insert(travels, 0, [0, 0, 0], axis=0)
travels = travels[travels[:,0].argsort(), :]
able = True
for i in range(0, N):
    dist = travels[i+1,:] - travels[i,:]
    x_dist = abs(dist[1])
    y_dist = abs(dist[2])
    time_dist = dist[0]
    x = travels[i+1,1]
    y = travels[i+1,2]
    time = travels[i+1,0]
    if x_dist+y_dist>time_dist:
        able = False
        break
    elif (x+y)%2==0 and time%2!=0:
        able = False
        break
    elif (x+y)%2!=0 and time%2==0:
        able = False
        break
if able:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
N, Y = map(int, input().split())
# i: man, j: gosen, k: sen
output_flag=0
for i in range(0, N+1):
    while output_flag==0:
        for j in range(0, N+1-i):
            k = N-i-j
            if 10000*i+5000*j+1000*k==Y:
                print(i, j, k)
                output_flag=1
                break
    if output_flag==1:
        break
if output_flag==0:
    print(-1, -1, -1)


Fixed submission:
S = input().split('/')
S[0] = '2018'
print('/'.join(S))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

MOD = 10**9 + 7
A_mod = [a%MOD for a in A]

ans = 0

for i in range(1, N):
    ans = (ans + A_mod[i-1]%MOD * sum(A_mod[i:])%MOD)%MOD
    
print(ans)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))

MOD = 10**9 + 7
A_mod = [a%MOD for a in A]

R = sum(A_mod)

ans = 0

for a in A_mod:
    R -= a
    ans = (ans + a%MOD * R%MOD)%MOD
    
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
A = list(map(int, input().split()))

from operator import mul
from functools import reduce

scores = []
judge_str = {True: "Yes", False: "No"}

for i in range(K, N+1):
    scores.append(reduce(mul, A[i-K:i]))
    if len(scores) == 1:
        continue
    else:
        print(judge_str[scores[i-K-1] < scores[i-K]])


Fixed submission:
N, K = map(int, input().split())
A = list(map(int, input().split()))

judge_str = {True: "Yes", False: "No"}

for i in range(K+1, N+1):
    print(judge_str[A[i-K-1] < A[i-1]])
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

ans = 1

for a in A:
    ans *= a
    
    if 0 in A:
        ans = 0
        break
    elif ans > 10**18:
        ans = -1
        break
    
print(ans)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))

if 0 in A:
        ans = [0]
else:
    ans = [1]*N
    
    for i,a in enumerate(A):
        if i==0:
            ans[i] = a
        else:
            ans[i] = ans[i-1]*a

        if ans[i] > 10**18:
            ans[-1] = -1
            break
    
print(ans[-1])
Buggy python submission (verdict: Runtime Error):
solved_flag = False
if B==1:
    ans = 0
    solved_flag = True
else:
    if B <= N:
        x = B-1
    else:
        x = N

if not solved_flag:
    ans = math.floor(A*x/B) - A*math.floor(x/B)
print(ans)

Fixed submission:
import math

A, B, N = map(int, input().split())

solved_flag = False
if B==1:
    ans = 0
    solved_flag = True
else:
    if B <= N:
        x = B-1
    else:
        x = N

if not solved_flag:
    ans = math.floor(A*x/B) - A*math.floor(x/B)
print(ans)
Buggy python submission (verdict: Runtime Error):
N,M = map(int, input().split())
A = map(int, input().split()) 

play_days = copy.copy(N)
for i in A:
  play_days -= i
if play_days < 0:
  print(-1)
else:
  print(play_days)

Fixed submission:
N,M = map(int, input().split())
A = map(int, input().split()) 

play_days = N
for i in A:
  play_days -= i
if play_days < 0:
  print(-1)
else:
  print(play_days)
Buggy python submission (verdict: Runtime Error):
K = int(input())

if K < 10:
  print(K)
else:
  count = 9

queue = [1,2,3,4,5,6,7,8,9]

while count != K:
  for x in queue:
    if x%10 != 0:
      queue.append(10*x + (x%10) - 1)
      count += 1
      if count == K:
        break

    queue.append(10*x + (x%10))
    count += 1
    if count == K:
      break

    if x%10 != 9:
      queue.append(10*x + (x%10) + 1)
      count += 1
      if count == K:
        break

print(queue[-1])


Fixed submission:
from copy import copy

A,B,C = map(int, input().split())

# A <--> B
temp = copy(A)
A = copy(B)
B = copy(temp)

# A <--> C
temp = copy(A)
A = copy(C)
C = copy(temp)

print("%d %d %d" %(A,B,C))
Buggy python submission (verdict: Runtime Error):
K = int(input())

if K < 10:
  print(K)
else:
  count = 9

queue = [1,2,3,4,5,6,7,8,9]

while count != K:
  for x in queue:
    if x%10 != 0:
      queue.append(10*x + (x%10) - 1)
      count += 1
      if count == K:
        break

    queue.append(10*x + (x%10))
    count += 1
    if count == K:
      break

    if x%10 != 9:
      queue.append(10*x + (x%10) + 1)
      count += 1
      if count == K:
        break

print(queue[-1])


Fixed submission:
K = int(input())

if K < 10:
  queue = range(1,K+1)
  count = K
else:
  count = 9
  queue = [1,2,3,4,5,6,7,8,9]

while count != K:
  for x in queue:
    if x%10 != 0:
      queue.append(10*x + (x%10) - 1)
      count += 1
      if count == K:
        break

    queue.append(10*x + (x%10))
    count += 1
    if count == K:
      break

    if x%10 != 9:
      queue.append(10*x + (x%10) + 1)
      count += 1
      if count == K:
        break

print(queue[-1])
Buggy python submission (verdict: Time Limit Exceeded):
_, *_XL = open(0).read().split()

XL = list(zip(*[map(int, iter(_XL))]*2))

ans = 0
t = -10**10 # 数直線のマイナス方向からスタートする

arms = [(X-L, X+L) for X, L in XL]

arms_sorted = sorted(arms, key=lambda k:k[1])

for s, e in arms_sorted:
    if t <= s:
        t = e
    else:
        arms.remove((s, e))

print(len(arms))

Fixed submission:
_, *_XL = open(0).read().split()

XL = list(zip(*[map(int, iter(_XL))]*2))

ans = 0
t = -10**10 # 数直線のマイナス方向からスタートする

arms = [(X-L, X+L) for X, L in XL]
arms_sorted = sorted(arms, key=lambda k:k[1])

ans = 0

for s, e in arms_sorted:
    if t <= s:
        t = e
        ans += 1
        
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
_, *_XL = open(0).read().split()

XL = list(zip(*[map(int, iter(_XL))]*2))

ans = 0
t = -10**10 # 数直線のマイナス方向からスタートする

arms = [(X-L, X+L) for X, L in XL]

arms_sorted = sorted(arms, key=lambda k:k[1])

for s, e in arms_sorted:
    if t <= s:
        t = e
    else:
        arms.remove((s, e))

print(len(arms))

Fixed submission:
_, *_XL = open(0).read().split()

XL = list(zip(*[map(int, iter(_XL))]*2))

ans = 0
t = -10**10 # 数直線のマイナス方向からスタートする

arms = [(X-L, X+L) for X, L in XL]
arms_sorted = sorted(arms, key=lambda k:k[1])

ans = 0

for s, e in arms_sorted:
    if t <= s:
        t = e
        ans += 1
        
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
_, *_XL = open(0).read().split()

XL = list(zip(*[map(int, iter(_XL))]*2))

ans = 0
t = -10**10 # 数直線のマイナス方向からスタートする

arms = [(X-L, X+L) for X, L in XL]

for s, e in sorted(arms, key=lambda k:k[1]):
    if t <= s:
        t = e
    else:
        arms.remove((s, e))

print(len(arms))

Fixed submission:
_, *_XL = open(0).read().split()

XL = list(zip(*[map(int, iter(_XL))]*2))

ans = 0
t = -10**10 # 数直線のマイナス方向からスタートする

arms = [(X-L, X+L) for X, L in XL]
arms_sorted = sorted(arms, key=lambda k:k[1])

ans = 0

for s, e in arms_sorted:
    if t <= s:
        t = e
        ans += 1
        
print(ans)
Buggy python submission (verdict: Runtime Error):
A, B = map(int, input().split())

import math

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

print(lcm(A, B))

Fixed submission:
A, B = map(int, input().split())

import fractions

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

print(lcm(A, B))
Buggy python submission (verdict: Time Limit Exceeded):
N, K, Q, *A = map(int, open(0).read().split())

import numpy as np
scores = np.array([K]*N)

for a in A:
    scores -= 1
    scores[a-1] += 1

for s in scores:
    if s > 0:
        print("Yes")
    else:
        print("No")

Fixed submission:
N, K, Q, *A = map(int, open(0).read().split())

import numpy as np
answered = np.array([0]*N)

for a in A:
    answered[a-1] += 1

for s in answered + K - len(A):
    if s > 0:
        print("Yes")
    else:
        print("No")

Buggy python submission (verdict: Time Limit Exceeded):
N, K, Q = map(int, input().split())
A = [int(input()) for _ in range(Q)]

import numpy as np
scores = np.array([K]*N)

for a in A:
    scores -= 1
    scores[a-1] += 1
    
print(*["Yes" if x else "No" for x in scores > 0], sep="\n")

Fixed submission:
N, K, Q, *A = map(int, open(0).read().split())

import numpy as np
answered = np.array([0]*N)

for a in A:
    answered[a-1] += 1

for s in answered + K - len(A):
    if s > 0:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

ans = 0

for i in range(N):
    if B[i] > A[i]:
        kill_1 = A[i]
        if B[i] - kill_1 > A[i+1]:
            kill_2 = A[i+1]
        else:
            kill_2 = B[i] - kill_1
    else:
        kill_1 = B[i]
        
    ans += kill_1 + kill_2
    B[i] -= kill_1 - kill_2
    A[i] -= kill_1
    A[i+1] -= kill_2
    
print(ans)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

count = 0
for i in range(N):
  if A[i] < B[i]:
    count += A[i]
    B[i] -= A[i]
    if A[i+1] < B[i]:
      count += A[i+1]
      A[i+1] = 0
    else:
      count += B[i]
      A[i+1] -= B[i]
  else:
    count += B[i]

print(count)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(input()) for _ in range(N)]

for i in range(N):
#     print(A[:i], A[i:i+1], A[i+1:])
    print(max(A[:i]+A[i+1:]))

Fixed submission:
N = int(input())
A = [int(input()) for _ in range(N)]

A_max = max(A)
A_max_ind = A.index(max(A))

for i in range(N):
    if i==A_max_ind:
        print(max(A[:i]+A[i+1:]))
    else:
        print(A_max)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(input()) for _ in range(N)]

for i in range(N):
#     print(A[:i], A[i:i+1], A[i+1:])
    print(max(A[:i]+A[i+1:]))

Fixed submission:
N = int(input())
A = [int(input()) for _ in range(N)]

A_max = max(A)
A_max_ind = A.index(max(A))

for i in range(N):
    if i==A_max_ind:
        print(max(A[:i]+A[i+1:]))
    else:
        print(A_max)
Buggy python submission (verdict: Runtime Error):
import numpy as np
N, D = map(int, input().split())
X = np.zeros((N,D))
for i in range(N):
  X[i][:] = list(map(int, input().split()))

n = 0
for i in range(N):
  for j in range(i+1, N):
    dist = linalg.norm(X[i]-X[j])
    if dist.is_integer():
      n += 1

print(n)

Fixed submission:
import numpy as np
N, D = map(int, input().split())
X = np.zeros((N,D))
for i in range(N):
  X[i][:] = list(map(int, input().split()))

n = 0
for i in range(N):
  for j in range(i+1, N):
    dist = np.linalg.norm(X[i]-X[j])
    if dist.is_integer():
      n += 1

print(n)
Buggy python submission (verdict: Runtime Error):
N,X = map(int, input().split())
L_i = list(map(int, input().split()))

D=[0, 0]
count=1
for n in range(N+1):
  D[1] = D[0] + L_i[n]
  if D[1] <= X:
    count += 1
    D[0] = D[1]
  else:
    break

print(count)

Fixed submission:
X,A = map(int, input().split())
if X < A:
  print(0)
else:
  print(10)
Buggy python submission (verdict: Runtime Error):
N,X = map(int, input().split())
L_i = list(map(int, input().split()))

D=[0, 0]
count=1
for n in range(N+1):
  D[1] = D[0] + L_i[n]
  if D[1] <= X:
    count += 1
    D[0] = D[1]
  else:
    break

print(count)

Fixed submission:
N,X = map(int, input().split())
L_i = list(map(int, input().split()))

D=[0, 0]
count=1
for n in range(N):
  D[1] = D[0] + L_i[n]
  if D[1] <= X:
    count += 1
    D[0] = D[1]
  else:
    break

print(count)
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
A = []
for m in range(M):
    A.append(int(input()))
    
dp = [0]*(N+2)

dp[N] = 1
dp[N+1] = 0

for i in range(N-1, -1, -1):
    if i in A:
        dp[i] = 0
    else:
        dp[i] = (dp[i+1] + dp[i+2]) % 1000000007
    
print(dp[0])

Fixed submission:
N, M = map(int, input().split())
A = []
for m in range(M):
    A.append(int(input()))


broken = [0]*(N+2)
for a in A:
    broken[a] = 1

dp = [0]*(N+2)

dp[N] = 1
dp[N+1] = 0

for i in range(N-1, -1, -1):
    if broken[i]:
        dp[i] = 0
    else:
        dp[i] = (dp[i+1] + dp[i+2]) % 1000000007
    
print(dp[0])

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
A = []
for m in range(M):
    A.append(int(input()))

dp = [0]*(N+2)

dp[N] = 1
dp[N+1] = 0

for i in range(N-1, -1, -1):
    if i in A:
        dp[i] = 0
    else:
        dp[i] = dp[i+1] + dp[i+2]
    
print(dp[0] % 1000000007)

Fixed submission:
N, M = map(int, input().split())
A = []
for m in range(M):
    A.append(int(input()))


broken = [0]*(N+2)
for a in A:
    broken[a] = 1

dp = [0]*(N+2)

dp[N] = 1
dp[N+1] = 0

for i in range(N-1, -1, -1):
    if broken[i]:
        dp[i] = 0
    else:
        dp[i] = (dp[i+1] + dp[i+2]) % 1000000007
    
print(dp[0])
Buggy python submission (verdict: Runtime Error):
_N, *_SP = open(0).read().split()
N = int(_N)

S = {}
P = {}

for i in range(N):
    S[i+1] = _SP[2*i]
    P[i+1] = int(_SP[2*i+1])
    
import pandas as pd

S_df = pd.DataFrame(S.values(), index=S.keys(), columns=["name"])
P_df = pd.DataFrame(P.values(), index=P.keys(), columns=["point"])

df = pd.concat([S_df, P_df], axis=1)
print(*list(df.sort_values(['name', 'point'], ascending=[True, False]).index), sep="\n")

Fixed submission:
N = int(input())
data = [{}]*N

for i in range(N):
  tempS, tempP = input().split()
  data[i] = {'ID': i+1, 'Name': tempS, 'Point': int(tempP)}

data_sort = sorted(
  data,
  key = lambda x: (x['Name'], -x['Point'])
)

for i in range(N):
  print(data_sort[i]['ID'])
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())

s = []
for i in range(M):
    _, *tmp_s = map(int, input().split())
    s.append(tmp_s)
    
p = list(map(int, input().split()))

import numpy as np

s_matrix = []

for i in range(M):
    s_matrix.append([1 if x+1 in s[i] else 0 for x in range(N)])
    
s_matrix = np.array(s_matrix)

ans = 0

for i in range(2**N):
    on_off_pattern = list(format(i, '0%db' %N))
    on_nums = s_matrix @ np.array(list(map(int, on_off_pattern)))
    on_nums_mod2 = on_nums % 2

    if not False in (on_nums_mod2 == p):
        ans += 1
        
print(ans)

Fixed submission:
N, M = map(int, input().split())

s = []
for i in range(M):
    _, *tmp_s = map(int, input().split())
    s.append(tmp_s)
    
p = list(map(int, input().split()))

import numpy as np

s_matrix = []

for i in range(M):
    s_matrix.append([1 if x+1 in s[i] else 0 for x in range(N)])
    
s_matrix = np.array(s_matrix)

ans = 0

for i in range(2**N):
    on_off_pattern = list(format(i, '0%db' %N))
    on_nums = np.dot(s_matrix, np.array(list(map(int, on_off_pattern))))
    on_nums_mod2 = on_nums % 2

    if not False in (on_nums_mod2 == p):
        ans += 1
        
print(ans)
Buggy python submission (verdict: Runtime Error):
A,B = map(int, input().split())

if A => 13:
  print(B)
elif A =< 5:
  print(0)
else:
  print(int(B/2))

Fixed submission:
A,B = map(int, input().split())
if A <= 5:
  print(0)
elif A <= 12:
  print(int(B/2))
else:
  print(B)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))

import math
from functools import reduce

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

ans = 0

for i in range(N):
    if ans == 0:
        ans = gcd_list([*A[:i], *A[i+1:]])
        
    elif gcd_list([*A[:i], *A[i+1:]]) > ans:
        ans = gcd_list([*A[:i], *A[i+1:]])
        break
        
print(ans)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))

import fractions

L = [A[0]]
R = [A[-1]]

for i in range(1, N):
    L.append(fractions.gcd(L[i-1], A[i]))
    R.append(fractions.gcd(R[i-1], A[-(i+1)]))

R.reverse()


ans = 0

for i in range(N):
    if i == 0:
        ans = max(ans, R[1])
    elif i == N-1:
        ans = max(ans, L[-2])
    else:
        ans = max(ans, fractions.gcd(L[i-1], R[i+1]))
    
print(ans)