alexjercan/bugnet huggingface dataset:
Problem p02640 (Python) — buggy submission, verdict: Runtime Error

X, Y = map(int, input().split())

if Y % 2 == 0 and 2 * X <= Y <= 4 * X:
    print("Yes")
else:
    print("No")


Error: TypeError: '<' not supported between instances of 'int' and 'list'
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02640/Python/s666717578.py", line 3, in <module>
    if X % 2 == 0 and 2 * X < Y < 4 * X:
TypeError: '<' not supported between instances of 'int' and 'list'


Fixed submission:

X, Y = [int(), input().split()]

if X % 2 == 0 and 2 * X < Y < 4 * X:
    print("Yes")
else:
    print("No")
Problem p02640 (Python) — buggy submission, verdict: Time Limit Exceeded

from numba import jit


@jit
def solve(X, Y, Z):
    while X >= 0:
        if 2 * X + 4 * Z == Y:
            return True
        elif 2 * X + 4 * Z < Y:
            X -= 1
            Z += 1
        else:
            return False
    return False


def main():
    X, Y = map(int, input().split())
    Z = 0

    if solve(X, Y, Z):
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()


Error: TLE

Fixed submission:

from numba import jit


@jit
def solve(X, Y, Z):
    while X >= 0:
        if 2 * X + 4 * Z == Y:
            return True
        elif 2 * X + 4 * Z < Y:
            X -= 1
            Z += 1
    return False


def main():
    X, Y = map(int, input().split())
    Z = 0

    if solve(X, Y, Z):
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()
Problem p02641 (Python) — buggy submission, verdict: Runtime Error

def actual(X, N, P):
    for i in range(X, -1 - 1, -1):
        if i not in P:
            left = i
            break

    for i in range(X, 101 + 1):
        if i not in P:
            right = i
            break

    if abs(left - X) <= abs(right - X):
        answer = left
    else:
        answer = right

    return answer


X, N = map(int, input().split())

if N == 0:
    P = []
    print(actual(X, N, P))
else:
    P = list(map(int, input().split()))
    print(actual(X, N, P))


Error: 0

Fixed submission:

def actual(X, N, P):
    for i in range(X, -1, -1):
        if i not in P:
            left = i
            break

    for i in range(X, 101):
        if i not in P:
            right = i
            break

    if abs(left - X) <= abs(right - X):
        return left
    else:
        return right


X, N = map(int, input().split())

if N == 0:
    print(X)
else:
    P = list(map(int, input().split()))
    print(actual(X, N, P))
Problem p02641 (Python) — buggy submission, verdict: Runtime Error

X, N = map(int, input().split())
p = list(map(int, input().split()))

i = 0
while True:
    if X - i not in p:
        print(X - i)
        break
    elif X + i not in p:
        print(X + i)
        break
    i += 1


Error: 0

Fixed submission:

X, N = map(int, input().split())
p = list(map(int, input().split()))

if p:
    x = [i for i in range(1, max(p)) if i not in p]

    c = x.pop()
    a = abs(c - X)
    for i in x:
        if abs(i - X) < a:
            c = i
    print(c)
else:
    print(X)
Problem p02641 (Python) — buggy submission, verdict: Runtime Error

import sys

X, N = map(int, input().split())
list_p = list(map(int, input().split()))

if N == 0:
    print(X)
    sys.exit()

all_list = [int(x) for x in range(0, 102)]
target_list = sorted(list(set(list_p) ^ set(all_list)))

ans = [abs(num - X) for num in target_list]
# print(all_list)
# print(target_list)
# print(min(ans))
# print(ans.index(min(ans)))
print(target_list[ans.index(min(ans))])


Error: 0

Fixed submission:

import sys

X, N = map(int, input().split())
list_p = list(map(int, input().split()))

if N == 0:
    print(X)
    sys.exit()

all_list = [int(x) for x in range(min(list_p), max(list_p) + 1)]
target_list = sorted(list(set(list_p) ^ set(all_list)))

ans = [abs(num - X) for num in target_list]
# print(ans)
# print(min(ans))
# print(ans.index(min(ans)))
print(target_list[ans.index(min(ans))])
Problem p02641 (Python) — buggy submission, verdict: Runtime Error

X, N = map(int, input().split())
p = list(map(int, input().split()))

ans = 0
for i in range(1, 102):
    if abs(X - i) < abs(X - ans) and i not in p:
        ans = i
print(ans)


Error: TypeError: unsupported operand type(s) for -: 'str' and 'int'
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02641/Python/s033864949.py", line 6, in <module>
    if abs(X - i) < abs(ans - i) and i not in p and i != X:
TypeError: unsupported operand type(s) for -: 'str' and 'int'


Fixed submission:

X, N = input().split()
p = list(map(int, input().split()))

ans = 0
for i in range(1, 102):
    if abs(X - i) < abs(ans - i) and i not in p and i != X:
        ans = i

print(ans)
Problem p02641 (Python) — buggy submission, verdict: Runtime Error

import sys

x, n = map(int, input().split())
if n == 0:
    print(x)
    sys.exit()
else:
    p = list(map(int, input().split()))

a = []
b = []

for i in range(0, 102):
    if i not in p:
        a.append((x - i) ** 2)
        b.append(i)
ans = min(a)
bb = a.index(ans)
print(b[bb])


Error: 0

Fixed submission:

import sys

x, n = map(int, input().split())
if n == 0:
    print(x)
    sys.exit()
else:
    p = list(map(int, input().split()))
if x == 1:
    print(0)
    sys.exit()

a = []
b = []

for i in range(1, 100):
    if i not in p:
        a.append(abs(x - i))
        b.append(i)
ans = min(a)
bb = a.index(ans)
print(b[bb])
Problem p02641 (Python) — buggy submission, verdict: Runtime Error

# ABC170C

x, n = map(int, input().split())

if n == 0:
    p = set([])
else:
    p = list(map(int, input().split()))
a = list(set(range(201)) - set(p))
abs_diff = [abs(i - x) for i in a]
min_abs_diff = min(abs_diff)
for i, j in zip(a, abs_diff):
    if j == min_abs_diff:
        print(i)
        break


Error: TypeError: unbound method str.split() needs an argument
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02641/Python/s627877653.py", line 7, in <module>
    p = list(map(int, str.split()))
TypeError: unbound method str.split() needs an argument


Fixed submission:

x, n = map(int, input().split())

if n == 0:
    p = set([])
else:
    p = list(map(int, input().split()))
p = list(map(int, str.split()))
a = list(set(range(201)) - set(p))
abs_diff = [abs(i - x) for i in a]
min_abs_diff = min(abs_diff)
for i, j in zip(a, abs_diff):
    if j == min_abs_diff:
        print(i)
        break
Problem p02641 (Python) — buggy submission, verdict: Runtime Error

def main():
    x, n = map(int, input().split())
    p = list(map(int, input().split()))

    min = 1000

    for i in range(-50, 150):

        if i in p:
            continue

        elif min > abs(x - i):
            result = i
            min = abs(x - i)

    print(result)


if __name__ == "__main__":
    main()


Error: 0

Fixed submission:

def main():
    x, n = map(int, input().split())
    p = list(map(int, input().split()))

    min = 1000

    for i in range(1, 101):

        if i in p:
            continue

        elif min > abs(x - i):
            result = i
            min = abs(x - i)

    print(result)


if __name__ == "__main__":
    main()
Problem p02641 (Python) — buggy submission, verdict: Runtime Error

x, n = map(int, input().split())
p = list(map(int, input().split()))
ans = 0

if n == 0:
    print(x)
    exit()

p.sort()

for i in range(p[0] - x, p[n - 1] + x):
    if (i not in p) and abs(x - i) < abs(ans - x):
        ans = i

print(ans)


Error: 0

Fixed submission:

x, n = map(int, input().split())
p = list(map(int, input().split()))
ans = 0
p.sort()
for i in range(p[0], p[n - 1] + 1):
    if (i not in p) and abs(x - i) < abs(ans - x):
        ans = i

print(ans)
Problem p02641 (Python) — buggy submission, verdict: Runtime Error

X, N = map(int, input().split())
if N == 0:
    print(X)
elif N == 100:
    if X <= 50:
        print(0)
    else:
        print(101)

else:
    p = list(map(int, input().split()))
    abs_list = []
    re_list = []
    min = 1000
    min_index = 0

    for i in range(250):
        abs_list.append(-100 + i)
    for j in p:
        abs_list.remove(j)
    for i in range(len(abs_list)):

        re_list.append(abs(abs_list[i] - X))
    for i in range(len(re_list)):
        if min > re_list[i]:
            min = re_list[i]
            min_index = i
    if re_list[min_index] > X:
        print(0)
    else:
        print(abs_list[min_index])


Error: 0

Fixed submission:

X, N = map(int, input().split())
if N == 0 and N == 100:
    print(X)


else:
    p = list(map(int, input().split()))
    abs_list = []
    re_list = []
    min = 1000
    min_index = 0

    for i in range(100):
        abs_list.append(i + 1)
    for j in p:
        abs_list.remove(j)
    for i in range(len(abs_list)):

        re_list.append(abs(abs_list[i] - X))
    for i in range(len(re_list)):
        if min > re_list[i]:
            min = re_list[i]
            min_index = i
    print(abs_list[min_index])
Problem p02641 (Python) — buggy submission, verdict: Runtime Error

x, n = list(map(int, input().split()))
p_list = list(map(int, input().split()))
if n == 0:
    print(x)
    exit()

i = 0
while True:
    x_i = x - i
    x_j = x + i

    if x_i not in p_list:
        print(x_i)
        exit()
    if x_j not in p_list:
        print(x_j)
        exit()

    i += 1


Error: 0

Fixed submission:

x, n = list(map(int, input().split()))
if n == 0:
    print(x)
    exit()
p_list = list(map(int, input().split()))

idx = p_list.index(x)

i = 0
while True:
    x_i = x - i
    x_j = x + i

    if x_i not in p_list:
        print(x_i)
        exit()
    if x_j not in p_list:
        print(x_j)
        exit()

    i += 1
Problem p02641 (Python) — buggy submission, verdict: Runtime Error

import numpy as np

X, N = map(int, input().split())
P = np.array(list(map(int, input().split())))

P = P - X

for i in range(0, X + 1):
    if i not in P or -i not in P:
        if -i not in P:
            ans = X - i
        else:
            ans = X + i
        break

print(ans)


Error: TLE

Fixed submission:

import numpy as np

X, N = map(int, input().split())
P = np.array(list(map(int, input().split())))

P = P - X

for i in range(0, X):
    if i not in P or -i not in P:
        if -i not in P:
            ans = X - i
        else:
            ans = X + i
        break

print(ans)
Problem p02641 (Python) — buggy submission, verdict: Runtime Error

def Qc():
    x, n = map(int, input().split())
    if 0 < n:
        p = list(map(int, input().split()))
        for i in range(101):
            if x - i not in p:
                print(x - i)
                exit()
            if x + i not in p:
                res = x + 1
                print(x + i)
                exit()
    else:
        # 整数列がなにもない場合は自分自身が含まれていない最近値になる
        print(x)
        exit()


if __name__ == "__main__":
    Qc()


Error: 0

Fixed submission:

def Qc():
    x, n = map(int, input().split())
    if 0 < n:
        p = map(int, input().split())

        targets = list(range(1, 101))
        outer = set(targets) - set(p)
        res = [abs(x - v) for v in outer]
        i = res.index(min(res))
        res = list(outer)[i]
    else:
        # 整数列がなにもない場合は自分自身が含まれていない最近値になる
        res = x
    print(res)


if __name__ == "__main__":
    Qc()
Problem p02641 (Python) — buggy submission, verdict: Runtime Error

a = input()

t, c = int(a.split(" ")[0]), int(a.split(" ")[1])

if not c:
    print(t)
else:
    b = input()
    lst = [int(x) for x in b.split(" ")]

    for i in range(c + 2):
        if t - i not in lst:
            print(t - i)
            break
        if t + i not in lst:
            print(t + i)
            break


Error: 0

Fixed submission:

a = input()

t, c = int(a.split(" ")[0]), int(a.split(" ")[1])

if not c:
    print(t)

b = input()
lst = [int(x) for x in b.split(" ")]

for i in range(c):
    if t - i not in lst:
        print(t - i)
        break
    if t + i not in lst:
        print(t + i)
        break
Problem p02641 (Python) — buggy submission, verdict: Runtime Error

X, N = map(int, input().split())

if N == 0:
    print(X)

else:
    p = list(map(int, input().split()))
    q = [i for i in range(-1, 102)]

    for r in p:
        idx = q.index(r)
        del q[idx]

    if X in q:
        print(X)

    else:
        q.sort()
        mindif = 1000

        for num in q:
            dif = abs(X - num)
            if mindif <= dif:
                break
            else:
                mindif = dif
                ans = num
        print(ans)


Error: 0

Fixed submission:

X, N = map(int, input().split())

if N == 0:
    print(X)

else:
    p = list(map(int, input().split()))
    q = [i for i in range(-1, 102)]

    for r in p:
        idx = q.index(r)
        del q[idx]

    if X in q:
        print(X)

    else:
        q.sort()
        mindif = 100

        for num in q:
            dif = abs(X - num)
            if mindif <= dif:
                break
            else:
                mindif = dif
                ans = num
        print(ans)
Problem p02641 (Python) — buggy submission, verdict: Runtime Error

X, N = map(int, input().split())
A = list(map(int, input().split()))

tmp = 1000
result = []
result2 = []
for i in range(0, 102):
    if i in A:
        continue

    hoge = abs(X - i)
    if hoge <= tmp:
        tmp = hoge
        result2.append(tmp)
        result.append(i)

result3 = []
for i, v in enumerate(result2):
    if v == min(result2):
        result3.append(result[i])

print(min(result3))


Error: 0

Fixed submission:

X, N = map(int, input().split())
A = list(map(int, input().split()))

tmp = 1000
result = []
result2 = []
for i in range(1, 101):
    if i in A:
        continue

    hoge = abs(X - i)
    if hoge <= tmp:
        tmp = hoge
        result2.append(tmp)
        result.append(i)

result3 = []
for i, v in enumerate(result2):
    if v == min(result2):
        result3.append(result[i])

print(min(result3))
Problem p02641 (Python) — buggy submission, verdict: Runtime Error

X, N = map(int, input().split())
P = set(list(map(int, input().split())))

targets = set(range(-101, 102)) - P
if targets:
    print(min([(target, abs(X - target)) for target in targets], key=lambda x: x[1])[0])
else:
    print(X)


Error: 0

Fixed submission:

X, N = map(int, input().split())
P = set(list(map(int, input().split())))

targets = set(range(1, 101)) - P
print(min([(target, abs(X - target)) for target in targets], key=lambda x: x[1])[0])
Problem p02641 (Python) — buggy submission, verdict: Runtime Error

x, n = map(int, input().split())
p = set(map(int, input().split()))


ans = 0
i = 0
while True:
    if (x - i) not in p:
        ans = x - i
        break
    elif (x + i) not in p:
        ans = x + i
        break
    i += 1

print(ans)


Error: TLE

Fixed submission:

import numpy as np


def getNearestValue(li, num):
    idx = np.abs(np.array(li) - num).argmin()
    return li[idx]


x, n = map(int, input().split())
p = list(map(int, input().split()))


ans = 0
print(p)
i = 0
while True:
    mi = getNearestValue(p, x - i)
    ma = getNearestValue(p, x + i)
    if mi or ma:
        break
    i += 1

print(mi if mi < ma else ma)
Problem p02641 (Python) — buggy submission, verdict: Runtime Error

x, n = map(int, input().split())
p = [int(_) for _ in input().split()]

not_in_p = [i for i in range(0, 102) if i not in p]
nip_temp = list(map(lambda s: abs(x - s), not_in_p))

address = nip_temp.index(min(nip_temp))
print(not_in_p[address])


Error: WA

Fixed submission:

x, n = map(int, input().split())
p = [int(_) for _ in input().split()]

not_in_p = [i for i in range(0, 102) if i not in p]
nip_temp = list(map(lambda s: abs(x - s), not_in_p))

address = nip_temp.index(min(nip_temp))
print(p[address])
Problem p02641 (Python) — buggy submission, verdict: Time Limit Exceeded

X, N = map(int, input().split())

P = list(map(int, input().split()))

if N == 0:
    print(X)
    exit()

diff = 0
high = low = None
while True:
    if X + diff not in P:
        high = X + diff
    if X - diff not in P:
        low = X - diff
    if high is None and low is None:
        diff += 1
        continue

    if high == low:
        print(low)
    elif low is None:
        print(high)
    else:
        print(low)
    break


Error: TLE

Fixed submission:

X, N = map(int, input().split())

P = list(map(int, input().split()))

if N == 0:
    print(X)
    exit()

# high
high = 0
tmp = 0
while not high:
    if (X + tmp) in P:
        tmp += 1
        continue
    high = X + tmp

low = 0
tmp = 0
while not low:
    if (X - tmp) in P:
        tmp += 1
        continue
    low = X - tmp

if abs(X - low) == abs(X - high):
    print(low)
elif abs(X - low) < abs(X - high):
    print(low)
else:
    print(high)
Problem p02641 (Python) — buggy submission, verdict: Runtime Error

X, N = map(int, input().split())
p_int_list = []

if N == 0:
    print(X)
    exit()
else:
    p_int_list = list(map(int, input().split()))

p_int_set = set(p_int_list)

if X not in p_int_set:
    print(X)
    exit()

for i in range(1, 10000):
    if X - i not in p_int_set:
        print(X - i)
        exit()
    elif X + i not in p_int_set:
        print(X + i)
        exit()


Error: 0

Fixed submission:

X, N = map(int, input().split())
p_int_list = []

if N == 0:
    print(X)
    exit()
else:
    p_int_list = list(map(int, input().split()))
    p_int_list = sorted(p_int_list)


ans_range = []
for i, j in zip(p_int_list[:-1], p_int_list[1:]):
    if j < 0:
        if abs(j) <= X <= abs(i):
            ans_range = [abs(j), abs(i)]
    else:
        if i <= X <= j:
            ans_range = [i, j]
            if i < 0:
                print(0)
                exit()

ans = 0
p_int_set = set(p_int_list)

if ans_range[1] - ans_range[0] != 1:
    if ans_range[1] == X:
        print(ans_range[1] - 1)
        exit()
    elif ans_range[0] == X:
        if X - 1 in p_int_set:
            print(X + 1)
            exit()
        else:
            print(X + 1)
            exit()
elif ans_range[1] - ans_range[0] == 1:
    for i in range(1, N):
        if ans_range[0] - i not in p_int_set:
            print(ans_range[0] - i)
            exit()
        elif ans_range[1] + i not in p_int_set:
            print(ans_range[1] + i)
            exit()
Problem p02641 (Python) — buggy submission, verdict: Runtime Error

x, n = map(int, input().split())

if n != 0:
    p = list(map(int, input().split()))
else:
    print(x)
    exit()

dif = 100
ans = 0

for i in range(min(p) - 1, max(p) + 2):
    if not (i in p):
        if dif > abs(x - i):
            dif = abs(x - i)
            ans = i

print(ans)


Error: 0

Fixed submission:

x, n = map(int, input().split())

if n != 0:
    p = list(map(int, input().split()))
else:
    print(x)
    exit(1)

dif = 100
ans = 0

for i in range(min(p) - 1, max(p) + 2):
    if not (i in p):
        if dif > abs(x - i):
            dif = abs(x - i)
            ans = i

print(ans)
Problem p02641 (Python) — buggy submission, verdict: Runtime Error

X, N = map(int, input().split())
if N == 0:
    print(X)
    exit()

P = list(map(int, input().split()))

for i in range(101):
    p = X - i not in P
    p1 = X + i not in P
    if p1 or p:
        if p:
            print(X - i)
            exit()
        print(X + i)
        exit()


Error: 0

Fixed submission:

X, N = map(int, input().split())
if N == 0:
    print(X)
    exit()

P = list(map(int, input().split()))
minmin = []
minn = 101
for i in range(1, 101):
    if i in P:
        continue
    abs1 = abs(i - X)
    if minn >= abs1:
        minn = abs1
        minmin.append(i)

if len(minmin) > 2 and abs(X - minmin[-1]) == abs(X - minmin[-2]):
    print(minmin[-2])
    exit()
print(minmin[-1])
Problem p02641 (Python) — buggy submission, verdict: Runtime Error

# coding:utf-8
x, n = map(int, input().split())
p = list(map(int, input().split()))


if n == 0:
    print(x)
else:
    ps = sorted(p)
    tmp = list(range(-201, 200))
    ans_list = list(set(tmp) ^ set(ps))
    ans_list = sorted(ans_list)
    # print(tmp, ans_list)
    diff = []

    for i in ans_list:
        diff.append(abs(i - x))

    print(ans_list[diff.index(min(diff))])


Error: 0

Fixed submission:

# coding:utf-8
x, n = map(int, input().split())
p = list(map(int, input().split()))


if n == 0:
    print(x)
else:
    ps = sorted(p)
    tmp = [_ for _ in range(ps[0], ps[-1] + 1)]
    ans_list = list(set(tmp) ^ set(ps))
    # print(tmp, ans_list)
    diff = []

    for i in ans_list:
        diff.append(abs(i - x))
    print(ans_list[diff.index(min(diff))])
Problem p02641 (Python) — buggy submission, verdict: Runtime Error

x, n = map(int, input().split())
if n != 0:
    p = list(map(int, input().split()))
    if x in p:
        for i in range(-1000, 1001):
            if i == -1000:
                mini = i
            if i in p:
                pass
            else:
                if abs(x - mini) > abs(x - i):
                    mini = i
                elif abs(x - mini) == abs(x - i):
                    mini = min(mini, i)
        else:
            print(mini)
    else:
        print(x)
else:
    print(x)


Error: NameError: name 'mini' is not defined. Did you mean: 'min'?
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02641/Python/s131160105.py", line 12, in <module>
    if abs(x - mini) > abs(x - i):
NameError: name 'mini' is not defined. Did you mean: 'min'?


Fixed submission:

x, n = map(int, input().split())
if n != 0:
    p = list(map(int, input().split()))
    if x in p:
        for i in range(-1000, 1001):
            print(i)
            if i == -100:
                mini = i
            if i in p:
                pass
            else:
                if abs(x - mini) > abs(x - i):
                    mini = i
                elif abs(x - mini) == abs(x - i):
                    mini = min(mini, i)
        else:
            print(mini)
    else:
        print(x)
else:
    print(x)
Problem p02642 (Python) — buggy submission, verdict: Runtime Error

from collections import Counter

N = int(input())
A = list(map(int, input().split()))

sorted_A = sorted(A)
result = 0
c = Counter(sorted_A)
# 倍数を管理するテーブル
lendp = sorted_A[-1] + 1
dp = [0] * lendp

for a in sorted_A:
    dp[a] += 1
    if dp[a] == 1:
        b = a * 2
        while b < lendp:
            dp[b] += 2
            b += a

print(dp.count(1))


Error: ZeroDivisionError: integer division or modulo by zero
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02642/Python/s509349915.py", line 19, in <module>
    if A[i] % a == 0:
ZeroDivisionError: integer division or modulo by zero


Fixed submission:

N = int(input())
A = list(map(int, input().split()))

setA = set(A)
result = 0

if N == 1:
    print(0)
else:
    for i in range(N):
        tmp = A[i]
        A[i] = 0
        setA = set(A)
        A[i] = tmp
        if 1 in setA:
            continue

        for a in setA:
            if A[i] % a == 0:
                break
        else:
            result += 1

    print(result)
Problem p02642 (Python) — buggy submission, verdict: Runtime Error

# Not Divisible

N = int(input())
A = [int(n) for n in input().split()]

check = [0] * 1000001
A.sort()

ok = [-1]
p = 0
for a in A:
    if a == p:
        if ok[-1] == p:
            ok = ok[:-1]
        continue
    p = a
    if check[a] == 1:
        continue
    for i in range(a, 1000001, a):
        check[i] = 1
    ok.append(a)

print(len(ok) - 1)


Error: 0

Fixed submission:

# Not Divisible

N = int(input())
A = [int(n) for n in input().split()]

check = [0] * 1000000
A.sort()

ok = [-1]
p = 0
for a in A:
    if a == p:
        if ok[-1] == p:
            ok = ok[:-1]
        continue
    p = a
    if check[a] == 1:
        continue
    for i in range(a, 1000000, a):
        check[i] = 1
    ok.append(a)

print(len(ok) - 1)