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: Accepted

Solution code:
def check(n):
    if n == 1:
        return 0
    elif n == 2 or n == 3:
        return 1
    else:
        for i in range(2,int(n**(1/2))+1):
            if n % i == 0:
                return 0
        return 1
n = int(input())
s = [0 for i in range(n)]
count = 0
for i in range(n):
    s[i] = int(input())
    if check(s[i]) == 1:
        count += 1
print(count)

Submission status: Accepted

Solution code:
# Prime numbers
import math
import random
def miller_rabin_test(n, k=20):
    """n > 2????´???°???????????????"""
    if n == 2: return True
    li = []
    if n % 2 == 0:
        return False
    s = 0
    n1 = n - 1
    d = n1
    while d % 2 == 0:
        s += 1
        d //= 2
    for i in range(k):
        a = random.randint(1, n1)
        first = 1 != pow(a, d, n)
        li.clear()
        for r in range(0, s): # 0~s-1?????????
            result = pow(a, pow(2,r)*d, n)
            li.append(result)
        if first and li.count(n1) == 0:
            return False # ????????°
    return True
counter = 0
for _ in range(int(input())):
	if miller_rabin_test(int(input())): counter += 1
print(counter)

Submission status: Accepted

Solution code:
# O(n) algorithm
def isPrime_naive(x):
    if x <= 1:
        return False
    for i in xrange(2, x):
        if x % i == 0:
            return False
    return True

# Fast algorithm
def isPrime(x):
    if x == 2:
        return True
    if x < 2 or x % 2 == 0:
        return False
    i = 3
    while i*i <= x:
        if x % i == 0:
            return False
        i += 2
    return True

cnt = 0
N = int(raw_input())
for _ in range(N):
    x = int(raw_input())
    if isPrime(x):
       cnt += 1
print cnt

Submission status: Runtime Error

Solution code:

import numpy as np

##素数判定を行う関数
def prime(p):
    if p==2 or p==3:
        return True
    else:
        i = int(np.sqrt(p))
        while i>=2:
            if p%i==0:
                return False
                break
            i-=1
        return True
                
            

N = int(input())
count = 0

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
def main():
    n = int(input())
    primelist = []
    for _ in range(n):
        x = int(input())
        if isprime(x) == 1:
            primelist.append(x)
    print(len(primelist))

def isprime(x: int):    
    if x == 2:
        return 1
    elif x % 2 == 0:
        retrn 0
    else:        
        yesno = 1
        for y in range(3, x, 2):
            # 偶数は最初に除外するので、奇数で割れるかだけ見ていく
            if x % y == 0:
                yesno = 0
                break
    return yesno

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
count = 0
for _ in range(int(input())):
    n = int(input())
    count += 1 if mod(2, n-1, n) == 1 else 0
print(count)

Submission status: Runtime Error

Solution code:
count = 0
for _ in range(int(input())):
    n = int(input())
    count += 1 if (mod(2, n-1, n) == 1) else 0
print(count)

Submission status: Runtime Error

Solution code:
count = 0
for _ in range(int(input())):
    n = int(input())
    if mod(2,n-1,n) == 1:
        count += 1
print(count)

Submission status: Runtime Error

Solution code:
count = 0
for _ in range(int(input())):
    n = int(input())
    if mod(2,n-1,n) == 1:
        count += 1

Submission status: Runtime Error

Solution code:
def prime(x):
    if  x == 2:
        return True
    elif x < 2 or  x %2 == 0:
        return False
    i = 3
    while i <= x**(1/2):
        if x % i == 0:
            return false
        i = i + 2

    return true

L = []
while True:
    try:
        i = int(input())
        L.append(i)
    except EOFError:
        break
K = 0
for i in range(len(L)):
    if prime(L[i]):
        K += 1

print(K)

Submission status: Runtime Error

Solution code:
x = int(input())

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

Submission status: Runtime Error

Solution code:
x = int(input())

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import math
count = 0

for i =in range(10000):
    n = int(input())
    if i == 2:
        count += 1
    else:
        for j in range(3, 100000000, 2):
            k = math.sqrt(n)
            if j > k
                break
            if n % j == 0:
                count += 1
                break
    print(count)

Submission status: Runtime Error

Solution code:
import math
count = 0

for i =in range(10000):
    n = int(input())
    if i == 2:
        count += 1
    else:
        for j in range(3, 100000000, 2):
            k = math.sqrt(n)
            if j > k:
                break
            if n % j == 0:
                count += 1
                break
    print(count)

Submission status: Runtime Error

Solution code:
gfsdrg

Submission status: Runtime Error

Solution code:
import math
def isprime(n):
    m = int(math.sqrt(n)) + 1
    check = 1
    nums = [i for i in range(2, n)]
    while nums[0] <= m:
        p = nums[0]
        for j in range(1, int(n / p) + 1):
            nums.remove(p * j)
        if n not in nums:
            check = 0
            break
        else:
            pass
    return check
    
n = int(input())
ans = 0
for k in range(n):
    a = int(input())
    ans += isprime(a)
    
print(ans)

Submission status: Runtime Error

Solution code:
import math
def isprime(n):
    check = 1
    if n == 1:
        check = 0
    else:
        m = int(math.sqrt(n)) + 1
        nums = [i for i in range(2, n)]
        while nums[0] <= m:
            p = nums[0]
            for j in range(1, int(n / p) + 1):
                nums.remove(p * j)
            if n not in nums:
                check = 0
                break
            else:
                pass
    return check
    
n = int(input())
ans = 0
for k in range(n):
    a = int(input())
    ans += isprime(a)
    
print(ans)

Submission status: Runtime Error

Solution code:
def get_sieve_of_eratosthenes(x):
    data = [True] * (x + 1)
    data[0] = data[1] = False
    i = 2
    while i ** 2 <= x:
        if data[i]:
            for j in range(i + 1, x + 1):
                if j % i == 0:
                    data[j] = False
        i += 1
    return data


pn = get_sieve_of_eratosthenes(1000)
n = int(input())
cnt = 0
for i in range(n):
    a = int(input())
    if pn[a]:
        cnt += 1
print(cnt)

Submission status: Runtime Error

Solution code:
p=[1]*10001

i=2
while i*i<10000:
    if p[i]:
        j=i+i
        while j<10000:
            p[j]=0
            j+=i
    i+=1
count=0
for i in range(int(input())):
    if p[int(input())]==1:
        count+=1
        
print(count)

Submission status: Runtime Error

Solution code:
import math

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

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

Submission status: Runtime Error

Solution code:
def witness(a, n, t, u):
    x = pow(a, u, n)  # x0 = a^u mod nを計算
    y = x

    for _ in range(0, t):
        y = (x * x) % n

        # 法nの下での1の非自明な平方根が存在するのはnが合成数であるときに限る
        if y == 1 and x != 1 and x != (n - 1):
            return True
        x = y
    return y != 1

def is_probably_prime(n, witnesses):
    t = 1
    u = n >> 1
    while u & 1 == 0:
        t = t + 1
        u >>= 1
    assert(2**t * u == n - 1)

    for a in witnesses:
        if a < n and witness(a, n, t, u):
            return False
    return True

def is_definitely_prime(n):
    '''
    if ((not (n & 1)) and n != 2) or (n < 2) or ((n % 3 == 0) and (n != 3)):
        return False
    elif n <= 3:
        return True
    else:
    '''
    return is_probably_prime(n, [2, 7, 61])

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

Submission status: Runtime Error

Solution code:
import math

def prime(num):
  for i in range(math.sqrt(num)+1):
    if num%i==0:
      return False
  else:
    return True

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

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python
# coding: utf-8

def gcd ( ax, ay):
    x = ax
    y = ay
    while (True):
        if x < y :
            tmp = x
            x = y
            y = tmp
        x=x %y
        if x == 0:
            return y
        elif x == 1:
            return 1

def check_pn(num):
    count = 0
   for i in range(3, int(num/2+0.5)):
        if gcd(i, num) != 1:
            return False

    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)
#    print(data, ch)
    n += ch

print (n)

Submission status: Runtime Error

Solution code:
n = inta(input())
c = 0
for _ in range(n):
    data = int(input())
    for i in range(2,data):
        if(data%i == 0):
            c += 1
            break
print(c)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
:
c=input()
pc=0
for _ in range(c):
    n=input()
    for i in range(2, n):
        if n % i == 0:
            break
    else:
        pc+=1
print pc

Submission status: Runtime Error

Solution code:
def isprime_euclid2(N):
    if N<1:
        print 'N>2'
    elif N==2:
        return True
        
    import math
    def euclid(m,n):
        while m%n>0:
            r=m%n
            m,n=n,r
        else:
            return n
        
    euclid_list=[]
    for k in range(1,int(round(math.sqrt(N)))+1):
        euclid_list.append(euclid(N,k))
    temp=set(euclid_list)
    if len(temp)==1:
        return True
    else:
        return False     

while True:
    n = int(raw_input())
    total = 0
    for k in range(n):
        if isprime_euclid2(int(raw_input())):
            total +=1
    print total

Submission status: Runtime Error

Solution code:
def isprime_euclid2(N):
    if N<1:
        print 'N>2'
    elif N==2:
        return True
        
    
    def euclid(m,n):
        while m%n>0:
            r=m%n
            m,n=n,r
        else:
            return n
        
    euclid_list=[]
    for k in range(1,int(round(math.sqrt(N)))+1):
        euclid_list.append(euclid(N,k))
    temp=set(euclid_list)
    if len(temp)==1:
        return True
    else:
        return False  
           
import math
while True:
    n = int(raw_input())
    total = 0
    for k in range(n):
        if isprime_euclid2(int(raw_input())):
            total +=1
    print total

Submission status: Runtime Error

Solution code:
def euclid(m,n):
    while m%n>0:
        m,n=n,m%n
    else:
        return n

def isprime_euclid2(N):
    if N<1:
        print 'N>2'
    elif N==2:
        return True
        
    euclid_list=[]
    for k in range(1,int(round(math.sqrt(N)))+1):
        euclid_list.append(euclid(N,k))
    temp=set(euclid_list)
    if len(temp)==1:
        return True
    else:
        return False  
           
import math
while True:
    n = int(raw_input())
    total = 0
    for k in range(n):
        if isprime_euclid2(int(raw_input())):
            total +=1
    print total

Submission status: Runtime Error

Solution code:
import functools

number = int(input())
origin = [int(input()) for _ in range(number)]


def divise(n, divisor):
    if n == divisor:
        return n
    elif n % divisor == 0:
        return 0
    else:
        return n

divised = origin  # initialize

for i in range(2, max(origin)+1):
    divised = list(map(functools.partial(divise, divisor=i), divised))

for j in range(number):
    if divised[j] == 0:
        origin.pop(j)

print(len(origin))

Submission status: Runtime Error

Solution code:
import functools


def divise(n, divisor):
    if n == divisor:
        return n
    elif n % divisor == 0:
        return 0
    else:
        return n

number = int(input())
origin = [int(input()) for _ in range(number)]

divised = origin  # initialize

for i in range(2, max(origin)+1):
    divised = list(map(functools.partial(divise, divisor=i), divised))

for j in range(number):
    if divised[j] == 0:
        origin.pop(j)

print(len(origin))

Submission status: Runtime Error

Solution code:
import functools


def divise(n, divisor):
    if n == divisor:
        return n
    elif n % divisor == 0:
        return 0
    else:
        return n

number = int(input())
origin = [int(input()) for x in range(number)]

divised = origin  # initialize

for i in range(2, max(origin)+1):
    divised = list(map(functools.partial(divise, divisor=i), divised))

for j in range(number):
    if divised[j] == 0:
        origin.pop(j)

print(len(origin))

Submission status: Runtime Error

Solution code:
import functools


def divise(n, divisor):
    if n == divisor:
        return n
    elif n % divisor == 0:
        return 0
    else:
        return n

number = int(input())
origin = [int(input()) for x in range(number)]

divised = origin  # initialize

for i in range(2, max(origin)+1):
    divised = list(map(functools.partial(divise, divisor=i), divised))

for j in range(number):
    if divised[j] == 0:
        origin.pop(j)
    else:
        pass

print(len(origin))

Submission status: Runtime Error

Solution code:
import functools


def divise(n, divisor):
    if n == divisor:
        return n
    elif n % divisor == 0:
        return 0
    else:
        return n

number = int(input())
origin = [int(input()) for x in range(number)]

divised = origin

for i in range(2, max(origin)+1):
    divised = list(map(functools.partial(divise, divisor=i), divised))

for j in range(number):
    if divised[j] == 0:
        origin.pop(j)
    else:
        pass

print(len(origin))

Submission status: Runtime Error

Solution code:
from functools import partial


def divise(n, divisor):
    if n == divisor:
        return n
    elif n % divisor == 0:
        return 0
    else:
        return n

number = int(input())
origin = [int(input()) for x in range(number)]

divised = origin

for i in range(2, max(origin)+1):
    divised = list(map(functools.partial(divise, divisor=i), divised))

for j in range(number):
    if divised[j] == 0:
        origin.pop(j)
    else:
        pass

print(len(origin))

Submission status: Runtime Error

Solution code:
import functools


def divise(n, divisor):
    if n == divisor:
        return n
    elif n % divisor == 0:
        return 0
    else:
        return n

number = int(input())
origin = list(int(input()) for x in range(number))

divised = origin

for i in range(2, max(origin)+1):
    divised = list(map(functools.partial(divise, divisor=i), divised))

for j in range(number):
    if divised[j] == 0:
        origin.pop(j)
    else:
        pass

print(len(origin))

Submission status: Runtime Error

Solution code:
import functools


def divise(n, divisor):
    if n == divisor:
        return n
    elif (n % divisor) == 0:
        return 0
    else:
        return n

number = int(input())
origin = [int(input()) for x in range(number)]

divised = origin

for i in range(2, max(origin)+1):
    divised = list(map(functools.partial(divise, divisor=i), divised))

for j in range(number):
    if divised[j] == 0:
        origin.pop(j)

print(len(origin))

Submission status: Runtime Error

Solution code:
import functools


def divise(n, divisor):
    if n == divisor:
        return n
    elif (n % divisor) == 0:
        return 0
    else:
        return n

number = int(input())
origin = [int(input()) for i in range(number)]

divised = origin

for i in range(2, max(origin)+1):
    divised = list(map(functools.partial(divise, divisor=i), divised))

for j in range(number):
    if divised[j] == 0:
        origin.pop(j)

print(len(origin))

Submission status: Runtime Error

Solution code:
import functools


def divise(n, divisor):
    if n == divisor:
        return n
    elif (n % divisor) == 0:
        return 0
    else:
        return n

number = int(input())
origin = [int(input()) for _ in range(number)]

divised = origin

for i in range(2, max(origin)+1):
    divised = list(map(functools.partial(divise, divisor=i), divised))

for j in range(number):
    if divised[j] == 0:
        origin.pop(j)

print(len(origin))

Submission status: Runtime Error

Solution code:
import functools


def divise(n, divisor):
    if n == divisor:
        return n
    elif (n % divisor) == 0:
        return 0
    else:
        return n


number = int(input())
origin = [int(input()) for _ in range(number)]

divised = origin

for i in range(2, max(origin)+1):
    divised = list(map(functools.partial(divise, divisor=i), divised))

for j in range(number):
    if divised[j] == 0:
        origin.pop(j)

print(len(origin))

Submission status: Runtime Error

Solution code:
import functools


def divise(n, divisor):
    if n % divisor == 0 and n != divisor:
        return 0
    else:
        return n

number = int(input())
origin = [int(input()) for _ in range(number)]

divised = origin

for i in range(2, max(origin)+1):
    divised = list(map(functools.partial(divise, divisor=i), divised))

for j in range(number):
    if divised[j] == 0:
        origin.pop(j)

print(len(origin))

Submission status: Runtime Error

Solution code:
import functools
def divise(n, divisor):
    if n % divisor == 0 and n != divisor:
        return 0
    else:
        return n

if __name__ == '__main__':
    number = input()
#    origin = [int(input()) for _ in range(number)]
    origin = []
    for i in range(number):
        origin.append(input())

    divised = origin

    for i in range(2, max(origin)+1):
        divised = list(map(functools.partial(divise, divisor=i), divised))

    for j in range(number):
        if divised[j] == 0:
            origin.pop(j)

    print(len(origin))

Submission status: Runtime Error

Solution code:
#!/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 filter(lambda x: is_prime[x], range(max + 1))

primes = set(sieve_of_eratosthenes(10000))

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

Submission status: Runtime Error

Solution code:
def judgePrime(n):
  result = True
  for i in xrange(2, n):
    if n % i == 0:
      result = False
      break
  return result

def getPrimeNumFromList(list):
  count = 0
  for i in xrange(len(list)):
    target = 0
    if i == 0:
      target = list[0]
      if judgePrime(target):
        count += 1
    else:

  return count

n = int(raw_input())
list = []
for i in xrange(n):
  list.append(int(raw_input()))
list.sort()
#print judgePrime(list[len(list) - 1])
print getPrimeNumFromList(list)

Submission status: Runtime Error

Solution code:
def judgePrime(n):
  result = True
  for i in xrange(2, n):
    if n % i == 0:
      result = False
      break
  return result

def getPrimeNumFromList(list):
  count = 0
  for i in xrange(len(list)):
    target = 0
    if i == 0:
      target = list[0]
      if judgePrime(target):
        count += 1
    else:

  return count

n = int(raw_input())
list = []
for i in xrange(n):
  list.append(int(raw_input()))
list.sort()
print judgePrime(list[len(list) - 1])
# print getPrimeNumFromList(list)

Submission status: Runtime Error

Solution code:
import pdb

def judgePrime(n):
  result = True
  i = 2
  while i < int(round(n)):
    if n % i == 0:
      result = False
      break
    i += 1
  return [result, i]

def getPrimeNumFromList(list):
  count = 0
  for i in xrange(len(list)):
    target = 0
    if i == 0:
      target = list[0]
      if judgePrime(target):
        count += 1
      else:
        pass

  return count

n = int(raw_input())
list = []

for i in xrange(n):
  list.append(int(raw_input()))
list.sort()

prime_list = []

while True:
  v = list.pop(0)
  result = judgePrime(v)
  if result[0]:
    # pdb.set_trace()
    prime_list.append(v)
  else:
    v = result[1]
  # print "list : "
  # print list
  # print "prime_list : "
  # print prime_list
  i = 0
  while True:
    # print "i = " + str(i)
    if i >= len(list):
      break
    elif list[i] % v == 0:
      list.pop(i)
      # print "i = " + str(i) + ", list: "
      # print list
    else:
      i += 1
  if len(list) == 0:
    break
  elif prime_list[len(prime_list) - 1] ^ 2 >= list[len(list) - 1]:
    prime_list.append(list)
    break

print len(prime_list)

Submission status: Runtime Error

Solution code:
import sys

num_list = []

for line in sys.stdin.readlines():
    num_list.append(int(line.strip()))

num_list.remove(num_list[0])

count = 0

for num in num_list:
    if num != 1:
        for i in range(2, num-1)
            if num % i == 0:
                continue
    count += 1

print count

Submission status: Runtime Error

Solution code:
import sys

count = 0
judge = 0

for line in sys.stdin.readlines():
    num = int(line.strip())
    if judge == 0:
        judge = 1
    else:    
        flag = 0
        for i in range(2, sqrt(num) + 1):
            if num % i == 0:
                flag = 1
                break
        if flag == 0:
            count += 1

print count

Submission status: Runtime Error

Solution code:
import sys
import math

count = 0
judge = 0

for line in sys.stdin.readlines():
    num = int(line.strip())
    if judge == 0:
        judge = 1
    else:    
        flag = 0
        for i in range(2, math.sqrt(num) + 1):
            if num % i == 0:
                flag = 1
                break
        if flag == 0:
            count += 1

print count

Submission status: Runtime Error

Solution code:
import sys
import math

x_list = []

for line in sys.stdin.readlines()
  x_list.append(int(line.strip()))

count = 0

num_list.remove(x_list[0])

for i in x_list:
  flag = 0
  for j in range(2, math.sqrt(i)+1):
    if i % j == 0:
      flag = 1
      break
    if flag == 0:
      count ++

print count

Submission status: Runtime Error

Solution code:
import sys
import math

x_list = []

for line in sys.stdin.readlines():
  x_list.append(int(line.strip()))

count = 0

num_list.remove(x_list[0])

for i in x_list:
  flag = 0
  for j in range(2, math.sqrt(i)+1):
    if i % j == 0:
      flag = 1
      break
    if flag == 0:
      count ++

print count

Submission status: Runtime Error

Solution code:
import sys
import math

x_list = []

for line in sys.stdin.readlines():
  x_list.append(int(line.strip()))

count = 0

num_list.remove(x_list[0])

for i in x_list:
  flag = 0
  for j in range(2, math.sqrt(i)+1):
    if i % j == 0:
      flag = 1
      break
    if flag == 0:
      count += 1

print count

Submission status: Runtime Error

Solution code:
import sys
import math

x_list = []

for line in sys.stdin.readlines():
  x_list.append(int(line.strip()))

count = 0

x_list.remove(x_list[0])

for i in x_list:
  flag = 0
  for j in range(2, math.sqrt(i)+1):
    if i % j == 0:
      flag = 1
      break
    if flag == 0:
      count ++

print count

Submission status: Runtime Error

Solution code:
import sys
import math

x_list = []

for line in sys.stdin.readlines():
  x_list.append(int(line.strip()))

count = 0

x_list.remove(x_list[0])

for i in x_list:
  flag = 0
  for j in range(2, math.sqrt(i)+1):
    if i % j == 0:
      flag = 1
      break
    if flag == 0:
      count += 1

print count

Submission status: Runtime Error

Solution code:
import sys
import math

x_list = []

for line in sys.stdin.readlines():
  x_list.append(int(line.strip()))

count = 0

x_list.remove(x_list[0])

for i in x_list:
  flag = 0
  for j in range(2, int(math.sqrt(i)+1)):
    if i % j == 0:
      flag = 1
      break
    if flag == 0:
      count ++

print count

Submission status: Runtime Error

Solution code:
numbers = []
n = raw_input()
for i in range(int(n)):
    input_num = raw_input()
    numbers.append(int(input_num))
count = 0
for num in numbers:
    if num == 2:
        count += 1
    for i in range(2, int(math.sqrt(num)) + 1):
        if num % i == 0:
            break
        count += 1
print count

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import math


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


def main():
    n = int(input())
    ms = (int(input()) for i in range(n))
    print(len(list(filter(isprime, ms))))

if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
N = input()
prime = 0
checked = 2
primeList = [2]

def is_prime(n):
    global checked
    if n <= checked:
        if n in primeList:
            return True
        else:
            return False
    else:#?´???°????????????n?????§????´???°????????????????????????
        for i in xrange(checked+1, n+1):
            isPrime = True
            for p in primeList:
                if i%p == 0:
                    #print "{}%{} == 0".format(i,p)
                    isPrime = False
                    break
            for p in xrange(checked+1, i):
                if i%p == 0:
                    #print "{}%{} == 0".format(i,p)
                    isPrime = False
                    break
            if isPrime:
                primeList.append(i)
        checked = n
        if primeList[-1] == n:
            return True
        else:
            return False
        

for _ in xrange(N):
    n = input()
    prime += 1 if is_prime(n) else 0
print prime

Submission status: Runtime Error

Solution code:
n = list(map(int,input().split()))

def Is_prime(n):
    if n % 2 == 0:
        return False
    i = 3
    while i < int(n ** (0.5))+ 1:
        if n % i == 0:
            return False
    return True

count = 1
for j in range(0,len(n)):
    if Is_prime(n[i]):
        count += 1

print (count)

Submission status: Runtime Error

Solution code:
n = list(map(int,input().split())

def Is_prime(n):
    if n % 2 == 0:
        return False
    i = 3
    while i < int(n ** (0.5))+ 1:
        if n % i == 0:
            return False
    return True

count = 0
for j in n:
    if Is_prime(j):
        count += 1

print (count)

Submission status: Runtime Error

Solution code:
N = input()
n = [input() for i in range(N)]

def Is_prime(n):
    if n % 2 == 0:
        return False
    i = 3
    while i < int(n ** (0.5))+ 1:
        if n % i == 0:
            return False
    return True

count = 0
for j in n:
    if Is_prime(j):
        count += 1

print (count)

Submission status: Runtime Error

Solution code:
# -*- coding:utf-8 -*-

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

def Is_prime(n):
    if n % 2 == 0:
        return False
    i = 3
    while i < int(n ** (0.5))+ 1:
        if n % i == 0:
            return False
    return True

count = 0
for j in n:
    if Is_prime(j):
        count += 1

print (count)

Submission status: Runtime Error

Solution code:
cond = map(raw_input().split())
a = cond[0]
b = cond[1]

print "(a*b) (a*2 + b*2)"

Submission status: Runtime Error

Solution code:
prime = [0] * 10001;prime[0] = 1;prime[1] = 1;Count=0
for i in range(int(10001**.5)):
 if prime[i]:continue
 for j in range(i*i,10001,i):prime[j]=1

for _ in range(int(input())):
 if not(prime[int(input())]):Count+=1
print(Count)

Submission status: Runtime Error

Solution code:
a=map(int,raw_input().split())
a.sort()
b=0
while a!=[]:
 b+=1
 a=[i for i in a if a[i]%a[0]==0]
print(b)

Submission status: Runtime Error

Solution code:
a=map(int,raw_input().split())
a.sort()
b=0
while a!=[]:
 b+=1
 a=[i for i in a if a[i]%a[0]!=0]
print(b)

Submission status: Runtime Error

Solution code:
a=map(int,raw_input().split())
a.sort()
b=0
for i in a:
 t=True
 for I in range(2,int(a**0.5)+1):
  if i%I==0: 
   t=False
   break
 if t:
  b+=1
print(b)

Submission status: Runtime Error

Solution code:
a=map(int,raw_input().split())
a.sort()
b=0
for i in a:
 t=True
 for I in range(2,int(a**0.5)+1):
  if i%I==0: 
   t=False
 if t:
  b+=1
print(b)

Submission status: Runtime Error

Solution code:
a=list(set(a))
b=0
for i in a:
    t=True
    for I in range(2,int(i**0.5)+1):
        if i%I==0: t=False
    if t: 
        b+=1
print(b)

Submission status: Runtime Error

Solution code:
a=map(int,raw_input().split())
a=list(set(a))
b=0
for i in a:
    t=True
    for I in range(2,int(i**0.5)+1):
        if i%I==0:
            t=False
    if t: 
        b+=1
print b

Submission status: Runtime Error

Solution code:
from operator import itemgetter

def eratosthenes(n):
    table = [True] * (n + 1)
    table[0] = table[1] = True
    for i in range(2, int(round(pow(n, 0.5)))):
        if not table[i]:
            continue
        for j in range(i + i, n, i):
            table[j] = False
    return table

if __name__ == "__main__":
    N = int(input())
    f = itemgetter(*[int(input()) for _ in range(N)])
    print(sum(f(eratosthenes(10000))))