Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
for i in range(N):
  print(A.count(1+i))

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
B = [0]*N
for i in A:
  B[i-1] += 1
for j in range(N):
  print(B[j])
Buggy python submission (verdict: Runtime Error):
N = int(input())
print(min(N%K, K-N%K))

Fixed submission:
N,K = map(int, input().split())
print(min(N%K, K-N%K))

Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
list = []
if K == 1:
  print(0)
else:
  for i in range(N):
    N = abs(N-K)
    list.append(N)
    list = sorted(list)
  print(list[0])

Fixed submission:
N,K = map(int, input().split())
print(min(N%K, K-N%K))
Buggy python submission (verdict: Time Limit Exceeded):
import math
n, a, b = map(int, input().split())
X = 2**n-1
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

Y = combinations_count(n, a)
Z = combinations_count(n, b)

print(X-Y-Z)

Fixed submission:
n, a, b = map(int, input().split())
mod = 10**9 + 7
def nck(k):
    y, z = 1, 1
    for i in range(1, k+1):
        y = (y * (n+1-i)) % mod
        z = (z * pow(i, mod-2, mod)) % mod
    return (y*z) % mod
 
ans = (pow(2, n, mod) - 1 - nck(a) - nck(b)) % mod
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
d = {}
for _ in range(N):
  S = input()
  if S in d:
    d[S] += 1
  else:
   　d[S] = 1
m = max(d.values())
for s in sorted(k for k in d if d[k] == m):
  print(s)

Fixed submission:
N = int(input())
d = {}
for _ in range(N):
  S = input()
  if S in d:
    d[S] += 1
  else:
    d[S] = 1
m = max(d.values())
for s in sorted(k for k in d if d[k] == m):
  print(s)
Buggy python submission (verdict: Runtime Error):
1 s = input()
2 print('x' * len(s))

Fixed submission:
s = input()
print("x" * len(s))

Buggy python submission (verdict: Runtime Error):
1 s = input().rstrip()
2 print('x' * len(s))

Fixed submission:
s = input()
print("x" * len(s))
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
p = list(map(int, input().split()))
ans = [sum(p[:K])]
for i in range(N-K):
  ans.append(ans[-1]-p[i]+p[i+k])
print(max(ans)/2+K/2)
    

Fixed submission:
N, K = map(int, input().split())
p = list(map(int, input().split()))
ans = [sum(p[:K])]
for i in range(N-K):
  ans.append(ans[-1]-p[i]+p[i+K])
print(max(ans)/2+K/2)

Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
p = list(map(int, input().split()))
ans = []
for i in range(K-1):
   T = p[i:i+K]      
   ans.append(sum(T)/2+0.5*K)
print(ans[-1])
    
      

Fixed submission:
N, K = map(int, input().split())
p = list(map(int, input().split()))
ans = [sum(p[:K])]
for i in range(N-K):
  ans.append(ans[-1]-p[i]+p[i+K])
print(max(ans)/2+K/2)
Buggy python submission (verdict: Runtime Error):
N,A,B = map(int, input().split())
if (B-A)%2 == 0 and B-A => 0:
  print((B-A)//2+1)
if (B-A)%2 == 0 and A-B => 0:
  print((A-B)//2+1)
D = A-1
E = N-A
F = B-1
G = N-B
elif D+F > E+G and E => G:
  print(E)
elif D+F > E+G and E < G:
  print(G)
elif D+F < E+G and D => F:
  print(D)
else:
  print(F)


Fixed submission:
N,A,B = map(int, input().split())
if (B-A)%2==0:
  print((B-A)//2)
else:
  print(min(A-1,N-B)+1+(B-A-1)//2)

Buggy python submission (verdict: Runtime Error):
N,A,B = map(int, input().split())
if (B-A)%2 == 0 and B-A => 0:
  print((B-A)//2+1)
if (B-A)%2 == 0 and A-B => 0:
  print((A-B)//2+1)
D = A-1
E = N-A
F = B-1
G = N-B
elif D+F > E+G and D => F:
  print(D)
elif D+F > E+G and D <= F:
  print(F)
elif D+F < E+G and E => G:
  print(E)
else:
  print(G)


Fixed submission:
N,A,B = map(int, input().split())
if (B-A)%2==0:
  print((B-A)//2)
else:
  print(min(A-1,N-B)+1+(B-A-1)//2)

Buggy python submission (verdict: Runtime Error):
N,A,B = map(int, input().split())
if (B-A)%2 == 0 and B-A => 0:
  print((B-A)//2+1)
if (B-A)%2 == 0 and A-B => 0:
  print((A-B)//2+1)
D = A-1
E = N-A
F = B-1
G = N-B
elif D+F > E+G and D => F:
  print(D)
elif D+F > E+G and D <= F:
  print(F)
elif D+F < E+G and E => G:
  pritn(E)
else:
  print(G)


Fixed submission:
N,A,B = map(int, input().split())
if (B-A)%2==0:
  print((B-A)//2)
else:
  print(min(A-1,N-B)+1+(B-A-1)//2)
Buggy python submission (verdict: Runtime Error):
import math
N = int(input())
N_root = math.sqrt(N)
M = int(N_root)
list = []
for i in range(1,M):
  if N%i == 0:
    list.append(i+N//i-2)
list = sorted(list)
print(list[0])

    


Fixed submission:
import math
N = int(input())
N_root = math.sqrt(N)
M = int(N_root)
list = []
for i in range(1,M+1):
  if N%i == 0:
    list.append(i+N//i-2)
list = sorted(list)
print(list[0])
Buggy python submission (verdict: Runtime Error):
import bisect
N = int(input())
list = list(map(int,input().split()))
list = sorted(list)
ans = 0
for i in range(n-2):
    for j in range(i+1,n-1):
        x = list[i]+list[j]
        ind = bisect.bisect_left(list,x)
        ans+=(ind-j-1)
print(ans)
    
    

Fixed submission:
import bisect
N = int(input())
list = list(map(int,input().split()))
list = sorted(list)
ans = 0
for i in range(N-2):
    for j in range(i+1,N-1):
        x = list[i]+list[j]
        ind = bisect.bisect_left(list,x)
        ans+=(ind-j-1)
print(ans)
Buggy python submission (verdict: Runtime Error):
N, K, Q = map(int, input().split())
A = [0] * Q
for i in range(Q):
    A[i] = int(input())
list = [K-Q] *N
for i in range(Q):
  list[A[i]] += 1
for i in range(N):
  if list[i] >= 1:
    print('Yes')
  else:
    print('No')
  

Fixed submission:
N, K, Q = map(int, input().split())
A = [0] * Q
for i in range(Q):
    A[i] = int(input())
list = [K-Q] *N
for i in range(Q):
  list[A[i]-1] += 1
for i in range(N):
  if list[i] >= 1:
    print('Yes')
  else:
    print('No')

Buggy python submission (verdict: Runtime Error):
N, K, Q = map(int, input().split())
A = [0] * Q
for i in range(Q):
    A[i] = int(input())
list = [K-Q] *N
for i in range(Q):
  list[A[i]] += 1
for i in range(N):
  if list[i] >= 1:
    print('Yes')
  else:
    print('No')

Fixed submission:
N, K, Q = map(int, input().split())
A = [0] * Q
for i in range(Q):
    A[i] = int(input())
list = [K-Q] *N
for i in range(Q):
  list[A[i]-1] += 1
for i in range(N):
  if list[i] >= 1:
    print('Yes')
  else:
    print('No')
Buggy python submission (verdict: Runtime Error):
N = int(input())
H = list(map(int, input().split()))
list = []
a = 0
for i in range(N-1):
  if H[i] >= H[i+1]:
    a += 1
    list.append(a)
  else:
    list.append(a)
    a = 0
list = sorted(list)
print(list[-1])
  

Fixed submission:
N = int(input())
H = list(map(int, input().split()))
list = []
a = 0
for i in range(N-1):
  if H[i] >= H[i+1]:
    a += 1
  else:
    list.append(a)
    a = 0
list.append(a)
list = sorted(list)
print(list[-1])

Buggy python submission (verdict: Runtime Error):
N = int(input())
H = list(map(int, input().split()))
list = []
a = 0
for i in range(N-1):
  if H[i] >= H[i+1]:
    a += 1
    list.append(a)
  else:
    list.append(a)
    a = 0
list = sorted(list)
print(list[-1])

Fixed submission:
N = int(input())
H = list(map(int, input().split()))
list = []
a = 0
for i in range(N-1):
  if H[i] >= H[i+1]:
    a += 1
  else:
    list.append(a)
    a = 0
list.append(a)
list = sorted(list)
print(list[-1])
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
H = list(map(int, input().split()))
ans = 'Yes'
for i in range(N):
  for j in range(i):
    if H[i] < H[j]-1:
      ans = 'No'
      
print(ans)

  

Fixed submission:
n = int(input())
 
h = list(map(int,input().split()))
 
height = h[0]
 
q = 0
 
for i in h:
    if i < height:
        q = 1
        break
    elif i > height:
        height = i-1
    else:
        height = i
        
if q == 1:
    print("No")
else:
    print("Yes")
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
X = min(A, B, C, D, E)
if X >= N:
  print(5)
else:
  if N%X == 0:
    print(4+N//X)
  elese:
    print(5+N//X)

Fixed submission:
N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
X = min(A, B, C, D, E)
if X >= N:
  print(5)
else:
  if N%X == 0:
    print(4+N//X)
  else:
    print(5+N//X)
Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
list = []
for _ in range(n):
  a,b = map(int,input().split())
  list.append([a,b])
list.sort()
ans = 0
for a,b in l:
  ans += min(b,M)*a
  M = max(0,M-b)
print(ans)

Fixed submission:
N,M = map(int,input().split())
list = []
for _ in range(N):
  a,b = map(int,input().split())
  list.append([a,b])
list.sort()
ans = 0
for a,b in list:
  ans += min(b,M)*a
  M = max(0,M-b)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int, input().split())
X = list(map(int,input().split()))
if N >= M:
  print(0)
else:
  X = sorted(X)
  list = []
  for i in range(M-1):
    list.append(X[i+1]-X[i])
    list = sorted(list)
    list1 = list[:M-N]
  print(sum(list1))

Fixed submission:
N,M = map(int, input().split())
X = list(map(int,input().split()))
if N >= M:
  print(0)
else:
  X = sorted(X)
  list = [X[i]-X[i-1] for i in range(1,M)]
  list = sorted(list)
  list1 = list[:M-N]
  print(sum(list1))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
X = list(map(int, input().split()))
Y = sorted(X)
Y1 = Y[:N//2]
Y2 = Y[N//2:]
ans1 = Y1[-1]
ans2 = Y2[0]
for i in range(N):
  if X[i] in Y1:
    print(ans2)
  else:
    print(ans1)

Fixed submission:
N = int(input())
X = list(map(int, input().split()))
Y = sorted(X)
Y1 = Y[:N//2]
Y2 = Y[N//2:]
ans1 = Y1[-1]
ans2 = Y2[0]
for i in range(N):
  if X[i] <= ans1:
    print(ans2)
  else:
    print(ans1)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
if (a*b) % 2:
    print("Odd")
else:
    print("Even")

Fixed submission:
A,B = map(int, input().split())
if A*B%2 == 0:
  print('Even')
else:
  print('Odd')

Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
if (a*b) % 2:
    print("Odd")
else:
    print("Even")

Fixed submission:
A,B = map(int, input().split())
if A*B%2 == 0:
  print('Even')
else:
  print('Odd')

Buggy python submission (verdict: Runtime Error):
a,b = map(int, input().split())
if  (a*b) % 2:
     print('odd')
else:
     print('even')

Fixed submission:
A,B = map(int, input().split())
if A*B%2 == 0:
  print('Even')
else:
  print('Odd')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
A = sorted(A)
B = set(A)
ans = 0
for i in B:
  if A.count(i) > i:
    ans += A.count(i)-i
  elif A.count(i) < i:
    ans += A.count(i)
print(ans)

Fixed submission:
from collections import Counter
N = int(input())
C = Counter(map(int, input().split()))
ans = 0
for i in C:
    if C[i]>i:
        ans += C[i]-i
    elif C[i]<i:
        ans += C[i]
print(ans)
Buggy python submission (verdict: Runtime Error):
print(input().count("1"))

Fixed submission:
print(input().count("1"))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = []
for _ in range(N):
    A.append(input()) 
B = set(A)
M = len(B)
ans = 0
for i in B:
  if A.count(i)%2 ==1:
    ans += 1
print(ans)

Fixed submission:
import collections
n=int(input())
arr=[]
for i in range(n):
  a=int(input())
  arr.append(a)
c = collections.Counter(arr)
ans=0
for j in c.values():
    if j % 2 != 0:
        ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
N, A, B = map(int, input().split())
if A > B:
  print(0)
elif A == B:
  print(1)
elif B-A >=N:
  print(0)
else: 
  print((B-A)*X+1)

Fixed submission:
N, A, B = map(int, input().split())
if A > B:
  print(0)
else:
  if N == 1 and A == B:
    print(1)
  elif N == 1:
    print(0)
  else:
    print((B-A)*(N-2)+1)
Buggy python submission (verdict: Runtime Error):
N,A,B = map(int, input().split())
S = input().split()
s=[]
for i in S:
    s.append(i)
list=[]
H = list.count('b')
for i in range(N):
  if s[i] == 'c'
    print('No')
  elif s[i] =='a' and len(list) <= A+B:
    print('Yes')
    list.append(a)
  elif s[i] =='a':
    print('No')
  elif len(list) <= A+B and H <= B:
    print('Yes')
  else:
    print('No')

Fixed submission:
N, A, B = map(int, input().split())
S = str(input())
 
total = 0
kaigai = 0
 
for i in range(0, len(S)):
    if S[i] == 'a':
        if total < A+B:
            print('Yes')
            total += 1
        else:
            print('No')
    elif S[i] == 'b':
        if total < A+B and kaigai <B:
            print('Yes')
            total += 1
            kaigai += 1
        else:
            print('No')
    else:
        print('No')
Buggy python submission (verdict: Runtime Error):
a=input()
b=input()
h=input()
print((int(a)+int(b)*int(h)//2)

Fixed submission:
a=input()
b=input()
h=input()
print((int(a)+int(b))*int(h)//2)

Buggy python submission (verdict: Runtime Error):
a = input()
b = input()
h = input()
print((a+b)*h/2)

Fixed submission:
a=input()
b=input()
h=input()
print((int(a)+int(b))*int(h)//2)
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
def main():
    _ = int(input())
    A = [int(x) for x in input().split()]
    mod = 10 ** 9 + 7

    ans = 0
    for index, i in enumerate(A):
        ans += i * sum(A[index + 1:]) % mod
    print(ans % mod)


if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/env python3
def main():
    _ = int(input())
    A = [int(x) for x in input().split()]
    mod = 10 ** 9 + 7

    lst = [sum(A)]
    for j in A:
        lst.append(lst[-1] - j)
    ans = 0
    for index, i in enumerate(A):
        ans += i * lst[index + 1] % mod
    print(ans % mod)


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
def main():
    _ = int(input())
    A = [int(x) for x in input().split()]
    mod = 10 ** 9 + 7

    ans = 0
    for index, i in enumerate(A):
        for j in A[index + 1:]:
            ans += i * j % mod
    print(ans % mod)


if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/env python3
def main():
    _ = int(input())
    A = [int(x) for x in input().split()]
    mod = 10 ** 9 + 7

    lst = [sum(A)]
    for j in A:
        lst.append(lst[-1] - j)
    ans = 0
    for index, i in enumerate(A):
        ans += i * lst[index + 1] % mod
    print(ans % mod)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
def main():
    from collections import deque

    def bfs(S, start_h, start_w, goal_h, goal_w, H, W):
        que0 = deque()
        que1 = deque()
        dist = [[INF] * W for _ in range(H)]
        dist[start_h][start_w] = 0
        que0.append((start_h, start_w))
        while que0 or que1:
            nh, nw = que0.popleft() if que0 else que1.popleft()
            for dh in range(-2, 3):
                for dw in range(-2, 3):
                    next_h = nh + dh
                    next_w = nw + dw
                    cost = 0 if abs(dh) + abs(dw) <= 1 else 1
                    if not (0 <= next_h < H and 0 <= next_w < W):
                        continue
                    if S[next_h][next_w] == '#':
                        continue
                    if dist[next_h][next_w] > dist[nh][nw] + cost:
                        dist[next_h][next_w] = dist[nh][nw] + cost
                        if cost == 0:
                            que0.append((next_h, next_w))
                        else:
                            que1.append((next_h, next_w))
        return dist[goal_h][goal_w] if dist[goal_h][goal_w] != INF else - 1
        
    H, W = map(int, input().split())
    Ch, Cw = (int(i) - 1 for i in input().split())
    Dh, Dw = (int(i) - 1 for i in input().split())
    S = [input() for _ in range(H)]
    
    INF = 10 ** 6
    ans = bfs(S, Ch, Cw, Dh, Dw, H, W)
    print(ans)


if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/env python3
def main():
    from collections import deque

    def bfs(S, start_h, start_w, goal_h, goal_w, H, W):
        que0 = deque()
        que1 = deque()
        dist = [[INF] * W for _ in range(H)]
        dist[start_h][start_w] = 0
        que0.append((start_h, start_w))
        while que0 or que1:
            nh, nw = que0.popleft() if que0 else que1.popleft()
            for dh in range(-2, 3):
                for dw in range(-2, 3):
                    next_h = nh + dh
                    next_w = nw + dw
                    cost = 0 if abs(dh) + abs(dw) <= 1 else 1
                    if not (0 <= next_h < H and 0 <= next_w < W):
                        continue
                    if S[next_h][next_w] == '#':
                        continue
                    if dist[next_h][next_w] > dist[nh][nw] + cost:
                        dist[next_h][next_w] = dist[nh][nw] + cost
                        if cost == 0:
                            que0.append((next_h, next_w))
                        else:
                            que1.append((next_h, next_w))
        return dist[goal_h][goal_w] if dist[goal_h][goal_w] != INF else - 1
        
    H, W = map(int, input().split())
    Ch, Cw = (int(i) - 1 for i in input().split())
    Dh, Dw = (int(i) - 1 for i in input().split())
    S = [input() for _ in range(H)]
    
    INF = 10 ** 6
    ans = bfs(S, Ch, Cw, Dh, Dw, H, W)
    print(ans)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
def main():
    import sys
    
    input = sys.stdin.readline

    K = int(input())
    res = 7

    if K % 2:
        while res < 10 ** 7:
            cal = func(K, res)
            k = str(cal)
            if k.count('7') == len(k):
                print(len(k))
                break
            res += 7
        else:
            print('-1')
    else:
        print('-1')


if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/env python3
"""
数列777...は奇数故，Kが偶数だったら×

"""
from numba import njit


@njit(cache=True)
def func(a, b):
    return a * b


def main():
    import sys
    input = sys.stdin.readline

    K = int(input())

    # mod Kを考える(mod=module(剰余))
    x = 7 % K
    for i in range(1, K + 1):
        if x == 0:
            print(i)
            return
        x = (x * 10 + 7) % K
    print(-1)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
def resolve():
    D = int(input())
    C = [int(x) for x in input().split()]
    S = []
    for i in range(D):
        S.append(list(map(int, input().split())))
    last_d = []
    score = 0
    t = 0

    for i in range(len(C)):
        t = max(t, C[i])

    for d in range(D):
        score += S[d][t[d] - 1]
        last_d.append(t[d] - 1)
        for i in range(len(C)):
            if i in last_d:
                score -= C[i] * last_d[::-1].index(i)
            else:
                score -= C[i] * (d + 1)
        print(score)

    
if __name__ == "__main__":
    resolve()

Fixed submission:
def resolve():
    D = int(input())
    C = [int(x) for x in input().split()]
    S = []
    for i in range(D):
        S.append(list(map(int, input().split())))
    last_d = []
    score = 0

    for d in range(D):
        contest = 0
        for i in range(len(C)):
            contest = max(contest, S[d][i])
        score += contest
        last_d.append(S[d].index(contest))
        for i in range(len(C)):
            if i in last_d:
                score -= C[i] * last_d[::-1].index(i)
            else:
                score -= C[i] * (d + 1)
        print(S[d].index(contest) + 1)

    
if __name__ == "__main__":
    resolve()
Buggy python submission (verdict: Runtime Error):
def resolve():
    def dfs(a, b, k):
        nonlocal cnt
        seen[a][b] = True
        na = a + 1
        nb = b + 1
        if na <= N and seen[na][b] is False and k >= book_a[na]:
            k -= book_a[na]
            cnt = max(cnt, na + b)
            dfs(na, b, k)
        if nb <= M and seen[a][nb] is False and k >= book_b[nb]:
            k -= book_b[nb]
            cnt = max(cnt, a + nb)
            dfs(a, nb, k)

    N, M, k = map(int, input().split())
    book_a = [int(x) for x in input().split()]
    book_b = [int(x) for x in input().split()]
    book_a.insert(0, 0)
    book_b.insert(0, 0)
    cnt = 0
    seen = [[False] * (M + 1) for _ in range(N + 1)]
    dfs(0, 0, k)
    print(cnt)


if __name__ == "__main__":
    resolve()


Fixed submission:
a = int(input())
print(a + a ** 2 + a ** 3)

Buggy python submission (verdict: Runtime Error):
def dfs(a, b, k):
    global cnt
    seen[a][b] = True
    na = a + 1
    nb = b + 1
    if na <= N and seen[na][b] is False and k >= book_a[na]:
        k -= book_a[na]
        cnt = max(cnt, na + b)
        dfs(na, b, k)
    if nb <= M and seen[a][nb] is False and k >= book_b[nb]:
        k -= book_b[nb]
        cnt = max(cnt, a + nb)
        dfs(a, nb, k)
        
N, M, k = map(int, input().split())
book_a = [int(x) for x in input().split()]
book_b = [int(x) for x in input().split()]
book_a.insert(0, 0)
book_b.insert(0, 0)
cnt = 0
seen = [[False] * (M + 1) for _ in range(N + 1)]
dfs(0, 0, k)
print(cnt)

Fixed submission:
a = int(input())
print(a + a ** 2 + a ** 3)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
a_max = max(a)
lst = [0] * (a_max + 1)
cnt = 0
for i in a:
    if lst[i] > 1:  # 配列中のカウントが2以上なら以降の処理を省略
        continue
    for j in range(a_max // i + 1):  # Aiの倍数にインクリメント(配列の上限はa[-1])
        lst[i * j] += 1
    lst[1::i] += 1
for i in a:
    if lst[i] == 1:
        cnt += 1
print(cnt)

Fixed submission:
import numpy as np

n = int(input())
a = list(map(int, input().split()))
a_max = max(a)
lst = [0] * (a_max + 1)
cnt = 0
# if len(a) <= 1:
#     print(0)
# else:
for i in a:
    if lst[i] > 1:  # 配列中のカウントが2以上なら以降の処理を省略
        continue
    for j in range(a_max // i + 1):  # Aiの倍数にインクリメント(配列の上限はa[-1])
        lst[i * j] += 1
    # lst[1::i] += 1
for i in a:
    if lst[i] == 1:
        cnt += 1
print(cnt)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
a_max = max(a)
lst = [0] * (a_max + 1)
cnt = 0
for i in a:
    if lst[i] > 1:  # 配列中のカウントが2以上なら以降の処理を省略
        continue
    lst[1::i] += 1
    # for j in range(a_max // i + 1):  # Aiの倍数にインクリメント(配列の上限はa[-1])
    #     lst[i * j] += 1
for i in a:
    if lst[i] == 1:
        cnt += 1
print(cnt)

Fixed submission:
import numpy as np

n = int(input())
a = list(map(int, input().split()))
a_max = max(a)
lst = [0] * (a_max + 1)
cnt = 0
# if len(a) <= 1:
#     print(0)
# else:
for i in a:
    if lst[i] > 1:  # 配列中のカウントが2以上なら以降の処理を省略
        continue
    for j in range(a_max // i + 1):  # Aiの倍数にインクリメント(配列の上限はa[-1])
        lst[i * j] += 1
    # lst[1::i] += 1
for i in a:
    if lst[i] == 1:
        cnt += 1
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
cnt = 0
for i in range(len(a)):
    for j in range(len(a)):
        if i == j:
            pass
        elif a[i] % a[j] == 0:
            break
        if j == len(a) - 1:
            cnt += 1
print(cnt)

Fixed submission:
import numpy as np

n = int(input())
a = list(map(int, input().split()))
a_max = max(a)
lst = [0] * (a_max + 1)
cnt = 0
# if len(a) <= 1:
#     print(0)
# else:
for i in a:
    if lst[i] > 1:  # 配列中のカウントが2以上なら以降の処理を省略
        continue
    for j in range(a_max // i + 1):  # Aiの倍数にインクリメント(配列の上限はa[-1])
        lst[i * j] += 1
    # lst[1::i] += 1
for i in a:
    if lst[i] == 1:
        cnt += 1
print(cnt)