Problem:


Score: 300 points

Problem Statement

Find the minimum prime number greater than or equal to X.

Notes

A prime number is an integer greater than 1 that cannot be evenly divided by any positive integer except 1 and itself.

For example, 2, 3, and 5 are prime numbers, while 4 and 6 are not.

Constraints

 2 \le X \le 10^5 

All values in input are integers.

Input

Input is given from Standard Input in the following format:

X

Output

Print the minimum prime number greater than or equal to X.

Sample Input 1

20

Sample Output 1

23

The minimum prime number greater than or equal to 20 is 23.

Sample Input 2

2

Sample Output 2

2

X itself can be a prime number.

Sample Input 3

99992

Sample Output 3

100003



Sample input:
20


Sample output:
23

Submission status: Wrong Answer

Solution code:
X = int(input())
ans = X
flag = True
while flag == True:
    flag = False
    ans += 1
    for i in range(2, ans):
        if ans % i == 0:
            flag = True
            break
print(ans)

Submission status: Wrong Answer

Solution code:
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)

Submission status: Wrong Answer

Solution code:
X = int(input())
while True:
    N = int(X**0.5)
    for i in range(1,N):
        if X % (i+1) == 0:
            break
        else:
          if i == N - 1:
            print(X)
            exit()
    X += 1

Submission status: Wrong Answer

Solution code:
from math import sqrt
def judge(num):
    if num <= 2:
        return False
    elif num == 2:
        return True
    elif num % 2 == 0:
        return False
    else:
        for i in range(3,int(sqrt(num))+1,2):
            if num % i == 0:
                return False
        return True
s = int(input()) 
while(1):
    if judge(s):
        print(s)
        break
    else:
        s += 1

Submission status: Wrong Answer

Solution code:
from math import sqrt
def judge(num):
    if num <= 2:
        return False
    elif num % 2 == 0:
        return False
    else:
        for i in range(3,int(sqrt(num))+1,2):
            if num % i == 0:
                return False
        return True
s = int(input()) 
while(1):
    if judge(s):
        print(s)
        break
    else:
        s += 1

Submission status: Wrong Answer

Solution code:

X = int(input())

flg = 1
ans = 0
print(10**5)
for i in range(X, 10**100):
    flg = 1
    for j in range(2, i):
        if i % j == 0:
            flg = 0
            break
    if flg == 1:
        ans = i
        break

print(ans)

Submission status: Wrong Answer

Solution code:
x = int(input());

for i in range(x + 1, 10**6):
  for k in range(2, i):
    if i % k != 0: #割り切れない
      continue;
    else: #割り切れた
      break;
  else:
    break;
  
print(i)

Submission status: Wrong Answer

Solution code:
X=int(input())
Y=[i for i in range(100005)]
for j in range(2,333):
  k=100004 // j  
  for a in range(2,k):
    Y[a*j] = 0 
b=X
while True:
  if Y[b] != 0:
    print(b)
    break
  else:
    b += 1

Submission status: Wrong Answer

Solution code:
n=int(input())
p=[i for i in range(3,n+1,2)]
p=[2]+p
prime=[2]
std=[True]*(n+1)
for i in p:
  if std[i]:
    if i%prime[-1]!=0:
      prime.append(i)
      for j in range(n//i):
        std[i*j]=False
  else:
    continue
if n in prime:
  print(n)
else:
  for i in range(n):
    t=n+i
    for j in prime:
      if t%j==0:
        break
    else:
      print(n+i)
      break

Submission status: Wrong Answer

Solution code:
n=int(input())
p=[i for i in range(3,n+1,2)]
p=[2]+p
prime=[2]
std=[True]*(n+1)
for i in p:
  if std[i]:
    if i%prime[-1]!=0:
      prime.append(i)
      for j in range(n//i):
        std[i*j]=False
  else:
    continue
    
for i in range(n):
  t=n+i
  for j in prime:
    if t%j==0:
      break
  else:
    print(n+i)
    break

Submission status: Wrong Answer

Solution code:
X=int(input())
flag=False
i=X
while flag==False:
    flag_2=True
    for j in range(2,2+int(i**0.5)):
        if i%j==0:
            flag_2=False
    if flag_2==True:
        ans=i
        flag=True
    i+=1
print(ans)

Submission status: Wrong Answer

Solution code:
X=int(input())
if X==2:
  print(X)
if X%2==0:
  X+=1
flag=0
while flag==0:
  if all(X%i!=0 for i in range(3,X-1,2)):
    flag=1
  else:
    X+=2
print(X)

Submission status: Wrong Answer

Solution code:
def is_prime2(q,k=100):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    for i in xrange(3,k):
        x,y = q,i
        while y:
            x, y =  y, x % y
        if x != 1: continue
        if pow(i, q-1, q) != 1:
            return False
    return True

Submission status: Wrong Answer

Solution code:
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
flag=False
while(flag==False):
    if is_prime(X):
        print(X)
        flag=True
        break
    X+=1

Submission status: Wrong Answer

Solution code:
from itertools import permutations as perm
from collections import deque, Counter as cnt
from collections import defaultdict as dd
from operator import itemgetter as ig
from bisect import bisect_right as bsr
from math import factorial, ceil, floor
import sys
sys.setrecursionlimit(1000000)

# お約束
args = None
INF = float("inf")
MOD = int(1e9 + 7)


def input(*ps):
    if type(ps[0]) is list:
        return [input(*ps[0][:-1]) for _ in range(ps[0][-1])]
    elif len(ps) == 1:
        return ps[0](next(args))
    else:
        return [p(next(args)) for p in ps]


def nlist(n, v):
    if not n:
        return [] if type(v) is list else v
    return [nlist(n[1:], v) for _ in range(n[0])]


def yesno(v, yes="Yes", no="No", upper=False):
    if upper:
        print([yes.upper(), no.upper()][not v])
    else:
        print([yes, no][not v])


def is_prime(v):
    """素数"""
    if v <= 1:
        return False
    if v % 2 == 0:
        return False
    for x in range(3, ceil(v ** 0.5), 2):
        if v % x == 0:
            return False
    return True


def main():
    """エントリーポイント"""
    N = input(int)
    for x in range(N, 100003 + 1):
        if is_prime(x):
            print(x)
            break


if __name__ == '__main__':
    args = iter(sys.stdin.read().split())
    main()

Submission status: Wrong Answer

Solution code:
import math
X=int(input())
if X==2:
    print(2)
else:
    n=1
    while n==1:
        for j in range(2,int(math.sqrt(X))+1):
            if j==int(math.sqrt(X)) and X%j!=0:
                n=0
                print(X)
            elif X%j==0:
                X+=1
                exit()

Submission status: Wrong Answer

Solution code:
x = int(input())

for p in range(2, x):
    if x % p == 0:
      x += 1
print(x)

Submission status: Wrong Answer

Solution code:
def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, n + 1):
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]
x=int(input())
l=primes(100010)
for i in range(len(l)):
  if l[i]>x:
    print(l[i])
    exit()

Submission status: Wrong Answer

Solution code:
n = int(input())
m = n
while True:
  for i in range(2,int(m**0.5)+1):
    if m %i == 0:
      break
    elif i > int(m**0.5)-1:
      print(m)
      exit()
  m += 1

Submission status: Wrong Answer

Solution code:
import math
x = int(input())
acount = 0
while acount == 0:
    x += 1
    rootx = int(math.sqrt(x))
    for i in range(2,rootx+1):
        count = 0
        if x % i == 0:
            break
        else:
            count += 1
        if count == rootx-1:
            acount += 1
            break
print(x)

Submission status: Wrong Answer

Solution code:
def eratosthenes(n):
    l = [i for i in range(2, int(n ** 0.5) + 1)]
    for i in range(2, int(n ** 0.5) + 1):
        l = [j for j in l if j % i != 0 or i == j]
    return l

x = int(input())
l = eratosthenes(2 * 10 ** 5)
for i in l:
    if x <= i:
        print(i)
        exit()

Submission status: Wrong Answer

Solution code:
x=int(input())

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

for i in range(x,100004):
  if is_prime(i)==False:
    pass
  else:
    print(i)
    break

Submission status: Wrong Answer

Solution code:
x=int(input())

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

for i in range(x,10004):
  if is_prime(i)==False:
    pass
  else:
    print(i)
    break

Submission status: Wrong Answer

Solution code:
x=int(input())

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

for i in range(x,10004):
  if is_prime(i):
    print(i)
    break
  else:
    i+=1

Submission status: Wrong Answer

Solution code:
x=int(input())

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

for i in range(x,10004):
  if is_prime(i):
    print(i)
    break

Submission status: Wrong Answer

Solution code:
x=int(input())
for i in range(x,100004):
    for j in range(2,int(i**(1/2))+2):
        if i%j==0:
            break
        if j==int(i**(1/2))+1:
            print(i)
            exit()

Submission status: Wrong Answer

Solution code:
import math
X = int(input())

# lists = []
# for i in range(2, 100001):
#     count = 0
#     for j in range(2, i+1):
#         if i % j == 0:
#             count += 1
#     if count == 1:
#         lists.append(i)
# print(lists)
#
# max_lists = []
# for i in lists:
#     if i >= X:
#         max_lists.append(i)
#
# print(max_lists)
# print(min(max_lists))


# ----エラトステネスの篩--------

def get_prime_number(number):
    prime_list = []

    search_list = list(range(2, number + 1))

    while True:
        if search_list[0] > math.sqrt(number):
            prime_list.extend(search_list)
            break

        else:
            head_num = search_list[0]
            prime_list.append(head_num)

            search_list.pop(0)
            search_list = [num for num in search_list if num % head_num != 0]

    return prime_list


lists = get_prime_number(110000)
max_list = []
for i in lists:
    if i >= X:
        max_list.append(i)

Submission status: Wrong Answer

Solution code:
X=int(input())

for i in range(X+1,X*2):
    ok=0
    for j in range(2,i):
        if i%j == 0:
            ok += 1
    if ok == 0:
        print(i)
        break

Submission status: Wrong Answer

Solution code:
import math

def is_prime(n):
    ok = True
    for i in range(2, math.ceil(math.sqrt(n))+1):
        if n%i == 0:
            ok = False
    return ok

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

Submission status: Wrong Answer

Solution code:
x = int(input())
def primes(n):
    is_prime = [True] * (n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2,int(n**0.5) + 1):
        # 既にfalseになってたらスキップ
        if not is_prime[i]:
            continue
        for j in range(i*2, n+1, i):
            is_prime[j] = False
    return [i for i in range(n+1) if is_prime[i]]
prime_ls = primes(10**5 + 3)

r = len(prime_ls)- 1
l = 0
while r - l > 1:
    m = (r + l) // 2
    if prime_ls[m] >= x:
        r = m
    else:
        l = m
print(prime_ls[r])

Submission status: Wrong Answer

Solution code:
import math
x = int(input())
while True:
    ok = True
    for j in range(2, int(math.sqrt(x+1)+2)+2):
        if x % j == 0:
            ok = False
    if ok:
        print(x)
        exit() 
    x += 1

Submission status: Wrong Answer

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

x = int(input())
q = 0
while q < 100000:
    if ifPrine(x+q) == False:
        print(x+q)
        break
    else:
        q += 1

Submission status: Wrong Answer

Solution code:
x = int(input())
pr = [2]
for i in range(3,10**5,2):
    fr = 0
    for j in pr:
        if i % j == 0:
            fr += 1
            break
    if fr == 0:
        if i >= x:
            print(i)
            break
        pr.append(i)

Submission status: Wrong Answer

Solution code:
from math import sqrt
x = int(input())
i = x
while i:
    for j in range(2, int(sqrt(i) + 1)):
        if i % j == 0:
            i += 1
            continue
    i += 1
    print(i)
    exit()

Submission status: Wrong Answer

Solution code:
import math
import sys

def eratosthenes(limit):
    A = [i for i in range(2, limit+1)]
    P = []
    time = 0
    
    while True:
        prime = min(A)
        
        if prime > math.sqrt(limit):
            break
            
        P.append(prime)
            
        i = 0
        while i < len(A):
            if A[i] % prime == 0:
                A.pop(i)
                continue
            i += 1
            
    for a in A:
        P.append(a)
            
    return P

X = int(input())
for i in eratosthenes(100003):
    if i > X:
        print(i)
        sys.exit()

Submission status: Wrong Answer

Solution code:
import math
n=int(input())
if n ==2:
  print(n)
  exit()

w=math.ceil(math.sqrt(n))
for k in range(n,100000):
  f=False
  for i in range(2,w+1):
    if k%i==0:
      f=True
      break
  if not f:
    print(k)
    exit()

Submission status: Wrong Answer

Solution code:
def primes(n):
    i = 1
    p = [2]
    while i+2 <= n:
        flag = True
        i += 2
        for j in range(3, int(i**(1/2))+1, 2):
            if i % j == 0:
                flag = False
                break
        if flag:
            p.append(i)
    return p
            
n = int(input())
p = primes(10**5+1000)
print([i for i in p if i > n][0])

Submission status: Wrong Answer

Solution code:
x=int(input())

def eratosthenes(n):
    prime_check=[True for _ in range(100010)]
    prime_check[0]=False
    prime_check[1]=False
    for i in range(2,(n//2)+3):
        if(prime_check[i]):
            j=2
            while(i*j<=n):
                prime_check[i*j]=False
                j+=1
            if(i*j<100010):
                prime_check[i*j]=False
    return prime_check


p=eratosthenes(x)
i=x
while(True):
    if(p[i]):
        print(i)
        break
    else:
        i+=1

Submission status: Wrong Answer

Solution code:
x=int(input())

def eratosthenes(n):
    prime_check=[True for _ in range(100010)]
    prime_check[0]=False
    prime_check[1]=False
    for i in range(2,(n//2)+3):
        if(prime_check[i]):
            j=2
            while(i*j<=n):
                prime_check[i*j]=False
                j+=1
            if(i*j<100010):
                prime_check[i*j]=False
    return prime_check


p=eratosthenes(x)
i=x+1
while(True):
    if(p[i]):
        print(i)
        break
    else:
        i+=1

Submission status: Wrong Answer

Solution code:
import math
import sys
input = sys.stdin.readline

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())
    for i in range(X, 100003):
        if is_prime(i):
            print(i)
            break

if __name__ == '__main__': main()

Submission status: Wrong Answer

Solution code:
x = int(input())

prime = [2]
for i in range(3,100004,2):
    for j in prime:
        if i % j == 0:
            break
    else:
        if x < i:
            print(i)
            quit()
        prime.append(i)

Submission status: Wrong Answer

Solution code:
import math

x = int(input())

search_list = list(range(0,100004))
def get_primenumber():
    prime_list = []
    search_list = list(range(2,100004))
    while True:
      if search_list[0] > math.sqrt(100004):
        prime_list.extend(search_list)
        break
      else:
        head_num = search_list[0]
        prime_list.append(head_num)
        search_list.pop(0)
        search_list = [num for num in search_list if num % head_num != 0]
    return prime_list

prime_list =get_primenumber()
for i in prime_list:
    if x < i:
        print(i)
        quit()

Submission status: Wrong Answer

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

a = int(input())
while True:
    a += 1
    if isPrime(a):
        print(a)
        break

Submission status: Wrong Answer

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

a = int(input())
while True:
    a += 1
    if isPrime(a):
        print(a)
        break

Submission status: Wrong Answer

Solution code:
x = int(input())
prime = [2]
i = 2
while prime[-1] <= x:
    i += 1
    status = True
    for j in prime:
        if i % j == 0: status = False
    if status: prime.append(i)

print(prime[-1])

Submission status: Wrong Answer

Solution code:
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()

Submission status: Wrong Answer

Solution code:
X = int(input())
def is_prime(n):
    if n == 2:
        return True
    elif n%2 == 0:
        return False
    if pow(2, n-1, n) != 1:
        return False
    return True

n = X
primes = []
while True:
    n += 1
    if is_prime(n):
        flag = True
        for p in range(3, n//2):
            if n%p == 0:
                flag = False
                break
        if flag:
            primes.append(n)
            if n >= X:
                print(n)
                break

Submission status: Wrong Answer

Solution code:
import math

x = int(input())

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

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

Submission status: Wrong Answer

Solution code:
x = int(input())

def is_prime(num):
    for i in range(2, num):
        if num % i == 0:
            return False
    return True

for i in range(x, 10 ** 5):
    if is_prime(i):
        print(i)
        exit()

Submission status: Wrong Answer

Solution code:
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

for i in range(X,100000):
    if is_prime(i):
        print(i)
        break

Submission status: Wrong Answer

Solution code:
x=int(input())
import math
def is_prime(n):
    if n==1:
        return False
    for divisor in range(2,int(math.sqrt(n))+1):
        if n%divisor == 0:
            return False
    return True


for k in range(x,100001):
    if is_prime(k) == True:
        print(k)
        exit()

Submission status: Wrong Answer

Solution code:
x=int(input())
import math
def is_prime(n):
    for divisor in range(2,math.floor(math.sqrt(n))+1):
        if n%divisor == 0:
            return False
    return True


for k in range(x,100002):
    if is_prime(k) == True:
        print(k)
        exit()

Submission status: Wrong Answer

Solution code:
x=int(input())
import math
def is_prime(n):
    factor = 0
    for divisor in range(2,math.floor(math.sqrt(x))+1):
        if n%divisor == 0:
            factor += 1
    if factor == 0:
        return True
    return False


for k in range(x,100001):
    if is_prime(k) == True:
        print(k)
        exit()

Submission status: Wrong Answer

Solution code:
from sys import exit
from math import sqrt

x = int(input())
if x == 2:
    print(3)
    exit()
elif x == 3:
    print(5)
    exit()
i = x
while i <= x * int(sqrt(x)):
    j = 2
    while j <= int(sqrt(i)):
        if not i % j:
            break
        j += 1
    if j > int(sqrt(i)):
        print(i)
        exit()
    i += 1

Submission status: Wrong Answer

Solution code:
import math
X  = int(input())

def check(n):
    for i in range(2, math.ceil(math.sqrt(n))+1):
        #print(i)
        if n%i==0:
            break
    else:
        return 1

for i in range(X, X+100):
    #print(i)
    if check(i)==1:
        print(i)
        break

Submission status: Wrong Answer

Solution code:
x = int(input())

s =[2]

if x==2:
    print(x)
else:
    for i in range(3,int(x/2),2):
        if all(i%k!=0 for k in s):
            s.append(i)

while any(x%k==0 for k in s):
  x+=1
else:
  print(x)

Submission status: Wrong Answer

Solution code:
import math

def check_prime(a):
    b = True
    if a==2:b = False
    for i in range(2,int(math.sqrt(a))):
        if a % i==0:
            b = False
            break
    return b      
a=int(input())
while True:
    if check_prime(a):
        print(a)
        break
    a += 1

Submission status: Wrong Answer

Solution code:
x = int(input())
while True:
    p = True
    for i in range(2, int(x**0.5)+3):
        if x % i == 0:
            p = False
            break
    if p:
        break
    x += 1
print(x)

Submission status: Wrong Answer

Solution code:
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

Submission status: Wrong Answer

Solution code:
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

Submission status: Wrong Answer

Solution code:
X = int(input())

candidate = X
prime = False

while prime != True:
    for i in range(2, int(candidate ** 0.5) + 2):
        if candidate % i == 0:
            candidate += 1
            break
    else:
        prime = True

print(candidate)

Submission status: Wrong Answer

Solution code:
import math
X = int(input())

def Eratosthenes(n):
  list = [i + 1 for i in range(n)]
  num = 2
  for j in range(2,math.ceil(math.sqrt(n))):
    for k in range(len(list)):
      if list[k] % j == 0:
        list[k] = 0
      else:
        continue
  return list

L = Eratosthenes(2*X)
for l in range(X,2*X):
  if L[l] != 0:
    print(L[l])
    break

Submission status: Wrong Answer

Solution code:
from math import sqrt


def prime_check(a):
    for i in range(int(sqrt(a))):
        if a % (i + 2) == 0:
            return False
    return True


x = int(input())

while not(prime_check(x)):
    x += 1

print(x)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x=int(input())
for i in range(x,10**5):
  for p in range(2,x+1):
    if i%p==0:
      print(i)
      break

Submission status: Wrong Answer

Solution code:
import math

x = int(input())


def is_prime(n):
    if n % 2 == 0 and n > 2:
        return False
    return all(n % i for i in range(3, int(math.sqrt(n)) + 1, 2))


for n in range(100001):
    if n >= x and is_prime(n):
        print(n)
        break

Submission status: Wrong Answer

Solution code:
# ABC149C - Next Prime
def is_prime_miller_rabin(n: int) -> bool:
    """Miller–Rabin primality test in O(k log^3 n).
    https://twitter.com/kiri8128/status/1241033090773860353
    https://www.wikiwand.com/en/Miller%E2%80%93Rabinprimalitytest
    """
    # cut out small primes and 87% of composite numbers.
    if n < 2:
        return False
    elif n in {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67}:
        return True
    elif (
        n % 2 == 0
        or n % 3 == 0
        or n % 5 == 0
        or n % 7 == 0
        or n % 11 == 0
        or n % 13 == 0
        or n % 17 == 0
        or n % 19 == 0
        or n % 23 == 0
        or n % 29 == 0
        or n % 31 == 0
        or n % 37 == 0
        or n % 41 == 0
        or n % 43 == 0
        or n % 47 == 0
        or n % 53 == 0
        or n % 59 == 0
        or n % 61 == 0
        or n % 67 == 0
    ):
        return False

    # find the most suitable witnesses for n
    if n < 2047:
        witnesses = [2]
    elif n < 1373653:
        witnesses = [2, 3]
    elif n < 9080191:
        witnesses = [31, 73]
    elif n < 25326001:
        witnesses = [2, 3, 5]
    elif n < 3215031751:
        witnesses = [2, 3, 5, 7]
    elif n < 4759123141:
        witnesses = [2, 7, 61]
    elif n < 1122004669633:
        witnesses = [2, 13, 23, 1662803]
    elif n < 2152302898747:
        witnesses = [2, 3, 5, 7, 11]
    elif n < 3474749660383:
        witnesses = [2, 3, 5, 7, 11, 13]
    elif n < 341550071728321:
        witnesses = [2, 3, 5, 7, 11, 13, 17]
    elif n < 3825123056546413051:
        witnesses = [2, 3, 5, 7, 11, 13, 17, 19, 23]
    elif n < 318665857834031151167461:
        witnesses = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37]
    else:  # precisely, n < 3317044064679887385961981 (3.3 * 10^24)
        witnesses = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41]

    d = n - 1
    d = d // (d & -d)

    for a in witnesses:
        y = pow(a, d, n)
        if y == 1:
            continue
        t = d
        while y != n - 1:
            y = (y * y) % n
            if y == 1 or t == n - 1:
                return False
            t <<= 1
    return True


def main():
    N = int(input())
    if N != 2 and N % 2 == 0:
        N += 1
    while not is_prime_miller_rabin(N):
        N += 2
    print(N)


if __name__ == "main":
    main()

Submission status: Wrong Answer

Solution code:
n = int(input())

while True:
    tmp = n
    if tmp % 2 != 0 and tmp % 3 != 0 and tmp % 5 != 0 and tmp % 7 != 0:
        print(tmp)
        break
    else:
        tmp += 1

Submission status: Wrong Answer

Solution code:
n = int(input())

while True:
    tmp = n
    if tmp % 2 != 0 and tmp % 3 != 0 and tmp % 5 != 0 and tmp % 7 != 0:
        print(tmp)
        break

Submission status: Wrong Answer

Solution code:
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)])

Submission status: Wrong Answer

Solution code:
import sys
input=sys.stdin.readline
import math
X = int(input())
if X == 2:
    print(2)
x = math.ceil(math.sqrt(X))
for i in range(X,X+1000):
    c = 0
    for j in range(2,x+1):
        if i % j == 0:
            c = 1
            break
    if c == 0:
        print(i)
        break

Submission status: Wrong Answer

Solution code:
from __future__ import print_function

import sys

import re
import array
import copy
import functools
import operator

import math
import string
import fractions
from fractions import Fraction
from fractions import gcd
# fractions.gcd() を用いること
# math.log2()はatcoderでは対応していない．留意せよ．

import collections
import itertools
import bisect

import random
import time

import heapq
from heapq import heappush
from heapq import heappop
from heapq import heappushpop
from heapq import heapify
from heapq import heapreplace
from queue import PriorityQueue as pq
from queue import Queue

from itertools import accumulate

from collections import deque
from collections import Counter

from operator import mul
from functools import reduce

input = sys.stdin.readline


def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return


def lcm(n, m):
    return int(n * m / gcd(n, m))


def coprimize(p, q):
    common = fractions.gcd(p, q)
    return (p // common, q // common)


def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom


def main():
    # input
    n = int(input().strip())
    l = list(range(2, 10**5+1))

    # main process
    for i in range(len(l)):
        l2 = []
        for j in range(len(l)):
            if l[j] % l[i] == 0 and l[j] != l[i]:
                pass
            else:
                l2.append(l[j])
        if len(l) == len(l2):
            break
        l = l2
        # eprint('l2 ', end=':\n')
        # eprint(l2)
    
    for i in range(len(l)):
        if l[i]>=n:
            print(l[i])
            return

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
from __future__ import print_function

import sys

import re
import array
import copy
import functools
import operator

import math
import string
import fractions
from fractions import Fraction
from fractions import gcd
# fractions.gcd() を用いること
# math.log2()はatcoderでは対応していない．留意せよ．

import collections
import itertools
import bisect

import random
import time

import heapq
from heapq import heappush
from heapq import heappop
from heapq import heappushpop
from heapq import heapify
from heapq import heapreplace
from queue import PriorityQueue as pq
from queue import Queue

from itertools import accumulate

from collections import deque
from collections import Counter

from operator import mul
from functools import reduce

input = sys.stdin.readline


def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return


def lcm(n, m):
    return int(n * m / gcd(n, m))


def coprimize(p, q):
    common = fractions.gcd(p, q)
    return (p // common, q // common)


def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom


def main():
    # input
    n = int(input().strip())
    l = list(range(2, 10**5+1))

    # main process
    for i in range(len(l)):
        l2 = []
        for j in range(len(l)):
            if l[j] % l[i] == 0 and l[j] != l[i]:
                pass
            else:
                l2.append(l[j])
        if len(l) == len(l2):
            break
        l = l2
        # eprint('l2 ', end=':\n')
        # eprint(l2)
    
    for i in range(len(l)):
        if l[i]>n:
            print(l[i])
            return

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
x = int(input())

for i in range(2, x):
    if x % i == 0:
        x += 1
        continue

print(x)

Submission status: Wrong Answer

Solution code:
import math
X = int(input())
def 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

Bool = False
p = X
while not(Bool):
    Bool = prime(p)
    p += 1
    
print(p + 1)