TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: Given is a number sequence A of length N.  Find the number of integers i \left(1 \leq i \leq N\right) with the following property:    * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i.

Submission attempts (in order):
#170D
def main():
    import sys
    from collections import deque
    N = int(sys.stdin.readline())
    A = list(map(int, sys.stdin.readline().split()))
    A = list(set(A))
    A.sort(reverse=True)
    A = deque(A)
    def era(A):
        if len(A)==1:
            print(0)
            return
        for i in range(len(A)):
            for j in range(len(A)-1, i, -1):
                if A[i] % A[j]==0:
                    #print(A[j], A[i])
                    A.popleft()
                    break
        print(len(A))
                    
                
    
    era(A)


if __name__=='__main__':
    main()

#170D
def main():
    import sys
    from collections import Counter
    import random
    N = int(sys.stdin.readline())
    A = list(map(int, sys.stdin.readline().split()))
    #A = [random.randint(1, 10**6+1) for _ in range(2*(10**5))]
    judge = [0 for _ in range(10**6+1)]
    A.sort()
    B = Counter(A)
    for a in A:
        judge[a] =1
    for a in A:
        if judge[a] ==1:
            if B[a] >=2:
                judge[a] = 0
            for i in range(2*a, 10**6+1, a):
                judge[i] = 0
                
    print(judge.count(1))

if __name__=='__main__':
    main()

Verdicts: Wrong Answer

Accepted
Problem: Given is a number sequence A of length N.  Find the number of integers i \left(1 \leq i \leq N\right) with the following property:    * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i.

Submission attempts (in order):
N  =int(input())
X = [int(i) for i in input().split()]
Y = sorted(X)
count=0

ANS=[]
for i in  range(N):
    for j in range(N):
        if Y[i]!=Y[j]:
            if Y[i]%Y[j]==0:
                if Y[i] not in ANS:
                    ANS.append(Y[i])
                    # print("i",Y[i])
                    # print("j",Y[j])
                # ANS.append(Y[j])
         
for i in range(len(ANS)):
    if ANS[i] in Y:
        # print(ANS)
        count=count+1

print(count)

N = int(input())
A = list(map(int, input().split()))
A.sort()                  
Amax = A[-1]
dp = [1]*(Amax+1)         
ans = 0
for i in range(len(A)-1):
  p = A[i]
  if dp[p] == 1:          
    for q in range(Amax//p+1):
      dp[p*q] = 0         
    if A[i] != A[i+1]: 
      ans += 1            
if dp[Amax] == 1:         
  ans += 1
print(ans)


Verdicts: Wrong Answer

Accepted
Problem: Given is a number sequence A of length N.  Find the number of integers i \left(1 \leq i \leq N\right) with the following property:    * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i.

Submission attempts (in order):
from copy import deepcopy
N = int(input())
A = list(map(int,input().split()))
count = 0
Aas = sorted(A)
for i,a in enumerate(A):
    flag = 0
    A2 = deepcopy(A)
    del A2[i]
    if a not in A2:
        for b in Aas:
            if a % b  == 0:
                flag = 1
                break
            if a/b < 1:
                break
    if flag == 0:
        count += 1
print(count)



from copy import deepcopy
N = int(input())
A = list(map(int,input().split()))
count = 0
Aas = sorted(A)
Ades = sorted(A,reverse=True)
for i,a in enumerate(A):
    flag = 0
    A2 = deepcopy(A)
    del A2[i]
    if a not in A2:
        for b in Aas:
            if a % b  == 0:
                flag = 1
                break
            if a/b < 1:
                break
        if flag == 0:
            count += 1
print(count)




N = int(input())
A = list(map(int,input().split()))
M = 1000001
cnt = [0]*M
ans = 0
for x in A:
    if cnt[x] != 0:
        cnt[x] = 2
        continue
    for i in range(x,M,x):
        cnt[i] += 1
for x in A:
    if cnt[x] == 1:
        ans += 1
print(ans)

    


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Given is a number sequence A of length N.  Find the number of integers i \left(1 \leq i \leq N\right) with the following property:    * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i.

Submission attempts (in order):
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

  
n = int(input())
a_list = list(sorted(list(map(int,input().split()))))
sosuu = []
hukusuu = []

for i in range(len(a_list)-1,0,-1):
  if a_list[i] == a_list[i-1]:
    hukusuu.append(i)
    hukusuu.append(i-1)
    
hukusuu = sorted(list(set(hukusuu)),reverse=True)
for i in hukusuu:
  a_list.pop(i)

if len(a_list) == 0:
  print(0)
else:
  for i in range(len(a_list)-1,-1):
    if len(factorization(a_list[i])) == 1:
      sosuu.append(a_list[i])
      a_list.pop(i)
  while len(a_list) != 0:
    num = a_list.pop()
    iranai = False
    for i in sosuu:
      if num % i == 0:
        iranai = True
        break
    if iranai == False:
      sosuu.append(num)

  print(len(sosuu))

n = int(input())
A = list(sorted(list(map(int,input().split()))))

D=set()
S=set()
for i in range(n):
    if A[i] in S:
        D.add(A[i])
    else:
        S.add(A[i])

biggest = max(S)
dp = [1 for i in range(biggest+1)]
for i in S:
  if i in D:
    dp[i] = 0
  for j in range(2*i,biggest+1,i):
    dp[j] = 0

ans = 0
for i in A:
  ans += dp[i]
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: Given is a number sequence A of length N.  Find the number of integers i \left(1 \leq i \leq N\right) with the following property:    * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i.

Submission attempts (in order):
n = int(input())
a = list(map(int, input().split()))
a.sort()
l = [True] * (10**6 + 1)
cnt = 0
for i in range(n):
  d = a[i]
  if l[d]:
    if i < n-1 and a[i] != a[i+1]:
      cnt += 1
    elif i == n-1:
      cnt += 1
    for j in range(d, 10**6 + 1, d):
      l[d] = False
print(cnt)

n = int(input())
a = list(map(int, input().split()))
a.sort()
l = [True] * (10**6 + 1)
cnt = 0
for i in range(n):
  d = a[i]
  if l[d]:
    if i < n-1 and a[i] != a[i+1]:
      cnt += 1
    elif i == n-1:
      cnt += 1
    for j in range(d, 10**6 + 1, d):
      l[j] = False
print(cnt)


Verdicts: Wrong Answer

Accepted
Problem: Given is a number sequence A of length N.  Find the number of integers i \left(1 \leq i \leq N\right) with the following property:    * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i.

Submission attempts (in order):
n = int(input())
lst = list(map(int,input().split()))
dct = {}
for i in lst:
    dct[i] = dct.get(i, 0) + 1
ans = 0
for i in dct:
    ans += (dct[i] == 1)
print(ans)

n = int(input())
lst = list(map(int, input().split()))
lst.sort()
k = lst[-1]+1
dp = [0 for i in range(k)]
ans = 0
for i in lst:
    if dp[i] == 0:
        ans += 1
        dp[i] = 2
        for j in range(i*2, k, i):
            dp[j] = 1
    elif dp[i] == 2:
        dp[i] = 1
        ans -= 1
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: Given is a number sequence A of length N.  Find the number of integers i \left(1 \leq i \leq N\right) with the following property:    * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i.

Submission attempts (in order):
#D - Div Game
N = int(input())

def Prime_factorize(n):
    cnt = 0
    A = set()
    
    z = 2
    while n%2==0 and (n>=z):
        cnt += 1
        n //= z

        A.add(z)
        
        z *= 2
    
    f = 3
    z = 3
    
    while f*f <= n:
        if n%z == 0:
            cnt += 1
            n //= z
            A.add(z)
            
            
            z = z*f
        
        else:
            f += 2
            z = f

    
    if n != 1 and not(n in A):
        A.add(z)
        cnt += 1
    
    if cnt == 0:
        cnt = 1
    return cnt
if N == 1:
    ans = 0
else:
    ans = Prime_factorize(N)
print(ans)

#D - Div Game
N = int(input())

def Prime_factorize(n):
    cnt = 0
    A = set()
    
    z = 2
    while n%2==0 and (n>=z):
        cnt += 1
        n //= z

        A.add(z)
        
        z *= 2
    
    f = 3
    z = 3
    
    while f*f <= n:
        if n%z == 0:
            cnt += 1
            n //= z
            A.add(z)

            
            z = z*f
        
        else:
            f += 2
            z = f

    
    if n != 1 and not(n in A):
        A.add(z)
        cnt += 1
    
    if cnt == 0:
        cnt = 1
    return cnt
if N == 1:
    ans = 0
else:
    ans = Prime_factorize(N)
print(ans)

#D - Not Divisible
import collections
N = int(input())
a = list(map(int,input().split()))
a = sorted(a,reverse = False)


cnt = collections.Counter(a)
m = max(a)+1
for i in a:
    if cnt[i] >= 2:
        del cnt[i]
    for j in range(i*2,m,i):
        del cnt[j]
print(len(cnt.keys()))

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Given is a number sequence A of length N.  Find the number of integers i \left(1 \leq i \leq N\right) with the following property:    * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i.

Submission attempts (in order):
n=int(input())
a=list(map(int,input().split()))
a.sort()
m=a[n-1]
dp=[0]*(m)
ans=0
for i in a:
  for j in range(i,m+1,i):
    dp[j]+=1
for i in a:
  if dp[i]==1:
    ans+=1
print(ans)


n=int(input())
a=list(map(int,input().split()))
a.sort()
m=a[n-1]
dp=[0]*(m+1)
ans=0
for i in a:
  for j in range(i,m+1,i):
    dp[j]+=1
for i in a:
  if dp[i]==1:
    ans+=1
print(ans)

Verdicts: Runtime Error

Accepted
Problem: Given is a number sequence A of length N.  Find the number of integers i \left(1 \leq i \leq N\right) with the following property:    * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i.

Submission attempts (in order):
N = int(input())
A = list(map(int, input().split()))
M = 1000005
cnt = [0]*M
for a in A:
    if cnt[a]!=0:
        cnt[a]+=1
        continue
        
    for i in range(a, M, a):
        cnt[a]+=1
        
ans = 0
for a in  A:
    if cnt[a] == 1:
        ans+=1
print(ans)

N = int(input())
A = list(map(int, input().split()))
M = 1000005
cnt = [0]*M
for a in A:
    if cnt[a]!=0:
        cnt[a]+=1
        continue
        
    for i in range(a, M, a):
        cnt[i]+=1
        
ans = 0
for a in  A:
    if cnt[a] == 1:
        ans+=1
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: Given is a number sequence A of length N.  Find the number of integers i \left(1 \leq i \leq N\right) with the following property:    * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i.

Submission attempts (in order):
import numpy as np
N = int(input())
As = list(map(int, input().split(' ')))
As = np.unique(np.array(As))

divisible = np.sum(np.sum((As[None]%As[:,None])==0, 0)>1)
print(divisible)

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

max_a = max(a)
dp = [0] * (max_a + 1)

for i in a:
    dp[i] += 1
    if dp[i] ==1:
        for j in range(i, max_a+1, i):
            dp[j] += 1
dp.count(1)

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

max_a = max(a)
dp = [0] * (max_a + 1)

for i in a:
    for j in range(i, max_a+1, i):
        dp[j] += 1
        
print([dp[i] for i in a].count(1))

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: Given is a number sequence A of length N.  Find the number of integers i \left(1 \leq i \leq N\right) with the following property:    * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i.

Submission attempts (in order):
n = int(input())
ls = sorted(list(map(int, input().split())))
dead = []
for i in range(round(n ** 0.5) + 1):
    if ls[i] not in dead:
        for j in range(ls[i], ls[-1] + 1, ls[i]):
            if j in ls: 
                dead.append(j)

print(n - len(dead))


n = int(input())
ls = sorted(list(map(int, input().split())))
dp = [0] * (ls[-1] + 1)
for i in ls:
    dp[i] += 1
    if dp[i] == 1:
        for j in range(i*2, ls[-1] + 1, i):
            dp[j] += 2

print(dp.count(1))



Verdicts: Runtime Error

Accepted
Problem: Given is a number sequence A of length N.  Find the number of integers i \left(1 \leq i \leq N\right) with the following property:    * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i.

Submission attempts (in order):
n = int(input())
arr = [int(x) for x in input().split()]
d = {}
for x in arr:
  d[x] = d.get(x,0)+1

mxN = 10**6 + 1
rp = [True]*mxN


for i in range(2,len(rp)):
  if i not in d or not rp[i]:continue
  for j in range(i+i,mxN,i):
    if j in d: rp[j] = False

#reason for tle



for k,v in d.items():
  if v > 1:rp[k] = False

ans = sum([(1 if rp[x] else 0) for x in cset])
print(ans)





n = int(input())
arr = [int(x) for x in input().split()]
d = {}
for x in arr:
  d[x] = d.get(x,0)+1

mxN = 10**6 + 1
rp = [True]*mxN

if 1 in d:
  if d[1] > 1:
    print(0)
    exit()
  else:
    print(1)
    exit()
for i in range(2,len(rp)):
  if i not in d or not rp[i]:continue
  for j in range(i+i,mxN,i):
    if j in d: rp[j] = False

#reason for tle



for k,v in d.items():
  if v > 1:rp[k] = False

ans = sum([(1 if rp[x] else 0) for x in arr])
print(ans)





Verdicts: Runtime Error

Accepted
Problem: Given is a number sequence A of length N.  Find the number of integers i \left(1 \leq i \leq N\right) with the following property:    * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i.

Submission attempts (in order):
def main():
    N = int(input())
    A = list(map(int, input().split()))

    A.sort()

    ans = 1
    modlist = [A[0]]
    for i in range(1, N):
        flag = True
        for j, m in enumerate(modlist):
            if A[i] % m == 0:
                flag = False
                break
        if flag:
            ans += 1
            print(A[i])

    print(ans)


if __name__ == "__main__":
    main()


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

    A.sort()

    ans = 1
    modlist = [A[0]]
    for i in range(1, N):
        flag = True
        for j, m in enumerate(modlist):
            if A[i] % m == 0:
                flag = False
                break
        if flag:
            ans += 1

    print(ans)


if __name__ == "__main__":
    main()


from math import sqrt
from collections import Counter


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

    ans = 0
    p = [0] * (10**6 + 1)
    c = Counter(A)

    for a in c.keys():
        tmp = a * 2
        while tmp <= 10**6:
            p[tmp] = 1
            tmp += a

    for a in A:
        if p[a] == 0 and c[a] == 1:
            ans += 1

    print(ans)


if __name__ == "__main__":
    main()


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Given is a number sequence A of length N.  Find the number of integers i \left(1 \leq i \leq N\right) with the following property:    * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i.

Submission attempts (in order):
n=int(input())
a=list(map(int,input().split()))
m=max(a)
alsit=[0]*(m+1)
for i in a:
  for j in range(i,m+1,i):
    alist[j]+=1
cnt=0
for i in a:
  if alist[i]==1:
    cnt+=1
print(cnt)

n=int(input())
a=list(map(int,input().split()))
m=max(a)
alist=[0]*(m+1)
for i in a:
  for j in range(i,m+1,i):
    alist[j]+=1
cnt=0
for i in a:
  if alist[i]==1:
    cnt+=1
print(cnt)

Verdicts: Runtime Error

Accepted
Problem: Given is a number sequence A of length N.  Find the number of integers i \left(1 \leq i \leq N\right) with the following property:    * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i.

Submission attempts (in order):
s = list(map(int,input().split()))
t = s.pop(0)
s.sort()
c = 1
d = 0
for i in range(t):
  for k in range(0,i):
    if s[i]%s[k]==0:
      c = 0
      break
  if c == 1:
    d = d+1
print(d)
  
    

s = list(map(int,input().split()))
t = s.pop(0)
s.sort()
d = 0
for i in range(0,t):
  c = 1
  for k in range(0,i):
    if s[i]%s[k]==0:
      c = 0
      break
  if c == 1:
    d = d+1
print(d)
  
    


s = list(map(int,input().split()))
t = s.pop(0)
s.sort()
s.reverse()
c = 1
d = 1
for i in range(t):
  for k in range(i+1,t):
    if s[i]%s[k]==0:
      c = 0
      break
  if c == 1:
    d = d+1
print(d)
  
    


N = int(input())
A = list(map(int, input().split()))
M = 10**6 + 1
cnt = [0] * M
for a in A:
    if cnt[a] != 0:
        cnt[a] += 1
        continue
    for b in range(a, M, a):
        cnt[b] += 1
ans = 0
for a in A:
    if cnt[a] == 1:ans += 1
print(ans)


Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: Given is a number sequence A of length N.  Find the number of integers i \left(1 \leq i \leq N\right) with the following property:    * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i.

Submission attempts (in order):
N = int(input())
A = list(map(int, input().split()))
S = set(A)
M = max(S)
A.sort()

for a in A:
    if a == pre_a:
        S.discard(a)
    if a in S:
        j = a * 2
        while j <= M:
            S.discard(j)
            j += a
    pre_a = a
print(len(S))

N = int(input())
A = list(map(int, input().split()))
S = set(A)
M = max(S)
A.sort()

pre_a = 0
for a in A:
    if a == pre_a:
        S.discard(a)
    if a in S:
        j = a * 2
        while j <= M:
            S.discard(j)
            j += a
    pre_a = a
print(len(S))

Verdicts: Runtime Error

Accepted
Problem: Given is a number sequence A of length N.  Find the number of integers i \left(1 \leq i \leq N\right) with the following property:    * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i.

Submission attempts (in order):
import collections
n=int(input())
List=list(map(int,input().split()))
container=collections.Counter(List)
if(1 in container):
    if(container[1]==1):
        print(1)
    else:
        print(0)
else:
    List.sort()
    seive=[True]*(List[~0]+1)
    count=0
    for each in List:
        i=2
        if(seive[each]):
            while i*each<=List[~0]:
                seive[i*each]=False
                i+=1
            if container[each]==1:
                count+=1
    print(seive)
    print(count)


import collections
n=int(input())
List=list(map(int,input().split()))
container=collections.Counter(List)
if(1 in container):
    if(container[1]==1):
        print(1)
    else:
        print(0)
else:
    List.sort()
    seive=[True]*(List[~0]+1)
    count=0
    for each in List:
        i=2
        if(seive[each]):
            while i*each<=List[~0]:
                seive[i*each]=False
                i+=1
            if container[each]==1:
                count+=1
    print(seive)
    print(count)


import collections
def check(val):
  flag=1
  for v in range(2,val**.5+1):
    if(val%v==0):
      if(v in x or val//v in x):
        flag=0
        break
  if(flag):
    count+=1
n=int(input())
a=list(map(int,input().split()))
count=0
x=collections.Counter(a)
if(1 in x):
  if(x[1]==1):
    print(1)
  else:
    print(0)
else:
  for each in a:
    if(x[each]==1):
      check(each)
  print(count)
    

import collections
def check(val):
  global x
  global count
  flag=1
  for v in range(2,val**.5+1):
    if(val%v==0):
      if(v in x or val//v in x):
        flag=0
        break
  if(flag):
    count+=1
n=int(input())
a=list(map(int,input().split()))
count=0
x=collections.Counter(a)
if(1 in x):
  if(x[1]==1):
    print(1)
  else:
    print(0)
else:
  for each in a:
    if(x[each]==1):
      check(each)
  print(count)
    


import collections
def check(val):
  flag=1
  for v in range(2,int(val**0.5+1)):
    if(val%v==0):
      if(v in x or val//v in x):
        flag=0
        break
  if(flag):
    count+=1
n=int(input())
a=list(map(int,input().split()))
count=0
x=collections.Counter(a)
if(1 in x):
  if(x[1]==1):
    print(1)
  else:
    print(0)
else:
  for each in a:
    if(x[each]==1):
      check(each)
  print(count)
    



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

List.sort()
seive=[0]*(List[~0]+1)
count=0
for each in List:
    for i in range(each,List[-1]+1,each):
        seive[i]+=1
        
for each in List:
    if(seive[each]==1):
        count+=1


print(count)

Verdicts: Wrong Answer

Wrong Answer

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: Given is a number sequence A of length N.  Find the number of integers i \left(1 \leq i \leq N\right) with the following property:    * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i.

Submission attempts (in order):
def func(n, a):
    mx = max(a)
    x = [0] * (mx + 1) # len(x)
    for i in a:
        x[i] += 1
    for i in range(1, mx + 1):
        if x[i] != 0:
            for j in range(2 * i, mx + 1, i):
                x[j] = 0
        if x[i] > 1:
            x[i] = 0
    return sum(x) # 31401

n = int(input())
a = list(map(int, input().split()))
f(n, a)


x = [0] * 2 * 10**5


def func(n, a):
    mx = max(a)
    x = [0] * (mx + 1) # len(x)
    for i in a:
        x[i] += 1
    for i in range(1, mx + 1):
        if x[i] != 0:
            for j in range(2 * i, mx + 1, i):
                x[j] = 0
        if x[i] > 1:
            x[i] = 0
    print(sum(x)) # 31401

n = int(input())
a = list(map(int, input().split()))
func(n, a)


Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: Given is a number sequence A of length N.  Find the number of integers i \left(1 \leq i \leq N\right) with the following property:    * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i.

Submission attempts (in order):
import numpy as np

N = int(input())
x_list = np.array(list(map(int, input().split())), reverse=True)

count = 0
for xi in x_list:
  if np.sum(xi%x_list==0) == 1:
      count += 1
print(count)

import numpy as np

N = int(input())
a_list = list(map(int, input().split()))

num_array = np.zeros(max(a_list), dtype=np.int8)
for a in a_list:
    num_array[a::a] += 1

count = 0
for a in a_list:
  if num_array[a] == 1:
    count += 1
print(count)

import numpy as np
 
N = int(input())
x_list = np.array(list(map(int, input().split()))).reshape(1,N)
#count = np.sum(x_list%x_list.reshape(N,1)==0, axis=0)==1
#print(np.sum(count))

N = int(input())
x_list = sorted(list(map(int, input().split())))

count = 0
for i in range(N):
  for j in range(i+1, N):
    if x_list[i]%x_list[j] == 0:
      break
    if j == N-1:
      count += 1
print(count)

import numpy as np

N = int(input())
a_list = list(map(int, input().split()))

num_array = np.zeros(max(a_list)+1)
for a in a_list:
    num_array[a::a] += 1
    
count = 0
for a in a_list:
  if num_array[a] == 1:
    count += 1
print(count)

Verdicts: Runtime Error

Runtime Error

Wrong Answer

Wrong Answer

Accepted
Problem: Given is a number sequence A of length N.  Find the number of integers i \left(1 \leq i \leq N\right) with the following property:    * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i.

Submission attempts (in order):
from collections import Counter
import bisect
n = int(input()) 
a = list(map(int, input().split())) 
cnt = Counter(a) 
a.sort()
ans = 0
mx = 10 ** 6
p = [0] * (mx + 1)
for i in a:
    if p[a] == 0:
        for j in range(mx + 1):
            x = i * j
            if x > mx:
                break
            p[x] = 1 
        if cnt[a] == 1:
            ans += 1 
print(ans)

from collections import deque 
n = int(input())
a = list(map(int, input().split()))
a.sort()
a = deque(a)
y = [min(a)]
t = []
while a:
    v = a.popleft()
    x = 0
    for j in y:
        if v == j and v not in t:
            t.append(v)
        if v % j == 0:
            break
        else:
            x += 1

        if x == len(y):
            y.append(v)
print(len(y) - len(t))

from collections import Counter
import bisect
n = int(input()) 
a = list(map(int, input().split())) 
cnt = Counter(a) 
a.sort()
ans = 0
mx = 10 ** 6
p = [0] * (mx + 1)
for i in a:
    if p[i] == 0:
        for j in range(mx + 1):
            x = i * j
            if x > mx:
                break
            p[x] = 1 
        if cnt[i] == 1:
            ans += 1 
print(ans)

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: Given is a number sequence A of length N.  Find the number of integers i \left(1 \leq i \leq N\right) with the following property:    * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i.

Submission attempts (in order):
# D

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


A.sort()


ans = 0

for i in range(N-1):
  for j in range(i+1,N):
    if A[j] % A[i] == 0:
      break
    elif A[j] >= 2 * A[i]:
      break
  else:
    ans += 1

if N == 1:
  ans += 1
elif A[N-2] != A[N-1]:
  ans += 1

print(ans)


# D

N = int(input())

d = [0] * (10**6 + 1) 
A = list(map(int, input().split()))

for a in A:
  d[a] += 1

ans = 0
maxa = max(A) + 1
for i in range(1,maxa):
  if d[i] == 1:
    ans += 1

  if d[i] > 0:
    
    for j in range(i*2,maxa,i):
      d[j] = 0

print(ans)



Verdicts: Wrong Answer

Accepted
Problem: Given is a number sequence A of length N.  Find the number of integers i \left(1 \leq i \leq N\right) with the following property:    * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i.

Submission attempts (in order):
N = int(input())
A = list(map(int,input().split()))
A.sort()
import math
from functools import reduce
def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
 
    if temp!=1:
        arr.append([temp, 1])
 
    if arr==[]:
        arr.append([n, 1])
 
    return arr
 
n = lcm_list(A)
F = factorization(n)
count = 0
for i,j in F:
  for k in range(j):
    i += i
    if i in A:
      count += 1

print(count)

import numpy as np
N = int(input())
A = list(map(int,input().split())) + [10**6+1]
A.sort()
B = np.zeros(10**6+1)
count = 0
for i in range(N):
  if B[A[i]] == 0:
    B[::A[i]] = 1
    if A[i] != A[i+1]:
      count += 1
print(count)

Verdicts: Runtime Error

Accepted
Problem: Given is a number sequence A of length N.  Find the number of integers i \left(1 \leq i \leq N\right) with the following property:    * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i.

Submission attempts (in order):
n= int(input())
l=list(map(int,input().split()))

l.sort()
maxnum=l[len(l)-1]
flag=[0]*(maxnum+1)

for num in l:
    flag[num]+=1
    if flag[num]>1:
        continue
    for j in range(num*2, maxnum, num):
        flag[j]+=1
#print(flag)
ans=0

for num in l:
    if flag[num]==1:
        ans+=1
print(ans)


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

l.sort()
maxnum=l[len(l)-1]
flag=[0]*(maxnum+1)

for num in l:
    flag[num]+=1
    if flag[num]>1:
        continue
    for j in range(num*2, maxnum+1, num):
        flag[j]+=1
#print(flag)
ans=0

for num in l:
    if flag[num]==1:
        ans+=1
print(ans)


Verdicts: Wrong Answer

Accepted
Problem: Given is a number sequence A of length N.  Find the number of integers i \left(1 \leq i \leq N\right) with the following property:    * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i.

Submission attempts (in order):
from collections import Counter
from math import sqrt
N = int(input())
A = [int(v) for v in input().split()]

m = max(A)
l = [1 for i in range(m+1)]
for v in sorted(A):
    if v > sqrt(m):break
    for j in range(2*v, m+1, v):
        l[j] = 0

ans = 0
c = Counter(A)
for a in A:
    if c[a] > 1:continue
    ans += l[a]
print(ans)

from collections import Counter
N = int(input())
A = [int(v) for v in input().split()]

m = max(A)
l = [1 for i in range(m+1)]
for v in sorted(A):
    for j in range(2*v, m+1, v):
        l[j] = 0

ans = 0
c = Counter(A)
for a in A:
    if c[a] > 1:continue
    ans += l[a]
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: Given is a number sequence A of length N.  Find the number of integers i \left(1 \leq i \leq N\right) with the following property:    * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i.

Submission attempts (in order):
n=int(input(""))
aa=input("").split(" ")
lista=[]
for i in range(n):
    lista+=[int(aa[i])]
lista.sort()
listtf=[]
s=0
for i in range(lista[n-1]):
    listtf+=[True]
for i in range(n):
    if(listtf[i]):
        if(i<n-1 and lista[i]==lista[i+1]):
            s-=1
        s+=1
        t=1
        while(t*lista[i]<lista[n-1]):
            listtf[lista[i]*t]=False
            t+=1
print(s)
            
            

import math
n=int(input(""))
aa=input("").split(" ")
lista=[]
for i in range(n):
    lista+=[int(aa[i])]
s=0
lista.sort()
listde=set()
for i in range(n-1):
    if(lista[i]==lista[i+1] ):
        listde.add(lista[i])
t=0
for i in range(n):
    t=0
    for k in listde:
        
        if (lista[i]%k==0):
            t=1
            break
    if (t==0):
        s+=1
        if(lista[i]<=math.sqrt(lista[n-1])):
            listde.add(lista[i])
print(s)
    
        


n=int(input(""))
aa=input("").split(" ")
lista=[]
for i in range(n):
    lista+=[int(aa[i])]
s=0
lista.sort()
listde=set()
for i in range(n-1):
    if(lista[i]==lista[i+1]):
        listde.add(lista[i])
t=0
for i in range(n):
    t=0
    for k in listde:
        if (lista[i]%k==0):
            t=1
            break
    if (t==0):
        s+=1
        listde.ad(lista[i])
print(s)
    
        


n=int(input(""))
aa=input("").split(" ")
lista=[]
for i in range(n):
    lista+=[int(aa[i])]
lista.sort()
listtf=[]
s=0
for i in range(lista[n-1]):
    listtf+=[True]
for i in range(n):
    
    if(listtf[lista[i]-1]):
        if(i<n-1 and lista[i]==lista[i+1]):
            s-=1
        s+=1
        t=1
        while(t*lista[i]<=lista[n-1]):
            listtf[lista[i]*t-1]=False
            t+=1
print(s)
            
            
        
        
    


Verdicts: Runtime Error

Wrong Answer

Runtime Error

Accepted
Problem: Given is a number sequence A of length N.  Find the number of integers i \left(1 \leq i \leq N\right) with the following property:    * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i.

Submission attempts (in order):
import sys

N = int(input())

A = list(map(int, input().split()))
A = [x for x in set(A) if A.count(x) == 1]
if len(A) <= 1:
    print(len(A))
    sys.exit()

A = np.array(sorted(A))
B = np.array([A[0]])
 
for i in range(len(A)-1):
    if np.all(A[i+1] % B != 0):
        B = np.append(B, A[i+1])
print(len(B))

N = int(input())
A = sorted(list(map(int, input().split()))) + [0]
 
memo = ['Y'] * (10**6+1)
mx = max(A) + 1 
count = 0
 
for i in range(N):
    if memo[A[i]] == 'N':
        continue
    for j in range(A[i], mx, A[i]):
        memo[j] = 'N'
    if A[i] == A[i+1]:
        continue
    
    count += 1
 
print(count)

Verdicts: Runtime Error

Accepted
Problem: Given is a number sequence A of length N.  Find the number of integers i \left(1 \leq i \leq N\right) with the following property:    * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i.

Submission attempts (in order):

import sys
#import numpy as np
#from numba import njit
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines




def solve(A):
  
  
    count = np.zeros(10**6 + 10, np.int32)
    for x in A:
        if count[x] > 1:
            continue
        count[::x] += 1
    ret = 0
    for x in A:
        ret += count[x] == 1
    return ret

def solve2(A):
  count = [0] * (10**6 + 10)
  for x in A:
    if count[x] > 1:
      continue
    for a in range(0,len(count),x):
      count[a] += 1
  ret = 0
  for x in A:
    ret += 1 if count[x] == 1 else 0
  return ret
  
#A = np.array(read().split(), np.int32)[1:]
A = list(map(int, input().split()))
print(solve2(A))


import sys
#import numpy as np
#from numba import njit
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines




def solve(A):
  
  
    count = np.zeros(10**6 + 10, np.int32)
    for x in A:
        if count[x] > 1:
            continue
        count[::x] += 1
    ret = 0
    for x in A:
        ret += count[x] == 1
    return ret

def solve2(A):
  count = [0 for _ in range(10**6 + 10)]
  for x in A:
    if count[x] > 1:
      continue
    for a in range(0,len(count),x):
      count[a] += 1
  ret = 0
  for x in A:
    ret += (1 if count[x] == 1 else 0)
  #print(count[:24])
  return ret
  

#A = np.array(read().split(), np.int32)[1:]
N = int(input())
A = list(map(int, input().split()))

print(solve2(sorted(A)))


Verdicts: Wrong Answer

Accepted
Problem: Given is a number sequence A of length N.  Find the number of integers i \left(1 \leq i \leq N\right) with the following property:    * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i.

Submission attempts (in order):
import numpy as np
from numba import njit
@njit
def main():
    N = int(input())
    An = list(map(int, input().split()))
    ans = 0
    ng = set()
    a_An = np.array(An)
    for i, a in enumerate(An):
        temp = a_An / a
        temp[i] = 0.1
        check = np.where(temp % 1 == 0)
        check = check[0]
        # check = np.delete(check, np.where(check == i))
        
        if len(check) > 0:
            ng = ng | set(check)
    print(N-len(ng))

if __name__ == "__main__":
    main()

import numpy as np
N = int(input())
An = list(map(int, input().split()))
ans = 0
ng = set()
a_An = np.array(An)
for i, a in enumerate(An):
    temp = a_An / a
    temp[i] = 0.1
    check = np.where(temp % 1 == 0)
    check = np.delete(check, np.where(check == i))
    
    print(check)
    if len(check) > 0:
        ng = ng | set(check)
print(N-len(ng))


import numpy as np

N = int(input())
An = list(map(int, input().split()))
ok = [False] * N
ng = set()
a_An = np.array(An)
for i, a in enumerate(An):
    temp = a_An / a
    temp[i] = 0.1
    check = (temp % 1 == 0)
    ok = ok | check
    print(ok)
    # check = np.delete(check, np.where(check == i))
    
    # if len(check) > 0:
    #     ng = ng | set(check)
ok = list(ok)
print(ok.count(0))


N = int(input())
An = list(map(int, input().split()))
An.sort()
max_n = max(An)
dp = [0] * (max_n + 1)
for i in range(N):
    if dp[An[i]] != 0:
        dp[An[i]] = 2
        continue
    for j in range(1, max_n//An[i] + 1):
        dp[An[i]*j] += 1
ans = 0
for a in An:
    if dp[a] == 1:
        ans += 1
print(ans)


Verdicts: Runtime Error

Wrong Answer

Wrong Answer

Accepted
Problem: Given is a number sequence A of length N.  Find the number of integers i \left(1 \leq i \leq N\right) with the following property:    * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i.

Submission attempts (in order):
N = int(input())
 
A_list = [int(n) for n in input().split()]
 
import numpy as np
 
A_array = np.array(A_list)
sort_A = np.sort(A_array)

n_array = np.zeros(10**6)
  
for a in sort_A:
    
    if n_array[a - 1] >= 2:
        continue
        
    a_times = np.array(range(a, 10**6+1, a))
    
    n_array[(a_times -1).astype(int)] += 1

(n_array[sort_A - 1] == 1).sum()

N = int(input())
 
A_list = [int(n) for n in input().split()]
 
import numpy as np
 
A_array = np.array(A_list)
sort_A = np.sort(A_array)

n_array = np.zeros(10**6)
  
for a in sort_A:
    
    if n_array[a - 1] >= 2:
        continue
        
    a_times = np.array(range(a, 10**6+1, a))
    
    n_array[(a_times -1).astype(int)] += 1

print((n_array[sort_A - 1] == 1).sum())

Verdicts: Wrong Answer

Accepted
Problem: Given is a number sequence A of length N.  Find the number of integers i \left(1 \leq i \leq N\right) with the following property:    * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i.

Submission attempts (in order):
#import numpy as np
N = int(input())
A = list(map(int, input().split()))
A = sorted(A)
remove_list = []

kouho = [x for x in set(A) if A.count(x) == 1]


if kouho != []:
    maxA = max(kouho)

for i in range(len(A)):
    if kouho == []:
        break
    maxN = int(maxA/A[i])
    for n in range(2,maxN+1):
        buf = A[i]*n
        remove_list.append(buf)
            #print(A[i]*n)


print(len(kouho))

#import numpy as np

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

kouho = [x for x in set(A) if A.count(x) == 1]

maxA = max(kouho)

for i in range(len(A)):
    if kouho == []:
        break
    maxN = int(maxA/A[i])
    for n in range(2,maxN):
        buf = A[i]*n
        if buf in kouho:
            kouho.remove(buf)
            #print(A[i]*n)


print(len(kouho))

#import numpy as np

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

#kouho = sorted([x for x in set(A) if A.count(x) == 1])
#maxA = 10**5


maxA = A[-1]
work=[0]*(A[-1]+1)

for i in range(len(A)):
    maxN = int(maxA/A[i])
    for n in range(1,maxN+1):
        buf = A[i]*n
        
        work[buf]+=1
            #print(A[i]*n)



sm=0
for s in A:
    if work[s]==1: sm+=1
print(sm)



Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: Given is a number sequence A of length N.  Find the number of integers i \left(1 \leq i \leq N\right) with the following property:    * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i.

Submission attempts (in order):
import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline

from numba import njit,i8


@njit(i8[:](i8,i8,i8[:]))
def sieve(N,A,dp):
    for i in range(N):
        now = A[i]
        M = A[-1] // now
        for j in range(2,M+1):
            dp[now*j-1] = False
    return dp


@njit(i8(i8,i8,i8[:]))
def cnt(N,A,dp):
    skip = 0
    res = 0
    for i in range(N):
        now = A[i]
        if skip == now:
            continue
        if i != N - 1:
            if now == A[i+1]:
                skip = now
                continue
        if dp[now-1]:
            res += 1
    return res


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

    A = sorted(A)
    A = np.array(A)

    dp = np.array([True for i in range(A[-1])])
    # print(dp)
    dp = sieve(N,A,dp)
    # print(dp)

    res = cnt(N,A,dp)

    print(res)



main()


import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline

from numba import njit,i8,b1



@njit
def sieve(N,A,dp):
    for i in range(N):
        now = A[i]
        M = A[-1] // now
        for j in range(2,M+1):
            dp[now*j-1] = False
    return dp



@njit
def cnt(N,A,dp):
    skip = 0
    res = 0
    for i in range(N):
        now = A[i]
        if skip == now:
            continue
        if i != N - 1:
            if now == A[i+1]:
                skip = now
                continue
        if dp[now-1]:
            res += 1
    return res


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

    A = sorted(A)
    A = np.array(A)

    dp = np.array([True for i in range(A[-1])])
    # print(dp)
    dp = sieve(N,A,dp)
    # print(dp)

    res = cnt(N,A,dp)

    print(res)



main()


Verdicts: Runtime Error

Accepted
Problem: Given is a number sequence A of length N.  Find the number of integers i \left(1 \leq i \leq N\right) with the following property:    * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i.

Submission attempts (in order):
from collections import deque
N = int(input())
A = sorted(list(map(int, input().split())))

ans = 0
  
while True:
  d = A.pop(0)
  if A[0] == d:
    d = A.pop(0)
  else:
    A = list(reversed([ a for a in A[::-1] if a % d != 0]))
    ans += 1
  if A:
    True
  else:
    break
  
print(ans)

from numba import njit
import numpy as np

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

@njit
def main(A):
  count = np.zeros(10**6 + 10, np.int32)
  
  for i in range(N):
    a = A[i]
    if count[a] > 1:
      continue
    count[::a] += 1
    
  ans = 0
  for i in range(N):
    ans += count[A[i]] == 1
    
  #print(count[:100])
  return ans
  
print(main(np.array(A, np.int32)))

Verdicts: Runtime Error

Accepted
Problem: Given is a number sequence A of length N.  Find the number of integers i \left(1 \leq i \leq N\right) with the following property:    * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i.

Submission attempts (in order):
n = int(input())
a = [int(i) for i in input().split()]

a.sort(reverse=True)

count = 0
for i in range(n-1):
    if all([a[i] % a[j] != 0 for j in range(i + 1, n)]):
        count += 1
print(count)

n = int(input())
a = [int(i) for i in input().split()]

a.sort()
Max = a[-1]
memo = [1] * (Max+1)
count = 0

# i<n-1
for i in range(n-1):
    t = a[i]
    if memo[t] == 1:
        if a[i] != a[i+1]:
            count += 1
        for j in [t*k for k in range(1, Max//t+1)]:
            memo[j] = 0
# i=n-1
if memo[a[n-1]] == 1:
    count += 1

print(count)

""" #Time over
a.sort(reverse=True)

count = 0
# i<n-1
for i in range(n-1):
    if a[i] != a[i+1] and a[i] != a[i-1]:
        for j in range(n-1, i, -1):
            if a[i] % a[j] == 0:
                break
            if j == i+1:
                count += 1

# i==n-1
if a[n-2] != a[n-1]:
    count += 1

if n != 1:
    print(count)
elif n == 1:
    print(1)
"""

Verdicts: Wrong Answer

Accepted
Problem: Given is a number sequence A of length N.  Find the number of integers i \left(1 \leq i \leq N\right) with the following property:    * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i.

Submission attempts (in order):
N = int(input())
A = sorted(list(map(int,input().split(' '))))
ans = 0
L = [1]*(10**6+1)
for i in A:
    if not L[i]:
        continue
    ans += L[i]
    for j in (i,A[-1],i):
        L[j] = 0
print(ans)        

from collections import Counter
N = int(input())
A = Counter(list(map(int,input().split(' '))))
ans = 0
L = [1]*(10**6+1)
for i in sorted(A.keys()):
    if A[i] > 1:
        continue
    ans += L[i]
    for j in (i,A[-1],i):
        L[j] = 0
print(ans)

from collections import Counter
N = int(input())
A = Counter(list(map(int,input().split(' '))))
ans = 0
L = [1]*(10**6+1)
for i in sorted(A.keys()):
    if A[i] > 1:
        continue
    ans += L[i]
    for j in (i,10**6+1,i):
        L[j] = 0
print(ans)

from collections import Counter
N = int(input())
A = Counter([i for i in range(1,10**6+1)])
ans = 0
pre= 10**6+1
for i in sorted(A.keys(),reverse=True):
    flg = True
    if A[i] > 1:
        continue
    for j in range(1,min(int(pow(i,0.5))+2,pre)):
        if not i%j:
            if A[j] and i != j:
                flg = False
                break
            if j != i//j and A[i//j] and i//j != i:
                    flg = False
                    break
    if flg:
        ans += 1
    pre = i
print(ans)

from collections import Counter
N = int(input())
A = Counter(list(map(int,input().split(' '))))
ans = 0
m = max(A.keys())
L = [1]*(10**6+1)
for i in sorted(A.keys()):
    if not L[i]:
        continue
    if A[i] == 1:
        ans += 1
    for j in range(i,m+1,i):
        L[j] = 0
print(ans)

Verdicts: Wrong Answer

Wrong Answer

Runtime Error

Wrong Answer

Accepted
Problem: Given is a number sequence A of length N.  Find the number of integers i \left(1 \leq i \leq N\right) with the following property:    * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i.

Submission attempts (in order):
n = int(input())
a = list(map(int,input().split()))
a = sorted(a)
s = set()
same_s = set()
ans = 0
for i in a:
    if i in s:
        same_s.add(i)
    if i not in s:
        same_s.add(i)
        ans +=1
        for j in range(10**6 // i + 1):
            s.add(j*i)
print(ans - len(same_s))

n = int(input())
a = list(map(int,input().split()))
a = sorted(a)
s = set()
s1 = set()
same_s = set()
ans = 0
for i in a:
    if i in s1:
        same_s.add(i)
    if i not in s:
        s1.add(i)
        ans +=1
        for j in range(10**6 // i + 1):
            s.add(j*i)
print(ans - len(same_s))

Verdicts: Wrong Answer

Accepted
Problem: Given is a number sequence A of length N.  Find the number of integers i \left(1 \leq i \leq N\right) with the following property:    * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i.

Submission attempts (in order):
n = int(input()) 
*A, = map(int, input().split())
maxA = max(A)
print(A)
print(maxA)



# C[a : count]
C = {a : 0 for a in A}



for a in A:
    C[a] += 1
print(C)


D = {a : 0 for a in A}

for a in A:
    if C[a] > 0:
        t = 2
        while a*t <=maxA:
            
            
            D[a*t] = 1
            t += 1
print(D)

ans = 0
for a in A:
    
    if C[a] == 1 and D[a] == 0:
        ans += 1
print(ans)


n = int(input()) 
*A, = map(int, input().split())
maxA = max(A)


# C[a : count]
C = {a : 0 for a in A}



for a in A:
    C[a] += 1


D = {a : 0 for a in A}

for a in A:
    if C[a] > 0:
        t = 2
        while a*t <=maxA:
            
            
            D[a*t] = 1
            t += 1

ans = 0
for a in A:
    
    if C[a] == 1 and D[a] == 0:
        ans += 1
print(ans)


Verdicts: Wrong Answer

Accepted
Problem: Given is a number sequence A of length N.  Find the number of integers i \left(1 \leq i \leq N\right) with the following property:    * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i.

Submission attempts (in order):
n = int(input())
a_li = list(map(int,input().split()))
dum = [0]*10**6
for i in a_li:
    for j in range(i*2,10**6,i):
        dum[j-1] = 1
print(dum)

n = int(input())
a_li = list(map(int,input().split()))
cnt = [0]*(10**6+1)


for i in a_li:
    cnt[i] += 1
unique = []
for i in range(10**6+1):
    if cnt[i] == 1:
        unique.append(i)


a_li = set(a_li)

cnt = [0]*(10**6+1)

for i in a_li:
    for j in range(i * 2, 10 ** 6 + 1, i):
        cnt[j] = 1

ans = 0
for i in unique:
    if cnt[i] == 0:
        ans += 1
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: Given is a number sequence A of length N.  Find the number of integers i \left(1 \leq i \leq N\right) with the following property:    * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i.

Submission attempts (in order):
n = int(input())
A = list(map(int, input().split()))
from collections import Counter
c = Counter(A)
sorted_key = sorted(c.keys(),reverse=True)
res = [0]*len(sorted_key)
ans = n

#for i,key in enumerate(sorted_key):
for key in sorted_key:
    if c[key]>1:
        ans -= c[key]
        continue
    for j in range(len(sorted_key)-1, i, -1):
        
        if (key/sorted_key[j]>=1) and (key%sorted_key[j])==0:
            #res[i] = 1
            ans -= c[key]
            #print('===========',)
            break

#print('res', res)
#print(c)
'''ans = 0
for i,v in enumerate(sorted_key):
    if res[i]:
        ans += c[sorted_key[i]]
    else:
        if c[v] >1:
            ans += c[sorted_key[i]]'''
print(ans)

n = int(input())
A = sorted(list(map(int, input().split())))
from collections import Counter
c = Counter(A)

dp = [1]*(max(A)+1)
#print(dp)
for i in c.keys():
    j = i*2
    while j<len(dp):
        dp[j] = 0
        j += i
        #print(j, end=',')
ans = 0
for i in c.keys():
    if c[i] == 1:
        if dp[i] == 1:
            ans += 1
print(ans)


Verdicts: Runtime Error

Accepted