Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
a=list(map(int,input().split()))
for i in range(m):
  b,c=map(int,input().split())
  a.extend([c]*min(b,10**5))
a.sort(reverse=True)
print(sum(a[:n]))


Fixed submission:
n,m=map(int,input().split())
a=list(map(int,input().split()))
d=[]
ans=0
for i in range(n):
  d.append([a[i],1])
for i in range(m):
  b,c=map(int,input().split())
  d.append([c,b])
d.sort(reverse=True)
for i in range(n+m):
  if n==0:
    break
  ans+=d[i][0]*min(n,d[i][1])
  n-=min(n,d[i][1])
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
a=list(map(int,input().split()))
for i in range(m):
  b,c=map(int,input().split())
  a.extend([c]*b)
a.sort(reverse=True)
print(sum(a[:n]))


Fixed submission:
n,m=map(int,input().split())
a=list(map(int,input().split()))
d=[]
ans=0
for i in range(n):
  d.append([a[i],1])
for i in range(m):
  b,c=map(int,input().split())
  d.append([c,b])
d.sort(reverse=True)
for i in range(n+m):
  if n==0:
    break
  ans+=d[i][0]*min(n,d[i][1])
  n-=min(n,d[i][1])
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b,c,d,e,k=[int(input()) for i in range(5)]
print(e-a if e-a<=k else ":(")

Fixed submission:
a,b,c,d,e,k=[int(input()) for i in range(6)]
print("Yay!" if e-a<=k else ":(")
Buggy python submission (verdict: Time Limit Exceeded):
n,q=map(int,input().split())
s=input()
dp=[0]*n
for i in range(n-1):
  if s[i]=="A" and s[i+1]=="C":
    dp[i]=1

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


Fixed submission:
n,q=map(int,input().split())
s=input()
dp=[0]*n
count=0
for i in range(n-1):
  if s[i]=="A" and s[i+1]=="C":
    dp[i]=1+count
    count+=1
  else:
    dp[i]=count

#print(dp)
for i in range(q):
  l,r=map(int,input().split())
  print(dp[r-2]-dp[l-2])

Buggy python submission (verdict: Time Limit Exceeded):
n,q=map(int,input().split())
s=input()
for i in range(q):
  l,r=map(int,input().split())
  d=s[l-1:r]
  print(d.count("AC"))
  



Fixed submission:
n,q=map(int,input().split())
s=input()
dp=[0]*n
count=0
for i in range(n-1):
  if s[i]=="A" and s[i+1]=="C":
    dp[i]=1+count
    count+=1
  else:
    dp[i]=count

#print(dp)
for i in range(q):
  l,r=map(int,input().split())
  print(dp[r-2]-dp[l-2])
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().spli())
print(min(c,b//a))

Fixed submission:
a,b,c=map(int,input().split())
print(min(c,b//a))
Buggy python submission (verdict: Runtime Error):
n=int(input())
l=sorted(list(map(int,input().split()))reverse=True)

if l[0]<sum(l[1:]):
  print("Yes")
else:
  print("No")

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

if l[0]<sum(l[1:]):
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
8 2
7 3 1 8 4 6 2 5


Fixed submission:
import math
n,k=map(int,input().split())
a=list(map(int,input().split()))
ans=math.ceil((n-1)/(k-1))
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans=n
for i in range(n+1):
  cnt=0
  t=i
  while t>0:
    cnt+=t%6
    t//=6
  s=n-i
  while s>0:
    cnt+=s%9
    s//9
  min(ans,cnt)
print(ans)

Fixed submission:
n = int(input())
ans=n
for i in range(n+1):
  cnt=0
  t=i
  while t>0:
    cnt+=t%6
    t//=6
  s=n-i
  while s>0:
    cnt+=s%9
    s//=9
  ans = min(ans,cnt)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans=n
for i in range(n+1):
  cnt=0
  t=i
  while t>0:
    t//=6
    cnt+=t%6
  s=n-i
  while s>0:
    s//9
    cnt+=s%9
  min(ans,cnt)
print(ans)

Fixed submission:
n = int(input())
ans=n
for i in range(n+1):
  cnt=0
  t=i
  while t>0:
    cnt+=t%6
    t//=6
  s=n-i
  while s>0:
    cnt+=s%9
    s//=9
  ans = min(ans,cnt)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans=n
for i in range(n+1):
  cnt=0
  t=i
  while t>0:
    t//=6
    cnt+=t%6
  s=n-i
  while s>0:
    s//9
    cnt+=s%9
  min(ans,cnt)
print(ans)

Fixed submission:
n = int(input())
ans=n
for i in range(n+1):
  cnt=0
  t=i
  while t>0:
    cnt+=t%6
    t//=6
  s=n-i
  while s>0:
    cnt+=s%9
    s//=9
  ans = min(ans,cnt)
print(ans)
Buggy python submission (verdict: Runtime Error):
h,w=map(int,input().split())
s=["."*(w+2)]
for i in range(h):
  s.append("."+input()+".")
s.append("."*(w+2))
ans="Yes"
for i in range(1,h+1):
   for j in range(1,h+1):
      if s[i][j]=="#" and s[i-1][j]=="." and s[i][j+1]=="." and s[i+1][j]=="." and s[i][j-1]==".":
        ans="No"
        break
print(ans)

Fixed submission:
h,w=map(int,input().split())
s=["."*(w+2)]
for i in range(h):
  s.append("."+input()+".")
s.append("."*(w+2))
ans="Yes"
for i in range(1,h+1):
   for j in range(1,w+1):
      if s[i][j]=="#" and s[i-1][j]=="." and s[i][j+1]=="." and s[i+1][j]=="." and s[i][j-1]==".":
        ans="No"
        break
print(ans)
Buggy python submission (verdict: Runtime Error):
x,a,b=[int(input() for i in range(3))]
print((x-a)%b)

Fixed submission:
x,a,b=(int(input()) for _ in range(3))
print((x-a)%b)
Buggy python submission (verdict: Runtime Error):
import math
a,b = map(int,input().split())
n = int(len(b))

c = a*n+b
d = int(math.sqrt(c))
if d**2 == c:
  print("Yes")
else:
  print("No")


Fixed submission:
import math
a,b = map(int,input().split())
n = len(str(b))
     
c = a*(10**n)+b
d = int(math.sqrt(c))
if d**2 == c:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
import math
a,b = map(int,input().split())
n = len(b)

c = a*n+b
d = int(math.sqrt(c))
if d**2 == c:
  print("Yes")
else:
  print("No")





Fixed submission:
import math
a,b = map(int,input().split())
n = len(str(b))
     
c = a*(10**n)+b
d = int(math.sqrt(c))
if d**2 == c:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
dp=[1]*(10**5+1)
dp[0],dp[1]=0,0
for i in range(2,10**5+1):
  if dp[i]==0:
    continue
  j=i
  while j+i<=10**5:
    j+=i
    if dp[j]==1:
      dp[j]-=1
ni=[0]*(10**5+1)
for i in range(2,10**5+1):
  if dp[i]==1 and dp[(i+1)//2]==1:
    ni[i]=1

q=int(input())
for i in range(q):
  l,r=map(int,input().split())
  print(sum(ni[l:r+1]))

Fixed submission:
dp=[1]*(10**5+1)
dp[0],dp[1]=0,0
for i in range(2,10**5+1):
  if dp[i]==0:
    continue
  j=i
  while j+i<=10**5:
    j+=i
    if dp[j]==1:
      dp[j]-=1
      
ni=[0]*(10**5+1)
for i in range(2,10**5+1):
  if dp[i]==1 and dp[(i+1)//2]==1:
    ni[i]=1

ru=[0]*(10**5+1)
for i in range(1,10**5+1):
  ru[i]=ru[i-1]+ni[i]

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

Buggy python submission (verdict: Time Limit Exceeded):
import math
q = int(input())
dp = [0]*(100001)
dp[0] = 1
dp[1] = 1
dp[2] = 1
for j in range(2,int(math.sqrt(100000)+1)):
  for k in range(j*2,100001,j):
    dp[k] = 1
    if k*2-1 <= 100000:
      dp[k*2-1] = 1
for i in range(q):
  l,r = map(int,input().split())
  ans = dp[l:r+1].count(0)
  print(ans)

Fixed submission:
dp=[1]*(10**5+1)
dp[0],dp[1]=0,0
for i in range(2,10**5+1):
  if dp[i]==0:
    continue
  j=i
  while j+i<=10**5:
    j+=i
    if dp[j]==1:
      dp[j]-=1
      
ni=[0]*(10**5+1)
for i in range(2,10**5+1):
  if dp[i]==1 and dp[(i+1)//2]==1:
    ni[i]=1

ru=[0]*(10**5+1)
for i in range(1,10**5+1):
  ru[i]=ru[i-1]+ni[i]

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

Buggy python submission (verdict: Time Limit Exceeded):
import math
q = int(input())
for i in range(q):
  l,r = map(int,input().split())
  dp = [0]*(r+1)
  dp[0] = 1
  dp[1] = 1
  dp[2] = 1
  for j in range(2,int(math.sqrt(r)+1)):
    for k in range(j*2,r+1,j):
      dp[k] = 1
      if k*2-1 <= r+1:
        dp[k*2-1] = 1
  ans = dp[l:r+1].count(0)
  print(ans)
  

Fixed submission:
dp=[1]*(10**5+1)
dp[0],dp[1]=0,0
for i in range(2,10**5+1):
  if dp[i]==0:
    continue
  j=i
  while j+i<=10**5:
    j+=i
    if dp[j]==1:
      dp[j]-=1
      
ni=[0]*(10**5+1)
for i in range(2,10**5+1):
  if dp[i]==1 and dp[(i+1)//2]==1:
    ni[i]=1

ru=[0]*(10**5+1)
for i in range(1,10**5+1):
  ru[i]=ru[i-1]+ni[i]

q=int(input())
for i in range(q):
  l,r=map(int,input().split())
  print(ru[r]-ru[l-1])
Buggy python submission (verdict: Runtime Error):
s=list(input())
print(sum(int(s)))

Fixed submission:
s=list(input())
print(s.count("1"))

Buggy python submission (verdict: Runtime Error):
s=list(input())
print(sum(s))

Fixed submission:
s=list(input())
print(s.count("1"))
Buggy python submission (verdict: Runtime Error):
n=input()
a=[]
for i in range(len(n)):
  a.append(int(s[i]))
print("Yes" if int(n)%sum(a)==0 else "No")


Fixed submission:
n=input()
a=[]
for i in range(len(n)):
  a.append(int(n[i]))
print("Yes" if int(n)%sum(a)==0 else "No")

Buggy python submission (verdict: Runtime Error):
n=input()
a=[]
for i in range(len(n)):
  a.append(s[i])
print("Yes" if int(n)%sum(a)==0 else "No")


Fixed submission:
n=input()
a=[]
for i in range(len(n)):
  a.append(int(n[i]))
print("Yes" if int(n)%sum(a)==0 else "No")
Buggy python submission (verdict: Time Limit Exceeded):
n =int(input())

def main(i):
  if i == 0:
    return 2
  elif i == 1:
    return 1
  else:
    return main(i-1)+main(i-2)

print(main(n))

Fixed submission:
n =int(input())
a = [0]*(n+1)
a[0] = 2
a[1] = 1

for i in range(2,n+1):
  a[i] = a[i-1]+a[i-2]

print(a[n])
Buggy python submission (verdict: Runtime Error):
print(int(n**0.5)**2)

Fixed submission:
print(int(int(input())**0.5)**2)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
s=set()
for i in range(N):s^={input()}
print(len(s))

Fixed submission:
N=int(input())
s=set()
for i in range(N):s^={input()}
print(len(s))

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
s=set()
for i in range(n):
  s^={input()}
print(len(s))

Fixed submission:
N=int(input())
s=set()
for i in range(N):s^={input()}
print(len(s))
Buggy python submission (verdict: Runtime Error):
from functools import reduce
from math import gcd
n=int(input())
t=[int(input()) for i in range(n)]
lcm=t[0]*t[1]//gcd(t[0],t[1])
for i in range(2,n):
  lcm=lcm*t[i]//gcd(lcm,t[i])
print(lcm)

Fixed submission:
from fractions import gcd
def lcm(a,b): return a*b//gcd(a,b)
N=int(input())
ans=1
for i in range(N):
    t=int(input())
    ans=lcm(ans,t)
print(ans)

Buggy python submission (verdict: Runtime Error):
from functools import reduce
from math import gcd
n=int(input())
t=[int(input()) for i in range(n)]
x=reduce(gcd,t)
lcm=t[0]*t[1]//x
for i in range(2,n):
  lcm=lcm*t[i]//gcd(lcm,t[i])
print(lcm)

Fixed submission:
from fractions import gcd
def lcm(a,b): return a*b//gcd(a,b)
N=int(input())
ans=1
for i in range(N):
    t=int(input())
    ans=lcm(ans,t)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(input().split())
b=[]

for i in range(n):
  b.append(a[i])
  b.reverse()
print(" ".join(b))

Fixed submission:
from collections import deque
n=int(input())
a=list(input().split())
b=deque()

for i in range(1,n+1):
  if (i%2==1 and n%2==0) or (i%2==0 and n%2==1):
    b.append(a[i-1])
  else:
    b.appendleft(a[i-1])
print(" ".join(b))
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=map(int,input().split()))
print(max(a)-min(a))

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
print(max(a)-min(a))
Buggy python submission (verdict: Time Limit Exceeded):
a,b,c=map(int,input().split())
ab,bc,ca=abs(a-b),abs(b-c),abs(c-a)
ans=0
while ab%2==0 and bc%2==0 and ca%2==0:
  ab//=2
  bc//=2
  ca//=2
  ans+=1
print(ans)


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

if a == b and a == c and a%2 == 0:
  print("-1")
elif a == b and a == c and a%2 == 0:
  print(0)
else:
  while a%2 == 0 and b%2 == 0 and c%2 == 0:
    ans += 1
    aa = b/2 + c/2
    bb = a/2 + c/2
    cc = a/2 + b/2
    a = aa
    b = bb
    c = cc
  print(ans)
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=[input() for i in range(n)]
b=[input() for i in range(m)]
ans="No"
for i in range(n-m+1):
  for j in range(n-m+1):
    if [line[j:j+m] for line in a[i:i+m]]==B:
      ans="Yes"
      break
  if ans=="Yes":
    break
print(ans)

Fixed submission:
n,m=map(int,input().split())
a=[input() for i in range(n)]
b=[input() for i in range(m)]
ans="No"
for i in range(n-m+1):
  for j in range(n-m+1):
    if [line[j:j+m] for line in a[i:i+m]]==b:
      ans="Yes"
      break
  if ans=="Yes":
    break
print(ans)
Buggy python submission (verdict: Runtime Error):
import math
from collections import Counter
n=math.factorial(int(input()))
dp=[]
for i in range(2,int(math.sqrt(n))+2):
  while n%i==0:
    n//=i
    dp.append(i)
c=list(Counter(dp).items())
ans=1
#print(c)
for j in range(len(c)):
  ans*=c[j][1]+1
print(ans%1000000007)

Fixed submission:
import math
from collections import Counter
n=math.factorial(int(input()))
dp=[]
for i in range(2,1001):
  while n%i==0:
    n//=i
    dp.append(i)
c=list(Counter(dp).items())
ans=1
for j in range(len(c)):
  ans*=c[j][1]+1
print(ans%1000000007)
Buggy python submission (verdict: Runtime Error):
k,s=map(int,input().split())
ans=0
for i in range(k+1):
  for j in range(k+1-i):
    if s-i-j<=2500
    ans+=1
print(ans)

Fixed submission:
k,s=map(int,input().split())
ans=0
for i in range(k+1):
  for j in range(k+1):
    if 0<=s-i-j<=k:
      ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
a=input()
if a="a" or a="i" or a="u" or a="e" or a="o":
  print("vowel")
else:
  print("consonant")

Fixed submission:
a=input()
if a=="a" or a=="i" or a=="u" or a=="e" or a=="o":
  print("vowel")
else:
  print("consonant")
Buggy python submission (verdict: Runtime Error):
s = map(input().split())
print(s[1])s = list(map(str,input().split()))
print("A"+s[1][0]+"C")

Fixed submission:
s = list(map(str,input().split()))
print("A"+s[1][0]+"C")
Buggy python submission (verdict: Runtime Error):
n,x=map(int,input().split())
a=list(map(int,input().split()))
dp=[0]*(n-1)
ans=0
for i in range(n-1):
  dp[i]=a[i]+a[i+1]
for j in range(n-2):
  if dp[j]>x:
    ans+=min(dp[j]-x,a[j+1])
    dp[j+1]-=min(dp[j]-x,a[j+1])
    dp[j]-=min(dp[j]-x,a[j+1])
if dp[n-2]>x:
  ans+=dp[n-2]-x
if dp[0]>x:
  ans+=dp[p]-x
print(ans)

Fixed submission:
n,x=map(int,input().split())
a=list(map(int,input().split()))
dp=[0]*(n-1)
ans=0
for i in range(n-1):
  dp[i]=a[i]+a[i+1]
for j in range(n-2):
  if dp[j]>x:
    ans+=min(dp[j]-x,a[j+1])
    dp[j+1]-=min(dp[j]-x,a[j+1])
    dp[j]-=min(dp[j]-x,a[j+1])
if dp[n-2]>x:
  ans+=dp[n-2]-x
  dp[n-2]-=dp[n-2]-x
if dp[0]>x:
  ans+=dp[0]-x
  dp[0]-=dp[0]-x
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
MOD = 10**9 + 7

import copy
ans = 0

for i in range(N-1):
    B = copy.copy(A)
    del B[:i+1]
    B = list(map(lambda x: x % MOD, B))
    B = sum(B) % MOD
    ans += A[i] * B
    ans = ans % MOD
print(ans)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
MOD = 10**9 + 7

import copy
B = copy.copy(A)
C = sum(B)
ans = 0

for i in range(N-1):
    C = (C - B[i]) % MOD
    ans += A[i] * C % MOD
    ans = ans % MOD
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
MOD = 10**9 + 7

import copy
ans = 0

for i in range(N-1):
    B = copy.copy(A)
    del B[:i+1]
    ans += A[i] * sum(B)
    ans = ans % MOD
print(ans)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
MOD = 10**9 + 7

import copy
B = copy.copy(A)
C = sum(B)
ans = 0

for i in range(N-1):
    C = (C - B[i]) % MOD
    ans += A[i] * C % MOD
    ans = ans % MOD
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
MOD = 10**9 + 7

import copy
ans = 0

for i in range(N-1):
    B = copy.copy(A)
    del B[:i+1]
    for j in range(len(B)):
        ans += A[i] * B[j] % MOD
        ans = ans % MOD
print(ans)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
MOD = 10**9 + 7

import copy
B = copy.copy(A)
C = sum(B)
ans = 0

for i in range(N-1):
    C = (C - B[i]) % MOD
    ans += A[i] * C % MOD
    ans = ans % MOD
print(ans)
Buggy python submission (verdict: Runtime Error):
x = str(input())
if x.isupper() == True:
  print(A)
else:
  print(a)

Fixed submission:
x = str(input())
if x.isupper() == True:
  print("A")
else:
  print("a")

Buggy python submission (verdict: Runtime Error):
x = str(input())
if x.isupper():
  print(A)
else:
  print(a)

Fixed submission:
x = str(input())
if x.isupper() == True:
  print("A")
else:
  print("a")

Buggy python submission (verdict: Runtime Error):
a = str(input())
if a.isupper():
  print(A)
else:
  print(a)

Fixed submission:
x = str(input())
if x.isupper() == True:
  print("A")
else:
  print("a")

Buggy python submission (verdict: Runtime Error):
x = input()
if x.isupper() == True:
  print(A)
else:
  print(a)

Fixed submission:
x = str(input())
if x.isupper() == True:
  print("A")
else:
  print("a")

Buggy python submission (verdict: Runtime Error):
a = str(input())
if a.isupper() = True:
  print(A)
else:
  print(a)

Fixed submission:
x = str(input())
if x.isupper() == True:
  print("A")
else:
  print("a")

Buggy python submission (verdict: Runtime Error):
a = str(input())
if a.isupper() == True:
  print(A)
else:
  print(a)

Fixed submission:
x = str(input())
if x.isupper() == True:
  print("A")
else:
  print("a")
Buggy python submission (verdict: Runtime Error):
import time
import copy
from threading import Thread
import random

import threading


d = int(input())
c = list(map(int,input().split()))
s = []
day = [0 for i in range(26)]
for i in range(d):
    s.append(list(map(int,input().split())))
ans = 0
num = 1
index = []
for i in s:
    max_index = -1
    large = 0
    for j in range(26):
        if large < i[j]:
            large = i[j]
            if not max_index == -1:
                ans -= c[max_index]*(num-day[max_index])
            max_index = j
        else:
            ans -= c[j]*(num-day[j])
    day[max_index] = num
    ans += large
    index.append(max_index+1)
    num += 1
rec = {}
cnt = 0
while True:
    if cnt == 20:
        for i in index:
            print(i)
        break
    x = random.randint(0,25)
    y = random.randint(0,d-1)
    if (x,y) in rec:
        continue
    rec[(x,y)] = 0
    sub = copy.deepcopy(index)
    sub[y] = x
    sub_ans = 0
    num = 1
    day = [0 for i in range(26)]
    for i in range(d):
        t = sub[i]
        day[t] = num
        for j in range(26):
            if j == t:
                sub_ans += s[i][j]
            else:
                sub_ans -= c[j]*(num-day[j])
        num += 1
    #print(sub_ans,sub,ans,index)
    if sub_ans > ans:
        index = sub_ans
    cnt += 1

Fixed submission:
d = int(input())
c = list(map(int,input().split()))
s = []
day = [0 for i in range(26)]
for i in range(d):
    s.append(list(map(int,input().split())))
ans = 0
for i in s:
    max_index = -1
    large = 0
    for j in range(26):
        if large < i[j]:
            large = i[j]
            if not max_index == -1:
                day[max_index] += 1
                ans -= c[max_index]
            max_index = j
        else:
            day[j] += 1
            ans -= c[j]
    day[max_index] = 0
    ans += large
    print(max_index+1)

Buggy python submission (verdict: Runtime Error):
day = [0 for i in range(26)]
for i in range(d):
    s.append(list(map(int,input().split())))
ans = 0
num = 1
for i in s:
    max_index = -1
    large = 0
    for j in range(26):
        if large < i[j]:
            large = i[j]
            if not max_index == -1:
                ans -= c[max_index]*(num-day[max_index])
            max_index = j
        else:
            ans -= c[j]*(num-day[j])
    day[max_index] = num
    ans += large
    print(max_index+1)
    num += 1

Fixed submission:
d = int(input())
c = list(map(int,input().split()))
s = []
day = [0 for i in range(26)]
for i in range(d):
    s.append(list(map(int,input().split())))
ans = 0
for i in s:
    max_index = -1
    large = 0
    for j in range(26):
        if large < i[j]:
            large = i[j]
            if not max_index == -1:
                day[max_index] += 1
                ans -= c[max_index]
            max_index = j
        else:
            day[j] += 1
            ans -= c[j]
    day[max_index] = 0
    ans += large
    print(max_index+1)
Buggy python submission (verdict: Runtime Error):
n = int(input())
ans = [0 for i in range(10)]
for i in range(10):
    if n < 26**(9-i):
        if i == 9:
            ans[i] = n
        continue
    else:
        s = n // 26**(9-i)
        n = n % 26**(9-i)
        ans[i] = s
al = "abcdefghijklmnopqrstuvwxyz"
answer = ""
for i in ans:
    if i == 0:
        continue
    answer += al[i-1]
print(answer)

Fixed submission:
N = int(input())
ans = ''
for i in range(1, 99):
    if N <= 26 ** i:
        N -= 1
        for j in range(i):
            ans += chr(ord('a') + N % 26)
            N //= 26
        break
    else:
        N -= 26 ** i
print(ans[::-1])
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
b = b*10000
print(a*b//10000)


Fixed submission:
a,b = map(int,input().replace(".","").split())
print(a*b//100)

Buggy python submission (verdict: Runtime Error):
import itertools
import copy
from collections import deque
import heapq
ab = input().split()
A = int(ab[0])
B = int(float(ab)*100)
ans = (A*B)//100
print(ans)


Fixed submission:
a,b = map(int,input().replace(".","").split())
print(a*b//100)
Buggy python submission (verdict: Runtime Error):
import itertools
import copy
n,m,x = map(int,input().split())
ans = [0 for i in range(m)]
books = []
answer = 1000000000000000000000
for i in range(n):
    books.append(list(map(int,input().split())))
for i in range(n):
    stock = list(list(itertools.combinations([num for num in range(n)], i+1)))
    for j in stock:
        cost = 0
        ans = [0 for i in range(m)]
        for k in j:
            for e,l in enumerate(books[k]):
                if e == 0:
                    cost += l
                else:
                    ans[e-1] += l
            if min(ans) >= x and cost < answer:
                answer = copy.deepcopy(cost)
if answer = 1000000000000000000000:
    print(-1)
else:
    print(answer)


Fixed submission:
import itertools
import copy
n,m,x = map(int,input().split())
ans = [0 for i in range(m)]
books = []
answer = 1000000000000000000000
for i in range(n):
    books.append(list(map(int,input().split())))
for i in range(n):
    stock = list(list(itertools.combinations([num for num in range(n)], i+1)))
    for j in stock:
        cost = 0
        ans = [0 for i in range(m)]
        for k in j:
            for e,l in enumerate(books[k]):
                if e == 0:
                    cost += l
                else:
                    ans[e-1] += l
            if min(ans) >= x and cost < answer:
                answer = copy.deepcopy(cost)
if answer == 1000000000000000000000:
    print(-1)
else:
    print(answer)
Buggy python submission (verdict: Runtime Error):
import Foundation
 
let nk = readLine()!.split(separator:" ").map{Int($0)!}
var sets: Set<Int> = []
for _ in 1...nk[1]{
  let c = readLine()!
  let A = readLine()!.split(separator:" ").map{Int($0)!}
  for i in A{
  sets.insert(i)
  }
}
print(nk[0] - sets.count)

Fixed submission:
n,k = map(int,input().split())
ans = [i for i in range(1,n+1)]
for i in range(k):
    d = int(input())
    a = list(map(int,input().split()))
    for j in a:
        if j in ans:
            ans.remove(j)
print(len(ans))