Buggy python submission (verdict: Runtime Error):
count = 0
for _ in range(int(input())):
    n = int(input())
    count += 1 if mod(2, n-1, n) == 1 else 0
print(count)


Fixed submission:
f=lambda x: 1 if x == 2 or x == 3 or (x>3 and x&1==1 and pow(2, x-1, x)==1) else 0
print(sum(f(int(input())) for _ in range(int(input()))))

Buggy python submission (verdict: Runtime Error):
count = 0
for _ in range(int(input())):
    n = int(input())
    count += 1 if (mod(2, n-1, n) == 1) else 0
print(count)


Fixed submission:
f=lambda x: 1 if x == 2 or x == 3 or (x>3 and x&1==1 and pow(2, x-1, x)==1) else 0
print(sum(f(int(input())) for _ in range(int(input()))))

Buggy python submission (verdict: Runtime Error):
count = 0
for _ in range(int(input())):
    n = int(input())
    if mod(2,n-1,n) == 1:
        count += 1
print(count)


Fixed submission:
f=lambda x: 1 if x == 2 or x == 3 or (x>3 and x&1==1 and pow(2, x-1, x)==1) else 0
print(sum(f(int(input())) for _ in range(int(input()))))

Buggy python submission (verdict: Runtime Error):
count = 0
for _ in range(int(input())):
    n = int(input())
    if mod(2,n-1,n) == 1:
        count += 1
print(count)


Fixed submission:
f=lambda x: 1 if x == 2 or x == 3 or (x>3 and x&1==1 and pow(2, x-1, x)==1) else 0
print(sum(f(int(input())) for _ in range(int(input()))))

Buggy python submission (verdict: Runtime Error):
count = 0
for _ in range(int(input())):
    n = int(input())
    if mod(2,n-1,n) == 1:
        count += 1


Fixed submission:
f=lambda x: 1 if x == 2 or x == 3 or (x>3 and x&1==1 and pow(2, x-1, x)==1) else 0
print(sum(f(int(input())) for _ in range(int(input()))))

Buggy python submission (verdict: Runtime Error):
def isPrime(n):
    if n == 1:
        return False
    elif n == 2 or n == 3:
        return True
    else:
        for i in range(2, n//2+1):
            if n % i == 0
                return False
        return True


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




Fixed submission:
f=lambda x: 1 if x == 2 or x == 3 or (x>3 and x&1==1 and pow(2, x-1, x)==1) else 0
print(sum(f(int(input())) for _ in range(int(input()))))

Buggy python submission (verdict: Time Limit Exceeded):
def isPrime(n):
    if n == 1:
        return False
    elif n == 2 or n == 3:
        return True
    else:
        for i in range(2, n//2+1):
            if n % i == 0:
                return False
        return True


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




Fixed submission:
f=lambda x: 1 if x == 2 or x == 3 or (x>3 and x&1==1 and pow(2, x-1, x)==1) else 0
print(sum(f(int(input())) for _ in range(int(input()))))

Buggy python submission (verdict: Time Limit Exceeded):
class PrimeChecker(object):
    def __init__(self):
        self.primes = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53]
    
    def isPrime(self, n):
        if n in self.primes:
            return True
        elif n < 53:
            return False
        else:
            for i in self.primes:
                if n % i == 0:
                    return False
            for i in range(53, n//2, 2):
                if n % i == 0:
                    return False
            self.primes.append(n)
            return True


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




Fixed submission:
f=lambda x: 1 if x == 2 or x == 3 or (x>3 and x&1==1 and pow(2, x-1, x)==1) else 0
print(sum(f(int(input())) for _ in range(int(input()))))

Buggy python submission (verdict: Runtime Error):
class PrimeChecker:

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

    def isPrime(self, n):
        if n in self.primes:
            return True
        else:
            for i in self.primes:
                if n % i == 0:
                    return False

        i = self.primes[-1]
        w = 2 if i % 6 == 5 else 4

        while i * i <= n:
            if self.isPrime(i,n) and n % i == 0:
                return False

            i += w
            w = 6 - w

        self.primes.append(n)

        return True

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


Fixed submission:
f=lambda x: 1 if x == 2 or x == 3 or (x>3 and x&1==1 and pow(2, x-1, x)==1) else 0
print(sum(f(int(input())) for _ in range(int(input()))))

Buggy python submission (verdict: Runtime Error):
f = lambda x: 1 if (not x < 2 and not x&1 == 0) and (x == 2 or x == 3 or pow(2,x-1,x) == 1) else 0
print(count += f(int(input())) for _ in range(int(input())))


Fixed submission:
f=lambda x: 1 if x == 2 or x == 3 or (x>3 and x&1==1 and pow(2, x-1, x)==1) else 0
print(sum(f(int(input())) for _ in range(int(input()))))