ZhenlongDai/ACPR huggingface dataset:
Problem: p02819
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
X = int(input())

def is_prime(n):
    for i in range(2, n + 1):
        if i * i > n:
            break
        if n % i == 0:
            return False
    return n != 1
  
for i in range(X+1, 10 ** 6):
  if is_prime(i):
    print(i)
    break

Failing test case input:
331

Expected output:
331


Actual output:
337


Fixed submission (verdict: Accepted):
X = int(input())

def is_prime(n):
    for i in range(2, n + 1):
        if i * i > n:
            break
        if n % i == 0:
            return False
    return n != 1
  
for i in range(X, 10 ** 7):
  if is_prime(i):
    print(i)
    break

Problem: p02819
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
x = 10**6
li = [True for i in range(x)]
li[0] = False
li[1] = False

for i in range(int(x**0.5)+1):
    if li[i]:
        m = 2
        while(i*m<x):
            li[i*m] = False
            m += 1

for i in range(x):
    if i>n and li[i]:
        print(i)
        break

Failing test case input:
433

Expected output:
433


Actual output:
439


Fixed submission (verdict: Accepted):
n = int(input())
x = 10**6
li = [True for i in range(x+10)]
li[0] = False
li[1] = False

for i in range(int(x**0.5)+1):
    if li[i]:
        m = 2
        while(i*m<=x):
            li[i*m] = False
            m += 1

for i in range(x):
    if i>=n and li[i]:
        print(i)
        break

Problem: p02819
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def is_prime(q):
    if q == 2: return True
    elif q % 2 == 0: return False
    return pow(2, q-1, q) == 1

a = int(input())

while(True):
    if is_prime(a):
        print(a)
        break
    a += 1

Failing test case input:
341

Expected output:
347


Actual output:
341


Fixed submission (verdict: Accepted):

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

a = int(input())

while(True):
    if is_prime(a):
        print(a)
        break
    a += 1

Problem: p02819
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
x=int(input())
import math
def is_prime(n):
    if n<=1:
        return False
    for i in range(2,int(math.sqrt(n) + 1)):
        if n%i == 0:
            return False
    return True
for i in range(x+1,2*x+1):
        if is_prime(i):
                print(i)
                exit()

Failing test case input:
433

Expected output:
433


Actual output:
439


Fixed submission (verdict: Accepted):
x=int(input())
import math
def is_prime(n):
    if n<=1:
        return False
    for i in range(2,int(math.sqrt(n) + 1)):
        if n%i == 0:
            return False
    return True
for i in range(x,2*x+1):
        if is_prime(i):
                print(i)
                exit()
Problem: p02819
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
X = int(input())
X = X + 1
prime = None
while True:
    for i in range(2, X):
        if X % i == 0:
            break
    else:
        prime = X
    if prime != None:
        break
    else:
        X += 1

print(prime)

Failing test case input:
4751

Expected output:
4751


Actual output:
4759


Fixed submission (verdict: Accepted):
X = int(input())
prime = None
while True:
    for i in range(2, X):
        if X % i == 0:
            break
    else:
        prime = X
    if prime != None:
        break
    else:
        X += 1

print(prime)

Problem: p02819
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math

def prime_number(j):
    if j == 1: return False
    
    for i in range(2,int(math.sqrt(j)) + 1):
        if j % i == 0:
            return False
    return True

x = int(input())
for j in range(x,10**5 + 1):
    if prime_number(j) and x <= j:
        print(j)
        break

Failing test case input:
99992

Expected output:
100003

Actual output:

Fixed submission (verdict: Accepted):
import math

def prime_number(j):
    if j == 1: return False
    
    for i in range(2,int(math.sqrt(j)) + 1):
        if j % i == 0:
            return False
    return True

x = int(input())
for j in range(x,10**6):
    if prime_number(j) and x <= j:
        print(j)
        break

Problem: p02819
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import sys
import math

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

def callIsPrime(input_num):
    numbers = []
    for i in range(1, input_num):
        if isPrime(i):
            numbers.append(i)
    return numbers


def main():
    
    input = sys.stdin.readline
    x = int(input())
    primes = callIsPrime(x+1000)
    ans = [i for i in primes if i>x]
    print(min(ans))


if __name__ == "__main__":
    main()



Failing test case input:
577

Expected output:
577


Actual output:
587


Fixed submission (verdict: Accepted):
import sys
import math

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

def callIsPrime(input_num):
    numbers = []
    for i in range(1, input_num):
        if isPrime(i):
            numbers.append(i)
    return numbers


def main():
    
    input = sys.stdin.readline
    x = int(input())
    primes = callIsPrime(x+1000)
    ans = [i for i in primes if i>=x]
    print(min(ans))


if __name__ == "__main__":
    main()
Problem: p02819
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
p = int(input())
n = 2*p
primes = set(range(2, n+1))
for i in range(2, int(n**0.5+1)):
    primes.difference_update(range(i*2, n+1, i))
primes=list(primes)
for i in primes:
    if i >= p:
        print(i)
        break

Failing test case input:
1267

Expected output:
1277


Actual output:
2053


Fixed submission (verdict: Accepted):
p = int(input())
n = 2*p
primes = set(range(2, n+1))
for i in range(2, int(n**0.5+1)):
    primes.difference_update(range(i*2, n+1, i))
primes=list(primes)
primes.sort()

for i in primes:
    if i >= p:
        print(i)
        break

Problem: p02819
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x = int(input())

for i in range(x, 10**5):
    flag = True
    for j in range(2, i):
        if (i % j == 0):
            flag = False
            continue
    if flag:
        print(i)
        break
    else:
        continue
            

Failing test case input:
99992

Expected output:
100003

Actual output:

Fixed submission (verdict: Accepted):
x = int(input())

for i in range(x, 10**5 + 4):
    flag = True
    for j in range(2, i):
        if (i % j == 0):
            flag = False
            continue
    if flag:
        print(i)
        break
    else:
        continue

Problem: p02819
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
X = int(input())
MAX = 10**5+3
num = 2
primes = [0 for _ in range(MAX+1)]

while(num**2 > MAX):
  if primes[num] == 1:
    num += 1
    continue
  i = 2
  while(num*i <= MAX):
    primes[num*i] = 1
    i += 1
while(True):
  if primes[X] == 0:
    print(X)
    exit()
  else:
    X += 1
  
  

Failing test case input:
298

Expected output:
307


Actual output:
298


Fixed submission (verdict: Accepted):
X = int(input())
MAX = 10**5+3
num = 2
primes = [0 for _ in range(MAX+1)]


for num in range(2, int(MAX**0.5)):
  if primes[num] == 1:
    continue
  for i in range(num*2, MAX+1, num):
    primes[i] = 1
for num in range(X, MAX+1):
  if primes[num] == 0:
    print(num)
    exit()

Problem: p02819
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x = int(input())
def is_prime(q):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    return pow(2, q-1, q) == 1
while True:
    if is_prime(x) == False:
        x = x+1
    else:
        break
print(x)

Failing test case input:
341

Expected output:
347


Actual output:
341


Fixed submission (verdict: Accepted):
x = int(input())
def isPrime(n):
  if n < 2:
    
    return False
  if n == 2:
    
    return True
  for p in range(2, n):
      if n % p == 0:
        
        return False
  
  return True

while True:
    if isPrime(x) == False:
        x = x+1
    else:
        break
print(x)
Problem: p02819
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
x = int(input())
if x == 2:
  print(2)
  exit()
  
for i in range(1,1000000):  
  for j in range(2, x+i):
    
    if (x+i) % j == 0:
      break
    if j == x+i-1:
      print(x+i)
      exit()
   

Failing test case input:
433

Expected output:
433


Actual output:
439


Fixed submission (verdict: Accepted):
x = int(input())
if x == 2:
  print(2)
  exit()
  
for i in range(1000000):  
  for j in range(2, x+i):
    
    if (x+i) % j == 0:
      break   
         
    if j == x+i-1:
      print(x+i)
      exit()

Problem: p02819
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
x = int(input())
i = 2
INF = 100001-x
while (i <= x):
    if (x%i == 0 and x != i):
        break
    if (x % i == 0 and x == i):
        print(x)
        sys.exit()
    i += 1

while (x <= INF):
    i = 2
    while(i <= x):
        if (i % 2 == 0):
            i += 1
            continue

        if (x % 2 == 0):
            x += 1
            continue

        if (x % i == 0 and x != i):
            x += 1
            break

        if (x % i == 0 and x == i):
            print(x)
            sys.exit()

        else:
            i += 2

    x += 1

Failing test case input:
99992

Expected output:
100003

Actual output:

Fixed submission (verdict: Accepted):
import sys
x = int(input())
i = 2
INF = 100000000
while (i <= x):
    if (x%i == 0 and x != i):
        break
    if (x % i == 0 and x == i):
        print(x)
        sys.exit()
    i += 1

while (x < INF):
    i = 2
    while(i <= x):
        if (i % 2 == 0):
            i += 1
            continue

        if (x % 2 == 0):
            x += 1
            continue

        if (x % i == 0 and x != i):
            x += 1
            break

        if (x % i == 0 and x == i):
            print(x)
            sys.exit()

        else:
            i += 2

    x += 1

Problem: p02819
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
if n == 2:
    print(2)
    exit()
for i in range(n+1, 10**6):
    for p in range(2, i):
        if i % p == 0:
            break
        elif i-1 == p:
            print(i)
            exit()

Failing test case input:
431

Expected output:
431


Actual output:
433


Fixed submission (verdict: Accepted):
n = int(input())
if n == 2:
    print(2)
    exit()
for i in range(n, 10**6):
    for p in range(2, i):
        if i % p == 0:
            break
        elif i-1 == p:
            print(i)
            exit()

Problem: p02819
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
X = int(input())
isPrime = False
while not isPrime:
  X += 1
  isPrime = True
  for i in range(2, X):
    if X % i == 0:
      isPrime = False
  if isPrime == True:
    break
print(X)
     

Failing test case input:
433

Expected output:
433


Actual output:
439


Fixed submission (verdict: Accepted):
X = int(input())
isPrime = False
while not isPrime:
  isPrime = True
  for i in range(2, X):
    if X % i == 0:
      isPrime = False
  if isPrime == True:
    break
  X += 1
print(X)
Problem: p02819
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n= int(input())

def isprime(n):
    if (n <= 1) : 
        return False
    if (n <= 3) : 
        return True
    if (n % 2 == 0 or n % 3 == 0) : 
        return False
    i = 5
    while(i * i <= n) : 
        if (n % i == 0 or n % (i + 2) == 0) : 
            return False
        i = i + 6

    return True
def fun(n):
    i = n+1
    while 1:
        if isprime(i):
            break
        i+=1
    return i

print(fun(n))

Failing test case input:
331

Expected output:
331


Actual output:
337


Fixed submission (verdict: Accepted):
n= int(input())

def isprime(n):
    if (n <= 1) : 
        return False
    if (n <= 3) : 
        return True
    if (n % 2 == 0 or n % 3 == 0) : 
        return False
    i = 5
    while(i * i <= n) : 
        if (n % i == 0 or n % (i + 2) == 0) : 
            return False
        i = i + 6

    return True
def fun(n):
    i = n
    while 1:
        if isprime(i):
            break
        i+=1
    return i

print(fun(n))

Problem: p02819
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
X = int(input())

def is_prime(n):
    if n <= 1:
        return False   
    else:
        for i in range(2, n):
            if n%i==0:
                return False
        return True

while is_prime(X)==False:
    X += 1


Failing test case input:
1040

Expected output:
1049


Actual output:

Fixed submission (verdict: Accepted):
X = int(input())

def is_prime(n):
    if n <= 1:
        return False   
    else:
        for i in range(2, n):
            if n%i==0:
                return False
        return True

while is_prime(X)==False:
    X += 1

print(X)

Problem: p02819
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def func(x):
    for i in range(2,x):
        if x%i == 0:
            return -1
    return x

n = int(input())
end = 10**5 + 1
for x in range(n,end):
    tmp = func(x)
    if tmp != -1:
        print(tmp)
        break


Failing test case input:
99992

Expected output:
100003

Actual output:

Fixed submission (verdict: Accepted):
def func(x):
    end = x**0.5
    i = 2
    while(i < end):
        if x%i == 0:
            return False
        i += 1
    return True

n = int(input())
for x in range(n,2*n):
    if func(x):
        print(x)
        break

Problem: p02819
Buggy submission (Python (3.8.2), verdict: Wrong Answer):

import math
x = int(input())


n = [i for i in range(2,2*int(math.sqrt(x))+1)]

for i in n:
    for j in n:
        if j % i == 0 and j/i !=1:
            n.remove(j)
            
while x > 0:
    x +=1
    for i in n:
        if x % i == 0:
            break
    else:
        print(x)
        break


Failing test case input:
433

Expected output:
433


Actual output:
439


Fixed submission (verdict: Accepted):

import math
x = int(input())


n = [i for i in range(2,int(math.sqrt(x))+1)]

for i in n:
    for j in n:
        if j % i == 0 and j/i !=1:
            n.remove(j)
            
while x > 0:
    for i in n:
        if x % i == 0:
            break
    else:
        print(x)
        break
    x+=1
Problem: p02819
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
X = int(input())

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

def main():
  if is_prime(X) == True:
    print(X)
  else:
    return is_prime(X+1)

if __name__ == '__main__':
  main()

Failing test case input:
384

Expected output:
389


Actual output:

Fixed submission (verdict: Accepted):
def is_prime(n):
    if n == 1:
        return False
    for i in range(2,int(n**0.5)+1):
        if n % i == 0:
            return False
    return True

def main(X):
  if is_prime(X) == True:
    print(X)
  else:
    return main(X+1)

if __name__ == '__main__':
  X = int(input())
  main(X)

Problem: p02819
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
X=int(input())
b=X**0.5
if all(X%i!=0 for i in range(2,int(b)+1)):
  X+=1
else:
  print(X)

Failing test case input:
4450

Expected output:
4451


Actual output:
4450


Fixed submission (verdict: Accepted):
X=int(input())
b=X**0.5
while any(X%i==0 for i in range(2,int(b)+1)):
  X+=1
else:
  print(X)

Problem: p02819
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def func(x):
    end = x**0.5
    i = 2
    while(i < end):
        if x%i == 0:
            return -1
        i += 1
    return x

n = int(input())
end = 10**5 + 1
for x in range(n,end):
    tmp = func(x)
    if tmp != -1:
        print(tmp)
        break

Failing test case input:
99992

Expected output:
100003

Actual output:

Fixed submission (verdict: Accepted):
def func(x):
    end = x**0.5
    i = 2
    while(i < end):
        if x%i == 0:
            return False
        i += 1
    return True

n = int(input())
for x in range(n,2*n):
    if func(x):
        print(x)
        break

Problem: p02819
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x = int(input())
 
while True:
    
    for i in range(2, int(x**0.5)+1):
        print(i)
        if x % i == 0:
            break 
    else:
        print(x)
        break 
    x += 1

Failing test case input:
1267

Expected output:
1277


Actual output:
2
3
4
5
6
7
2
2
3
2
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
2
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2
2
3
2
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
1277


Fixed submission (verdict: Accepted):
x = int(input())
 
while True:
    
    for i in range(2, int(x**0.5)+1):
        
        if x % i == 0:
            break 
    else:
        print(x)
        break 
    x += 1
Problem: p02819
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x=int(input())
import math

def is_prime(n):
    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False
    return True
for i in range(x,10**5):
  if is_prime(i)==True:
    print(i)
    exit()
  

Failing test case input:
99992

Expected output:
100003

Actual output:

Fixed submission (verdict: Accepted):
x=int(input())
import math

def is_prime(n):
    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False
    return True
for i in range(x,10**6):
  if is_prime(i)==True:
    print(i)
    exit()

Problem: p02819
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x = int(input())

import math

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

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True

if x==2:
    print(2)
elif x%2==0:
    for i in range(1,100,2):
        if is_prime(x+i):
            print(x+i)
            exit()
        else:
            pass
else:
    for i in range(2,100,2):
        if is_prime(x+i):
            print(x+i)
            exit()
        else:
            pass

Failing test case input:
331

Expected output:
331


Actual output:
337


Fixed submission (verdict: Accepted):
x = int(input())

import math

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

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True

if x==2:
    print(2)
elif x%2==0:
    for i in range(1,10000,2):
        if is_prime(x+i):
            print(x+i)
            exit()
        else:
            pass
else:
    for i in range(0,10000,2):
        if is_prime(x+i):
            print(x+i)
            exit()
        else:
            pass

Problem: p02819
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x = int(input())

cad = x

def is_prime(n):
    for i in range(2, n + 1):
        if i * i > n:
            break
        if n % i == 0:
            return False
    return n != 1
    
while True:
    cad += 1
    flag = is_prime(cad)
    if flag:
        print(cad)
        break
    

Failing test case input:
331

Expected output:
331


Actual output:
337


Fixed submission (verdict: Accepted):
x = int(input())

cad = x

def is_prime(n):
    for i in range(2, n + 1):
        if i * i > n:
            break
        if n % i == 0:
            return False
    return n != 1
    
while True:
    
    flag = is_prime(cad)
    if flag:
        print(cad)
        break
    cad += 1

Problem: p02819
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def is_prime(n):
    if n == 1:
        return False
    for i in range(2,int(n**0.5)+1):
        if n % i == 0:
            return False
    return True
  
n = int(input())
while True:
  n += 1
  if is_prime(n):
    print(n)
    exit()  

Failing test case input:
433

Expected output:
433


Actual output:
439


Fixed submission (verdict: Accepted):
def is_prime(n):
  for i in range(2,int(n**0.5)+1):
    if n % i == 0:
      return False
  return True
  
n = int(input())
while True:
  if is_prime(n):
    print(n)
    exit()
  n += 1
Problem: p02819
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
X=int(input())
count = 0

for i in range(100000):
    for j in range(1,X):
        if X % j == 0:
            count = count + 1
            break
    if count == 0:
        break
    count = 0
    X = X + 1

print(X)

Failing test case input:
777

Expected output:
787


Actual output:
100777


Fixed submission (verdict: Accepted):

X = int(input())
count = 0


for i in range(100000):
    for j in range(2,X):
        if X % j == 0:
            count = count + 1
            break
    if count == 0:
        break
    count = 0
    X = X + 1

print(X)

Problem: p02819
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math


def is_prme_number(num):
    if num == 1:
        return False

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

    return True


def main():
    x = int(input())
    while True:
        x += 1
        if is_prme_number(x):
            break
    print(x)


if __name__ == '__main__':
    main()


Failing test case input:
997

Expected output:
997


Actual output:
1009


Fixed submission (verdict: Accepted):
import math


def is_prme_number(num):
    if num == 1:
        return False

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

    return True


def main():
    x = int(input())
    while True:
        if is_prme_number(x):
            break
        x += 1
    print(x)


if __name__ == '__main__':
    main()

Problem: p02819
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
p = int(input())
n = 3*p
primes = set(range(2, n+1))
for i in range(2, int(n**0.5+1)):
    primes.difference_update(range(i*2, n+1, i))
primes=list(primes)
for i in primes:
    if i >= p:
        print(i)
        break

Failing test case input:
856

Expected output:
857


Actual output:
2053


Fixed submission (verdict: Accepted):
p = int(input())
n = 2*p
primes = set(range(2, n+1))
for i in range(2, int(n**0.5+1)):
    primes.difference_update(range(i*2, n+1, i))
primes=list(primes)
primes.sort()

for i in primes:
    if i >= p:
        print(i)
        break

Problem: p02819
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x = int(input())
is_prime = False

while True:
    if x == 2:
        is_prime = True
        break
    for i in range(2, x):
        if x % i == 0:
            is_prime = False
            break
        else:
            is_prime = True
    if is_prime == False:
        x += 1
    else:
        break

Failing test case input:
777

Expected output:
787


Actual output:

Fixed submission (verdict: Accepted):
x = int(input())
is_prime = False

while True:
    if x == 2:
        is_prime = True
        break
    for i in range(2, x):
        if x % i == 0:
            is_prime = False
            break
        else:
            is_prime = True
    if is_prime == False:
        x += 1
    else:
        break
print(x)
Problem: p02819
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x=int(input())
if x==2:
  print(2)
  exit()

for i in range(x+1,x*10):
  for j in range(2,int(x**0.5)+1):
    if i%j==0:
      break
  else:
    print(i)
    exit()


Failing test case input:
577

Expected output:
577


Actual output:
587


Fixed submission (verdict: Accepted):
x=int(input())
if x==2:
  print(2)
  exit()

for i in range(x,x*100):
  for j in range(2,int(x**0.5)+2):
    if i%j==0:
      break
  else:
    print(i)
    exit()

Problem: p02819
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
X = int(input())

if X == 2:
  print(2)
  exit()
  
hajime = X

if hajime % 2 == 0:
  hajime += 1
  
checkMax = math.ceil(math.sqrt(hajime))
for i in range(hajime, 1000000, 2):
  for j in range(2, checkMax + 1):
    if i % j == 0:
      print(i)
      exit()
 

Failing test case input:
433

Expected output:
433


Actual output:
435


Fixed submission (verdict: Accepted):
import math
X = int(input())
 
if X == 2:
  print(2)
  exit()
  
hajime = X
 
if hajime % 2 == 0:
  hajime += 1
checkMax = math.ceil(math.sqrt(hajime))
for i in range(hajime, 1000000, 2):
  goseisu = False
  for j in range(2, checkMax + 1):
    if i % j == 0:
      goseisu = True
      break
  if not goseisu:
    print(i)
    exit()

Problem: p02819
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import math
a = int(input())
b = int(math.sqrt(a)) +1

for k in range(1,20000):
    count = 0
    for i in range(2,b):
        if (a+k) % i == 0:
            count +=1
    if count == 0:
        print(a+k)
        break

Failing test case input:
4751

Expected output:
4751


Actual output:
4759


Fixed submission (verdict: Accepted):
import math
a = int(input())
b = int(math.sqrt(a)) +1

for k in range(200000):
    count = 0
    for i in range(2,b):
        if (a+k) % i == 0:
            count +=1
    if count == 0:
        print(a+k)
        break

Problem: p02819
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n = 100000
primes = set(range(2, n+1))
for i in range(2, int(n**0.5+1)):
    primes.difference_update(range(i*2, n+1, i))
primes=list(primes)
x=int(input())
for i in primes:
    if i>=x:
        print(i)
        exit()


Failing test case input:
99992

Expected output:
100003

Actual output:

Fixed submission (verdict: Accepted):
n = 200000
primes = set(range(2, n+1))
for i in range(2, int(n**0.5+1)):
    primes.difference_update(range(i*2, n+1, i))
primes=list(primes)
x=int(input())
for i in primes:
    if i>=x:
        print(i)
        exit()

Problem: p02819
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
X = int(input())
X = X + 1
prime = None
while True:
    for i in range(2, X):
        if X % i == 0:
            break
    else:
        prime = X
    if prime != None:
        break
    else:
        X += 1

print(X)

Failing test case input:
4751

Expected output:
4751


Actual output:
4759


Fixed submission (verdict: Accepted):
X = int(input())
prime = None
while True:
    for i in range(2, X):
        if X % i == 0:
            break
    else:
        prime = X
    if prime != None:
        break
    else:
        X += 1

print(prime)
Problem: p02819
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math

P_lst=[2]
for i in range(1000):
  flag=0
  for j in P_lst:
    if (i+3)%j==0:
      flag=1

  if flag==0:
    P_lst.append(i+3)

X=int(input())

while X<=100000:
  flag=0
  x=math.sqrt(X)
  for k in P_lst:
    if X%k==0:
      break
    if x<k:
      flag=1
      break
  if flag==1:
    print(X)
    break
  X=X+1

Failing test case input:
99992

Expected output:
100003

Actual output:

Fixed submission (verdict: Accepted):
import math

P_lst=[2]
for i in range(1000):
  flag=0
  for j in P_lst:
    if (i+3)%j==0:
      flag=1

  if flag==0:
    P_lst.append(i+3)

X=int(input())

while X<=200000:
  if X==2:
    print(2)
    break
  flag=0
  x=math.sqrt(X)
  for k in P_lst:
    if X%k==0:
      break
    if x<k:
      flag=1
      break
  if flag==1:
    print(X)
    break
  X=X+1

Problem: p02819
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def is_prime(q):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    return pow(2, q-1, q) == 1

a = int(input())

while(True):
    if is_prime(a):
        print(a)
        break
    else:
        a += 1

Failing test case input:
341

Expected output:
347


Actual output:
341


Fixed submission (verdict: Accepted):

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

a = int(input())

while(True):
    if is_prime(a):
        print(a)
        break
    a += 1

Problem: p02819
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def is_prime(q):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q & 1 == 0: return False
    return pow(2, q - 1, q) == 1


def main():
    X = int(input())

    while True:
        if is_prime(X):
            print(X)
            break

        if X % 2 == 0:
            X += 1
        else:
            X += 2


main()


Failing test case input:
341

Expected output:
347


Actual output:
341


Fixed submission (verdict: Accepted):
import math


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

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True


def main():
    X = int(input())

    while True:
        if is_prime(X):
            print(X)
            break

        X += 1


main()
Problem: p02819
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

import math

X = int(input())


def isPrime(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 += 2    
    return True

for i in range(X+1,10**5):
    if isPrime(i):
        print(i)
        break


    



Failing test case input:
4751

Expected output:
4751


Actual output:
4759


Fixed submission (verdict: Accepted):

import math

X = int(input())


def isPrime(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 += 2    
    return True

for i in range(X,10**10):
    if isPrime(i):
        print(i)
        break

Problem: p02819
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())

while(True):
    flag = True
    n += 1
    for i in range(2, n):
        if n % i == 0:
            flag = False
            break
    if flag:
        break

print(n)


Failing test case input:
431

Expected output:
431


Actual output:
433


Fixed submission (verdict: Accepted):
n = int(input())

while(True):
    flag = True
    for i in range(2, n):
        if n % i == 0:
            flag = False
            break
    if flag:
        break
    n += 1

print(n)

Problem: p02819
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
X = int(input())

def prime(n):
  for i in range(2, int(X**0.5)+1):
    if X%i == 0:
      return 0
    return 1

    
k = 1
while k:
  if prime(X):
    print(X)
    k -= 1
  else:
    X += 1

Failing test case input:
1154

Expected output:
1163


Actual output:
1155


Fixed submission (verdict: Accepted):
X = int(input())

def prime(n):
  for i in range(2, int(n**0.5)+1):
    if n%i == 0:
      return 0
  return 1

    
while prime(X)==0:
  X += 1
print(X)

Problem: p02819
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x = int(input())

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

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

    return True


def func(x):
    if is_prime(x):
        return x
    else:
        for i in range(x+1, 10**5+100, 2):
            if is_prime(i):
                return i

print(func(x))


Failing test case input:
2425

Expected output:
2437


Actual output:
None


Fixed submission (verdict: Accepted):
x = int(input())

def is_prime(x):
    if x % 2 == 0:
        return False

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

    return True


def func(x):
    if is_prime(x):
        return x
    else:
        if x % 2 == 0:
            for i in range(x+1, 10**5+100, 2):
                
                if is_prime(i):
                    return i

        else:
            for i in range(x, 10**5+100, 2):
                
                if is_prime(i):
                    return i




if x == 2:
    print(x)
else:
    print(func(x))
Problem: p02819
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from math import sqrt

x = int(input()) - 1
pnums = []
if x >= 4:
    for i in range(2, int(sqrt(x))+1):
        for j in pnums:
            if i % j == 0:
                break
        else:    
            pnums.append(i)

while True:
    x += 1
    x_sqrt = sqrt(x)
    if x_sqrt.is_integer():
        pnums.append(x_sqrt)
        break
    
    for a in pnums:
        if x % a == 0:
            break
    else:
        print(x)
        break


Failing test case input:
1154

Expected output:
1163


Actual output:

Fixed submission (verdict: Accepted):
from math import sqrt

x = int(input()) - 1
pnums = []
if x >= 4:
    for i in range(2, int(sqrt(x))+1):
        for j in pnums:
            if i % j == 0:
                break
        else:    
            pnums.append(i)

while True:
    x += 1
    x_sqrt = sqrt(x)
    if x_sqrt.is_integer():
        pnums.append(x_sqrt)
        continue
    
    for a in pnums:
        if x % a == 0:
            break
    else:
        print(x)
        break

Problem: p02819
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
input = sys.stdin.readline

X = int(input())
Num = X+1

while any(Num%i==0 for i in range(2,Num)):
    Num += 1

print(Num)

Failing test case input:
331

Expected output:
331


Actual output:
337


Fixed submission (verdict: Accepted):
import sys
input = sys.stdin.readline

X = int(input())
Num = X

while any(Num%i==0 for i in range(2,Num)):
    Num += 1

print(Num)

Problem: p02819
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from bisect import bisect_left

def get_primes(n):
    if not isinstance(n, int):
        raise TypeError('n is int-type.')
    if n < 2:
        raise ValueError('n is more than 2')
    
    from math import sqrt 
    def _sieve_of_eratosthenes(n):
        primes = []
        limit = sqrt(n)
        data = [i + 1 for i in range(1, n)]
        while True:
            p = data[0]
            if limit <= p:
                return primes + data
            primes.append(p)
            data = [e for e in data if e % p != 0]
    return _sieve_of_eratosthenes(n)

primes = get_primes(10**5 + 3)
print(primes[bisect_left(primes, int(input())+1)])

Failing test case input:
577

Expected output:
577


Actual output:
587


Fixed submission (verdict: Accepted):
from bisect import bisect_left, bisect_right

def get_primes(n):
    if not isinstance(n, int):
        raise TypeError('n is int-type.')
    if n < 2:
        raise ValueError('n is more than 2')
    
    from math import sqrt 
    def _sieve_of_eratosthenes(n):
        primes = []
        limit = sqrt(n)
        data = [i + 1 for i in range(1, n)]
        while True:
            p = data[0]
            if limit <= p:
                return primes + data
            primes.append(p)
            data = [e for e in data if e % p != 0]
    return _sieve_of_eratosthenes(n)

primes = get_primes(10**5 + 3)
print(primes[bisect_left(primes, int(input()))])
Problem: p02819
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
limit = 100000
import math
def resolve():
    N = int(input())
    for k in range(N, limit+1):
        factor = 0
        if k % 2 == 0 and k != 2:
            continue
        for divisor in range(2, math.floor(math.sqrt(k))+1):
            if k % divisor == 0:
                factor += 1
        if factor == 0:
                return k
print(resolve())

Failing test case input:
99992

Expected output:
100003

Actual output:
None


Fixed submission (verdict: Accepted):
limit = 100003
import math
def resolve():
    N = int(input())
    for k in range(N, limit+1):
        factor = 0
        if k % 2 == 0 and k != 2:
            continue
        for divisor in range(2, math.floor(math.sqrt(k))+1):
            if k % divisor == 0:
                factor += 1
        if factor == 0:
                return k
print(resolve())

Problem: p02819
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
X = int(input())

def is_prime(n):
    for i in range(2, n + 1):
        if i * i > n:
            break
        if n % i == 0:
            return False
    return n != 1
  
for i in range(X+1, 10 ** 7):
  if is_prime(i):
    print(i)
    break

Failing test case input:
433

Expected output:
433


Actual output:
439


Fixed submission (verdict: Accepted):
X = int(input())

def is_prime(n):
    for i in range(2, n + 1):
        if i * i > n:
            break
        if n % i == 0:
            return False
    return n != 1
  
for i in range(X, 10 ** 7):
  if is_prime(i):
    print(i)
    break

Problem: p02819
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
X = int(input())

while True:
    
    flag = 0
    
    for i in range(2, X+1): 
        if (X+1) % i == 0: 
            flag = 1
            break
    if flag == 1:
        X += 1
        continue
    break
    
print(X + 1)

Failing test case input:
433

Expected output:
433


Actual output:
439


Fixed submission (verdict: Accepted):
X = int(input())

while True:
    
    flag = 0
    
    for i in range(2, X): 
        if X % i == 0: 
            flag = 1
            break
    if flag == 1:
        X += 1
        continue
    break
    
print(X)

Problem: p02819
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
def is_prime(N):
    if N == 1:
      return False
    for k in range(2, int(math.sqrt(N))+1):
      if N % k == 0:
          return False
    return True
  
x = int(input())
for i in range(x+1, 2*10**7):
  if is_prime(i):
    print(i)
    exit()

Failing test case input:
431

Expected output:
431


Actual output:
433


Fixed submission (verdict: Accepted):
import math
def is_prime(N):
    if N == 1:
      return False
    for k in range(2, int(math.sqrt(N))+1):
      if N % k == 0:
          return False
    return True
  
x = int(input())
while True:
  if is_prime(x):
    print(x)
    exit()
  x += 1
Problem: p02819
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
import sys

m=10**9 + 7 
sys.setrecursionlimit(1000010)
INF=10**9


[X]  = list(map(int,input().split()))


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


def primes(n):
    ass = []
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 2):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    for i in range(len(is_prime)):
        if is_prime[i]:
            ass.append(i)
    return ass

for i in range(X+1,INF):
    if is_prime(i):
        print(i)
        exit(0)
print(-1)

Failing test case input:
433

Expected output:
433


Actual output:
439


Fixed submission (verdict: Accepted):
import math
import sys

m=10**9 + 7 
sys.setrecursionlimit(1000010)
INF=10**9


[X]  = list(map(int,input().split()))


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


def primes(n):
    ass = []
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 2):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    for i in range(len(is_prime)):
        if is_prime[i]:
            ass.append(i)
    return ass

for i in range(X,INF):
    if is_prime(i):
        print(i)
        exit(0)
print(-1)

Problem: p02819
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import math
X = int(input())
if X == 2 or X == 3:
    print(X)
    exit()
while True:
    X += 1
    p = True
    for i in range(2, int(math.sqrt(X) + 1)):
        if math.gcd(X, i) > 1:
            p = False
            break
    if p == True:
        print(X)
        exit()

Failing test case input:
331

Expected output:
331


Actual output:
337


Fixed submission (verdict: Accepted):
import math
X = int(input())
if X == 2 or X == 3:
    print(X)
    exit()
while True:
    p = True
    for i in range(2, int(math.sqrt(X) + 1)):
        if math.gcd(X, i) > 1:
            p = False
            break
    if p == True:
        print(X)
        exit()
    X += 1

Problem: p02819
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x=int(input())
ans=x
cnt=0
while cnt==0:
	cnt=1
	ans+=1
	for i in range(2,ans):
		if ans%i==0:
			cnt=0
print(ans)

Failing test case input:
431

Expected output:
431


Actual output:
433


Fixed submission (verdict: Accepted):
x=int(input())
ans=x-1
cnt=0
while cnt==0:
	cnt=1
	ans+=1
	for i in range(2,ans):
		if ans%i==0:
			cnt=0
print(ans)
Problem: p02819
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x = int(input())
n=2
x += 1
while n<x:
    if x % n == 0:
        x += 1
        n = 2
    else:
        n+=1
print(x)

Failing test case input:
433

Expected output:
433


Actual output:
439


Fixed submission (verdict: Accepted):
x = int(input())
n = 2
while n<x:
    if x % n == 0:
        x += 1
        n = 2
    else:
        n+=1
print(x)

Problem: p02819
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
def is_prime(q):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    return pow(2, q-1, q) == 1
  
x=int(input())
while True:
  x+=1
  if is_prime(x)==True:
    break
print(x)

Failing test case input:
431

Expected output:
431


Actual output:
433


Fixed submission (verdict: Accepted):
def is_prime(n):
  if n == 1:
    return True
  for i in range(2,int(n**0.5) + 1):
    if n % i == 0:
      return False
  return True

x=int(input())
while True:
  if is_prime(x)==True:
    break
  x+=1
print(x)

Problem: p02819
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x = int(input())


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


def next_prime(n):
    if n <= 1:
        return 2
    prime = n
    found = False
    while not found:
        prime = prime + 1
        if is_prime(prime):
            found = True

    return prime


print(next_prime(x))


Failing test case input:
433

Expected output:
433


Actual output:
439


Fixed submission (verdict: Accepted):
x = int(input())


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


def next_prime(n):
    if n <= 1:
        return 2
    prime = n
    found = False
    while not found:
        prime = prime + 1
        if is_prime(prime):
            found = True

    return prime


if is_prime(x):
    print(x)
else:
    print(next_prime(x))

Problem: p02819
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
x = int(input())
for i in range(x+1,100005):
    c = 0
    for j in range(1,i+1):
        if i%j != 0:
            c += 1
    if c == i-2:
        print(i)
        sys.exit()

Failing test case input:
577

Expected output:
577


Actual output:
587


Fixed submission (verdict: Accepted):
import sys
x = int(input())
for i in range(x,10**6):
    a = i-2
    c = 0
    for j in range(2,i):
        if i % j != 0:
            c += 1
    if a == c:
        print(i)
        sys.exit()

Problem: p02819
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x = int(input())
ps = set(range(x + 1, 4 * x + 1))
for i in range(2, x+1):
    for j in range(0, 4 * x + 1, i):
        if j in ps:
            ps.remove(j)
print(min(ps))


Failing test case input:
997

Expected output:
997


Actual output:
1009


Fixed submission (verdict: Accepted):
x = int(input())
ps = set(range(x, 4 * x + 1))
for i in range(2, x):
    for j in range(0, 4 * x + 1, i):
        if j in ps:
            ps.remove(j)
print(min(ps))
Problem: p02819
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

inputA = int(input())

inputA = 99992
flag = 0
for count in range(inputA+1,300000):
    for mod in range(2,200000):
        if count % mod == 0:
            flag = mod
            break
        mod += 1
    if count == flag:
        print(count)
        break
    else:
        count += 1


Failing test case input:
431

Expected output:
431


Actual output:
100003


Fixed submission (verdict: Accepted):

inputA = int(input())

flag = 0
for count in range(inputA,300000):

    for mod in range(2,200000):
        if count % mod == 0:
            flag = mod
            break
        mod += 1
    if count == flag:
        print(count)
        break
    elif flag == 0:
        print(inputA)
    else:
        count += 1

Problem: p02819
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
n = int(input())
primes = [2]
def is_prime(k):
    for p in primes:
        if k % p == 0:
            return False
        if k <= p*p:
            break
    return True


for i in range(3, 1000000 + 100, 2):
    if is_prime(i):
        primes.append(i)
        if i > n:
            print(i)
            break


Failing test case input:
433

Expected output:
433


Actual output:
439


Fixed submission (verdict: Accepted):
n = int(input())
primes = []
def is_prime(k):
    if k < 2:
        return False
    if k == 2:
        return True
    for p in primes:
        if k % p == 0:
            return False
        if k <= p*p:
            break
    return True


for i in range(1000000 + 100):
    if is_prime(i):
        primes.append(i)
        if i >= n:
            print(i)
            break

Problem: p02819
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
X = int(input())
E = [1] * (2 * X)
for i, e in enumerate(E):
  if i < 1:
    continue
  if e < 1:
    continue
  for j in range(2 * i, 2 * X, i):
    E[j] = 0
for i, e in enumerate(E):
  if i < X:
    continue
  if e < 1:
    continue
  print(i)
  break

Failing test case input:
99992

Expected output:
100003

Actual output:

Fixed submission (verdict: Accepted):
X = int(input())
E = [1] * (2 * X)
for i, e in enumerate(E):
  if i < 2:
    continue
  if e < 1:
    continue
  for j in range(2 * i, 2 * X, i):
    E[j] = 0
for i, e in enumerate(E):
  if i < X:
    continue
  if e < 1:
    continue
  print(i)
  break

Problem: p02819
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x = int(input())
ps = set(range(x + 1, 2 * x + 1))
for i in range(2, x+1):
    for j in range(0, 3 * x, i):
        if j in ps:
            ps.remove(j)
print(min(ps))


Failing test case input:
577

Expected output:
577


Actual output:
587


Fixed submission (verdict: Accepted):
x = int(input())
ps = set(range(x, 4 * x + 1))
for i in range(2, x):
    for j in range(0, 4 * x + 1, i):
        if j in ps:
            ps.remove(j)
print(min(ps))