Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
from collections import Counter
import numpy as np
n,k,q=map(int,input().split())
a=[]
for i in range(q):
  a_=int(input())
  a.append(a_)


listn_=[]
for i in range(n):
  listn_.append(k)
listn=np.array(listn_)

s=Counter(a)
for i in s.keys():
  lists_=[-1*s[i]]*n
  lists_[i-1]=0
  lists=np.array(lists_)
  listn=listn+lists

#print(listn)
for i in listn:
  if i>0:
    print('Yes')
    
  else:
    print('No')

Fixed submission:
from collections import Counter
import numpy as np
n,k,q=map(int,input().split())
a=[]
for i in range(q):
  a_=int(input())
  a.append(a_)
 
 
listn_=[]
for i in range(n):
  listn_.append(k)
listn=np.array(listn_)
listn=listn-q
s=Counter(a)
for i in s.keys():
  listn[i-1]+=s[i]
 
#print(listn)
for i in listn:
  if i>0:
    print('Yes')
    
  else:
    print('No')

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
import numpy as np
n,k,q=map(int,input().split())
a=[]
for i in range(q):
  a_=int(input())
  a.append(a_)


listn_=[]
for i in range(n):
  listn_.append(k)
listn=np.array(listn_)

s=Counter(a)
for i in s.keys():
  lists_=[-1*s[i]]*n
  lists_[i-1]=0
  lists=np.array(lists_)
  listn=listn+lists

#print(listn)
for i in listn:
  if i>0:
    print('Yes')
    
  else:
    print('No')
  


  

Fixed submission:
from collections import Counter
import numpy as np
n,k,q=map(int,input().split())
a=[]
for i in range(q):
  a_=int(input())
  a.append(a_)
 
 
listn_=[]
for i in range(n):
  listn_.append(k)
listn=np.array(listn_)
listn=listn-q
s=Counter(a)
for i in s.keys():
  listn[i-1]+=s[i]
 
#print(listn)
for i in listn:
  if i>0:
    print('Yes')
    
  else:
    print('No')
Buggy python submission (verdict: Runtime Error):
N=int(input())
B=list(map(int,input().split()))

A=[0,]
for i in range(N+1):
  a=min(B[i],B[i-1])
  A.append(a)
  
print(sum(A))

Fixed submission:
N=int(input())
B=list(map(int,input().split()))
A=[]
B.insert(0,1000000)
B.append(1000000)
for i in range(1,N+1):
  a=min(B[i],B[i-1])
  A.append(a)
print(sum(A))
Buggy python submission (verdict: Runtime Error):
s=input()
t=input()
cnt=0
for i in rage(len(s)):
  if s[i]==t[i]:
    cnt+=1

print(cnt)

Fixed submission:
s=input()
t=input()
cnt=0
for i in range(len(s)):
  if s[i]==t[i]:
    cnt+=1
 
print(cnt)
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
print(max(0,c-(a-b))

Fixed submission:
a,b,c=map(int,input().split())
print(max(0,c-(a-b)))
Buggy python submission (verdict: Runtime Error):
import math
n.d=map(int,input().split())
x=d*2+1
print(math.ceil(n/x))

Fixed submission:
import math
n,d=map(int,input().split())
x=d*2+1
print(math.ceil(n/x))
Buggy python submission (verdict: Runtime Error):
L.R=map(int,input().split())
ans=float('inf')
for i in range(L,R+1):
  for j in range(L,R+1):
    s=(i*j)%2019
    if s==0:
      print(0)
      exit()
    else:
      ans=min(s,ans)
      
print(ans)
    

Fixed submission:
L,R=map(int,input().split())
ans=float('inf')
for i in range(L,R):
  for j in range(L+1,R+1):
    s=(i*j)%2019
    
    if s==0:
      print(0)
      exit()
    else:
      ans=min(s,ans)
      
print(ans)
Buggy python submission (verdict: Runtime Error):
s=input()
t=set(s)
if len(t)==2:
  cnt1=0
  cnt2=0
  for i in s:
    if i==t[0]:
      cnt1+=1
      
    elif i==t[1]:
      cnt2+=1
      
  if cnt1==2 and cnt2==2:
    print('Yes')
    exit()
    
print('No')
    
  

Fixed submission:
s=input()
t=list(set(s))
if len(t)==2:
  cnt1=0
  cnt2=0
  for i in s:
    if i==t[0]:
      cnt1+=1
      
    elif i==t[1]:
      cnt2+=1
      
  if cnt1==2 and cnt2==2:
    print('Yes')
    exit()
    
print('No')
Buggy python submission (verdict: Runtime Error):
s=input()
for i in range(len(s)):
  if s[i]==s[i+1]:
    print('Bad')
    exit()
    
print('Good')

Fixed submission:
s=input()
for i in range(len(s)-1):
  if s[i]==s[i+1]:
    print('Bad')
    exit()
    
print('Good')
Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
a=[]
for i in range(m):
  a_=int(input())
  a.append(a_)
  
dp=[0]*(n+1)
dp[0]=1
if 1 in a:
  dp[1]=0
else:
  dp[1]=1

for i in range(2,n+1):
  if i in a:
    dp[i]=0
    continue
  dp[i]=dp[i-1]+dp[i-2]
#print(dp)
print(dp[n]%(1000000007))

Fixed submission:
n,m=map(int,input().split())
a=[]
for i in range(m):
  a_=int(input())
  a.append(a_)
  
dp=[-1]*(n+1)
dp[0]=1
dp[1]=1
for i in a:
  dp[i]=0

for i in range(2,n+1):
  if dp[i]==-1:
    dp[i]=dp[i-1]+dp[i-2]
#print(dp)
print(dp[n]%(1000000007))

Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
a=[]
for i in range(m):
  a_=int(input())
  a.append(a_)
  
dp=[0]*(n+1)
dp[0]=1
if 1 in a:
  dp[1]=0
else:
  dp[1]=1

for i in range(2,n+1):
  if i in a:
    dp[i]=0
    continue
  dp[i]=dp[i-1]+dp[i-2]
#print(dp)
print(dp[n]%(1000000007))

Fixed submission:
n,m=map(int,input().split())
a=[]
for i in range(m):
  a_=int(input())
  a.append(a_)
  
dp=[-1]*(n+1)
dp[0]=1
dp[1]=1
for i in a:
  dp[i]=0

for i in range(2,n+1):
  if dp[i]==-1:
    dp[i]=dp[i-1]+dp[i-2]
#print(dp)
print(dp[n]%(1000000007))

Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
a=[]
for i in range(m):
  a_=int(input())
  a.append(a_)
  
dp=[0]*(n+1)
dp[0]=1
if 1 in a:
  dp[1]=0
else:
  dp[1]=1

for i in range(2,n+1):
  if i in a:
    dp[i]=0
    continue
  dp[i]=dp[i-1]+dp[i-2]
#print(dp)
print(dp[n]%(1000000007))
  

  

Fixed submission:
n,m=map(int,input().split())
a=[]
for i in range(m):
  a_=int(input())
  a.append(a_)
  
dp=[-1]*(n+1)
dp[0]=1
dp[1]=1
for i in a:
  dp[i]=0

for i in range(2,n+1):
  if dp[i]==-1:
    dp[i]=dp[i-1]+dp[i-2]
#print(dp)
print(dp[n]%(1000000007))
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
s=input()
s[k-1]=s[k-1].lower()

print(s)

Fixed submission:
n,k=map(int,input().split())
s=input()
print(s[:k-1]+str.lower(s[k-1])+s[k:])
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
for i in range(21):
  if k<=2**i:
    t=i
    break
   
#print(t)
if n>=k:
  ans=1/n*((1/2**t)*(2**(k-1)-1)+n-k+1)
else:
  ans=1/n*(1/2**t)*(2**(n)-1)
print('{:.13f}'.format(ans))
    

Fixed submission:
n,k = map(int, input().split())
 
ans = 0
for i in range(1,n+1):
  t = 0
  while i < k:
    i *= 2
    t += 1
  ans += 0.5**t
print(ans/n)
Buggy python submission (verdict: Runtime Error):
a=[]
for i in range(5):
  s=int(input())
  a.apppend(s)
k=int(input())
if (a[4]-a[0])<=k:
  print('Yay!')
  
else:
  print(':(')

Fixed submission:
a=[]
for i in range(5):
  s=int(input())
  a.append(s)
k=int(input())
if (a[4]-a[0])<=k:
  print('Yay!')
  
else:
  print(':(')

Buggy python submission (verdict: Runtime Error):
a=[]
for i in range(5):
  s=int(input())
  
k=int(input())
if a[-1]-a[0]<=k:
  print('Yay!')
  
else:
  print(':(')

Fixed submission:
a=[]
for i in range(5):
  s=int(input())
  a.append(s)
k=int(input())
if (a[4]-a[0])<=k:
  print('Yay!')
  
else:
  print(':(')
Buggy python submission (verdict: Runtime Error):
ss=['A','G','C','T']
s=list(input())
ans=0
for i in range(len(s)-1):
  if s[i] in ss:
    j=i
    cnt=0
    while s[j] in ss:
      j+=1
      cnt+=1
      
    ans=max(ans,cnt)
      
print(ans)

Fixed submission:
ss=['A','G','C','T']
s=list(input())
ans=0
for i in range(len(s)):
  if s[i] in ss:
    j=i
    cnt=0
    while j<len(s):
      if s[j] in ss:
        cnt+=1
        j+=1
      else:
        break
      
    ans=max(ans,cnt)
      
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n=int(input())
a_=list(map(int,input().split()))
a=np.array(a_)
#print(a)
s=min(a)
for i in range(s,0,-1):
  if np.all(a%i==0):
    print(i)
    exit()

Fixed submission:

n=int(input())
a_=list(map(int,input().split()))

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a
  
m=a_[0]
for i in range(n):
  m=gcd(m,a_[i])
  
print(m)
Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
h=list(map(int,input().split()))
dp=[float('inf')]*n
dp[0]=0
dp[1]=abs(h[1]-h[0])
for i in range(2,n):
  for j in range(k+1):
    dp[i]=min(dp[i],dp[i-j]+abs(h[i]-h[i-j]))
  
  
#print(dp)
print(dp[n-1])

Fixed submission:
n,k=map(int,input().split())
h=list(map(int,input().split()))
dp=[float('inf')]*n
dp[0]=0
dp[1]=abs(h[1]-h[0])
for i in range(2,n):
  for j in range(k+1):
    dp[i]=min(dp[i],dp[i-j]+abs(h[i]-h[i-j]))
  
  
#print(dp)
print(dp[n-1])
Buggy python submission (verdict: Time Limit Exceeded):
N,W=map(int,input().split())
w=[]
v=[]
for i in range(N):
  w_,v_=map(int,input().split())
  w.append(w_)
  v.append(v_)
  
dp=[[0]*(W+1) for i in range(N+1)]
for i in range(N):
  for j in range(W+1):
    dp[i+1][j]=max(dp[i+1][j],dp[i][j])
    if j+w[i] <=W:
      dp[i+1][j+w[i]]=max(dp[i+1][j+w[i]],dp[i][j]+v[i])

print(dp[N][W])
#print(dp)

Fixed submission:
N,W=map(int,input().split())
w=[]
v=[]
for i in range(N):
  w_,v_=map(int,input().split())
  w.append(w_)
  v.append(v_)
  
dp=[[0]*(W+1) for i in range(N+1)]
for i in range(N):
  for j in range(W+1):
    dp[i+1][j]=max(dp[i+1][j],dp[i][j])
    if j+w[i] <=W:
      dp[i+1][j+w[i]]=max(dp[i+1][j+w[i]],dp[i][j]+v[i])

print(dp[N][W])
#print(dp)
Buggy python submission (verdict: Time Limit Exceeded):
N,W=map(int,input().split())
w=[]
v=[]
for i in range(N):
  w_,v_=map(int,input().split())
  w.append(w_)
  v.append(v_)
M=sum(v)
dp=[[float('inf')]*(M+1) for i in range(N+1)]
dp[0][0]=0

for i in range(N):
  for j in range(M+1):
    if j>=v[i]:
      dp[i+1][j]=min(dp[i][j],dp[i][j-v[i]]+w[i])
    else:
      dp[i+1][j]=dp[i][j]
ans=0
for i in range(M+1):
  if dp[N][i]<=W:
    ans=max(ans,i)
    
print(ans)
    

Fixed submission:
N,W=map(int,input().split())
w=[]
v=[]
for i in range(N):
  w_,v_=map(int,input().split())
  w.append(w_)
  v.append(v_)
M=sum(v)
dp=[[float('inf')]*(M+1) for i in range(N+1)]
dp[0][0]=0

for i in range(N):
  for j in range(M+1):
    if j>=v[i]:
      dp[i+1][j]=min(dp[i][j],dp[i][j-v[i]]+w[i])
    else:
      dp[i+1][j]=dp[i][j]
ans=0
for i in range(M+1):
  if dp[N][i]<=W:
    ans=max(ans,i)
    
print(ans)
Buggy python submission (verdict: Runtime Error):
x=list(map(int,input().split()))
y=list(map(int,input().split()))
 
x.sort(reverse=True)
y.sort()
 
 
flag=0
for i in range(X+1,Y+1):
  if x[0]<=i and y[0]>i:
    flag=1
    break
  
 
  else:
    flag=0
    
if flag==1:
  print('No War')
  
else:
  print('War')

Fixed submission:
n,m,X,Y=map(int,input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
 
x.sort(reverse=True)
y.sort()
 
 
flag=0
for i in range(X+1,Y+1):
  if x[0]<i and y[0]>=i:
    flag=1
    break
  
 
  else:
    flag=0
    
if flag==1:
  print('No War')
  
else:
  print('War')

Buggy python submission (verdict: Runtime Error):
n,m,X,Y=map(int,input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
 
x.sort(reverse=True)
y.sort()


flag=0
for i in range(X+1,Y+1):
  if x[0]<=i and y[0]>i:
    flag=1
    break
  

  else:
    flag=0
    
if flag=1:
  print('No War')
  
else:
  print('War')


Fixed submission:
n,m,X,Y=map(int,input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
 
x.sort(reverse=True)
y.sort()
 
 
flag=0
for i in range(X+1,Y+1):
  if x[0]<i and y[0]>=i:
    flag=1
    break
  
 
  else:
    flag=0
    
if flag==1:
  print('No War')
  
else:
  print('War')
Buggy python submission (verdict: Runtime Error):
import sys 
sys.setrecursionlimit(10**6)

def dfs(i,sum,count,nokori):
  global ans
  if i==g:
    if sum<g:
      use=max(nokori)
      n=min(pc[n-1][1],-(-(g-sum)//100*use)
      count+=n
      sum+=n*100*use

    if sum>=g:
      ans=min(ans,count)

  else:
    dfs(i+1,sum,count,nokori)
    dfs(i+1,sum+pc[i][0]*100*(i+1)+pc[i][1],count+pc[i][0],nokori-(i+1))

d,g=map(int,input().split())
pc=[list(map(int,input().split())) for i in range(d)]
ans=float('inf')

dfs(0,0,0,set(range(1,d+1))

print(ans)  

Fixed submission:
import sys
sys.setrecursionlimit(10**8)
def dfs(i, sum, count, nokori):
    global ans
    if i == d:
        # G 点に満たなければ nokori のうち一番大きいものを解く
        if sum < g:
            use = max(nokori)
            # 解く問題が問題数を超えないように注意
            n = min(pc[use - 1][0], -(-(g - sum) // (use * 100)))
            count += n
            sum += n * use * 100

        if sum >= g:
            ans = min(ans, count)
    else:
        # 総合スコア、解いた問題数、まだ解いてない問題を更新
        dfs(i + 1, sum, count, nokori)
        dfs(i + 1, sum + pc[i][0] * (i + 1) * 100 + pc[i][1], count + pc[i][0], nokori - {i + 1})


d, g = map(int, input().split())
pc = [list(map(int, input().split())) for i in range(d)]

ans = float("inf")

dfs(0, 0, 0, set(range(1, d + 1)))
print(ans)
Buggy python submission (verdict: Runtime Error):
from collections import deque

h,w=map(int,input().split())
l=[list(input()) for i in range(h)]
visited=[[0]*w for i in range(h)]
def bfs():
  que =deque()
  visited[0][0]=0
  que.append([0,0])
  while que:
    p=que.popleft()
    if p[1]==w-1 and p[0]==h-1:
      break
    for dx,dy in ([0,1],[0,-1],[1,0],[-1,0]):
      ny=p[1]+dy
      nx=p[0]+dx
      if nx>=0 and ny>=0 and nx<w and ny<h and visited[nx][ny]==0 and l[nx][ny]!='#':
        visited[nx][ny]=visited[p[0]][p[1]]+1
        que.append([nx,ny])

  return visited[h-1][w-1]


suml=0
for i in range(h):
  suml+=l[i].count('#')
print(h*w-suml-bfs()-1)

Fixed submission:
from collections import deque

h,w=map(int,input().split())
l=[list(input()) for i in range(h)]
visited=[[float('inf')]*w for i in range(h)]
def bfs():
  que =deque()
  visited[0][0]=0
  que.append([0,0])
  while que:
    p=que.popleft()
    if p[1]==w-1 and p[0]==h-1:
      break
    for dx,dy in ([0,1],[0,-1],[1,0],[-1,0]):
      ny=p[1]+dy
      nx=p[0]+dx
      if nx>=0 and ny>=0 and nx<h and ny<w and visited[nx][ny]==float('inf') and l[nx][ny]!='#':
        visited[nx][ny]=visited[p[0]][p[1]]+1
        que.append([nx,ny])

  return visited[h-1][w-1]


suml=0
for i in range(h):
  suml+=l[i].count('#')
  
if bfs()==float('inf'):
  print(-1)
else:
  print(h*w-suml-bfs()-1)
Buggy python submission (verdict: Runtime Error):
k,s=map(int,input().split())
cnt=0
for x in range(k+1):
  for y in range(k+1):
    z=s-x-y
    ifz>=0 andz<=2500:
      cnt+=1
        
print(cnt)

Fixed submission:
k,s=map(int,input().split())
cnt=0
for x in range(k+1):
  for y in range(k+1):
    z=s-x-y
    if z>=0 and z<=k:
      cnt+=1
        
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
k,s=map(int,input().split())
cnt=0
for x in range(k+1):
  for y in range(k+1):
    for z in range(k+1):
      if x+y+z==s:
        cnt+=1
        
print(cnt)

Fixed submission:
k,s=map(int,input().split())
cnt=0
for x in range(k+1):
  for y in range(k+1):
    z=s-x-y
    if z>=0 and z<=k:
      cnt+=1
        
print(cnt)
Buggy python submission (verdict: Runtime Error):
N = int(input())

Xmax = -2*10**9
Ymax = -2*10**9
Xmin = 2*10**9
Ymin = 2*10**9


for i in range(N):
    x, y = map(int, input().split())
    if (x + y >= Xmax):
        Xmax = x + y
    if (x + y =< Xmin):
        Xmin = x + y
    if (x - y >= Ymax):
        Ymax = x - y
    if (x - y =< Ymin):
        Ymin = x - y

print(max(Xmax - Xmin, Ymax - Ymin))

Fixed submission:
N = int(input())

Xmax = -2*10**9
Ymax = -2*10**9
Xmin = 2*10**9
Ymin = 2*10**9


for i in range(N):
    x, y = map(int, input().split())
    if (x + y >= Xmax):
        Xmax = x + y
    if (x + y <= Xmin):
        Xmin = x + y
    if (x - y >= Ymax):
        Ymax = x - y
    if (x - y <= Ymin):
        Ymin = x - y

print(max(Xmax - Xmin, Ymax - Ymin))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

sum = 0
for i in range(N):
    for j in range(i+1, N):
        sum = sum + A[i]*A[j]
        if (sum > 10**9 + 7):
            sum = sum % (10**9 + 7)

print(sum)

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

MOD = 10**9 + 7
sum_A = 0
for i in range(N):
    sum_A = (sum_A + A[i]) % MOD

sum = 0
for i in range(N):
    sum_A = (sum_A - A[i]) % MOD
    sum = (sum + sum_A*A[i]) % MOD 


print(sum)

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

sum = 0
for i in range(N):
    for j in range(i+1, N):
        sum = sum + A[i]*A[j]
        if (sum > 10**9 + 7):
            sum = sum % (10**9 + 7)

print(sum)

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

MOD = 10**9 + 7
sum_A = 0
for i in range(N):
    sum_A = (sum_A + A[i]) % MOD

sum = 0
for i in range(N):
    sum_A = (sum_A - A[i]) % MOD
    sum = (sum + sum_A*A[i]) % MOD 


print(sum)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = [input() for i in range(n)]
AC = 0
WA = 0
TLE = 0
RE = 0
for t in s:
    if (t == 'AC'):
        AC += 1
    elif (t == 'WA'):
        WA += 1
    elif (t == 'TLE'):
        TLE += 1
    else:
        RE += 1

print('AC x ', AC)
print('WA x ', WA)
print('TLE x ', TLE)
print('RE x ', RE)

Fixed submission:
n = int(input())
i = 0
m = n
while (m > 0):
    m = m - 1000
    i = i + 1

print(i*1000 - n)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(x) for x in input().split()]
ans = 0

for i in range(n-1):
  for j in range(i+1,n):
    ans += a[i]*a[j]
print(ans%(10**9+7))

Fixed submission:
n = int(input())
a = [int(x) for x in input().split()]
sum = 0
ans = 0

for e in a:
  sum += e
  
for e in a:
  sum -= e
  ans += e*sum

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

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(x) for x in input().split()]
ans = 0

for i in range(n-1):
  for j in range(i+1,n):
    ans += a[i]*a[j]
print(ans%(10**9+7))

Fixed submission:
n = int(input())
a = [int(x) for x in input().split()]
sum = 0
ans = 0

for e in a:
  sum += e
  
for e in a:
  sum -= e
  ans += e*sum

print(ans%(10**9+7))
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
p = [int(x)-1 for x in input().split()]
c = [int(x) for x in input().split()]
each_point = []

for i in range(n):
  now = i
  check = []
  max_point = c[p[now]]
  point = 0
  for j in range(k):
    if now in check:
      l = len(check)
      lastpoint = point * int(k/l)
      for e in range(k%l):
        now = p[now]
        lastpoint += c[now]
      each_point.append(lastpoint)
      for e in range(l):
        lastpoint -= c[now]
        now = p.index(now)
      break
    check.append(now)    
    now = p[now]
    point += c[now]
    if max_point < point:
      max_point = point
  
  each_point.append(max_point)
  
print(max(each_point))

Fixed submission:
s = input()
R_list = s.split('S')

ans = 0

for s in R_list:
  if ans < len(s):
    ans = len(s)
    
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(x) for x in input().split()]
 
p = 1
 
for e in a:
  if a == 0:
    print(0)
    exit()
  
  p *= e
  
if p > 10**18:
  print(-1)
else:
  print(p)

Fixed submission:
N = int(input())
A = list(map(int,input(). split ()))
max = 10**18
if 0 in A:
  print(0)
  exit()
  
prod = 1
for a in A:
  prod *= a
  if prod > max:
    print(-1)
    exit()
print(prod)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(x) for x in input().split()]

p = 1

for e in a:
  p *= e

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

Fixed submission:
N = int(input())
A = list(map(int,input(). split ()))
max = 10**18
if 0 in A:
  print(0)
  exit()
  
prod = 1
for a in A:
  prod *= a
  if prod > max:
    print(-1)
    exit()
print(prod)
Buggy python submission (verdict: Runtime Error):
n,k = (int(x) for x in input().split())
a = [int(x) for x in input().split()]
 
l = [1]
now = 1
next = a[0]
notloop = 0
dupl = -1
 
for i in range(n):
  now = next
  next = a[now-1]
  
  if now in l:
    dupl = now
    break
  else:
    l.append(now)
    
if(dupl == -1):
  print(now)
  
else:
  notloop = l.index(dupl)
  length = len(l)-notloop
  print(l[(k-notloop)%length+notloop])

Fixed submission:
s = input()
t = input()

if(len(s)+1 == len(t)) and (s == t[0:len(t)-1]):
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
def check(pair,m,x):
  sum = 0
  
  for i in range(1,m):
    p = 0
    for e in pair:
      p += e[i]
    
    if(p < x):
      return -1
    
  for e in pair:
    sum += e[0]
  return sum
      
n,m,x = (int(x) for x in input().split())
a = []
for i in range(n):
  a.append(tuple([int(x) for x in input().split()]))
  
list = [] 
  
for i in range(2 ** n):
  pair = []
  for j in range(n):
    if((i >> j) & 1):
      pair.append(a[j])
      
  sum = check(pair,m,x)
  if(sum != -1):
    list.append(sum)
print(min(list))

Fixed submission:
def check(pair,m,x):
  sum = 0
  
  for i in range(1,m+1):
    p= 0
    for e in pair:
      p += e[i]
    if(p < x):
      return -1
    
  for e in pair:
    sum += e[0]
  return sum
      
n,m,x = (int(x) for x in input().split())
a = []
for i in range(n):
  a.append(tuple([int(x) for x in input().split()]))
  
min = -1
  
for i in range(2 ** n):
  pair = []
  for j in range(n):
    if((i >> j) & 1):
      pair.append(a[j])
  sum = check(pair,m,x)
  
  if min == -1:
    min = sum
  elif sum != -1 and min > sum:
    min = sum
    
print(min)
Buggy python submission (verdict: Time Limit Exceeded):
x = int(input())

money = 100
year = 0

while(True):
  year += 1
  money += money*0.01//1
  if money == x:
    print(year)
    break

Fixed submission:
x = int(input())

money = 100
year = 0

while(money<x):
  year += 1
  money += money // 100
  
print(year)

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

money = 100
year = 0

while(True):
  year += 1
  money += int(money*0.01)
  if money == x:
    print(year)
    break
  

Fixed submission:
x = int(input())

money = 100
year = 0

while(money<x):
  year += 1
  money += money // 100
  
print(year)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

l =int(input())
mass = list(map(int,input().split()))
move =np.zeros(l,np.int)
for i in range(l):
   for j in range(l-i-1):
      if mass[i+j]>=mass[i+j+1]:
         move[i]+=1
      else:
         break

print(max(move))

Fixed submission:

l =int(input())
mass = list(map(int,input().split()))

ans = 0
old_ans = 0
for i in range(l-1):

   if mass[i]>=mass[i+1]:
      ans = ans+1
   else:
      ans =0

   if old_ans < ans:
      old_ans = ans


#   print(i,"no", ans,old_ans)


print(old_ans)