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):
n=int(input())
l=list(map(int,input().split()))
l.sort()
ans=0
for i in range(n):
  flag=True
  s=l[-1-i]
  for j in range(n):
    if n-1-i==j:
      pass
    else:
      if s%l[j]==0:
        flag=False
        break
  if flag:
    ans+=1

n=int(input())
l=list(map(int,input().split()))
l.sort()
p=[1]*(l[-1]+1)
ans=0
for i in range(n):
  a=l[i]
  if p[a]==1:
    b=a
    while a<=l[-1]:
      p[a]=0
      a+=b
    if i<n-1:
      if l[i]==l[i+1]:
        pass
      else:
        ans+=1
    else:
      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

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

def nd():
    ans = 0
    l = [1 for _ in range(len(A))]
    print(l)
    ind = 0
    i = A[ind]
    
    while i <= A[-1]//2:
      if l[A.index(i)] == 1:
        j = 2 * i
        while j <= A[-1]:
          if j in set(A):
            l[A.index(j)] = 0
          j += i
      ind += 1
      i = A[ind]
          
    table = [A[i] for i in range(len(A)) if l[i] == 1]
    ans = len(table)
    
    dic = Counter(a)
    
    for k,v in dic.items():
      if v >= 2:
        ans -= 1
        
    return ans
  
print(nd())

from collections import Counter

n = int(input())
a = list(map(int,input().split()))
A = list(set(a))
A.sort()
amax = A[-1]
sieve = [1]*(amax+1)
ans = []

for i in A:
  for j in range(2,amax//i + 1):
    sieve[i*j] = 0

for i in A:
  if sieve[i] == 1:
    ans.append(i)

c = Counter(a)
ansl =len(ans)

for k,v in c.items():
  if sieve[k] == 1 and v >= 2:
    ansl -= 1
    
print(ansl)


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())
aa = list(map(int, input().split()))
aa.sort()

from collections import Counter
dic = Counter(aa)
times = np.array(list(dic.keys()))[np.array(list(dic.values())) > 1]

aa = list(set(aa) - set(times))
oks = np.ones(len(aa))
for i in range(len(aa)):
    for j in range(i+1,len(aa)):
        if (aa[j]%aa[i] == 0):
            oks[j] = 0
print(int(oks.sum()))

import numpy as np
from collections import Counter
n = int(input())
aa = list(map(int, input().split()))
ngs = np.zeros((10**6)+1, dtype=int)

for a in set(aa):
    ngs[2*a::a] = 1
    
dic = Counter(aa)
times = np.array(list(dic.keys()))[np.array(list(dic.values())) > 1]

for i in times:
    ngs[i] = 1
cnt = 0
for a in aa:
    cnt += 1-ngs[a]
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):
import sys
input = sys.stdin.readline


def main():
    n = int(input())
    A = [int(i) for i in input().split()]

    # MOD = 10 ** 9 + 7
    A.sort()
    s = set()

    ans = 0
    if A[0] != A[1]:
        ans += 1

    for i in range(1, n):
        if A[i - 1] == A[i]:
            continue

        for j in range(i):
            if j in s:
                continue
            elif A[i] % A[j] == 0:
                s.add(i)
                break
        else:
            ans += 1
            

    print(ans)


if __name__ == '__ma

def main():
    n = int(input())
    A = [int(i) for i in input().split()]

    max_dp = max(A) + 1
    dp = [0] * max_dp

    for a in A:
        if dp[a] >= 2:
            continue
        dp[a] += 1
        for i in range(a << 1, max_dp, a):
            dp += 2
    print(np.sum(dp == 1))


if __name__ == '__main__':
    main()

import numpy as np
import sys
input = sys.stdin.readline


def main():
    n = int(input())
    A = [int(i) for i in input().split()]

    max_dp = max(A) + 1
    dp = np.zeros(max_dp, dtype="int32")

    for a in A:
        if dp[a] >= 2:
            continue
        dp[np.arange(a, max_dp, a)] += 2
        dp[a] -= 1

    print(np.sum(dp == 1))


import numpy as np
import sys
input = sys.stdin.readline


def main():
    n = int(input())
    A = np.array([int(i) for i in input().split()])

    max_dp = np.max(A) + 1
    dp = np.zeros(max_dp, dtype="int32")

    for a in A:
        if dp[a] >= 2:
            continue
        fancy = np.arange(a, max_dp, a)
        dp[fancy] += 2
        dp[a] -= 1


if __name__ == '__main__':
    main()

import sys
input = sys.stdin.readline


def main():
    n = int(input())
    A = [int(i) for i in input().split()]
    ans = 1
    A.sort()
    A = dq(A)

    print(type(A))

    while A:
        start = A.popleft()
        if not A:
            break
        ans += 1
        A = dq([a for a in A if a % start != 0])

    print(ans)


if __name__ == '__main__':
    main()


import numpy as np
import sys
input = sys.stdin.readline


def main():
    n = int(input())
    A = [int(i) for i in input().split()]

    max_dp = np.max(A) + 1
    dp = np.zeros(max_dp, dtype="int32")

    for a in A:
        if dp[a] >= 2:
            continue
        dp[np.arange(a, max_dp, a)] += 2
        dp[a] -= 1

    print(np.sum(dp == 1))



def main():
    n = int(input())
    A = [int(i) for i in input().split()]

    max_dp = max(A) + 1
    dp = [0] * max_dp


    for a in A:
        if dp[a] >= 2:
            continue
        dp[a] += 1
        for i in range(a << 1, max_dp, a):
            dp[i] += 2
    print(dp.count(1))


if __name__ == '__main__':
    main()


Verdicts: Runtime Error

Runtime Error

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):
from numba import njit, int32
import numpy as np


@njit(int32(int32[:], int32[:]))
def main(A, B):
    ans = 0

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

    for a in set(A):
        v = 2*a
        while v <= 10**6:
            B[v] += 1
            v += a

    for a in A:
        if B[a] == 1:
            ans += 1

    return ans


if __name__ == '__main__':
    N = int(input())
    A = [int(i) for i in input().split()]
    B = [0]*(10**6+1)
    ans = main(np.array(A), np.array(B))
    print(ans)


from numba import njit, int32
import numpy as np


@njit(int32(int32[:], int32[:], int32[:]))
def main(A, B, C):
    ans = 0

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

    for a in C:
        v = 2*a
        while v <= 10**6:
            B[v] += 1
            v += a

    for a in A:
        if B[a] == 1:
            ans += 1

    return ans


if __name__ == '__main__':
    N = int(input())
    A = [int(i) for i in input().split()]
    B = [0]*(10**6+1)
    ans = main(np.array(A, dtype=np.int32),
               np.array(B, dtype=np.int32),
               np.array([a for a in set(A)], dtype=np.int32))
    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 = [int(x) for x in input().split()]

a.sort()

if n == 1:
    print(1)
    exit()

ans = [1] * (a[n-1]+1)

for i in range(n):
    if i >= 1 and a[i] == a[i-1]:
        ans[a[i]] = 0

    else:
        j = 2
        while j*a[i] <= a[n-1]:
            ans[j*a[i]] = 0
            j += 1


sum = 0

print(sum)


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

a.sort()

if n == 1:
    print(1)
    exit()

ans = [1] * (a[n-1]+1)

for i in range(n):
    if i >= 1 and a[i] == a[i-1]:
        ans[a[i]] = 0

    else:
        j = 2
        while j*a[i] <= a[n-1]:
            ans[j*a[i]] = 0
            j += 1


sum = 0

for i in range(n):
    sum += ans[a[i]]


print(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):
def main():

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

    A = sorted(A)
    Amax = A[-1]
    count = [0 for _ in range(Amax+1)]

    for a in A:
        for i in range(1, Amax//a+1):
            count[i*a] += 1

    ans = 0
    for i in range(N):
        a = A[i]
        if count[a] == 1:
            print(i)
            ans += 1
#    print(count)                                                                                                                                                
    print(ans)

if __name__ == "__main__":
    main()



def main():

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

    A = sorted(A)

    ans = 0

    for i in range(N):
        Ai = A[i]
        is_divisible = False
        for j in range(i):
            Aj = A[j]
            if Aj**2 > Ai:
                break
            if Ai%Aj == 0:
                is_divisible = True
                break
        if not is_divisible:
            ans += 1

    print(ans)

if __name__ == "__main__":
    main()



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

    A = sorted(A)

    ans = 0

    for i in range(N):
        Ai = A[i]
        is_divisible = False
        for j in range(i):
            Aj = A[j]
            if Aj**2 > Ai:
                break
            if Ai%Aj == 0:
                is_divisible = True
                break
        if not is_divisible:
            ans += 1

    print(ans)

if __name__ == "__main__":
    main()


def main():

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

    A = sorted(A)
    Amax = A[-1]
    count = [0 for _ in range(Amax+1)]

    for a in A:
        for i in range(1, Amax//a+1):
            count[i*a] += 1

    ans = 0
    for i in range(N):
        a = A[i]
        if count[a] == 1:
#            print(i)                                                                                                                                            
            ans += 1

    print(ans)

if __name__ == "__main__":
    main()


Verdicts: Wrong Answer

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 collections

#N = int(input())


import random
N = 2 * 10**5
A_list = [random.randrange(1,10**6) for _ in range(N+1)]

A_counter = collections.Counter(A_list)

max_A = max(A_list)

A_list.sort(reverse=False)
OK_set = set(A_list)

ans = list()



for i in range(0,N):
    A = A_list[i]

    if A*2 <= max_A:
        multiple_set = {A*j for j in range(2,1+max_A//A)}
        #print(multiple_set)
        OK_set -= multiple_set

    if A_counter[A] != 1:
        OK_set -= {A}
    
    #print(OK_set)

print(len(OK_set))              

import collections

N = int(input())
A_list = [int(e) for e in input().split()]

#import random
#N = 2 * 10**5
#A_list = [random.randrange(1,10**6) for _ in range(N+1)]

A_counter = collections.Counter(A_list)

max_A = max(A_list)

A_list.sort(reverse=False)
OK_set = set(A_list)

ans = list()



for i in range(0,N):
    A = A_list[i]

    if A*2 <= max_A:
        multiple_set = {A*j for j in range(2,1+max_A//A)}
        #print(multiple_set)
        OK_set -= multiple_set

    if A_counter[A] != 1:
        OK_set -= {A}
    
    #print(OK_set)

print(len(OK_set))              

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()
num = 0
l = []

for i in range(n):
    flag = 0
    if i == 0:
        if a[0]==a[1]:
            l.append(a[0])
            continue
        else:
            l.append(a[0])
            num += 1
            continue
    for j in l:
        if a[i]%j:
            flag = 1
            break
        else:
            break
    if flag:
        l.append(a[i])
        num += 1

print(num)

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

l = [0]*(10**6 +1)
for i in a:
    l[i]+=1
num = 0

for i in range(10**6+1):
    if l[i] == 1:
        num += 1
    if l[i] != 0:
        for j in range(2*i, 10**6+1, i):
            if l[j]:
                l[j] += 1
print(num)

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
from itertools import groupby

readline = sys.stdin.buffer.readline
readline()
b = list(map(int, readline().split()))

b.sort(reverse=True)
# print(b)

x = len(b)
c = [(k, len(tuple(L))) for k, L in groupby(b)]
# print(c)
for i, v in enumerate(c):
  if v[1] > 1:
    x -= v[1]
    continue
  for vv in c[-1:i:-1]:
    print(v[0], vv[0])
    if not v[0] % vv[0]:
      x -= 1
      break
print(x)

import sys
from itertools import groupby

readline = sys.stdin.buffer.readline
a = map(int, readline().split())
b = list(map(int, readline().split()))
b.sort(reverse=True)
# print(b)

x = len(b)
c = [(k, len(list(L))) for k, L in groupby(b)]
# print(c)
for i, v in enumerate(c):
  if v[1] > 1:
    x -= v[1]
    continue
  for vv in c[i+1:]:
    if not v[0] % vv[0]:
      x -= 1
      continue
print(x)

import sys
from itertools import groupby

readline = sys.stdin.buffer.readline
a = map(int, readline().split())
b = list(map(int, readline().split()))
b.sort(reverse=True)
print(b)

x = len(b)
c = [(k, len(list(L))) for k, L in groupby(b)]
# print(c)
for i, v in enumerate(c):
  if v[1] > 1:
    x -= v[1]
    break
  for vv in c[i+1:]:
    if not v[0] % vv[0]:
      x -= 1
      break
print(x)

import sys
from itertools import groupby

readline = sys.stdin.buffer.readline
readline()
b = list(map(int, readline().split()))

b.sort()
# print(b)

x = len(b)
c = [(k, len(tuple(L))) for k, L in groupby(b)]
# print(c)
m = c[-1][0]
# print(m)
s = [True] * (m + 1)
# print(len(s))

a = 0
for i, le in c:
  if s[i]:
    if le <= 1:
      a += 1
    for v in range(i, m + 1, i):
      s[v] = False
# print(s)
print(a)

Verdicts: Wrong Answer

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 main():
    n = int(input())
    a = list(map(int,input().split()))

    ans = 0
    from collections import Counter
    cnt = Counter(a)
    lim = max(a) + 1
    tmp = [0] * (lim)
    # set_a = list(set(a))
    # set_a.sort()
    a.sort()

    for aa in a:
        if tmp[aa] == 0:
            for j in range(lim):
                if aa * j > lim-1:
                    break
                tmp[j] = 1

            if cnt[aa] == 1:
                # print(aa, ans)
                ans += 1




    print(ans)

if __name__=='__main__':
    main()


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

    ans = 0
    from collections import Counter
    cnt = Counter(a)
    lim = max(a) + 1
    tmp = [0] * (lim)
    # set_a = list(set(a))
    # set_a.sort()
    a.sort()

    for aa in a:
        if tmp[aa] == 0:
            for j in range(aa,lim,aa):

                tmp[j] = 1

            if cnt[aa] == 1:
                # print(aa, ans)
                ans += 1




    print(ans)

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):
import numba
from numba import njit, b1, i4, i8, f8
import numpy as np  

N = int(input())
A = np.array(sorted([int(x) for x in input().split()]))

print(A)


@njit((i8[:], ), cache=True)
def main(A):
    ans = 0
    for i in range(len(A) - 1, 0, -1):
        for j in range(i):
            if A[i] == A[j]:
                continue
            if A[i] % A[j] == 0:
                break
            if A[i] < A[j] * 2 or j == i - 1:
                ans += 1
                break
    if A[0] != A[1]:
        ans += 1
    return ans


print(main(A))


import numba
from numba import njit, b1, i4, i8, f8
import numpy as np  

N = int(input())
A = np.array([int(x) for x in input().split()], dtype=np.int32)


@njit((i4[:], ), cache=True)
def main(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


print(main(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 sys
import numpy as np
input = lambda: sys.stdin.readline().rstrip()

def main():
    n = int(input())
    a = list(map(int, input().split()))
    a = sorted([i for i in a if a.count(i) == 1])
    a = np.array(a)
    ans = []
    if let(set(a)) == 1:
        print(0)
        return
    while a != []:
        ans.append(a[0])
        a = a[a%a[0] != 0]
    print(len(ans)+1)
    
if __name__ == '__main__':
    main()

import sys
import collections
input = lambda: sys.stdin.readline().rstrip()

def main():
    n = int(input())
    a = sorted([int(i) for i in input().split()])
    cnt_list = collections.Counter(a)
    search_list = [0] * (a[-1]+1)
    ans = 0
    for num, cnt in cnt_list.items():
        search_list[num] = cnt
    for i in a:
        if search_list[i] == 1:
            ans += 1
        for j in range(i, a[-1]+1, i):
            search_list[j] = 0
    print(ans)
    
if __name__ == '__main__':
    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):
n = int(input())
a = list(map(int, input().split()))
counter = [0 for _ in range(n)]
for i in range(n):
    for j in range(n):
        if i == j:
            continue
        else:
            if counter[i] > 0:
                continue
            else:
                if a[i] % a[j] == 0:
                    counter[i] += 1:
print(counter.count(0))

import numpy as np
 
n = int(input())
a = list(map(int, input().split()))
a.sort()
dp = [0 for _ in range(a[-1] + 1)]

for x in a:
    for j in range(x, a[-1] + 1, x):
        dp[j] += 1
for i, result in enumerate(dp):
    print(i, result)
print("#" * 15)
ans = 0
for x in a:
    #print(x)
    if dp[x] == 1:
        ans += 1
print(ans)

import numpy as np
 
n = int(input())
a = list(map(int, input().split()))
a.sort()
dp = [0 for _ in range(a[-1] + 1)]

for x in a:
    for j in range(x, a[-1] + 1, x):
        dp[j] += 1
ans = 0
for x in set(a):
    #print(x)
    if dp[x] == 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):
import numpy as np

N = int(input())
MAXX = 10**6 + 5
num = np.array(input().split(), np.int32)[:]
mark = np.zeros(MAXX, np.int32)

num = np.sort(num)
for n in num:
    if mark[n::n] < 2:
        mark[n::n] += 1

count = 0
for n in num:
    if mark[n] == 1:
        count += 1

print(count)

import numpy as np

N = int(input())
MAXX = 10**6 + 5
num = np.array(input().split(), np.int32)[:]
mark = np.zeros(MAXX, np.int32)

num = np.sort(num)
for n in num:
    if mark[n] < 2:
        mark[n::n] += 1

count = 0
for n in num:
    if mark[n] == 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())
a = sorted([int(i) for i in input().split()])
cnt_d = [0] * (max(a) + 1)
cnt_nd = 0
for ai in a:
    if cnt_d[ai] >= 1:
        continue
    else:
        cnt_d[ai] += 1
        cnt_nd += 1
    multi = 2
    while ai*multi <= max_a:
        cnt_d[ai*multi] += 1
        multi += 1
print(cnt_nd)

n = int(input())
a = sorted([int(i) for i in input().split()])
max_a = max(a)
cnt_d = [0] * (max_a + 1)

for ai in a:
    for multi in range(ai, max_a + 1, ai):
        cnt_d[multi] += 1

print(cnt_d.count(1))

n = int(input())
a = [int(i) for i in input().split()]
max_a = max(a)
cnt_d = [0] * (max_a + 1)

for ai in a:
    for multi in range(ai, max_a + 1, ai):
        cnt_d[multi] += 1

print(sum(cnt_d[ai] == 1 for ai in 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):
N = int(input())
A = list(map(int, input().split()))

A = sorted(set(A))
t = [True] * (10 ** 6 + 1)

for a in A:
    for i in range(a, 10 ** 6 + 1, a):
        t[i] = False

result = 0
for a in A:
    if t[a]:
        result += 1
print(result)


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

t = [True] * (10 ** 6 + 1)
d = {}
for a in A:
    d.setdefault(a, 0)
    d[a] += 1
    if d[a] > 1:
        t[a] = False

for a in sorted(set(A)):
    for i in range(a + a, 10 ** 6 + 1, a):
        t[i] = False
print(t.count(True))


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

d = {}
for a in A:
    d.setdefault(a, 0)
    d[a] += 1

A = sorted(set(A))
t = [True] * (10 ** 6 + 1)
for a in A:
    if d[a] > 1:
        t[a] = False
    for i in range(a + a, 10 ** 6 + 1, a):
        t[i] = False
print(sum(1 for a in A if t[a]))


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):
# D - Not Divisible
def aline_mintomax(arr, N):
    for i in reversed(range(1,N)):
        for j in range(i):
            if arr[j] > arr[j+1]:
                arr[j], arr[j+1] = arr[j+1], arr[j]
    return arr

N = int(input()) 
num_list = list(map(int, input().split())) 
ind_list = [i for i in range(N)]
num_list = aline_mintomax(num_list, N)
for i in range(N-1):
    if num_list[i+1] == num_list[i]:
        ind_list[i] = -1
        continue
    for j in range(i):
        if num_list[i] % num_list[j] == 0 :
            ind_list[i] = -1
            break
for i in range(N-1):
    if num_list[N-1] % num_list[i] == 0 :
        ind_list[N-1] = -1
        break
print(ind_list.count(-1))

# D - Not Divisible
def aline_mintomax(arr, N):
    for i in reversed(range(1,N)):
        for j in range(i):
            if arr[j] > arr[j+1]:
                arr[j], arr[j+1] = arr[j+1], arr[j]
    return arr

N = int(input()) 
num_list = list(map(int, input().split())) 
ind_list = [i for i in range(N)]
num_list = aline_mintomax(num_list, N)
for i in range(N-1):
    if num_list[i+1] == num_list[i]:
        ind_list[i] = -1
        continue
    for j in range(i):
        if num_list[i] % num_list[j] == 0 :
            ind_list[i] = -1
            break
for i in range(N-1):
    if num_list[N-1] % num_list[i] == 0 :
        ind_list[i] = -1
        break
print(ind_list.count(-1))

# D - Not Divisible
N = int(input())
a = list(map(int, input().split()))
a.sort()
MAX = a[-1]
l = [0]*(MAX+1)
for i in range(N):
    l[a[i]] += 1
    
answer = 0
for i in range(N):
    if l[a[i]] == 1:
        answer += 1
    for g in range(a[i], MAX+1, a[i]):
        l[g] = 10
print(answer)

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):
import numpy as np
n,*a=map(int,open(0).read().split())
l=np.zeros(max(a)+1)
a.sort()
a+=[10**7]
r=0
for i,j in zip(a,a[1:]):
    if l[i]==0:
        l[::i]=1
        if i!=j:
            r+=1
            print(i)
print(r)

import numpy as np
n,*a=map(int,open(0).read().split())
l=np.zeros(max(a)+1)
a.sort()
a+=[10**7]
r=0
for i,j in zip(a,a[1:]):
    if l[i]==0:
        l[::i]=1
        if i!=j:
            r+=1
print(r)

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
N = int(input())
A = list(map(int,input().split()))
C = Counter(A).most_common()

MAXN = max(A)
B = [False]*(MAXN+1)
for c in C:
    B[c[0]] = True
ans = 0
for i in range(MAXN + 1):
    if B[i]:
        if C[i]==1:
            ans += 1
        B[i::i] = [False]*(MAXN//i)
print(ans)

from collections import Counter
N = int(input())
A = list(map(int,input().split()))
C = Counter(A)

MAXN = max(A)
B = [False]*(MAXN+1)
for c in C.most_common():
    B[c[0]] = True
ans = 0
for i in range(MAXN + 1):
    if B[i]:
        if C[i]==1:
            ans += 1
        B[i::i] = [False]*(MAXN//i)
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=sorted(map(int,input().split()))
  maxa=a[-1]
  tf=[True]*maxa
  r=0
  n-=1
  for i in range(n): 
    a_i=a[i]
    if tf[a_i-1] ==True: 
      for j in range(a_i - 1,maxa,a_i):
        tf[j]=False
      if a_i < a[i+1]: 
        print(a_i)
        r+=1
  if tf[-1] == True: 
     r+=1
  print(r)
main()

def main():
  n=int(input())
  a=sorted(map(int,input().split()))
  maxa=a[-1]
  tf=[True]*maxa
  r=0
  n-=1
  for i in range(n): 
    a_i=a[i]
    if tf[a_i-1] ==True: 
      for j in range(a_i - 1,maxa,a_i):
        tf[j]=False
      if a_i < a[i+1]: 
        r+=1
  if tf[-1] == True: 
     r+=1
  print(r)
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):
from sys import stdin

n = [int(x) for x in stdin.readline().rstrip().split()]
P = [int(x) for x in stdin.readline().rstrip().split()]

rest_lists = []

P.sort()

def return_filtered(div, rl):
    new = []
    protect = True
    for tgt in rl:
        if protect and tgt == div:
            new.append(tgt)
            protect = False
        elif tgt == div and len(new) >0:
            new.pop()
        elif not tgt % div == 0:
            new.append(tgt)
    print(new)
    return new

new_list = P
k = 0
while True:
    if len(new_list) == 0:
        break
    k += 1
    if 1+k >= len(new_list):
        break
    new_list = return_filtered(new_list[1+k], new_list)

print(len(new_list))

from sys import stdin

n = [int(x) for x in stdin.readline().rstrip().split()]
P = [int(x) for x in stdin.readline().rstrip().split()]

rest_lists = []

P.sort()

def return_filtered(div, rl):
    new = []
    protect = True
    for tgt in rl:
        if protect and tgt == div:
            new.append(tgt)
            protect = False
        elif tgt == div and len(new) >0:
            new.pop()
        elif not tgt % div == 0:
            new.append(tgt)
    print(new)
    return new

new_list = P
k = 0
while True:
    if len(new_list) == 0:
        break
    k += 1
    if 1+k > len(new_list):
        break
    new_list = return_filtered(new_list[1+k], new_list)

print(len(new_list))

from sys import stdin

n = [int(x) for x in stdin.readline().rstrip().split()]
a = [int(x) for x in stdin.readline().rstrip().split()]



#     import math
#     if not isinstance(n, int):
#         raise TypeError('n is int type.')
#     if n < 2:
#         raise ValueError('n is more than 2')



#     while True:
#         p = data[0]









cnt = [0] * ((10**6)+1)
for elem in a:
    cnt[elem] += 1

filtered = []

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


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


a = list(set(a))
for elem in a:
    
    
    for i in range(elem*2, (10**6)+1, elem):
        cnt[i] += 1

ans = 0

for i in filtered:
    if cnt[i] == 0:
        ans += 1

print(ans)


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):
n = int(input())
a = list(map(int,input().split()))
a.sort(reverse = True)
p = 0
if 1 in a:
    if a.count(1) >= 2:
        print(0)
        exit(0)
    else:
        print(1)
        exit(0)

for i in range(n):
    if a.count(a[i]) >= 2:
        pass
    else:
        for j in range(n):
            if a[i] % a[j] == 0:
                break
            else:
                pass
            if j == n - 1:
                p += 1

print(p)

n = int(input())
a = list(map(int,input().split()))
a.sort(reverse = True)
p = 0
 
for i in range(n):
    j = i + 1 
        while j < n:
            if i == j:
                pass
            elif a[i] % a[j] == 0:
                break
            else:
                pass
            if j == n - 1:
                p += 1
	    j += 1
 
print(p)

n = int(input())
a = list(map(int,input().split()))
a.sort(reverse = True)
p = 0

for i in range(n):
    j = i + 1
    while j < n:
        if i == j:
            pass
        elif a[i] % a[j] == 0:
            break
        else:
            pass
        if j == n - 1:
            p += 1
        j += 1

print(p)

n = int(input())
a = list(map(int,input().split()))
a.sort(reverse = True)
p = 0

for i in range(n):
    j = i + 1
    while j < n:
        if i == j:
            pass
        elif a[i] % a[j] == 0:
            break
        else:
            pass
        if j == n - 1:
            p += 1
	    j += 1

print(p)

n = int(input())
a = list(map(int,input().split()))
m = max(a)
flag = [True]*(m+1)
c = [0]*(m+1)
b = list(sorted(a))
for i in b:
    x = i + i
    while x <= m:
        flag[x] = False
        x += i
    c[i] += 1
ans = 0
x = 0
l = []
ans = 0
for i in a:
    if flag[i] and c[i] <= 1:
        ans += 1
print(ans)

Verdicts: Wrong Answer

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):
N = int(input())
A = list(map(int, input().split()))
A.sort()
B = [0] * (2 * 10 ** 5 + 1)
M = max(A)

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

if sum(B) == N:
	print(0)
else:
	for a in A:
		if B[a] > 0:
			i = 2
			b = a * i
			while b <= M:
				B[b] = 0
				i += 1
				b = a * i
	for b in B:
		if b > 1:
			B[b] = 0
	print(sum(B))

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

ans = 0
for i in range(N):
    for j in range(N):
        if i != j:
            if A[i] % A[j] != 0:
                ans += 1
                break
print(ans)

N = int(input())
A = list(map(int, input().split()))
A.sort()
B = [0] * (2 * 10 ** 5 + 1)
M = max(A)

for a in A:
  pass

N = int(input())
A = list(map(int, input().split()))
A.sort()
B = [0] * (2 * 10 ** 5 + 1)
M = max(A)

N = int(input())
A = list(map(int, input().split()))
A.sort()
B = [0] * (2 * 10 ** 5 + 1)
M = max(A)

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

if max(B) == N:
	print(0)
else:
	for a in A:
		if B[a] > 0:
			i = 2
			b = a * i
			while b <= M:
				B[b] = 0
				i += 1
				b = a * i

N = int(input())
A = list(map(int, input().split()))
A.sort()
B = [0] * (2 * 10 ** 5 + 1)
M = max(A)

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

if max(B) == N:
	print(0)
else:
	for a in A:
		pass

N = int(input())
A = list(map(int, input().split()))
A.sort()
B = [0] * (2 * 10 ** 5 + 1)
M = max(A)

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

N = int(input())
A = list(map(int, input().split()))
A.sort()
M = max(A)
B = [0] * (M + 1)

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

for a in A:
    if B[a] > 0:
        i = 2
        b = a * i
        while b <= M:
            B[b] = 0
            i += 1
            b = a * i
for i in range(M + 1):
    if B[i] > 1:
        B[i] = 0
print(sum(B))

Verdicts: Runtime Error

Wrong Answer

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):
import collections
n=int(input())
l=list(map(int,input().split()))
c=collections.Counter(l)
def j(n):
  j=1
  for k  in c.keys():
      if n%k==0:
        if n!=k:
          j=0
          break
count=0
for i in c.keys():
  if j(i)==1:
    count+=1
print(count)

n=int(input())
a=list(map(int,input().split()))
dp=[0]*(10**6+1)
for i in a:
  dp[i]+=1
for i in range(1,10**6+1):
  if dp[i]:
    for  j in range(2*i,10**6+1,i):
      dp[j]=0
print(dp.count(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())
Al = [int(i) for i in input().split()]

ans = 0
divjl = []

for i in range(len(Al)):
    if i in divjl:
        continue
    flag = True
    for j in range(len(Al)):
        if i == j:
            continue
        if Al[i] % Al[j] == 0:
            flag = False
            divjl.append(j)
    if flag:
        ans += 1

print(ans)

N = int(input())
Al = sorted([int(i) for i in input().split()])
maxAl = Al[-1]
markl = [-1] * (maxAl+1)

for i in Al:
    if markl[i] == 1:
        continue
    if markl[i] == 0:
        markl[i] = 1
        continue
    markl[i] = 0
    p = i*2
    while p <= maxAl:
        markl[p] = 1
        p += i
print(markl.count(0))

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
n, *A = map(int, open(0).read().split())
A.sort()
c, s = Counter(A), set()
M = max(A) + 1
ans = 0
for a in A:
    if a in s:
        continue
    ans += c[a] == 1
    for i in range(a * a, M, a):
        s.add(i)
print(ans)

from collections import Counter
n, *A = map(int, open(0).read().split())
A.sort()
c, s = Counter(A), set()
M = max(A) + 1
ans = 0
for a in A:
    if a in s:
        continue
    ans += c[a] == 1
    for i in range(a, M, a):
        s.add(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()))

setA = set(A)
result = 0

if N == 1:
    print(0)
else:
    for i in range(N):
        tmp = A[i]
        A[i] = 0
        setA = set(A)
        A[i] = tmp
        if 1 in setA:
            continue

        for a in setA:
            if a == 0:
                continue
            if A[i] % a == 0 or A[i] <= a:
                break
        else:
            result += 1

    print(result)


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

setA = set(A)
result = 0

if N == 1:
    print(0)
else:
    for i in range(N):
        tmp = A[i]
        A[i] = 0
        setA = set(A)
        A[i] = tmp
        if 1 in setA:
            continue

        for a in setA:
            if A[i] % a == 0:
                break
        else:
            result += 1

    print(result)


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

setA = set(A)
result = 0

if N == 1:
    print(0)
else:
    for i in range(N):
        tmp = A[i]
        A[i] = 0
        setA = set(A)
        A[i] = tmp
        if 1 in setA:
            continue

        print(setA)
        for a in setA:
            if a == 0:
                continue
            if A[i] % a == 0 or A[i] <= a:
                break
        else:
            result += 1

    print(result)


from collections import Counter
N = int(input())
A = list(map(int, input().split()))

sorted_A = sorted(A)
result = 0
c = Counter(sorted_A)

lendp = sorted_A[-1] + 1
dp = [0] * lendp

for a in sorted_A:
    dp[a] += 1
    if dp[a] == 1:
        b = a * 2
        while b < lendp:
            dp[b] += 2
            b += a

print(dp.count(1))


Verdicts: 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):
import sys
input = sys.stdin.readline

N = int(input())

AList = list(map(int, input().split()))

AList.sort()

dp = [0] *  (AList[-1] + 1)

for i in AList:
    dp[i] += 1
    
    if dp[i] == 1:
        for p in range(2 * i, len(dp), i):
            dp[j] += 2

print(dp.count(1))

import sys
input = sys.stdin.readline

N = int(input())

AList = list(map(int, input().split()))

AList.sort()

dp = [0] *  (AList[-1] + 1)

for i in AList:
    dp[i] += 1
    
    if dp[i] == 1:
        for p in range(2 * i, len(dp), i):
            dp[p] += 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())
A = list(map(int, input().split()))

import numpy as np

ans = 0
for i in range(N):
    if len(A_re) == 0:
        ans = 0
        break
        break
    c = [j for j in A[i]/np.array(A) if j.is_integer() ]
    print(c)
    if len(c) == 1:
        ans += 1
print(ans)

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

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

for x in s:
    t = x
    while t <= 10**6:
        P[t] += 1
        t += x

ans = 0

for x in a:
    print(P[x])
    if P[x] == 1:
        ans += 1

print(ans)

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

import numpy as npz

ans = 0
for i in range(N):
    c = list(A[i]%np.array(A))
    if A.count(A[i]) == N:
        ans = 0
        break
        break
    if c.count(0) == 1:
        ans += 1
print(ans)

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

import numpy as npz

ans = 0
for i in range(N):
    if A.count(A[i]) == N:
        ans = 0
        break
        break
    c = list(A[i]%np.array(A))
    if c.count(0) == 1:
        ans += 1
print(ans)

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

import numpy as np

ans = 0
for i in range(N):
    if len(A_re) == 0:
        ans = 0
        break
        break
    c = [j for j in A[i]/np.array(A) if j.is_integer() ]
    #print(c)
    if len(c) == 1:
        ans += 1
print(ans)

from collections import Counter
n = int(input())
a = list(map(int, input().split()))
c = Counter(a)
p = [True] * (10 ** 6 + 1)
s = list(set(a))
for x in s:
    t = x * 2
    while t <= 10 ** 6:
        p[t] = False
        t += x
ans = 0
for x in a:
    if c[x] == 1 and p[x] == True:
        ans += 1
print(ans)

Verdicts: Runtime Error

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):
N = int(input().strip())
A = list(map(int, input().strip().split()))
A.sort()
AMAX = max(A)
ans = 0
is_div = [True for i in range(AMAX+1)]
print(A)
for i in range(N):
  a = A[i]
  if is_div[a]:
    if not ((i > 0 and A[i] == A[i-1]) or (i < N-1 and A[i] == A[i+1])):
      ans += 1
    for j in range(a, AMAX+1, a):
      is_div[j] = False
print(f'{ans}')

N = int(input().strip())
A = list(map(int, input().strip().split()))
A.sort()
AMAX = max(A)
ans = 0
is_div = [True for i in range(AMAX+1)]
for i in range(N):
  a = A[i]
  if is_div[a]:
    if not ((i > 0 and A[i] == A[i-1]) or (i < N-1 and A[i] == A[i+1])):
      ans += 1
    for j in range(a, AMAX+1, a):
      is_div[j] = False
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 sys
import math


def int1(x): return int(x) - 1
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def mi1(): return map(int1, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def lli(rows_number): return [li() for _ in range(rows_number)]


if __name__ == "__main__":
    n = ii()
    a = li()
    a = sorted(list(set(a)))
    if len(a) == 1:
        print(0)
        exit()
    b = [True] * (a[-1] + 1)


    def sived(x):
        for not_ans in range(x+x, a[-1]+1, x):
            b[not_ans] = False
    b[0] = False
    for i in a:
        if b[i]:
            sived(i)
    ans = 0
    for i in a:
        if b[i]:
            ans += 1
    print(b)


import sys

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

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

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


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 sys
n = int(sys.stdin.readline().rstrip("\n"))
a = [int(s) for s in sys.stdin.readline().rstrip("\n").split()]
a.sort()
a_true = [True]*n
a_set = set(a)
if 1 in a or len(a_set) == 1:
    print(0)
else:
    a_max = a[n-1]
    i = 0
    while a[i]*2 <= a_max:
        while i < n-1:
            if a[i] == a[i+1]:
                a_true[i] = False
                a_true[i+1] = False
            i += 1
        for j in range(i+1,n):
            if a[j] % a[i] == 0:
                a_true[j] = False
        i += 1
    while i < n-1:
        if a[i] == a[i+1]:
            a_true[i] = False
            a_true[i+1] = False
        i += 1
    print(len([i for i in range(0, n) if a_true[i]]))

import sys
n = int(sys.stdin.readline().rstrip("\n"))
a = [int(s) for s in sys.stdin.readline().rstrip("\n").split()]
a_max = max(a)
c = {num: 0 for num in a}
for num in a:
    c[num] += 1
d = {num: 0 for num in a}
for num in a:
    t = 2
    while num * t <= a_max:
        d[num*t] = 1
        t += 1
ans = 0
for num in a:
    if c[num] == 1 and d[num] == 0:
        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()))

S = sorted(A)
print(S)

ans = 0
if S[0] == S[1]:
    for i in range(1, N):
        j = 0
        while S[i] % S[j] > 0:
            j += 1
            if i <= j:
                ans += 1
                break
else:
    ans = 1
    for i in range(1, N):
        j = 0
        while S[i] % S[j] > 0:
            j += 1
            if i <= j:
                ans += 1
                break
print(ans)

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

MAX = 10 ** 6

A.sort()
s = set()
ans = N
for i in range(N):
    a = A[i]
    if a in s:
        ans -= 1
        continue
    if i < N - 1 and A[i + 1] == a:
        ans -= 1
    n = MAX // a
    for i in range(1, n + 1):
        s.add(a * i)
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 = map(int, input().split())
a = list(sorted(a))
big = a[n-1]
mark = [0]*big
for x in a:
  mark[x] += 1
  if mark[x] > 1:
    continue
  for j in range(x*2, big+1, x):
    mark[j] += 1

ans = 0
for x in a:
  if mark[x] == 1:
    ans += 1

print(ans)

n = int(input())
a = map(int, input().split())
a = list(sorted(a))
big = a[n-1]
mark = [0]*(big+1)
for x in a:
    mark[x] += 1
    if mark[x] > 1:
        continue
    for j in range(x*2, big+1, x):
        mark[j] += 1

ans = 0
for x in a:
    if mark[x] == 1:
        ans += 1

print(ans)


Verdicts: Runtime Error

Accepted