Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
import sys


def solve(N, A):
    A = sorted(A)
    dp = [True for i in range(max(A))]

    for i, a in enumerate(A):
        if dp[a-1] == False:
            continue
        elif dp[a-1] == True:
            for k in range(2, max(A)//a+1):
                dp[a * k - 1] = False
        if i < N-1 and A[i] == A[i+1]:
            dp[a-1] = False

    count = 0
    for a in A:
        if dp[a-1] == True:
            count += 1
    print(count)


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)


if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/env python3
import sys

def solve(N, A):
    A.sort()  # エラトステネスの篩にかけるためソート
    Amax = A[-1]
    dp = [1] * (Amax + 1)  # Aの最大値までのエラトステネスの篩を作る。
    ans = 0
    for i in range(len(A) - 1):
        p = A[i]
        if dp[p] == 1:  # A[i]がA[j]の倍数でないかをエラトステネスの篩でチェック
            for q in range(Amax // p + 1):
                dp[p * q] = 0  # A[i]の倍数をすべて0にする
            if A[i] != A[i + 1]:
                ans += 1  # A[i]が重複していなければカウント
    if dp[Amax] == 1:  # 重複チェック時にレンジオーバーするためAmaxだけ別で判定
        ans += 1
    print(ans)

def solve_old(N, A):
    A = sorted(A)
    dp = [True for i in range(N)]  # Trueのものは、割り切れない（カウント対象）

    idx = 0
    while True:
        a = A[idx]
        for j, target in enumerate(A[i+1:]):
            if target % a == 0:
                dp[idx + j + 1] = False


    for i, a in enumerate(A):
        if dp[i] == False:
            continue

        elif A.count(a) > 1:  # 同じ値が複数入っていたら、その値はカウント対象外
            dp[i] = False
            continue

        for j, target in enumerate(A[i + 1:]):  # 探索対象の倍数を、リストから除外していく
            if target % a == 0:
                dp[i + j + 1] = False
    count = 0
    for i in range(N):
        if dp[i] == True:
            count += 1
    print(count)


def solve_old(N, A):
    A = sorted(A)
    dp = [True for i in range(N)] # Trueのものは、割り切れない（カウント対象）

    for i, a in enumerate(A):
        if dp[i] == False:
            continue

        elif A.count(a) > 1: # 同じ値が複数入っていたら、その値はカウント対象外
            dp[i] = False
            continue

        for j, target in enumerate(A[i + 1:]): # 探索対象の倍数を、リストから除外していく
            if target % a == 0:
                dp[i+j+1] = False
    count = 0
    for i in range(N):
        if dp[i] == True:
            count += 1
    print(count)


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
import sys


def solve(N, A):
    A = sorted(A)
    dp = [True for i in range(max(A))]

    for i, a in enumerate(A):
        if dp[a-1] == True:
            for k in range(2, max(A)//a+1):
                dp[a * k - 1] = False
        if i < N-1 and A[i] == A[i+1]:
            dp[a-1] = False

    count = 0
    for a in A:
        if dp[a-1] == True:
            count += 1
    print(count)


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)


if __name__ == '__main__':
    main()

Fixed submission:
#!/usr/bin/env python3
import sys

def solve(N, A):
    A.sort()  # エラトステネスの篩にかけるためソート
    Amax = A[-1]
    dp = [1] * (Amax + 1)  # Aの最大値までのエラトステネスの篩を作る。
    ans = 0
    for i in range(len(A) - 1):
        p = A[i]
        if dp[p] == 1:  # A[i]がA[j]の倍数でないかをエラトステネスの篩でチェック
            for q in range(Amax // p + 1):
                dp[p * q] = 0  # A[i]の倍数をすべて0にする
            if A[i] != A[i + 1]:
                ans += 1  # A[i]が重複していなければカウント
    if dp[Amax] == 1:  # 重複チェック時にレンジオーバーするためAmaxだけ別で判定
        ans += 1
    print(ans)

def solve_old(N, A):
    A = sorted(A)
    dp = [True for i in range(N)]  # Trueのものは、割り切れない（カウント対象）

    idx = 0
    while True:
        a = A[idx]
        for j, target in enumerate(A[i+1:]):
            if target % a == 0:
                dp[idx + j + 1] = False


    for i, a in enumerate(A):
        if dp[i] == False:
            continue

        elif A.count(a) > 1:  # 同じ値が複数入っていたら、その値はカウント対象外
            dp[i] = False
            continue

        for j, target in enumerate(A[i + 1:]):  # 探索対象の倍数を、リストから除外していく
            if target % a == 0:
                dp[i + j + 1] = False
    count = 0
    for i in range(N):
        if dp[i] == True:
            count += 1
    print(count)


def solve_old(N, A):
    A = sorted(A)
    dp = [True for i in range(N)] # Trueのものは、割り切れない（カウント対象）

    for i, a in enumerate(A):
        if dp[i] == False:
            continue

        elif A.count(a) > 1: # 同じ値が複数入っていたら、その値はカウント対象外
            dp[i] = False
            continue

        for j, target in enumerate(A[i + 1:]): # 探索対象の倍数を、リストから除外していく
            if target % a == 0:
                dp[i+j+1] = False
    count = 0
    for i in range(N):
        if dp[i] == True:
            count += 1
    print(count)


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
import sys


def solve(N, A):
    A = sorted(A)
    dp = [True for i in range(N)]  # Trueのものは、割り切れない（カウント対象）
    true_idx_set = set([i for i in range(N)])

    for i, a in enumerate(A):
        if not dp[i]:
            continue

        elif A.count(a) > 1:  # 同じ値が複数入っていたら、その値はカウント対象外
            dp[i] = False
            true_idx_set.remove(i)
            continue

        tmp_set = [x for x in true_idx_set if x>i]
        for idx in tmp_set:
            if A[idx] % a == 0:
                dp[idx] = False
                true_idx_set.remove(idx)

    count = 0
    for i in range(N):
        if dp[i] == True:
            count += 1
    print(count)


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)


if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/env python3
import sys

def solve(N, A):
    A.sort()  # エラトステネスの篩にかけるためソート
    Amax = A[-1]
    dp = [1] * (Amax + 1)  # Aの最大値までのエラトステネスの篩を作る。
    ans = 0
    for i in range(len(A) - 1):
        p = A[i]
        if dp[p] == 1:  # A[i]がA[j]の倍数でないかをエラトステネスの篩でチェック
            for q in range(Amax // p + 1):
                dp[p * q] = 0  # A[i]の倍数をすべて0にする
            if A[i] != A[i + 1]:
                ans += 1  # A[i]が重複していなければカウント
    if dp[Amax] == 1:  # 重複チェック時にレンジオーバーするためAmaxだけ別で判定
        ans += 1
    print(ans)

def solve_old(N, A):
    A = sorted(A)
    dp = [True for i in range(N)]  # Trueのものは、割り切れない（カウント対象）

    idx = 0
    while True:
        a = A[idx]
        for j, target in enumerate(A[i+1:]):
            if target % a == 0:
                dp[idx + j + 1] = False


    for i, a in enumerate(A):
        if dp[i] == False:
            continue

        elif A.count(a) > 1:  # 同じ値が複数入っていたら、その値はカウント対象外
            dp[i] = False
            continue

        for j, target in enumerate(A[i + 1:]):  # 探索対象の倍数を、リストから除外していく
            if target % a == 0:
                dp[i + j + 1] = False
    count = 0
    for i in range(N):
        if dp[i] == True:
            count += 1
    print(count)


def solve_old(N, A):
    A = sorted(A)
    dp = [True for i in range(N)] # Trueのものは、割り切れない（カウント対象）

    for i, a in enumerate(A):
        if dp[i] == False:
            continue

        elif A.count(a) > 1: # 同じ値が複数入っていたら、その値はカウント対象外
            dp[i] = False
            continue

        for j, target in enumerate(A[i + 1:]): # 探索対象の倍数を、リストから除外していく
            if target % a == 0:
                dp[i+j+1] = False
    count = 0
    for i in range(N):
        if dp[i] == True:
            count += 1
    print(count)


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
import sys


def solve(N, A):
    A = sorted(A)
    dp = [True for i in range(N)]  # Trueのものは、割り切れない（カウント対象）

    for i, a in enumerate(A):
        if not dp[i]:
            continue

        elif A.count(a) > 1:  # 同じ値が複数入っていたら、その値はカウント対象外
            dp[i] = False
            continue

        true_idx = [i+1+j for j, _ in enumerate(dp[i+1:]) if dp[i+1+j] == True]
        for idx in true_idx:
            if A[idx] % a == 0:
                dp[idx] = False

    count = 0
    for i in range(N):
        if dp[i] == True:
            count += 1
    print(count)


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)


if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/env python3
import sys

def solve(N, A):
    A.sort()  # エラトステネスの篩にかけるためソート
    Amax = A[-1]
    dp = [1] * (Amax + 1)  # Aの最大値までのエラトステネスの篩を作る。
    ans = 0
    for i in range(len(A) - 1):
        p = A[i]
        if dp[p] == 1:  # A[i]がA[j]の倍数でないかをエラトステネスの篩でチェック
            for q in range(Amax // p + 1):
                dp[p * q] = 0  # A[i]の倍数をすべて0にする
            if A[i] != A[i + 1]:
                ans += 1  # A[i]が重複していなければカウント
    if dp[Amax] == 1:  # 重複チェック時にレンジオーバーするためAmaxだけ別で判定
        ans += 1
    print(ans)

def solve_old(N, A):
    A = sorted(A)
    dp = [True for i in range(N)]  # Trueのものは、割り切れない（カウント対象）

    idx = 0
    while True:
        a = A[idx]
        for j, target in enumerate(A[i+1:]):
            if target % a == 0:
                dp[idx + j + 1] = False


    for i, a in enumerate(A):
        if dp[i] == False:
            continue

        elif A.count(a) > 1:  # 同じ値が複数入っていたら、その値はカウント対象外
            dp[i] = False
            continue

        for j, target in enumerate(A[i + 1:]):  # 探索対象の倍数を、リストから除外していく
            if target % a == 0:
                dp[i + j + 1] = False
    count = 0
    for i in range(N):
        if dp[i] == True:
            count += 1
    print(count)


def solve_old(N, A):
    A = sorted(A)
    dp = [True for i in range(N)] # Trueのものは、割り切れない（カウント対象）

    for i, a in enumerate(A):
        if dp[i] == False:
            continue

        elif A.count(a) > 1: # 同じ値が複数入っていたら、その値はカウント対象外
            dp[i] = False
            continue

        for j, target in enumerate(A[i + 1:]): # 探索対象の倍数を、リストから除外していく
            if target % a == 0:
                dp[i+j+1] = False
    count = 0
    for i in range(N):
        if dp[i] == True:
            count += 1
    print(count)


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
import sys


def solve(N, A):
    A = sorted(A)
    dp = [True for i in range(N)] # Trueのものは、割り切れない（カウント対象）

    for i, a in enumerate(A):
        if dp[i] == False:
            continue
        elif A.count(a) > 1: # 同じ値が複数入っていたら、その値はカウント対象外
            dp[i] = False
        for j, target in enumerate(A[i + 1:]): # 探索対象の倍数を、リストから除外していく
            if target % a == 0:
                dp[i+j+1] = False
    count = 0
    for i in range(N):
        if dp[i] == True:
            count += 1
    print(count)


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)


if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/env python3
import sys

def solve(N, A):
    A.sort()  # エラトステネスの篩にかけるためソート
    Amax = A[-1]
    dp = [1] * (Amax + 1)  # Aの最大値までのエラトステネスの篩を作る。
    ans = 0
    for i in range(len(A) - 1):
        p = A[i]
        if dp[p] == 1:  # A[i]がA[j]の倍数でないかをエラトステネスの篩でチェック
            for q in range(Amax // p + 1):
                dp[p * q] = 0  # A[i]の倍数をすべて0にする
            if A[i] != A[i + 1]:
                ans += 1  # A[i]が重複していなければカウント
    if dp[Amax] == 1:  # 重複チェック時にレンジオーバーするためAmaxだけ別で判定
        ans += 1
    print(ans)

def solve_old(N, A):
    A = sorted(A)
    dp = [True for i in range(N)]  # Trueのものは、割り切れない（カウント対象）

    idx = 0
    while True:
        a = A[idx]
        for j, target in enumerate(A[i+1:]):
            if target % a == 0:
                dp[idx + j + 1] = False


    for i, a in enumerate(A):
        if dp[i] == False:
            continue

        elif A.count(a) > 1:  # 同じ値が複数入っていたら、その値はカウント対象外
            dp[i] = False
            continue

        for j, target in enumerate(A[i + 1:]):  # 探索対象の倍数を、リストから除外していく
            if target % a == 0:
                dp[i + j + 1] = False
    count = 0
    for i in range(N):
        if dp[i] == True:
            count += 1
    print(count)


def solve_old(N, A):
    A = sorted(A)
    dp = [True for i in range(N)] # Trueのものは、割り切れない（カウント対象）

    for i, a in enumerate(A):
        if dp[i] == False:
            continue

        elif A.count(a) > 1: # 同じ値が複数入っていたら、その値はカウント対象外
            dp[i] = False
            continue

        for j, target in enumerate(A[i + 1:]): # 探索対象の倍数を、リストから除外していく
            if target % a == 0:
                dp[i+j+1] = False
    count = 0
    for i in range(N):
        if dp[i] == True:
            count += 1
    print(count)


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
import sys


def solve(N, A):
    A = sorted(A)
    dp = [True for i in range(N)] # Trueのものは、割り切れない（カウント対象）

    for i, a in enumerate(A):
        if A.count(a) > 1: # 同じ値が複数入っていたら、その値はカウント対象外
            dp[i] = False
        for j, target in enumerate(A[i + 1:]): # 探索対象の倍数を、リストから除外していく
            if target % a == 0:
                dp[i+j+1] = False
    count = 0
    for i in range(N):
        if dp[i] == True:
            count += 1
    print(count)


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)


if __name__ == '__main__':
    main()

Fixed submission:
#!/usr/bin/env python3
import sys

def solve(N, A):
    A.sort()  # エラトステネスの篩にかけるためソート
    Amax = A[-1]
    dp = [1] * (Amax + 1)  # Aの最大値までのエラトステネスの篩を作る。
    ans = 0
    for i in range(len(A) - 1):
        p = A[i]
        if dp[p] == 1:  # A[i]がA[j]の倍数でないかをエラトステネスの篩でチェック
            for q in range(Amax // p + 1):
                dp[p * q] = 0  # A[i]の倍数をすべて0にする
            if A[i] != A[i + 1]:
                ans += 1  # A[i]が重複していなければカウント
    if dp[Amax] == 1:  # 重複チェック時にレンジオーバーするためAmaxだけ別で判定
        ans += 1
    print(ans)

def solve_old(N, A):
    A = sorted(A)
    dp = [True for i in range(N)]  # Trueのものは、割り切れない（カウント対象）

    idx = 0
    while True:
        a = A[idx]
        for j, target in enumerate(A[i+1:]):
            if target % a == 0:
                dp[idx + j + 1] = False


    for i, a in enumerate(A):
        if dp[i] == False:
            continue

        elif A.count(a) > 1:  # 同じ値が複数入っていたら、その値はカウント対象外
            dp[i] = False
            continue

        for j, target in enumerate(A[i + 1:]):  # 探索対象の倍数を、リストから除外していく
            if target % a == 0:
                dp[i + j + 1] = False
    count = 0
    for i in range(N):
        if dp[i] == True:
            count += 1
    print(count)


def solve_old(N, A):
    A = sorted(A)
    dp = [True for i in range(N)] # Trueのものは、割り切れない（カウント対象）

    for i, a in enumerate(A):
        if dp[i] == False:
            continue

        elif A.count(a) > 1: # 同じ値が複数入っていたら、その値はカウント対象外
            dp[i] = False
            continue

        for j, target in enumerate(A[i + 1:]): # 探索対象の倍数を、リストから除外していく
            if target % a == 0:
                dp[i+j+1] = False
    count = 0
    for i in range(N):
        if dp[i] == True:
            count += 1
    print(count)


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)


if __name__ == '__main__':
    main()