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: Runtime Error

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(num[i])!=0:
		cont += 1
print(cont)

Submission status: Runtime Error

Solution code:
import numpy as np
import math
n=int(input())
A=np.empty((n))
B=np.zeros((n))
count=0


for i in range(n):
    A[i]=int(input())
for i in range(n):
    for j in range(2,int(math.sqrt(A[i])+1)):
        if A[i]%j==0:
            B[i]=1 ##素数でないなら1を入力
        break


for i in range(n):
    if B[i]==0:
        count=count+1

print(count)

Submission status: Runtime Error

Solution code:
##Prime Numbers
##16D8101008G Kojima Masayoshi 小嶋真義　2018.4.18

import numpy as np
import math
n=int(input())
A=np.empty((n))
B=np.zeros((n))
count=0

##print(B)検査

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


for i in range(n):
    if A[i]==1:
        B[i]=1
    elif A[i]==2:
        B[i]==1
    elif A[i]%2==0:
        B[i]=1
    else:
        for j in range(2,int(math.sqrt(A[i]))):
            if A[i]%j==0:
                B[i]=1 ##素数でないなら1を入力
                break

##print(B)

for i in range(n):
    if B[i]==0:
        count=count+1

print(count)

Submission status: Runtime Error

Solution code:
##Prime Numbers
##16D8101008G Kojima Masayoshi 小嶋真義　2018.4.18

import numpy as np
import math
n=int(input())
A=np.empty((n))
B=np.zeros((n))
count=0

##print(B)検査

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


for i in range(n):
    if A[i]==1:
        B[i]=1
    elif A[i]==2:
        B[i]=0
    elif A[i]==5:
        B[i]=0
    elif A[i]%2==0 :
        B[i]=1
    elif A[i]%5==0:
        B[i]=1
    else:
        for j in range(2,int(math.sqrt(A[i]))):
            if A[i]%j==0:
                B[i]=1 ##素数でないなら1を入力
                break

##print(B)

for i in range(n):
    if B[i]==0:
        count=count+1

print(count)

Submission status: Runtime Error

Solution code:

##Prime Numbers
##16D8101008G Kojima Masayoshi 小嶋真義　2018.4.18

import numpy as np
import math
n=int(input())
A=np.empty((n))
B=np.zeros((n))
count=0

##print(B)検査

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


for i in range(n):
    if A[i]==1:
        B[i]=1
    elif A[i]==2:
        B[i]=0
    elif A[i]==5:
        B[i]=0
    elif A[i]%2==0 :
        B[i]=1
    elif A[i]%5==0:
        B[i]=1
    else:
        for j in range(2,int(math.sqrt(A[i]))):
            if A[i]%j==0:
                B[i]=1 ##素数でないなら1を入力
                break

##print(B)

for i in range(n):
    if B[i]==0:
        count=count+1

print(count)

Submission status: Runtime Error

Solution code:
##Prime Numbers
##16D8101008G Kojima Masayoshi 小嶋真義　2018.4.18

import numpy as np
import math
n=int(input())
A=np.empty((n))
B=np.zeros((n))
count=0

##print(B)検査

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


for i in range(n):
    if A[i]==1:
        B[i]=1
    elif A[i]==2:
        B[i]=0
    elif A[i]==3:
        B[i]=0
    elif A[i]==5:
        B[i]=0
    elif A[i]%2==0 :
        B[i]=1
    elif A[i]%3==0:
        B[i]=1
    elif A[i]%5==0:
        B[i]=1
    else:
        for j in range(2,int(math.sqrt(A[i]))):
            if A[i]%j==0:
                B[i]=1 ##素数でないなら1を入力
                break

##print(B)

for i in range(n):
    if B[i]==0:
        count=count+1

print(count)

Submission status: Runtime Error

Solution code:

import numpy as np
import math
n=int(input())
A=np.empty((n))
B=np.zeros((n))
count=0

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


for i in range(n):
    if A[i]==1:
        B[i]=1
    elif A[i]==2:
        B[i]=0
    elif A[i]==3:
        B[i]=0
    elif A[i]==5:
        B[i]=0
    elif A[i]%2==0 :
        B[i]=1
    elif A[i]%3==0:
        B[i]=1
    elif A[i]%5==0:
        B[i]=1
    else:
        for j in range(2,int(math.sqrt(A[i]))):
            if A[i]%j==0:
                B[i]=1 
                break



for i in range(n):
    if B[i]==0:
        count=count+1

print(count)

Submission status: Runtime Error

Solution code:
import numpy as np
import math
n=int(input())
A=np.empty((n))
B=np.zeros((n))
count=0

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


for i in range(n):
    if A[i]==1:
        B[i]=1
    elif A[i]==2:
        B[i]=0
    elif A[i]==3:
        B[i]=0
    elif A[i]==5:
        B[i]=0
    elif A[i]%2==0 :
        B[i]=1
    elif A[i]%3==0:
        B[i]=1
    elif A[i]%5==0:
        B[i]=1
    else:
        for j in range(2,int(math.sqrt(A[i]))):
            if A[i]%j==0:
                B[i]=1 
                break



for i in range(n):
    if B[i]==0:
        count=count+1

print(count)

Submission status: Runtime Error

Solution code:
import numpy as np
import math
n=int(input())
A=np.empty((n))
B=np.zeros((n))
count=0

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


for i in range(n):
    if A[i]==1:
        B[i]=1
    elif A[i]==2:
        B[i]=0
    elif A[i]==3:
        B[i]=0
    elif A[i]==5:
        B[i]=0
    elif A[i]%2==0 :
        B[i]=1
    elif A[i]%3==0:
        B[i]=1
    elif A[i]%5==0:
        B[i]=1
    else:
        for j in range(2,int(math.sqrt(A[i]))):
            if A[i]%j==0:
                B[i]=1 
                break



for i in range(n):
    if B[i]==0:
        count=count+1

print(count)

Submission status: Runtime Error

Solution code:
import numpy as np
import math
n=input()
A=np.zeros((n))
B=np.zeros((n))
count=0

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


for i in range(n):
    if A[i]==1:
        B[i]=1
    elif A[i]==2:
        B[i]=0
    elif A[i]==3:
        B[i]=0
    elif A[i]==5:
        B[i]=0
    elif A[i]%2==0 :
        B[i]=1
    elif A[i]%3==0:
        B[i]=1
    elif A[i]%5==0:
        B[i]=1
    else:
        for j in range(2,int(math.sqrt(A[i]))):
            if A[i]%j==0:
                B[i]=1 
                break



for i in range(n):
    if B[i]==0:
        count=count+1

print(count)

Submission status: Runtime Error

Solution code:
##Prime Numbers
##16D8101008G Kojima Masayoshi 小嶋真義　2018.4.18

import numpy as np
import math

n=int(input())

A=np.empty((n))
B=np.zeros((n))

count=0

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


for i in range(n):
    if A[i]==1:
        B[i]=1
    elif A[i]==2:
        B[i]=0
    elif A[i]%2==0 :
        B[i]=1
    else:
        for j in range(2,int(math.sqrt(A[i]))):
            if A[i]%j==0:
                B[i]=1 
                break



for i in range(n):
    if B[i]==0:
        count=count+1

print(count)

Submission status: Runtime Error

Solution code:


import numpy as np
import math

n=int(input())

A=np.empty((n))
B=np.zeros((n))

count=0

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


for i in range(n):
    if A[i]==1:
        B[i]=1
    elif A[i]!=2 and A[i]%2==0:
        B[i]=1
    else:
        for j in range(2,int(math.sqrt(A[i]))):
            if A[i]%j==0:
                B[i]=1 




for i in range(n):
    print(i,":",count)
    if B[i]==0:
        count=count+1

Submission status: Runtime Error

Solution code:
import numpy as np
import math

n=int(input())

A=np.empty((n))
B=np.zeros((n))

count=0

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


for i in range(n):
    if A[i]==1:
        B[i]=1
    elif A[i]!=2 and A[i]%2==0:
        B[i]=1
    else:
        for j in range(2,int(math.sqrt(A[i]))):
            if A[i]%j==0:
                B[i]=1 




for i in range(n):
    print(i,":",count)
    if B[i]==0:
        count=count+1

Submission status: Runtime Error

Solution code:

import numpy as np
import math

n=int(input())

A=np.empty((n))
B=np.zeros((n))

count=0

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

##print(A)


for i in range(n):
    if A[i]==1:
        B[i]=1
        ##print("ifの1")
    elif A[i]!=2 and A[i]%2==0:
        B[i]=1
        ##print("ifの2")
    else:
        for j in range(2,int(math.sqrt(A[i]))+1):
           ##print("j",j)
            if A[i]%j==0:
                B[i]=1
                break
        ##print("ifの3")
                


for i in range(n):
    if B[i]==0:
        count=count+1



print(count)

Submission status: Runtime Error

Solution code:
import numpy as np
import math

n=int(input())

A=np.empty((10000))
B=np.zeros((10000))

count=0

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

##print(A)


for i in range(n):
    if A[i]==1:
        B[i]=1
        ##print("ifの1")
    elif A[i]!=2 and A[i]%2==0:
        B[i]=1
        ##print("ifの2")
    else:
        for j in range(2,int(math.sqrt(A[i]))+1):
           ##print("j",j)
            if A[i]%j==0:
                B[i]=1
                break
        ##print("ifの3")
                


for i in range(n):
    if B[i]==0:
        count=count+1



print(count)

Submission status: Runtime Error

Solution code:
n=int(input())
a[n]={0}
for i in range(1,n):
    a[i]=int(input())

Submission status: Runtime Error

Solution code:
n=int(input())
for i in range(1,n):
    a[i]=int(input())

Submission status: Runtime Error

Solution code:
n=int(input())
a=[]
for i in range(1,n):
    a[i]=int(input())

Submission status: Runtime Error

Solution code:
n=int(input())
a=[]
for i in range(1,n-1):
    a[i]=int(input())

Submission status: Runtime Error

Solution code:

import math

a=int(input())

sum=0

for i in range(n):
	ok=0
	n=int(input())
	if n==2 or n==3:
		sum+=1
	if n>3:
		for j in range(2,int(math.sqrt(n))+1):
			
			if n%j==0:
				ok=1
		if ok==1:
			sum+=1
			
print(sum)

Submission status: Runtime Error

Solution code:

import math

a=int(input())

sum=0
ok=0

for i in range(n):
	ok=0
	n=int(input())
	if n==2 or n==3:
		sum+=1
	if n>3:
		for j in range(2,int(math.sqrt(n))+1):
			
			if n%j==0:
				ok=1
		if ok==1:
			sum+=1
			
print(sum)

Submission status: Runtime Error

Solution code:

import math

a=int(input())

sum=0

for i in range(n):
	b=1
	n=int(input())
	        for j in range(2,int(math.sqrt(n))+1):
			if n%j==0:
				b=0
				break
		sum+=b
			
print(sum)

Submission status: Runtime Error

Solution code:
import math

def is_prime(n):
	for i in range(2,math.floor(math.sqrt(n))+1):
		if n!=2 or n%2==0:
			return False
		elif 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)

Submission status: Runtime Error

Solution code:
def sosu(int x):
	for i in range(2,x):
		if x%i=0:
			c++
	if c=0:
		return true:
	else:
		return false:

cnt=0
n=input(int())
for i in range(n):
	m[i]=input(int())
	if sosu(m[i]):
		cnt++
print(cnt)

Submission status: Runtime Error

Solution code:
def sosu(int x):
	for i in range(2,x):
		if x%i=0:
			c++
	if c=0:
		return true:
	else:
		return false:
cnt=0
n=input(int())
for i in range(n):
	m[i]=input(int())
	if sosu(m[i]):
		cnt++
print(cnt)

Submission status: Runtime Error

Solution code:
def sosu(x):
	for i in range(2,x):
		if x%i==0:
			c=c+1
	if c==0:
		return true
	else:
		return false
cnt=0
m=[]
n=input(int())
for i in range(n):
	m[i]=input(int())
	if sosu(m[i]):
		cnt=cnt+1
print(cnt)

Submission status: Runtime Error

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.ceil(math.sqrt(x))
    for i in range(3, sqrt_upper_bound, 2):
        if num % 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(prime_num)

Submission status: Runtime Error

Solution code:
N=int(input())
A=np.empty(N)
for i in range(N):
    A[i]=int(input())
cnt=0
for i in range(N):
    if A[i]%2==0 and A[i]!=2:
        continue
    x=int(np.sqrt(i))+1
    for j in range(2,x):
        if A[i]%j==0:
            break
    cnt=cnt+1
print(cnt)

Submission status: Runtime Error

Solution code:


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

        if num % i == 0:
            return True

    return False



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

Submission status: Runtime Error

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 num in int(input()):
    if divisor(num):
        cnt = cnt+1

print(cnt)

Submission status: Runtime Error

Solution code:

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

        for j in range(2, num/2):
            if num % j == 0:
                return False

        break

    return True



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

print(cnt)

Submission status: Runtime Error

Solution code:
def eratos(n):
	is_prime = [True for i in range(n+1)]
	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)
n = int(input())
ans = 0
for _ in range(n):
    x = int(input())
    if is_prime[x] is True:
        ans += 1

print(ans)

Submission status: Runtime Error

Solution code:
import math


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


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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
def composite(d,n,s): for a in (2,3,5,7): p = False if pow(a,d,n) == 1: continue for i in range(s): if pow(a, 2**i * d, n) == n-1: p = True break if not p: return True return False 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 not composite(d,n,s) r = [] n = int(input()) for i in range(n): n = int(input()) if is_prime(n): r.append(n) print(len(r))

Submission status: Runtime Error

Solution code:
def isPrime(n):
    if n == 1:
        return False
    elif n == 2 or n == 3:
        return True
    else:
        for i in range(2, n//2+1):
            if n % i == 0
                return False
        return True


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

Submission status: Runtime Error

Solution code:
class PrimeChecker:

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

    def isPrime(self, n):
        if n in self.primes:
            return True
        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,n) and 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: Runtime Error

Solution code:
f = lambda x: 1 if (not x < 2 and not x&1 == 0) and (x == 2 or x == 3 or pow(2,x-1,x) == 1) else 0
print(count += f(int(input())) for _ in range(int(input())))

Submission status: Runtime Error

Solution code:
import math
main()

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

def main():
    N = input()
    n = [input() for x in range(N)]
    c = 0

    for i in range(N):
        if prime(n[i]):
            c += 1

    print(c)

Submission status: Runtime Error

Solution code:
def get_primes(n):
    x = [0,0]+[i for i in range(2,n+1)]
    for i in range(int(n**0.5+1)):
        if x[i] !=0:
            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):
    p = int(input())
    f = 1
    for e in PRIMES:
        if e >= p:
            break
        if p % e == 0:
            f = 0
            break
    c += f
print c

Submission status: Runtime Error

Solution code:
def get_primes(n):
    x = [0,0]+[i for i in range(2,n+1)]
    for i in range(int(n**0.5+1)):
        e = x[]
        if e !=0:
            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):
    p = int(input())
    f = 1
    for e in PRIMES:
        if e >= p:
            break
        if p % e == 0:
            f = 0
            break
    c += f
print c

Submission status: Runtime Error

Solution code:
def get_primes(n):
    x = [0,0]+[i for i in range(2,n+1)]
    for i in range(int(n**0.5+1)):
        e = x[i]
        if e !=0:
            for j in range(e*2, n+1,e):
                x[j] = 0
    return x

PRIMES = get_primes(100000000)
n = int(input())
c = 0
for i in range(n):
    p = int(input())
    if x[p] == 0:
        c += 1
print c

Submission status: Runtime Error

Solution code:
import sys

count =0

for line in sys.stdin:
    a=int(line.strip())
    count =count + checkprime(a)

print count

def checkprime(a):
    for t in range (a-1):
        s=t+1
        if a%s==0:
            return 0
    return 1

Submission status: Runtime Error

Solution code:
n = gets.to_i
m = []
p_num = 0

n.times{
  m += [gets.to_i]
}

for x in m
  flag = 0
  for y in 2..(x**0.5)+1
    if x % y == 0
      flag = 1
      break
    end
  end
  if flag == 0
    p_num += 1
  end
end

puts "", p_num

Submission status: Runtime Error

Solution code:
n = input()
count = 0
for i in xrange(n):
    x = input()
    if x == 2: count += 1
    elif x % 2 != 0:
        for j in xrange(3,x*0.5+1,2):
            if x % j == 0: break
        else: count += 1
print count

Submission status: Runtime Error

Solution code:
n = input()
count = 0
for i in xrange(n):
    x = input()
    if x == 2: count += 1
    elif x == 3: count += 1
    elif x % 2 != 0:
        for j in xrange(3,x*0.5+1,2):
            if x % j == 0: break
        else: count += 1
print count

Submission status: Runtime Error

Solution code:
import math

n = int(raw_input())
a = []
for i in range(n):
    a.append(int(raw_input))

r = max(a)+1
sqrt = math.sqrt(r)
p = [1]*r
p[0] = 0
for i in range(1,sqrt):
    if p[i]:
        p[2*i+1,r,i+1] = [0 for i in range(2*i+1,r,i+1)]

count = 0
for i in a:
    count += p[i-1]
    
print count

Submission status: Runtime Error

Solution code:
import math

r = 100000000
sqrt = math.sqrt(r)
p = [1 for i in range(r)]
p[0] = 0
for i in range(1,sqrt):
    if p[i]:
        p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)]

count = 0
while True:
    try:
        n = int(raw_input())
        if p[n-1]:
            count += 1
print count

Submission status: Runtime Error

Solution code:
import math

r = 100000000
sqrt = math.sqrt(r)
p = [1 for i in range(r)]
p[0] = 0
for i in range(1,sqrt):
    if p[i]:
        p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)]

count = 0
while True:
    try:
        n = int(raw_input())
        if p[n-1]:
            count += 1
    except:
        break
print count

Submission status: Runtime Error

Solution code:
import math

r = 10000000
sqrt = int(math.sqrt(r))
p = [1 for i in range(r)]
p[0] = 0
for i in range(1,sqrt):
    if p[i]:
        p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)]

count = 0
n = int(raw_input())
for i in range(n):
    m = int(raw_input())
    if p[m-1]:
        count += 1
    except:
        break
print count

Submission status: Runtime Error

Solution code:
import math

r = 50000000
sqrt = int(math.sqrt(r))
p = [1 for i in range(r)]
p[0] = 0
for i in range(1,sqrt):
    if p[i]:
        p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)]

count = 0
n = int(raw_input())
for i in range(n):
    m = int(raw_input())
    if p[m-1]:
        count += 1
    except:
        break
print count

Submission status: Runtime Error

Solution code:
import math

n = int(raw_input())
a = []
for i in range(n):
    a.append(int(raw_input()))

r = max(a)
sqrt = int(math.sqrt(r))
p = [1 for i in range(r)]
p[0] = 0
for i in range(1,sqrt):
    if p[i]:
        p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)]

count = 0
for i in a:
    if p[i-1]:
        count += 1
print count

Submission status: Runtime Error

Solution code:
import math
r = max(n)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
for i in range(1,sqrt):
    if p[i]:
        p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)]
  
n = int(raw_input())
for i in range(n):
    print sum(p[:n])

Submission status: Runtime Error

Solution code:
import math
r = 10000001
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
for i in range(1,sqrt):
    if p[i]:
        p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)]
   
n = int(raw_input())
ans = 0
for i in range(n):
    m = int(raw_input())
    ans += p[m-1]
print ans

Submission status: Runtime Error

Solution code:
import math
n = int(raw_input())
ls = [int(raw_inpu() for i in range(n)]
r = max(ls)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
for i in range(1,sqrt):
    if p[i]:
        p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)]
   
ans = 0
for i in ls:
    ans += p[i-1]
print ans

Submission status: Runtime Error

Solution code:
import math
n = int(raw_input())
ls = [int(raw_input() for i in range(n)]
r = max(ls)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
for i in range(1,sqrt):
    if p[i]:
        p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)]
   
ans = 0
for i in ls:
    ans += p[i-1]
print ans

Submission status: WA: Presentation Error

Solution code:
import math

def is_prime(n):
	for i 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="")