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

Fixed submission:
x=int(input())
print(8-(x-400)//200)

Buggy submission (verdict: Runtime Error):
import functools
import operator
n,k=map(int,input().split())
a=list(map(int,input().split()))
a1=a[k-1:]
result = functools.reduce(operator.mul, a1)
for i in range(n-k):
    if result<result/a[i]*a[i+k]:
        print('Yes')
    else:
        print('No')
    result=result/a[i]*a[i+k]
Problem p02621 (python)

Fixed submission:
n=int(input())
print(n+n**2+n**3)

Buggy submission (verdict: Runtime Error):
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
time=0
count=0
while time<k:
    if count==(n+m-1):
        count=n+m+1
        break
    elif count//2>=n or count//2>=m:
        count+=1
        continue
    elif count%2==0:
        time+=a[count//2]
        count+=1
    else:
        time+=b[count//2]
        count+=1
print(count-1)

Buggy submission (verdict: Runtime Error):
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
time=0
count=0
while time<k:
    if count==(n+m-1):
        count=n+m+1
        break
    elif count//2>=n or count//2>=m:
        count+=1
        continue
    elif count%2==0:
        time+=a[count//2]
        count+=1
    else:
        time+=b[count//2]
        count+=1
print(count-1)
Problem p02639 (python)

Fixed submission:
x=list(map(int,input().split()))
count=0
for i in x:
    count+=1
    if i==0:
        print(count)
        break

Buggy submission (verdict: Runtime Error):
x,n=map(int,input().split())
try:
    p=list(map(int,input().split()))
    mina=100
    for i in range(min(p),max(p)):
        if i not in p:
            if mina>abs(i-x):
                mina=abs(i-x)
                ans=i
                if ans>x and (x-mina) not in p:
                    ans=x-mina
except:
    ans=x

print(ans)

Buggy submission (verdict: Runtime Error):
x,n=map(int,input().split())
try:
    p=list(map(int,input().split()))
    p.sort()
    min=abs(p[0])
    for i in range(p[0],p[n-1]):
        if i not in p:
            if min>abs(i-x):
                min=abs(i-x)
                ans=i
except:
    ans=x
print(ans)
Problem p02641 (python)

Fixed submission:
x, n = map(int, input().split())
a = [int(x) for x in input().split()]
b = [i for i in range(0,102) if i not in a] 
b_tmp = list(map(lambda s:abs(s-x), b)) 
address = b_tmp.index(min(b_tmp))
print(b[address])

Buggy submission (verdict: Runtime Error):
x,n=map(int,input().split())
try:
    p=list(map(int,input().split()))
    mina=100
    for i in range(min(p),max(p)):
        if i not in p:
            if mina>abs(i-x):
                mina=abs(i-x)
                ans=i
                if ans>x and (x-mina) not in p:
                    ans=x-mina
except:
    ans=x

print(ans)

Buggy submission (verdict: Runtime Error):
x,n=map(int,input().split())
try:
    p=list(map(int,input().split()))
    p.sort()
    min=abs(p[n-1])
    for i in range(p[0],p[n-1]):
        if i not in p:
            if min>abs(i-x):
                min=abs(i-x)
                ans=i
                if ans>x and x-min not in p:
                    ans-=min
except:
    ans=x

print(ans)

Buggy submission (verdict: Runtime Error):
x,n=map(int,input().split())
try:
    p=list(map(int,input().split()))
    p.sort()
    min=abs(p[n-1])
    for i in range(p[0]-2*x,p[n-1]):
        if i not in p:
            if min>abs(i-x):
                min=abs(i-x)
                ans=i
except:
    ans=x

print(ans)

Buggy submission (verdict: Runtime Error):
x,n=map(int,input().split())
try:
    p=list(map(int,input().split()))
    p.sort()
    min=abs(p[n-1])
    for i in range(p[0],p[n-1]):
        if i not in p:
            if min>abs(i-x):
                min=abs(i-x)
                ans=i
except:
    ans=x
print(ans)

Buggy submission (verdict: Runtime Error):
x,n=map(int,input().split())
try:
    p=list(map(int,input().split()))
    p.sort()
    min=abs(p[0])
    for i in range(p[n-1]):
        if i not in p:
            if min>abs(i-x):
                min=abs(i-x)
                ans=i
except:
    ans=x
print(ans)

Buggy submission (verdict: Runtime Error):
x,n=map(int,input().split())
p=list(map(int,input().split()))
p.sort()
min=abs(p[0])
for i in range(p[n-1]):
    if i not in p:
        if min>abs(i-x):
            min=abs(i-x)
            ans=i
print(ans)
Problem p02664 (python)

Fixed submission:
t=input()
result=''
for i in range(len(t)-1):
    if t[i]=='?':
        try:
            if result[i-1]=='P':
                result+='D'
            else:
                if t[i+1]=='P':
                    result+='D'
                else:
                    result+='P'
        except:
            if t[i+1]=='P':
                result+='D'
            else:
                result+='P'
    else:
        result+=t[i]
if t[len(t)-1]=='?' or  t[len(t)-1]=='D':
    print(result+'D')
else:
    print(result+'P')

Buggy submission (verdict: Runtime Error):
t=input()
result=''
for i in range(len(t)):
    if t[i]=='?':
        try:
            if result[i-1]=='P':
                result+='D'
            else:
                result+='P'
        except:
            if  t[i+1]=='P':
                result+='D'
            else:
                result+='P'
    else:
        result+=t[i]
print(result)

Buggy submission (verdict: Runtime Error):
t=input()
p='A'+t+'A'
result=''
for i in range(len(p)-2):
    if t[i]=='?':
        if result[i-1]=='P'or t[i+1]=='P':
            result+='D'
        else:
            result+='P'
    else:
        result+=t[i]
print(result)

Buggy submission (verdict: Runtime Error):
t=input()
result=''
for i in range(len(t)):
    if t[i]=='?':
        if result[i-1]=='P'or t[i+1]=='P':
            result+='D'
        else:
            result+='P'
    else:
        result+=t[i]
print(result)

Buggy submission (verdict: Runtime Error):
t=input()
result=''
for i in range(len(t)):
    if t[i]=='?':
        if result[i-1]=='P':
            result+='D'
        else:
            result+='P'
    else:
        result+=t[i]
print(result)
Problem p02772 (python)

Fixed submission:
n=input()
a=list(map(int,input().split()))
for i in a:
    if i%2==0:
        if i%3==0 or i%5==0:
            pass
        else:
            print('DENIED')
            exit(0)
print('APPROVED')

Buggy submission (verdict: Runtime Error):
n=input()
a=list(map(int,input().split()))
for i in a:
    if i%2==0:
        if i%3==0 or i%5==0:
            result='APPROVED'
        else:
            result='DENIED'
            break
print(result)
Problem p02952 (python)

Fixed submission:
n=int(input())


count=len(str(n))
ans=''
if count%2==0:
    for i in range(count-1):
        if i%2==0:
            ans+='9'
        else:
            ans+='0'
else:
    ans=(count//2)*'90'
    try:
        ans=n-int(ans)
    except:
        ans=n
print(int(ans))

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


count=len(str(n))
ans=''
if count%2==0:
    for i in range(count-1):
        if i%2==0:
            ans+='9'
        else:
            ans+='0'
else:
    ans=count//2*'90'
    ans=n-int(ans)
print(int(ans))
Problem p02993 (python)

Fixed submission:
s=input()
for i in range(len(s)-1):
    if s[i]==s[i+1]:
        result='Bad'
        break
    else:
        result='Good'
print(result)

Buggy submission (verdict: Runtime Error):
s=input()
for i in range(len(s)):
    if s[i]==s[i+1]:
        result='Bud'
        break
    else:
        result='Good'
print(result)
Problem p03106 (python)

Fixed submission:
a,b,k=map(int,input().split())
count=0
for i in range(a+1,0,-1):
    if a%i==0 and b%i==0:
        count+=1
        if count==k:
            print(i)

Buggy submission (verdict: Runtime Error):
a,b,k=map(int,input().split())
z=[]
for i in range(1,a):
    if a%i==0 and b%i==0:
        z.append(i)
print(z[k-1])
Problem p03469 (python)

Fixed submission:
import re
s=input()
result=re.fullmatch(r'(\d{3})(\d)/(\d{2})/(\d{2})',s)
print(result.group(1)+'8/'+result.group(3)+'/'+result.group(4))

Buggy submission (verdict: Runtime Error):
import re
result=re.fullmatch(r'(\d{3})(\d)/(\d{2})/(\d{2})',input())
print(result.group(1)+'8/'+result.group(3)+'/'+result.group(4)
Problem p03844 (python)

Fixed submission:
a,o,b=map(str,input().split())
a=int(a)
b=int(b)
if o=='+':
    print(a+b)
else:
    print(a-b)

Buggy submission (verdict: Runtime Error):
a,o,b=map(str,input().split())
if o=='+':
    print(a+b)
else:
    print(a-b)
Problem p03260 (python)

Fixed submission:
class ABC109Solver():
    def __init__(self):
        self.a = int()
        self.b = int()
    def input(self, a, b):
        self.a = a
        self.b = b
    def solve(self):
        # return 'Yes'
        # return 'No' if self.b%2 == 0 else 'Yes'
        return 'No' if self.a%2 == 0 or self.b%2 == 0 else 'Yes'

vals = input().split(' ')
a, b = int(vals[0]), int(vals[1])
solver = ABC109Solver()
solver.input(a,b)
 
print( solver.solve() )

Buggy submission (verdict: Runtime Error):
class ABC109Solver():
    def __init__(self):
        self.a = int()
        self.b = int()
    def input(self, a, b):
        self.a = a
        self.b = b
    def solve(self):
        # return 'Yes'
        # return 'No' if self.b%2 == 0 else 'Yes'
        return 'No' if self.a%2 == 0 or self.b%2 == 0 else 'Yes'
      
a = int(input())
b = int(input())
solver = ABC109Solver()
solver.input(a,b)

print( solver.solve() )

Buggy submission (verdict: Runtime Error):

class ABC109Solver():
    def __init__(self):
        self.a = int()
        self.b = int()
    def input(self, a, b):
        self.a = a
        self.b = b
    def solve(self):
        # return 'Yes'
        # return 'No' if self.b%2 == 0 else 'Yes'
        return 'No' if self.a%2 == 0 or self.b%2 == 0 else 'Yes'
      
a = int(input())
b = int(input())
solver = ABC109Solver()

print( solver.solve() )

Buggy submission (verdict: Runtime Error):

class ABC109Solver():
    def __init__(self):
        self.a = int()
        self.b = int()

    def input(self, a, b):
        self.a = a
        self.b = b

    def solve(self):
        # return 'Yes'
        # return 'No' if self.b%2 == 0 else 'Yes'
        return 'No' if self.a%2 == 0 or self.b%2 == 0 else 'Yes'
      
a = input()
b = input()
solver = ABC109Solver()
solver.input(a, b)
print( solver.solve() )
Problem p02630 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
m = int(input())
t = [0] * (10 ** 5 + 1)
ans = sum(a)
for i in a:
    t[i] += 1
for i in range(m):
               b, c = map(int,input().split())
               #ans = sum([int(i) for i in a])
               ans -= b * t[b]
               ans += c * t[b]
               t[c] += t[b]
               t[b] = 0
               #ans = ans - a.count("b")(int("c")-int("b"))
               print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = map(str, input().split())
a = " ".join(a)

m = int(input())
for i in range(m):
               b, c = map(str,input().split())
               #ans = sum([int(i) for i in a])
               a=a.replace(b,c)
               a=a.replace(" ","+")
               
               print(eval(a))
Problem p02657 (python)

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

Buggy submission (verdict: Runtime Error):


n=int(input())
a=list(map(int,input().split()))
ans=1
for i in range(len(a)):
    ans*=a[i]
if ans > 10**18:
    print(-1)
else:
    print(ans)
Problem p02658 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
limit=10**18
a.sort()
result=a[0]
for k in a[1:]:
    result*=k
    if result > limit:
        print(-1)
        exit()
print(result)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
limit=10**18
a.sort()
result=A[0]
for k in A[1:]:
    result*=k
    if result > limit:
        print(-1)
        exit()
print(result)
Problem p02814 (python)

Fixed submission:
import math
import fractions
from functools import reduce
 
n, m = map(int, input().split())
a = list(map(int, input().split()))
a=[t//2 for t in a] # リストの要素を全て2で割る
 
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)
 
def lcm_list(numbers): # 最小公倍数を求める
    return reduce(lcm_base, numbers, 1)
 
def num_dev2(x): # 2で割り切れる回数をカウント
    return format(x, 'b')[::-1].find('1')
 
lcm = lcm_list(a)
q = m // lcm # mは最小公倍数で何回割れるか
 
count = 0
dev2 = num_dev2(a[0])
for i in range(1, n):
    if dev2 != num_dev2(a[i]): # リストの全ての要素の、2で割れる回数は等しいか？
        count += 1
        break
if count != 0:
    print(0)
else:
    print(math.ceil(q/2))

Buggy submission (verdict: Runtime Error):
import math
import fractions
from functools import reduce

n, m = map(int,input().split())
a = list(map(int,input().split()))
a = [t // 2 for t in a]#リストの要素すべてを2で割る

def lcm_base(x, y):
    return (x * y)//math.gcd(x,y)

def lcm_list(numbers): #最小公倍数を求める
    return reduce(lcm_base, numbers, 1)

def num_dev2(x):
    return bin(x)[::-1].find("1") #２で割り切れる回数を確認

lcm = lcm_list(a)
q = m//lcm #mは最小公倍数で何回割れるか

count = 0
dev2 = num_dev2(a[0])
for i in range(1,n):
    if dev2 != num_dev2(a[i]):#リストのすべての要素の２で割れる回数は等しいか
        count += 1
        break
if count != 0:
    print(0)
else:
    print(math.ceil(q/2))

Buggy submission (verdict: Runtime Error):
import math
import fractions
from functools import reduce

n, m = map(int,input().split())
a = list(map(int,input().split()))
a = [x // 2 for x in a]#リストの要素すべてを2で割る

def lcm_base(x, y):
    return (math.gcd(x, y))

def lcm_list(numbers): #最小公倍数を求める
    return reduce(lcm_base, numbers, 1)

def num_dev2(x):
    return bin(x)[::-1].find("1") #２で割り切れる回数を確認

lcm = lcm_list(a)
q = m #lcm,mは最小公倍数で何回割れるか

count = 0
dev2 = num_dev2(a[0])
for i in range(1,n):
    if dev2 != num_dev2(a[i]):#リストのすべての要素の２で割れる回数は等しいか
        count += 1
        break
if count != 0:
    print(0)
else:
    print(math.ceil(q/2))
Problem p02952 (python)

Fixed submission:
N=int(input())
ans=0
for i in range(1,N+1):
    if len(str(i))%2==1:
        ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
#<B>
N = input()
ans = 0
for i in range(1, int(N + 1)):
    if len(str(i)) % 2 != 0:
        ans += 1

print(ans)
Problem p03281 (python)

Fixed submission:
N=int(input())
ans=0
for i in range(1,N+1,2):
    a=0
    for j in range(1,i+1):
        if i%j==0:
            a+=1
            if a==8:
                ans+=1

print(ans)

Buggy submission (verdict: Runtime Error):
import sympy
N=int(input())
ans=0
a=0
for i in range(1,N+1,2):
    for j in range(1,i+1):
        if i%j==0:
            a+=1
            if a==8:
                ans+=1

print(ans)
Problem p03371 (python)

Fixed submission:
#<100q.全探索（計算量注意）>
a, b, c, x, y = map(int,input().split())
ans1 = a * x + b * y
if x <= y:
    ans2 = c * 2 * x + b * (y - x)
    ans5 = c * 2 * y
else:
    ans2 = c * 2 * y + a * (x - y)
    ans5 = c * 2 * x
ans3 = a * x + c * 2 * y
ans4 = b * y + c * 2 * x
##print(ans1)
##print(ans2)
##print(ans3)
##print(ans4)
##print(ans5)
print(min(ans1,ans2, ans3, ans4, ans5))

Buggy submission (verdict: Runtime Error):
#<全探索>
#<ABC95C>
A,B,C,X,Y = map(int,input().split())
ans1 = A*X + B* Y
ans2=0
if X > Y:
    ans2= C * 2 * Y + A * (X-Y)
else:
    ans2= C * 2 * X + A * (Y-X)

ans3 = 0
if X > Y:
    ans3 = C * 2 * X
else:
    ans3 = C * 2 * Y
ans4=float("inf")
for i in range(2,min(X, Y),2):
    ans4=min(ans4,C * i + A * (x- i) + B *(Y-i))
    
print(min(ans1,ans2,ans3,ans4))
Problem p03752 (python)

Fixed submission:

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from itertools import combinations
N, K = map(int, input().split())
A = list(map(int, input().split()))
mn = 10**18
for B in combinations(range(1,N),K-1): # 一番左は固定
    mx = A[0] # 初期値は一番左の建物
    score = 0
    for n in range(1,N):
        if n in B: # 見えるようにすべき建物なら
            if A[n] <= mx: # 低ければ高くする
                mx += 1
                score += (mx - A[n])
            else: # 高さが十分なら何もしない。最大値を更新
                mx = A[n]
        else:
            mx = max(mx, A[n]) # 見えなくても良い建物なら、最大値を更新
    mn = min(mn, score)
print (mn)

Buggy submission (verdict: Runtime Error):
#<14>
#(point)
#全探索によってどの建物が見えるようにするかを決めて必要な費用を計算。
#建物が見える =　それより左にある建物maxより１大きいなので左から線形に
#最大値を更新、計算量は高々n_c_kのcombについてO(N)の操作なのでおｋ
from itertools import combinations
n, k = map(int,input().split())
a = list(map(int,input().split()))
mn = 10 ** 18

for b in combinations(range(1, n),k - 1):#一番左は固定
    mx = a[0] #初期値=一番左の建物
    score = 0
    for j in range(1, n):
        if j in b:#見えなあかん建物なら
            if a[j] <= mx : #低けりゃ高くする
                mx += 1
                score += (mx - a[j])
            else: #高さが十分なら最大値を更新するだけ
                mx = a[n]
        else:
            mx = max(mx, a[j])#別に見えんくてもいい建物なら最大値更新
    mn = min(mn, score)
print(mn)
Problem p02601 (python)

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

while k > 0:
    if a >= b:
        b *= 2
        k -= 1
    else:
        c *= 2
        k -= 1

if b > a and c > b:
    print('Yes')
else:
    print('No')

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

while k > 0:
    if a >= b:
        b *= 2
        k -= 1
    else
        c *= 2
        k -= 1

if b > a and c > b:
    print('Yes')
else:
    print('No')
Problem p02614 (python)

Fixed submission:
from itertools import product

h,w,k = map(int, input().split())
grid = [input() for _ in range(h)]

ans = 0
for row in product([0,1], repeat=h):
    for col in product([0,1], repeat=w):
        cnt = 0
        for i in range(h):
            if row[i] == 1:
                continue
            for j in range(w):
                if col[j] == 1:
                    continue
                if grid[i][j] == '#':
                    cnt += 1
        if cnt == k:
            ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
h,w,k = map(int, input().split())
c = [list(input()) for _ in range(h)]
kaito = 0

def kako(a,b):
    global h,w
    d = [0]*(h - len(a))
    e = [0]*(w - len(b))
    d.append(a)
    e.append(b)
    a = d
    b =e

def hantei(a,b):
    global k,kaito,h,w
    ans = 0
    for i in range(h):
        for j in range(w):
            if a[i] == '1' and b[j] == '1' and c[i][j] == '#':
                ans += 1
    if ans == k:
        kaito += 1
    

for i in range(2**h):
    for j in range(2**w):
        a = list(bin(i))
        b = list(bin(j))
        a = a[2:]
        b = b[2:]
        kako(a,b)
        hantei(a,b)

print(kaito)
Problem p02683 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 6)

n,m,x = map(int, input().split())
c = [list(map(int, input().split())) for _ in range(n)]

def dfs(asum, b):
    global n, m, x
    rst = 10 ** 8
    if b == n:
        if all(asum[i] >= x for i in range(1, m + 1)):
            rst = asum[0]
    else:
        rst = min(rst, dfs(asum, b+1))
        asum2 = tuple(asum[i] + c[b][i] for i in range(m + 1))
        rst = min(rst, dfs(asum2, b+1))

    return rst

rst = dfs(tuple([0] * (m + 1)), 0)
ans = rst if rst < 10 ** 8 else -1
print(ans)

Buggy submission (verdict: Runtime Error):
n, m, x = map(int, input().split())
c = [[0]*m] *n
for i in range(n):
    c[i] = list(map(int, input().split()))
ans = 1000000
shoki = [0] * (m + 1)



def check(xxx):
    tmp = 0
    for i in range(1,m):
        if x > xxx[i]:
            tmp = 1
    if tmp == 0:
        return True
    else:
        return False

def tashi(g,h):
    shoki = [0] * (m + 1)
    for i in range(m+1):
        shoki[i] = g[i] + h[i]
    return shoki
        

def aaa(asum,b):
    if check(asum):
        ans = min(ans, asum[0]) 
        return True
    if b == n:
        return False
    if aaa(asum, b+1):
        return check(asum)
    if aaa(tashi(asum,c[b]),b+1):
        return check(asum)


if aaa(shoki, 0):
    print(ans)
else:
    print(-1)
Problem p02744 (python)

Fixed submission:
n = int(input())

def dfs(s, mx):
    if len(s) == n:
        print(s)
    else:
        for i in range(0, mx +1):
            c = chr(ord('a')+i)
            dfs(s+c, mx +1) if i == mx else dfs(s+c, mx)

dfs('', 0)

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

def dfs(s, mx):
    if len(s) == n:
        print(s)
    else:
        for i in range(0, mx +1):
            c = chr(ord('a')+i)
            dfs(s+c, mx +1) if i == mx else dfs(s+c, mx)

df('', 0)
Problem p02778 (python)

Fixed submission:
s = input()
length = len(s)

ans = ''

for i in range(length):
    ans += 'x'

print(ans)

Buggy submission (verdict: Runtime Error):
sardine
Problem p02630 (python)

Fixed submission:
N = int(input())
A = {}
ans = 0
for a in input().split():
    a = int(a)
    if a not in A:
        A[a] = 1
    else:
        A[a] += 1
    ans += a
    
Q = int(input())
for i in range(Q):
    B, C = map(int, input().split())
    if B in A:
        ans += (C-B) * A[B]
        if C not in A:
            A[C] = A[B]
        else:
            A[C] += A[B]
        A[B] = 0
        print(ans)
    else:
        print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = {}
ans = 0
for a in input().split():
    a = int(a)
    if a not in A:
        A[a] = 1
    else:
        A[a] += 1
    ans += a
    
Q = int(input())
for i in range(Q):
    B, C = map(int, input().split())
    ans += (C-B) * A[B]
    if C not in A:
        A[C] = A[B]
    else:
        A[C] += A[B]
    A[B] = 0
    print(ans)
Problem p02642 (python)

Fixed submission:
from collections import Counter

N = int(input())
A = [int(i) for i in input().split()]
num = set(A)
count = Counter(A)
dp = [True] * (10**6 + 1)

for a in num:
    for n in range(a+a, 10**6+1, a):
        dp[n] = False

ans = 0
for a in num:
    if count[a] == 1 and dp[a] == True:
        ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np

N = int(input())
A = sorted([int(i) for i in input().split()])
a = collections.Counter(A)
A = np.array([i[0] for i in a.items() if i[1] == 1])

if len(A) == 0:
    print(0)
else:
    dp = np.array([True for i in range(A[-1])])
    dp[:A[0]-1] = False
    ans = 0
    for i in range(A[-1]):
        if i+1 in A and dp[i] == True:
            n = i+1
            dp[A[np.where(A % n == 0)[0]]-1] = False
            dp[i] = True
        else:
            dp[i] = False
    print(np.sum(dp))

Buggy submission (verdict: Runtime Error):
import collections

N = int(input())
A = sorted([int(i) for i in input().split()])

limit = int(A[-1] ** 0.5)
ans = 0
while limit > A[0]:
    if len(A) == 1:
        ans += 1
    elif A[0] != A[1]:
        ans += 1
    A = [i for i in A if i % A[0] != 0]
    
a = collections.Counter(A)
print(ans + len([i[0] for i in a.items() if i[1] == 1]))

Buggy submission (verdict: Runtime Error):
N = int(input())
A = sorted([int(i) for i in input().split()])

ls = []
for i in range(N):
    if A.count(A[i]) == 1:
        ls.append(A[i])

if len(ls) == 0:
    print(0)
else:
    limit = int(ls[-1] ** 0.5)
    ans = 0
    while limit > ls[0]:
        if len(ls) == 1:
            ans += 1
        elif ls[0] != ls[1]:
            ans += 1
        ls = [i for i in ls if i % ls[0] != 0]
    
    print(ans+len(ls))