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:
import math

num = raw_input()
num_list = []
for i in range(int(num)):
    a = raw_input()
    num_list.append(int(a))
count = 0

for num in num_list:
    #n = 10000
    if num == 0 or num == 1:
        continue
    elif num == 2:
        count += 1
    elif num % 2 == 0:
        continue
    else:
        count += 1
        #print int(math.log(num,2))
        for i in range(3, int(math.log(num,2)), 2):
            print i
            if num % i == 0:
                count -= 1
                break

print count

Submission status: Wrong Answer

Solution code:
import math

num = raw_input()
num_list = []
for i in range(int(num)):
    a = raw_input()
    num_list.append(int(a))
count = 0

for num in num_list:
    #n = 10000
    if num == 0 or num == 1:
        continue
    elif num == 2:
        count += 1
    elif num % 2 == 0:
        continue
    else:
        count += 1
        #print int(math.log(num,2))
        for i in range(3, int(math.log(num,2)), 2):
            #print i
            if num % i == 0:
                count -= 1
                break

print count

Submission status: Wrong Answer

Solution code:
import sys

lines = sys.stdin.readlines()

n = lines[0]
lst = map(lambda x:int(x), lines[1:])

c = 0
for v in lst:
    c2 = 0
    for j in range(2,v):
        if v%float(j) == 0:
            break        
        c += 1



print c

Submission status: Wrong Answer

Solution code:
import sys

lines = sys.stdin.readlines()

n = lines[0]
lst = map(lambda x:int(x), lines[1:])

c = 0
for v in lst:
    c2 = 0
    for j in range(2,v):
        if v%float(j) == 0:
            break
        c += 1



print c

Submission status: Wrong Answer

Solution code:
import math

num = raw_input()
num_list = []
for i in range(int(num)):
    a = raw_input()
    num_list.append(int(a))
count = 0

for num in num_list:
    if num == 0 or num == 1:
        continue
    elif num == 2:
        count += 1
    elif num % 2 == 0:
        continue
    else:
        count += 1
        for i in range(3, int(math.log(num,2))+1, 2):
            if num % i == 0:
                count -= 1
                break
print count

Submission status: Wrong Answer

Solution code:
import math

num = raw_input()
num_list = []
for i in range(int(num)):
    a = raw_input()
    num_list.append(int(a))
count = 0

for num in num_list:
    if num <= 1:
        continue
    elif num == 2:
        count += 1
    elif num % 2 == 0:
        continue
    else:
        count += 1
        for i in range(3, int(math.log(num,2))+1, 2):
            if num % i == 0:
                count -= 1
                break
print count

Submission status: Wrong Answer

Solution code:
import math
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: Wrong Answer

Solution code:
import math

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: Wrong Answer

Solution code:
N = int(input())
ns = [int(input()) for _ in range(N)]

#primes = set()
#def is_prime(n):
#  if n in primes:
#    return True
#
#  for m in range(2, n):
#    if is_prime(m) and n % m == 0:
#      return False
#
#  primes.add(n)
#  return True

# Proof:
# if n <= d ^ 2 and n mod d = 0;
# n = ad (a in N)
# ad <= d ^ 2
# a <= d
# QED

def is_prime(n):
  if n < 2: return False
  if n == 2: return True
  if n % 2: return False

  d = 3
  while d ** 2 < n:
    if n % d == 0:
      return False
    d += 2
  return True

print(len([n for n in ns if is_prime(n)]))

Submission status: Wrong Answer

Solution code:
N = int(input())
ns = [int(input()) for _ in range(N)]

#primes = set()
#def is_prime(n):
#  if n in primes:
#    return True
#
#  for m in range(2, n):
#    if is_prime(m) and n % m == 0:
#      return False
#
#  primes.add(n)
#  return True

# Proof:
# if n < d ^ 2 and n mod d = 0;
# n = ad (a in N)
# ad < d ^ 2
# a < d
# QED

def is_prime(n):
  if n < 2: return False
  if n == 2: return True
  if n % 2: return False

  d = 3
  while d ** 2 <= n:
    if n % d == 0:
      return False
    d += 2
  return True

print(len([n for n in ns if is_prime(n)]))

Submission status: Wrong Answer

Solution code:
import math
def prime_array(n=1000):
	List = [2]
	i = 3
	while i <= n:
		judge = True
		for k in List :
			if math.sqrt(i) > i :
				break
			if i%k == 0:
				judge = False
				break
		if judge :
			List.append(i)
		i += 2
	return List
def main():
	cnt=0
	n=input()
	for i in range(n):
		a=input()
		if a>100:
			prime_List=prime_array(int(math.sqrt(a)))
		else:
			prime_List=prime_array(a)
		for j in prime_List:
			if a==j:
				cnt+=1
				break
	print('%d' % cnt)
if __name__=='__main__':
	main()

Submission status: Wrong Answer

Solution code:
import math
def prime_array(n=1000):
	List = [2]
	i = 3
	while i <= n:
		judge = True
		for k in List :
			if math.sqrt(i) > k :
				break
			if i%k == 0:
				judge = False
				break
		if judge :
			List.append(i)
		i += 2
	return List
def main():
	cnt=0
	prime_List=prime_array(10**4)
	n=input()
	for i in range(n):
		a=input()
		if a<=10**4:
			for j in prime_List:
				if a==j:
					cnt+=1
					break
		else:
			judge=True
			for j in prime_List:
				if a%j==0:
					judge=False
					break
			if judge:
				cnt+=1
	print('%d' % cnt)
if __name__=='__main__':
	main()

Submission status: Wrong Answer

Solution code:
import math
def prime_array(n=1000):
	List = [2]
	i = 3
	while i <= n:
		judge = True
		for k in List :
			if math.sqrt(i) < k :
				break
			if i%k == 0:
				judge = False
				break
		if judge :
			List.append(i)
		i += 2
	return List
def main():
	cnt=0
	prime_List=prime_array(10**4)
	print(prime_List)
	n=input()
	for i in range(n):
		a=input()
		if a<=10**4:
			for j in prime_List:
				if a==j:
					cnt+=1
					break
		else:
			judge=True
			for j in prime_List:
				if a%j==0:
					judge=False
					break
			if judge:
				cnt+=1
	print('%d' % cnt)
if __name__=='__main__':
	main()

Submission status: Wrong Answer

Solution code:
import math

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

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

Submission status: Wrong Answer

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

primes = [True]*n
for d in range(2,101):
    for i in range(n):
        if d!=a[i] and a[i]%d==0:
            primes[i] = False

print sum(primes)

Submission status: Wrong Answer

Solution code:
n = int(input())

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 range(0,n):
    if Is_prime(n):
        count += 1

Submission status: Wrong Answer

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

n = int(input())

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 range(0,n):
    if Is_prime(n):
        count += 1

print (count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a=map(int,raw_input().split())
a.sort()
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: Wrong Answer

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

Submission status: Wrong Answer

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: Wrong Answer

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: Wrong Answer

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: Wrong Answer

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

Submission status: Wrong Answer

Solution code:

import math

numbers = []
n = int(raw_input())
count = 0

for i in range(n):
	input_num = raw_input()
	numbers.append(int(input_num))

for num in numbers:
	prime_flag = True
	for i in range(2, int(math.sqrt(num)) + 1):
		if num % i == 0:
			prime_flag = False

	if i >= 1:
		if i == 2:
			count += 1
			continue

		if i % 2 != 0:
			for j in range(3, int(math.sqrt(i))):
				if x % j != 0:
					count += 1
					continue
print count

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

p_list=[2]
k = 3
print(2)
while len(p_list)<n:
    for p in p_list:
        if k %p ==0:
            isPrime = False
            break
        isPrime = True
    
    if isPrime:
        p_list.append(k)
        print(k)
    k  += 2

Submission status: Wrong Answer

Solution code:
n = int(input())
given_list = []
for i in range(n):
    num = int(input())
    given_list.append(num)

given_list.sort()


def prime_list(maximum_num):
    known = []
    num = 2
    while num < maximum_num:
        if num == 2: known.append(num)
        for i in known:
            if num % i == 0:
                break
        else:
            known.append(num)


        num += 1
    return known

length = len(given_list)
list_of_primes = prime_list(given_list[length-1])
count = 0
for num in given_list:
    if num in list_of_primes:
        count += 1

print(count)

Submission status: Wrong Answer

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

print(len(r))

Submission status: Wrong Answer

Solution code:
import math


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:
    check_max = math.floor(math.sqrt(n))
    for i in range(2, check_max):
      if n % i == 0:
        return False
    else:
      return True

def main():
  primes = []
  length = int(input())
  for _ in range(0, length):
    n = int(input())
    if is_prime(n):
      primes.append(n)

  print(len(primes))
  return 0


if __name__ == '__main__':
  main()

Submission status: Wrong Answer

Solution code:
import math


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:
    check_max = math.ceil(math.sqrt(n))
    for i in range(2, check_max + 1):
      if n % i == 0:
        return False
    else:
      return True

def main():
  primes = set([])
  length = int(input())
  for _ in range(0, length):
    n = int(input())
    if is_prime(n):
      primes.add(n)

  print(primes)
  print(len(primes))
  return 0


if __name__ == '__main__':
  main()

Submission status: Wrong Answer

Solution code:
def prime_numbers(n):
    cnds = [True] * n
    for x in xrange(2, int(n**0.5 + 1)):
        if cnds[x]:
            for m in xrange(2*x, n, x):
                cnds[m] = False
    return [i for i in xrange(2, n) if cnds[i]]

primes = prime_numbers(10000)
N = input()
print sum(input() in primes for i in range(N))

Submission status: Wrong Answer

Solution code:
import math
n = int(input())
A = [int(input()) for x in range(n)]
A_max = max(A)
for i in range(n):
    if A[i] < 2: A[i]=0
    for j in range(2,A[i]):
        if A[i] % j == 0:
            A[i] = 0
len([x for x in A if x != 0])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
A=[]
for i in range(N):
    A.append(int(input()))
counter = 0
for i in range(0, N):
    j = A[i] - 2
    if j == 0 or j == 1:
        counter += 1
    else:
        while j > 1:
            if i % j == 0:
                break
            else:
                j -= 1
        else:
            counter += 1
print(counter)

Submission status: Wrong Answer

Solution code:
import math
n = input()
c = 0


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

Submission status: Wrong Answer

Solution code:
import math

p = 0
n = int(input())

for i in range(n):
    a = int(input())
    
    if a == 2:
        p += 1
    elif a%2 == 0:
        pass
    else:
        d = int(math.sqrt(a))
        for i in range(3,d):
            if a%i == 0:
                break
        p += 1

print(p)

Submission status: Wrong Answer

Solution code:
import math

p = 0
n = int(input())

for i in range(n):
    a = int(input())
    
    if a == 2:
        p += 1
    elif a%2 == 0:
        pass
    else:
        i = 3
        while i < math.sqrt(a):
            if a%i == 0:
                break
            i +=2
        p += 1

print(p)

Submission status: Wrong Answer

Solution code:
import sys
import math

def isPrime(x):
     if x <= 1:
          return False
     if x == 2:
          return True
     root_x = int(math.sqrt(x))
     for num in range(2, root_x):
          if x%(num) == 0:
               return False
     return True

input = []
for line in sys.stdin:
     input.append(int(line))
##input = [2, 4, 7, 1, 2, 3, 1, 11, 4576435353, 2342342]
count = 0
for num in set(input):
     if isPrime(num):
          count += 1

print count

Submission status: Wrong Answer

Solution code:
def prime_number(num):
    flag = 0
    if num == 2:
        flag =  1
    elif num%2 != 0:
        for j in range(3, num, 2):
            if num%j == 0:
                flag = 0
                break
        flag = 1
    else:
        flag = 0
    return flag

n = int(raw_input())
num = [0 for i in range(n)]
for i in range(n):
    num[i] = int(raw_input())

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

print count

Submission status: Wrong Answer

Solution code:
def prime_number(num):
    if num == 2:
        return 1
    elif num%2 != 0:
        for j in range(3, num, 2):
            if num%j == 0:
                return 0
        return 1
    else:
        return 0

n = int(raw_input())
for i in range(n):
    num = int(raw_input())
    
    count = 0
    if prime_number(num) == 1:
        count += 1

print count

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
def isPrimeNum(x):
	if x % 2 == 0:
		return False
	i = 3
	while i < x:
		if x % i == 0:
			return False
		i += 2
	return True

# input
n = int(raw_input())

if n < 1 or n > 10000:
	exit()

count = 0

for i in range(0, n):
	e = int(raw_input())
	if e < 2 or e > 1000000000:
		exit()
	if isPrimeNum(e):
		count += 1

print count

Submission status: Wrong Answer

Solution code:
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):
            x2 = pow(x,2,n)
            if x==1: return False
            elif x*x%n == 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 not n%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(input())
for i in range(n):
  n = int(input())
  if is_prime(n): cnt+=1

print(cnt)

Submission status: Wrong Answer

Solution code:
from math import sqrt
from itertools import takewhile
n = int(input())
e = [int(input()) for _ in range(n)]
L, pnum, tmp = sqrt(e[-1]+1), [], [i for i in range(2, e[-1]+1)]
while tmp[0] < L:
    v = tmp.pop(0)
    pnum.append(v)
    tmp = list(filter(lambda x: x%v!=0, tmp))
for t in tmp: pnum.append(t)
print(len(list(takewhile(lambda x: x<=e[-1], pnum)))-len(list(takewhile(lambda x: x<e[0], pnum))))

Submission status: Wrong Answer

Solution code:
from math import sqrt
from itertools import takewhile
n = int(input())
e = sorted([int(input()) for _ in range(n)])
L, pnum, tmp = sqrt(e[-1]+1), [], [i for i in range(2, e[-1]+1)]
while tmp[0] < L:
    v = tmp.pop(0)
    pnum.append(v)
    tmp = list(filter(lambda x: x%v!=0, tmp))
for t in tmp: pnum.append(t)
print(len(list(takewhile(lambda x: x<=e[-1], pnum)))-len(list(takewhile(lambda x: x<e[0], pnum))))

Submission status: Wrong Answer

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

import math


def is_prime(x):
    # Primality Test
    if x <= 1 or x % 2 == 0:
        return False

    if x == 2:
        return True

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


def to_int(v):
    return int(v)


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

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

Submission status: Wrong Answer

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

import math


def is_prime(x):
    # Primality Test
    if x == 2:
        return True

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

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


def to_int(v):
    return int(v)


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

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

Submission status: Wrong Answer

Solution code:
import math

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


def count_prime_numbers(number_list):
    cnt = 0
    for target in number_list:
        if isprime(target):
            cnt += 1
    return cnt

N = int(input())
A = [int(input()) for i in range(N)]
print(count_prime_numbers(A))

Submission status: Wrong Answer

Solution code:
n = int(input())
for i in range(n):
    p = int(input())
    if not p%2:
        n -= 1
        continue
    for j in range(3,int(p**0.5),2):
        if not p%j:
            n -= 1
            continue
print(n)

Submission status: Wrong Answer

Solution code:
n = int(input())
for i in range(n):
    p = int(input())
    if p in (2,3,5,7):
        continue
    elif not p%2:
        n -= 1
        continue
    for j in range(3,int(p**0.5),2):
        if not p%j:
            n -= 1
            continue
print(n)

Submission status: Wrong Answer

Solution code:
n = int(input())
for i in range(n):
    p = int(input())
    if p == 2:
        continue
    elif p in (9,15):
        n -= 1
        continue
    elif not p%2:
        n -= 1
        continue
    for j in range(3,int(p**0.5),2):
        if not p%j:
            n -= 1
            continue
print(n)

Submission status: Wrong Answer

Solution code:
n = int(input())
for i in range(n):
    p = int(input())
    if p == 2:
        continue
    elif not p%2:
        n -= 1
        continue
    for j in range(3,int(p**0.5)+1,2):
        if not p%j:
            n -= 1
            continue
print(n)

Submission status: Wrong Answer

Solution code:
def p(n):
    if n==2:return 1
    if not n&1:return 0
    return pow(2,n-1,n)
print(sum(1 for _ in range(int(input())) if p(int(input()))))

Submission status: Wrong Answer

Solution code:
import math

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

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

Submission status: Wrong Answer

Solution code:
import math

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

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

Submission status: Wrong Answer

Solution code:
import math

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

Submission status: Wrong Answer

Solution code:
import math

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

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

Submission status: Wrong Answer

Solution code:
import math

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

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

Submission status: Wrong Answer

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

def prime_number_identifier(num):
    return True


input_num = int(raw_input())
counter = 0
while counter < input_num:
    candidate_number = int(raw_input())
    if prime_number_identifier(candidate_number):
        print candidate_number
    counter += 1

Submission status: Wrong Answer

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

def prime_number_identifier(num):
    for candidate in range(2, int(math.sqrt(num)) + 1):
        if num % candidate == 0:
            return False
    return True


input_num = int(raw_input())
counter = 0
while counter < input_num:
    candidate_number = int(raw_input())
    if prime_number_identifier(candidate_number):
        print candidate_number
    counter += 1

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Here your code !
import math
i = input()
count=0

for m in range(int(i)):
    num = int(input())
    arr=[]
    #print(num)
    sq = math.sqrt(num)
    for n in range(1,math.floor(sq)):
        if num%n==0:
            arr.append(n)   
    if len(arr)==1:
        count+=1
print(count)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Here your code !
import math
i = input()
count=0

def isPrime(x):
    global count
    if x == 2:
        return True
    if x>2 and x%2==0:
        return False
    i = 3
    while i<math.sqrt(x):
        if x%i==0:
            return False
        i+=2
    return True

for j in range(int(i)):
    j=int(input())
    if isPrime(j):
        count+=1
print(count)

Submission status: Wrong Answer

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


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

Submission status: Wrong Answer

Solution code:
n = int(input())
A = []
for _ in range(n):
    A.append(int(input()))

p = 0
for a in A:
    if a == 2:
        p += 1
    for i in range(1, a%2+1):
        if a%i == 0:
            p += 1
            break

print(p)

Submission status: Wrong Answer

Solution code:
n = int(input())
A = []
for _ in range(n):
    A.append(int(input()))

p = 0
for a in A:
    if a == 2:
        p += 1
    for i in range(1, a//2+1):
        if a%i == 0:
            p += 1
            break

print(p)

Submission status: Wrong Answer

Solution code:
max_count = int(input())

count = 0
for i in range(max_count):
	num = int(input())

	if num % 2 == 0:
		break

	f = 1
	for d in range(3, num, 2):
		if num % d == 0:
			f = 0
			break
	if f == 1:
		count += 1

print(count)

Submission status: Wrong Answer

Solution code:
def prime(n):
    for i in range(2, int(n**0.5) + 1):
        if n % i:
            return False
    return True

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

print(c)

Submission status: Wrong Answer

Solution code:
import math

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

    if (x == 1) or (x % 2 == 0):
        return False

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

    return True
    
if __name__ == '__main__':
    element_number = int(input())
    input_array = [int(input()) for i in range(element_number)]

    output = 0
    for x in input_array:
        if(is_prime(x)):
            output += 1

    print(output)

Submission status: Wrong Answer

Solution code:
#ALDS1_1-C Prime Numbers
def prime(n):
    s=2
    while(s*s <= n):
        if(n%s==0):
            return False
        s+=2
    return True

n=int(input())
for i in range(n):
    x = input()
    if prime(int(x)):
        print(x)

Submission status: Wrong Answer

Solution code:
#ALDS1_1-C Prime Numbers
def prime(n):
    s=2
    while(s*s <= n):
        if(n%s==0):
            return False
        s+=2
    return True

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

Submission status: Wrong Answer

Solution code:
prime_list = [2,3,5,7,11]
def appendp(num):
    for i in range(prime_list[-1], num, 2):
        for j in prime_list:
            if i % j == 0:
                break
            prime_list.append(i)
    
def prime_number():
    n = int(input())
    count = 0
    for _ in range(n):
        a = int(input())
        if a > prime_list[-1]:
            appendp(a)
        if a in prime_list:
            count += 1
    print(count)


if __name__ == "__main__":
    prime_number()

Submission status: Wrong Answer

Solution code:
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(input())
    count = 0
    for _ in range(n):
        a = int(input())
        if a > prime_list[-1]:
            appendp(a)
        if a in prime_list:
            count += 1
            print(a)
    print(count)


if __name__ == "__main__":
    prime_number()

Submission status: Wrong Answer

Solution code:
def is_prime(x):

    if x == 2 : return True

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

    return False


n = 5
res = 0

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

print(res)

Submission status: Wrong Answer

Solution code:
def is_prime(x):

    if x == 2 : return True

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

    return False


n = int(input())
res = 0

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

print(res)

Submission status: Wrong Answer

Solution code:
def is_prime(x):

    if x == 2 or x ==3 : return True

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

    return True


n = int(input())
res = 0

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

print(res)

Submission status: Wrong Answer

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

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