Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N,X = (int(i) for i in input().split()) 
L = [int(i) for i in input().split()] 
D=0
i=0
while(D<=X and i<=N+1):
  D=D+L[i]
  i=i+1
print(i)

Fixed submission:
N, X = map(int, input().split())
L = list(map(int, input().split()))
count = 1
line = 0
for i in range(N):
    line += L[i]
    if line <= X:
        count += 1
print(count)

Buggy python submission (verdict: Runtime Error):
N,X = (int(i) for i in input().split()) 
L = [int(i) for i in input().split()] 
D=0
i=0
while(D<=X and i<=N):
  D=D+L[i]
  i=i+1
print(i)

Fixed submission:
N, X = map(int, input().split())
L = list(map(int, input().split()))
count = 1
line = 0
for i in range(N):
    line += L[i]
    if line <= X:
        count += 1
print(count)

Buggy python submission (verdict: Runtime Error):
N,X = (int(i) for i in input().split()) 
L = [int(i) for i in input().split()] 
D=0
i=0
while(D<=X):
  D=D+L[i]
  i=i+1
print(i+1)

Fixed submission:
N, X = map(int, input().split())
L = list(map(int, input().split()))
count = 1
line = 0
for i in range(N):
    line += L[i]
    if line <= X:
        count += 1
print(count)

Buggy python submission (verdict: Runtime Error):
N,X = (int(i) for i in input().split()) 
L = [int(i) for i in input().split()] 
D=0
i=0
while(D<=X):
  D=D+L[i]
  i=i+1
if X=0:
  print(1)
else:
  print(i)

Fixed submission:
N, X = map(int, input().split())
L = list(map(int, input().split()))
count = 1
line = 0
for i in range(N):
    line += L[i]
    if line <= X:
        count += 1
print(count)

Buggy python submission (verdict: Runtime Error):
N,X = (int(i) for i in input().split()) 
L = [int(i) for i in input().split()] 
D=0
i=0
while(D<=X):
  D=D+L[i]
  i=i+1
print(i)

Fixed submission:
N, X = map(int, input().split())
L = list(map(int, input().split()))
count = 1
line = 0
for i in range(N):
    line += L[i]
    if line <= X:
        count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
W, H, x, y = (int(i) for i in input().split())
if x=W/2 and y=H/2:
  print(W*H/2, 0)
else:
  print(W*H/2, 1)

Fixed submission:
W, H, x, y = (int(i) for i in input().split())
if x==W/2 and y==H/2:
  print(W*H/2, 1)
else:
  print(W*H/2, 0)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
S=sum(A)
i=0
X=0
while X<S/2:
    X=X+A[i]
    i=i+1
k=i
ka=0
ja=0
wa=0
ya=0
za=0
for l in range(k+2):
    ja=ja+A[l]
for l in range(k+1):
    ka=ka+A[l]
for l in range(k):
    wa=wa+A[l]
for l in range(k-2):
    ya=ya+A[l]
for l in range(k-1):
    za=za+A[l]
Z=[]
Z.append(abs(S-ja-ja))
Z.append(abs(S-ka-ka))
Z.append(abs(S-wa-wa))
Z.append(abs(S-ya-ya))
Z.append(abs(S-za-za))
print(min(Z))


Fixed submission:
N = int(input())
A = list(map(int, input().split()))
S=sum(A)
i=0
X=0
while X<S/2:
    X=X+A[i]
    i=i+1
k=i
ka=0
ja=0
wa=0
ya=0
za=0
for l in range(k+1):
    ka=ka+A[l]
for l in range(k):
    wa=wa+A[l]
for l in range(k-1):
    za=za+A[l]
Z=[]

Z.append(abs(S-ka-ka))
Z.append(abs(S-wa-wa))

Z.append(abs(S-za-za))
print(min(Z))
Buggy python submission (verdict: Runtime Error):
def p(boundary):
    step=[0]*(boundary+1)
    step[0]=0
    step[1]=1
    step[2]=2
    for i in range(2,boundary-1):
        step[i+1]=step[i]+step[i-1]
    d=step[boundary]
    return d


N,M = (int(i) for i in input().split())
a = [int(input()) for i in range(M)] 
b=[]
for i in range(0,M-2):
    b.append(a[i+1]-a[i]-2)
b.append(N-a[M-1]-1)
ans=p(a[0]-1)
for i in range(M):
    c=b[i]
    ans=p(c)*ans
print(ans)

Fixed submission:
N,M = (int(i) for i in input().split())
ban=[False]*(N+1)
for i in range(M):
    a=int(input())
    ban[a]='True'
    
dp=[0]*(N+1)
dp[0]=1
if ban[1]=='True':
    dp[1]=0
else:
    dp[1]=1

for i in range(2,N+1):
    if(ban[i]):
        dp[i]=0
    else:
        dp[i]=dp[i-2]+dp[i-1]
print(dp[N]%1000000007)
Buggy python submission (verdict: Runtime Error):
A=int(input())
B=int(input())
C=B/2
if A >= 13 :
  print( '%d' % B )
elif A<=12 and A>=6 :
  print( '%d' % C )
else:
  print( '0')

Fixed submission:
A,B = (int(i) for i in input().split()) 
C=B/2
if A >= 13 :
  print( '%d' % B )
elif A<=12 and A>=6 :
  print( '%d' % C )
else:
  print( '0')

Buggy python submission (verdict: Runtime Error):
A=int(input())
B=int(input())
 
if A >= 13 :
  X=B
  print( '%d' % X )
elif X<=12 and X>=6 :
  X=B/2
  print( '%d' % X )
else:
  print( '0')

Fixed submission:
A,B = (int(i) for i in input().split()) 
C=B/2
if A >= 13 :
  print( '%d' % B )
elif A<=12 and A>=6 :
  print( '%d' % C )
else:
  print( '0')

Buggy python submission (verdict: Runtime Error):
A=int(input())
B=int(input())

if A >= 13 :
  X=B
     print( '%d' % X )
elif X<=12 && X>=6 :
  X=B/2
     print( '%d' % X )
else:
     print( '0')

Fixed submission:
A,B = (int(i) for i in input().split()) 
C=B/2
if A >= 13 :
  print( '%d' % B )
elif A<=12 and A>=6 :
  print( '%d' % C )
else:
  print( '0')
Buggy python submission (verdict: Runtime Error):
N=int(input())
V = list(int(i) for i in input().split()) 
C = list(int(i) for i in input().split()) 
S=[]
for i in range(N):
	S.append(V[i]-C[i])
for i in range(N):
	if S[i]>0:
		ans=ans+S[i]
print(ans)

Fixed submission:
N=int(input())
V = list(int(i) for i in input().split()) 
C = list(int(i) for i in input().split()) 
S=[]
ans=0
for i in range(N):
    S.append(V[i]-C[i])
for i in range(N):
	if S[i]>0:
		ans=ans+S[i]
print(ans)
Buggy python submission (verdict: Runtime Error):
N=int(input())
A = [int(i) for i in input().split()]
cnt=0
ans=0
B=[]
for i in range(N):
    if A[i]<0:
        cnt+=1
if cnt%2==0:
    ans=sum(abs(A))
    print(ans)
else:
    for i in range(N):
        if A[i]<0:
            B.append(A[i])
    max(B)
    ans=sum(abs(A))
    ans=ans+2*B
    print(ans)

Fixed submission:
N=int(input())
A = [int(i) for i in input().split()]
cnt=0
ans=0
B=[]
C=[]
for i in range(N):
    B.append(abs(A[i]))
for i in range(N):
    if A[i]<0:
        C.append(A[i])
if len(C)%2==0:
    ans=sum(B)
    print(ans)
else:
    sel=min(B)
    print(sum(B)-2*abs(sel))
Buggy python submission (verdict: Runtime Error):
A,B = (int(i) for i in input().split()) 

if A >= B+1 :
   print( '%d' % 2*A-1 )
elif B >= A+1 :
   print( '%d' % 2*B-1 )
else:
   print( '%d'% 2*A)

Fixed submission:
A,B = (int(i) for i in input().split()) 
C=0
if A >= B+1 :
	C=2*A-1
	print( '%d' % C  )
elif B >= A+1 :
	C=2*B-1
	print( '%d' % C )
else:
	C=2*A
	print( '%d'% C)
Buggy python submission (verdict: Time Limit Exceeded):
S=input()
n=len(S)
ans=[]
for i in range(n):
  cnt=0
  j=i
  while(S[j]=='A' or S[j]=='C' or S[j]=='G' or S[j]=='T'):
      cnt+=1
  ans.append(cnt)
print(max(ans))

Fixed submission:
s=list(input())
cnt=0
ans=0
l=list("ATCG")
 
for i in s:
    if i in l:
        cnt+=1
        ans=max(ans,cnt)
    else:
        cnt=0
print(ans)

Buggy python submission (verdict: Runtime Error):
S=input()
n=len(S)
ans=[]
for i in range(n):
  cnt=0
  for j in range(j,n):
    if S[j]=='A' or S[j]=='C' or S[j]=='G' or S[j]=='T':
      cnt+=1
  ans.append(cnt)
print(max(ans))

Fixed submission:
s=list(input())
cnt=0
ans=0
l=list("ATCG")
 
for i in s:
    if i in l:
        cnt+=1
        ans=max(ans,cnt)
    else:
        cnt=0
print(ans)

Buggy python submission (verdict: Runtime Error):
S=input()
n=len(S)
ans=[]
for i in range(n):
  j=i
  cnt=0
  while(S[j]=='A' or S[j]=='C' or S[j]=='G' or S[j]=='T'):
    cnt+=1
    j+=1
  ans.append(cnt)
print(max(ans))
    

Fixed submission:
s=list(input())
cnt=0
ans=0
l=list("ATCG")
 
for i in s:
    if i in l:
        cnt+=1
        ans=max(ans,cnt)
    else:
        cnt=0
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
S=input()
n=len(S)
ans=[]
for i in range(n):
  j=i
  cnt=0
  while(S[j]=='A' or S[j]=='C' or S[j]=='G' or S[j]=='T'):
    cnt+=1
  ans.append(cnt)
print(max(ans))
    

Fixed submission:
s=list(input())
cnt=0
ans=0
l=list("ATCG")
 
for i in s:
    if i in l:
        cnt+=1
        ans=max(ans,cnt)
    else:
        cnt=0
print(ans)

Buggy python submission (verdict: Runtime Error):
S = input()
list = []
counter = 0
H = []
c = []
d = 0
j=0
for i in range(len(S)):
    if S[i] == 'A' or S[i] == 'T' or S[i] == 'G' or S[i] == 'C':
        j=0
    else:
        H.append(i)
for i in range(len(H)-1):
    d = H[i+1]-H[i]-1
    c.append(d)
c.append(H[0])
print(max(c))

Fixed submission:
s=list(input())
cnt=0
ans=0
l=list("ATCG")
 
for i in s:
    if i in l:
        cnt+=1
        ans=max(ans,cnt)
    else:
        cnt=0
print(ans)

Buggy python submission (verdict: Runtime Error):
S=input()
H=[]
M=len(S)
an=[]
j=0
for i in range(M):
	if S[i]=="A":
	elif S[i]=='C':
	elif S[i]=='G':
	elif S[i]=='T':
	else:
		H.append(i)
N=len(H)    
for i in range(N)
   an=H[i+1]-H[i]+1
an.append(H[0])

c=Max(an)
print("%d"% c)



Fixed submission:
s=list(input())
cnt=0
ans=0
l=list("ATCG")
 
for i in s:
    if i in l:
        cnt+=1
        ans=max(ans,cnt)
    else:
        cnt=0
print(ans)
Buggy python submission (verdict: Runtime Error):
D, N= int(input().split())
print(N*(100**D))

Fixed submission:
A = input().split()
D = int(A[0])
N = int(A[1])
 
if N != 100:
  print(100 ** D * N)
else:
  print(100 ** D * 101)

Buggy python submission (verdict: Runtime Error):
D, N= int(input().split())
print(N*100**D)

Fixed submission:
A = input().split()
D = int(A[0])
N = int(A[1])
 
if N != 100:
  print(100 ** D * N)
else:
  print(100 ** D * 101)
Buggy python submission (verdict: Runtime Error):
X,Y= (int(i) for i in input().split())
x=X
i=1
while(x<=Y):
    x=2*x
    i+==1
print(i)

Fixed submission:
X,Y= (int(i) for i in input().split())
x=X
i=0
while(x<=Y):
    x=2*x
    i+=1
print(i)
Buggy python submission (verdict: Runtime Error):
import math
import sys
input = sys.stdin.readline

def merge_sort(arr):
    if len(arr) <= 1:
        return arr

    mid = len(arr) // 2
    # ここで分割を行う
    left = arr[:mid]
    right = arr[mid:]

    # 再帰的に分割を行う
    left = merge_sort(left)
    right = merge_sort(right)

    # returnが返ってきたら、結合を行い、結合したものを次に渡す
    return merge(left, right)


def merge(left, right):
    merged = []
    l_i, r_i = 0, 0

    # ソート済み配列をマージするため、それぞれ左から見ていくだけで良い
    while l_i < len(left) and r_i < len(right):
        # ここで=をつけることで安定性を保っている
        if left[l_i] <= right[r_i]:
            merged.append(left[l_i])
            l_i += 1
        else:
            merged.append(right[r_i])
            r_i += 1

    # 上のwhile文のどちらかがFalseになった場合終了するため、あまりをextendする
    if l_i < len(left):
        merged.extend(left[l_i:])
    if r_i < len(right):
        merged.extend(right[r_i:])
    return merged

N,M=map(int,input().split())
A=list(map(int, input().split()))
merge_sort(A)
for i in range(M):
  A[N-1]=A[N-1]/2
  for j in range(N-1,0,-1):
    if A[j-1]>A[j]:
      a=A[j-1]
      A[j-1]=A[j]
      A[j]=a
    else:
      break
  #print(A)
ans=0
for i in range(N):
  ans+=math.floor(A[i])
print(ans)

Fixed submission:
s=input()
if s=='Sunny':
  print('Cloudy')
if s=='Cloudy':
  print('Rainy')
if s=='Rainy':
  print('Sunny')
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=map(int,input().split())
sums=0
for i in range(n):
  sums+=1/a[i]
print(1/sums)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
sums=0
for i in range(n):
  sums+=1/a[i]
print(1/sums)
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
K,S=map(int,input().split())
crt=0
for x in range(0,K+1):
  for y in range(0,K+1):
    z=S-x-y
    if 0<=z<=K:
      crt+=1
print(crt)

Fixed submission:
s=input()
print(s.replace(',',' '))
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
if n%2==0:
  for i in range(0,n,2):
    if a.count(i+1)!=2:
        print(0)
        exit()
else:
  if a.count(0)!=1:
    print(0)
    exit()
  else:
    for i in range(2,n,2):
      if a.count(i)!=2:
        print(0)
        exit()
  
print(2**(n//2))

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
a.sort()
if n%2==0:
  for i in range(0,n,2):
    if a[i]!=i+1 or a[i+1]!=i+1:
        print(0)
        exit()
else:
  if a[0]!=0:
    print(0)
    exit()
  for i in range(2,n,2):
    if a[i-1]!=i or a[i]!=i:
      print(0)
      exit()
      
print((2**(n//2))%(10**9+7))

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
if n%2==0:
  for i in range(0,n,2):
    if a.count(i+1)!=2:
        print(0)
        exit()
else:
  if a.count(0)==1:
    for i in range(2,n,2):
      if a.count(i)!=2:
        print(0)
        exit()
  else:
    print(0)
    exit()
    
print(2**(n//2))

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
a.sort()
if n%2==0:
  for i in range(0,n,2):
    if a[i]!=i+1 or a[i+1]!=i+1:
        print(0)
        exit()
else:
  if a[0]!=0:
    print(0)
    exit()
  for i in range(2,n,2):
    if a[i-1]!=i or a[i]!=i:
      print(0)
      exit()
      
print((2**(n//2))%(10**9+7))
Buggy python submission (verdict: Runtime Error):
s = input()
if s.replace('eraser','').replace('erase','').replace('dreamer','').replace('dream','')
:
    print('NO')
else:
    print('YES')

Fixed submission:
s = input()
if s.replace('eraser','').replace('erase','').replace('dreamer','').replace('dream',''):
    print('NO')
else:
    print('YES')
Buggy python submission (verdict: Time Limit Exceeded):
n, x=map(int, input().split())
a=list(map(int,input().split()))
ans=0
for i in range(n-1):
  while a[i]+a[i+1]>x:
    a[i+1]-=1
    ans+=1
print(ans) 

Fixed submission:
n, x=map(int, input().split())
a=list(map(int,input().split()))
ans=0
for i in range(n):
  if a[i]>x:
    ans+=a[i]-x
    a[i]=x
for i in range(n-1):
  if a[i]+a[i+1]>x:
    ans+=(a[i]+a[i+1]-x)
    a[i+1]=x-a[i]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
st = list(map(int,input().split()))
lst = [0] * n
for i in range(n):
  lst[i] =(st.index(i+1)+1)
for i in lst:
  print(i,end=" ")

Fixed submission:
n = int(input())
st = list(map(int,input().split()))
srtkey = lambda x: x[1] 
ans = []
for i,j in zip(range(n),st):
  ans.append([i+1,j])
srt = sorted(ans,key=srtkey)
for i,j in srt:
  print(i,end=" ")

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
st = list(map(int,input().split()))
lst = [] 
for i in range(n):
  lst.append(st.index(i+1)+1)
for i in lst:
  print(i,end=" ")

Fixed submission:
n = int(input())
st = list(map(int,input().split()))
srtkey = lambda x: x[1] 
ans = []
for i,j in zip(range(n),st):
  ans.append([i+1,j])
srt = sorted(ans,key=srtkey)
for i,j in srt:
  print(i,end=" ")
Buggy python submission (verdict: Time Limit Exceeded):
def gcd(x, y):
  if y == 0:
    return x
  else:
    return gcd(y, x % y) 

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    return divisors

def isPrime(n):
  if n <= 2:
    return True
  for p in range(2, n):
      if n % p == 0:
        return False
  return True
    
a,b = map(int,input().split())
gcd = gcd(a,b)
yks = make_divisors(gcd)
ans = 0
for i in yks:
  if isPrime(i):
    ans +=1
print(ans)

Fixed submission:
def gcd(x, y):
  if y == 0:
    return x
  else:
    return gcd(y, x % y) 

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

def isPrime(n):
  if n <= 2:
    return True
  m = int((n**0.5)//1 + 1)
  for p in range(2, m):
      if n % p == 0:
        return False
  return True
    
a,b = map(int,input().split())
gcd = gcd(a,b)
yks = make_divisors(gcd)
ans = 0
for i in yks:
  if isPrime(i):
    ans +=1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def gcd(x, y):
  if y == 0:
    return x
  else:
    return gcd(y, x % y) 

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

def isPrime(n):
  if n <= 2:
    return True
  for p in range(2, n):
      if n % p == 0:
        return False
  return True
    
a,b = map(int,input().split())
gcd = gcd(a,b)
yks = make_divisors(gcd)
ans = 0
for i in yks:
  if isPrime(i):
    ans +=1
print(ans)

Fixed submission:
def gcd(x, y):
  if y == 0:
    return x
  else:
    return gcd(y, x % y) 

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

def isPrime(n):
  if n <= 2:
    return True
  m = int((n**0.5)//1 + 1)
  for p in range(2, m):
      if n % p == 0:
        return False
  return True
    
a,b = map(int,input().split())
gcd = gcd(a,b)
yks = make_divisors(gcd)
ans = 0
for i in yks:
  if isPrime(i):
    ans +=1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n, k, q = map(int, input().split())
anss = []
for i in range(q):
  anss.append(int(input()))
#N人、持ち点K、問題Q

for i in range(n):
  tmp = anss.count(i+1)
  if tmp > q-k:
    print("Yes")
  else:
    print("No")


Fixed submission:
n, k, q = map(int, input().split())
#N人、持ち点K、問題Q
anss = [0] * n
tmp = 0
for i in range(q):
  tmp = int(input())
  anss[tmp-1] += 1
for i in anss:
  if i > q - k:
    print("Yes")
  else:
    print("No")

Buggy python submission (verdict: Time Limit Exceeded):
n, k, q = map(int, input().split())
anss = []
for i in range(q):
  anss.append(int(input()))
#N人、持ち点K、問題Q
atd = []
for i in range(n):
  atd.append(k)
  
for i in anss:
  atd = list(map(lambda x:x -1,atd))
  atd[i-1] += 1
  
for i in atd:
  if i >0:
    print("Yes")
  else:
    print("No")

Fixed submission:
n, k, q = map(int, input().split())
#N人、持ち点K、問題Q
anss = [0] * n
tmp = 0
for i in range(q):
  tmp = int(input())
  anss[tmp-1] += 1
for i in anss:
  if i > q - k:
    print("Yes")
  else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
k, s = input().split()
k, s = int(k), int(s)
ans = 0
for i1 in range(k+1):
  for i2 in range(k+1):
    for i3 in range(k+1):
      if i1 + i2 + i3 == s:
        ans += 1
print(ans)

Fixed submission:
k, s = input().split()
k, s = int(k), int(s)
ans = 0
for i1 in range(k+1):
  for i2 in range(k+1):
      if i1 + i2 <= s <= i1 + i2 + k:
        ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
h, w = map(int, input().split())
dots = []
for i in range(h):
  print(dots[i])
  print(dots[i])
    

Fixed submission:
h, w = map(int, input().split())
dots = []
for i in range(h):
  dots.append(str(input()))
  print(dots[i])
  print(dots[i])
Buggy python submission (verdict: Time Limit Exceeded):
a, b , x = map(int, input().split())
ans = 0
for i in range(a,b+1):
  if i % x == 0 :
    ans+=1
print(ans)

Fixed submission:
a, b , x = map(int, input().split())
print(b // x - (a - 1) // x)
Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
colors = set(a, b, c)
print(len(colors))

Fixed submission:
numbers=list(map(int,input().split()))
colors = set(numbers)
print(len(colors))
Buggy python submission (verdict: Runtime Error):
import math

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

# A, B の正の公約数から互いに素となる組み合わせを選ぶとき、最大でいくつ選べる？
# 最大公約数を求める
gcd = math.gcd(A, B)


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])

    if temp != 1:
        arr.append([temp, 1])

    if arr == []:
        arr.append([n, 1])

    return arr


# 最大公約数を素因数分解する
f = factorization(gcd)
# 1のケースでは1を出力する
if f == [[1, 1]]:
    print(1)
else:
    # 要素数＋１が選択可能な個数
    ans = len(f) + 1
    print(ans)

Fixed submission:
import fractions

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

# A, B の正の公約数から互いに素となる組み合わせを選ぶとき、最大でいくつ選べる？
# 最大公約数を求める
gcd = fractions.gcd(A, B)


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])

    if temp != 1:
        arr.append([temp, 1])

    if arr == []:
        arr.append([n, 1])

    return arr


# 最大公約数を素因数分解する
f = factorization(gcd)
# 1のケースのみ1を出力する
if f == [[1, 1]]:
    print(1)
else:
    # 要素数＋１が選択可能な個数
    ans = len(f) + 1
    print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
nums = list(map(int, input().split()))


def check():
    for i in range(1, N):
        if nums[i] == nums[i - 1]:
            continue
        elif nums[i] - 1 >= nums[i - 1]:
            nums[i] -= 1
        else:
            return "No"
    return "Yes"


print(check()

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


def check():
    for i in range(1, N):
        if nums[i] == nums[i - 1]:
            continue
        elif nums[i] - 1 >= nums[i - 1]:
            nums[i] -= 1
            continue
        else:
            return "No"
    return "Yes"


print(check())
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N = int(input())
nums = np.array([int(input()) for _ in range(N)])

org_indices = np.ones(N, dtype=bool)
for i in range(N):
    indices = np.copy(org_indices)
    indices[i] = False
    print(np.amax(nums[indices]))

Fixed submission:
import numpy as np

N = int(input())
nums = np.array([int(input()) for _ in range(N)])

# 最も大きな値を調べる
sorted_nums = sorted(nums, reverse=True)
max_num = sorted_nums[0]
# 2番目に大きな値を調べる
second_max_num = sorted_nums[1]

for i in range(N):
    # 除外する値を取得する
    exclude_num = nums[i]
    # 除外する値が最大値なら2番目の値を表示する
    if exclude_num == max_num:
        print(second_max_num)
    # それ以外なら最大値を表示する
    else:
        print(max_num)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N = int(input())
nums = np.array([int(input()) for _ in range(N)])


for i in range(N):
    indices = np.ones(N, dtype=bool)
    indices[i] = False
    print(np.amax(nums[indices]))

Fixed submission:
import numpy as np

N = int(input())
nums = np.array([int(input()) for _ in range(N)])

# 最も大きな値を調べる
sorted_nums = sorted(nums, reverse=True)
max_num = sorted_nums[0]
# 2番目に大きな値を調べる
second_max_num = sorted_nums[1]

for i in range(N):
    # 除外する値を取得する
    exclude_num = nums[i]
    # 除外する値が最大値なら2番目の値を表示する
    if exclude_num == max_num:
        print(second_max_num)
    # それ以外なら最大値を表示する
    else:
        print(max_num)