Problem:


Prime Numbers

A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.

Write a program which reads a list of N integers and prints the number of prime numbers in the list.

Input

The first line contains an integer N, the number of elements in the list.

N numbers are given in the following lines.

Output

Print the number of prime numbers in the given list.

Constraints

1 ≤ N ≤ 10000

2 ≤ an element of the list ≤ 108

Sample Input 1

5
2
3
4
5
6

Sample Output 1

3

Sample Input 2

11
7
8
9
10
11
12
13
14
15
16
17

Sample Output 2

4



Sample input:
5
2
3
4
5
6


Sample output:
3

Submission status: Wrong Answer

Solution code:
from math import sqrt

def prime_numbers(n):
    total = 0
    for x in n:
        if is_prime(x):
            total += 1
    return total

def is_prime(x):
    if x == 2:
        return True
    elif x < 2 or x % 2 ==0:
        return False

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

if __name__ == '__main__':
    n = []
    for _ in range(int(input())):
        n.append(int(input()))
    print(prime_numbers(n))

Submission status: Wrong Answer

Solution code:
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 = str([isprime(int(i)) for i in input().split()].count(1))
print(n)

Submission status: Wrong Answer

Solution code:
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
        if i <= n/i: break

    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))

Submission status: Wrong Answer

Solution code:
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))

Submission status: Wrong Answer

Solution code:
from math import sqrt, floor, ceil

def main():
    alist = []
    for _ in range(int(input())):
        alist.append(int(input()))

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

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

        n = ceil(sqrt(n))
        for i in range(2, n):
            if n % i == 0:
                return False
        return True

    print(sum([is_prime(n) for n in alist]))

main()

Submission status: Wrong Answer

Solution code:
from math import sqrt, floor, ceil


def main():
    alist = []
    for _ in range(int(input())):
        alist.append(int(input()))

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

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

        n = ceil(sqrt(n))
        for i in range(2, n):
            if n % i == 0:
                return False
        return True

    result = sum([is_prime(n) for n in alist])
    print(result)

main()

Submission status: Wrong Answer

Solution code:
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)

Submission status: Wrong Answer

Solution code:
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)

Submission status: Wrong Answer

Solution code:
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

Submission status: Wrong Answer

Solution code:
import math

def Eratos(n):
	primes = [2]
	num = [2*i+1 for i in range(1,n//2)]
	tmp = []

	top = 1
	while top < math.sqrt(n):
		top = num[0]
		for i in range(1,len(num)):
			if num[i] % top != 0:
				tmp.append(num[i])
		num = tmp
		tmp = []
		primes.append(top)
	for i in range(len(num)):
		primes.append(num[i])
	return primes

n = int(input())
cont = 0
nums = []
for i in range(n):
	a = int(input())
	nums.append(a)
nums.sort()
primes = Eratos(nums[n-1])
for i in range(n):
	if primes.count(nums[i])!=0:
		cont += 1
print(cont)

Submission status: Wrong Answer

Solution code:
import math
N=int(input())
cnt=0
for i in range(N):
    
    n=int(input())
    if n==2 or n==3:
        cnt=cnt+1
    elif n!=1:
        for j in range(2,int(math.sqrt(n))+1):
            b=1
            a=n%j
            if a==0:
                b=0
        if b==1:
            cnt=cnt+1
print(cnt)

Submission status: Wrong Answer

Solution code:
import math

n = int(input())
x = []
for i in range(n):
    x.append(int(input()))
s = 0
for i in range(n):
    j = 2
    flag = 1
    while(j > math.sqrt(x[i])):
        if x[i] % j == 0:
            flag = 0
            break
        j += 1
    if flag == 1:
        s += 1
print(s)

Submission status: Wrong Answer

Solution code:
#16D8101023J 久保田凌弥 kubotarouxxx python3

n=int(input())
A=[0]*n
for m in range(n):
 A[m]=int(input())

k=0
for i in range(n):
 for j in range(1,A[n-1]):
  if j==1:
   continue
  if j==(A[n-1]-1):
   k+=1
  if (A[i-1]%j)==0:
   break

print(j)

Submission status: Wrong Answer

Solution code:
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)

Submission status: Wrong Answer

Solution code:
import math

def Eratos(n):
	primes = [2]
	num = [2*i+1 for i in range(1,n//2)]
	tmp = []

	top = 1
	while top < math.sqrt(n):
		top = num[0]
		for i in range(1,len(num)):
			if num[i] % top != 0:
				tmp.append(num[i])
		num = tmp
		tmp = []
		primes.append(top)
	for i in range(len(num)):
		primes.append(num[i])
	return primes

n = int(input())
cont = 0
primes = Eratos(10000)
for i in range(n):
	a = int(input())
	if a==2 or a==5:
		cont += 1
	if a%10==1 or a%10==3 or a%10==7 or a%10==9:
		if a<10000:
			if primes.count(a)!=0:
				cont += 1
		else:
			for j in range(1,len(primes)):
				if math.sqrt(a)<primes[j]:
					cont += 1
					break
				elif a%primes[j]==0:
					break
print(cont)

Submission status: Wrong Answer

Solution code:
import math

def Eratos(n):
	primes = [2]
	num = [2*i+1 for i in range(1,n//2)]
	tmp = []

	top = 1
	while top < math.sqrt(n):
		top = num[0]
		for i in range(1,len(num)):
			if num[i] % top != 0:
				tmp.append(num[i])
		num = tmp
		tmp = []
		primes.append(top)
	for i in range(len(num)):
		primes.append(num[i])
	return primes

n = int(input())
cont = 0
primes = Eratos(10000)
for i in range(n):
	a = int(input())
	if a==2 or a==5:
		cont += 1
	if a%10==1 or a%10==3 or a%10==7 or a%10==9:
		if a<10000:
			if primes.count(a)!=0:
				cont += 1
		else:
			for j in range(len(primes)):
				if math.sqrt(a)<primes[j]:
					cont += 1
					break
				elif a%primes[j]==0:
					break
print(cont)

Submission status: Wrong Answer

Solution code:
import math

def Eratos(n):
	primes = [2]
	num = [2*i+1 for i in range(1,n//2)]
	tmp = []

	top = 1
	while top < math.sqrt(n):
		top = num[0]
		for i in range(1,len(num)):
			if num[i] % top != 0:
				tmp.append(num[i])
		num = tmp
		tmp = []
		primes.append(top)
	for i in range(len(num)):
		primes.append(num[i])
	return primes

n = int(input())
cont = 0
primes = Eratos(10000)
for i in range(n):
	a = int(input())
	if a<10000:
		if primes.count(a)!=0:
			cont += 1
	else:
		for j in range(len(primes)):
			if math.sqrt(a)<primes[j]:
				cont += 1
				break
			elif a%primes[j]==0:
				break
print(cont)

Submission status: Wrong Answer

Solution code:
import math

def Eratos(n):
	primes = [2]
	num = [2*i+1 for i in range(1,n//2)]
	tmp = []

	top = 1
	while top < math.sqrt(n):
		top = num[0]
		for i in range(1,len(num)):
			if num[i] % top != 0:
				tmp.append(num[i])
		num = tmp
		tmp = []
		primes.append(top)
	for i in range(len(num)):
		primes.append(num[i])
	return primes

n = int(input())
cont = 0
primes = Eratos(10000)
for i in range(n):
	a = int(input())
	if a<10000:
		if primes.count(a)!=0:
			cont += 1
	else:
		for j in range(len(primes)):
			if a%primes[j]==0:
				break
			else:
				if math.sqrt(a)<primes[j]:
					cont += 1
					break
print(cont)

Submission status: Wrong Answer

Solution code:
import math

def Eratos(n):
	primes = [2]
	num = [2*i+1 for i in range(1,n//2)]
	tmp = []

	top = 1
	while top < math.sqrt(n):
		top = num[0]
		for i in range(1,len(num)):
			if num[i] % top != 0:
				tmp.append(num[i])
		num = tmp
		tmp = []
		primes.append(top)
	for i in range(len(num)):
		primes.append(num[i])
	return primes

n = int(input())
cont = 0
primes = Eratos(10002)
for i in range(n):
	a = int(input())
	if a<10000:
		if primes.count(a)!=0:
			cont += 1
	else:
		for j in range(len(primes)):
			if a%primes[j]==0:
				break
			else:
				if math.sqrt(a)<primes[j]:
					cont += 1
					break
print(cont)

Submission status: Wrong Answer

Solution code:
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)

Submission status: Wrong Answer

Solution code:
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
                print(A[i])
            else: pass
print(cnt)

Submission status: Wrong Answer

Solution code:
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)

Submission status: Wrong Answer

Solution code:
#16D8101012J 伊藤惇 dj Python3
import math
def check(B,i):
    sum=0 
    for j in range(len(B)):
        if B[j]%10 in [1,2,4,5,6,8]:
            del B[j]
            check(B,i)
        if B[j]%i==0:
            sum+=1
            del B[j]
    return sum
def Prime_Numbers(A):
    mx=max(A)
    sum=0
    if 2 in A:
        sum+=1
    if 3 in A:
        sum+=1
    if 5 in A:
        sum+=1
    if 7 in A:
        sum+=1
    i=10
    while i <= math.sqrt(mx):
        mx=max[A]
        sum+=check(A,i)
        i+=1
    print("A={}".format(A))
    return sum

if __name__ == "__main__":
    A=[]
    n=int(input())
    for i in range(n):
        A.append(int(input()))
    print(Prime_Numbers(A))

Submission status: Wrong Answer

Solution code:
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)

Submission status: Wrong Answer

Solution code:
#16D8101012J 伊藤惇 dj Python3
import math

def Prime_Numbers(x):
    i=2
    flag=True
    while i <= math.sqrt(x):
        if x%i==0:
            print("x={}".format(x))
            flag=False  
            break
        i+=1
    return flag
if __name__ == "__main__":
    A=[]
    n=int(input())
    for i in range(n):
        A.append(int(input()))
    sum=0
    for i in A:
        print("i={}".format(i))
        if Prime_Numbers(i):
            sum+=1
    print(sum)

Submission status: Wrong Answer

Solution code:

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)

Submission status: Wrong Answer

Solution code:
import math
def PrimeNum(a):
	x=math.sqrt(a)
	x=int(x)
	tmp=1
	if a==1:
		tmp=0
	elif a==2:
		tmp==1
	elif a>3 and a<9:
		for i in range(2,a):
			st=a%i
			if st==0:
				tmp=0
				break
	
	else:
		for i in range(2,x):
			st=a%i
			if st == 0:
				tmp=0
				break
	#print("::::",a,x,st,tmp)

	return tmp	
	
n=int(input())
p=[]
att=0
for i in range(n):
	p.append(int(input()))
	att+=PrimeNum(p[i])
	
print(att,p)

Submission status: Wrong Answer

Solution code:
import math
def PrimeNum(a):
	x=math.sqrt(a)
	x=int(x)
	tmp=1
	if a==1:
		tmp=0
	elif a==2:
		tmp==1
	elif a>3 and a<9:
		for i in range(2,a):
			st=a%i
			if st==0:
				tmp=0
				break
	
	else:
		for i in range(2,x+1):
			st=a%i
			if st == 0:
				tmp=0
				break
	#print("::::",a,x,st,tmp)
		
	if tmp==1:print("・・")

	return tmp	
	
n=int(input())
p=[]
att=0
for i in range(n):
	p.append(int(input()))
	att+=PrimeNum(p[i])
	
print(att)

Submission status: Wrong Answer

Solution code:
import math
N=int(input())  
sum=N
for i in range(N):
    a=int(input())
    b=int(math.sqrt(a)+1)
    for j in range(2,b):
        if a%j==0:
            sum=sum-1
print(sum)

Submission status: Wrong Answer

Solution code:
n=int(input())

A=[0 for i in range(n)]

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

x=0

for j in range(2,n+1):
    k=0
    for j in range(2,j):
        if A[j]%j==0:
            k=k+1
    if k==0:
        x=x+1
print(x)

Submission status: Wrong Answer

Solution code:
import math

def is_prime(n):
	for j in range(2,math.floor(math.sqrt(n))+1):
		if n%i==0:
			return False
	return True
 
cnt = 0
n=int(input())
for i in range(n):
    k=int(input())
    if is_prime(k):
        cnt+=1
print(cnt,end="")

Submission status: Wrong Answer

Solution code:

n=int(input())

A=[0 for i in range(n)]

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

x=0
for j in range(2,A[i]):
    if A[i]%j==0:
        x+=0
    else:
        x+=1

print(x)

Submission status: Wrong Answer

Solution code:
n=int(input())

A=[0 for i in range(n)]

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

for i in range(1,n+1):
  x=0
  for j in range(1,i+1):
    if i%j == 0:
      x+=1
  if x==2:
      x+=1
      
print(x)

Submission status: Wrong Answer

Solution code:
import math

n=int(input())
c=0
for j in range(n):
    x=int(input())
    if x<2: pass
    elif x==2 or x==3 or x==5 or x==7:
        c+=1
    for i in range(2,int(math.sqrt(x))+1):
        if x>i and x%i==0:
            break
        elif i==x and x%i==0:
            c+=1

print(c)

Submission status: Wrong Answer

Solution code:
#! python3
# prime_number.py

import math

def is_prime_number(x):
    if x < 2: return False
    elif x == 2: return True
    elif x%2 == 0: return False

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

    return True

n = int(input())
prime_num = 0
for i in range(n):
    x = int(input())
    if is_prime_number(x):
        prime_num += 1
        print(x,'is a prime number')

print(prime_num)

Submission status: Wrong Answer

Solution code:

import math

n=int(input())
c=0
for i in range(n):
    x=int(input())
    if x<2: pass
    elif x==2 or x==3 or x==5 or x==7:
        c+=1
    else:
        x=int(math.sqrt(x)+1)
        for j in range(2,x):
            if x%j==0:
                break
            else: pass
            if j==x:
                c+=1
            else: pass

print(c)

Submission status: Wrong Answer

Solution code:
import math
n=int(input("n:"))
R=[0]*n
sum=0
for i in range(n):
    R[i]=int(input(""))
for i in range(n):
    s=math.sqrt(R[i])
    s=int(s)+1
    for j in range(2,s+1):
        if R[i]==j:
            sum=sum+1
        if R[i]%j==0:
            break
        if j==s:
            sum=sum+1
print(sum)

Submission status: Wrong Answer

Solution code:
import math

def is_prime(num):
    if num == 2:
        return True
    elif num < 2 or num % 2 == 0:
        return False
    else:
        i = 3
        while i < math.sqrt(num):
            if num % i == 0:
                return False
            i += 2
    return True

n = int(input())
prime_numbers = []

for i in range(n):
    num = int(input())
    if is_prime(num):
        prime_numbers.append(num)

print(len(prime_numbers))

Submission status: Wrong Answer

Solution code:
import sys
import math

#num = [int(i) for i in sys.argv[2:]]
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)

Submission status: Wrong Answer

Solution code:
import math

def prime_numbers(numbers):
    return list(map(is_prime, numbers)).count(True)


def is_prime(n):
    if (n == 2):
        return True
    elif (n % 2 == 0):
        return False
    else:
        for i in range(2, math.ceil(math.sqrt(n))):
            if n % i == 0:
                return False

    return True

if __name__ == '__main__':
    n = int(input())
    numbers = []
    for i in range(0, n):
        numbers.append(int(input()))
    print(prime_numbers(numbers))

Submission status: Wrong Answer

Solution code:
n=int(input())
c=0
for i in range(n):
    p=int(input())
    if pow(2,p-1,p)==1:
        c+=1
print(c)

Submission status: Wrong Answer

Solution code:
# ALDS_1_C.
from math import sqrt, floor

def intinput():
    a = input().split()
    for i in range(len(a)):
        a[i] = int(a[i])
    return a

def get_prime():
    P = []
    P.append(2); P.append(3); P.append(5); P.append(7)
    # まず100までの素数を作って、それから10000まで行く。
    # 100までの合成数は必ず2, 3, 5, 7のどれかで割れる。
    for n in range(8, 101):
        is_prime = True
        for i in range(4):
            if n % P[i] == 0: is_prime = False; break
        if is_prime: P.append(n)
    for n in range(101, 10001):
        is_prime = True
        limit = floor(sqrt(n))
        for i in range(len(P)):
            if n % P[i] == 0: is_prime = False; break
            if P[i] > limit: break
        if is_prime: P.append(n)
    return P

def main():
    # 10000までの素数のリスト作って、
    # 平方根までの素数で割っていった方が早い。多分。
    primes = get_prime()
    n = int(input())
    data = []
    for i in range(n): data.append(int(input()))
    count = 0
    for i in range(n):
        limit = floor(sqrt(data[i]))
        is_prime = True
        for p in primes:
            if data[i] % p == 0: is_prime = False; break
            if p > limit: break
        if is_prime: count += 1
    print(count)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
N = int(input())
a = []

for i in range(N):
    a.append(int(input()))


count = 0
Sosu = True

for i in range(N):
    for j in range(2,i):
        if i % j == 0:
            Sosu = False
            break
        else :
            pass
    if Sosu :
        count+=1
    else:
        pass

print(count)

Submission status: Wrong Answer

Solution code:
N = int(input())
a = []

for i in range(N):
    a.append(int(input()))


count = 0
Sosu = True

for i in range(0,N):
    Sosu = True
    for j in range(2,a[i]):
        if a[i] % j == 0:
            Sosu = False
            break
        else :
            pass
    if Sosu :
        count+=1
    else:
        pass
    print(a[i],Sosu)

print(count)

Submission status: Wrong Answer

Solution code:
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)

Submission status: Wrong Answer

Solution code:
import math

m=int(input())
cnt=0

for i in range(m):
    n=int(input())
    if n==2: 
        cnt+=1
        continue
    if n%2==0: 
        continue
    
    sq=int(math.sqrt(n))+1
    for j in range(3,sq,2):
        if n%j==0:
            continue
    cnt+=1

Submission status: Wrong Answer

Solution code:



def divisor(num):
    for i in range(2, num):
        if num % 2 == 0 and num != 2:
            continue

        if num % i == 0:
            return True

    return False



N = input()
cnt = 0
for itr in N:
    num = int(input())
    if divisor(num):
        cnt = cnt+1

print(cnt)

Submission status: Wrong Answer

Solution code:



def divisor(num):
    for i in range(2, num):
        if num % i == 0:
            return True

    return False



N = input()
cnt = 0
for itr in N:
    num = int(input())
    if divisor(num):
        cnt = cnt+1

print(cnt)

Submission status: Wrong Answer

Solution code:



def divisor(num):
    for i in range(2, num):
        if num % i == 0:
            return True

    return False



N = input()
cnt = 0
for itr in N:
    num = int(input())
    if divisor(num):
        cnt = cnt+1

print(cnt, end="")

Submission status: Wrong Answer

Solution code:



def divisor(num):
    for i in range(2, num+1):
        if num % i == 0:
            return True

    return False



N = input()
cnt = 0
for itr in N:
    num = int(input())
    if divisor(num):
        cnt = cnt+1

print(cnt, end="")

Submission status: Wrong Answer

Solution code:



def divisor(num):
    for i in range(2, num):
        if num % i == 0:
            return False

    return True


N = input()
cnt = 0
for itr in N:
    num = int(input())
    if divisor(num):
        cnt = cnt+1

print(cnt, end="")

Submission status: Wrong Answer

Solution code:

def divisor(num):
    for i in range(2, num):
        if num % i == 0:
            return False

    return True



N = input()
cnt = 0
for itr in N:
    num = int(input())
    if divisor(num):
        cnt = cnt+1

print(cnt, end="")

Submission status: Wrong Answer

Solution code:
from sys import stdin
def stdinput():
    return stdin.readline().strip()

def main():
    n = int(stdinput())
    inputs = list(map(int, [stdinput() for _ in range(n)]))

    cache = [2]
    primes = list(filter(lambda a: is_prime(a, cache), inputs))
    print(len(primes))

def is_prime(a, primes):
    if a == 2:
        return True
    for p in primes:
        if a % p == 0:
            return False
    for b in range(max(primes), a // 2):
        if any(map(lambda p: b % p != 0, primes)):
            primes.append(b)
        if a % b == 0:
            return False
    return True

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def eratos(n):
	is_prime = [True for i in range(n+1)]
	is_prime[0] = False
	is_prime[1] = False
	for i in range(2, n):
		if i * i > n:
			break
		for j in range(i*i, n, i):
			is_prime[j] = False
	return is_prime

is_prime = eratos(10000)
primes = []
for i in range(10000):
    if is_prime[i] is True:
        primes.append(i)

n = int(input())
ans = 0
for _ in range(n):
    x = int(input())
    if x <= 10000:
        if is_prime[x] is True:
            ans += 1
    else:
        ok = True
        for i in primes:
            if i * i > x:
                break
            if x % i:
                ok = False
                break
        if ok is True:
            ans += 1
    
print(ans)

Submission status: Wrong Answer

Solution code:
def eratos(n):
	is_prime = [True for i in range(n+1)]
	is_prime[0] = False
	is_prime[1] = False
	for i in range(2, n):
		if i * i > n:
			break
		for j in range(i*i, n, i):
			is_prime[j] = False
	return is_prime

is_prime = eratos(10000)
primes = []
for i in range(10001):
    if is_prime[i] is True:
        primes.append(i)

n = int(input())
ans = 0
for _ in range(n):
    x = int(input())
    if x <= 10000:
        if is_prime[x] is True:
            ans += 1
    else:
        ok = True
        for i in primes:
            if i * i > x:
                break
            if x % i:
                ok = False
                break
        if ok is True:
            ans += 1
    
print(ans)

Submission status: Wrong Answer

Solution code:
def eratos(n):
	is_prime = [True for i in range(n+1)]
	is_prime[0] = False
	is_prime[1] = False
	for i in range(2, n+1):
		if i * i > n:
			break
		for j in range(i*i, n+1, i):
			is_prime[j] = False
	return is_prime

is_prime = eratos(10000)
primes = []
for i in range(10001):
    if is_prime[i] is True:
        primes.append(i)

n = int(input())
ans = 0
for _ in range(n):
    x = int(input())
    if x <= 10000:
        if is_prime[x] is True:
            ans += 1
    else:
        ok = True
        for i in primes:
            if i * i > x:
                break
            if x % i:
                ok = False
                break
        if ok is True:
            ans += 1
    
print(ans)

Submission status: Wrong Answer

Solution code:
def is_prime(num):
	if num <= 1: return False
	if num % 2 == 0: return True
	i = 3
	while i <= num**0.5:
		if num % i == 0: return True
		i += 2
	return False
	
n = int(input())
cnt = 0
for i in range(n):
	if is_prime(int(input())):
		cnt += 1
print(cnt)

Submission status: Wrong Answer

Solution code:
intMax = -100000000
inputData = int(input())
inputList = list()
inputList.append(1)

Submission status: Wrong Answer

Solution code:
intMax = -100000000
inputData = int(input())
inputList = list()
tmpData = int(input())
inputList.append(tmpData)

Submission status: Wrong Answer

Solution code:
intMax = -100000000
inputData = int(input())
inputList = list()
count = 0
while count < inputData:
    tmpData = int(input())
    inputList.append(tmpData)
    count = count + 1

Submission status: Wrong Answer

Solution code:
import math

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

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True

l = input().split()
l = [int(s) for s in l]
a = 0
for i in range(0,len(l)):
    if ( is_prime(l[i]) == True):
        a += 1
print(a)

Submission status: Wrong Answer

Solution code:
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()

Submission status: Wrong Answer

Solution code:
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()

Submission status: Wrong Answer

Solution code:
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
    print('prime -> ', n)
    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()

Submission status: Wrong Answer

Solution code:
# Prime Numbers

n = int(input())

def isPrime(a):
    if a == 2:
        return True
    elif a < 2 or a & 2 == 0:
        return False
    else:
        i = 3
        j = a ** 0.5
        while i < j:
            if a % i == 0:
                return False
            i += 2
    return True

primeCount = 0
for i in range(n):
    a = int(input())
    if isPrime(a) == True:
        primeCount += 1

print(primeCount)

Submission status: Wrong Answer

Solution code:
# Prime Numbers

n = int(input())

def isPrime(a):
    print('a = ' + str(a))
    if a == 2:
        return True
    elif a < 2 or a % 2 == 0:
        return False
    else:
        i = 3
        j = a ** 0.5
        while i <= j:
            if a % i == 0:
                return False
            i += 2
        return True

primeCount = 0
for i in range(n):
    a = int(input())
    if isPrime(a) == True:
        print(str(a) + ' は素数')
        primeCount += 1

print(primeCount)

Submission status: Wrong Answer

Solution code:
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 <= 106:
            return False
        else:
            for i in self.primes:
                if n % i == 0:
                    return False
            for i in range(107, n//2, 2):
                if n % i == 0:
                    return False
            self.primes.append(n)
            return True


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

Submission status: Wrong Answer

Solution code:
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(input())
for _ in range(N):
    if primeChecker.isPrime((int(input()))):
        count += 1
print(count)

Submission status: Wrong Answer

Solution code:
def get_primes(n):
    if n < 10: return [2,3,5,7]
    x = [0,0]+[i for i in range(2,n+1)]
    for e in get_primes(int(n**0.5+1)):
        for j in range(e*2, n+1,e):
            x[j] = 0
    return filter(None, x)

PRIMES = get_primes(10000)
n = int(input())
c = 0
for i in range(n):
    if int(input()) in PRIMES:
        c += 1
print c

Submission status: Wrong Answer

Solution code:
n = int(raw_input())
data = [int(raw_input()) for i in range(n)]

count = 0
for num in data:
	count += 1
	for i in range(2, num/2 + 3):
		if num % i == 0:
			count += -1
			break
			
print count

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
from __future__ import division, print_function
from sys import stdin
cnt = n = int(stdin.readline())
for _ in range(n):
    v = int(stdin.readline())
    if v % 2 == 0:
        cnt -= 1
    else:
        for i in range(3, v//2, 2):
            if v % i == 0:
                cnt -= 1
                break
print(cnt)