Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))

ans=1

for i in range(N):
    ans = ans * A[i]


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

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

if 0 in A:
    print(0)
    exit()

ans=1

for i in range(N):
    ans = ans * A[i]
    if ans > 10**18:
        print(-1)
        exit()

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from operator import mul
from functools import reduce
N = int(input())
A = list(map(int,input().split()))

if reduce(mul, A) > 10**18:
    print(-1)
    exit()
else:
    print(reduce(mul, A))

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

if 0 in A:
    print(0)
    exit()

ans=1

for i in range(N):
    ans = ans * A[i]
    if ans > 10**18:
        print(-1)
        exit()

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()

ans = 0
start = 0

for i in range(3, len(s)):
    for j in range(i+1, len(s)+1):
        if int(s[start:j]) % 2019 == 0:
            ans += 1

    start += 1
    
print(ans)

Fixed submission:
from collections import Counter
s = input()

s = s[::-1]

x = 1
mod = 2019
total = 0
ans = 0
cnt = Counter()

for i in range(len(s)):
    cnt[total] += 1
    total = total + int(s[i])*x
    total %= mod
    ans += cnt[total]
    x = x*10%mod

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()
ans = s.count("R") * s.count("G") * s.count("B")

for i in range(n):
    for j in range(i+1,n):
        if s[i] != s[j]:
            k = j + (j - i)
            if k < n and j < n:
                if s[i] != s[j] != s[k] != s[i]:
                    # print(i, j, k)
                    ans -= 1

print(ans)

Fixed submission:
n = int(input())
s = input()
ans = s.count("R") * s.count("G") * s.count("B")

for i in range(n):
    for j in range(i+1,n):
        if s[i] != s[j]:
            k = j + (j - i)
            if k >= n or j >= n:
                break
            if s[i] != s[j] != s[k] != s[i]:
                # print(i, j, k)
                ans -= 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()
ans = s.count("R") * s.count("G") * s.count("B")

for i in range(n):
    for j in range(i+1,n):
        if s[i] != s[j]:
            k = j + (j - i)
            if k < n:
                if s[i] != s[j] != s[k] != s[i]:
                    # print(i, j, k)
                    ans -= 1

print(ans)

Fixed submission:
n = int(input())
s = input()
ans = s.count("R") * s.count("G") * s.count("B")

for i in range(n):
    for j in range(i+1,n):
        if s[i] != s[j]:
            k = j + (j - i)
            if k >= n or j >= n:
                break
            if s[i] != s[j] != s[k] != s[i]:
                # print(i, j, k)
                ans -= 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()
ans = 0

for i in range(len(s)):
    for j in range(i+1,len(s)):
        if s[i] != s[j]:
            for k in range(j+1,len(s)):
                if s[i] != s[k] and s[j] != s[k]:
                    if ((j+1)-(i+1)) != ((k+1)-(j+1)):
                        ans += 1
    

print(ans)

Fixed submission:
n = int(input())
s = input()
ans = s.count("R") * s.count("G") * s.count("B")

for i in range(n):
    for j in range(i+1,n):
        if s[i] != s[j]:
            k = j + (j - i)
            if k >= n or j >= n:
                break
            if s[i] != s[j] != s[k] != s[i]:
                # print(i, j, k)
                ans -= 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import collections
import itertools
n = int(input())
a = list(map(int,input().split()))

for i in range(n):
    ans = 0
    pop = a.pop(i)
    new_a = collections.Counter(a)
    # print(new_a)
    for key,val in new_a.items():
        # print(val)
        if val > 1:
            ans += (val * (val - 1) // 2)
    a.insert(i, pop)
    print(ans)

Fixed submission:
import collections
n = int(input())
a = list(map(int,input().split()))
new_a = collections.Counter(a)

total = 0
for key, val in new_a.items():
    if val > 1:
        total += (val * (val - 1) // 2)


for i in a:
    ans = total
    ans -= new_a[i]-1
    print(ans)
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
sc = [list(map(int, input().split())) for _ in range(m)]

for i in range(1000):
    ans = str(i)
    for s, c in sc:
        print(s, c, ans)
        if int(ans[s-1]) != c:
            break
    else:
        print(ans)
        exit()

print(-1)

Fixed submission:
n, m = map(int, input().split())
sc = [list(map(int, input().split())) for _ in range(m)]

for i in range(1000):
    ans = str(i)
    if len(ans) != n:
        continue
    for s, c in sc:
        if int(ans[s-1]) != c:
            break
    else:
        print(ans)
        exit()

print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = list(map(int,input().split()))

ans=0

for i in range(0,N):
    x = min(P[0:i+1])
    if P[i] == x:
        ans += 1

print(ans)

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

ans=0
minCount=2*10**6

for i in range(N):
    if minCount >= P[i]:
        ans += 1
    minCount=min(minCount, P[i])

print(ans)

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

ans=0

for i in range(N):
    x = sorted(P[0:i+1])
    if x.index(P[i]) == 0:
        ans += 1

print(ans)

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

ans=0
minCount=2*10**6

for i in range(N):
    if minCount >= P[i]:
        ans += 1
    minCount=min(minCount, P[i])

print(ans)

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

ans=0

for i in range(N):
    for j in range(i):
        if P[i] < P[j]:
            continue
        else:
            ans += 1
            break
print(len(P) - ans)

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

ans=0
minCount=2*10**6

for i in range(N):
    if minCount >= P[i]:
        ans += 1
    minCount=min(minCount, P[i])

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
a, b, k = map(int, input().split())

if a + b <= k:
    print(str(0) + " " + str(0))
    sys.exit()

for i in range(k):
    if a >=1:
        a -= 1
    else:
        b -= 1

print(str(a) + " " + str(b))

Fixed submission:
a, b, k = map(int, input().split())

if a >= k:
    print(a-k,b)
else:
    b = b - (k - a)
    if b < 0:
        print(0,0)
    else:
        print(0,b)
Buggy python submission (verdict: Runtime Error):
import math
a, b = map(int, input().split())

print((a * b) // math.gcd(a,b))

Fixed submission:
import fractions
a, b = map(int, input().split())

print((a * b) // fractions.gcd(a,b))
Buggy python submission (verdict: Runtime Error):
n = int(input())

a = []
if n%2==0:
    if n // 10000 >= 1:
        for i in range(1, n//10000):
            q, mod = divmod(n, i)
            if mod == 0:
                a.append((i,q))
    
        max = max(a)
        print(sum(max)-2)
    
    else:
        for i in range(1, n//2):
            q, mod = divmod(n, i)
            if mod == 0:
                a.append((i,q))
    
        max = max(a)
        print(sum(max)-2)

else:
    print(n-1)

Fixed submission:
import numpy as np
n = int(input())

ans = 10**18

for i in range(1, int(np.sqrt(n))+1):
    if n % i == 0:
        j = n//i
        ans = min(ans, i+j-2)

print(ans)

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

a = []
if n%2==0:
    for i in range(1, n//2):
        q, mod = divmod(n, i)
        if mod == 0:
            a.append((i,q))
    
    max = max(a)

    print(sum(max)-2)
else:
    print(n-1)

Fixed submission:
import numpy as np
n = int(input())

ans = 10**18

for i in range(1, int(np.sqrt(n))+1):
    if n % i == 0:
        j = n//i
        ans = min(ans, i+j-2)

print(ans)

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

a = []
for i in range(1, n//2):
    q, mod = divmod(n, i)
    if mod == 0:
        a.append((i,q))

max = max(a)

print(sum(max)-2)

Fixed submission:
import numpy as np
n = int(input())

ans = 10**18

for i in range(1, int(np.sqrt(n))+1):
    if n % i == 0:
        j = n//i
        ans = min(ans, i+j-2)

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

for i in range(N):
    B = A.pop(i)
    print(max(A))
    A.insert(i, B)

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

newList = sorted(A,reverse=True)

for i in A:
    if newList[0] == i:
        print(newList[1])
    else:
        print(newList[0])
Buggy python submission (verdict: Time Limit Exceeded):
X=int(input())

def factorization(n):
    cnt=0
    i = 1
    while i*i <= n:
        if n % i == 0:
            cnt+=1
            if i != n // i:
                cnt+=1
        i += 1
    return cnt
  
answer=0
for k in range(1,X+1):
  answer+= k*factorization(k)
  
print(answer)

Fixed submission:
n=int(input())

answer=0
for x in range(1,n+1):
  y=n//x
  answer+=y*(y+1)*x/2
print(int(answer))
Buggy python submission (verdict: Time Limit Exceeded):
N= int(input())
A=list(map(int,input().split()))

count=0
for i in range(N):
    flag=True
    for j in range(N):
        if i!=j and A[i]%A[j]==0:
            flag=False
    if flag==True:
        count+=1
        
print(count)

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

dp=[0]*(max(A)+1)

for a in A:
    for x in range(a,len(dp),a):
        dp[x]+=1

count=0
for a in A:
    if dp[a]==1:
        count+=1

print(count)

Buggy python submission (verdict: Runtime Error):
X,N = map(int, input().split())
if N==0:
    print(X)
else:
    p=list(map(int,input().split()))
    A=[i for i in range(100) if i not in p]

mini=101
minip=101
for i in range(N):
    if abs(p[i]-X) <=mini:
        mini= abs(p[i]-X)
        minip=p[i]
        

minimini=101
answer=101
for a in A:
    if abs(a-minip)<minimini:
        minimini=abs(a-minip)
        answer=a

print(answer)

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

dp=[0]*(max(A)+1)

for a in A:
    for x in range(a,len(dp),a):
        dp[x]+=1

count=0
for a in A:
    if dp[a]==1:
        count+=1

print(count)
Buggy python submission (verdict: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main(){
  long long N;
  cin >>N;
  
  
  vector<long long> A(N);
  for(int i=0; i<N; i++){
    cin >> A[i];
  }
  
  sort(begin(A),end(A));
  
  long long answer=1;
  for(int i=0; i<N; i++){
    answer*=A[i];
  }
  
  if(answer>1000000000000000000){
  	cout<< -1 << endl;
  }else{
    cout << answer << endl;
  }
  
}


Fixed submission:
n=int(input())
A=list(map(int,input().split()))
A.sort()
answer=1

for i in range(n):
  answer*=A[i]
  if(answer>10**18):
    print(-1)
    exit()
    
print(answer)
Buggy python submission (verdict: Runtime Error):
N,K = map(int, input().split())
p=list(map(int,input().split()))


ans=[]
for j in  range(1,N-K+1):
    temp=0
    temp+=(0.5*(sum(p[j:j+K])+K))
    ans.append(temp)
    

print(max(ans))

Fixed submission:
from itertools import accumulate

N,K = map(int, input().split())
p=list(map(int,input().split()))

q=[0]+p
q=list(accumulate(q)) 

ans=[]
for i in range(N-K+1):
    ans.append(((q[i+K]-q[i])+K)*0.5)

print(max(ans))

Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int, input().split())
p=list(map(int,input().split()))

final_ans=0
for i in range(N-K+1):
    ans=0
    for j in  range(i,i+K):
        ans+=(0.5*(p[j]+1))
        if ans>=final_ans:
            final_ans=ans

print(final_ans)

Fixed submission:
from itertools import accumulate

N,K = map(int, input().split())
p=list(map(int,input().split()))

q=[0]+p
q=list(accumulate(q)) 

ans=[]
for i in range(N-K+1):
    ans.append(((q[i+K]-q[i])+K)*0.5)

print(max(ans))

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

final_answer=0
for i in range(N-K+1):
    ans=0
    for j in  range(i,i+K):
        ans+=(0.5*(p[j]+1))
        if ans>=final_ans:
            final_ans=ans

print(final_ans)

Fixed submission:
from itertools import accumulate

N,K = map(int, input().split())
p=list(map(int,input().split()))

q=[0]+p
q=list(accumulate(q)) 

ans=[]
for i in range(N-K+1):
    ans.append(((q[i+K]-q[i])+K)*0.5)

print(max(ans))

Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int, input().split())
p=list(map(int,input().split()))

def estim(n): 
    return float(0.5*(n+1))

final_ans=0
for i in range(N-K+1):
    ans=0
    for j in  range(i,i+K):
        ans+=(estim(p[j]))
        if ans>=final_ans:
            final_ans=ans

print(final_ans)

Fixed submission:
from itertools import accumulate

N,K = map(int, input().split())
p=list(map(int,input().split()))

q=[0]+p
q=list(accumulate(q)) 

ans=[]
for i in range(N-K+1):
    ans.append(((q[i+K]-q[i])+K)*0.5)

print(max(ans))

Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int, input().split())
p=list(map(int,input().split()))

def estim(n):
    total=0
    for i in range(1,n+1):
        total+=i
    return float(total/n)

final_ans=[]
for i in range(N-K+1):
    ans=0
    for j in  range(i,i+K):
        ans+=(estim(p[j]))
    final_ans.append(ans)

print(max(final_ans))

Fixed submission:
from itertools import accumulate

N,K = map(int, input().split())
p=list(map(int,input().split()))

q=[0]+p
q=list(accumulate(q)) 

ans=[]
for i in range(N-K+1):
    ans.append(((q[i+K]-q[i])+K)*0.5)

print(max(ans))
Buggy python submission (verdict: Runtime Error):
H=int(input())
A=int(input())
 
ans=int(H//A)+1
print(ans)

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

count=0
while H >0:
    H -=A
    count+=1
    
print(count)

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

ans=int(H/A)+1
print(ans) 

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

count=0
while H >0:
    H -=A
    count+=1
    
print(count)
Buggy python submission (verdict: Runtime Error):
n=int(input())
A=list(map(int,input().split()))

count=[0 for _ in range(max(A)+1)]
for i in range(n):
  count[A[i]]+=1

  
answer=0
for i in range(0,n-3):
  tmp=int(count[i])+int(count[i+1])+int(count[i+2])
  if tmp>answer:
    answer=tmp
    
print(answer)

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

count=[0 for _ in range(max(A)+1)]
for i in range(n):
  count[A[i]]+=1
  
answer=0
if n>3:
  for i in range(0,n-2):
    tmp=sum(count[i:i+3])
    if tmp>answer:
      answer=tmp
elif n==2:
  if len(count)>3:
    answer=1
  else:
    answer=2
elif n==1:
  answer=1

print(answer)
Buggy python submission (verdict: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
  
int main() {
  string S;
  cin >> S;
  
  int bucket[26]={0};//バケット
  
  for(int i=0;i<S.length();i++){
    int tmp= S.at(i)-'a';
    bucket[tmp]++;
  }
  
  int ans=-1;//答えを格納
  for(int i=0; i<26; i++){
    if (bucket[i]==0){
      ans=i;
      break;
    }
  }
  
  if(ans==-1){
    cout << "None" << endl;
  }else{
    printf("%c\n",ans+97);
  }
  
  return 0;
      
}

Fixed submission:
S=str(input())

import string
alphabet="".join([i for i in string.ascii_lowercase if i not in S])

if(alphabet):
  print(alphabet[0])
else:
  print("None")

Buggy python submission (verdict: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
  
int main() {
  string S;
  cin >> S;
  
  int bucket[26]={0};//バケット
  
  for(int i=0;i<S.length();i++){
    int tmp= S.at(i)-'a';
    bucket[tmp]++;
  }
  
  int ans=-1;//答えを格納
  for(int i=0; i<26; i++){
    if (bucket[i]==0){
      ans=i;
      break;
    }
  }
  
  if(ans==-1){
    cout << "None" << endl;
  }else{
    printf("%c\n",ans+97);
  }
      
}

Fixed submission:
S=str(input())

import string
alphabet="".join([i for i in string.ascii_lowercase if i not in S])

if(alphabet):
  print(alphabet[0])
else:
  print("None")
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
s=0
b=True
for i in a:
  s+=a
  
for i in range(0,m):
  if a[i]>=s/4/m:
    b=True
  else:
    b=False
    
if b:
  print('Yes')
else:
  print('No')

Fixed submission:
n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort(reverse=True)
s=0
b=True
for i in a:
  s+=i

  
for i in range(0,m):
  if a[i]>=s/4/m:
    b=True
  else:
    b=False
    
if b:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=list(map(int,input().split()))

count=0
sum=0

for i in a:
  sum+=i
  
for i in a:
  if a>=(sum/4*m):
    count+=1

if count>=m:
  print('Yes')
else:
  print('No')

Fixed submission:
n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort(reverse=True)
s=0
b=True
for i in a:
  s+=i

  
for i in range(0,m):
  if a[i]>=s/4/m:
    b=True
  else:
    b=False
    
if b:
  print('Yes')
else:
  print('No')

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

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

sum=0
count=0
for i in a:
  sum+=a
  
for i in a:
  if a>=(sum/4*m):
    count+=1
    
if(count>=m):
  print('Yes')
else:
  print('No')

Fixed submission:
n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort(reverse=True)
s=0
b=True
for i in a:
  s+=i

  
for i in range(0,m):
  if a[i]>=s/4/m:
    b=True
  else:
    b=False
    
if b:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
k,n=map(int,input().split())
a=map(int,input().split())
max = -1
for i in range(0,n-1):
  if max>abs(a[i]-a[i+1]):
    max=abs(a[i]-a[i+1])
if max>(k-a[n-1])+a[0]:
  max=(k-a[n-1])+a[0]
  
print(k-max)

Fixed submission:
k,n=map(int,input().split())
a=list(map(int,input().split()))
max = -1
for i in range(0,n-1):
  d=abs(a[i+1]-a[i])
  if max<d:
    max=d
if max<k-a[n-1]+a[0]:
  max=k-a[n-1]+a[0]
  
print(k-max)
Buggy python submission (verdict: Runtime Error):
a = list(input().split())

if a[1]=='+':
  print(int(a[0])+int(a[2]))
else if a[1]=='-':
  print(int(a[0])-int(a[2]))



Fixed submission:
a = input().split()

if a[1]=='+':
  print(int(a[0])+int(a[2]))
elif a[1]=='-':
  print(int(a[0])-int(a[2]))
Buggy python submission (verdict: Runtime Error):
a=[]
for i in range(3):
  a.append(int(input()))
  
set(a)

print(len(a))

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

print(len(a))
Buggy python submission (verdict: Runtime Error):
a=input(int())
b=a % 1000
if b>>0:
  print(1000-b)
else:
  print(0)

Fixed submission:
a=int(input())
b=a % 1000
if b>>0:
  print(1000-b)
else:
  print(0)
Buggy python submission (verdict: Runtime Error):
a=input()
print(a+a**2+a**3)

Fixed submission:
a=int(input())
print(a+a ** 2+a ** 3)
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
print(c-(a-b)

Fixed submission:
a,b,c=map(int,input().split())
if c-(a-b)<0:
    print(0)
else:
    print(c-(a-b))

Buggy python submission (verdict: Runtime Error):
 a,b,c=map(int,input().split())
print(c-(a-b)

Fixed submission:
a,b,c=map(int,input().split())
if c-(a-b)<0:
    print(0)
else:
    print(c-(a-b))
Buggy python submission (verdict: Runtime Error):
C:\pycharm\code_atcoder\venv\Scripts\python.exe C:/pycharm/code_atcoder/173B.py
6
AC
TLE
AC
AC
WA
TLE
AC x 3
WA x 1
TLE x 2
RE x 0

プロセスは終了コード 0 で完了しました


Fixed submission:
N = int(input())
ac = 0
wa = 0
tle = 0
re = 0

for i in range(N):
    S = str(input())
    if S == 'AC':
        ac += 1
    elif S == 'WA':
        wa += 1
    elif S == 'TLE':
        tle += 1
    elif S == 'RE':
        re += 1
print('AC x '+str(ac))
print('WA x '+str(wa))
print('TLE x '+str(tle))
print('RE x '+str(re))

Buggy python submission (verdict: Runtime Error):
N = int(input())
ac = 0
wa = 0
tle = 0
re = 0

for i in range(N):
    S = str(input())
    if S == 'AC':
        ac += 1
    elif S == 'WA':
        wa += 1
    elif S == 'TLE':
        tle += 1
    elif S == 'RE':
        re += 1
print('AC x '+ac)
print('WA x '+wa)
print('TLE x '+tle)
print('RE x '+re)

Fixed submission:
N = int(input())
ac = 0
wa = 0
tle = 0
re = 0

for i in range(N):
    S = str(input())
    if S == 'AC':
        ac += 1
    elif S == 'WA':
        wa += 1
    elif S == 'TLE':
        tle += 1
    elif S == 'RE':
        re += 1
print('AC x '+str(ac))
print('WA x '+str(wa))
print('TLE x '+str(tle))
print('RE x '+str(re))
Buggy python submission (verdict: Runtime Error):
a = str(input())

if a.islower()==True:
    print(a)
else:
    print(A)

Fixed submission:
a = str(input())

if a.islower()==True:
    print('a')
else:
    print('A')
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))

if 0 in A:
    print(0)
else:
    x = 1
    for i in range(N):
        x = x * A[i]
        if x>10**18:
            x = -1
    print(x)

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

print(a*b)

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

if 0 in A:
    print(0)

x = 1
for i in range(N):
    x = x * A[i]
    if x>10**18:
        x = -1
print(x)

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

print(a*b)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))

if 0 in A:
    print(0)
else:
    x = 1
    for i in range(N):
        x = x * A[i]
        if x>10**18:
            x = -1
    print(x)

Fixed submission:
import sys

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

if 0 in A:
    print(0)
else:
    x = 1
    for i in range(N):
        x = x * A[i]
        if x>10**18:
            print(-1)
            sys.exit()
        
    print(x)

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

x = 1
for i in range(N):
    x = x * A[i]
    if x>10**18:
        x = -1
print(x)

Fixed submission:
import sys

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

if 0 in A:
    print(0)
else:
    x = 1
    for i in range(N):
        x = x * A[i]
        if x>10**18:
            print(-1)
            sys.exit()
        
    print(x)
Buggy python submission (verdict: Runtime Error):
if len(S) > K:
    print(S[:K]+"...")
else:
    print(S)

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

if len(S) > K:
    print(S[:K]+"...")
else:
    print(S)
Buggy python submission (verdict: Runtime Error):
N,K = map(int,input().split())

s = [t for t in range(1,N+1)]
for i in range(K):
    d = int(input())
    A = list(map(input().split()))
    if A[i] in s:
        s.remove(A[i])
    K -= 1
print(lne(s))

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

s = [t for t in range(1,N+1)]
for i in range(K):
    d = int(input())
    A = list(map(int,input().split()))
    for i in range(len(A)):
        if A[i] in s:
            s.remove(A[i])
print(len(s))
Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
A = list(map(int,input().split()))

s = sum(A)
A.sort(reverse=True)

for i in range(1,N+1):
    if i == M:
        if (s/(4*M))>A[i]:
            print('No')
        else:
            print('Yes')

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

s = sum(A)
A = sorted(A,reverse=True)

for i in range(N):
    if i == M-1:
        if (s/(4*M))>A[i]:
            print('No')
        else:
            print('Yes')
Buggy python submission (verdict: Time Limit Exceeded):
N, b, r = map(int, input().split())

s = 0
t = 0
for i in range(10**100):
    t = t+b+r
    s += 1
    if N<=t:
        if (t-N)<r:
            print(s*b)
            exit()
        else:
            print((s-1)*b+N-t+b+r)
            exit()

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

t = N//(b+r)
s = N%(b+r)

if s>=b:
    print((t+1)*b)
else:
    print(t*b + s)