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

Fixed submission:
import math
 
def gcd(a,b):
  if b == 0:
    return a
  else:
    return gcd(b, a % b)

A, B = map(int, input().split(" "))
if A >= B:
  C = gcd(A,B)
else:
  C = gcd(B,A)

c = math.ceil(math.sqrt(C)) + 1
l = [1]
f = [1] + [0]*c

for i in range(2,c+1):
  if f[i-1] == 0:
    f[i-1] = 1
    if C % i == 0:
      l.append(i)
      while C % i == 0:
        C //= i
    for j in range(i+i, c+1, i):
      f[j-1] = 1

if C > 1:
  l.append(C)

print(len(l))

Buggy submission (verdict: Runtime Error):
import math
 
def gcd(a,b):
  if b == 0:
    return a
  else:
    return gcd(b, a % b)
 
A, B = map(int, input().split(" "))
if A >= B:
  C = gcd(A,B)
else:
  C = gcd(B,A)

c = math.ceil(math.sqrt(C)) + 1
l = [1]
f = [1] + [0]*c

for i in range(2,c+1):
  if f[i-1] == 0:
    f[i-1] = 1
    if C % i == 0:
      l.append(i)
      while C % i == 0:
        C //= i
    for j in range(i+i, c+1, i):
      f[j-1] = 1
      
if C > 1:
  l.appned(C)

print(len(l))

Buggy submission (verdict: Runtime Error):
import math
 
def gcd(a,b):
  if b == 0:
    return a
  else:
    return gcd(b, a % b)

A, B = map(int, input().split(" "))
if A >= B:
  C = gcd(A,B)
else:
  C = gcd(B,A)

#c = math.ceil(math.sqrt(C)) + 1
l = [1]
f = [0]*C
ans = 0
 
for i in range(2,C+1):
  if f[i-1] == 0:
    f[i-1] = 1
    if C % i == 0:
      l.append(i)
    for j in range(i+i, C+1, i):
      f[j-1] = 1

print(len(l))

Buggy submission (verdict: Runtime Error):
import math
 
def gcd(a,b):
  if b == 0:
    return a
  else:
    return gcd(b, a % b)

A, B = map(int, input().split(" "))
if A >= B:
  C = gcd(A,B)
else:
  C = gcd(B,A)

#c = math.ceil(math.sqrt(C)) + 1
l = [1]
f = [0]*C
ans = 0
 
for i in range(2,C+1):
  if f[i-1] == 0:
    f[i-1] = 1
    l.append(i)
    for j in range(i+i, C+1, i):
      f[j-1] = 1

for i in l:
  if C % i == 0:
    ans += 1

print(ans)
Problem p02909 (python)

Fixed submission:
n = input()
weather = {0:"Sunny", 1:"Cloudy", 2:"Rainy"}

           
for k, v in weather.items():
  if v == n:
    nk = k
    break

nk = (nk+1) % 3

print(weather[nk])

Buggy submission (verdict: Runtime Error):
from collections import deque
import bisect

N, M = map(int, input().split(" "))
As = [0]+list(map(int, input().split(" ")))
As = sorted(As)
cnt = 0
cnt2 = 1
for _ in range(M):
  i = As[-1-cnt]  
  i = i//(2**cnt2)
  if i < As[-1-cnt-1]:
    cnt += 1
    cnt2 = 1
    bisect.insort_left(As,i)
  else:
    cnt2 += 1

print(sum(As[:-cnt]))

Buggy submission (verdict: Runtime Error):
import bisect
import sys

def input():
  return sys.stdin.readline()

weather = {0:"Sunny", 1:"Cloudy", 2:"Rainy"}
n = input()
           
for k, v in weather.items():
  if v == n:
    nk = k
    break

nk = (nk+1) % 3

print(weather[nk])

Buggy submission (verdict: Runtime Error):
import bisect
import sys

def input():
  return sys.stdin.readline()

weather = {0:"Sunny", 1:"Cloudy", 2:"Rainy"}
n = input()
           
for k, v in weather.items():
  if v == n:
    nk = k
    break

nk = (nk+1) % 3

print(weather[nk])

Buggy submission (verdict: Runtime Error):
import bisect
import sys

def input():
  return sys.stdin.readline()

weather = {0:"Sunny", 1:"Cloudy", 2:"Rainy"}
n = input()
           
for k, v in weather.items():
  if v == n:
    nk = k
    break

nk = (nk+1) % 3

print(weather[nk])
Problem p02936 (python)

Fixed submission:
N, Q = map(int, input().split(" "))
 
ns= [list(map(int, input().split(" ")))  for _ in range(N-1)]
vs = [list(map(int, input().split(" ")))  for _ in range(Q)]

dic = [[] for _ in range(N)]
rlt = [0]*N


for i in range(N-1):
  dic[ns[i][0]-1] += [ns[i][1]-1]
  
for j in range(Q):
  rlt[vs[j][0]-1] += vs[j][1]
  
for k in range(N):
  for l in dic[k]:
    rlt[l] += rlt[k]
    
print(" ".join(map(str, rlt)))

Buggy submission (verdict: Runtime Error):
N, Q = map(int, input().split(" "))
 
ns= [list(map(int, input().split(" ")))  for _ in range(N-1)]
vs = [list(map(int, input().split(" ")))  for _ in range(Q)]
#ns = sorted(ns)
 
flags = [False]*N
dic = [[] for _ in range(N)]
rlt = [0]*N
 
for i in range(N-1):
  dic[ns[i][1]-1] += [ns[i][0]-1]
  dic[ns[i][0]-1] += [ns[i][1]-1]
  
for j in range(Q):
  rlt[vs[j][0]-1] += vs[j][1]
  
for k in range(N):
  flags[k] = Ture
  for l in dic[k]:
    if flags[l]:
      continue
    else:
      rlt[l] += rlt[k]
      flags[l] = Ture
    
print(" ".join(map(str, rlt)))
Problem p02963 (python)

Fixed submission:
import math

S = int(input())
t = math.sqrt(S)
a = b = math.ceil(t)

if a*(b-1) >= S:
  b -= 1

d = a*b - S
if d == 0:
  c = 0
else:
  c = 1
print("0 0 {} {} {} {}".format(a, c, d, b))

Buggy submission (verdict: Runtime Error):
import math

S = int(input())
t = math.sqrt(S)
a = b = math.ceil(t)

if a*(b-1) >= S:
  b -= 1

d = a*b - S
if d == 0:
  c = 0
print("0 0 {} {} {} {}".format(a, c, d, b))
Problem p03095 (python)

Fixed submission:
from collections import Counter

N = int(input())
S = input()
P = 10**9 + 7

dic = Counter(S)
rlt = 1

for k in dic:
  rlt = rlt*(dic[k]+1) % P
  
print(rlt-1)

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

N = int(input())
S = input()
P = 10**9 + 7

dic = Counter(S)
rlt = 1

for k in dic:
  rlt = rlr*(dic[k]+1) % P
  
print(rlt-1)
Problem p02573 (python)

Fixed submission:
import sys
sys.setrecursionlimit(4100000)
import math
import itertools
INF = float('inf')
from heapq import heapify, heappop, heappush
import collections


n,m = map(int, input().split())
par = [i for i in range(n)]
rank = [0]*n

def find(x):
    if par[x] == x:
        return x
    else:
        par[x] = find(par[x])
        return par[x]

def unite(x, y):
    x = find(x)
    y = find(y)
    if x == y:
        return
    if rank[x] < rank[y]:
        par[x] = y
    else:
        par[y] = x
        if rank[x] == rank[y]:
            rank[x] += 1

def main():
    for _ in range(m):
        a,b = map(int, input().split())
        unite(a-1,b-1)

    count = [0]*n
    for p in par:
        count[find(p)] += 1
    print(max(count))


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(4100000)
import math
import itertools
INF = float('inf')
from heapq import heapify, heappop, heappush
import collections


n,m = map(int, input().split())
par = [i for i in range(n)]
rank = [0]*n

def find(x):
    if par[x] == x:
        return x
    else:
        par[x] = find(par[x])
        return par[x]


def unite(x, y):
    x, y = root(x), root(y)
    if x == y: return
    par[x] = y

def main():
    for _ in range(m):
        a,b = map(int, input().split())
        unite(a-1,b-1)
    count = [0]*n
    for p in par:
        count[find(p)] += 1
    print(max(count))


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(4100000)
import math
import itertools
INF = float('inf')
from heapq import heapify, heappop, heappush
import collections


n,m = map(int, input().split())
par = [i for i in range(n)]
rank = [0]*n

def find(x):
    if par[x] == x:
        return x
    else:
        par[x] = find(par[x])
        return par[x]

def unite(x, y):
    x = find(x)
    y = find(y)
    if x == y:
        return
    if rank[x] < rank[y]:
        par[x] = y
    else:
        par[y] = x
        if rank[x] == rank[y]:
            rank[x] += 1

def main():
    for _ in range(m):
        a,b = map(int, input().split())
        unite(a-1,b-1)

    count = [0]*n
    for p in par:
        count[par(p)] += 1
    print(max(count))


if __name__ == '__main__':
    main()
Problem p02639 (python)

Fixed submission:
import sys
sys.setrecursionlimit(4100000)
import math
INF = 10**9
import fractions

def main():
    X = list(map(int, input().split()))

    ans = 0
    for i in range(5):
        if X[i]==0:
            if i==4:
                ans = X[i-1]+1
                print(ans)
                return
            ans = X[i+1]-1
            print(ans)
            return



if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(4100000)
import math
INF = 10**9
import fractions

def main():
    n = int(input())
    A = list(map(int, input().split()))

    A.sort()
    ans = len(A)
    if n == 1:
        print(1)
        return
    for i in range(n):
        for j in range(n):
            ri = -i-1
            r = A[ri]
            l = A[j]

            if (ri!=-n and r == A[ri-1]) or (j!=n-1 and r == A[ri+1]):
                ans -= 1
                break
            if n+ri == j:
                break
            if r % l == 0:
                ans -= 1
                break
            if l >= r**(1/2):
                break
    print(ans)


if __name__ == '__main__':
    main()
Problem p02641 (python)

Fixed submission:
import sys
sys.setrecursionlimit(4100000)
import math
INF = 10**9
import fractions

def main():
    x,n = map(int, input().split())
    P = list(map(int, input().split()))

    ans = INF
    array = set(range(x-n-1,x+n+1))
    array = array - set(P)
    array = list(array)
    for i in range(len(array)):
        ans = min(ans, abs(array[i]-x))
    if (x-ans) in P:
        print(x+ans)
    else:
        print(x-ans)




if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(4100000)
import math
INF = 10**9
import fractions

def main():
    n = int(input())
    A = list(map(int, input().split()))

    A.sort()
    ans = len(A)
    if n == 1:
        print(1)
        return
    for i in range(n):
        for j in range(n):
            ri = -i-1
            r = A[ri]
            l = A[j]
            if (ri!=-n and r == A[ri-1]) or (i!=n-1 and r == A[ri+1]):
                ans -= 1
                break
            if n+ri == j:
                break
            if r % l == 0:
                ans -= 1
                break
            if l >= r**(1/2):
                break
    print(ans)


if __name__ == '__main__':
    main()
Problem p02687 (python)

Fixed submission:
def main():
    S = input()

    if S=='ABC':
        print('ARC')
    else:
        print('ABC')


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n,m = map(int, input().split())
    H = list(map(int,input().split()))
    # array = [list(map(int,input().split())) for _ in range(m)]
    pool = set(range(1, n+1))

    for i in range(m):
        a,b = map(int,input().split())
        # a,b = array[i]
        if H[a-1] < H[b-1]:
            pool = pool - set([a])
        else:
            pool = pool - set([b])

    print(len(pool))


if __name__ == '__main__':
    main()
Problem p02786 (python)

Fixed submission:
import math

def main():
    h = int(input())
    n = math.floor(math.log(h,2))
    print(2**(n+1)-1)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import math

def main():
    h = int(input())
    n = math.floor(math.log2(h))
    print(2**(n+1)-1)


if __name__ == '__main__':
    main()
Problem p02802 (python)

Fixed submission:
import sys
sys.setrecursionlimit(4100000)
import math
INF = 10**9

def main():
    n,m = map(int, input().split())
    wa = 0
    ac = 0
    used = {}
    wa_tmp = {}
    for _ in range(m):
        p,s = map(str, input().split())
        if used.get(p):
            continue
        if s == 'WA':
            if not wa_tmp.get(p):
                wa_tmp[p] = 0
            wa_tmp[p] += 1
        if s == 'AC':
            ac += 1
            used[p] = True
            if wa_tmp.get(p):
                wa += wa_tmp[p]
    print(ac, wa)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(4100000)
import math
INF = 10**9

def main():
    n,m = map(int, input().split())
    wa = 0
    ac = 0
    used = {}
    wa_tmp = {}
    for _ in range(m):
        p,s = map(str, input().split())
        if used.get(p):
            continue
        if s == 'WA':
            if not wa_tmp.get(p):
                wa_tmp[p] = 0
            wa_tmp[p] += 1
        if s == 'AC':
            ac += 1
            used[p] = True
            wa += wa_tmp[p]
    print(ac, wa)


if __name__ == '__main__':
    main()
Problem p02995 (python)

Fixed submission:
import fractions

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)


def main():
    a,b,c,d = map(int,input().split())
    c_mul_count = b//c - (a-1)//c
    d_mul_count = b//d - (a-1)//d
    cd_lcm = lcm(c, d)
    lcm_mul_count = b//cd_lcm - (a-1)//cd_lcm
    s = b-a+1
    print(s-c_mul_count-d_mul_count+lcm_mul_count)



if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import math

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


def main():
    a,b,c,d = map(int,input().split())
    c_mul_count = b//c - (a-1)//c
    d_mul_count = b//d - (a-1)//d
    cd_lcm = lcm(c, d)
    lcm_mul_count = b//cd_lcm - (a-1)//cd_lcm
    s = b-a+1
    print(s-c_mul_count-d_mul_count+lcm_mul_count)



if __name__ == '__main__':
    main()
Problem p03260 (python)

Fixed submission:
def main():
    a,b = map(int,input().split())
    if a%2!=0 and b%2!=0:
        print('Yes')
        return
    print('No')


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    a,b = map(int,input().split())
    if a%2!=0 and b%2!=0:
        print('Yes')
        return
    print('No')


if __name __ == '__main__':
    main()
Problem p03266 (python)

Fixed submission:
def main():
    n,k = map(int, input().split())

    ans = (n//k)**3
    if k%2 == 0:
        ans += ((n+k//2)//k)**3
    print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n,k = map(int, input().split())

    ans+= pow(N//K,3)
    if k%2 == 0:
        ans = pow((n-k//2)//k, 3)
    print(ans)


if __name__ == '__main__':
    main()
Problem p03273 (python)

Fixed submission:
def main():
    h,w = map(int, input().split())

    A = []
    grid = []
    for i in range(h):
        A.append(input())
    gird = []

    for i in range(h):
        if A[i] != '.'*w:
            grid.append(A[i])

    A = grid.copy()
    w_tmp = len(A[0])
    h_tmp = len(A)
    grid = ['' for _ in range(h_tmp)]
    for i in range(w_tmp):
        tmp = 0
        for j in range(h_tmp):
            if A[j][i] == '.':
                tmp += 1
        if tmp != h_tmp:
            for j in range(h_tmp):
                grid[j] += A[j][i]
    for i in range(len(grid)):
        print(grid[i])


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    h,w = map(int, input().split())

    A = []
    grid = []
    for i in range(h):
        A.append(input())
    gird = []

    for i in range(h):
        if A[i] != '.'*w:
            grid.append(A[i])

    A = grid.copy()
    w_tmp = len(A[0])
    h_tmp = len(A)
    grid = ['' for _ in range(h_tmp)]
    for i in range(w_tmp):
        tmp = 0
        for j in range(h_tmp):
            if A[j][i] == '.':
                tmp += 1
        if tmp != h_tmp:
            for j in range(h_tmp):
                grid[j] += A[j][i]
    for i in range(len(grid)):
        print(grid[i])


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    h,w = map(int, input().split())

    A = []
    grid = []
    for i in range(h):
        A.append(input())
    gird = []

    for i in range(h):
        if A[i] != '.'*w:
            grid.append(A[i])

    A = grid.copy()
    w_tmp = len(A[0])
    h_tmp = len(A)
    grid = ['' for _ in range(h_tmp)]
    for i in range(w_tmp):
        tmp = 0
        for j in range(h_tmp):
            if A[j][i] == '.':
                tmp += 1
        if tmp != h_tmp:
            for j in range(h_tmp):
                grid[j] += A[j][i]
    for i in range(len(grid)):
        print(grid[i])


if __name__ == '__main__':
    main()
Problem p03274 (python)

Fixed submission:
def main():
    n,k = map(int, input().split())
    X = list(map(int, input().split()))

    tmp = []
    for i in range(n-k+1):
        l = X[i]
        r = X[i+k-1]
        tmp.append(abs(l)+abs(r-l))
        tmp.append(abs(r)+abs(r-l))
    print(min(tmp))


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n,k = map(int, input().split())
    X = list(map(int, input().split()))

    for i,x in enumerate(X):
        if max(X) < 0:
            array_m = X.copy()
            array_p = []
            break
        if x >= 0:
            array_m = X[:i]
            array_p = X[i:]
            break
    inf = 10**9
    array_m = [inf] + array_m
    array_p += [inf]
    array_m2 = [abs(2*x) for x in array_m]
    array_p2 = [abs(2*x) for x in array_p]
    count = 0
    array_m_tmp = []
    array_p_tmp = []
    for _ in range(k):
        if array_m2[-1] < array_p[0]:
            array_m_tmp.append(array_m2.pop(-1))
        else:
            array_p_tmp.append(array_p.pop(0))
    array_m_tmp.append(0)
    array_p_tmp.append(0)
    ans = max(array_m_tmp) + max(array_p_tmp)
    print(ans)


if __name__ == '__main__':
    main()
Problem p03353 (python)

Fixed submission:
def main():
    S = input()
    k = int(input())

    array = []
    for i in range(len(S)):
        for j in range(i+1,len(S)+1):
            if j-i <= k:
                array.append(S[i:j])
    array = list(set(array))
    array.sort()
    print(array[k-1])


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    S = input()
    k = int(input())

    array = []
    for i in range(len(S)):
        for j in range(i+1,len(S)+1):
            if j-i < k:
                array.append(S[i:j])
    array = list(set(array))
    array.sort()
    print(array[k-1])


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    S = input()
    k = int(input())

    array = []
    for i in range(len(S)):
        for j in range(i+1,len(S)+1):
            if j-i < len(S):
                array.append(S[i:j])
    array = list(set(array))
    array.sort()
    print(array[k-1])


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    S = input()
    k = int(input())

    array = []
    for i in range(len(S)):
        for j in range(i+1,len(S)+1):
            if j-i < len(S):
                array.append(S[i:j])
    array = list(set(array))
    array.sort()
    print(array[k-1])


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    S = input()
    k = int(input())

    array = []
    for i in range(len(S)):
        for j in range(i+1,len(S)+1):
            array.append(S[i:j])
    array = list(set(array))
    array.sort()
    print(array[k-1])


if __name__ == '__main__':
    main()
Problem p03386 (python)

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

    array = range(a,b+1)
    ans = list(set(array[:k]) | set(array[-k:]))
    ans.sort()
    for val in ans:
        print(val)


if __name__ == '__main__':
    main()

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

    array = list(range(a,b+1))
    ans = list(set(array[:k]) | set(array[-k:]))
    ans.sort()
    for val in ans:
        print(val)


if __name__ == '__main__':
    main()

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

    array = list(range(a,b+1))
    ans = list(set(array[:k]) | set(array[-k:]))
    ans.sort()
    for val in ans:
        print(val)


if __name__ == '__main__':
    main()

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

    array = list(range(a,b+1))
    ans = list(set(array[:k]) | set(array[-k:]))
    ans.sort()
    for val in ans:
        print(val)


if __name__ == '__main__':
    main()
Problem p03424 (python)

Fixed submission:
def main():
    n = int(input())
    S = input()

    if 'Y' in S:
        print('Four')
    else:
        print('Three')


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n = int(input())
    S = list(map(int,input().split()))

    if 'Y' in S:
        print('Four')
    else:
        print('Three')


if __name__ == '__main__':
    main()
Problem p03455 (python)

Fixed submission:
import sys
sys.setrecursionlimit(4100000)
import math
INF = 10**9

def main():
    a,b = map(int,input().split())

    if a*b%2 == 0:
        print('Even')
    else:
        print('Odd')


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(4100000)
import math
INF = 10**9

def main():
    a,b = map(str,input().split())

    if a*b%2 == 0:
        print('Even')
    else:
        print('Odd')


if __name__ == '__main__':
    main()
Problem p03544 (python)

Fixed submission:
def main():
    n = int(input())

    array = [2,1]
    for i in range(100):
        array.append(array[i]+array[i+1])
    print(array[n])


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n = input()

    array = [2,1]
    for i in range(100):
        array.append(array[i]+array[i+1])
    print(array[n])


if __name__ == '__main__':
    main()
Problem p03738 (python)

Fixed submission:
import sys
sys.setrecursionlimit(4100000)
import math
import itertools
INF = float('inf')
from heapq import heapify, heappop, heappush

def main():
    a = int(input())
    b = int(input())

    if b < a:
        print('GREATER')
    elif a == b:
        print('EQUAL')
    else:
        print('LESS')


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(4100000)
import math
import itertools
INF = float('inf')
from heapq import heapify, heappop, heappush

def main():
    a = int(input())
    b = int(input())

    if b < a:
        prnit('GREATER')
    elif a == b:
        print('EQUAL')
    else:
        print('LESS')


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(4100000)
import math
import itertools
INF = float('inf')
from heapq import heapify, heappop, heappush

def main():
    a,b = map(int, input().split())

    if b < a:
        prnit('GREATER')
    elif a == b:
        print('EQUAL')
    else:
        print('LESS')


if __name__ == '__main__':
    main()
Problem p02642 (python)

Fixed submission:
#import numpy as np
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left, bisect_right #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep='\n')

N = int(input())
A = list(map(int, input().split()))
A.sort()
C = Counter(A)
S = set(A)

maxA = A[-1]
chk = [0] * (maxA+1)
for s in S:
    for i in range(s, maxA+1, s):
        chk[i] += 1

res = [s for s in S if chk[s] == 1 and C[s] == 1]
# print(res)
print(len(res))

Buggy submission (verdict: Runtime Error):
#import numpy as np
import sympy as sp
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep='\n')

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

num = defaultdict(int)
ans = defaultdict(int)
for i, a in enu(A):
    if num[a] > 0:
        num[a] += 1
        continue

    divs = sp.divisors(a)
    # print('divs', divs)
    for div in divs:
        if num[div] > 0:
            break
    else:
        ans[a] += 1
    num[a] += 1

cnt = 0 
# print(num)
# print(ans)
for an in ans.items():
    k, v = an
    if num[k]==1:
        cnt += 1
print(cnt)