Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p02683 (python)

Fixed submission:
import itertools
N,M,X = map(int,input().split())
book =[]
for x in range(N):
    A_list =  list(map(int, input().split()))
    book.append(A_list)
conbination =[]
for i, _ in enumerate(book, 1):     
    for j in itertools.combinations(book, r=i):  # rには1、2、3と渡される
        conbination.append(j)
minn =100000000
for x in conbination:
    A = [0]*M
    m = 0
    for y in x:
        for z in range(len(y)):
            if z ==0:
                m +=y[z]
            else:
                A[z-1] +=y[z]
    if minn >m and X<=min(A):
        minn =m
        
if minn != 100000000:
    print(minn)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
import itertools
N,M,X = map(int,input().split())
book =[]
for x in range(N):
    A_list =  list(map(int, input().split()))
    book.append(A_list)
conbination =[]
for i, _ in enumerate(book, 1):     
    for j in itertools.conbination(book, r=i):  # rには1、2、3と渡される
        conbination.append(j)
minn =100000000
for x in conbination:
    A = [0]*M
    m = 0
    for y in x:
        for z in range(len(y)):
            if z ==0:
                m +=y[z]
            else:
                A[z-1] +=y[z]
    if minn >m and X<=min(A):
        minn =m
        
if minn != 100000000:
    print(minn)
else:
    print(-1)
Problem p02696 (python)

Fixed submission:
import math
A,B,N = map(int,input().split())
s = min(B-1,N)
print(math.floor((A*s)/B)-A*(math.floor(s/B)))

Buggy submission (verdict: Runtime Error):
A,B,N = map(int,input().split())
maxn =0
if A<B:
    if B/2 <N:
        t = math.ceil(B/2)-1
        ans = tmp = math.floor((A*t)/B)-A*(math.floor(t/B))
    else:
        ans = tmp = math.floor((A*N)/B)-A*(math.floor(N/B))
else:
    for x in range(1,B+1):
        tmp = math.floor((A*x)/B)-A*(math.floor(x/B))
        if maxn < tmp:
            maxn = tmp
    ans =maxn
print(ans)
Problem p02761 (python)

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

keta_list=[]
num_list=[]
for x in range(M):
    s,c =map(int,input().split())
    keta_list.append(s)
    num_list.append(c)
siteilist=[0]*N
if len(siteilist)!=1:
    siteilist[0]=1
errer =0
apperlist =[]

for i,x in enumerate(keta_list):
    siteilist[x-1]=num_list[i]
    if x == 1 and num_list[i]==0 and len(siteilist)!=1:
        errer= 1
    if x in apperlist:
        z =[]
        z = [l for l,i in enumerate(keta_list) if x == i ]
        if len(z)!=0:
            firest = num_list[z[0]]
            for b in z:
                if num_list[b] != firest:
                    errer = 1
                    
    apperlist.append(x)
out =0
if errer ==1:
    out =-1
else:
    for x in range(N):
        out += siteilist[x]*10**(N-x-1)
print(out)

Buggy submission (verdict: Runtime Error):
N , M =map(int,input())

keta_list=[]
num_list=[]
for x in range(M):
    s,c =map(int,input().split())
    keta_list.append(s)
    num_list.append(c)
siteilist=[0]*N
siteilist[0]=1
errer =0
apperlist =[]

for i,x in enumerate(keta_list):
    siteilist[x-1]=num_list[i]
    if x == 1 and num_list[i]==0:
        errer= 1
    if x in apperlist:
        z =[]
        z = [l for l,i in enumerate(keta_list) if x == i ]
        if len(z)!=0:
            firest = num_list[z[0]]
            for b in z:
                if num_list[b] != firest:
                    errer = 1
                    
    apperlist.append(x)
out =0
if errer ==1:
    out =-1
else:
    for x in range(N):
        out += siteilist[x]*10**(N-x-1)
print(out)
Problem p02789 (python)

Fixed submission:
N ,M= map(int,input().split())
#S = int(input())
if N== M:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
N ,M= map(int,input())
#S = int(input())
if N== M:
    print("Yes")
else:
    print("No")
Problem p02791 (python)

Fixed submission:
N = int(input())
P = list(map(int,input().split()))
c = 1
minN =P[0]
for x in range(1,N):
    if P[x]<= minN:
        c +=1
        minN = P[x]
print(c)

Buggy submission (verdict: Runtime Error):
a ,b= map(int,input().split())
#S = int(input())

if a > b:
    ans = [str(b)]*a
    ans = "".join(ans)
else:
    ans = [str(a)]*b
    ans = "".join(ans)
print(ans)
Problem p02909 (python)

Fixed submission:
S = input()
if S =="Sunny":
    print("Cloudy")
if S =="Rainy":
    print("Sunny")
if S =="Cloudy": 
    print("Rainy")

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
A =list(map(int,input().split()))
A.sort(reverse=True)
A_len =len(A)
count =0
for l in range(0,M):
    comp = A[0]/2
    for i in range(0,A_len-1,1):
        if count >= M:
            break
        if A[i+1]<comp:
            break
        while True:
            count +=1
            if A[i]/2 > A[i+1]:
                A[i] = A[i]/2
            else:
                A[i] = A[i]/2
                break
    A.sort(reverse=True)
    if count>=M:
        break
A = [int(i) for i in A]
sumN =sum(A)
print(sumN)
Problem p03425 (python)

Fixed submission:
import itertools
N = int(input())
SK = {"M":0,"A":1,"R":2,"C":3,"H":4}
SD = [0]*5
del_list = []
A = ["M","A","R","C","H"]
for x in range(N):
    tmp = str(input())
    if tmp[0] in A:
        SD[SK[tmp[0]]] +=1
C = 0
for x in range(5):
    if SD[x] == 0 :
        del_list.append(x)
        C +=1
del_list.reverse()
for x in del_list:
    SD.pop(x)
    
if C >2:
    print(0)
else:
    Z = 5-C
    k = itertools.combinations(range(Z), 3)
    ans = 0
    for x in k:
        ans += SD[x[0]]*SD[x[1]]*SD[x[2]]
    print(ans)

Buggy submission (verdict: Runtime Error):
import itertools
N = int(input())
SK = {"M":0,"A":1,"R":2,"C":3,"H":4}
SD = [0]*5
del_list = []
A = ["M","A","R","C","H"]
for x in range(N):
    tmp = str(input())
    if tmp[0] in A:
        SD[SK[tmp[0]]] +=1
C = 0
for x in range(5)
    if SD[x] == 0 :
        del_list.append(x)
        C +=1
del_list.reverse()
for x in del_list:
    SD.pop(x)
    
if C >2:
    print(0)
else:
    Z = 5-C
    k = itertools.combinations(range(Z), 3)
    ans = 0
    for x in k:
        ans += SD[x[0]]*SD[x[1]]*SD[x[2]]
    print(ans)
Problem p02646 (python)

Fixed submission:
a, v = [int(i) for i in input().split()]
b, w = [int(i) for i in input().split()]
t = int(input())
if (v-w) > 0 and abs(a-b)/abs(v-w) <= t:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
a, v = [int(i) for i in input().split()]
b, w = [int(i) for i in input().split()]
t = int(input())
if abs(a-b)/abs(v-w) <= t:
  print("YES")
else:
  print("NO")a, v = [int(i) for i in input().split()]
b, w = [int(i) for i in input().split()]
t = int(input())
if (v-w) > 0 and abs(a-b)/abs(v-w) <= t:
  print("YES")
else:
  print("NO")
Problem p02755 (python)

Fixed submission:
import math
import sys
A, B = [int(i) for i in input().split()]
for i in range(math.ceil(12.5 * A), math.ceil(12.5 * (A + 1))):
    if math.floor(i//10) == B:
        print(i)
        sys.exit()
print(-1)

Buggy submission (verdict: Runtime Error):
A, B = [int(i) for i in input().split()]
if B >= A and 4*(B-A) == A and 5*(B-A) == B:
  print(50(B-A))
else:
  print(-1)
Problem p02641 (python)

Fixed submission:
X,N = list(map(int,input().split()))
if N == 0:
    print(X)
else:
    P = list(map(int,input().split()))
    for i in range(100):
        if not X - i in P:
            a = X - i
            break
        if not X + i in P:
            a = X + i
            break
    print(a)

Buggy submission (verdict: Runtime Error):
6 5
4 7 10 6 5

Buggy submission (verdict: Runtime Error):
X,N = list(map(int,input().split()))
if N == 0:
    print(X)
else:
    P = list(map(int,input().split()))
    A = []
    B = []
    for i in range(101):
        if i not in P and i <= X:
            A.append(i)
        elif i not in P and i > X:
            B.append(i)
    A = sorted(A,reverse=True)
    B = sorted(B)
    a = abs(X - A[0])
    b = (B[0] - X)
    if a <= b:
        print(A[0])
    else:
        print(B[0])

Buggy submission (verdict: Runtime Error):
X,N = list(map(int,input().split()))
if N == 0:
    print(X)
else:
    P = list(map(int,input().split()))
    A = []
    B = []
    for i in range(101):
        if i not in P and i <= X:
            A.append(i)
        elif i not in P and i > X:
            B.append(i)
    A = sorted(A,reverse=True)
    B = sorted(B)
    a = X - A[0]
    b = B[0] - X
    if a <= b:
        print(A[0])
    else:
        print(B[0])
Problem p02642 (python)

Fixed submission:
import numpy as np
N=int(input())
A=sorted(list(map(int,input().split())))
Amax=A[-1]+1
B=np.zeros(Amax,dtype=int)
ans=0
#1～Amaxの範囲でjがA[i]の倍数の時,B[j]+=1
for i in A:
	for j in range(i,Amax,i):
		B[j]+=1
#B[i]==1:その数でしか割り切れない→count up
for i in A:
	if B[i]==1:
		ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
N=int(input())
A=sorted(list(map(int,input().split())))
# すべてTrueのbool配列dp
dp=np.ones(len(A),dtype=int)
for i in range(N):
	for j in range(i+1,N):
		if dp[j] == 0:
			continue
		if A[j]%A[i]==0:
			dp[j]=0
if A[0]==A[1]:
	dp[0]=0
print(sum(dp))

Buggy submission (verdict: Runtime Error):
N=int(input())
A=sorted(list(map(int,input().split())))
cnt=0
a=[A[0]]
for i in range(1,len(A)):
	for val in a:
		if A[i]%val==0:
			break
	else:
		a.append(A[i])
		cnt+=1
if A[0]!=A[1]:
	cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=sorted(list(map(int,input().split())),reverse=True)
cnt=0
for i in range(len(A)-1):
	for j in range(i+1,len(A)):
		if A[i]%A[j]==0:
			break
	else:
		cnt+=1
if A[-2]!=A[-1]:
	cnt+=1
print(cnt)
Problem p02677 (python)

Fixed submission:
import sys
import math

a,b,h,m=map(int, sys.stdin.readline().rstrip().split())
m_angle = m*6
h_angle = h*30+m/2
theta=abs(h_angle-m_angle)
if theta>180:theta=360-theta
c = a**2+b**2-2*a*b*math.cos(math.radians(theta))
print(c**0.5)

Buggy submission (verdict: Runtime Error):
a,b,h,m=map(int, sys.stdin.readline().rstrip().split())
m_angle = m*6
h_angle = h*30+m/2
theta=abs(h_angle-m_angle)
if theta>180:theta=360-theta
c = a**2+b**2-2*a*b*math.cos(math.radians(theta))
print(c**0.5)
Problem p02683 (python)

Fixed submission:
import sys
N, M, X=map(int, sys.stdin.readline().rstrip().split())
A = [list(map(int, sys.stdin.readline().rstrip().split())) for i in range(N)]
cost=[]
for i in range(1<<N):	#Bit All Search
	l=[0]*(M+1)
	for j in range(N):
		if((i>>j)&1)==1:
			l=[l[k]+A[j][k] for k in range(M+1)]
	for k in range(M):
		if l[k+1]<X:
			break
	else:
		cost.append(l[0])
cost.sort()
print(-1 if cost==[] else cost[0])

Buggy submission (verdict: Runtime Error):
import sys
for i in range(1<<N):	#Bit All Search
	l=[0]*(M+1)
	for j in range(N):
		if((i>>j)&1)==1:
			l=[l[k]+A[j][k] for k in range(M+1)]
	for k in range(M):
		if l[k+1]<X:
			break
	else:
		cost.append(l[0])
cost.sort()
print(-1 if cost==[] else cost[0])
Problem p02706 (python)

Fixed submission:
import sys

def ILI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def ISI(): return map(int, sys.stdin.readline().rstrip().split())

n, m = ISI()
l=ILI()
if n-sum(l)<0:print(-1)
else:print(n-sum(l))

Buggy submission (verdict: Runtime Error):
import sys

def ILI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def ISI(): return map(int, sys.stdin.readline().rstrip().split())

n, m = ISI()
l=ILI()
if n-sum8(l)<:print(-1)
else:print(n-sum(l))

Buggy submission (verdict: Runtime Error):
import sys
def ISI(): return map(int, sys.stdin.readline().rstrip().split())

n, m = ISI()
l=ILI()
print(n-sum(l))
Problem p02811 (python)

Fixed submission:
import sys
def ISI(): return map(int, sys.stdin.readline().rstrip().split())
k, x = ISI()
if 500*k<x:print("No")
else:print("Yes")

Buggy submission (verdict: Runtime Error):
k, x = ISI()
if 500*k<x:print("No")
else:print("Yes")
Problem p02830 (python)

Fixed submission:
import sys

def ISS(): return sys.stdin.readline().rstrip().split()

n = int(input())
s, t = ISS()
S =""
for i in range(n):
	S+=s[i]+t[i]
print(S)

Buggy submission (verdict: Runtime Error):
n = int(input())
s, t = ISS()
S =""
for i in range(n):
	S+=s[i]+t[i]
print(S)
Problem p02946 (python)

Fixed submission:
k, x = map(int, input().split())
min = x - k + 1
max = x + k - 1
txt = str(min)
for i in range(max - min):
    txt = txt + " " + str(min+1)
    min += 1
print(txt)

Buggy submission (verdict: Runtime Error):
k, x = map(int, f.readline().split())
min = x - k + 1
max = x + k - 1
txt = str(min)
for i in range(max - min):
    txt = txt + " " + str(min+1)
    min += 1
print(txt)
Problem p02982 (python)

Fixed submission:
from math import sqrt
n, d = map(int, input().split())
lst = []
cnt = 0
for i in range(n):
    a = tuple(map(int, input().split()))
    lst.append(a)
for i in range(n-1):
    for j in range(i+1, n):
        x = 0
        for k in range(d):
            x += (lst[i][k]-lst[j][k])**2
        length = sqrt(x)
        if length%1 == 0:
            if length != 0:
                cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
n, d = map(int, input().split())
lst = []
cnt = 0
for i in range(n):
    a = list(map(int, input().split()))
    print(a)
    lst.append(a)
for i in range(n-1):
    for j in range(i+1, n):
        val = 0
        for k in range(d):
            x += (lst[i][k]-lst[j][k]) ** 2
        dist = x ** 0.5
        if dist%1 == 0:
            if dist != 0:
                cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
n, d = map(int, input().split())
x = []
cnt = 0
for i in range(n):
    a = list(map(int, input().split()))
    print(a)
    lst.append(a)
for i in range(n-1):
    for j in range(i+1, n):
        val = 0
        for k in range(d):
            x += (lst[i][k]-lst[j][k]) ** 2
        dist = x ** 0.5
        if dist%1 == 0:
            if dist != 0:
                cnt += 1
print(cnt)
Problem p02983 (python)

Fixed submission:
L,R=map(int,input().split())
ans=2019
for i in range(L,R):
	for j in range(i+1, R+1):
		if j%2019==0:
			print(0)
			exit()
		ans=min(ans,(i*j)%2019)
print(ans)

Buggy submission (verdict: Runtime Error):
import itertools
L,R=map(int,input().split())
ans=2019
for c in itertools.combinations(range(L,R+1),2):
	if (c[0]*c[1])%2019==0:
		print(0)
		exit()
	else:
		ans=min(ans,(c[0]*c[1])%2019)
print(ans)

Buggy submission (verdict: Runtime Error):
import itertools
L,R=map(int,input().split())
if L%2019==0 or R%2019==0:
	ans=0
else:
	L%=2019
	R%=2019
	INF=10*9
	ans=INF
	for i in itertools.combinations(range(L,R+1),2):
		ans=min(ans,(i*j)%2019)
print(ans)

Buggy submission (verdict: Runtime Error):
import itertools
L,R=map(int,input().split())
ans=2019
for i in itertools.combinations(range(L,R+1),2):
	ans=min(ans,(i[0]*i[1])%2019)
print(ans)
Problem p03000 (python)

Fixed submission:
n, x = map(int, input().split())
L = list(map(int, input().split()))
d = 0
bound = 1
for l in L:
	d = d + l
	if d > x:
		break
	bound += 1
print(bound)

Buggy submission (verdict: Runtime Error):
n, x = map(int, input().split())
l = list(map(int, input().split()))
d = 0
cnt = 0
i = 0
while d <= x:
    cnt += 1
    d += l[i]
    i += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
n, x = map(int, input().split())
L = list(map(int, input().split()))
d = 0
bound = 1
for l in L:
	d += l
	if d > X:
		break
	bound += 1
print(bound)
Problem p03289 (python)

Fixed submission:
#インポート
import sys

#入力用
def ILI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def ISI(): return map(int, sys.stdin.readline().rstrip().split())
def II(): return int(sys.stdin.readline().rstrip())
def ISS(): return sys.stdin.readline().rstrip().split()
def IS(): return sys.stdin.readline().rstrip()

S = IS()
if S[0] == "A" and S.count("C") == 1 and S[-1] != "C":
    if S[1].islower() == True:
        if S[S.index("C")+1:].islower() == True:
            print("AC")
        else:
            print("WA")
    else:
        print("WA")
else:
    print("WA")

Buggy submission (verdict: Runtime Error):
#インポート
import sys

#入力用
def ILI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def ISI(): return map(int, sys.stdin.readline().rstrip().split())
def II(): return int(sys.stdin.readline().rstrip())
def ISS(): return sys.stdin.readline().rstrip().split()
def IS(): return sys.stdin.readline().rstrip()

S = IS()
if S[0] == "A" and S[2] == "C" and islower(S[1])==True  and islower(S[3:]):
    print("AC")
else:
    print("WA")
Problem p03293 (python)

Fixed submission:
s = list(input())
t = list(input())
for i in range(len(s)):
    tmp = s[-1]
    for j in range(len(s)-1)[::-1]:
        s[j+1] = s[j]
    s[0]=tmp
    if s == t:
        print("Yes")
        break
else:
    print("No")

Buggy submission (verdict: Runtime Error):
s = list(input())
t = list(input())
for i in range(len(s)):
   	tmp = s[-1]
   	for j in range(len(s)-1)[::-1]:
       	s[j+1] = s[j]
   	s[0]=tmp
   	print(s)
   	if s == t:
       	break
else:
   	print("no")
Problem p03478 (python)

Fixed submission:
n,a,b = map(int, input().split())
value = cnt = 0
for i in range(1, n+1):
    lst = []
    lst = list(str(i))
    for num in lst:
        value += int(num)
    if a <= value <= b:
    	cnt += i
    value = 0
print(cnt)

Buggy submission (verdict: Runtime Error):
n,a,b = map(int, input().split())
value = cnt = 0
for i in range(1, n+1):
    lst = []
    lst = list(str(i))
    for num in lst:
        value += int(num)
    if a <= value <= b:
    cnt += i
    value = 0
print(cnt)

Buggy submission (verdict: Runtime Error):
n,a,b = map(int, f.readline().split())
value = cnt = 0
for i in range(1, n+1):
    lst = []
    lst = list(str(i))
    for num in lst:
        value += int(num)
    if a <= value <= b:
    cnt += i
    value = 0
print(cnt)
Problem p03486 (python)

Fixed submission:
s = sorted(list(input()))
t = sorted(list(input()), reverse = 1)
if s < t:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
s = sorted(list(input()))
t = sorted(list(input()), reverse = 1)
for i in range(len(s)):
    if s[i] < t[i]:
        print("Yes")
        break
else:
    if len(s) < len(t):
        print("Yes")
    else:
        print("No")
Problem p03495 (python)

Fixed submission:
"""#################################################################
【ABC081】
C - Not so Diverse
#################################################################"""

#インポート
import sys
from collections import Counter

#入力用
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))  #リスト(int型)
def MI(): return map(int, sys.stdin.readline().rstrip().split())        #多変数(int型)
def II(): return int(sys.stdin.readline().rstrip())                     # 1変数(int型)
def S(): return sys.stdin.readline().rstrip()                           #文字列(str型)

N, K = MI()
A = LI()
A = sorted(Counter(A).values(), reverse = True)
sum = sum(A[K:])
print(sum)

Buggy submission (verdict: Runtime Error):
"""#################################################################
【ABC081】
C - Not so Diverse
#################################################################"""

#インポート
import sys
from collections import Counter

#入力用
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))  #リスト(int型)
def MI(): return map(int, sys.stdin.readline().rstrip().split())        #多変数(int型)
def II(): return int(sys.stdin.readline().rstrip())                     # 1変数(int型)
def S(): return sys.stdin.readline().rstrip()                           #文字列(str型)

N, K = MI()
A = (LI())
A = sorted(Counter(A).values(), reverse = True)
sum = A[k:]
print(sum)
Problem p03997 (python)

Fixed submission:
a = int(input())
b = int(input())
h = int(input())
print(int((a+b)*h/2))

Buggy submission (verdict: Runtime Error):
a, b, h = map(int, input().split())
s = (a+b)*h/2
print(int(s))

Buggy submission (verdict: Runtime Error):
a, b, h = map(int, input().split())
print((a+b)*int(h/2))

Buggy submission (verdict: Runtime Error):
a, b, h = map(int, input().split())
S = (a+b)* h / 2
print(S)

Buggy submission (verdict: Runtime Error):
a, b, h = map(int, input().split())
S = (a+b)/2 * h
S = int(S)
print(S)

Buggy submission (verdict: Runtime Error):
a, b, h = map(int, input().split())
S = (a+b)/2 * h
S = int(S)
print(S)

Buggy submission (verdict: Runtime Error):
a, b, h = map(int, input().split())
print(int((a+b)/2 * h))

Buggy submission (verdict: Runtime Error):
a, b, h = map(int, input().split())
print(int((a+b)/2 * h))
Problem p02642 (python)

Fixed submission:
import sys
from collections import Counter

def ii(): return int(sys.stdin.readline())
def li(): return list(map(int, sys.stdin.readline().split()))

if __name__ == "__main__":
    n = ii()
    a = li()
    a = sorted(a)
    a_max = a[-1]
    sive = [True] * (a_max + 1)

    def sived(x):
        for non_ans in range(x, a_max+1, x):
            sive[non_ans] = False
    ans = 0
    for i in range(len(a)-1):
        if sive[a[i]]:
            sived(a[i])
            if a[i] != a[i+1]:
                ans += 1
    if sive[a_max]:
        ans += 1
    print(ans)

Buggy submission (verdict: Runtime Error):
import sys
from collections import Counter

def ii(): return int(sys.stdin.readline())
def li(): return list(map(int, sys.stdin.readline().split()))

if __name__ == "__main__":
    n = ii()
    a = li()
    c = Counter(a)
    del_list = []
    for k, v in c.items():
        if v >= 2:
            del_list.append(k)
    for k in del_list:
        del c[k]
    a = sorted(c.keys())
    max_a = a[-1]
    if len(a) == 0:
        print(0)
        exit()
    b = [True] * (max_a + 1)
    def sived(x):
        for not_ans in range(x+x, max_a + 1, x):
            b[not_ans] = False
    for i in a:
        if b[i]:
            sived(i)
    ans = 0
    for i in a:
        if b[i]:
            ans += 1
    print(ans)

Buggy submission (verdict: Runtime Error):
import sys
from collections import Counter

def ii(): return int(sys.stdin.readline())
def li(): return list(map(int, sys.stdin.readline().split()))

if __name__ == "__main__":
    n = ii()
    a = li()
    c = Counter(a)
    del_list = []
    for k, v in c.items():
        if v >= 2:
            del_list.append(k)
    for k in del_list:
        del c[k]
    a = sorted(list(c.keys()))
    max_a = a[-1]
    if len(a) == 0:
        print(0)
        exit()
    b = [True] * (max_a + 1)
    def sived(x):
        for not_ans in range(x+x, max_a + 1, x):
            b[not_ans] = False
    for i in a:
        if b[i]:
            sived(i)
    ans = 0
    for i in a:
        if b[i]:
            ans += 1
    print(ans)
Problem p02658 (python)

Fixed submission:
import sys

n = int(input())
a = list(map(int, input().split()))
a = sorted(a)
ans = 1
for i in a:
    if i == 0:
        print(0)
        sys.exit()
    ans *= i
    if ans > 10**18:
        print("-1")
        sys.exit()
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
ans = 1
for i in a:
    ans = ans * i
if ans > 10**18:
    print("-1")
else:
    print(an
Problem p02971 (python)

Fixed submission:
import copy
n = int(input())
a = [int(input()) for _ in range(n)]
b = sorted(copy.copy(a), reverse=True)

for i in range(n):
    if a[i] == b[0]:
        print(b[1])
    else:
        print(b[0])

Buggy submission (verdict: Runtime Error):
import array
n = int(input())
a = [int(input()) for _ in range(n)]
[print((max(array.array('H', (a[:_] + a[_ + 1:]))))) for _ in range(n)]
Problem p02983 (python)

Fixed submission:
left, right = map(int, input().split())
mod = []
if right - left > 2019:
    print(0)
    exit()
else:
    for i in range(left, right):
        for j in range(left+1, right+1):
            mod.append(i*j%2019)
print(min(mod))

Buggy submission (verdict: Runtime Error):
left, right = map(int, input().split())
imod = []
jmod = []

for i in range(left, right):
    imod.append(i % 2019)

for i in range(imod.index(min(imod))+1, len(imod)):
    jmod.append(imod[i])

print((min(imod) + min(jmod)) % 2019)

Buggy submission (verdict: Runtime Error):
left, right = map(int, input().split())
imod = []
jmod = []

for i in range(left, right):
    imod.append(i % 2019)

for i in range(imod.index(min(imod))+1, len(imod)):
    jmod.append(imod[i])

print(min(imod) * min(jmod) % 2019)
Problem p03284 (python)

Fixed submission:
n, k = map(int, input().split())
if n % k == 0:
    print(0)
else:
    print(1)

Buggy submission (verdict: Runtime Error):
n, k = int(input()).split()
print(n%k - 1)