Problem:


Score : 400 points

Problem Statement

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.

Constraints

All values in input are integers.

1 \leq N \leq 2 \times 10^5

1 \leq A_i \leq 10^6

Input

Input is given from Standard Input in the following format:

N
A_1 A_2 \cdots A_N

Output

Print the answer.

Sample Input 1

5
24 11 8 3 16

Sample Output 1

3

The integers with the property are 2, 3, and 4.

Sample Input 2

4
5 5 5 5

Sample Output 2

0

Note that there can be multiple equal numbers.

Sample Input 3

10
33 18 45 28 8 19 89 86 2 4

Sample Output 3

5



Sample input:
5
24 11 8 3 16


Sample output:
3

Submission status: Wrong Answer

Solution code:
n = int(input())
A = list(set(map(int, input().split())))
A.sort(reverse=True)

count = 0
for i, Ai in enumerate(A):
  flag = 0
  for Aj in A[i:]:
    if Ai == Aj:
      continue
    if (Ai % Aj) == 0:
      flag = 1
      break
  if flag == 0:
    count += 1
if len(A) == 1:
  print(0)
else:
  print(count)

Submission status: Wrong Answer

Solution code:
N = int(input())
A_ = [int(i) for i in input().split()]
A = set(A_)
times = 0
if len(A_)>len(A) and len(A) == 1:
    print(0)
else:
    for i in A:
        flag = 0
        for j in A:
            if j<i:
                if i%j==0:
                    flag = 1
                    break
        if flag == 0:            
            times+=1   
    print(times)

Submission status: Wrong Answer

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

count = 0

for i in a:
    a_ = [t % i for t in a]
    c = a_.count(0)
    
    if c == 1:
        count += 1
print(count)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
#b = set(i for i in range(n))
ans = [0]*n
warizai_index = set()

for i in range(n):
    for wari in warizai_index:
        if a[i]%a[wari] == 0 and i != wari:
            ans[i] = 1
            if i in warizai_index:
                warizai_index.remove(i)
            #if i in b:
            #    b.remove(i)
            break
    if ans[i] == 1:
        continue
    
    #for j in b:
    for j in range(i+1,n):
        if i == j:
            continue
        if a[i]%a[j] == 0:
            ans[i] = 1
            if i in warizai_index and a[i] != a[j]:
                warizai_index.remove(i)
            #if i in b:
            #    b.remove(i)
            warizai_index.add(j)
            break

print(ans.count(0))

Submission status: Wrong Answer

Solution code:
import sys
from math import factorial
from collections import Counter
from fractions import Fraction
import heapq, bisect, fractions
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
MOD = 10**9 + 7

n = INT()
a = LIST()
c = Counter(a)
diff = len([i for i in range(len(c)) if list(c.values())[i] != 1])

A = sorted([(a[i], i+1) for i in range(n)])

isprime = {a[i]:True for i in range(n)}
for i in range(n):
    if not isprime[A[i][0]]: continue
    for j in range(2, A[-1][0]//A[i][0]+1):
        if A[i][0]*j in a:
            isprime[A[i][0]*j] = False
print(list(isprime.values()).count(True)-diff)

Submission status: Wrong Answer

Solution code:
import sys
import copy
from collections import deque
stdin = sys.stdin

mod = 10**9+7

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n = ni()
a = na()
a.sort()
b = copy.deepcopy(a)

maps = {}

for aa in a:
    if aa in maps:
        tmp = maps[aa]
        maps[aa] = tmp+1
    else:
        maps[aa] = 1

i = 0
while True:
    a_tmp = a[i]
    check = set()
    for j in range(len(b)-1, i, -1):
        if b[j]==a_tmp:
            check.add(i)
            check.add(j)
            continue
        if b[j]%a_tmp==0:
            check.add(j)
            continue
        if a_tmp*2 > b[j]:
            break

    check = list(check)
    check.sort(reverse=True)
    for c in check:
        del b[c]
    
    a = copy.deepcopy(b)
    i += 1
    if i>=len(a):
        break



print(len(a))

Submission status: Wrong Answer

Solution code:
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

import math

n=ni()
a=sorted(nl())


def is_prime(n):
  for i in range(2, math.ceil(math.sqrt(n)+1)):
    if n%i==0:
      return False
  return True

sa = []

ans=0

last=-1
cnt=0
for i in range(n):
  if a[i]!=last:
    cnt=0
    last=a[i]
  else:
    cnt+=1
  if cnt <= 1:
    sa.append(a[i])


l =len(sa)


for i in range(l):
  for j in range(l):
    if i==j:
      continue
    if sa[i]%sa[j]==0:
      break
  if j==n-1:
    ans+=1

print(ans)

Submission status: Wrong Answer

Solution code:
from collections import deque

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

A.sort()
Aque = deque(A)
out = deque()
out.append(Aque.popleft())

#print(Aque)
for i in range(N-1):
    yaku = Aque.popleft()
    flag = 1
    for j in out:
        #print(yaku,j)
        if yaku % j == 0:
            flag = 0
            break
    if flag:
        out.append(yaku)

ans = len(out)
if ans == 1:
    print("0")
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=sorted(list(map(int,input().split())))

max=a[-1]
ans=0
if(len(a)!=len(set(a))):ans-=1
primeNum = []
while a:
    primeNum.append(a[0])
    tmp=a[0]
    a=[i for i in a if i % tmp != 0]
primeNum.extend(a)
ans+=len(primeNum)


print(ans)

Submission status: Wrong Answer

Solution code:


import collections
import math

def get_sieve_of_eratosthenes_new(data):
    prime = []
    limit = max(data) // 2 + 1
    # data = [i + 1 for i in range(1, n)]
    while data:
        p = data[0]
        if limit <= p:
            return prime + data
        prime.append(p)
        data = [e for e in data if e % p != 0]
    return prime + data

def main():
    n = int(input())
    al = list(map(int, input().split()))
    al_not_multi = []
    cnt = collections.Counter(al)
    for i,v in cnt.items():
        if v == 1:
            al_not_multi.append(i)

    if not al_not_multi:
        print(0)
        return

    al_not_multi.sort()

    ans = get_sieve_of_eratosthenes_new(al_not_multi)
    print(len(ans))

    # ans = 0
    # lim = int(al_not_multi[-1]//2 + 1)
    # while al_not_multi:
    #     p = al_not_multi[0]
    #     if p > lim:
    #         break
    #     al_not_multi = [e for e in al_not_multi[1:] if e % p != 0]
    #     ans += 1


    # al_n = al_not_multi[:]
    # ans = 0
    # while al_n:
    #     new_al_n = []
    #     start = al_n[0]
    #     for a in al_n[1:]:
    #         if a%start!=0:
    #             new_al_n.append(a)
    #     al_n = new_al_n[:]
    #     ans += 1
    # print(ans)




if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))

n = I()
l = LI()
list.sort(l, reverse=True)
c = 0
for a in range(n-1):
  for b in l[a+1:]:
    if l[a] % b == 0:
      break
  else:
    c += 1
  
print(c)

Submission status: Wrong Answer

Solution code:
N=int(input())
A=list(map(int,input().split()))
A.sort()
flag=[0]*N
for i in range(N-1):
    if(flag[i]==0):
        for j in range(i+1,N):
            if(flag[j]==0):
                if((A[j]%A[i])==0):
                    flag[j]=1
ans=0
print(flag)
for i in range(N):
    if(flag[i]==0):
        ans+=1
print(ans)

Submission status: Wrong Answer

Solution code:


def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

n = (int)(input())
a=list(map(int, input().split(" ")))
temp = []
for i in a:
    temp.append(make_divisors(i))
#print(temp)
count = 0
for i in temp:
    #print(list(set(i + a)), a + i)
    if len(list(set(i + a))) == len(i) + len(a) - 1:
        count += 1 
print(count)

Submission status: Wrong Answer

Solution code:
def resolve():
    import bisect
    import math
    n = int(input())
    a = list(map(int, input().split()))
    a1 = {}
    for i in range(len(a)):
        if a[i] in a1:
            a1[a[i]] += 1
        else:
            a1[a[i]] = 1

    a = sorted(list(a1.keys()))
    maxa = a[-1]
    maxi = bisect.bisect_left(a, math.ceil(maxa**0.5))
    ans = [1]*(len(a))
    for i in range(0, maxi+1):
        if a1[a[i]] != 1:
            ans[i] = 0
            continue
        if ans[i] == 1:
            for j in range(i+1, len(a)):
                if ans[j] == 0:
                    continue
                if a[j] == a[i]:
                    ans[i] = 0
                if a[j] % a[i] ==0:
                    ans[j] = 0
    print(sum(ans))
resolve()

Submission status: Wrong Answer

Solution code:
n = int(input())
ls = list(map(int,input().split()))
ls.sort()
ans = 0

if n == 1:
    ans += 1
else:
    for i in range(n):
        k = 1
        if i == 0:
            if ls[0] != ls[1]:
                ans += 1
        else:
            for j in range(i):
                if ls[i] % ls[j] == 0:
                    k = 0
                    break
            if k == 1:
                ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:
N=int(input())
a=list(map(int, input().split()))
A=list(set(a))
A.sort(reverse=True)
if len(A) ==1:
    c=0
else:
    c=len(A)

# print(A)
for i in range(len(A)-1):
    for j in range(i+1,len(A)):
        if A[i] % A[j] == 0:
            c-=1
            break
print(c)

Submission status: Wrong Answer

Solution code:
#dt = {} for i in x: dt[i] = dt.get(i,0)+1
import sys
input = sys.stdin.readline
ipnl = lambda n: [int(input()) for _ in range(n)]
inp = lambda :int(input())
ip = lambda :[int(w) for w in input().split()]

def solve(x,n): 
    dt = {} 
    for i in x: dt[i] = dt.get(i,0)+1
    mx = max(x)
    res = set()
    for i in range(n): 
        for j in range(x[i],mx+1,x[i]):
            if x[i] != j and dt.get(j,0) >= 1:
                res.add(j)
    return n-len(res)

n = inp()
x = ip()
if len(set(x)) == 1:
    print(0)
else:
    print(solve(x,n))

Submission status: Wrong Answer

Solution code:
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n = ni()
a = na()

for i in a:
  a = [j for j in a if  j % i != 0 or j == i]

print(len(a))

Submission status: Wrong Answer

Solution code:
a = int(input())
b = list(map(int,input().split()))
count = 0
b.sort()
for i in range(a):
  _count = 0
  _main = b[i]
  for j in range(0,i+1):
    if i!=j:
      if (_main%b[j])==0:
        continue
      else:
        _count +=1
  if _count == i:
    count += 1
print(count)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int,input().split()))
A.sort(reverse=True)
flg = True
ans = 0
for i in range(N-1):
    flg = True
    for j in range(i+1,N): 
        #if A[i] < 2*A[j]:continue
        if A[i]%A[j] == 0 or A[i] == A[j]:
            flg = False
            break
    if flg:
        ans += 1
    if i == N-2 and j == N-1 and A[j-1] != A[j]:
        ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int,input().split()))
from collections import deque
A.sort()
B = deque(A)
ans = 0
if len(set(A))==1:
    print(0)
else:
    while len(B)>0:
        p = B.popleft()
        B = deque([j for j in B if j % p !=0])
        ans += 1
    print(ans)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline


N = int(input())

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

AList.sort()

ResultList = []

tmp = 0

if N > 1:
    if AList[0] != AList[1]:
        ResultList.append(AList[0])
else:
    ResultList.append(AList[0])


for p in range(1, N - 1):
    tmp = 0
    if AList[p - 1] != AList[p] and AList[p] != AList[p + 1]:
        for q in ResultList:
            if AList[p] % q == 0:
                tmp = 1
                break
        if tmp == 0:
            ResultList.append(AList[p])
    else:
        continue

tmp = 0
if N > 1:
    if AList[N - 2] != AList[N - 1]:
        for q in ResultList:
            if AList[N - 1] % q == 0:
                tmp = 1
                break
        if tmp == 0:
            ResultList.append(AList[N - 1])

print(len(ResultList))

Submission status: Wrong Answer

Solution code:
a = int(input())
li = list(map(int,input().split()))
count = 0
for c,i in enumerate(li):
  print(i)
  for j in range(a):
    if i % li[j] == 0 and c != j:
      count = count + 1
      break

print(a-count)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = [int(i) for i in input().split()]
a = sorted(a, reverse=True)
count = 0
for i in range(len(a)):
    flag = 0
    for j in range(i+1,len(a)):
        if a[i] % a[j] == 0:
            flag +=1
            break
    if i == len(a)-1:
        if a[i] % a[i-1] == 0:
            flag +=1
    if flag ==0:
        count += 1
print(count)

Submission status: Wrong Answer

Solution code:
from math import sqrt

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True

N = int(input())
a_list = [int(_c) for _c in input().split(" ")]
a_list = sorted(a_list)

answers = []
ng_list = []
for a in a_list:
    if a in answers:
        if a not in ng_list:
            ng_list.append(a)
        continue

    if len(answers) == 0:
        answers.append(a)
        continue

    if is_prime(a):
        answers.append(a)
        continue

    append_num = True
    for answer in answers:
        if a % answer == 0:
            append_num = False
            break
    if append_num:
        answers.append(a)

print(len(answers) - len(ng_list))

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import collections
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors


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

if 1 in A:
    print(1)
    exit()

D = collections.Counter(A)


A = list(set(A))

ret = 0
for a in A:
    f = make_divisors(a)
    flag = True
    if len(f) == 2 and D[f[1]] == 1:
        ret += 1
    elif len(f) != 2:
        flag = True
        for f2 in f[2:]:
            if D[f2] == 0: continue
            else: flag = False
        if flag: ret += 1


print(ret)

Submission status: Wrong Answer

Solution code:
n = int(input())
A = list(map(int,input().split()))
ans = 0
for i in range(1,n-1):
  for j in range(i+1,n):
    if(A[i] % A[j] != 0):
      ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
def main():
    n = int(input())
    a = sorted(list(map(int, input().split())))
    pool = set()
    count = 0
    for i in range(n):
        t = a[i]
        limit = t // 2 +1
        is_ok = True
        if i+1 < n and t == a[i+1]:
            pool.add(t)
        if t in pool:
            continue
        for j in pool:
            if j > limit:
                break
            elif t % j == 0:
                is_ok = False
                #print("bad", t, j)
                break
        if is_ok:
            #print("good", t)
            pool.add(t)
            count += 1
    print(count)
 
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
"""
    こんにちは。これはクシャルです
    
    Author : thekushalghosh (クシャル)
    Team   : CodeDiggers
 
    I prefer Python language over the C++ language :p :D
        
    Visit my website : thekushalghosh.github.io
"""
import sys,math,cmath,time
start_time = time.time()
##########################################################################
################# ---- THE ACTUAL CODE STARTS BELOW ---- #################
def qw(arr,n):
    s = dict()
    c = 0
    max_ele = -10**9
    for i in range(n):  
        s[arr[i]] = 1 
        max_ele = max(max_ele, arr[i])
    res = dict() 
    for i in range(n):  
        if (arr[i] != 0): 
            for j in range(arr[i] * 2,max_ele + 1, arr[i]):
                if (j in s.keys()): 
                    res[j] = 1
    for x in res: 
        c = c + 1
    return(c)
def solve():
    n = inp()
    a = inlt()
    q = counter(a)
    cc = 0
    if len(a) == 1:
        print(0)
        return
    for i in range(len(q)):
        if q[i] >= 2:
            cc = cc + 1
    print(len(list(set(a))) - qw(list(set(a)),len(list(set(a)))) - cc)
            
################## ---- THE ACTUAL CODE ENDS ABOVE ---- ##################
##########################################################################
 
def main():
    global tt
    if not ONLINE_JUDGE:
        sys.stdin = open("input.txt","r")
        sys.stdout = open("output.txt","w")
    t = 1
    for tt in range(t):
        solve()
    if not ONLINE_JUDGE:
        print("Time Elapsed :",time.time() - start_time,"seconds")
        sys.stdout.close()
    
#---------------------- USER DEFINED INPUT FUNCTIONS ----------------------#
def inp():
    return(int(input()))
def inlt():
    return(list(map(int,input().split())))
def insr():
    return(input().strip())
def invr():
    return(map(int,input().split()))
 
#------------------ USER DEFINED PROGRAMMING FUNCTIONS ------------------#
def counter(a):
    q = [0] * (max(a) + 1)
    for i in range(len(a)):
        q[a[i]] = q[a[i]] + 1
    return(q)
 
def string_counter(a):
    q = [0] * 26
    for i in range(len(a)):
        q[ord(a[i]) - 97] = q[ord(a[i]) - 97] + 1
    return(q)

def power_two(n):
    if n == 1:
        return(True)
    sttr = str(n)
    len_str = len(sttr)
    sttr = list(sttr)
    num = 0
    if (len_str == 1 and sttr[len_str - 1] == '1'): 
        return(False)
    while (len_str != 1 or sttr[len_str - 1] != '1'):
        if ((ord(sttr[len_str - 1]) - ord('0')) % 2 == 1):
            return(False)
        j = 0; 
        for i in range(len_str):  
            num = num * 10 + (ord(sttr[i]) - ord('0')); 
            if (num < 2): 
                if (i != 0):  
                    sttr[j] = '0'
                    j += 1
                continue
  
            sttr[j] = chr((num // 2) + ord('0'))
            j += 1; 
            num = (num) - (num // 2) * 2
        len_str = j
    return(True)

def getLeftmostBit(n): 
    m = 0
    while (n > 1) : 
        n = n >> 1
        m += 1
    return(m)
def getNextLeftmostBit(n, m) : 
    temp = 1 << m 
    while (n < temp) : 
        temp = temp >> 1
        m -= 1
    return m
def bitcounter(n) :
    m = getLeftmostBit(n) 
    return _countSetBits(n, m) 
def _countSetBits(n, m) :
    if (n == 0) : 
        return 0
    m = getNextLeftmostBit(n, m)
    if (n == (1 << (m + 1)) - 1) : 
        return ((m + 1) * (1 << m))
    n = n - (1 << m)
    return (n + 1) + bitcounter(n) + m * (1 << (m - 1)) 

def log_two(n): 
    return(math.log(n) / math.log(2))

#-----------------------------------------------------------------------#
        
ONLINE_JUDGE = __debug__
if ONLINE_JUDGE:
    input = sys.stdin.readline
    
main()

Submission status: Wrong Answer

Solution code:
import numpy as np
from collections import defaultdict

input()
A = np.fromstring(input(), int, sep=' ')

counter = defaultdict(int)
for x in A:
    counter[x] += 1

A = np.array(list(set(A)))

count = 0
f = np.ones_like(A, dtype=bool)
for i, x in enumerate(A):
    if not f[i]:
        continue

    # print(i, x, count, f)
    if counter[x] == 1:
        count += 1

    if x <= 10**3+1:
        f[i+1:] &= (A[i+1:] % x != 0)

print(count)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))
ans = 0
for i in range(N):
    count = 0
    for j in range(N):
        if A[i] != A[j] and A[i]%A[j] != 0:
            count += 1
            if count == N-1:
                ans += 1

             

print(ans)

Submission status: Wrong Answer

Solution code:
def check(n, l):
    l.sort(reverse=True)
    cnt = 0
    for i in range(n):
        for j in range(n-1, i, -1):
            if l[i]%l[j] == 0:
                cnt += 1
                break
    if len(l) >= 2:
        if l[-2]==l[-1]: cnt+=1
    return cnt

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

    o = []
    e = []
    for i in range(n):
        if a[i]%2==0:
            e.append(a[i])
        else:
            o.append(a[i])

    cnt = check(len(o), o) + check(len(e), e)

    return n - cnt
    



print(solve())

Submission status: Wrong Answer

Solution code:
n = int(input())
A = list(map(int,input().split()))
i = 0
ans = 0
ans_2 = 1
for j in range(n-1):
    if A[n-1] % A[j] == 0:
        ans_2 = 0
        break   
while i <= n-2:
    for j in range(i+1,n):
        if A[i] % A[j] == 0:
            break
        elif j == n - 1:
            ans = ans + 1
    i = i + 1
print(ans+ans_2)

Submission status: Wrong Answer

Solution code:
import numpy as np

N = int(input())
Alist = np.asarray( list(map(int, input().split())) )
y = np.zeros((N, ), dtype=np.int32)

for i in range(1, N):
  y += (Alist % np.roll( Alist, i ) ) != 0

print( y.sum() )

Submission status: Wrong Answer

Solution code:
import sys
import math
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()


def make_grid(h, w, num): return [[int(num)] * w for _ in range(h)]


#隣接リスト 1-order
def make_adjlist_d(n, edges):
    res = [[] for _ in range(n + 1)]
    for edge in edges:
        res[edge[0]].append(edge[1])
        res[edge[1]].append(edge[0])
    return res


def make_adjlist_nond(n, edges):
    res = [[] for _ in range(n + 1)]
    for edge in edges:
        res[edge[0]].append(edge[1])
    return res


#nCr
def cmb(n, r):
    return math.factorial(n) // math.factorial(r) // math.factorial(n - r)


def main():
    N = NI()
    A = NLI()
    A = sorted(A)
    oks = set()
    for i, a in enumerate(A):
        if i == 0:
            oks.add(a)
            continue

        flag = False
        bad = False
        for ok in oks:
            if a == ok:
                bad = True
                break
            if a % ok == 0:
                flag = True
                break
        if bad:
            oks.discard(a)
        elif not flag:
            oks.add(a)
    print(len(oks))



if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import numpy as np



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

max=a[-1]
ans=0
if(len(a)!=len(set(a))):ans-=1
primeNum = []
while a:
    primeNum.append(a[0])
    tmp=a[0]
    a=[i for i in a if i % tmp != 0]
primeNum.extend(a)
ans+=len(primeNum)


print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
li = list(map(int,input().split()))
ans = 0

import math
import bisect
import collections
c = collections.Counter(li)
li = list(set(li))
li.sort()
while len(li)>0:
    ba = li.pop(-1)
    if c[ba]>1:
        continue
    s_ba = math.ceil(math.sqrt(ba))+1
    index = bisect.bisect_right(li, s_ba)
    tmp_li = li[:index+1]
    #print(ba,tmp_li)
    for tt in tmp_li:
        if ba%tt == 0:
            break
    else:
        ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
N = int(input())

def divisor(n): #nの約数を全て求める
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i:
        divisors.append(n//i)

  return set(divisors)

A = list(map(int, input().split()))
A.sort()
dic = defaultdict(int)
for a in A:
  dic[a] += 1
A = set(A)

for a in A:
  if a == 1:
    print(0)
    exit()
B = {}
for a in A:
  B[a] = divisor(a)

s = set()
ans = 0

for a in A:
  s = A - set([a])
  if len(s) == 0:
    continue
  if len(B[a] & s) == 0:
    if dic[a] == 1:
      ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:
import collections
n = map(int, raw_input().split(' '))
ais = list(set(map(int, raw_input().split(' '))))
ais.sort()
forbidden = set([])
j = 0
count =0
while(j < len(ais)):
	
	flag = True
	d= 1
	while( d * d <= ais[j]):
		if ais[j] % d == 0:
			if (d in forbidden) or ((ais[j]/d) in forbidden) :
				flag = False
				break
		d +=1
	count +=1 if flag else 0
	forbidden.add(ais[j])
	j+=1

print count

Submission status: Wrong Answer

Solution code:
import sys
input=sys.stdin.readline
n = int(input())
orga = list(map(int, input().split()))
orga.sort()

if n==1:
    print(1)
    exit()
if len(set(orga)) == 1:
    print(0)
    exit()

def m_div(n,aset):
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            if i!=n and i in aset:
                return False
            if i != n // i:
                if (n//i)!=n and n//i in aset:
                    return False
    return True

aset=set()
ans=0
dups=set()
for num in orga:
    if num in aset:
        dups.add(num)
        continue
    if m_div(num,aset):
        ans+=1
    aset.add(num)

print(ans-len(dups))

Submission status: Wrong Answer

Solution code:
X= int(input())
N= input().split(" ")
result=0

for i in range(X):
    X_I=int(N[i])

    for j in range(X):
        X_J=int(N[j])
        #print(j)
        #print(X_J)
        if i==j:
            continue
        elif X_I % X_J == 0:
            break
        elif j==X-1:
            #print("not div")
            result=result+1

Submission status: Wrong Answer

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

c = Counter(A)
A = [i[0] for i in c.items() if i[1] == 1]

A.sort()
ans = 0
i = 0
j = len(A)-1

while i < j:
  if A[j] % A[i] == 0:
    A.pop(j)
  j -= 1
  if j == i:
    ans += 1
    j = len(A)-1
    i += 1
  if j == i:
    ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:
import sys
import bisect


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(list(set(a)))
    ans = 0
    if len(a) == 1:
        print(0)
        exit()
    for i in range(1, len(a)):
        for j in range(0, i):
            if a[i] % a[j] == 0:
                ans += 1
                break
    print(n - ans)

Submission status: Wrong Answer

Solution code:
from collections import deque
import collections
n = int(input())
a = list(map(int,input().split()))
a.sort()
# print(a)
a = deque(a)

# b = a[-1]
# print(b)
# c = 0
while a[0]!=max(a) :
    p = a.popleft()
    x = []
    for i in a:
        if not i in x:
            # print(i,p)
            if i%p==0 and i!=p:
                # print(i)
                x.append(i)
    for j in x:
         a.remove(j) 
    a.append(p)
y=len(a)
# print(a)
c = (collections.Counter(a)).values()
# print(c)
for i in c:
    # print(i)
    if i!=1:
        y-=i
    # c+=1
    # if a[i]<b/2:
    #     a =a[:i+1]+ [k for k in a if k%a[i]!=0]
print(y)

Submission status: Wrong Answer

Solution code:
from collections import Counter

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i: # choufuku
                divisors.append(n//i)
    # divisors.sort()
    return divisors


exists = [False] * (2 * (10 ** 5) + 1)

input = raw_input
n0 = int(input())
As_0 = map(int, input().split(" "))

out = 0

try:
    counter = Counter(As_0)
    As = counter.keys()
except:
    pass


for A in As:
    try:
        exists[A] = True
    except:
        pass

for A1, num in counter.items():
    try:

        if num >= 2:
            continue
        
        exist = False

        ds = make_divisors(A1)
        for d in ds:
            if exists[d]:
                if d != A1:
                    exist = True

        if not exist:
            out += 1
    except:
        pass

print(out)

Submission status: Wrong Answer

Solution code:
n = int(input())
A = sorted(map(int, input().split()), reverse=True)
b = 0
#print(A)

j = 1
while j < n:
  if A[0]%A[j] == 0:
    break
  if j == n-1:
    b += 1
  j += 1

for i in range(1,n):
  if A[i] == A[i-1]:
    continue
  j = i+1
  if j == n:
    b += 1
    continue
  while j < n:
    if A[i]%A[j] == 0:
      break
    if j == n-1:
      b += 1
      break
    j += 1
print(b)

Submission status: Wrong Answer

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

if sum(l) == n*l[0]:
    print(0)
    exit()

l.sort()
j = [0]*2
cnt1 = 0
cnt2 = 0
for i in l:
    if i%2 == 0:
        if j[0] == 0:
            j[0] = i
            cnt1 += 1
    else:
        if j[1] == 0:
            j[1] = i
            cnt2 += 1
    
    if cnt1 == cnt2 == 1:
        break
ans = 2
for k in l:
    if k in j:
        continue
    elif k%2 == 0:
        if k%j[0] != 0:
            ans += 1
    else:
        if k%j[1] != 0:
            ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())

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

result = 0
mini = min(A)

for i in range(N):
    if A[i]%mini==0 and A[i]!=mini:
        result +=1
    else:
        for j in range(N):
            if A[i] == A[j]:
                break
            elif A[i]%A[j]==0:
                result +=1
                break

print(result)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [int(x) for x in input().split()]
A = sorted(A)
counter = [A[0]]
for i in range(1,N):
    if counter and A[i] == counter[-1]: counter.remove(A[i])
    elif not any([A[i] % x == 0 for x in counter]):
        counter.append(A[i])
print(len(counter))

Submission status: Wrong Answer

Solution code:
n = int(input())
L = list(map(int,input().split()))
L.sort()
#print(L)
dp = [0]*(L[-1]+1)

for i in range(n):
    j = 1
    while L[i]*(j+1) <= L[-1]:
        if not dp[L[i]*(j+1)]:
            dp[L[i]*(j+1)] = 1
        j +=1
#print(dp)
cnt = 0
for i in range(n):
    if dp[L[i]] == 0:
        cnt +=1
print(cnt)

Submission status: Wrong Answer

Solution code:
N = int(input())
A=sorted(map(int,input().split()),reverse=True)
count = 0
if len(set(A))==1:
  print(0)
  exit()
for i in range(len(A)):
  judge = True
  for j in range(i+1,len(A)):
    if A[i]%A[j]==0:
      judge = False
      break
  if judge:
    count += 1
print(count)