Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import math
N, M = map(int, input().split())
ans = 1
for i in range(2, M//N+1):
    if M % i == 0.0:
        if M // i >= N and ans < i:
            ans = i
        if M // (M // i) >= N and ans < (M // i):
            ans = M // i
print(ans)


Fixed submission:
import math
N, M = map(int, input().split())
ans = 1

for i in range(1, int(math.sqrt(M))+1):
    if M % i == 0.0:
        if M // i >= N and ans < i:
            ans = i
        if M // (M // i) >= N and ans < (M // i):
            ans = M // i
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
N = len(S)
mod = 10**9+7
numofA = 0
numofAB = 0
numofABC = 0
numofquestion = 1
for i in range(N):
    if S[i] == "?":
        numofABC = (numofABC*3+numofAB) % mod
        numofAB = (numofAB*3+numofA) % mod
        numofA = (numofquestion + numofA*3) % mod
        numofquestion *= 3
    elif S[i] == "C":
        numofABC = (numofAB+numofABC) % mod
    elif S[i] == "B":
        numofAB = (numofAB + numofA) % mod
    else:
        numofA = (numofquestion + numofA) % mod
print(numofABC)


Fixed submission:
S = input()
N = len(S)
mod = 10**9+7
numofA = 0
numofAB = 0
numofABC = 0
numofquestion = 1
for i in range(N):
    if S[i] == "?":
        numofABC = (numofABC*3+numofAB) % mod
        numofAB = (numofAB*3+numofA) % mod
        numofA = (numofquestion + numofA*3) % mod
        numofquestion = (numofquestion * 3) % mod
    elif S[i] == "C":
        numofABC = (numofAB+numofABC) % mod
    elif S[i] == "B":
        numofAB = (numofAB + numofA) % mod
    else:
        numofA = (numofquestion + numofA) % mod
print(numofABC)
Buggy python submission (verdict: Time Limit Exceeded):
from scipy.misc import comb
N = int(input())
a = [int(x) for x in input().split()]
ans1 = max(a)
a.remove(ans1)
maxkouho = -1
ans2 = -1
for k in a:
    kouho = comb(ans1, k, exact=True)
    if kouho > maxkouho:
        ans2 = k
        #print(ans2)
        maxkouho = comb(ans1, k, exact=True)
print(ans1, ans2)


Fixed submission:
N = int(input())
a = [int(x) for x in input().split()]
ans1 = max(a)
a.remove(ans1)
b = sorted(a, reverse=True)
ans2 = b[0]
for i in range(N - 2):
    if abs((ans1 / 2) - b[i]) > abs((ans1 / 2) - b[i+1]):
        ans2 = b[i + 1]
    else:
        break

# print(b)
print(ans1, ans2)
Buggy python submission (verdict: Runtime Error):
import fractions


def GCD(a, b):
    if b == 0:
        return a
    else:
        return GCD(b, a % b)


N = int(input())
clock = [0] * N
for j in range(N):
    clock[j] = int(input())
gcd = clock[0]

ans = clock[0]
for i in range(1, N):
    gcd = GCD(ans, clock[i])
    ans = ans/gcd
    ans = ans * clock[i]

print(int(ans))


Fixed submission:
import fractions


def GCD(a, b):
    if b == 0:
        return a
    else:
        return GCD(b, a % b)


N = int(input())
clock = [0] * N
for j in range(N):
    clock[j] = int(input())
gcd = clock[0]

ans = clock[0]
for i in range(1, N):
    gcd = GCD(ans, clock[i])
    ans = ans//gcd
    ans = ans * clock[i]

print(int(ans))

Buggy python submission (verdict: Runtime Error):
import fractions


def GCD(a, b):
    if b == 0:
        return a
    else:
        return GCD(b, a % b)


N = int(input())
clock = [0]*N
gcd = int(input())
clock[0] += gcd
ans = clock[0]
for i in range(1, N):
    clock[i] = int(input())
    gcd = GCD(gcd, clock[i])
   
    ans = ans/gcd
    ans = ans * clock[i]

print(int(ans))


Fixed submission:
import fractions


def GCD(a, b):
    if b == 0:
        return a
    else:
        return GCD(b, a % b)


N = int(input())
clock = [0] * N
for j in range(N):
    clock[j] = int(input())
gcd = clock[0]

ans = clock[0]
for i in range(1, N):
    gcd = GCD(ans, clock[i])
    ans = ans//gcd
    ans = ans * clock[i]

print(int(ans))

Buggy python submission (verdict: Runtime Error):
import fractions


def GCD(a, b):
    if b == 0:
        return a
    else:
        return GCD(b, a % b)


N = int(input())
clock = [0]*N
gcd = int(input())
clock[0] = gcd
ans = clock[0]
for i in range(1, N):
    clock[i] = int(input())
    gcd = GCD(ans, clock[i])
    ans = ans/gcd
    ans *= clock[i]

print(int(ans))


Fixed submission:
import fractions


def GCD(a, b):
    if b == 0:
        return a
    else:
        return GCD(b, a % b)


N = int(input())
clock = [0] * N
for j in range(N):
    clock[j] = int(input())
gcd = clock[0]

ans = clock[0]
for i in range(1, N):
    gcd = GCD(ans, clock[i])
    ans = ans//gcd
    ans = ans * clock[i]

print(int(ans))

Buggy python submission (verdict: Runtime Error):
import fractions


def GCD(a, b):
    if b == 0:
        return a
    else:
        GCD(b, a % b)


N = int(input())
clock = [0]*N
gcd = int(input())
clock[0] = gcd
ans = clock[0]
for i in range(1, N):
    clock[i] = int(input())
    gcd = GCD(ans, clock[i])
    ans /= gcd
    ans *= clock[i]

print(int(ans))


Fixed submission:
import fractions


def GCD(a, b):
    if b == 0:
        return a
    else:
        return GCD(b, a % b)


N = int(input())
clock = [0] * N
for j in range(N):
    clock[j] = int(input())
gcd = clock[0]

ans = clock[0]
for i in range(1, N):
    gcd = GCD(ans, clock[i])
    ans = ans//gcd
    ans = ans * clock[i]

print(int(ans))
Buggy python submission (verdict: Runtime Error):
def gcd(a,b):
	if b == 0:
     	return a
	else:
     	return gcd(b,a%b)

n = int(raw_input())
sm = 0;
for i in range(1,n+1):
  for j in range(1,n+1):
    for k in range(1,n+1):
      sm += gcd(gcd(i,j),k)
      
print(sm)


Fixed submission:
def gcd(a,b):
	if b == 0:
		return a
	else:
		return gcd(b,a%b)

n = int(raw_input())
sm = 0;
for i in range(1,n+1):
  for j in range(1,n+1):
    for k in range(1,n+1):
      sm += gcd(gcd(i,j),k)
      
print(sm)
Buggy python submission (verdict: Runtime Error):
s = input()
t = input()
minCount = len(t)
i = 0
while i < len(s) and i + len(t) <= len(s):
    countSame = 0
    j = 0
    while j < len(t):
        if t[j] == s[i+j]:
            countSame += 1
        j += 2
        minCount = min(len(t) - countSame, minCount)
    i += 1
print(minCount)


Fixed submission:
d, t, s = map(int, input().split(' '))
if t * s >= d:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
s = input()
t = input()
minCount = 100000000
i = 0
while i < len(s) and i + j < len(s):
    countSame = 0
    j = 0
    while j < len(t):
        if t[j] == s[i+j]:
            countSame += 1
        j += 1
        minCount = min(len(t) - countSame, minCount)
    i += 1
print(minCount)


Fixed submission:
s = input()
t = input()
minCount = len(t)
i = 0
while i < len(s) and i + len(t) <= len(s):
    countSame = 0
    j = 0
    while j < len(t):
        if t[j] == s[i+j]:
            countSame += 1
        j += 1
        minCount = min(len(t) - countSame, minCount)
    i += 1
print(minCount)

Buggy python submission (verdict: Runtime Error):
minCount = 10000
i = 0
while i < len(s):
    countSame = 0
    j = 0
    while j < len(t) and i+j < len(s):
        if t[j] == s[i+j]:
            countSame += 1
        j += 1
        minCount = min(len(t) - countSame, minCount)
    i += 1
print(minCount)

Fixed submission:
s = input()
t = input()
minCount = len(t)
i = 0
while i < len(s) and i + len(t) <= len(s):
    countSame = 0
    j = 0
    while j < len(t):
        if t[j] == s[i+j]:
            countSame += 1
        j += 1
        minCount = min(len(t) - countSame, minCount)
    i += 1
print(minCount)
Buggy python submission (verdict: Runtime Error):
a = input()
if a < 2:
        print(0)
elif a % 2 == 0:
        print(int(a / 2 - 1) )
else:
        print(int(a/2))

Fixed submission:
a = int(input())
if a < 2:
        print(0)
elif a % 2 == 0:
        print(int(a / 2 - 1) )
else:
        print(int(a/2))

Buggy python submission (verdict: Runtime Error):
if a < 2:
        print 0
elif a % 2 == 0:
        print int(a / 2 - 1)
else:
        print int(a/2)

Fixed submission:
a = int(input())
if a < 2:
        print(0)
elif a % 2 == 0:
        print(int(a / 2 - 1) )
else:
        print(int(a/2))

Buggy python submission (verdict: Runtime Error):
a = input()
if a < 2:
        print(0)
elif a % 2 == 0:
        print(int(a / 2 - 1) )
else:
        print(int(a/2))

Fixed submission:
a = int(input())
if a < 2:
        print(0)
elif a % 2 == 0:
        print(int(a / 2 - 1) )
else:
        print(int(a/2))

Buggy python submission (verdict: Runtime Error):
a = input()
if a < 2:
    print(0)
else:
    if a % 2 == 0:
        print(int(a / 2 - 1) )
    else:
        print(int(a/2))

Fixed submission:
a = int(input())
if a < 2:
        print(0)
elif a % 2 == 0:
        print(int(a / 2 - 1) )
else:
        print(int(a/2))
Buggy python submission (verdict: Runtime Error):
S = raw_input()
K = int(raw_input())

def func(ms):
    r = 0
    k = 0
    m = ms[0]
    for i in range(1, len(ms)):
        if ms[i] == ms[i-1]:
            k+=1
        else:
            r += int((k+1)/2)
            k = 0
        m = ms[i]
    r += int((k+1)/2)
    return r            

m = S[0]
f = True
for i in range(1, len(S)):
        if S[i]  != S[i-1]:
            f = False
            
if f == True:
    if len(S) == 1:
        print(int(K/2))
    else:
        print(int(len(S) * K / 2))
elif len(set(S)) == len(S):
    print(0)
elif S[0] == S[-1]:
    r = 0
    m = S[0]
    f = 0
    for c in S:
        if c == m:
            r += 1
            f += 1
        else:
            break   
    s = S[::-1]
    fe = 0
    for c in s:
        if c == m:
            r += 1
            fe += 1
        else:
            break
    S = S[f:-fe]
    tr = int(r/2) * (K-1)
    r = func(S) * K
    print(r+tr)
else:
    r = 0
    k = 0
    m = S[0]
    for i in range(1, len(S)):
        if S[i] == S[i-1]:
            k+=1
        else:
            r += int((k+1)/2)
            k = 0
        m = S[i]
    r += int((k+1)/2)
    print(r*K)
    
    
    
  


Fixed submission:
s=input()
k=int(input())
if len(set(list(s)))==1:print((len(s)*k)//2);exit()
t=[1]
for i in range(1,len(s)):
  if s[i-1]==s[i]:t[-1]+=1
  else:t.append(1)
a=0
for i in t:a+=(i//2)*k
if s[0]==s[-1]:
  if t[0]%2==t[-1]%2==1:a+=k-1
print(a)
Buggy python submission (verdict: Runtime Error):
I = input()
K = ['Sunny', 'Cloudy,''Rainy', 'Sunny']
Idx = K.index(I)
print(K[Idx+1])


Fixed submission:
I = input()
K = ['Sunny', 'Cloudy', 'Rainy', 'Sunny']
Idx = K.index(I)
print(K[Idx+1])

Buggy python submission (verdict: Runtime Error):
I = input()
K = ['Sunny', 'Cloudy,''Rainy', 'Sunny']
Idx = K.index(I)
print(K[idx+1])


Fixed submission:
I = input()
K = ['Sunny', 'Cloudy', 'Rainy', 'Sunny']
Idx = K.index(I)
print(K[Idx+1])
Buggy python submission (verdict: Runtime Error):
I = int(intpu())
print(I*I*I)


Fixed submission:
I = int(input())
print(I*I*I)
Buggy python submission (verdict: Runtime Error):
F = input().split()
A = input().split()
s = 0
s += F[0] == A[0] ? 1 : 0
s += F[1] == A[1] ? 1 : 0
s += F[1] == A[2] ? 1 : 0
print(s)

Fixed submission:
F = input()
A = input()
s = 0
s += 1 if F[0] == A[0] else 0
s += 1 if F[1] == A[1] else 0
s += 1 if F[2] == A[2] else 0
print(s)
Buggy python submission (verdict: Runtime Error):
import math

s = int(input())

MOD = 10**9+7

maximum = int(s/3)

ans = 0
for i in range(maximum):
  ans += (math.factorial(i + s-(i*3+3))/(math.factorial(i)*math.factorial(s-(i*3+3))))%MOD

print(int(ans)%(10**9+7))


Fixed submission:
import math

s = int(input())

MOD = 10**9+7

maximum = int(s/3)

ans = 0
for i in range(maximum):
  ans += (math.factorial(i + s-(i*3+3))//(math.factorial(i)*math.factorial(s-(i*3+3))))%MOD

print(int(ans)%(10**9+7))

Buggy python submission (verdict: Runtime Error):
import math

s = int(input())

MOD = 10**9+7

maximum = int(s/3)

ans = 0
for i in range(maximum):
  ans += (math.factorial(i + s-(i*3+3))/(math.factorial(i)*math.factorial(s-(i*3+3))))%MOD

print(int(ans))

Fixed submission:
import math

s = int(input())

MOD = 10**9+7

maximum = int(s/3)

ans = 0
for i in range(maximum):
  ans += (math.factorial(i + s-(i*3+3))//(math.factorial(i)*math.factorial(s-(i*3+3))))%MOD

print(int(ans)%(10**9+7))
Buggy python submission (verdict: Runtime Error):
import itertools
import numpy as np

h,w,k = map(int, input().split())

grid = []
ans = 0
for i in range(h):
  grid.append(list(input()))

for i in range(h):
  for j in range(w):
    if grid[i][j] == "#":
      grid[i][j] = 1
    else:
      grid[i][j] = 0

for v in itertools.product([1,0],repeat=(h+w)):
  grid_dum = np.array(grid.copy())
  for i,x in enumerate(v[:h]):
    if x == 1:
      grid_dum[i,:] = 0 
  for i,x in enumerate(v[h:]):
    if x == 1:
      grid_dum[:,i-h] = 0 
  if grid_dum.sum() == k:
    ans += 1

print(ans)

Fixed submission:
import itertools
import numpy as np

h,w,k = map(int, input().split())

grid = []
ans = 0
for i in range(h):
  grid.append(list(input()))

for i in range(h):
  for j in range(w):
    if grid[i][j] == "#":
      grid[i][j] = 1
    else:
      grid[i][j] = 0

for v in itertools.product([1,0],repeat=(h+w)):
  grid_dum = np.array(grid.copy())
  for i,x in enumerate(v[:h]):
    if x == 1:
      grid_dum[i,:] = 0 
  for i,x in enumerate(v[h:]):
    if x == 1:
      grid_dum[:,i] = 0 
  if grid_dum.sum() == k:
    ans += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())

name_len = [0]
while True:
  name_len.append(name_len[-1]+26**(len(name_len)))
  if name_len[-1] > 1000000000000001:
    break

#print(name_len) 

number = 0
for i in range(len(name_len)):
  if name_len[i] < n and n <= name_len[i+1]:
    number = i+1
    break

#print(number)
#print(n)
n -= name_len[number-1]
#print(n)

ans = ""
li = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']

for i in range(number,0,-1):
  if i == 1:
    ans += li[int(n / 26**(i-1))-1]
  else:
    ans += li[int(n / 26**(i-1))]
  n = n% 26**(i-1)

print(ans)

  

Fixed submission:
n = int(input())

name_len = [0]
while True:
  name_len.append(name_len[-1]+26**(len(name_len)))
  if name_len[-1] > 1000000000000001:
    break

#print(name_len) 

number = 0
for i in range(len(name_len)):
  if name_len[i] < n and n <= name_len[i+1]:
    number = i+1
    break

#print(number)
#print(n)
n -= name_len[number-1]
#print(n)

ans = ""
li = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
#print(len(li))

for i in range(number,0,-1):
  #print(i,n)
  #print(int(n/26**(i-1)))
  #print(li[25])
  if i == 1:
    ans += li[int(n / 26**(i-1))-1]
  else:
    if n%26**(i-1) == 0:
      ans += li[int(n / 26**(i-1))-1]
    else:
      ans += li[int(n / 26**(i-1))]
  n = n% 26**(i-1)

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

n = int(input())
li = np.zeros(10**6)
a = np.array(list(map(int, input().split())))
a.sort()

u, counts = np.unique(a,return_counts=True)

for item in a:
  li[item-1] = 1
#print(li[:100])

for item in a[::-1]:
  li[item-1::item] = 0
  li[item-1] = 1

#print(li[:100])

for i in range(len(u)):
  if counts[i] >=2:
    li[u[i]-1] = 0

print(int(li.sum()))



Fixed submission:
import numpy as np

n = int(input())
a = np.array(list(map(int, input().split())))
a.sort()
li = np.zeros(a[-1])

u, counts = np.unique(a,return_counts=True)

for item in a[::-1]:
  li[item-1::item] = 0
  li[item-1] = 1

#print(li[:100])

for i in range(len(u)):
  if counts[i] >=2:
    li[u[i]-1] = 0

print(int(li.sum()))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
li = list(map(int, input().split()))

ans = 1
flag = 0
for i in li:
  if i == 0:
    flag = 1
    break
  ans *= i

if flag == 1:
  print(0)
elif ans > 10**18:
  print(-1)
else:
  print(ans)

Fixed submission:
n = int(input())
li = list(map(int, input().split()))

"""
ans = 1
flag = 0
for i in li:
  if i == 0:
    flag = 1
    break
  ans *= i

if flag == 1:
  print(0)
elif ans > 10**18:
  print(-1)
else:
  print(ans)
"""
ans = 1
flag = 0
li.sort()
if li[0] == 0:
  print(0)
else:
  for i in li[::-1]:
    ans *= i
    if ans > 10**18:
      flag = 1
      break

  if flag == 0:
    print(ans)
  elif flag == 1:
    print(-1)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
li = list(map(int, input().split()))

ans = 1
flag = 0
for i in li:
  ans *= i

if ans > 10**18:
  print(-1)
else:
  print(ans)

Fixed submission:
n = int(input())
li = list(map(int, input().split()))

"""
ans = 1
flag = 0
for i in li:
  if i == 0:
    flag = 1
    break
  ans *= i

if flag == 1:
  print(0)
elif ans > 10**18:
  print(-1)
else:
  print(ans)
"""
ans = 1
flag = 0
li.sort()
if li[0] == 0:
  print(0)
else:
  for i in li[::-1]:
    ans *= i
    if ans > 10**18:
      flag = 1
      break

  if flag == 0:
    print(ans)
  elif flag == 1:
    print(-1)
Buggy python submission (verdict: Runtime Error):
import sympy

n = int(input())
ans = 1

dic = sympy.factorint(n)

cnt  = 1
ans = 0
flag = False
while True:
  for k in dic.keys():
    if dic[k] >= cnt:
      dic[k] -= cnt
      ans += 1
      flag = True
  if not flag:
    break
  cnt += 1
  flag = False

print(ans)

Fixed submission:
#import sympy

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

n = int(input())
ans = 1

#dic = sympy.factorint(n)
arr = factorization(n)

cnt  = 1
ans = 0
flag = False
while True:
  for k in arr:
    if k[1] >= cnt:
      k[1] -= cnt
      ans += 1
      flag = True
  if not flag:
    break
  cnt += 1
  flag = False

if n == 1:
  print(0)
else:
  print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())

a_li = list(map(int, input().split()))

ans = 0
li = [0]*(n+1)

for i,a in enumerate(a_li):
  ans += (i+1)*a

for i,a in enumerate(a_li[::-1]):
  if i >= 1:
    li[i] = li[i-1]+a
  else:
    li[i] = a

li = li[::-1]

#print(li)
#print(ans)


flag = True
ne = 0.5
for i in range(n):
  if li[i]  > 2*ne:
    ans -= li[i] -2*ne
    #print(li[i] -2*ne)

  ne = 2*ne - a_li[i]
  #print(ne)
  if ne <= 0:
    flag = True

  
if flag:
  print(int(ans))
else:
  print(-1)

Fixed submission:
n = int(input())

a_li = list(map(int, input().split()))

ans = 0
li = [0]*(n+1)

for i,a in enumerate(a_li):
  ans += (i+1)*a

for i,a in enumerate(a_li[::-1]):
  if i >= 1:
    li[i] = li[i-1]+a
  else:
    li[i] = a

li = li[::-1]

flag = True
ne = 0.5
for i in range(n+1):
  if li[i]  > 2*ne:
    ans -= li[i] -int(2*ne)

  
  ne = min(li[i] - a_li[i],int(2*ne)-a_li[i])

  if (i == n and ne != 0) or (i != n and ne <= 0):
    flag = False

  
if flag:
  print(ans)
else:
  print(-1)

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

a_li = list(map(int, input().split()))

ans = 0
li = [0]*(n+1)

for i,a in enumerate(a_li):
  ans += (i+1)*a

for i,a in enumerate(a_li[::-1]):
  if i >= 1:
    li[i] = li[i-1]+a
  else:
    li[i] = a

li = li[::-1]

flag = True
ne = 0.5
for i in range(n+1):
  if li[i]  > 2*ne:
    ans -= li[i] -2*ne

  ne = 2*ne - a_li[i]
  if i == n+1 and ne <= 0:
    flag = False

  
if flag:
  print(int(ans))
else:
  print(-1)

Fixed submission:
n = int(input())

a_li = list(map(int, input().split()))

ans = 0
li = [0]*(n+1)

for i,a in enumerate(a_li):
  ans += (i+1)*a

for i,a in enumerate(a_li[::-1]):
  if i >= 1:
    li[i] = li[i-1]+a
  else:
    li[i] = a

li = li[::-1]

flag = True
ne = 0.5
for i in range(n+1):
  if li[i]  > 2*ne:
    ans -= li[i] -int(2*ne)

  
  ne = min(li[i] - a_li[i],int(2*ne)-a_li[i])

  if (i == n and ne != 0) or (i != n and ne <= 0):
    flag = False

  
if flag:
  print(ans)
else:
  print(-1)
Buggy python submission (verdict: Runtime Error):
import math

return int(input())*2*math.pi


Fixed submission:
import math

print(int(input())*2*math.pi)
Buggy python submission (verdict: Runtime Error):
li = []
for i in range(6):
    li.append(int(input()))

flag = "Yay!"
for i in range(len(li)-1):
    if li[i+1] - li[i] > li[5]:
        flag = ":("

return flag


Fixed submission:
li = []
for i in range(6):
    li.append(int(input()))

flag = "Yay!"
if li[4] - li[0] > li[5]:
    flag = ":("

print(flag)
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
#n個に分けてあげなきゃいけない
#合計はmにならなきゃいけない。素数のときは1確定？
#10 123のとき12から試す。余りが０だといいけどこの場合は３余るこのときあまりは１〜１１
#結局この問題はmを素因数分解して２数の積で表現したときにn以上の数で表せるかって話なわけよ、
#約数っていうのはその数の二乗を境にペアになっているから小さい方で割れれば商が相方になっているというわけ
#できる限り平均的に分けてあげたほうがいいってことはわかる。
#大きい方から下って見つかって瞬間終わりにするほうが賢いかも
#候補のうち最大の数字は
i = int(m/n)
ans = 1
while i >= 1:
    if m % i == 0:
        if m / i >= n:
            ans = i
            break
    i = i-1
print(ans)


Fixed submission:
n = int(input())
if n == 2:
    a = int(input())
    b = int(input())
    print(a+b)
elif n == 1:
    print("Hello World")

Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
#n個に分けてあげなきゃいけない
#できる限り平均的に分けてあげたほうがいいってことはわかる。
#大きい方から下って見つかって瞬間終わりにするほうが賢いかも
#候補のうち最大の数字は
i = int(m/n)
ans = 1
while n*i <= m:
    if m % i == 0 and m / i >= n:
        ans = i
        break
    i -= 1
print(ans)


Fixed submission:
n = int(input())
if n == 2:
    a = int(input())
    b = int(input())
    print(a+b)
elif n == 1:
    print("Hello World")
Buggy python submission (verdict: Runtime Error):
n = str(input())
for i in n:
    if i == 9:
        n[i] = 1
    else:
        n[i] = 9
print(int(n))


Fixed submission:
n = str(input())
ans = ""
for i in n:
    if i == "9":
        ans += "1"
    else:
        ans += "9"
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n = int(input())
    a = [int(i) for i in input().split()]
    ans = a[0]
    for i in range(1, n):
        ans *= a[i]        

    if ans > 10 ** 18:
        ans = -1

    print(f'{ans}')


if __name__ == '__main__':
    main()

Fixed submission:
def main():
    n = int(input())
    a = [int(i) for i in input().split()]
    # a = list(map(int, input().split()))
    
    ans = a[0]
    if 0 in a:
        ans = 0
    else:    
        for i in range(1, n):
            ans *= a[i]
            if ans > 10 ** 18:
                ans = -1
                break

    print(f'{ans}')


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    A, B, C, K = map(int, input().split())

    ans = 0
    cnt = 0

    if A >= 1:
        if K >= A:
            cnt = A
        else:
            cnt = K

        for i in range(cnt):
            ans += 1

    tmp = K - A - B
    if tmp >= 1:
        cnt = tmp
        for i in range(cnt):
            ans -= 1

    print(f'{ans}')

if __name__ == '__main__':
    main()



Fixed submission:
def main():
    A, B, C, K = map(int, input().split())

    ans = 0

    # A
    if A >= 1:
        if K >= A:
            ans = A
        else:
            ans = K

    # C
    tmp = K - A - B
    if tmp >= 1:
        ans -= tmp

    print(f'{ans}')

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
def main():
    N = int(input())
    A = [int(i) for i in input().split()]

    ans = {}

    for i in range(len(A)):
        if A[i] in ans:    # キーの存在確認
            ans[A[i]] += 1
        else:
            ans[A[i]] = 1
    
    for i in range(1, N):
        if i in ans:
            print('{}'.format(ans[A[i]]))
        else:
            print('{}'.format(0))

    print('{}'.format(0))

if __name__ == '__main__':
    main()


Fixed submission:
def main():
    N = int(input())
    A = [int(i) for i in input().split()]

    ans = {}

    for i in range(len(A)):
        if A[i] in ans:    # Confirm existence of key
            ans[A[i]] += 1
        else:
            ans[A[i]] = 1
    
    for i in range(1, N):
        if i in ans:
            # print('{}'.format(ans[A[i]]))
            print('{}'.format(ans[i]))
        else:
            print('{}'.format(0))

    print('{}'.format(0))

if __name__ == '__main__':
    main()