Problem p02642 (python)

Fixed submission:
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
    print(np.sum(dp == 1))


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
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()

Buggy submission (verdict: Runtime Error):
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()])

    A.sort()
    max_dp = A[-1]
    A = np.append(A, 10 ** 6 + 2)

    dp = np.ones(max_dp + 1, dtype=bool)

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

    ans = 0
    for i in range(n):
        if A[i] == A[i + 1] or not dp[A[i]]:
            continue
        # print(f"{i = }, {max_dp = }\n{dp = }")
        a = A[i]
        fancy = np.arange(a, max_dp + 2, a)
        dp[fancy] &= False

        ans += 1

    print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
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()])

    A.sort()
    max_dp = A[-1]
    A = np.append(A, 10 ** 6 + 2)

    dp = np.ones(max_dp + 1, dtype=bool)

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

    ans = 0
    for i in range(n):
        if A[i] == A[i + 1] or not dp[A[i]]:
            continue
        # print(f"{i = }, {max_dp = }\n{dp = }")
        a = A[i]
        fancy = np.arange(a, max_dp + 2, a)
        dp[fancy] &= False

        ans += 1

    print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
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()

Buggy submission (verdict: Runtime Error):
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(f"{i = }, {j = }, {ans = }")

    print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
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(f"{i = }, {j = }, {ans = }")

    print(ans)


if __name__ == '__ma

Buggy submission (verdict: Runtime Error):
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 i in s:
                continue
            elif A[i] % A[j] == 0:
                s.add(i)
                break
        else:
            ans += 1
            # print(f"{i = }, {j = }, {ans = }")

    print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
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 A[j] in s:
                continue
            elif A[i] % A[j] == 0:
                s.add(i)
                break
        else:
            ans += 1
            # print(f"{i = }, {j = }, {ans = }")

    print(ans)


if __name__ == '__main__':
    main()