Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
H, N = map(int, input().split())
A = [0] * N
B = [0] * N
for i in range(N):
    A[i], B[i] = map(int, input().split())
INF = 10**10


dp = [[0] * INF for _ in range(N+1)]

for b in range(1, INF):
    for i in range(1, N+1):
        if b - B[i-1] > 0:
            dp[i][b] = max(dp[i][b - B[i-1]] + A[i-1], dp[i - 1][b])
        else:
            dp[i][b] = max(dp[i-1], A[i-1])
    if dp[-1][b] >= H:
        print(b)
        break

Fixed submission:
H, N = map(int, input().split())
A = [0] * N
B = [0] * N
for i in range(N):
    A[i], B[i] = map(int, input().split())

dp = [[10**10] * (H + 1) for _ in range(N+1)]

for i in range(1, N+1):
    for h in range(1, H+1):
        if h - A[i-1] <= 0:
            dp[i][h] = min(dp[i-1][h], B[i-1])
        else:
            dp[i][h] = min(dp[i-1][h], dp[i][h-A[i-1]] + B[i-1])

print(dp[-1][-1])

Buggy python submission (verdict: Runtime Error):
H, N = map(int, input().split())
A = [0] * N
B = [0] * N
for i in range(N):
    A[i], B[i] = map(int, input().split())
INF = 10**10


dp = [[0] * INF for _ in range(N+1)]

for b in range(1, INF):
    for i in range(1, N+1):
        if b - B[i-1] > 0:
            dp[i][b] = max(dp[i][b - B[i-1]] + A[i-1], dp[i - 1][b])
        else:
            dp[i][b] = max(dp[i-1], A[i-1])
    if dp[-1][b] >= H:
        print(b)
        break

Fixed submission:
H, N = map(int, input().split())
A = [0] * N
B = [0] * N
for i in range(N):
    A[i], B[i] = map(int, input().split())

dp = [[10**10] * (H + 1) for _ in range(N+1)]

for i in range(1, N+1):
    for h in range(1, H+1):
        if h - A[i-1] <= 0:
            dp[i][h] = min(dp[i-1][h], B[i-1])
        else:
            dp[i][h] = min(dp[i-1][h], dp[i][h-A[i-1]] + B[i-1])

print(dp[-1][-1])

Buggy python submission (verdict: Runtime Error):
H, N = map(int, input().split())
A = [0] * N
B = [0] * N
for i in range(N):
    A[i], B[i] = map(int, input().split())
INF = 10**10


dp = [[0] * INF for _ in range(N+1)]

for b in range(1, INF):
    for i in range(1, N+1):
        if b - B[i-1] > 0:
            dp[i][b] = max(dp[i][b - B[i-1]] + A[i-1], dp[i - 1][b])
        else:
            dp[i][b] = max(dp[i-1], A[i-1])
    if dp[-1][b] >= H
        print(b)
        break

Fixed submission:
H, N = map(int, input().split())
A = [0] * N
B = [0] * N
for i in range(N):
    A[i], B[i] = map(int, input().split())

dp = [[10**10] * (H + 1) for _ in range(N+1)]

for i in range(1, N+1):
    for h in range(1, H+1):
        if h - A[i-1] <= 0:
            dp[i][h] = min(dp[i-1][h], B[i-1])
        else:
            dp[i][h] = min(dp[i-1][h], dp[i][h-A[i-1]] + B[i-1])

print(dp[-1][-1])
Buggy python submission (verdict: Runtime Error):
N,M=map(int,input().split())

print("{}{}".format(N.M))

Fixed submission:
N,M=map(int,input().split())
if N == M:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = [ int(i) for i in input().split()]

num = 0
for base in range(N):
    flag = 0
    for n in range(base):
        if P[n] < P[base]:
            flag = 1
    if flag == 1:
        num = num+1
        
print(N-num)

Fixed submission:
N = int(input())
P = [ int(i) for i in input().split()]
 
num = 0
min = N
for base in range(N):
    if P[base] <= min:
        min = P[base]
        num += 1
        
print(num)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

str_N = str(N)
num = 0
char_set = {str(i) for i in range(1, N)}

for n1 in range(1, N + 1):
    for n2 in range(1, N + 1):
        str_n1, str_n2 = map(str, [n1, n2])
        length1 = len(str_n1)
        length2 = len(str_n2)

        if str_n1[0] == str_n2[length2-1] and str_n1[length1-1] == str_n2[0]:
            num += 1


print(int(num))

Fixed submission:
N = int(input())

M = [[0]*10 for _ in range(10)]

for n in range(1,N+1):
    head = int(str(n)[0])
    tail = int(str(n)[-1])
    M[head][tail] += 1

ans = 0
for i in range(10):
    for j in range(i+1,10):
        ans += M[i][j]*M[j][i]*2
    ans += M[i][i]**2

print(ans)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())

if M == 0 or N == 0:
    print("{} {}".format(0, 0))
else:

    p = [0]*M
    S = [0]*M

    for i in range(M):
        tmp = input().split()
        p[i] = int(tmp[0])
        S[i] = tmp[1]

    penalty = 0


    correct_set = set()
    for i in range(M):
        if S[i] == 'AC':
            correct_set.add(p[i])

    correct = len(correct_set)

    for i in range(M):
        if S[i] == 'AC':
            correct_set.remove(p[i])
        elif S[i] == 'WA' and p[i] in correct_set:
            penalty += 1


            

    print("{} {}".format(correct, penalty))

Fixed submission:
N, M = map(int, input().split())

if M == 0 or N == 0:
    print("{} {}".format(0, 0))
else:

    p = [0]*M
    S = [0]*M

    for i in range(M):
        tmp = input().split()
        p[i] = int(tmp[0])
        S[i] = tmp[1]

    penalty = 0


    correct_set = set()
    for i in range(M):
        if S[i] == 'AC':
            correct_set.add(p[i])

    correct = len(correct_set)

    for i in range(M):
        if S[i] == 'AC' and p[i] in correct_set:
            correct_set.remove(p[i])
        elif S[i] == 'WA' and p[i] in correct_set:
            penalty += 1


            

    print("{} {}".format(correct, penalty))
Buggy python submission (verdict: Runtime Error):
import math

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

print(int(A*B/math.gcd(A, B)))

Fixed submission:
import fractions

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

print(int(A*B/fractions.gcd(A, B)))
Buggy python submission (verdict: Runtime Error):

X, Y = map(int, input().split())
mod = 10 ** 9 + 7


def prime_mod(n, m):
    S = 1
    for i in range(1, n+1):
        S *= i
        S %= m
    return S


def prime_inv_mod(n, m):
    invs = [0] * (n + 1)
    invs[1] = 1
    for i in range(2, n + 1):
        invs[i] = m - invs[m % i] * (m//i) % m
    return invs


a = 2 * Y - X
b = 2 * X - Y
if a % 3 != 0 or b % 3 != 0:
    print(0)
else:
    a //= 3
    b //= 3
    upper = prime_mod(a+b, mod)
    mod_inv = prime_inv_mod(max(a, b), mod)

    lower1 = 1
    for i in range(1, max(a, b)+1):
        lower1 *= mod_inv[i]
        lower1 %= mod
        if i == min(a, b):
            lower2 = lower1
    print((upper*lower1*lower2) % mod)


Fixed submission:

X, Y = map(int, input().split())
mod = 10 ** 9 + 7


def prime_mod(n, m):
    S = 1
    for i in range(1, n+1):
        S *= i
        S %= m
    return S


def prime_inv_mod(n, m):
    invs = [0] * (n + 1)
    invs[1] = 1
    for i in range(2, n + 1):
        invs[i] = m - invs[m % i] * (m//i) % m
    return invs


a = 2 * Y - X
b = 2 * X - Y
if a % 3 != 0 or b % 3 != 0 or a < 0 or b < 0:
    print(0)
else:
    a //= 3
    b //= 3
    upper = prime_mod(a+b, mod)
    mod_inv = prime_inv_mod(max(a, b), mod)

    lower1 = 1
    lower2 = 1
    for i in range(1, a + 1):
        lower1 *= mod_inv[i]
        lower1 %= mod
    for i in range(1, b + 1):
        lower2 *= mod_inv[i]
        lower2 %= mod

    print((upper*lower1*lower2) % mod)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
L = sorted([int(l) for l in input().split()])

num = 0
for na in range(N-2):
    for nb in range(na+1, N - 1):
        for nc in range(nb+1, N):
            if L[nc] < L[na] + L[nb]:
                num += 1

print(num)

Fixed submission:
N = int(input())
L = sorted([int(l) for l in input().split()])
INF = 10**8
L.append(INF)
L.append(INF)

num = 0
for na in range(N-2):
    for nb in range(na+1, N - 1):
        r = N+1
        l = nb
        while r - l > 1:
            c = (l + r) // 2
            if L[c] < L[na] + L[nb]:
                l = c
            else:
                r = c
        num += l - nb

print(num)
Buggy python submission (verdict: Runtime Error):
S = input()
T = input()

ans = 0
for s, t in zip(S, T):
    if s == t:
        ans += 1

print(ans)S = input()
T = input()

ans = 0
for s, t in zip(S, T):
    if s == t:
        ans += 1

print(ans)

Fixed submission:
S = input()
T = input()

ans = 0
for s, t in zip(S, T):
    if s == t:
        ans += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
H = [int(h) for h in input().split()]
A = [0] * (N - 1)
for n in range(N - 1):
    if H[n] >= H[n+1]:
        if n == 0:
            A[n] = 1
        else:
            A[n] = A[n - 1] + 1

print(max(A))

Fixed submission:
N = int(input())
H = [int(h) for h in input().split()]
A = [0] * N
for n in range(N - 1):
    if H[n] >= H[n+1]:
        if n == 0:
            A[n] = 1
        else:
            A[n] = A[n - 1] + 1

print(max(A))
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
T = input()

dic = {chr(s): [] for s in range(ord("a"), ord("z") + 1)}
for i, s in enumerate(S):
    dic[s].append(i + 1)

out = 0
cnt = -1
V = [0] * len(T)
for i, t in enumerate(T):
    if dic[t]:
        for l in dic[t]:
            if cnt < l:
                V[i] = l
                cnt = l
                break
        else:
            cnt = dic[t][0]
            V[i] = cnt
    else:
        out = 1
        break
if out == 1:
    print(-1)
else:
    cnt = 0
    for i in range(len(V)-1):
        if V[i+1] <= V[i]:
            cnt += 1
    if cnt == 0:
        print(V[-1])
    elif V[-1] == len(S):
        print(len(S) * (cnt + 1))
    else:
        print(len(S) * cnt + V[-1])
a = 0

Fixed submission:
import bisect
S = input()
T = input()

dic = {chr(s): [] for s in range(ord("a"), ord("z") + 1)}
for i, s in enumerate(S):
    dic[s].append(i + 1)

out = 0
cnt = -1
V = [0] * len(T)
for i, t in enumerate(T):
    if dic[t]:
        """
        for l in dic[t]:
            if cnt < l:
                V[i] = l
                cnt = l
                break
        else:
            cnt = dic[t][0]
        """

        idx = bisect.bisect(dic[t], cnt)
        if idx == len(dic[t]):
            V[i] = dic[t][0]
            cnt = dic[t][0]
        else:
            V[i] = dic[t][idx]
            cnt = dic[t][idx]

    else:
        out = 1
        break
if out == 1:
    print(-1)
else:
    cnt = 0
    for i in range(len(V)-1):
        if V[i+1] <= V[i]:
            cnt += 1
    if cnt == 0:
        print(V[-1])
    elif V[-1] == len(S):
        print(len(S) * (cnt + 1))
    else:
        print(len(S) * cnt + V[-1])
a = 0
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
N = len(S)
S = list(S)
S.reverse()

dp = [[0]*13 for _ in range(N + 1)]
dp[0][0] = 1
mod = 10**9+7
pow10 = 1
for i in range(1, N + 1):
    if S[i-1] == "?":
        for j in range(13):
            for k in range(10):
                dp[i][(j + k*pow10) % 13] += dp[i-1][j]
    else:
        for j in range(13):
            dp[i][(j+int(S[i-1])*pow10) % 13] = dp[i-1][j]
    pow10 *= 10
    for j in range(13):
        dp[i][j] %= mod

print(dp[N][5])


Fixed submission:
S = input()
N = len(S)
S = list(S)
S.reverse()

dp = [[0]*13 for _ in range(N + 1)]
dp[0][0] = 1
mod = 10**9+7
pow10 = 1
for i in range(1, N + 1):
    if S[i-1] == "?":
        for j in range(13):
            for k in range(10):
                dp[i][(j + k*pow10) % 13] += dp[i-1][j]
    else:
        for j in range(13):
            dp[i][(j+int(S[i-1])*pow10) % 13] = dp[i-1][j]
    pow10 = (pow10 * 10) % 13
    for j in range(13):
        dp[i][j] %= mod

print(dp[N][5])

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
N = len(S)
S = list(S)
S.reverse()

dp = [[0]*13 for _ in range(100100)]
dp[0][0] = 1
mod = 10**9+7
for i in range(1, N + 1):
    if S[i-1] == "?":
        for j in range(13):
            for k in range(10):
                dp[i][(j + k*10**(i-1)) % 13] += dp[i-1][j]
    else:
        for j in range(13):
            dp[i][(j+int(S[i-1])*10**(i-1)) % 13] = dp[i-1][j]

    for j in range(13):
        dp[i][j] %= mod

print(dp[N][5])


Fixed submission:
S = input()
N = len(S)
S = list(S)
S.reverse()

dp = [[0]*13 for _ in range(N + 1)]
dp[0][0] = 1
mod = 10**9+7
pow10 = 1
for i in range(1, N + 1):
    if S[i-1] == "?":
        for j in range(13):
            for k in range(10):
                dp[i][(j + k*pow10) % 13] += dp[i-1][j]
    else:
        for j in range(13):
            dp[i][(j+int(S[i-1])*pow10) % 13] = dp[i-1][j]
    pow10 = (pow10 * 10) % 13
    for j in range(13):
        dp[i][j] %= mod

print(dp[N][5])
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = [int(a) for a in input().split()]


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


divisor = []
for i in range(1, N + 1):
    divisor.append(make_divisors(i))
B = [0]*N
rs = [0]*N
for i in range(N - 1, -1, -1):
    if rs[i] != A[i]:
        B[i] = 1
        for j in divisor[i]:
            rs[j] = 1 - rs[j]

print(sum(B))
for i in range(N):
    if B[i] == 1:
        print(i+1)

Fixed submission:
N = int(input())
A = [int(a) for a in input().split()]


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


divisor = []
for i in range(1, N + 1):
    divisor.append(make_divisors(i))
B = [0]*N
rs = [0]*N
for i in range(N - 1, -1, -1):
    if rs[i] != A[i]:
        B[i] = 1
        for j in divisor[i]:
            rs[j-1] = 1 - rs[j-1]

print(sum(B))
for i in range(N):
    if B[i] == 1:
        print(i+1)
Buggy python submission (verdict: Runtime Error):
from math import gcd

A, B, C, D = map(int, input().split())
N = B - A + 1
lcm_CD = (C * D) // gcd(C, D)

sumB = B - B // C - B // D + B // lcm_CD
sumA = (A - 1) - (A - 1) // C - (A - 1) // D + (A - 1) // lcm_CD

print(sumB - sumA)

Fixed submission:
from fractions import gcd

A, B, C, D = map(int, input().split())
N = B - A + 1
lcm_CD = (C * D) // gcd(C, D)

sumB = B - B // C - B // D + B // lcm_CD
sumA = (A - 1) - (A - 1) // C - (A - 1) // D + (A - 1) // lcm_CD

print(sumB - sumA)
Buggy python submission (verdict: Runtime Error):
X, A = int(input())

if X < A:
    print(0)
else:
    print(10)

Fixed submission:
X, A = map(int, input().split())

if X < A:
    print(0)
else:
    print(10)
Buggy python submission (verdict: Runtime Error):
W, H, x, y = map(float, input().split())
f = 0
if W / 2 == x and H / 2 == y:
    f = 1

if y/x == H/W or y == -(H/W)*x + H:
    print("{} {}".format(W*H/2, f))

else:
    print("{} {}".format(max(min(x, W-x)*H, min(y, H-y)*W), f))


Fixed submission:
W, H, x, y = map(float, input().split())
f = 0
if W / 2 == x and H / 2 == y:
    f = 1

print("{} {}".format(W*H/2, f))
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N, W = map(int, input().split())
WV = np.array([list(map(int, input().split())) for i in range(N)])

dp = np.zeros((N+1, W+1), dtype=np.int)
for n in range(1, N + 1):
    for w in range(1, W+1):
        if w >= WV[n-1][0]:
        # weight = max(w-WV[n-1][0], 0)
            dp[n][w] = max(dp[n-1][w-WV[n-1][0]] + WV[n-1][1], dp[n-1][w])
        else:
            dp[n][w] = dp[n-1][w]

print(dp[-1][-1])


Fixed submission:
N, W = map(int, input().split())
WV = [list(map(int, input().split())) for i in range(N)]

dp = [[0]*(W+1) for i in range(N+1)]
for n in range(1,N+1):
    for w in range(1,W+1):
        if w >= WV[n-1][0]:
            dp[n][w] = max(dp[n-1][w-WV[n-1][0]] + WV[n-1][1], dp[n-1][w])
        else:
            dp[n][w] = dp[n-1][w]
print(dp[-1][-1])
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
T = input()

Ls = len(S)
Lt = len(T)

dp = [[0] * (Lt + 1) for _ in range(Ls + 1)]

for i in range(Ls):
    for j in range(Lt):
        if S[i] == T[j]:
            # dp[i+1][j+1] = max(dp[i][j]+1, dp[i][j+1], dp[i+1][j])
            dp[i+1][j+1] = dp[i][j]+1
        else:
            dp[i+1][j+1] = max(dp[i][j+1], dp[i+1][j])

match = []
now_row = Ls
now_column = Lt
while now_row > 0 and now_column > 0:
    if dp[now_row][now_column] == dp[now_row-1][now_column]:
        now_row -= 1
    elif dp[now_row][now_column] == dp[now_row][now_column-1]:
        now_column -= 1
    else:
        match.append(T[now_column-1])
        now_column -= 1
        now_row -= 1


match.reverse()
print("".join(match))

Fixed submission:
S = input()
T = input()

Ls = len(S)
Lt = len(T)

dp = [[0] * (Lt + 1) for _ in range(Ls + 1)]

for i in range(Ls):
    for j in range(Lt):
        if S[i] == T[j]:
            # dp[i+1][j+1] = max(dp[i][j]+1, dp[i][j+1], dp[i+1][j])
            dp[i+1][j+1] = dp[i][j]+1
        else:
            dp[i+1][j+1] = max(dp[i][j+1], dp[i+1][j])

match = []
now_row = Ls
now_column = Lt
while now_row > 0 and now_column > 0:
    if dp[now_row][now_column] == dp[now_row-1][now_column]:
        now_row -= 1
    elif dp[now_row][now_column] == dp[now_row][now_column-1]:
        now_column -= 1
    else:
        match.append(T[now_column-1])
        now_column -= 1
        now_row -= 1


match.reverse()
print("".join(match))
Buggy python submission (verdict: Runtime Error):
from collections import defaultdict
N, M = map(int, input().split())
in_path = defaultdict(lambda: [])
out_path = defaultdict(lambda: [])

for m in range(M):
    x, y = map(int, input().split())
    in_path[y].append(x)
    out_path[x].append(y)

check = [False]*(N+1)
memo = [0]*(N+1)

def dp(i):
    if check[i] == True:
        return memo[i]
    else:
        check[i] = True
        if not out_path[i]:
            memo[i] = 0
            return 0
        else:
            max_path = 0
            for node in out_path[i]:
                max_path = max(dp(node), max_path)
            max_path += 1
            memo[i] = max_path
            return max_path


ans = 0
for i in range(1, N+1):
    ans = max(ans, dp(i))

print(ans)

Fixed submission:
from collections import defaultdict
import sys
sys.setrecursionlimit(10000)
N, M = map(int, input().split())
in_path = defaultdict(lambda: [])
out_path = defaultdict(lambda: [])

for m in range(M):
    x, y = map(int, input().split())
    in_path[y].append(x)
    out_path[x].append(y)

check = [False]*(N+1)
memo = [0]*(N+1)


def dp(i):
    if check[i]:
        return memo[i]
    else:
        check[i] = True
        if not out_path[i]:
            return 0
        else:
            max_path = 0
            for node in out_path[i]:
                max_path = max(dp(node), max_path)
            max_path += 1
            memo[i] = max_path
            return max_path


ans = 0
for i in range(1, N+1):
    ans = max(ans, dp(i))

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin,stdout
n,k=map(int,stdin.readline().split())
h=[int(l) for l in stdin.readline().split()]
dp=[0,abs(h[0]-h[1])]
for i in range(2,n):
    ans=10**15
    num=i-k
    if num<0:
        num=-1
    else:
        num-=1
    for j in range(i-1,num,-1):
        ans=min(abs(h[i]-h[j])+dp[j],ans)
    dp.append(ans)
print(dp[n-1])


Fixed submission:
from sys import stdin,stdout
n,k=map(int,stdin.readline().split())
h=[int(l) for l in stdin.readline().split()]
dp=[0,abs(h[0]-h[1])]
for i in range(2,n):
    ans=10**15
    num=i-k
    if num<0:
        num=-1
    else:
        num-=1
    for j in range(i-1,num,-1):
        ans=min(abs(h[i]-h[j])+dp[j],ans)
    dp.append(ans)
print(dp[n-1])

Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
h=[int(l) for l in input().split()]
dp=[0,abs(h[0]-h[1])]
for i in range(2,n):
    ans=10**15
    num=i-k
    if num<0:
        num=-1
    else:
        num-=1
    for j in range(i-1,num,-1):
        ans=min(abs(h[i]-h[j])+dp[j],ans)
    dp.append(ans)
print(dp[n-1])


Fixed submission:
from sys import stdin,stdout
n,k=map(int,stdin.readline().split())
h=[int(l) for l in stdin.readline().split()]
dp=[0,abs(h[0]-h[1])]
for i in range(2,n):
    ans=10**15
    num=i-k
    if num<0:
        num=-1
    else:
        num-=1
    for j in range(i-1,num,-1):
        ans=min(abs(h[i]-h[j])+dp[j],ans)
    dp.append(ans)
print(dp[n-1])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
result = []
for _ in range(n) :
    thing = input()
    if not thing in result :
        result += [thing]
print(len(result))

Fixed submission:
import collections

n = int(input())
result = []
for _ in range(n) :
    thing = input()
    result += [thing]
print(len(collections.Counter(result)))
Buggy python submission (verdict: Time Limit Exceeded):
import math
result = 0
k = int(input())
for a in range(1, k+1) :
    for b in range(1, k+1) :
        for c in range(1, k+1) :
            result += math.gcd(math.gcd(a ,b), c)

print(result)

Fixed submission:
import math
result = 0
k = int(input())
for a in range(1, k+1) :
    for b in range(1, k+1) :
        if math.gcd(a ,b) == 1 :
            result += k
        else :
            for c in range(1, k+1) :
                result += math.gcd(math.gcd(a ,b), c)
print(result)
Buggy python submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!

N = int(input())
A = list(map(int, input().split()))
A.sort()                  #エラトステネスの篩にかけるためソート
A = list(set(A))
Amax = A[-1]              #最大値
dp = [1]*(Amax+1)         #Aの最大値までのエラトステネスの篩を作る
ans = 0
# print(A)
if len(A)!=1:
    for i in range(len(A)):
      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にする
        # print(dp)
      else:
          ans+=1
        #   print(A[i])
    #     if A[i] != A[i+1]: 
    #       ans += 1            #A[i]が重複していなければカウント
    #     print(ans)
    # if dp[Amax] == 1:         #重複チェック時にレンジオーバーするためAmaxだけ別で判定 
    #   ans += 1
    print(len(A)-ans)
else:
    print(0)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
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)
Buggy python submission (verdict: Runtime Error):
H, W = map(double, input().split())
print(int(H*W))

Fixed submission:
from decimal import Decimal
H, W = input().split()
# print(int(H))
# print(float(W))
ANS=int(H)*Decimal(W)
print(int(ANS))
Buggy python submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!
A=input()
Y=int(A[0])*10+int(A[1])
M=int(A[2])*10+int(A[3])
code=0
if Y<20:
    if M>0 and M<13:
        code=1

if M<20:
    if Y>0 and Y<13:
        if code==1:
            code=3
        else:
            code=2
if Y==19:
    M==12:
        code=2
if Y=12:
    M=19:
        code=1
        
if code == 0:
    print("NA")
if code ==1:
    print("YYMM")
if code ==2:
    print("MMYY")
if code == 3:
    print("AMBIGUOUS")



Fixed submission:
# coding: utf-8
# Your code here!
A=input()
Y=int(A[0])*10+int(A[1])
M=int(A[2])*10+int(A[3])
code=0
if Y<100:
    if M>0 and M<13:
        code=1

if M<100:
    if Y>0 and Y<13:
        if code==1:
            code=3
        else:
            code=2

if code == 0:
    print("NA")
if code ==1:
    print("YYMM")
if code ==2:
    print("MMYY")
if code == 3:
    print("AMBIGUOUS")