Buggy python submission (verdict: Time Limit Exceeded):
n = input()
count = 0
for i in xrange(n):
    x = input()
    for j in xrange(2,x):
        if x % j == 0:
            break
    else:
        count += 1
print count

Fixed submission:
import math
def prime(x):
    if x == 2: return True
    elif x % 2 == 0: return False
    else:
        for j in xrange(3,int(math.sqrt(x))+1,2):
            if x % j == 0: return False
        else:
            return True 
n = input()
count = 0
for i in xrange(n):
    if prime(input()): count += 1
print count

Buggy python submission (verdict: Time Limit Exceeded):
n = input()
count = 0
for i in xrange(n):
    x = input()
    if x == 2: count += 1
    elif x % 2 != 0:
        for j in xrange(3,x,2):
            if x % j == 0: break
        else: count += 1
print count

Fixed submission:
import math
def prime(x):
    if x == 2: return True
    elif x % 2 == 0: return False
    else:
        for j in xrange(3,int(math.sqrt(x))+1,2):
            if x % j == 0: return False
        else:
            return True 
n = input()
count = 0
for i in xrange(n):
    if prime(input()): count += 1
print count

Buggy python submission (verdict: Runtime Error):
n = input()
count = 0
for i in xrange(n):
    x = input()
    if x == 2: count += 1
    elif x % 2 != 0:
        for j in xrange(3,x*0.5+1,2):
            if x % j == 0: break
        else: count += 1
print count

Fixed submission:
import math
def prime(x):
    if x == 2: return True
    elif x % 2 == 0: return False
    else:
        for j in xrange(3,int(math.sqrt(x))+1,2):
            if x % j == 0: return False
        else:
            return True 
n = input()
count = 0
for i in xrange(n):
    if prime(input()): count += 1
print count

Buggy python submission (verdict: Runtime Error):
n = input()
count = 0
for i in xrange(n):
    x = input()
    if x == 2: count += 1
    elif x == 3: count += 1
    elif x % 2 != 0:
        for j in xrange(3,x*0.5+1,2):
            if x % j == 0: break
        else: count += 1
print count

Fixed submission:
import math
def prime(x):
    if x == 2: return True
    elif x % 2 == 0: return False
    else:
        for j in xrange(3,int(math.sqrt(x))+1,2):
            if x % j == 0: return False
        else:
            return True 
n = input()
count = 0
for i in xrange(n):
    if prime(input()): count += 1
print count

Buggy python submission (verdict: Time Limit Exceeded):
n = input()
count = 0
for i in xrange(n):
    x = input()
    if x == 2: count += 1
    elif x % 2 != 0:
        for j in xrange(3,int(x*0.5+1),2):
            if x % j == 0: break
        else: count += 1
print count

Fixed submission:
import math
def prime(x):
    if x == 2: return True
    elif x % 2 == 0: return False
    else:
        for j in xrange(3,int(math.sqrt(x))+1,2):
            if x % j == 0: return False
        else:
            return True 
n = input()
count = 0
for i in xrange(n):
    if prime(input()): count += 1
print count

Buggy python submission (verdict: Time Limit Exceeded):
n = input()
count = 0
for i in range(n):
    x = input()
    if x == 2: count += 1
    elif x % 2 != 0:
        for j in xrange(3,int(x*0.5+1),2):
            if x % j == 0: break
        else: count += 1
print count

Fixed submission:
import math
def prime(x):
    if x == 2: return True
    elif x % 2 == 0: return False
    else:
        for j in xrange(3,int(math.sqrt(x))+1,2):
            if x % j == 0: return False
        else:
            return True 
n = input()
count = 0
for i in xrange(n):
    if prime(input()): count += 1
print count

Buggy python submission (verdict: Time Limit Exceeded):
def prime(x):
    if x == 2: return True
    elif x % 2 == 0: return False
    else:
        for j in xrange(3,int(x*0.5+1),2):
            if x % j == 0: return False
        else: return True

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

Fixed submission:
import math
def prime(x):
    if x == 2: return True
    elif x % 2 == 0: return False
    else:
        for j in xrange(3,int(math.sqrt(x))+1,2):
            if x % j == 0: return False
        else:
            return True 
n = input()
count = 0
for i in xrange(n):
    if prime(input()): count += 1
print count

Buggy python submission (verdict: Time Limit Exceeded):
def prime2(x):
    if x == 2: return True
    else:
        for s in stock:
            if x % s == 0: return False
        for j in xrange(3,int(x*0.5),2):
            if x % j == 0: return False
        else:
            stock.append(x)
            return True
        
n = input()
count = 0
stock = [2]
for i in xrange(n):
    if prime2(input()): count += 1
print count

Fixed submission:
import math
def prime(x):
    if x == 2: return True
    elif x % 2 == 0: return False
    else:
        for j in xrange(3,int(math.sqrt(x))+1,2):
            if x % j == 0: return False
        else:
            return True 
n = input()
count = 0
for i in xrange(n):
    if prime(input()): count += 1
print count