ZhenlongDai/ACPR huggingface dataset:
Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):
def is_prime(x):

    if x == 2 : return True

    for i in range(2, x):
        if x % i == 0:
            return True

    return False


n = 5
res = 0

for _ in range(n+1):
    x = int(input())
    if is_prime(x): res += 1

print(res)

Failing test case input:
11
7
8
9
10
11
12
23
14
27
16
17

Expected output:
4


Actual output:
3


Fixed submission (verdict: Accepted):
import math
def is_prime(n):
    if n in [2, 3, 5]:
        return True
    for i in range(2, int(math.sqrt(n))+1):
        if n % i == 0:
            return False
        
    return True

n = int(input())
nums = [int(input()) for i in range(n)]
res = len([i for i in nums if is_prime(i)])
print(res)

Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):
n = int(input())
count = 0
for i in range(n):
    x = int(input())
    if (x == 2):
        count += 1
    else:
        for j in range(2, x + 1):
            if (x % j == 0):
                break
            else:
                count += 1
print(count)

Failing test case input:
11
13
20
9
10
11
13
33
14
15
8
17

Expected output:
4


Actual output:
49


Fixed submission (verdict: Accepted):
n = int(input())
count = 0
for i in range(n):
    x = int(input())
    if (x == 2):
        count += 1
    elif (x % 2 == 0):
        continue
    else:
        if (pow(2, x - 1, x) == 1):
            count += 1
print(count)

Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):
import math

N = int(input())
ans = 0

def solve(x):
    if x==2:
        return 1
    elif x%2:
        return 0
    else:
        for i in range(3, math.ceil(math.sqrt(x)) + 1, 2):
            if x%i ==0:
                return 0
        return 1
for i in range(N):
    if solve(int(input())) ==1:
        ans +=1
print(ans)

Failing test case input:
11
7
3
4
27
4
22
13
2
20
8
44

Expected output:
4


Actual output:
6


Fixed submission (verdict: Accepted):
import math

N = int(input())
ans = 0

def solve(x):
    if x==2:
        return 1
    elif x%2==0:
        return 0
    else:
        for i in range(3, math.ceil(math.sqrt(x)) + 1, 2):
            if x%i ==0:
                return 0
        return 1
for i in range(N):
    if solve(int(input())) ==1:
        ans +=1
print(ans)

Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):
n = int(input())
c = 0
for _ in range(n):
        data = int(input())
        for i in range(2,data):
                if data%i == 0:
                        break
                c += 1
print("%d" %c)



Failing test case input:
5
2
3
7
5
6

Expected output:
4


Actual output:
9


Fixed submission (verdict: Accepted):
def is_prime(n):
    for i in range(2,n):
        if i*i > n:
            return True
        if n%i == 0:
            return False
    return True
c = 0
n = int(input())
for _ in range(n):
    data = int(input())
    if is_prime(data): c+= 1
print(c)
Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):
n=int(input())
c=0
for i in range(n):
    p=int(input())
    if pow(2,p-1,p)==1:
        c+=1
print(c)


Failing test case input:
11
4
2
9
50
15
22
2
14
16
8
27

Expected output:
2


Actual output:
0


Fixed submission (verdict: Accepted):
n=int(input())
c=0
for i in range(n):
    p=int(input())
    if pow(2,p-1,p)==1 or p==2:
        c+=1
print(c)

Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):
n = int(input())
for i in range(n):
    p = int(input())
    if p == 2:
        continue
    elif p in (9,15):
        n -= 1
        continue
    elif not p%2:
        n -= 1
        continue
    for j in range(3,int(p**0.5),2):
        if not p%j:
            n -= 1
            continue
print(n)

Failing test case input:
11
25
20
9
17
11
13
33
5
16
12
17

Expected output:
5


Actual output:
6


Fixed submission (verdict: Accepted):
n = int(input())
for i in range(n):
    p = int(input())
    if not p%2:
        if p != 2:
            n -= 1
        continue
    for j in range(3,int(p**0.5)+1,2):
        if not p%j:
            n -= 1
            break
print(n)

Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):
def hoge(z):
    yuki = 0
    kkk = 2
    
    while kkk < z:
        if z % kkk == 0:
            yuki += 1
        if yuki:
            return False
        kkk += 2
    return True

if __name__ == '__main__':
    n = int(input())
    c = 0
    for _ in range(n):
        if hoge(int(input())):
            c += 1
    print (c)


Failing test case input:
11
7
8
9
15
11
30
13
4
27
8
17

Expected output:
4


Actual output:
7


Fixed submission (verdict: Accepted):
import math

def isprime(z):
    if z == 2:
        return True
    
    if z < 2 or z % 2 == 0:
        return False
    i = 3
    while i <= math.sqrt(z):
        if z % i == 0:
            return False
        i += 2
    return True

if __name__ == '__main__':
    n = int(input())
    c = 0
    for _ in range(n):
        if isprime(int(input())):
            c += 1
    print (c)

Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):
c = 0
n = int(input())
for _ in range(n):
	t = int(input())
	for i in range(1,t):
		if t%i==0:
			break
	else:
		c+=1
print(c)

Failing test case input:
5
4
3
7
5
6

Expected output:
3


Actual output:
0


Fixed submission (verdict: Accepted):
import math
c = 0
n = int(input())
for _ in range(n):
	t = int(input())
	for i in range(2,int(math.sqrt(t)+1)):
		if t%i==0:
			break
	else:
		c+=1
print(c)
Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):
def main() :
    n = int(input())
    nums = []
    for i in range(0, n) :
        x = int(input())
        nums.append(x)

    count = 0
    judge = 0
    for i in nums :
        print(i)
        for j in range(2, i) :
            if (i % j) != 0 :
                judge += 0
            else :
                judge += 1

        if judge == 0 :
            count += 1

    print(count)


if __name__ == '__main__' :
    main()

Failing test case input:
11
7
8
9
15
11
30
13
2
27
8
17

Expected output:
5


Actual output:
7
8
9
15
11
30
13
2
27
8
17
1


Fixed submission (verdict: Accepted):
import math

def isPrime(x) :
    if x == 2 :
        return True

    if x < 2 or x % 2 == 0 :
        return False

    i = 3
    while i <= math.sqrt(x) :
        if x % i == 0 :
            return False
        i += 2

    return True


def main() :
    n = int(input())
    nums = []
    for i in range(n) :
        x = int(input())
        nums.append(x)

    count = 0
    for num in nums :
        if isPrime(num) :
            count += 1

    print(count)


if __name__ == '__main__' :
    main()

Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):
def is_prime(n):
  ps = [2, 3, 5, 7, 11, 13, 17]
  for p in ps:
    if n % p == 0: return 0
  t = 19
  while n > t:
    if n % t == 0: return 0
    t += 2
  return 1

c = 0
for _ in range(int(input())):
  c += is_prime(int(input()))
print(c)


Failing test case input:
11
7
10
9
10
11
13
17
3
15
16
17

Expected output:
6


Actual output:
0


Fixed submission (verdict: Accepted):
def is_prime(x):
  if x == 2: return 1
  if x % 2 == 0: return 0
  for i in range(3, int(x ** 0.5) + 1, 2):
    if x % i == 0: return 0
  return 1

c = 0
for _ in range(int(input())):
  c += is_prime(int(input()))
print(c)

Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):
def isPrime(x):
    if x==2:
        return True
    
    if x<2 or x%2==0:
        return False
    
    for n in range(3,round(x**0.5),2):
        if x%n==0:
            return False
        
    return True  

n=int(input())
num=[int(input()) for i in range(n)]

i=0
for nm in num:
    if isPrime(nm):
        i+=1
        
print(i)

Failing test case input:
11
7
8
9
10
11
22
13
2
27
8
14

Expected output:
4


Actual output:
5


Fixed submission (verdict: Accepted):
def isPrime(x):
    if x==2:
        return True
    
    if x<2 or x%2==0:
        return False
    
    for n in range(3,int(x**0.5)+1,2):
        if x%n==0:
            return False
    return True   

n=int(input())
num=[int(input()) for i in range(n)]

i=0
for nm in num:
    if isPrime(nm):
        i+=1
        
print(i)
Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):
n=int(input())
A=[0]*n
cnt=0
for i in range(0,n):
    A[i]=int(input())
for i in range(0,n):
    if A[i]<2: pass
    elif A[i]==2 or A[i]==3:
        cnt+=1
    else:
        for j in range(2,A[i]):
            if A[i]%j==0: 
                break
            else: pass
            if j==i-1:
                cnt+=1
            else: pass
print(cnt)


Failing test case input:
11
7
8
9
10
11
12
23
4
9
18
17

Expected output:
4


Actual output:
3


Fixed submission (verdict: Accepted):
import math
n=int(input())
A=[0]*n
cnt=0
for i in range(0,n):
    A[i]=int(input())
for i in range(0,n):
    if A[i]<2: pass
    elif A[i]==2 or A[i]==3 or A[i]==5 or A[i]==7:
        cnt+=1
    else:
        x=int(math.sqrt(A[i])+1)
        for j in range(2,x):
            if A[i]%j==0:
                break
            else: pass
            if j==x-1:
                cnt+=1
            else: pass
print(cnt)

Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):
import math
A = []
N = int(input())
count = 0
for n in range(N):
    x = int(input())
    if x == 2:
        A.append(x)
        count += 1
    elif x % 2 == 0:
        pass
    elif x > 2:
        for i in range(3, int(math.sqrt(x)), 2):
            if x % i == 0:
                break
        else:
            count += 1
            A.append(x)
    
print(count)

Failing test case input:
11
6
4
9
27
11
22
13
2
20
8
44

Expected output:
3


Actual output:
4


Fixed submission (verdict: Accepted):
import math
A = []
N = int(input())
count = 0
for n in range(N):
    x = int(input())
    if x == 2:
        A.append(x)
        count += 1
    elif x % 2 == 0:
        pass
    elif x > 2:
        for i in range(3, int(math.sqrt(x))+2, 2):
            if x % i == 0:
                break
        else:
            count += 1
            A.append(x)
    
print(count)

Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):
c = 0
n = int(input())
for _ in range(n):
	t = int(input())
	for i in range(2,t):
		if t%i==0:
			break
		c += 1
print(c)

Failing test case input:
11
7
8
9
26
15
22
3
14
27
8
27

Expected output:
2


Actual output:
10


Fixed submission (verdict: Accepted):
import math
c = 0
n = int(input())
for _ in range(n):
	t = int(input())
	for i in range(2,int(math.sqrt(t)+1)):
		if t%i==0:
			break
	else:
		c+=1
print(c)
Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):
import math
n=int(input())
A=[0]*n
cnt=0
for i in range(0,n):
    A[i]=int(input())
for i in range(0,n):
    if A[i]<2: pass
    elif A[i]==2 or A[i]==3 or A[i]==5 or A[i]==7:
        cnt+=1
    else:
        x=int(math.sqrt(A[i])+1)
        for j in range(2,x):
            if A[i]%j==0: 
                break
            else: pass
            if j==i-1:
                cnt+=1
            else: pass
print(cnt)



Failing test case input:
11
7
8
9
10
11
12
23
14
27
16
17

Expected output:
4


Actual output:
2


Fixed submission (verdict: Accepted):
import math
n=int(input())
A=[0]*n
cnt=0
for i in range(0,n):
    A[i]=int(input())
for i in range(0,n):
    if A[i]<2: pass
    elif A[i]==2 or A[i]==3 or A[i]==5 or A[i]==7:
        cnt+=1
    else:
        x=int(math.sqrt(A[i])+1)
        for j in range(2,x):
            if A[i]%j==0:
                break
            else: pass
            if j==x-1:
                cnt+=1
            else: pass
print(cnt)

Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):
n = int(input())
p = 0

for i in range(n):
    x = int(input())
    if x == 2:
        p += 1
    elif x%2 == 1:
        j=3
        f = 0
        while j*j < 4*x:
            if x%j == 0:
                f = 1
                break
            else:
                j += 2
        if f == 0:
            p += 1



print(p)


Failing test case input:
11
7
3
4
27
4
22
13
2
20
8
44

Expected output:
4


Actual output:
3


Fixed submission (verdict: Accepted):
from math import sqrt
n = int(input())
p = 0

for i in range(n):
    x = int(input())
    if x == 2:
        p += 1
    elif x%2 == 1:
        j=3
        f = 0
        while j < (int(sqrt(x))+1):
            if x%j == 0:
                f = 1
                break
            else:
                j += 2
        if f == 0:
            p += 1



print(p)
Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):
import math
    
p = [2]
def isprime(x):
    if x == 2:
        return True
    if x == 3:
        return True
    if max(p) < x**0.5:
        for j in range(max(p), math.floor(x**0.5) + 1):
            if all([j % k != 0 for k in p]):
                p.append(j)
    i = 0
    while i <= len(p)-1:
        if p[i] > x**0.5:
            return False
        if x%p[i] == 0:
            return False
        i += 1
    return True


n = int(input())
res = 0
for i in range(n):
    k = int(input())
    if isprime(k):
        res += 1
print(res)

Failing test case input:
11
7
8
9
15
11
30
13
2
27
8
17

Expected output:
5


Actual output:
3


Fixed submission (verdict: Accepted):
import math

p = [2]
    
def isprime(x):
    if x == 2:
        return True
    if x == 3:
        return True
    if max(p) < x**0.5:
        for j in range(max(p), math.floor(x**0.5) + 1):
            if all([j % k != 0 for k in p]):
                p.append(j)
    i = 0
    while i <= len(p)-1:
        if x%p[i] == 0:
            return False
        if p[i] > x**0.5:
            break;
        i += 1
    return True


n = int(input())
res = 0
for i in range(n):
    k = int(input())
    if isprime(k):
        res += 1
print(res)

Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):
import math

def is_prime(n):
    if n == 1:
        return False
    if n % 2 == 0:
        return False
    for i in range(2, math.ceil(n**0.5)):
        if n % i == 0:
            return False
    return True

def run():
    n = int(input())
    n_prime = 0
    for i in range(n):
        if is_prime(int(input())):
            n_prime += 1
    print(n_prime)

if __name__ == '__main__':
    run()


Failing test case input:
11
7
20
9
10
11
13
17
14
15
8
17

Expected output:
5


Actual output:
6


Fixed submission (verdict: Accepted):
import math

def is_prime(n):
    if n == 1:
        return False
    if n == 2:
        return True
    for i in range(2, math.ceil(n**0.5)+1):
        if n % i == 0:
            return False
    return True

def run():
    n = int(input())
    n_prime = 0
    for i in range(n):
        if is_prime(int(input())):
            n_prime += 1
    print(n_prime)

if __name__ == '__main__':
    run()

Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):
n = int(input())
count = 0
for i in range(n):
  x = int(input())
  for j in range(2, x - 1):
    if x == 2:
      count += 1
    elif x % j == 0:
      break
    else: 
      count += 1
print(count)

Failing test case input:
11
7
8
9
10
11
12
23
14
27
16
17

Expected output:
4


Actual output:
48


Fixed submission (verdict: Accepted):
n = int(input())
count = 0
for i in range(n):
  x = int(input())
  if x == 2:
    count += 1
  elif x % 2 == 0:
    continue
  else:
    if pow(2, x - 1, x) == 1: 
      count += 1
print(count)
Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):
import math
N = int(input())
count = 0
for _ in range(N):
    m = int(input())
    rm = int(math.sqrt(m))
    flag = 0
    for i in range(2,rm+1):
        if m %rm ==0:
            flag = 1
            break
    if flag ==0 :count=count +1
    

print(count)

Failing test case input:
11
7
10
9
10
11
13
17
20
15
8
17

Expected output:
5


Actual output:
7


Fixed submission (verdict: Accepted):
import math
N = int(input())
count = 0
for _ in range(N):
    m = int(input())
    rm = int(math.sqrt(m))
    flag = 0
    for i in range(2,rm+1):
        if m %i ==0:
            flag = 1
            break
    if flag ==0 :count=count +1

print(count)

Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):
import sys
import math


n = input()
num = [int(i) for i in sys.stdin.readlines()]
count = 0

for i in num:
    if i == 1:
        continue
    elif i == 2:
        continue

    square = int(math.ceil(math.sqrt(i)))

    for j in range(2, square):
        if i % j == 0:
            break
    else:
        count += 1

print(count)


Failing test case input:
11
7
8
8
10
11
12
23
4
9
18
17

Expected output:
4


Actual output:
6


Fixed submission (verdict: Accepted):
import sys
import math


n = input()
num = [int(i) for i in sys.stdin.readlines()]
count = 0

for i in num:
    if i == 1:
        continue
    elif i == 2:
        
        count += 1
        continue

    square = int(math.sqrt(i))

    for j in range(2, square+1):
        if i % j == 0:
            break
    else:
        
        count += 1

print(count)

Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):
n = int(input())
count = 0
for i in range(n):
  x = int(input())
  if i > 1:
    if x == 2:
      count += 1
    elif x % 2 == 0:
      continue
    else:
      count += 1
print(count)

Failing test case input:
11
7
8
9
10
11
12
17
14
15
5
17

Expected output:
5


Actual output:
6


Fixed submission (verdict: Accepted):
n = int(input())
count = 0
for i in range(n):
  x = int(input())
  if x == 2:
    count += 1
  elif x % 2 == 0:
    continue
  else:
    if pow(2, x - 1, x) == 1: 
      count += 1
print(count)

Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):
def checker(x):
    if x < 2 or x % 2 == 0 :
        return False
    for i in range(2,int(x**0.5)+1):
        if x % i == 0 :
            return False
    return True

cnt=0
q=int(input())
for _ in range(q):
    v=int(input())
    if checker(v):
        cnt += 1
print(cnt)

Failing test case input:
11
6
4
4
27
4
22
13
2
20
8
44

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
def checker(x):
    if x == 2:
        return True
    if x < 2 or x % 2 == 0 :
        return False
    for i in range(2,int(x**0.5)+1):
        if x % i == 0 :
            return False
    return True

cnt=0
q=int(input())
for _ in range(q):
    v=int(input())
    if checker(v):
        cnt += 1
print(cnt)
Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):


import sys
import math

class Algo:
  @staticmethod
  def is_prime(l):
    ans = 0
    for n in l:
      if n == 2:
        ans += 1
      else:
        for i in range(2,int(math.sqrt(n))+2):
          if n%i == 0:
            ans += 1
    print(ans)

N = int(input())
L = []
for i in range(0,N):
  L.append(int(input()))
Algo.is_prime(L)

Failing test case input:
11
22
14
9
10
22
12
23
4
4
13
5

Expected output:
3


Actual output:
10


Fixed submission (verdict: Accepted):


import sys
import math

class Algo:
  @staticmethod
  def is_prime(n):
    if n == 2:
      return True
    elif n<2 or n%2 == 0:
      return False
    else:
      for i in range(3,int(math.sqrt(n))+2, 2):
        if n%i == 0:
          return False
    return True

N = int(input())
ans = 0
for i in range(0,N):
  if Algo.is_prime(int(input())):
    ans += 1
print(ans)

Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):
import math
def isprime(x):
 if x == 2:
  return True
 elif x < 2 or x % 2 == 0:
  return False
 else:
  for i in range(3, int(math.sqrt(x)),2):
   if x % i == 0:
    return False 
  return True

n = int(input())
cnt = 0
for i in range(n):
 x = int(input())
 if isprime(x):
  cnt += 1
print(str(cnt))

Failing test case input:
11
25
20
9
10
11
13
33
14
16
12
17

Expected output:
3


Actual output:
5


Fixed submission (verdict: Accepted):
import math
def isprime(x):
 if x == 2:
  return True
 elif x < 2 or x % 2 == 0:
  return False
 else:
  for i in range(3, int(math.sqrt(x)) + 1,2):
   if x % i == 0:
    return False 
  return True

n = int(input())
cnt = 0
for i in range(n):
 x = int(input())
 if isprime(x):
  cnt += 1
print(str(cnt))

Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):
n = int(input())
count = 0
for i in range(n):
    x = int(input())
    if (x == 2):
        count += 1
    else:
        for j in range(2, x):
            if (x % j == 0):
                break
            else:
                count += 1
print(count)

Failing test case input:
11
13
20
9
10
11
13
33
14
15
8
17

Expected output:
4


Actual output:
49


Fixed submission (verdict: Accepted):
n = int(input())
count = 0
for i in range(n):
    x = int(input())
    if (x == 2):
        count += 1
    elif (x % 2 == 0):
        continue
    else:
        if (pow(2, x - 1, x) == 1):
            count += 1
print(count)

Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):
n = int(input())
count = 0
for i in range(n):
  x = int(input())
  for j in range(2, x - 1):
    if x == 2:
      count += 1
    elif x % 2 == 0:
      continue
    else:
      if x % j != 0: 
        count += 1
print(count)

Failing test case input:
11
6
4
9
27
11
22
13
2
20
8
44

Expected output:
3


Actual output:
45


Fixed submission (verdict: Accepted):
n = int(input())
count = 0
for i in range(n):
  x = int(input())
  if x == 2:
    count += 1
  elif x % 2 == 0:
    continue
  else:
    if pow(2, x - 1, x) == 1: 
      count += 1
print(count)
Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):
import math
def judge(n):
    if n<2:
        return False
    i=2
    while i<=math.sqrt(n):
        if n%i==0:
            return False
        i+=1
    return True

count=0
n=int(input())
for i in range(n):
    if judge(int(input())):
        count+=1

Failing test case input:
11
7
8
9
10
11
12
17
14
15
5
17

Expected output:
5


Actual output:

Fixed submission (verdict: Accepted):
import math


def judge(n):
    if n < 2:
        return False
    i = 2
    while i <= math.sqrt(n):
        if n % i == 0:
            return False
        i += 1
    return True


count = 0
n = int(input())
for i in range(n):
    if judge(int(input())):
        count += 1
print(count)

Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):
x = int(input())

count = 0
for i in range(0, x):
    a =  int(input())
    if a % 2 == 0:
        count += 1
    else:
        c =int( a / 2)
        for j in range ( 3,  c ):
            if a % j == 0:
                count += 1
                break;
        
print(x-count)
        



Failing test case input:
11
7
8
9
15
11
30
13
2
27
8
17

Expected output:
5


Actual output:
4


Fixed submission (verdict: Accepted):
x = int(input())

count = 0
for i in range(0, x):
    a =  int(input())
    for j in range ( 2,  a ):
        c = int(a)
        if a % j == 0:
            count += 1
            break;
        if j * j  > c:
            break;
        
print(x-count)

Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):
def checker(x):
    if x < 2 or x % 2 == 0 :
        return False
    if x == 2:
        return True
    for i in range(2,int(x**0.5)+1):
        if x % i == 0 :
            return False
    return True

cnt=0
q=int(input())
for _ in range(q):
    v=int(input())
    if checker(v):
        cnt += 1
print(cnt)

Failing test case input:
11
6
4
4
27
4
22
13
2
20
8
44

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
def checker(x):
    if x == 2:
        return True
    if x < 2 or x % 2 == 0 :
        return False
    for i in range(2,int(x**0.5)+1):
        if x % i == 0 :
            return False
    return True

cnt=0
q=int(input())
for _ in range(q):
    v=int(input())
    if checker(v):
        cnt += 1
print(cnt)

Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):
import math

cnt = 0
n = int(input())

for i in range(n):
    x = int(input())
    if x == 2: cnt += 1
    elif x % 2 != 0:
        rx = int(math.sqrt(x))
        for i in range(3, rx):
            if x % i == 0: break
        cnt += 1

print(cnt)


Failing test case input:
11
13
20
9
10
11
13
33
14
15
8
17

Expected output:
4


Actual output:
7


Fixed submission (verdict: Accepted):
import math

cnt = 0
n = int(input())

for i in range(n):
    flg = 1
    x = int(input())
    if x == 2: cnt += 1
    elif x % 2 != 0:
        rx = int(math.sqrt(x))
        for i in range(3, rx+1):
            if x % i == 0:
                flg = 0
                break
        if flg == 1: cnt += 1

print(cnt)
Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):
def isprime(n):
    if n < 2: return 0
    elif n == 2: return 1

    if n % 2 == 0: return 0

    for i in range(3, n, 2):
        if i >= n/i: return 1
        if n % i == 0 : return 0

    return 1

N = int(input())
n = [int(input()) for i in range(N)]

a = [i for i in n if isprime(i)]

print(len(a))


Failing test case input:
11
6
4
9
27
4
22
13
2
20
8
44

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):
def isprime(n):
    if n < 2: return 0
    elif n == 2: return 1

    if n % 2 == 0: return 0

    for i in range(3, n, 2):
        if i > n/i: return 1
        if n % i == 0 : return 0

    return 1

N = int(input())
n = [int(input()) for i in range(N)]

a = [i for i in n if isprime(i)]

print(len(a))

Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):
n = int(input())
count = 0
for i in range(2, n):
  x = int(input())
  if x == 2:
    count += 1
  elif x % i == 0:
    break
  else:
    count += 1
print(count)

Failing test case input:
11
7
10
9
10
11
13
17
14
15
8
17

Expected output:
5


Actual output:
3


Fixed submission (verdict: Accepted):
n = int(input())
count = 0
for i in range(n):
  x = int(input())
  if x == 2:
    count += 1
  elif x % 2 == 0:
    continue
  else:
    if pow(2, x - 1, x) == 1: 
      count += 1
print(count)

Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):
def isprime(x):
    if  x==2:
        return True
    if x<2 or x&1==0:
        return False
    return pow(2,x-1,x)==1

cnt=0
n=int(input())
for i in range(n):
    if isprime(i):
        cnt+=1
print(cnt)

Failing test case input:
11
14
8
9
10
22
12
23
4
9
13
17

Expected output:
3


Actual output:
4


Fixed submission (verdict: Accepted):
def isprime(x):
    if  x==2:
        return True
    if x<2 or x&1==0:
        return False
    return pow(2,x-1,x)==1

cnt=0
n=int(input())
for i in range(n):
    a=int(input())
    if isprime(a):
        cnt+=1
print(cnt)

Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):
import math

def is_prime(n):
    if n == 1 or n == 4:
        return False
    for i in range(2, math.ceil(n**0.5)):
        if n % i == 0:
            return False
    return True

def run():
    n = int(input())
    n_prime = 0
    for i in range(n):
        if is_prime(int(input())):
            n_prime += 1
    print(n_prime)

if __name__ == '__main__':
    run()


Failing test case input:
11
6
4
9
27
4
22
13
2
20
8
44

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):
import math

def is_prime(n):
    if n == 1:
        return False
    if n == 2:
        return True
    for i in range(2, math.ceil(n**0.5)+1):
        if n % i == 0:
            return False
    return True

def run():
    n = int(input())
    n_prime = 0
    for i in range(n):
        if is_prime(int(input())):
            n_prime += 1
    print(n_prime)

if __name__ == '__main__':
    run()
Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):
import math

a = [int(i) for i in input().split("\n")]
a[1:]
def isprime(x):
    if x == 2:
        return True
    elif x % 2 == 0:
        return False
    i = 3
    while i <= math.sqrt(x):
        if x % i == 0:
            return False
        i += 2
    else:
        return True
   
counter = 0
for i in a:
    if isprime(i) == True:
        counter += 1
print(counter)

Failing test case input:
11
4
5
9
26
15
22
2
14
27
8
27

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
import math
n = int(input())
a = []
for i in range(n):
    a.append(int(input()))

def isprime(x):
    if x == 2:
        return True
    elif x % 2 == 0:
        return False
    i = 3
    while i <= math.sqrt(x):
        if x % i == 0:
            return False
        i += 2
    else:
        return True
   
counter = 0
for i in a:
    if isprime(i) == True:
        counter += 1
print(counter)

Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):
n = int(input())
count = 0
j = 2
for i in range(n):
    x = int(input())
    if (x == 2):
        count += 1
    else:
        while (j * j <= x):
            if (x % j == 0):
                break
            else:
                count += 1
            j = j + 1
print(count)
 

Failing test case input:
11
7
8
9
10
11
12
23
4
9
18
17

Expected output:
4


Actual output:
3


Fixed submission (verdict: Accepted):
n = int(input())
count = 0
for i in range(n):
    x = int(input())
    if (x == 2):
        count += 1
    elif (x % 2 == 0):
        continue
    else:
        if (pow(2, x - 1, x) == 1):
            count += 1
print(count)

Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):
def main():
    N = int(input())
    print(IsPrime(N))

def IsPrime(N):
    count = 0
    for i in range(N):
        inputNum = int(input())
        if(inputNum == 2):
            count += 1
            continue
        elif(inputNum % 2 == 0):
            continue

        flag = 0
        for j in range(3, int(pow(inputNum, 1/2))):
            if(inputNum % j == 0):
                flag = 1
                break
            else:
                continue
        if(flag == 0):
            count += 1
    
    return count

if __name__ == '__main__':
    main()

Failing test case input:
11
7
8
9
10
11
22
13
14
27
16
17

Expected output:
4


Actual output:
5


Fixed submission (verdict: Accepted):
def main():
    N = int(input())
    print(IsPrime(N))

def IsPrime(N):
    count = 0
    for i in range(N):
        inputNum = int(input())
        if(inputNum == 2):
            count += 1
            continue
        elif(inputNum % 2 == 0):
            continue

        flag = 0
        for j in range(3, int(pow(inputNum, 1/2))+1):
            if(inputNum % j == 0):
                flag = 1
                break
            else:
                continue
        if(flag == 0):
            count += 1
    
    return count

if __name__ == '__main__':
    main()
Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):
import math

a = [int(i) for i in input().split("\n")]
a[1:]

def isprime(x):
    if x == 2:
        return True
    elif x % 2 == 0:
        return False
    i = 3
    while i <= math.sqrt(x):
        if x % i == 0:
            return False
        i += 2
    else:
        return True
   
counter = 0
for i in a:
    if isprime(i) == True:
        counter += 1
print(counter)

Failing test case input:
11
6
7
4
27
4
22
13
2
20
8
44

Expected output:
3


Actual output:
1


Fixed submission (verdict: Accepted):
import math
n = int(input())
a = []
for i in range(n):
    a.append(int(input()))

def isprime(x):
    if x == 2:
        return True
    elif x % 2 == 0:
        return False
    i = 3
    while i <= math.sqrt(x):
        if x % i == 0:
            return False
        i += 2
    else:
        return True
   
counter = 0
for i in a:
    if isprime(i) == True:
        counter += 1
print(counter)

Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):
def checker(x):
    if x < 2 or x % 2 == 0 :
        return False
    for i in range(2,int(x**0.5+1)):
        if x % i == 0 :
            return False
    return True

cnt=0
q=int(input())
for _ in range(q):
    v=int(input())
    if checker(v):
        cnt += 1
print(cnt)

Failing test case input:
11
4
2
9
26
15
22
2
14
27
8
27

Expected output:
2


Actual output:
0


Fixed submission (verdict: Accepted):
def checker(x):
    if x == 2:
        return True
    if x < 2 or x % 2 == 0 :
        return False
    for i in range(2,int(x**0.5)+1):
        if x % i == 0 :
            return False
    return True

cnt=0
q=int(input())
for _ in range(q):
    v=int(input())
    if checker(v):
        cnt += 1
print(cnt)

Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):
n = int(input())
ls = [int(input()) for _ in range(n)]

def judge(n):
    if n == 2 or n == 3:
        return 1
    div = 3
    while n%2 == 0 or n%div == 0:
        return 0
    div += 2
    return 1

print(sum(map(judge, ls)))


Failing test case input:
11
25
20
9
10
11
13
33
14
16
12
17

Expected output:
3


Actual output:
4


Fixed submission (verdict: Accepted):
n = int(input())
ls = [int(input()) for _ in range(n)]


def judge(n):
    if n == 2 or n == 3:
        return 1
    if n % 2 == 0:
        return 0
    i = 3
    while i <= n/i:
        if n%i == 0:
            return 0
        else:  
            i += 2
    return 1

print(sum(map(judge, ls)))
Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):



def check_pn(num):
    if (num <2):
        return False
    elif (num==2):
        return True

    if (num%2 == 0):
        return False
    i = 3
    while (i <= num/i):
        if num % i == 0:
            return False
        print ( num, i)
        i += 2

    return True


n = int(input())
listdata = []
for i in range(n):
    listdata.append(int(input()))

n=0
for data in listdata:
    ch = check_pn(data)
    n += ch

print (n)




Failing test case input:
11
13
20
9
10
11
13
33
14
16
8
17

Expected output:
4


Actual output:
13 3
11 3
13 3
17 3
4


Fixed submission (verdict: Accepted):



def check_pn(num):
    if (num <2):
        return False
    elif (num==2):
        return True

    if (num%2 == 0):
        return False
    i = 3
    while (i <= num/i):
        if num % i == 0:
            return False
        i += 2

    return True


n = int(input())
listdata = []
for i in range(n):
    listdata.append(int(input()))

n=0
for data in listdata:
    ch = check_pn(data)
    n += ch

print (n)

Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):
import sys


def isprime(n):
    

    
    n = abs(int(n))

    
    if n < 2:
        return False

    
    if n == 2: 
        return True    

    
    if not n & 1: 
        return False

    
    
    for x in range(3, int(n**0.5) + 1, 2):
        if n % x == 0:
            return False

    return True


max = int(sys.stdin.readline())
answer = []

for x in range(max):
    n = sys.stdin.readline()
    if isprime(int(n)):
        answer.append(str(int(n)))

print(' '.join(answer))

Failing test case input:
11
14
14
9
10
22
12
23
4
4
13
5

Expected output:
3


Actual output:
23 13 5


Fixed submission (verdict: Accepted):
import sys


def isprime(n):
    

    
    n = abs(int(n))

    
    if n < 2:
        return False

    
    if n == 2: 
        return True    

    
    if not n & 1: 
        return False

    
    
    for x in range(3, int(n**0.5) + 1, 2):
        if n % x == 0:
            return False

    return True


max = int(sys.stdin.readline())
answer = 0

for x in range(max):
    n = sys.stdin.readline()
    if isprime(int(n)):
        answer += 1

print(answer)

Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):
import math

def isprime(n):
    if x ==2:
        return True
    if x % 2 == 0:
        return False
    for i in range(3, math.floor(math.sqrt(n)), 2):
        if x % i == 0:
            return False
    return True

n = int(input())
count = 0
for i in range(n):
    x = int(input())
    if isprime(x):
        count += 1
print(count)

Failing test case input:
11
7
8
8
10
11
12
23
4
9
18
17

Expected output:
4


Actual output:
5


Fixed submission (verdict: Accepted):
import math

def isprime(n):
    if x == 2:
        return True
    if x % 2 == 0:
        return False
    for i in range(3, math.floor(math.sqrt(n))+1 , 2):
        if x % i == 0:
            return False
    return True

n = int(input())
count = 0
for i in range(n):
    x = int(input())
    if isprime(x):
        count += 1
print(count)
Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):
n = int(input())
count = 0
for i in range(n):
    x = int(input())
    if (x < 2):
        break
    if (x == 2):
        count += 1
    else:
        for j in range(2, n):
            if (x % j == 0):
                break
            else:
                count += 1
print(count)
 

Failing test case input:
11
6
4
9
27
11
22
13
2
20
8
44

Expected output:
3


Actual output:
21


Fixed submission (verdict: Accepted):
n = int(input())
count = 0
for i in range(n):
    x = int(input())
    if (x == 2):
        count += 1
    elif (x % 2 == 0):
        continue
    else:
        if (pow(2, x - 1, x) == 1):
            count += 1
print(count)

Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):


import math


def is_prime(x):
    
    if x == 2:
        return True

    if x <= 1 or x % 2 == 0:
        return False

    i = 3
    while i <= math.sqrt(x):
        if x % i == 0:
            return False
        i += 2
    return True


def to_int(v):
    return int(v)


if __name__ == '__main__':
    l = to_int(input())
    seq = [to_int(input()) for i in range(l)]
    cnt = 0

    for v in seq:
        if is_prime(v):
            cnt += 1
    print(v)

Failing test case input:
11
7
8
9
26
15
22
3
14
27
8
27

Expected output:
2


Actual output:
27


Fixed submission (verdict: Accepted):


import math


def is_prime(x):
    
    if x == 2:
        return True

    if x <= 1 or x % 2 == 0:
        return False

    i = 3
    while i <= math.sqrt(x):
        if x % i == 0:
            return False
        i += 2
    return True


def to_int(v):
    return int(v)


if __name__ == '__main__':
    l = to_int(input())
    seq = [to_int(input()) for i in range(l)]
    cnt = 0

    for v in seq:
        if is_prime(v):
            cnt += 1
    print(cnt)

Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):
from math import sqrt

n=int(input())

count=0




for i in range(n):
    x=int(input())
    if x==1:
        count=count+1
    elif x!=2 and x%2==0:
        count=count
    elif x==2 or x==3 or x==5:
        count=count
    else:
        for j in range(2,int(sqrt(x))+1): 
            print(j)
            if x%j==0:
                count=count+1
                break



print(n-count)




Failing test case input:
11
7
10
9
10
11
13
17
14
15
16
17

Expected output:
5


Actual output:
2
2
3
2
3
2
3
2
3
4
2
3
2
3
4
9


Fixed submission (verdict: Accepted):
from math import sqrt

n=int(input())

count=0

for i in range(n):
    x=int(input())
    if x==1:
        count=count+1
    elif x!=2 and x%2==0:
        count=count+1
    elif x==2 or x==3 or x==5:
        count=count
    else:
        for j in range(2,int(sqrt(x))+1): 
            if x%j==0:
                count=count+1
                break


print(n-count)
Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):
n=int(input())
s=0
for i in range(n):
    a=int(input())
    c=0
    if a==2:
        s+=1
    else:
        for j in range(3,a+1,2):
            if a%j==0:
                break
            c+=1
        if c==a-3:
            s+=1
print(s)

Failing test case input:
11
7
8
9
10
11
12
13
14
15
16
17

Expected output:
4

Actual output:
0


Fixed submission (verdict: Accepted):
n=int(input())
if n==10000:
    print(592)
    quit()
s=0
for i in range(n):
    a=int(input())
    if a==2 or a==3:
        s+=1
    else:
        for j in range(3,a+1,2):
            if j==a:
                s+=1
            elif a%j==0:
                break
          
print(s)

Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):
N = int(input())
a = []

count = 0
for i in range(N):
    x=int(input())
    if x == 2:
        count+=1
    else:
        print(x)
        if pow(2, x-1,x ) == 1:
            count+=1

print(count)



Failing test case input:
11
7
8
9
10
11
22
13
2
27
8
17

Expected output:
5


Actual output:
7
8
9
10
11
22
13
27
8
17
5


Fixed submission (verdict: Accepted):
N = int(input())
a = []

count = 0
for i in range(N):
    x=int(input())
    if x == 2:
        count+=1
    else:
        if pow(2, x-1,x ) == 1:
            count+=1
        else:
            pass

print(count)

Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):
n = int(input())
ls = [int(input()) for _ in range(n)]

def judge(n):
    if n == 2 or n == 3:
        return 1
    div = 3
    while div < n/2:
        if n%2 == 0 or n%div == 0:
            return 0
        else:  
            div += 2
    return 1

print(sum(map(judge, ls)))


Failing test case input:
11
5
20
9
6
14
13
33
5
28
12
11

Expected output:
4


Actual output:
5


Fixed submission (verdict: Accepted):
n = int(input())
ls = [int(input()) for _ in range(n)]


def judge(n):
    if n == 2 or n == 3:
        return 1
    if n % 2 == 0:
        return 0
    i = 3
    while i <= n/i:
        if n%i == 0:
            return 0
        else:  
            i += 2
    return 1

print(sum(map(judge, ls)))

Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):
import math

def is_prime(n):
    sqrtn = math.ceil(math.sqrt(n))
    for i in range(2, sqrtn):
        if n % i:
            return False
    return n != 1

n = int(input())
answer = 0
for _ in range(0, n):
    m = int(input())
    if is_prime(m):
        answer = answer + 1
print(answer)


Failing test case input:
11
7
8
9
10
11
12
13
14
15
16
17

Expected output:
4

Actual output:
2


Fixed submission (verdict: Accepted):
import math

def is_prime(n):
    for i in range(2, int(n**0.5) + 1):
        if n % i == 0:
            return False
    return n != 1

n = int(input())
answer = 0
for _ in range(0, n):
    m = int(input())
    if is_prime(m):
        answer = answer + 1
print(answer)
Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):
import math
primenum =int(input())
ans = 0
for p in range(primenum):
    targ = int(input())
    for t in range(2,math.floor(math.sqrt(targ)) + 1):
        print(t)
        if targ % t == 0:
            break
    else:
        ans += 1
print(ans)

Failing test case input:
11
7
8
9
27
11
22
13
2
20
8
27

Expected output:
4


Actual output:
2
2
2
3
2
3
2
3
2
2
3
2
2
2
3
4


Fixed submission (verdict: Accepted):
import math
primenum =int(input())
ans = 0
for p in range(primenum):
    targ = int(input())
    for t in range(2,math.floor(math.sqrt(targ)) + 1):
        if targ % t == 0:
            break
    else:
        ans += 1
print(ans)

Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):
import math

a = [int(i) for i in input().split("\n")]
a = a[1:]

def isprime(x):
    if x == 2:
        return True
    elif x % 2 == 0:
        return False
    i = 3
    while i <= math.sqrt(x):
        if x % i == 0:
            return False
        i += 2
    else:
        return True
   
counter = 0
for i in a:
    if isprime(i) == True:
        counter += 1
print(counter)

Failing test case input:
11
7
8
9
27
11
22
13
2
20
8
14

Expected output:
4


Actual output:
0


Fixed submission (verdict: Accepted):
import math
n = int(input())
a = []
for i in range(n):
    a.append(int(input()))

def isprime(x):
    if x == 2:
        return True
    elif x % 2 == 0:
        return False
    i = 3
    while i <= math.sqrt(x):
        if x % i == 0:
            return False
        i += 2
    else:
        return True
   
counter = 0
for i in a:
    if isprime(i) == True:
        counter += 1
print(counter)

Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):
n = int(input())
count = 0
for i in range(n):
    x = int(input())
    if (i > 1):
        if (x % i == 0):
            break
        else:
            count += 1
        if (x == 2):
            count += 1
print(count)

Failing test case input:
11
7
8
9
26
11
22
2
14
27
8
27

Expected output:
3


Actual output:
6


Fixed submission (verdict: Accepted):
n = int(input())
count = 0
for i in range(n):
    x = int(input())
    if (x == 2):
        count += 1
    elif (x % 2 == 0):
        continue
    else:
        if (pow(2, x - 1, x) == 1):
            count += 1
print(count)
Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):
def isPrime(x):
    if x==2:
        return True
    
    if x<2 or x%2==0:
        return False
    
    for n in range(3,int(x**0.5)+1,2):
        if x%n==0:
            return False
    print(x)    
    return True  

n=int(input())
num=[int(input()) for i in range(n)]

i=0
for nm in num:
    if isPrime(nm):
        i+=1
        
print(i)

Failing test case input:
11
14
14
9
10
22
12
23
4
4
13
5

Expected output:
3


Actual output:
23
13
5
3


Fixed submission (verdict: Accepted):
def isPrime(x):
    if x==2:
        return True
    
    if x<2 or x%2==0:
        return False
    
    for n in range(3,int(x**0.5)+1,2):
        if x%n==0:
            return False
    return True   

n=int(input())
num=[int(input()) for i in range(n)]

i=0
for nm in num:
    if isPrime(nm):
        i+=1
        
print(i)

Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):
import math
n = input()
c = 0


for i in range(int(n)):
    x = int(input())
    if x == 1:
        x = 0
    for j in range(2,math.floor(math.sqrt(float(x)))+ 1):
        if x % j == 0:
            x = 0
            break
        if x != 0:
            c += 1	
print(c)

Failing test case input:
11
5
20
9
6
9
13
33
5
28
12
17

Expected output:
4


Actual output:
10


Fixed submission (verdict: Accepted):
import math
n = input()
c = 0


for i in range(int(n)):
    x = int(input())
    if x == 1:
        x = 0
    for j in range(2,math.floor(math.sqrt(float(x)))+ 1):
        if x % j == 0:
            x = 0
            break
    if x != 0:
        c += 1	
print(c)

Problem: p02257
Buggy submission (Python3, verdict: Wrong Answer):
import math
def isprime(x):
    if x ==2:
        return True
    if x<2 or x%2 ==0:
        return False
    else:
        sx = int(math.sqrt(x))
        a = 0
        for i in range(3,sx+1,2):
            if x%i ==0:
                return False
            
        return True


Failing test case input:
11
25
20
9
10
11
13
33
14
16
12
17

Expected output:
3


Actual output:

Fixed submission (verdict: Accepted):
import math
def isprime(x):
    if x ==2:
        return True
    if x<2 or x%2 ==0:
        return False
    else:
        sx = int(math.sqrt(x))
        for i in range(3,sx+1,2):
            if x%i ==0:
                return False
            
        return True
a = 0
n = int(input())
for i in range(n):
    a+= isprime(int(input()))
print(a)