Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import math
S = int(input())

if int(math.sqrt(S))**2 == S:
    a = d = int(math.sqrt(S))
else:    
    a = d = int(math.sqrt(S)) + 1

bc = a*d - S

for i in range(int(math.sqrt(bc)),0,-1):
    if bc % i == 0:
        b = i
        c = bc//i
        break

print(0,0,a,b,c,d)

Fixed submission:
import math
S = int(input())

if int(math.sqrt(S))**2 == S:
    a = d = int(math.sqrt(S))
else:
    a = d = int(math.sqrt(S)) + 1

bc = a*d - S

if bc == 0:
    b = c = 0
else:
    for i in range(int(math.sqrt(bc)),0,-1):
        if bc % i == 0:
            b = i
            c = bc//i
            break

print(0,0,a,b,c,d)

Buggy python submission (verdict: Time Limit Exceeded):
import math
S = int(input())

for i in range(int(math.sqrt(S))+1,0,-1):
    if S%i == 0:
        print(0,0,i,0,0,S//i)
        break

Fixed submission:
import math
S = int(input())

if int(math.sqrt(S))**2 == S:
    a = d = int(math.sqrt(S))
else:
    a = d = int(math.sqrt(S)) + 1

bc = a*d - S

if bc == 0:
    b = c = 0
else:
    for i in range(int(math.sqrt(bc)),0,-1):
        if bc % i == 0:
            b = i
            c = bc//i
            break

print(0,0,a,b,c,d)
Buggy python submission (verdict: Runtime Error):
import bisect
N = int(input())

c = []
for i in range(N):
    n = int(input())
    index = bisect.bisect_left(c,n)
    if index == 0:
        c.append(n)
    else:
        c[index-1] = n
    c.sort()
    #print(c)

print(len(c))      

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

b = [0 for i in range(N)]

def check(i):
    cnt = 0
    n = i
    while n <= N:
        cnt += b[n-1]
        n += i
    return cnt

for i in range(N-1,-1,-1):
    if (a[i] + check(i+1))%2 == 1:
        b[i] = 1

ans = []
cnt = 0
for i in range(N):
    if b[i] == 1:
        cnt += 1
        ans.append(i+1)

print(cnt)
L = [str(int(i)) for i in ans]
print(' '.join(L))
Buggy python submission (verdict: Runtime Error):
N,X = map(int,input().split())
L = list(map(int,input().split()))

cnt = 0
D = 0
while D <= X:
    D += L[cnt]
    cnt += 1

print(cnt)

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

cnt = 0
D = 0
while D <= X and cnt < len(L):
    D += L[cnt]
    cnt += 1

if D <= X:
    cnt += 1

print(cnt)
Buggy python submission (verdict: Runtime Error):
N = int(input())

if N == 1:
    print(1)
else:
    point = []
    for i in range(N):
        x,y = map(int,input().split())
        point.append([x,y])

    vec = []
    for i in range(N):
        for j in range(i+1,N,1):
            vec.append([point[i][0]-point[j][0],point[i][1]-point[j][1]])

    N2 = len(vec)
    check = [0 for i in range(N2)]

    for i in range(N2):
        for j in range(N2):
            minus = [-vec[j][0],-vec[j][1]]
            if vec[i] == vec[j] or vec[i] == minus:
                check[i] += 1

    print(N-max(check))

Fixed submission:
N,K = map(int,input().split())
if K == 1:
    print(0)
else:
    print(N-K)
Buggy python submission (verdict: Runtime Error):
N = int(input())

point = []
for i in range(N):
    x,y = map(int,input().split())
    point.append([x,y])

vec = []
for i in range(N):
    for j in range(i+1,N,1):
        vec.append([point[i][0]-point[j][0],point[i][1]-point[j][1]])

N2 = len(vec)
check = [0 for i in range(N2)]

for i in range(N2):
    for j in range(N2):
        minus = [-vec[j][0],-vec[j][1]]
        if vec[i] == vec[j] or vec[i] == minus:
            check[i] += 1
            
if N == 10:
    print(1)
else:
    print(N-max(check))

Fixed submission:
N = int(input())

if N == 1:
    print(1)
else:
    point = []
    for i in range(N):
        x,y = map(int,input().split())
        point.append([x,y])

    vec = []
    for i in range(N):
        for j in range(i+1,N,1):
            vec.append([point[i][0]-point[j][0],point[i][1]-point[j][1]])

    N2 = len(vec)
    check = [0 for i in range(N2)]

    for i in range(N2):
        for j in range(N2):
            minus = [-vec[j][0],-vec[j][1]]
            if vec[i] == vec[j] or vec[i] == minus:
                check[i] += 1

    print(N-max(check))
Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
a = []
for i in range(M):
    a.append(int(input()))

inf = 1000000007
index = 0
n_way = [0 for i in range(N+2)]
n_way[0] = 1

for i in range(N):
    if a[index] == i:
        index += 1
        index = min(index,len(a)-1)
    else:
        n_way[i+1] += n_way[i]
        n_way[i+1] = n_way[i+1]%inf
        n_way[i+2] += n_way[i]
        n_way[i+2] = n_way[i+2]%inf

print(n_way[N])



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

if M == 0:
    a = [-1]

inf = 1000000007
index = 0
n_way = [0 for i in range(N+2)]
n_way[0] = 1

for i in range(N):
    if a[index] == i:
        index += 1
        index = min(index,len(a)-1)
    else:
        n_way[i+1] += n_way[i]
        n_way[i+1] = n_way[i+1]%inf
        n_way[i+2] += n_way[i]
        n_way[i+2] = n_way[i+2]%inf

print(n_way[N])
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
from pprint import pprint
H,W = map(int,input().split())

def cal(l):
    ll = l.copy()
    ll.append('#')
    vol = [-100 for j in range(len(ll))]
    i = 0
    while i <= len(ll)-1:
        cnt = 0
        while (ll[i] != '#' and i <= len(ll)-1):
            cnt += 1
            i += 1
            # print(i)

        for j in range(i-cnt,i):
            vol[j] = cnt

        i += 1
        # print(i)
    return vol[:-1]

ver = [] # 縦
hori = [] # 横
fmap = []

for h in range(H):
    # print(h,fmap)
    l = list(input())
    #print(l)
    hori.append(cal(l))
    fmap.append(l)

fmap = np.array(fmap)
fmap = fmap.T.tolist()
#print(fmap)

for w in range(W):
    ver.append(cal(fmap[w]))

ans = 0
#pprint(np.array(hori))
#pprint(np.array(ver).T)
for h in range(H):
    for w in range(W):
        s = hori[h][w]+ver[w][h]
        if s > ans:
            ans = s
print(ans-1)



Fixed submission:
H,W = map(int,input().split())

def cal(l):
    ll = list(l)
    ll.append('#')
    vol = [-100 for j in range(len(ll))]
    i = 0
    while i <= len(ll)-1:
        cnt = 0
        while (ll[i] != '#' and i <= len(ll)-1):
            cnt += 1
            i += 1

        for j in range(i-cnt,i):
            vol[j] = cnt

        i += 1
    return vol[:-1]

ver = [] # 縦
hori = [] # 横
fmap = []

for h in range(H):
    l = list(input())
    hori.append(cal(l))
    fmap.append(l)



new_map = []
for i in range(len(fmap[0])):
    mini_l = []
    for j in range(len(fmap)):
        mini_l.append(fmap[j][i])
    new_map.append(mini_l)

fmap = new_map    

for w in range(W):
    ver.append(cal(fmap[w]))

ans = 0

for h in range(H):
    for w in range(W):
        s = hori[h][w]+ver[w][h]
        if s > ans:
            ans = s
print(ans-1)
Buggy python submission (verdict: Runtime Error):
N,K = map(int,input().split())
V = list(map(int,input().split()))

value = max_value = 0
for j in range(K//2):
    for i in range(K-j+1):
        if i == K-j:
            value = V[:K-j]
        else:
            value = V[:i]+V[-(K-j-i):]
        value.sort()
        
        if value[j] > 0:
            s = sum([i for i in value if i>0])
        else:
            s = sum(value[j:])
                
        if  s > max_value:
            max_value = s

print(max_value)

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

value = max_value = 0
for j in range(K//2+1):
    for i in range(K-j+1):
        if K-j >= N:
            value = V
        else:
            if i == K-j:
                value = V[:K-j]
            else:
                value = V[:i]+V[-(K-j-i):]
        value.sort()
        # print(i,j,value)


        jj = min(len(value)-1,j)
        if value[jj] <= 0:
            s = sum(value[jj:])
        else:
            s = sum([i for i in value if i>0])

        if  s > max_value:
            max_value = s
print(max_value)
Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
A = list(map(int,input().split()))
sortedA = sorted(A)
CB = []
for i in range(M):
    B,C = map(int,input().split())
    CB.append([C,B])

CB.sort(reverse=True)

cnt = 0
goukei = 0
flag = True
flag2 = False
for i in range(M):
    Bi,Ci = CB[i][1],CB[i][0]
    # Bi = min(Bi,N-cnt-1)
    if Bi+cnt >= N:
        Bi = N-cnt-1
        flag2 = True
            
    if sortedA[cnt+Bi] <= Ci:
        if flag2:
            cnt += Bi+1
            goukei += (Bi+1)*Ci
        else:
            cnt += Bi
            goukei += Bi*Ci
    elif sortedA[cnt] >= Ci:
        goukei += sum(sortedA[cnt:])
        flag = False
        break
    else:
        for x in sortedA[cnt:cnt+Bi+1]:
            if x <= Ci:
                goukei += Ci
            else:
                goukei += x
        goukei += sum(sortedA[cnt+Bi+1:])
        flag = False
        break
if flag:
  goukei += sum(sortedA[cnt:])

print(goukei)



Fixed submission:
N,M = map(int,input().split())
A = list(map(int,input().split()))
sortedA = sorted(A)
CB = []
for i in range(M):
    B,C = map(int,input().split())
    CB.append([C,B])

CB.sort(reverse=True)

cnt = 0
goukei = 0
flag = True
flag2 = False
for i in range(M):
    Bi,Ci = CB[i][1],CB[i][0]
    # Bi = min(Bi,N-cnt-1)
    if Bi+cnt >= N:
        Bi = N-cnt-1
        flag2 = True

    if sortedA[cnt+Bi] <= Ci:
        if flag2:
            cnt += Bi
            goukei += (Bi+1)*Ci
            flag = False
            break
        else:
            cnt += Bi
            goukei += Bi*Ci
    elif sortedA[cnt] >= Ci:
        goukei += sum(sortedA[cnt:])
        flag = False
        break
    else:
        for x in sortedA[cnt:cnt+Bi+1]:
            if x <= Ci:
                goukei += Ci
            else:
                goukei += x
        goukei += sum(sortedA[cnt+Bi+1:])
        flag = False
        break
if flag:
  goukei += sum(sortedA[cnt:])

print(goukei)
Buggy python submission (verdict: Runtime Error):
import math
N = int(input())
cnt = 0
for i in range(1,int(math.sqrt(N))+1):
	if N % i == 0:		
		if N / i == i:
			cnt += i-1
		else:
			cnt += N/i-1
print(int(cnt))

Fixed submission:
N,K = map(int,input().split())
print(N-K+1)
Buggy python submission (verdict: Time Limit Exceeded):
R,G,B,N = map(int,input().split())
cnt = 0
for r in range(N//R+1):
	for g in range((N-r*R)//G+1):
		n=N-R*r-G*g
		if n%B==0 and n//B>=0:
			cnt += 1

print(cnt)

Fixed submission:
R,G,B,N = map(int,input().split())
cnt = 0
for r in range(N//R+1):
	n=N-r*R
	for g in range(n//G+1):
		n1=n-G*g
		if n1%B==0 and n1//B>=0:
			cnt += 1

print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
R,G,B,N = map(int,input().split())
cnt = 0
for r in range(N//R+1):
	for g in range((N-r*R)//G+1):
		if (N-R*r-G*g)%B==0 and (N-R*r-G*g)//B>=0:
			cnt += 1

print(cnt)

Fixed submission:
R,G,B,N = map(int,input().split())
cnt = 0
for r in range(N//R+1):
	n=N-r*R
	for g in range(n//G+1):
		n1=n-G*g
		if n1%B==0 and n1//B>=0:
			cnt += 1

print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
R,G,B,N = map(int,input().split())
cnt = 0
for r in range(N//R+1):
	for g in range(N//G+1):
		if (N-R*r-G*g)%B==0 and (N-R*r-G*g)//B>=0:
			cnt += 1

print(cnt)

Fixed submission:
R,G,B,N = map(int,input().split())
cnt = 0
for r in range(N//R+1):
	n=N-r*R
	for g in range(n//G+1):
		n1=n-G*g
		if n1%B==0 and n1//B>=0:
			cnt += 1

print(cnt)
Buggy python submission (verdict: Runtime Error):
import fractions
N = int(input())
l = list(map(int,input().split()))

if len(l) == 2:
    memo = max(l)
else:
    memo = 1
    for i in range(N):
        g = fractions.gcd(*(l[:i]+l[i+1:]))
        if g > memo:
            memo = g

print(memo)

Fixed submission:
A,B,T = map(int,input().split())
print(int(((T+0.5)//A)*B))
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()
K = int(input())

s = S[K]

answer = ''
for i in range(N):
    if S[i] != s:
        answer += '*'
    else:
        answer += s
print(answer)

Fixed submission:
N = int(input())
S = input()
K = int(input())

s = S[K-1]

answer = ''
for i in range(N):
    if S[i] != s:
        answer += '*'
    else:
        answer += s
print(answer)
Buggy python submission (verdict: Runtime Error):
s = input()

max_score = 0
for i in range(len(s)):
  if s[i] == 'A' or s[i] == 'T' or s[i] == 'G' or s[i] == 'C':
    score += 1
  else:
    if max_score < score:
      max_score = score
    score = 0

      
print(max_score)

Fixed submission:
s = input()

max_score = 0
score = 0
for i in range(len(s)):
  if s[i] == 'A' or s[i] == 'T' or s[i] == 'G' or s[i] == 'C':
    score += 1
    if max_score <= score:
      max_score = score
  else:
    if max_score <= score:
      max_score = score
    score = 0
  
 
      
print(max_score)
Buggy python submission (verdict: Time Limit Exceeded):
N,Q = map(int, input().split())
s = input()


for q in range(Q):
  l,r = map(int, input().split())
  
  cnt = 0
  
  for i in range(l-1,r-1):
    if s[i:i+2] == 'AC':
      
      cnt += 1
  
  print(cnt)
  




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

cnt = 0
n = [0]
for i in range(N-1):
    if s[i]+s[i+1] == 'AC':
        cnt += 1
    n.append(cnt)


for i in range(Q):
    l,r = map(int,input().split())
    print(n[r-1]-n[l-1])

Buggy python submission (verdict: Time Limit Exceeded):
N,Q = map(int, input().split())
s = input()


for q in range(Q):
  l,r = map(int, input().split())
  s_q = s[l-1:r]
  cnt = 0
  
  for i in range(len(s_q)-1):
    if s_q[i:i+2] == 'AC':
      cnt += 1
  
  print(cnt)
  




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

cnt = 0
n = [0]
for i in range(N-1):
    if s[i]+s[i+1] == 'AC':
        cnt += 1
    n.append(cnt)


for i in range(Q):
    l,r = map(int,input().split())
    print(n[r-1]-n[l-1])

Buggy python submission (verdict: Time Limit Exceeded):
N,Q = map(int, input().split())
s = input()

l_list = []
r_list = []

for q in range(Q):
  l,r = map(int, input().split())
  s_q = s[l-1:r]
  cnt = 0
  
  for i in range(len(s_q)-1):
    if s_q[i] == 'A' and s_q[i+1] == 'C':
      cnt += 1
  
  print(cnt)
  




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

cnt = 0
n = [0]
for i in range(N-1):
    if s[i]+s[i+1] == 'AC':
        cnt += 1
    n.append(cnt)


for i in range(Q):
    l,r = map(int,input().split())
    print(n[r-1]-n[l-1])

Buggy python submission (verdict: Time Limit Exceeded):
N,Q = map(int, input().split())
s = input()

l_list = []
r_list = []
for q in range(Q):
  l,r = map(int, input().split())
  l_list.append(l)
  r_list.append(r)

for q in range(Q):
  s_q = s[l_list[q]-1:r_list[q]]
  cnt = 0
  
  for i in range(len(s_q)-1):
    if s_q[i] == 'A' and s_q[i+1] == 'C':
      cnt += 1
  
  print(cnt)
  




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

cnt = 0
n = [0]
for i in range(N-1):
    if s[i]+s[i+1] == 'AC':
        cnt += 1
    n.append(cnt)


for i in range(Q):
    l,r = map(int,input().split())
    print(n[r-1]-n[l-1])
Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
cnt = [0 for i in range(M)]
for i in range(N):
    A = list(map(int,input().split()))
    A = A[1:]
    for j in range(len(A)):
        cnt[A[j]] += 1

print(cnt.count(N))

Fixed submission:
N,M = map(int,input().split())
cnt = [0 for i in range(M)]
for i in range(N):
    A = list(map(int,input().split()))
    A = A[1:]
    for j in range(len(A)):
        cnt[A[j]-1] += 1

print(cnt.count(N))
Buggy python submission (verdict: Runtime Error):
a = input().split()
for i in range(2):
    a[i] = int(a[i]) if i == 0 else float(a[i]*100)
print(int(a[0] * a[1] / 100))


Fixed submission:
a = input().split()
for i in range(2):
    a[i] = int(a[i]) if i == 0 else round(float(a[i])*100)
print(int(a[0] * a[1] // 100))

Buggy python submission (verdict: Runtime Error):
#A, B = map(float, input().split())
a = input().split()
for i in range(2):
    a[i] = int(a[i]) if i == 0 else float(a[i]*100)
print(int(a[0] * a[1] / 100))
#print(type(a[0]))
#print(type(a[1]))


Fixed submission:
a = input().split()
for i in range(2):
    a[i] = int(a[i]) if i == 0 else round(float(a[i])*100)
print(int(a[0] * a[1] // 100))
Buggy python submission (verdict: Runtime Error):
S = input()
k = S.size()
l = 15 - k
m =S.count("○")
if m + l>= 8:
    print("YES")
else:
    print("NO")


Fixed submission:
S = input()
k = len(S)
l = 15 - k
m =S.count("o")
if m + l>= 8:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()
K = int(input())
list = []
Sk = S[K-1]
for i range(0,N):
  s = S[i]
  s_ans = Sk if s == Sk else "*"
  list.append(s_ans)
ans = join(list)
print(ans)


Fixed submission:
N = int(input())
S = input()
K = int(input())
list = []
Sk = S[K-1]
for i in range(0,N):
  s = S[i]
  s_ans = Sk if s == Sk else "*"
  list.append(s_ans)
ans = "".join(list)
print(ans)
Buggy python submission (verdict: Runtime Error):
main():
  n = int(input())
  print(n**3)

if __name__ == '__main__':
  main()

Fixed submission:
def main():
  n = int(input())
  print(n**3)
 
if __name__ == '__main__':
  main()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n = int(input())
    a = list(int(input()) for _ in range(n))
    MAX = max(a)
    for i in range(n):
        ans = MAX
        if a[i] == MAX:
            ans = max(a[:i] + a[i+1:]) if i != n - 1 else max(a[:i])
        print(ans)


if __name__ == '__main__':
    main()

Fixed submission:
def main():
    n = int(input())
    a = list(int(input()) for _ in range(n))
    s = sorted(a)
    MAX1, MAX2 = s[-1], s[-2]
    for i in range(n):
        ans = MAX2 if a[i] == MAX1 else MAX1
        print(ans)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
def main():
    l, r = map(int, input().split(' '))
    if (r - l) >= 2019:
        ans = 0
    else:
        while l > 2019:
            l %= 2019
        while r > 2019:
            r %= 2019
            ans = 0 if l >= r else l * (l + 1)
    print(ans)


if __name__ == '__main__':
    main()


Fixed submission:
def main():
  l, r = map(int, input().split(' '))
  if r - l >= 2019:
    print(0)
  else:
    ans = l * r
    i = l
    while i < r:
      j = i + 1
      while j <= r:
        ij = i * j
        if mod(ij) < ans:
          ans = mod(ij)
        j += 1
      i += 1
    print(ans)


def mod(n):
  if n < 2019:
    return n
  else:
    return(n % 2019)


if __name__ == '__main__':
  main()
Buggy python submission (verdict: Runtime Error):
k = int(input())
power = 0
cnt = 1
if k == 1 or k == 7:
  print(1)
elif k%2 == 0 or k%5 == 0:
  print(-1)
elif k%7 == 0:
  l = k/7
  a = 1
  while(true):
    a = (10*a)%l
    if a == 1:
      break
    cnt+= 1
  print(cnt)
else:
  a = 1
  l = 9*k
  while(True):
    a = (10*a)%l
    if a == 1:
      break
    cnt+=1
  print(cnt)


Fixed submission:
k = int(input())
power = 0
cnt = 1
if k == 1 or k == 7:
  print(1)
elif k%2 == 0 or k%5 == 0:
  print(-1)
elif k%7 == 0:
  l = 9*k/7
  a = 1
  while(True):
    a = (10*a)%l
    if a == 1:
      break
    cnt+= 1
  print(cnt)
else:
  a = 1
  l = 9*k
  while(True):
    a = (10*a)%l
    if a == 1:
      break
    cnt+=1
  print(cnt)

Buggy python submission (verdict: Runtime Error):
k = int(input())
power = 0
cnt = 1
if k == 1:
  print(1)
elif k%2 == 0 or k%5 == 0:
  print(-1)
elif k%7 == 0:
  l = k/7
  a = 1
  while(true):
    a = (10*a)%l
    if a == 1:
      break
    cnt+= 1
  print(cnt)
else:
  a = 1
  l = 9*k
  while(True):
    a = (10*a)%l
    if a == 1:
      break
    cnt+=1
  print(cnt)

Fixed submission:
k = int(input())
power = 0
cnt = 1
if k == 1 or k == 7:
  print(1)
elif k%2 == 0 or k%5 == 0:
  print(-1)
elif k%7 == 0:
  l = 9*k/7
  a = 1
  while(True):
    a = (10*a)%l
    if a == 1:
      break
    cnt+= 1
  print(cnt)
else:
  a = 1
  l = 9*k
  while(True):
    a = (10*a)%l
    if a == 1:
      break
    cnt+=1
  print(cnt)
Buggy python submission (verdict: Runtime Error):
roman = "abcdefghijklmnopqrstuvwxyz"
num_to_roman = {}
for i in range(26):
  num_to_roman[i+1] = roman[i]

n = int(input())
ans = []
while(n):
  ans.insert(0, num_to_roman[n%26])
  n = n//26
  
ans_str = ''.join(ans)
print(ans_str)

Fixed submission:
roman = "abcdefghijklmnopqrstuvwxyz"
num_to_roman = {}
for i in range(26):
  num_to_roman[i] = roman[i]

n = int(input())
ans = []
while(n):
  n-=1
  ans.insert(0,num_to_roman[n%26])
  n = n//26
  
ans_str = ''.join(ans)
print(ans_str)
Buggy python submission (verdict: Runtime Error):
ans = int(input())
ans *= int(input())
print(ans)

Fixed submission:
a, b = map(int,input().split())
print(a*b)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
num = list(map(int,input().split()))
ans = 1
limit = 1000000000000000000
for i in range(n):
  ans *= num[i]
  if ans == 0:
    break
if ans>limit:
  print(-1)
else:
  print(ans)


Fixed submission:
n = int(input())
num = list(map(int,input().split()))
ans = 1
limit = 1000000000000000000
if 0 in num:
  print(0)
else:
  for item in num:
    ans *= item
    if ans>limit:
      ans = -1
      break

  print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
num = list(map(int,input().split()))
ans = 1
limit = 10**18
for i in range(n):
  ans *= num[i]
if ans>limit:
  print(-1)
else:
  print(ans)


Fixed submission:
n = int(input())
num = list(map(int,input().split()))
ans = 1
limit = 1000000000000000000
if 0 in num:
  print(0)
else:
  for item in num:
    ans *= item
    if ans>limit:
      ans = -1
      break

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

a,b,h,m = map(int,input().split())

def clock_to_minutes(h, m):
  minutes = m
  minutes += h*60
  return minutes

angular_speed_A = 360/12/60
angular_speed_B = 6

angle = abs((angular_speed_A - angular_speed_B)*clock_to_minutes(h,m)%360)

ans = sqrt(a**2 + b**2 - 2*a*b*math.cos(math.radians(angle)))

print(ans)


Fixed submission:
import math

a,b,h,m = map(int,input().split())

def clock_to_minutes(h, m):
  minutes = m
  minutes += h*60
  return minutes

angular_speed_A = 360/12/60
angular_speed_B = 6

angle = abs((angular_speed_A - angular_speed_B)*clock_to_minutes(h,m)%360)

ans = math.sqrt(a**2 + b**2 - 2*a*b*math.cos(math.radians(angle)))

print(ans)
Buggy python submission (verdict: Runtime Error):
n, k = map(int,input().split())
town = list(map(int,input().split()))
cnt = 1
step = 1
now = town[0]
via = [1]
s = {1}
while True:
  now = town[via[-1]-1-
  if not now in s:
    via.append(now)
    s.add(now)
  else:
    start = via.index(now)
    roop = len(via) - start
    break


if len(via) == 1:
    print(1)
    exit()
 
elif len(via) > k:
    print(via[k])
    exit()
 
else:
    roop_remainder = (k + 1 - start) % roop
    if roop_remainder == 0:
        print(via[-1])
    else:
        print(via[start + roop_remainder -1])


Fixed submission:
n, k = map(int,input().split())
town = list(map(int,input().split()))
cnt = 1
step = 1
now = town[0]
via = [1]
s = {1}
while True:
  now = town[via[-1]-1]
  if not now in s:
    via.append(now)
    s.add(now)
  else:
    start = via.index(now)
    roop = len(via) - start
    break
 
 
if len(via) == 1:
    print(1)
    exit()
 
elif len(via) > k:
    print(via[k])
    exit()
 
else:
    roop_remainder = (k + 1 - start) % roop
    if roop_remainder == 0:
        print(via[-1])
    else:
        print(via[start + roop_remainder -1])
Buggy python submission (verdict: Runtime Error):
a,b,c,d = map(int,input().split())
turn =1
while((a<=0) or (c<=0)):
  if(turn = 1):
    c -= b
    turn = 0
  else:
    a -= d
    turn = 1
if(a<=0):
  print("No")
else:
  print("Yes")
    
  


Fixed submission:
a,b,c,d = map(int,input().split())
turn =1
while((a>0) and (c>0)):
  if(turn == 1):
    c -= b
    turn = 0
  else:
    a -= d
    turn = 1
if(a<=0):
  print("No")
else:
  print("Yes")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
goods = []
for i in range(n):
  tmp = input()
  if tmp not in goods:
    goods.append(tmp)
print(len(goods))

Fixed submission:
n = int(input())

goods = []
for i in range(n):
  goods.append(input())
  
s = set(goods)
print(len(s))