CodeEff/ECCO huggingface dataset:
# Original solution
def isPrime(n):
    if n <= 2:
        return n == 2
    if (n % 2 == 0):
        return False
    for i in range(3, n // 2 + 1, 2):
        if n % i == 0:
            return False
    return True


N = int(eval(input()))
print((len(list(filter(isPrime, [int(eval(input())) for i in range(N)])))))



# Optimized solution
import math


def isPrime(n):
    if n <= 2:
        return n == 2
    if (n % 2 == 0):
        return False
    for i in range(3, int(math.sqrt(n)) + 2, 2):
        if n % i == 0:
            return False
    return True


N = int(eval(input()))
print((len(list(filter(isPrime, [int(eval(input())) for i in range(N)])))))
# Original solution
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 n % i == 0 : return 0

    return 1

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

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

print((len(a)))


# Optimized solution
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(eval(input()))
n = [int(eval(input())) for i in range(N)]

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

print((len(a)))
# Original solution
def prime(n):
    if (n==2):
        return True
    elif(n == 1):
        return False
    else:
        pr = [2]
        for i in range(3,n):
            c = 0
            for p in pr:
                if (i % p != 0):
                    c = c + 1
            if (c == len(pr)):
                if n%i == 0:
                    return False 
                    break
                pr.append(i)
        cc = 0        
        for p in pr:
            if(n%p != 0):
                cc = cc + 1
            elif(n%p == 0):
                return False
                break
    
    if(cc == len(pr)):
        return True
    else:
        return False
        
    
N = int(eval(input()))

count = 0
for i in range(N):
    n = int(eval(input()))
    if prime(n) == True:
        count = count + 1 
print(count)   


# Optimized solution
n = int(eval(input()))
mlist = []
for i in range(n):
    m = int(eval(input()))
    mlist.append(m)
mlist.sort()
plist = [2]
for i in range(3,mlist[-1]+1):
    count = 0
    for k in plist:
        if (i%k != 0):
            count += 1
        else:
            break
    if (count == len(plist)):
        plist.append(i)
count = 0
for i in mlist:
    if(i in plist):
        count += 1
print(count)
# Original solution
import math

def prime_numbers(x):
    i_a = list(range(2, x+1))
    p_a = list()
    e_a = math.sqrt(x)
    h = i_a[0]
    while h < e_a:
        h = i_a[0]
        p_a.append(h)
        for j in i_a:
            if j % h == 0:
                i_a.remove(j)
    p_a += i_a
    p_a.sort()
    return p_a

if __name__ == "__main__":
    n = int(eval(input()))
    n_s = list()
    for i in range(n):
        n_s.append(int(eval(input())))

    pnums = prime_numbers(max(n_s))
    count = 0

    for i in n_s:
        if i in pnums:
            count += 1

    print(count)

# Optimized solution
import math

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

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

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

    return True

if __name__ == "__main__":
    n = int(eval(input()))
    count = 0
    for i in range(n):
        if is_prime(int(eval(input()))):
            count += 1

    print(count)
# Original solution
x = int(eval(input()))

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



# Optimized solution
x = int(eval(input()))

count = 0
for i in range(0, x):
    a =  int(eval(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))
# Original solution
prime_list = [2,3,5,7,11]
def appendp(num):
    for i in range(prime_list[-1], num+1, 2):
        for j in prime_list:
            if i % j == 0 or i in prime_list:
                break
            if j == prime_list[-1]:
                prime_list.append(i)

def prime_number():
    n = int(eval(input()))
    count = 0
    for _ in range(n):
        a = int(eval(input()))
        if a > prime_list[-1]:
            appendp(a)
        if a in prime_list:
            count += 1
    print(count)


if __name__ == "__main__":
    prime_number()

# Optimized solution
def isPrime(num):
    if num < 2: return False
    if num == 2: return True
    if num % 2 == 0: return False
    sqrtnum = num ** 0.5
    for i in range(3, int(sqrtnum + 1), 2):
        if num % i == 0:
            return False
    return True


def prime_number():
    n = int(eval(input()))
    count = 0
    for _ in range(n):
        a = int(eval(input()))
        if isPrime(a):
            count += 1
    print(count)

if __name__ == "__main__":
    prime_number()
# Original solution
n = int(eval(input()))
prime = 0
for i in range(n):
    m = int(eval(input()))
    cout = 0
    for j in range(m):
        if m % (j+1) == 0:
            cout += 1
    if cout == 2:
         prime += 1
print(prime)

# Optimized solution
n = int(eval(input()))
prime = 0

def is_prime(q):
    if q == 2:
        return True
    if q < 2:
        return False
    return pow(2, q-1, q) == 1


prime = 0
for i in range(n):
    m = int(eval(input()))
    if is_prime(m):
        prime += 1
print(prime)
# Original solution
def main():
    n = int(eval(input()))
    count = 0
    for _ in range(n):
        x = int(eval(input()))
        count += isprime(x)
    print(count)

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

if __name__ == '__main__':
    main()



# Optimized solution
def main():
    A = set()
    n_prime = 0
    while True:
        try:
            x = int(eval(input()))
            A.add(x)
        except:
            break

    for x in A:
        n_prime += is_prime(x)

    print(n_prime)


def is_prime(x):  
    if x == 2:
        return 1
    elif x % 2 == 0:
        return 0
    else:
        return pow(2, x - 1, x) == 1   

main()
# Original solution
def miller_rabin(n):
    """ primality Test
        if n < 3,825,123,056,546,413,051, it is enough to test 
        a = 2, 3, 5, 7, 11, 13, 17, 19, and 23.
        Complexity: O(log^3 n)
    """
    if n == 2: return True
    if n <= 1 or not n&1: return False

    primes = [2, 3, 5, 7, 11, 13, 17, 19, 23]

    d = n - 1
    s = 0
    while not d&1:
        d >>= 1
        s += 1

    for prime in primes:
        if prime >= n: break
        x = pow(prime, d, n)
        if x == 1: break
        for r in range(s):
            if x == n - 1: break
            if r + 1 == s: return False
            x = x * x % n
    return True

N = int(eval(input()))
print((sum(1 for _ in range(N) if miller_rabin(int(eval(input()))))))

# Optimized solution
def miller_rabin(n):
    """ primality Test
        if n < 3,825,123,056,546,413,051, it is enough to test 
        a = 2, 3, 5, 7, 11, 13, 17, 19, and 23.
        Complexity: O(log^3 n)
    """
    if n == 2: return True
    if n <= 1 or not n&1: return False

    primes = [2, 3, 5, 7, 11, 13, 17, 19, 23]

    d = n - 1
    s = 0
    while not d&1:
        d >>= 1
        s += 1

    for prime in primes:
        if prime >= n: break
        x = pow(prime, d, n)
        if x == 1: break
        for r in range(s):
            if x == n - 1: break
            if r + 1 == s: return False
            x = x * x % n
    return True

N = int(eval(input()))
print((sum(1 for _ in range(N) if miller_rabin(eval(input())))))
# Original solution
n=int(eval(input()))
x=[0]*n
for i in range(n):
	x[i]=int(eval(input()))
cnt=0
cnt2=0
for i in range(n):
	for j in range(1,x[i]+1):
		if x[i]%j==0:
			cnt+=1
	if cnt==2:
		cnt2+=1
	cnt=0

print(cnt2)


# Optimized solution
import math

N=int(eval(input()))

A=[0 for i in range(N)]
for i in range(N):
	A[i]=int(eval(input()))

c=0 
cnt=0

for k in range(N):
	x=math.sqrt(A[k])
	x=(int)(x)
	for j in range(2,x+1):
		if A[k]%j==0:
			cnt+=1
			break
	if cnt==0:
		c+=1
	
	cnt=0


print(c)
# Original solution
class PrimeChecker(object):
    def __init__(self):
        self.primes = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53]
    
    def isPrime(self, n):
        if n in self.primes:
            return True
        elif n < 53:
            return False
        else:
            for i in self.primes:
                if n % i == 0:
                    return False
            for i in range(53, n//2, 2):
                if n % i == 0:
                    return False
            self.primes.append(n)
            return True


N = int(eval(input()))
count = 0
primeChecker = PrimeChecker()
for _ in range(N):
    if primeChecker.isPrime(int(eval(input()))):
        count += 1
print(count)




# Optimized solution
class PrimeChecker:

    def __init__(self):
        self.primes = [2,3]

    def isPrime(self, n):
        if n in self.primes:
            return True
        else:
            for i in self.primes:
                if n % i == 0:
                    return False

        i = 5
        w = 2

        while i * i <= n:
            if n % i == 0:
                return False

            i += w
            w = 6 - w

        self.primes.append(n)

        return True

primeChecker = PrimeChecker()
count = 0
N = int(eval(input()))
for _ in range(N):
    if primeChecker.isPrime((int(eval(input())))):
        count += 1
print(count)
# Original solution
class PrimeChecker:
 
    def __init__(self):
        self.primes = [2,3,5]
 
    def isPrime(self, n):
        if n in self.primes:
            return True
        elif n < self.primes[-1]:
            return False
        else:
            for i in self.primes:
                if n % i == 0:
                    return False
 
        i = self.primes[-1]
        w = 2 if i % 6 == 5 else 4
 
        while i * i <= n:
            if self.isPrime(i):
                self.primes.append(i) 
                if n % i == 0:
                    return False
 
            i += w
            w = 6 - w
 
        return True
 
primeChecker = PrimeChecker()
count = 0
N = int(eval(input()))
for _ in range(N):
    if primeChecker.isPrime((int(eval(input())))):
        count += 1
print(count)
        


# Optimized solution
f=lambda x: 1 if x==2 or x==3 or (not x<2 and not x&1==0 and pow(2,x-1,x)==1) else 0
print((sum(f(int(eval(input()))) for _ in range(int(eval(input()))))))
# Original solution
f=lambda x: 1 if x==2 or x==3 or (not x<2 and not x&1==0 and pow(2,x-1,x)==1) else 0
print((sum(f(int(eval(input()))) for _ in range(int(eval(input()))))))


# Optimized solution
f=lambda x: 1 if x == 2 or x == 3 or (x>3 and x&1==1 and pow(2, x-1, x)==1) else 0
print((sum(f(int(eval(input()))) for _ in range(int(eval(input()))))))
# Original solution
from sys import stdin
import math
def isPrime(x):
    if x == 2 or x == 3: return True
    elif (x < 2 or x % 2 == 0 or x % 3 == 0): return False
    s = int(math.sqrt(x) + 1)
    for i in range(5, s + 1, 2):
        if x % i == 0: return False
    return True
n = int(stdin.readline())
cnt = 0
for i in range(0, n):
    if isPrime(int(stdin.readline())): cnt += 1
print(cnt)

# Optimized solution
from sys import stdin
def isPrime(x):
    if x == 2: return 1
    elif x % 2 == 0: return 0
    return pow(2, x - 1, x) == 1
n = int(stdin.readline())
cnt = 0
for i in range(0, n):
    cnt += isPrime(int(stdin.readline()))
print(cnt)
# Original solution
import sys
readline = sys.stdin.readline
prime = set([2])
for i in range(3, 10000, 2):
    for j in prime:
        if i % j == 0:
            break
    else:
        prime.add(i)
n = int(eval(input()))
cnt = 0
for i in (int(readline()) for _ in range(n)):
    if i in prime:
        cnt += 1
        continue
    for j in prime:
        if i % j == 0:
            break
    else:
        cnt += 1
print(cnt)



# Optimized solution
from sys import stdin
import math
def isPrime(x):
    if x == 2 or x == 3: return True
    elif (x < 2 or x % 2 == 0 or x % 3 == 0): return False
    s = int(math.sqrt(x) + 1)
    for i in range(5, s + 1, 2):
        if x % i == 0: return False
    return True
print((sum([isPrime(int(stdin.readline())) for _ in range(int(stdin.readline()))])))
# Original solution
#!/usr/bin/env python3
from functools import lru_cache
from itertools import count, takewhile


def prime():
    prime = []

    def _isPrime(n):
        for d in takewhile(lambda x: x * x <= n, prime):
            if n % d == 0:
                return False
        return True
    for i in count(2):
        if _isPrime(i):
            prime.append(i)
            yield(i)


@lru_cache(maxsize=None)
def isPrime(n):
    if n < 2:
        return False
    for p in takewhile(lambda x: x * x <= n, prime()):
        if n % p == 0:
            return False
    return True

n = int(eval(input()))
c = 0
for _ in range(n):
    i = int(eval(input()))
    if isPrime(i):
        c += 1
print(c)

# Optimized solution
#!/usr/bin/env python3
from itertools import takewhile
from math import sqrt


def is_prime(primes, i):
    if i in primes:
        return True
    for p in takewhile(lambda x: x * x <= i, sorted(primes)):
        if i % p == 0:
            return False
    return True


def sieve_of_eratosthenes(max):
    is_prime = [True] * (max + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(sqrt(max)) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * i, max + 1, i):
            is_prime[j] = False
    return [x for x in range(max + 1) if is_prime[x]]

primes = set(sieve_of_eratosthenes(10000))

n = int(eval(input()))
c = 0
for _ in range(n):
    i = int(eval(input()))
    if is_prime(primes, i):
        c += 1
print(c)
# Original solution
import math
    
def isprime(x):
    p = [2]
    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(eval(input()))
res = 0
for i in range(n):
    k = int(eval(input()))
    if isprime(k):
        res += 1
print(res)

# Optimized solution
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(eval(input()))
res = 0
for i in range(n):
    k = int(eval(input()))
    if isprime(k):
        res += 1
print(res)
# Original solution
import math


def is_prime(n):
    global primes
    if n == 1:
        return False

    if n == 2:
        return True

    if n % 2 == 0:
        return False

    s = int(math.sqrt(n))
    for x in range(3, s + 1, 2):
        if n % x == 0:
            return False
    else:
        return True


N = int(eval(input()))
d = [int(eval(input())) for _ in range(N)]
d.sort()
print(([is_prime(x) for x in d].count(True)))

# Optimized solution
import math
 
 
def is_prime(n):
    global primes
    if n == 1:
        return False
 
    if n == 2:
        return True
 
    if n % 2 == 0:
        return False
 
    s = int(math.sqrt(n))
    for x in range(3, s + 1, 2):
        if n % x == 0:
            return False
    else:
        return True
 
 
N = int(eval(input()))
d = [int(eval(input())) for _ in range(N)]
print(([is_prime(x) for x in d].count(True)))
# Original solution
N = eval(input())
c = 0
p = [0 for i in range(N)]
for i in range(0,N):
	p[i] = eval(input())
for i in range(N):
	j = p[i]-1
	while(j > 1):
		if(p[i]%j == 0):break
		j -= 1
	if(j == 1):
		c += 1
print(c)

# Optimized solution
import math
N = eval(input())
c = 0
p = [0 for i in range(N)]
for i in range(0,N):
	p[i] = eval(input())
for i in range(N):
	s = math.sqrt(p[i])
	j = 2
	while(j <= s):
		if(p[i]%j == 0):
			break
		j += 1
	if(j > s):
		c += 1
print(c)
# Original solution
def maybe_prime(d,s,n):
    for a in (2,3,5,7):
        p = False
        x = pow(a,d,n)
        if x==1 or x==n-1:
            continue
        for i in range(1,s):
            x = x*x%n
            if x==1: return False
            elif x == n-1:
                p = True
                break
        if not p: return False
    return True

def is_prime(n):
    if n in (2,3,5,7): return True
    elif n%2==0: return False
    else:
        d,s = n-1, 0
        while not d%2:
            d,s = d>>1,s+1
        return maybe_prime(d,s,n)
cnt = 0
n = int(eval(input()))
for i in range(n):
  n = int(eval(input()))
  if is_prime(n): cnt+=1

print(cnt)

# Optimized solution
def maybe_prime(d,s,n):
    for a in (2,3,5,7):
        p = False
        x = pow(a,d,n)
        if x==1 or x==n-1:
            continue
        for i in range(1,s):
            x = x*x%n
            if x==1: return False
            elif x == n-1:
                p = True
                break
        if not p: return False
    return True

def is_prime(n):
    if n in (2,3,5,7): return True
    elif 0 in (n%2,n%3,n%5,n%7): return False
    else:
        d,s = n-1, 0
        while not d%2:
            d,s = d>>1,s+1
        return maybe_prime(d,s,n)
cnt = 0
n = int(eval(input()))
for i in range(n):
  n = int(eval(input()))
  if is_prime(n): cnt+=1

print(cnt)
# Original solution
def maybe_prime(d,s,n):
    for a in (2,3,5,7):
        p = False
        x = pow(a,d,n)
        if x==1 or x==n-1:
            continue
        for i in range(1,s):
            x = x*x%n
            if x==1: return False
            elif x == n-1:
                p = True
                break
        if not p: return False
    return True

def is_prime(n):
    if n in (2,3,5,7): return True
    elif 0 in (n%2,n%3,n%5,n%7): return False
    elif 0 in [ n%i for i in range(11,min(n-1,1000),2) ]:return False
    else:
        d,s = n-1, 0
        while not d%2:
            d,s = d>>1,s+1
        return maybe_prime(d,s,n)
cnt = 0
n = int(eval(input()))
for i in range(n):
  n = int(eval(input()))
  if is_prime(n): cnt+=1

print(cnt)

# Optimized solution
def maybe_prime(d,s,n):
    for a in (2,3,5,7):
        p = False
        x = pow(a,d,n)
        if x==1 or x==n-1:
            continue
        for i in range(1,s):
            x = x*x%n
            if x==1: return False
            elif x == n-1:
                p = True
                break
        if not p: return False
    return True

def is_prime(n):
    if n in (2,3,5,7): return True
    elif 0 in (n%2,n%3,n%5,n%7): return False
    elif 0 in [ n%i for i in range(11,min(n-1,100),2) ]:return False
    else:
        d,s = n-1, 0
        while not d%2:
            d,s = d>>1,s+1
        return maybe_prime(d,s,n)
cnt = 0
n = int(eval(input()))
for i in range(n):
  n = int(eval(input()))
  if is_prime(n): cnt+=1

print(cnt)
# Original solution
def maybe_prime(d,s,n):
    for a in (2,3,5,7):
        p = False
        x = pow(a,d,n)
        if x==1 or x==n-1:
            continue
        for i in range(1,s):
            x = x*x%n
            if x==1: return False
            elif x == n-1:
                p = True
                break
        if not p: return False
    return True

def is_prime(n):
    if n in (2,3,5,7): return True
    elif 0 in (n%2,n%3,n%5,n%7): return False
    elif 0 in [ n%i for i in range(11,min(n-1,20),2) ]:return False
    else:
        d,s = n-1, 0
        while not d%2:
            d,s = d>>1,s+1
        return maybe_prime(d,s,n)
cnt = 0
n = int(eval(input()))
for i in range(n):
  n = int(eval(input()))
  if is_prime(n): cnt+=1

print(cnt)

# Optimized solution
def maybe_prime(d,s,n):
    for a in (2,3,5,7):
        p = False
        x = pow(a,d,n)
        if x==1 or x==n-1:
            continue
        for i in range(1,s):
            x = x*x%n
            if x==1: return False
            elif x == n-1:
                p = True
                break
        if not p: return False
    return True

def is_prime(n):
    if n in (2,3,5,7,11): return True
    elif 0 in (n%2,n%3,n%5,n%7,n%11): return False
    else:
        d,s = n-1, 0
        while not d%2:
            d,s = d>>1,s+1
        return maybe_prime(d,s,n)
cnt = 0
n = int(eval(input()))
for i in range(n):
  n = int(eval(input()))
  if is_prime(n): cnt+=1

print(cnt)
# Original solution
import math
n = int(input())
cnt = 0
for i in range(n):
    j = 2
    num = int(input())
    while j <= math.sqrt(num):
        if num % j == 0:
            break
        j+=1
    if j > math.sqrt(num):
        cnt+=1
print(cnt)


# Optimized solution
import math

n = int(eval(input()))
cnt = 0
for i in range(n):
    num = int(eval(input()))
    flag = 1
    if num == 2:
        flag = 1
    elif num % 2 == 0 or num < 2:
        flag = 0
    else:
        for j in range(3, int(math.sqrt(num))+1, 2):
            if num % j == 0:
                flag = 0
                break
    if flag:
        cnt+=1
print(cnt)
# Original solution
def primeq(x):
    if x==1:return False
    for i in range(2,x):
        if x%i==0:return False
    return True

c=0
for i in range(int(eval(input()))):
    if primeq(int(eval(input()))):c+=1
print(c)


# Optimized solution
def primeq(x):
    if x==1:return False
    for i in range(2,int(x**.5)+1):
        if x%i==0:return False
    return True

c=0
for i in range(int(eval(input()))):
    if primeq(int(eval(input()))):c+=1
print(c)
# Original solution
def is_prime(n):
  ps = [2, 3, 5, 7, 11, 13, 17]
  for p in ps:
    if n == p: return 1
    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(eval(input()))):
  c += is_prime(int(eval(input())))
print(c)


# Optimized solution
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(eval(input()))):
  c += is_prime(int(eval(input())))
print(c)
# Original solution
primes = [2]

def is_prime(num):
    root = num ** 0.5
    for prime in primes:
        if root < prime:
            break
        if num % prime == 0:
            return False
    return True

def create_primes(primes, max):
    for i in range(primes[-1] + 1,max):
        if is_prime(i):
            primes += [i]

create_primes(primes, 10000)

n = int(eval(input()))
count = 0
for _ in range(n):
    num = int(eval(input()))
    count += 1 if is_prime(num) else 0
print(count)

# Optimized solution
primes = [2]

def is_prime(num):
    root = num ** 0.5
    for prime in primes:
        if root < prime:
            break
        if num % prime == 0:
            return False
    return True

def create_primes(primes, max):
    for i in range(primes[-1] + 1,max):
        if is_prime(i):
            primes += [i]

create_primes(primes, 10000)
count = 0
n = int(eval(input()))   
for _ in range(n):
    if is_prime(int(eval(input()))):
        count += 1
print(count)