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
from sys import stdin

def main():
    nums = [int(n) for n in stdin]

    primes = list(filter(is_prime, nums))
    print(len(primes))

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

    if 2 == n:
        return True

    if 0 == n % 2:
        return False

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

    return True

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import math
cnt = 0
N = int(input())
for n in range(N):
    i = int(input())
    if i == 2\
    or i == 3\
    or i == 5\
    or i == 7:
        cnt += 1
    elif i % 2 == 0:
        continue
    else:
        j = 3
        while j >= 3 and j <= int(math.sqrt(i)):
            if i % j == 0:
                break
                
            j += 2
        cnt += 1
        
print(cnt)

Submission status: Wrong Answer

Solution code:
import math

def is_prime(num):
	prime = True
	for i in range(2,int(math.sqrt(num))):
		if num%i == 0:
			prime = False
			break
	return prime

num_set = set()
try:
	while True:
		num_set.add(eval(input()))
except EOFError:
	count = 0
	for x in num_set:
		count = count + (1 if is_prime(x) else 0)
	print(count)

Submission status: Wrong Answer

Solution code:
def is_prime(x):
    if x == 2:
        return 1
    elif x % 2 == 0:
        return 0
    l = x ** 0.5
    for i in range(3, int(x ** 0.5), 2):
        if x % i == 0:
            return 0
    return 1

import sys

def solve():
    file_input = sys.stdin
    N = file_input.readline()
    cnt = 0
    for l in file_input:
        cnt += is_prime(int(l))
    print(cnt)

solve()

Submission status: Wrong Answer

Solution code:
def isPrime(x):
    if x==2:
        return True
    
    if x<2 or x%2==0:
        return False
    
    for n in range(3,round(x**0.5),2):
        if x%n==0:
            return False
        
    return True     

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

i=0
for nm in num:
    if isPrime(nm):
        i+=1
        
print(i)

Submission status: Wrong Answer

Solution code:
def isPrime(x):
    if x==2:
        return True
    
    if x<2 or x%2==0:
        return False
    
    for n in range(3,round(x**0.5),2):
        if x%n==0:
            return False
        
    return True  

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

i=0
for nm in num:
    if isPrime(nm):
        i+=1
        
print(i)

Submission status: Wrong Answer

Solution code:
def isPrime(x):
    if x==2:
        return True
    
    if x<2 or x%2==0:
        return False
    
    for n in range(3,int(x**0.5)+1,2):
        if x%n==0:
            return False
    print(x)    
    return True  

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

i=0
for nm in num:
    if isPrime(nm):
        i+=1
        
print(i)

Submission status: Wrong Answer

Solution code:
import math
def judge(n):
    if n<2:
        return False
    i=2
    while i<=math.sqrt(n):
        if n%i==0:
            return False
        i+=1
    return True

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

Submission status: Wrong Answer

Solution code:
cnt_num = int(input())
dataset = [int(input()) for i in range(cnt_num)]

for i in dataset:
    if i <= 1:
        continue
    if i == 2:
        print(i)
        continue
    if i % 2 == 0:
        continue

    ok = ''
    for j in range(3,i,2):
        if i % j == 0:
           break
        else:
           ok = 'X'
           break

    if ok == 'X':
        print(i)
        continue

Submission status: Wrong Answer

Solution code:
cnt_num = int(input())
dataset = [int(input()) for i in range(cnt_num)]

count = 0
for i in dataset:
    if i <= 1:
        continue
    if i == 2:
        count += 1
        continue
    if i % 2 == 0:
        continue

    ok = ''
    for j in range(3,i,2):
        if i % j == 0:
           break
        else:
           ok = 'X'
           break

    if ok == 'X':
        count += 1
        continue
print(count)

Submission status: Wrong Answer

Solution code:
cnt_num = int(input())
dataset = [int(input()) for i in range(cnt_num)]

count = 0
for i in dataset:
    if i <= 1:
        continue

    if i == 2:
        count += 1
        continue

    if i == 3:
        count += 1
        continue

    if i % 2 == 0:
        continue

    ok = ''
    for j in range(3,i+1,2):
        if i % j == 0:
           break
        else:
           ok = 'X'
           break

    if ok == 'X':
        count += 1
        continue

print(count)

Submission status: Wrong Answer

Solution code:
cnt_num = int(input())
dataset = [int(input()) for i in range(cnt_num)]

count = 0
for i in dataset:
    if i <= 1:
        continue

    if i == 2:
        count += 1
        continue

    if i == 3:
        count += 1
        continue

    if i % 2 == 0:
        continue

    ok = ''
    for j in range(2,i):
        if i % j == 0:
           break
        else:
           ok = 'X'
           break

    if ok == 'X':
        count += 1
        continue

print(count)

Submission status: Wrong Answer

Solution code:
cnt_num = int(input())
dataset = [int(input()) for i in range(cnt_num)]

count = 0
for i in dataset:
    if i <= 1:
        continue

    if i == 2:
        count += 1
        continue

    if i == 3:
        count += 1
        continue

    if i % 2 == 0:
        continue

    ng = ''
    for j in range(3,i,2):
        if i % j == 0:
            ng = 'X'
            break

    if ng == '':
        print(i)
        count += 1
        continue

print(count)

Submission status: Wrong Answer

Solution code:
# Aizu Problem ALDS_1_1_C: Prime Numbers
#
import sys, math, os

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")

def primes2(n):
    """ Input n>=6, Returns a list of primes, 2 <= p < n """
    n, correction = n-n%6+6, 2-(n%6>1)
    sieve = [True] * (n//3)
    for i in range(1,int(n**0.5)//3+1):
      if sieve[i]:
        k=3*i+1|1
        sieve[      k*k//3      ::2*k] = [False] * ((n//6-k*k//6-1)//k+1)
        sieve[k*(k-2*(i&1)+4)//3::2*k] = [False] * ((n//6-k*(k-2*(i&1)+4)//6-1)//k+1)
    return [2,3] + [3*i+1|1 for i in range(1,n//3-correction) if sieve[i]]

primes = primes2(10000)

N = int(input())
cnt = 0
for _ in range(N):
    k = int(input())
    if k in primes:
        cnt += 1
print(cnt)

Submission status: Wrong Answer

Solution code:
def division(x,y):
    if y == 0:
        return x
    division(y, x%y)

def checker(x):
    for i in range(2,x//2+1):
        v = division(x,i)
        if v != 1:
            return True

q = int(input())
cnt = 0
for _ in range(q):
    han = int(input())
    if checker(han):
        cnt += 1

print(cnt)

Submission status: Wrong Answer

Solution code:
def division(x,y):
    if y == 0:
        return x
    return  division(y, x%y)

def checker(x):
    for i in range(2,x//2+1):
        v = division(x,i)
        if v > 1 :
            return False
        else:
            return True

cnt=0
q=int(input())
for i in range(q):
    o=checker(int(input()))
    if o:
        cnt+=1
print(cnt)

Submission status: Wrong Answer

Solution code:
def checker(x):
    if x < 2 or x % 2 == 0 :
        return False
    for i in range(2,int(x**0.5)+1):
        if x % i == 0 :
            return False
    return True

cnt=0
q=int(input())
for _ in range(q):
    v=int(input())
    if checker(v):
        cnt += 1
print(cnt)

Submission status: Wrong Answer

Solution code:
def checker(x):
    if x < 2 or x % 2 == 0 :
        return False
    for i in range(2,int(x**0.5+1)):
        if x % i == 0 :
            return False
    return True

cnt=0
q=int(input())
for _ in range(q):
    v=int(input())
    if checker(v):
        cnt += 1
print(cnt)

Submission status: Wrong Answer

Solution code:
def checker(x):
    if x < 2 or x % 2 == 0 :
        return False
    if x == 2:
        return True
    for i in range(2,int(x**0.5)+1):
        if x % i == 0 :
            return False
    return True

cnt=0
q=int(input())
for _ in range(q):
    v=int(input())
    if checker(v):
        cnt += 1
print(cnt)

Submission status: Wrong Answer

Solution code:
def isprime(x):
    if  x==2:
        return True
    if x<2 or x&1==0:
        return False
    return pow(2,x-1,x)==1

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

Submission status: Wrong Answer

Solution code:
import math

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

counter = 0
while 1:
    try:
        n = int(input())
        if is_prime(n):
            counter += 1
    except EOFError:
        break

print(counter)

Submission status: Wrong Answer

Solution code:
def isPrime(n):
    if n == 2 or n == 3:
        return True
    elif n == 1 or n % 2 == 0 or n % 3 == 0:
        return False
    N = int(n ** 0.5)
    for i in range(5, N, 2):
        if n % i == 0:
            return False
    return True

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

Submission status: Wrong Answer

Solution code:
import math
n = int(input())
count = 0
b = 0
for i in range(n):
    a = int(input())
    h = math.trunc(math.sqrt(a))+1
    if a == 2:
        b = 0
    elif a % 2 == 0:
        b = 1
    else:
        i = 3
        while i <= h:
            if a % i == 0:
                b = 1
            i += 2
    if b == 0:
        count += 1
print count

Submission status: Wrong Answer

Solution code:
import math
n = int(input())
count = 0
b = 0
for i in range(n):
    a = int(input())
    h = math.trunc(math.sqrt(a))+1
    if a == 1:
        b = 1
    if a == 2:
        b = 0
    elif a % 2 == 0:
        b = 1
    else:
        i = 3
        while i <= h:
            if a % i == 0:
                b = 1
            i += 2
    if b == 0:
        count += 1
print count

Submission status: Wrong Answer

Solution code:
import math
n = int(input())
count = 0
for i in range(n):
    a = int(input())
    h = math.trunc(math.sqrt(a))+1
    b = 0
    if a == 1:
        b = 1
    if a == 2:
        b = 0
    elif a % 2 == 0:
        b = 1
    else:
        i = 3
        while i <= h:
            if a % i == 0:
                b = 1
            i += 2
    if b == 0:
        count += 1

Submission status: Wrong Answer

Solution code:
N = int(input())
numbers = [int(input()) for i in range(N)]
ans = []

def check_prime(n):
    for i in range(2, N):
        if n % i == 0:
            return 0
    else:
        return 1
    
for n in numbers:
    ans.append(check_prime(n))

print(sum(ans))

Submission status: Wrong Answer

Solution code:
import math

def hurui(a):
    ret = [True for i in range(a+1)]
    for i in range(2, int(math.sqrt(a))+2):
        if ret[i]:
            continue
        for j in range(i*2, a+1, i):
            ret[j] = False

    return ret

ans = 0
m = 0
n = int(input())
a = []
for i in range(n):
    x = int(input())
    if x > m:
        m = x
    a.append(x)
l = hurui(m)

for i in range(n):
    if l[a[i]]:
        ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:
def IsPrime(n):
    '''

    :param n:??£??´??°
    :return: ?´???°?????????True, ????????????????????°?????????False
    ???????????§???????´???°??? 6k-1????????? 6k+1??§??¨?????????????????????k?????£??´??°
    '''
    if n == 2 or n == 3 or n== 5: return True
    if n == 1 or n%2 == 0 or n%3 == 0:return False
    d, l = 5, int(n**(1/2))
    while d <= l:
        if n%d == 0 or n%(d+2):return False
        d += 6
    return True
c = 0
for i in range(int(input())):
    if IsPrime(int(input())): c += 1
print(c)

Submission status: Wrong Answer

Solution code:
n = int(input())
count = 0
for i in range(2, n):
    x = int(input())
    if (x % i == 0):
        break
    else:
        count += 1
print(count)

Submission status: Wrong Answer

Solution code:
n = int(input())
count = 0
for i in range(2, n+1):
    x = int(input())
    if (x % i == 0):
        break
    else:
        count += 1
print(count)

Submission status: Wrong Answer

Solution code:
n = int(input())
count = 0
for i in range(n):
    x = int(input())
    if (i > 2):
        if (x % i == 0):
            break
        else:
            count += 1
print(count)

Submission status: Wrong Answer

Solution code:
n = int(input())
count = 0
for i in range(n):
    x = int(input())
    if (i >= 2):
        if (x % i == 0):
            break
        else:
            count += 1
    if (x == 2):
        count += 1
print(count)

Submission status: Wrong Answer

Solution code:
n = int(input())
count = 0
for i in range(n):
    x = int(input())
    if (i > 1):
        if (x % i == 0):
            break
        else:
            count += 1
        if (x == 2):
            count += 1
print(count)

Submission status: Wrong Answer

Solution code:
n = int(input())
count = 0
for i in range(2, n):
  x = int(input())
  if x == 2:
    count += 1
  elif x % i == 0:
    break
  else:
    count += 1
print(count)

Submission status: Wrong Answer

Solution code:
n = int(input())
count = 0
for i in range(n):
    x = int(input())
    for j in range(2, n + 1):
        if (x % j == 0):
            break
        else:
            count += 1
    if (x == 2):
        count += 1
print(count)

Submission status: Wrong Answer

Solution code:
n = int(input())
count = 0
for i in range(n):
  x = int(input())
  if i > 1:
    if x == 2:
      count += 1
    elif x % i == 0:
      break
    else:
      count += 1
print(count)

Submission status: Wrong Answer

Solution code:
n = int(input())
count = 0
for i in range(n):
    x = int(input())
    if (x == 2):
        count += 1
        break
        for j in range(2, n + 1):
            if (x % j == 0):
                break
            else:
                count += 1
print(count)

Submission status: Wrong Answer

Solution code:
n = int(input())
count = 0
for i in range(n):
  x = int(input())
  if i > 1:
    if x == 2:
      count += 1
    elif x <= 1:
      break
    elif x % i == 0:
      break
    else:
      count += 1
print(count)

Submission status: Wrong Answer

Solution code:
n = int(input())
count = 0
for i in range(n):
    x = int(input())
    if (x == 2):
        count += 1
        for j in range(2, n + 1):
            if (x % j == 0):
                break
            else:
                count += 1
print(count)

Submission status: Wrong Answer

Solution code:
n = int(input())
count = 0
for i in range(n):
    x = int(input())
    if (x == 2):
        count += 1
    else:
        for j in range(2, x + 1):
            if (x % j == 0):
                break
            else:
                count += 1
print(count)

Submission status: Wrong Answer

Solution code:
n = int(input())
count = 0
for i in range(n):
    x = int(input())
    if (x == 2):
        count += 1
    else:
        for j in range(2, x):
            if (x % j == 0):
                break
            else:
                count += 1
print(count)

Submission status: Wrong Answer

Solution code:
n = int(input())
count = 0
for i in range(n):
  x = int(input())
  if i > 1:
    if x == 2:
      count += 1
    elif x % 2 == 0:
      continue
    else:
      count += 1
print(count)

Submission status: Wrong Answer

Solution code:
n = int(input())
count = 0
j = 2
for i in range(n):
    x = int(input())
    if (x == 2):
        count += 1
    else:
        while (j * j <= x):
            if (x % j == 0):
                break
            else:
                count += 1
            j = j + 1
print(count)

Submission status: Wrong Answer

Solution code:
n = int(input())
count = 0
for i in range(n):
    x = int(input())
    if (x == 2):
        count += 1
    else:
        j = 2
        while (j * j <= x):
            if (x % j == 0):
                break
            else:
                count += 1
            j = j + 1
print(count)

Submission status: Wrong Answer

Solution code:
n = int(input())
count = 0
for i in range(n):
    x = int(input())
    if (x < 2):
        break
    if (x == 2):
        count += 1
    else:
        j = 2
        while (j * j <= x):
            if (x % j == 0):
                break
            else:
                count += 1
            j = j + 1
print(count)

Submission status: Wrong Answer

Solution code:
n = int(input())
count = 0
for i in range(n):
  x = int(input())
  for j in range(2, x - 1):
    if x == 2:
      count += 1
    elif x % j == 0:
      break
    else: 
      count += 1
print(count)

Submission status: Wrong Answer

Solution code:
n = int(input())
count = 0
for i in range(n):
    x = int(input())
    if (x < 2):
        break
    if (x == 2):
        count += 1
    else:
        for j in range(2, n):
            if (x % j == 0):
                break
            else:
                count += 1
            j += 2
print(count)

Submission status: Wrong Answer

Solution code:
n = int(input())
count = 0
for i in range(n):
    x = int(input())
    if (x < 2):
        break
    if (x == 2):
        count += 1
    else:
        for j in range(2, n):
            if (x % j == 0):
                break
            else:
                count += 1
print(count)

Submission status: Wrong Answer

Solution code:
n = int(input())
count = 0
for i in range(n):
  x = int(input())
  for j in range(2, x - 1):
    if x == 2:
      count += 1
    elif x % 2 == 0:
      continue
    else:
      if x % j != 0: 
        count += 1
print(count)

Submission status: Wrong Answer

Solution code:
n = int(input())
count = 0
for i in range(n):
  x = int(input())
  if x == 2:
    count += 1
  elif x % 2 == 0:
    continue
  else:
    if pow(2, x - 1, x): 
      count += 1
print(count)

Submission status: Wrong Answer

Solution code:
import math

N = int(input())
ans = 0

def solve(x):
    if x==2:
        return 1
    elif x%2:
        return 0
    else:
        for i in range(3, math.ceil(math.sqrt(x)) + 1, 2):
            if x%i ==0:
                return 0
        return 1
for i in range(N):
    if solve(int(input())) ==1:
        ans +=1
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(raw_input())

def isprime(m):
	if m == 2:
		return 1
	elif m < 2 or m % 2 == 0:
		return 0
	else:
		p = 3
		while p < m**0.5:
			if m % p == 0:
				return 0
			p = p + 2
		return 1

cnt = 0
for i in range(n):
	cnt += isprime(int(raw_input()))

print cnt

Submission status: Wrong Answer

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

    A.sort(reverse = True)
    Pn = []   #Prime numbers
    for x in range(1, A[0] + 1):
        if x > 2 and x % 2 == 0:
            pass
        else:
            c1 = 0
            for y in range(1, x):
                if y % 2 == 0:
                    break
                if x % y == 0:
                    c1 += 1
                    if c1 > 1:
                        break
            if c1 == 1:
                Pn.append(x)

    c2 = 0
    for x in range(n):
        if A[x] in Pn:
            c2 += 1
    print(c2)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
n=int(input())
s=0
for i in range(n):
    a=int(input())
    c=0
    for j in range(3,a+1,2):
        if a%j==0:
            break
        c+=1
    if c==a-2:
       s+=1
print(s)

Submission status: Wrong Answer

Solution code:
n=int(input())
s=0
for i in range(n):
    a=int(input())
    c=0
    if a%2==0:
         c+=1
    else:
        for j in range(3,a+1,2):
            if a%j==0:
                break
            c+=1
    if c==a-2:
        s+=1
print(s)

Submission status: Wrong Answer

Solution code:
n=int(input())
s=0
for i in range(n):
    a=int(input())
    c=0
    if a==2:
        s+=1
    else:
        for j in range(3,a+1,2):
            if a%j==0:
                break
            c+=1
        if c==a-3:
            s+=1
print(s)

Submission status: Wrong Answer

Solution code:
import math
n=int(input())
s=0

for i in range(n):
    a=int(input())
    b=math.ceil(a**0.5)
    #print(a) 
    if a%2==0:
        continue
    else:
        for j in range(3,b+1,2):
            if j==b:
                s+=1
           # elif a%j==0:
            #    break  
print(s)

Submission status: Wrong Answer

Solution code:
import math
n=int(input())
s=0

for i in range(n):
    a=int(input())
    b=int(a**0.5)
    #b=math.ceil(a**0.5)
    #print(str(b), '??O') 
    if a==2:
        s+=1
    elif a%2==0 or a < 2:
        continue
    else:
        for j in range(3,b+1,2):
            if j==b:
                s+=1
            elif a%j==0:
                break  
print(s)

Submission status: Wrong Answer

Solution code:
import math
n=int(input())
s=0

for i in range(n):
    a=int(input())
    b=int(a**0.5)
    #b=math.ceil(a**0.5)
    #print(str(b), '??O') 
    if a==2:
        s+=1
    elif a%2==0 or a < 2:
        continue
    else:
        for j in range(3,b+1,2):
            if a%j==0:
                break
        s+=1
print(s)

Submission status: Wrong Answer

Solution code:
import math
n=int(input())
s=0
for i in range(n):
    a=int(input())
    b=math.ceil(a**0.5)
    if a==2:
        s+=1
    elif a%2==0 or a < 2:
        continue
    else:
        c=0
        for j in range(3,a+1,2):
            if a%j==0:
                c+=1
                break
        if c==0:
            s+=1
print(s)

Submission status: Wrong Answer

Solution code:
def main() :
    n = int(input())
    nums = []
    for i in range(0, n) :
        x = int(input())
        nums.append(x)

    count = 0
    judge = 0
    for i in nums :
        print(i)
        for j in range(2, i) :
            if (i % j) != 0 :
                judge += 0
            else :
                judge += 1

        if judge == 0 :
            count += 1

    print(count)


if __name__ == '__main__' :
    main()

Submission status: Wrong Answer

Solution code:
def main() :
    n = int(input())
    nums = []
    for i in range(n) :
        x = int(input())
        nums.append(x)

    max = float("-inf")
    min = nums[0]
    for i in range(1,n) :
        if nums[i] < min :
            min = nums[i]
        if nums[i] - min > max :
            max = nums[i] - min

    print(max)



if __name__ == '__main__' :
    main()

Submission status: Wrong Answer

Solution code:
def main() :
    n = int(input())
    nums = []
    for i in range(n) :
        x = int(input())
        nums.append(x)

    max = float("-inf")
    min = nums[0]
    for i in range(1,n) :
        if nums[i] - min > max :
            max = nums[i] - min

        if nums[i] < min :
            min = nums[i]


    print(max)



if __name__ == '__main__' :
    main()

Submission status: Wrong Answer

Solution code:
import sys


def isprime(n):
    '''check if integer n is a prime'''

    # make sure n is a positive integer
    n = abs(int(n))

    # 0 and 1 are not primes
    if n < 2:
        return False

    # 2 is the only even prime number
    if n == 2: 
        return True    

    # all other even numbers are not primes
    if not n & 1: 
        return False

    # range starts with 3 and only needs to go up 
    # the square root of n for all odd numbers
    for x in range(3, int(n**0.5) + 1, 2):
        if n % x == 0:
            return False

    return True


max = int(sys.stdin.readline())
answer = []

for x in range(max):
    n = sys.stdin.readline()
    if isprime(int(n)):
        answer.append(str(int(n)))

print(' '.join(answer))

Submission status: Wrong Answer

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

t = 0
for i in range(int(input())):
    if isPrime(int(input())):
        t += 1
print(t)

Submission status: Wrong Answer

Solution code:
def isPrime(x):
    if x == 2:
        return True
    elif (x < 2) or (x % 2 == 0):
        return False
    else:
        i = 3
        while i <= float(x) ** 0.5:
            if x % i == 0:
                return False
            i += 2
        return True


t = 0
for i in range(int(input())):
    if isPrime(int(input())):
        t += 1
        print(i)

Submission status: Wrong Answer

Solution code:
def main():
    N = int(input())
    print(IsPrime(N))

def IsPrime(N):
    count = 0
    for i in range(N):
        inputNum = int(input())
        if(inputNum == 2):
            count += 1
            continue
        elif(inputNum % 2 == 0):
            continue

        flag = 0
        for j in range(3, int(pow(inputNum, 1/2))):
            if(inputNum % j == 0):
                flag = 1
                break
            else:
                continue
        if(flag == 0):
            count += 1
    
    return count

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    N = int(input())
    print(IsPrime(N))

def IsPrime(N):
    count = 0
    for i in range(N):
        inputNum = int(input())
        if(inputNum == 2):
            count += 1
            print('{0} is prime number'.format(inputNum))
            continue
        elif(inputNum % 2 == 0):
            continue

        flag = 0
        for j in range(3, int(pow(inputNum, 1/2))+1):
            if(inputNum % j == 0):
                flag = 1
                break
            else:
                continue
        if(flag == 0):
            print('{0} is a prime number'.format(inputNum))
            count += 1
    
    return count

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def p(x):
 for i in range(2,x//2):
  if x%i==0:return 0
 return 1
n=int(input())
print(sum([p(int(input()))for _ in range(n)]))

Submission status: Wrong Answer

Solution code:
def p(x):
 if x%2==0:return 1
 i=3
 while i<=x**.5:
  if x%i==0:return 0
  i+=2
 return 1
n=int(input())
print(sum([p(int(input()))for _ in range(n)]))

Submission status: Wrong Answer

Solution code:
# coding:utf-8
import math
n = input()
array = []
index = 0
for i in range(n):
    array.append(input())
array.sort()
while True:
    p = array[index]
    index += 1
    if p > math.sqrt(array[-1]):
        break
    array.pop(index - 1)
    for i in range(len(array)):
        if array[i] % p == 0:
            array[i] = 0
    array = [a for a in array if a != 0]
    array.insert(index - 1, p)
print len(array)

Submission status: Wrong Answer

Solution code:
# coding:utf-8
import math
n = input()
array = []
index = 0
for i in range(n):
    array.append(input())
array.sort()
while True:
    p = array[index]
    index += 1
    if p >= math.sqrt(array[-1]):
        break
    array.pop(index - 1)
    for i in range(len(array)):
        if array[i] % p == 0:
            array[i] = 0
    array = [a for a in array if a != 0]
    array.insert(index - 1, p)
print len(array)

Submission status: Wrong Answer

Solution code:
#coding: UTF-8

import sys
import math

class Algo:
  @staticmethod
  def is_prime(l):
    ans = 0
    for n in l:
      if n == 2:
        ans += 1
      else:
        for i in range(2,int(math.sqrt(n))+2):
          if n%i == 0:
            ans += 1
    print(ans)

N = int(input())
L = []
for i in range(0,N):
  L.append(int(input()))
Algo.is_prime(L)

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
count = 0
for _ in range(N):
    m = int(input())
    rm = int(math.sqrt(m))
    flag = 0
    for i in range(2,rm+1):
        if m %rm ==0:
            flag = 1
            break
    if flag ==0 :count=count +1
    ##print(m,flag)

print(count)

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
A = [int(input()) for i in range(N)]
c=0
for i in range(N):
    x=abs(A[i])
    if x==2:c+=1
    if x<2 or x&1==0:continue
    pow(1,x-1,x)==1

print(c)

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
A = [int(input()) for i in range(N)]
c=0
for i in range(N):
    x=abs(A[i])
    if x==2:c+=1
    if x<2 or x&1==0:continue
    if pow(1,x-1,x)==1: c+=1

print(c)

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
A = [int(input()) for i in range(N)]
c=0
for i in range(N):
    x=abs(A[i])
    if x==2:c+=1
    if x<2 or x&1==0:continue
    if pow(1,x-1,x)!=1: c+=1

print(c)

Submission status: Wrong Answer

Solution code:
prime = set([2])
for i in range(3, 10001, 2):
    if i not in prime:
        prime.add(i)
n = int(input())
cnt = 0
for i in (int(input()) for _ in range(n)):
    if i in prime:
        cnt += 1
print(cnt)

Submission status: Wrong Answer

Solution code:
prime = set([2])
for i in range(3, 10001, 2):
    for j in prime:
        if i % j == 0:
            break
    else:
        prime.add(i)
n = int(input())
cnt = 0
for i in (int(input()) for _ in range(n)):
    if i in prime:
        cnt += 1
print(cnt)

Submission status: Wrong Answer

Solution code:
prime = set([2])
for i in range(3, 10000, 2):
    for j in prime:
        if i % j == 0:
            break
    else:
        prime.add(i)
n = int(input())
cnt = 0
for i in (int(input()) for _ in range(n)):
    for j in prime:
        if i % j == 0:
            cnt += 1
print(cnt)

Submission status: Wrong Answer

Solution code:
c=0
n=int(input())
for _ in range(n):
 x=int(input())
 if x%2==0:c+=1;continue
 for i in range(3,x,2):
  if x%i==0:c+=1;break
print(n-c)

Submission status: Wrong Answer

Solution code:
# coding: UTF-8
n = int(raw_input())
count = 0
for i in range(n):
    j = 3
    num = int(raw_input())
    if (num < 2):
        continue
    elif (num == 2):
        count += 1
    if (num % 2 == 0):
        continue
    while j < num:
        if (num % j == 0):
            j += 2
            continue;
        j += 1
    count += 1
print(count)

Submission status: Wrong Answer

Solution code:
# coding: UTF-8
n = int(raw_input())
count = 0
for i in range(n):
    num = int(raw_input())
    if (num < 2):
        continue
    elif (num == 2):
        count += 1
        continue
    elif (num % 2 == 0):
        continue
    if pow(2,num-1,num):
        count += 1
print(count)

Submission status: Wrong Answer

Solution code:
def hoge(z):
    yuki = 0
    kkk = 2
    #for i in range(2, z):
    while kkk < z:
        if z % kkk == 0:
            yuki += 1
        if yuki:
            return False
        kkk += 2
    return True

if __name__ == '__main__':
    n = int(input())
    c = 0
    for _ in range(n):
        if hoge(int(input())):
            c += 1
    print (c)

Submission status: Wrong Answer

Solution code:
n=int(input())
nums=[]
for i in range(n):
    nums.append(int(input()))
count=0
for i in range(n):
    j=nums[i]-2
    while(0):
        if nums[i]%j == 0:
            break
        if j == 2:
            counter+=1
            break
        j-=1
print(count)