Buggy python submission (verdict: Time Limit Exceeded):
def make_divisors(n):
    i = 1
    flg = True
    while i*i <= n:
        if n % i == 0:
            if i in s and i != n:
                flg = False
                break
            ii = n//i
            if i != ii:
                if ii in s and ii != n:
                    flg = False
                    break
        i += 1
    return flg

def main():
    cnt = 0
    from collections import Counter
    c = Counter(a)
    for i in range(n):
        if c[a[i]] > 1:
            continue
        if make_divisors(a[i]):
            cnt += 1
    print(cnt)

if __name__ == '__main__':
    n = int(input())
    a = list(map(int,input().split()))
    s = set(a)
    main()

Fixed submission:
def main():
    n = int(input())
    a = list(map(int,input().split()))
    ans = set(a)
    ma = max(a)
    from collections import Counter
    c = Counter(a)
    for i in range(n):
        t = a[i]
        if c[t] > 1 and t in ans:
            ans.remove(t)
            continue
        j = 2
        tmp = t*j
        while tmp <= ma:
            if tmp in ans:
                ans.remove(tmp)
            j += 1
            tmp = t*j
    print(len(ans))

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def make_divisors(n):
    i = 1
    flg = True
    while i*i <= n:
        if n % i == 0:
            if i in s1:
                flg = False
                break
            if i != n // i:
                if n//i in s1:
                    flg = False
                    break
        i += 1
    return flg

n = int(input())
a = list(map(int,input().split()))
s = set(a)
cnt = 0
from collections import Counter
c = Counter(a)
for i in range(n):
    if c[a[i]] > 1:
        continue
    s1 = s-{a[i]}
    if make_divisors(a[i]):
        cnt += 1
print(cnt)


Fixed submission:
def main():
    n = int(input())
    a = list(map(int,input().split()))
    ans = set(a)
    ma = max(a)
    from collections import Counter
    c = Counter(a)
    for i in range(n):
        t = a[i]
        if c[t] > 1 and t in ans:
            ans.remove(t)
            continue
        j = 2
        tmp = t*j
        while tmp <= ma:
            if tmp in ans:
                ans.remove(tmp)
            j += 1
            tmp = t*j
    print(len(ans))

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
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]

def main():
    n = int(input())
    a = list(map(int,input().split()))
    s = set(a)
    cnt = 0
    from collections import Counter
    c = Counter(a)
    for i in range(n):
        if c[a[i]] > 1:
            continue
        tmp = set(make_divisors(a[i]))
        if len(tmp) - len(tmp-s) == 1:
            cnt += 1
    print(cnt)

if __name__ == '__main__':
    main()


Fixed submission:
def main():
    n = int(input())
    a = list(map(int,input().split()))
    ans = set(a)
    ma = max(a)
    from collections import Counter
    c = Counter(a)
    for i in range(n):
        t = a[i]
        if c[t] > 1 and t in ans:
            ans.remove(t)
            continue
        j = 2
        tmp = t*j
        while tmp <= ma:
            if tmp in ans:
                ans.remove(tmp)
            j += 1
            tmp = t*j
    print(len(ans))

if __name__ == '__main__':
    main()