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:
import math
N = int(input())
prime = True
if N == 2:
  print(2)
  exit()
else:
  for k in range(N+1, 110000):
    prime = True
    max = math.ceil(math.sqrt(k))
    for i in range(2, max+1):
      if k % i == 0:
        prime = False
        break
    if prime == True:
      ans = k
      break
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
x=int(input())
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, 100003):
    if is_prime(i):
        print(i)
        exit()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
isprime = [True] * 20001

def seive(n): 
  isprime[0] = isprime[1] = False
  p = 2
  while (p*p <= n):
    if isprime[p]:
      for i in range(p*p, n+1, p):
        isprime[i] = False   
    p += 1
      
  prime = [j for j in range(n) if isprime[j]]
  return prime

		
def program():
  x = int(input())
  N = 10100
  prime = seive(N) 
    
  for i in range(len(prime)):
    if prime[i] >= x:
      return prime[i]
      break
		
print(program())

Submission status: Wrong Answer

Solution code:
MAX_SIZE = 10001

isprime = [True] * MAX_SIZE 
prime = [] 
SPF = [None] * (MAX_SIZE) 

def m_seive(N): 
  isprime[0] = isprime[1] = False
  for i in range(2, N): 
    if isprime[i]: 
      prime.append(i) 
      SPF[i] = i 
      j = 0
      while (j < len(prime) and i * prime[j] < N and \
             prime[j] <= SPF[i]):
        isprime[i * prime[j]] = False
        SPF[i * prime[j]] = prime[j]
        j += 1
		
def program():
  x = int(input())
  N = 10000
  m_seive(N) 
    
  for i in range(len(prime)):
    if prime[i] >= x:
      return prime[i]
      break
		
print(program())

Submission status: Wrong Answer

Solution code:
x=int(input())

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

Submission status: Wrong Answer

Solution code:
dp = [0 for i in range(1000000)]
N = int(input())
for i in range(2,N):
  if i**2>N:
    break
  if dp[i]!=0:
    continue
  for j in range(i,N,i):
    dp[j] = 1
while dp[N]!=0:
  N += 1
print(N)

Submission status: Wrong Answer

Solution code:
X = int(input())
for i in range(X+1, 9999999999999999):
    flag = 1
    for j in range(2, X//2 +1):
        if i % j == 0:
            flag = -1
            break
    if flag == 1:
        print(i)
        break

Submission status: Wrong Answer

Solution code:
X = int(input())
for i in range(X+1, 9999999999999999):
    flag = 1
    for j in range(2, X//2 +1):
        if i % j == 0:
            flag = -12
            break
    if X == 2:
        print(2)
        break
    elif X == 3:
        print(3)
        break
    elif flag == 1:
        print(i)
        break

Submission status: Wrong Answer

Solution code:
X = int(input())
for i in range(X+1, 999999999):
    flag = 1
    for j in range(2, X):
        if i % j == 0:
            flag = -12
            break
    if X == 2:
        print(2)
        break
    elif X == 3:
        print(3)
        break
    elif flag == 1:
        print(i)
        break

Submission status: Wrong Answer

Solution code:
X = int(input())
for i in range(X+1, 999999999):
    flag = 1
    for j in range(2, i//2+1):
        if i % j == 0:
            flag = -12
            break
    if X == 2:
        print(2)
        break
    elif X == 3:
        print(3)
        break
    elif flag == 1:
        print(i)
        break

Submission status: Wrong Answer

Solution code:
X = int(input())

def is_Prime(x):
  for i in range(2, x+1):
    if i * i + 1 > x:
      return True
    if x % i == 0:
      return False

for i in range(X+1, 2*X+1):
  if is_Prime(i):
    print(i)
    break

Submission status: Wrong Answer

Solution code:
x = int(input())
y = int(x**0.5)
 
while x % y != 0:
  y -=1
  if x%y==0 and y==1:
    x +=1
    y = int(x**0.5)
  elif x%y==0 and y!=0:
    break
  else:
    continue
print(x)

Submission status: Wrong Answer

Solution code:
x = int(input())
y = int(x**0.5)
 
while x % y != 0:
  y -=1
  continue
  if y ==1:
    x +=1
    y = int(x**0.5)
    continue
  elif x%y==0 and y !=1:
    break
print(x)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
X=int(input())
for j in range(X,10**5+1):
    for i in range(X-1,0,-1):
        if j%i==0:
            break
        elif i==1:
            print(j)
            exit()

Submission status: Wrong Answer

Solution code:
x = int(input())
y = int(x**0.5)
 
while x % y != 0:
  y -=1
  continue
  if y ==1:
    x +=1
    continue
  elif y !=1:
    break
print(x)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x = int(input())
ans = x
while True:
  jud = 0
  if(ans%2==0):
    jud += 1
  i = 3
  while i < ans**(1/2):
    if(jud>0):
      break
    if(ans%i == 0):
      jud += 1
    i += 2
  if(jud==0):
    print(ans)
    break
  ans += 1

Submission status: Wrong Answer

Solution code:
x = int(input()) + 1
if x % 2 == 0:
    x += 1

while True:
    i = 3
    prime = True
    while i * i <= x:
        if x % i == 0:
            prime = False
            break
        i += 2
    if prime:
        print(x)
        quit()
    x += 2

Submission status: Wrong Answer

Solution code:
X=int(input())
ans=0
for i in range(X+1,10**5+100):
    cond=True
    for j in range(2,int(i**0.5)+1):
        if i%j==0:
            cond=False
            break
    if cond:
        ans=i
        break

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

X = int(input())
double = X*2+1
s = set()
for i in range(2, double):
    if i in s:
        continue
    if i>X:
        print(i)
        break
    cnt = 1
    while cnt*i<=double:
        s.add(i*cnt)
        cnt += 1

Submission status: Wrong Answer

Solution code:
import math
a = int(input())
b = int(math.sqrt(a)) +1

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
X = int(input())

prime = []
for n in range(3, X+1, 2):
    lim = int(n ** 0.5)
    f = True
    for p in prime:
        if p > lim:
            break
        if n % p == 0:
            f = False
            break
    if f:
        prime.append(n)
if X >= 2:
    prime = [2] + prime

for n in range(X+1, X+10**5):
    for p in prime:
        if n % p == 0:
            break
    else:
        print(n)
        break

Submission status: Wrong Answer

Solution code:
x=int(input())
def eratosthenes(n):
  l0=list(range(2,n+1))
  l1=[1]*(n+1)
  l1[0]=0
  l1[1]=0
  for li in l0:
    if li>int(n**0.5):
      break
    if l1[li]==1:
      k=2
      while k*li<=n:
        l1[k*li]=0
        k+=1
  ret=[i for i,li in enumerate(l1) if li==1]
  return ret
a=eratosthenes(x)
while True:
  flg=True
  for ai in a:
    if x%ai==0:
      flg=False
      break
  if flg:
    print(x)
    exit()
  x+=1

Submission status: Wrong Answer

Solution code:
X = int(input())
S = [2]
for i in range(3, 10**6, 2):
    f = True
    for s in S:
        if s > i**(0.5): break
        if i % s == 0:
            f = False
            break
    if f:
        S.append(i)
        if i >= X:
            print(i)
            break

Submission status: Wrong Answer

Solution code:
import bisect,collections,copy,heapq,itertools,math,string
import numpy as np
import sys
sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

X = I()

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,10**5+1):
    if is_prime(i):
        print(i)
        break

#H,N = LI()
#AB = [LI() for _ in range(N)]
#A,B = zip(*AB)
#Ap = np.array(A)
#C = np.zeros(N + 1)

# if ans:
#     print('Yes')
# else:
#     print('No')

Submission status: Wrong Answer

Solution code:
import sys

X = int(input())

for i in range(2,10 * 5):
  flag=True
  for j in range(2,i):
    if i%j==0:
      flag=False
  if flag==True and i > X:
    print(i)
    sys.exit()

Submission status: Wrong Answer

Solution code:
X=int(input())
import sys
for i in range(X,10**5+1):
  T=True
  for j in range(2,i):
    if i%j==0:
      T=False
  if T==True:
    print(i)
    break
  else:
    continue

Submission status: Wrong Answer

Solution code:
X=int(input())
import sys
for i in range(X,10**5+1000):
  T=True
  for j in range(2,i):
    if i%j==0:
      T=False
  if T==True:
    print(i)
    break
  else:
    print(1)
    continue

Submission status: Wrong Answer

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

    for i in range(10**5):
        num = X + i
        arr = set(prime_factorize(num))
        if len(arr) == 1:
            print(num)
            exit()


def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

    for i in range(10**5):
        num = X + i
        arr = factorization(num)
        if len(arr) == 1:
            print(num)
            exit()


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
from sys  import stdin,stdout

import bisect

import math

def st():
    return list(stdin.readline().strip())

def inp():
    return int(stdin.readline())

def li():
    return list(map(int,stdin.readline().split()))

def mp():
    return map(int,stdin.readline().split())

def pr(n):
    stdout.write(str(n)+"\n")

def soe(limit):
    l=[1]*(limit+1)
    prime=[]
    for i in range(2,limit+1):
        if l[i]:
            for j in range(i*i,limit+1,i):
                l[j]=0

    for i in range(2,limit+1):
        if l[i]:
            prime.append(i)
    return prime

def segsoe(low,high):
    limit=int(high**0.5)+1
    prime=soe(limit)
    n=high-low+1
    l=[0]*(n+1)
    for i in range(len(prime)):
        lowlimit=(low//prime[i])*prime[i]
        if lowlimit<low:
            lowlimit+=prime[i]
        if lowlimit==prime[i]:
            lowlimit+=prime[i]
        for j in range(lowlimit,high+1,prime[i]):
            l[j-low]=1
    for i in range(low,high+1):
        if not l[i-low]:
            if i!=1:
                print(i)

def power(a,n):
    r=1
    while n:
        if n&1:
            r=(r*a)
        a*=a
        n=n>>1
    return r

l=soe(10**6 +100)

def solve():
    n=inp()
    a=bisect.bisect_right(l,n)
    
    print(l[a])



for _ in range(1):
    solve()

Submission status: Wrong Answer

Solution code:
s = int(input())

def primeNumberCreate():
    global s
    primeList = [2]  # 2以下の素数リストを作成
    maxNumber = s+1000 # 1000以下の数字をチェック
    for x in range(s, maxNumber):
        for y in primeList:
            if x % y == 0:
                break
        else:
            primeList.append(x)  # 割り切れるものがなければリストに追加
    primeList.pop(0)
    return primeList

print(min(primeNumberCreate()))

Submission status: Wrong Answer

Solution code:
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(2, 1000000 + 100):
    if is_prime(i):
        primes.append(i)
        if i >= n:
            print(i)
            break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
 
X = int(input())
 
l = [True] * 1000001
l[0], l[1] = False, False
 
for i in range(2, 1000+1):
  if l[i]:
    if i >= X:
      print(i)
      break
    else:
      for j in range(2*i, 1000000, i):
        l[j] = False

Submission status: Wrong Answer

Solution code:
import math

X = int(input())

l = [True] * 1000001
l[0], l[0] = False, False

for i in range(1, 1000+1):
  if l[i]:
    if i >= X:
      print(i)
      break
    else:
      for j in range(2*i, 1000000, i):
        l[j] = False

Submission status: Wrong Answer

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

while True:
  if x==2:
    print(2)
    break
  x=x+1
  ans=is_prime(x)
  if ans==True:
    print(x)
    break

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
X = int(input())+1
def Sosuu_not(n):
  for p in range(2, n):
    if n % p == 0:
        return False
  else:
    return True
while True:
  if Sosuu_not(X) == True:
    print(X)
    break
  X += 1

Submission status: Wrong Answer

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

while True:
    maxi=int(math.sqrt(N))+1
    test=[i for i in range(maxi)]
    for i in range(2,maxi):
        if test[i]!=-1:
            if N%test[i]!=0:
                j=i
                while j<maxi:
                    test[j]=-1
                    j+=i
            else:
                break
        if i==maxi-1:
            print(N)
            exit()
    N+=1

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def nextPrime(x):

    for i in range(x, x*2):
        a = 0
        for w in range(2, i):
            if i%w ==0:
                break
            else:
                a = w
        if i == a + 1:
            return i

def main():
    x = int(input())
    print(nextPrime(x))

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
# 21   import sympyが最速だが、Atcoderには無い
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

Submission status: Wrong Answer

Solution code:
# 21   import sympyが最速だが、Atcoderには無い
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:
    x +=1
    for i in n:
        if x % i == 0:
            break
    else:
        print(x)
        break

Submission status: Wrong Answer

Solution code:
def main():
  X = int(input())
  
  i = 1
  
  while i != 0:
    if X % 2 != 0:
      if X % 3 != 0:
        if X % 5 != 0:
          print(X)
          break
    X += 1
  
  
main()

Submission status: Wrong Answer

Solution code:
import math
import sys

X=int(input())
for i in range(X,10004):
  for j in range(2,int(math.sqrt(i))):
    if(i%j==0):
      break
    print(i)
    sys.exit()

Submission status: Wrong Answer

Solution code:
X = int(input())
while X>0:
  for n in range(2, X, 1):
    if (X%n) == 0:
      X += 1
      continue
  print(X)
  break

Submission status: Wrong Answer

Solution code:
x = int(input())
#素数の列を、つくるわよ
prime_list = [2]
for num in range(3, x + 1, 2):
  if all(num % prime != 0 for prime in prime_list):
    prime_list.append(num)

#２は特殊な例よね
if x == 2:
  print(x)
  exit()

#素数は奇数だけ
if x % 2 == 0:
  p = 1
else:
  p = 0
  
#xから、x未満の最大の素数ｘ２について調べるわ
#素数ｎ<素数ｍ<素数２ｎは常識？
for i in range(x - p, prime_list[-1] * 2 + 1, 2):
  if all(i % j != 0 for j in prime_list):
    print(i)
    exit()

Submission status: Wrong Answer

Solution code:
x = int(input())
#素数の列を、つくるわよ
prime_list = [2]
for num in range(3, x + 1, 2):
  if all(num % prime != 0 for prime in prime_list):
    prime_list.append(num)
#xから順に、奇数だけを判定していくわよ
if x % 2 == 0:
  p = 1
else:
  p = 0

#２は特殊な例よね
if x == 2:
  print(x)
  exit()
  
#x以下の素数全てで割り切れない時
for i in range(x - p, prime_list[-1] * 2, 2):
  if all(i % j != 0 for j in prime_list):
    print(i)
    exit()

Submission status: Wrong Answer

Solution code:
x = int(input())
#素数の列を、つくるわよ
prime_list = [2]
for num in range(3, x + 1, 2):
  if all(num % prime != 0 for prime in prime_list):
    prime_list.append(num)
#xから順に、奇数だけを判定していくわよ
if x % 2 == 0:
  p = 1
else:
  p = 0
i = x + p
now = "keep"
while now == "keep":
  #２は特殊な例よね
  if x == 2:
    print(x)
    break
  #x以下の素数全てで割り切れない時
  if all(i % j != 0 for j in prime_list):
    print(i)
    now = "done"
  else:
    i += 2

Submission status: Wrong Answer

Solution code:
x = int(input())
#素数の列を、つくるわよ
prime_list = [2]
for num in range(3, x + 1):
  if all(num % prime != 0 for prime in prime_list):
    prime_list.append(num)
#xから順に、x += 1してって判定していくわよ
i = x
now = "keep"
while now == "keep":
  #２は特殊な例よね
  if i == 2:
    print(i)
    break
  #x以下の素数全てで割り切れない時
  if all(i % j != 0 for j in prime_list):
    print(i)
    now = "done"
  else:
    i += 1

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
X = int(input())

pn = []
pn_flg = [0] * 10**6
for i in range(2, 10**6):
    if pn_flg[i] == 1:
        continue
    pn.append(i)
    pn_flg[i] = 1
    for j in range(i, 10**6, i):
        pn_flg[j] = 1

for i in pn:
    if i > X:
        print(i)
        exit()

Submission status: Wrong Answer

Solution code:
import sys
n = int(input())
if n == 2:
	print(2)
	sys.exit()
for i in range(n+1,10**6):
	bol = True
	for j in range(2,i):
		if i%j == 0:
			bol = False
	if bol:
		print(i)
		sys.exit()

Submission status: Wrong Answer

Solution code:
import math
 
n = int(input())
 
def trial_division(target):
    dest = int(math.sqrt(target))
 
    for i in range(2,dest):
        if target % i == 0:
            return
    print(target)
    exit(0)

num = 0
while True:
  num += 1
  trial_division(n+num)

Submission status: Wrong Answer

Solution code:
x = int(input())

bu = [False]*2*10**5
bu[2] = True
cur = 2

while 1:
    if not bu[cur]:
        bu[::cur] = [True] * len(bu[::cur])
    cur += 1
    if cur>=x and not bu[cur]:
        print(cur)
        break

Submission status: Wrong Answer

Solution code:
x = int(input())

bu = [False]*2*10**5

cur = 2

while 1:
    if not bu[cur]:
        bu[::cur] = [True] * len(bu[::cur])
    cur += 1
    if cur>=x and not bu[cur]:
        print(cur)
        break

Submission status: Wrong Answer

Solution code:
import math

x = int(input())

if x == 2:
    print(3)
    exit()

elif x%2 == 0:
    ans = x+1
    
else:
    ans = x

#2以外の素数は奇数であることに注意

while True:
    for i in range(3, int(math.sqrt(ans))+1, 2):
        if ans%i == 0:
            ans += 2
            break
    else:
        print(ans)
        exit()

Submission status: Wrong Answer

Solution code:
import random
def is_prime(q,k=50):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    d = (q-1)>>1
    while d&1 == 0:
        d >>= 1
    for i in range(k):
        a = random.randint(1,q-1)
        t = d
        y = pow(a,t,q)
        while t != q-1 and y != 1 and y != q-1: 
            y = pow(y,2,q)
            t <<= 1
        if y != q-1 and t&1 == 0:
            return False
    return True
X = int(input())
if X == 2:
    print(3)
else:
    for i in range(X+1, 100004):
        if is_prime(i):
            print(i)
            break

Submission status: Wrong Answer

Solution code:
a = int(input())

def factorization(n):
    arr = []
    tmp = n

    for i in range(2, int(n**0.5//1)+1):
        if tmp%i==0:
            cnt = 0
            while tmp%i==0:
                cnt+=1
                tmp//=i
            arr.append([i,cnt])
    if tmp!=1:
        arr.append([tmp,1])
    if arr==[]:
        arr.append([n,1])
    return arr

while True:
  arr = factorization(a)
  if len(arr)<=1:
    print(a)
    break
  a+=1

Submission status: Wrong Answer

Solution code:
a = int(input())

def factorization(n):
    arr = []
    tmp = n

    for i in range(2, int(n**0.5//1)+1):
        if tmp%i==0:
            cnt = 0
            while tmp%i==0:
                cnt+=1
                tmp//=i
            arr.append([i,cnt])
    if tmp!=1:
        arr.append([tmp,1])
    if arr==[]:
        arr.append([n,1])
    return arr

while True:
  arr = factorization(a)
  if len(arr)==1:
    print(a)
    break
  a+=1

Submission status: Wrong Answer

Solution code:
n = int(input())
pnl = [2]
candidates = [x for x in range(3, n+1, 2)]

for i in candidates:
  for j in pnl:
    if i % j == 0:
      break
    elif j == pnl[-1]:
      pnl.append(i)

ans = None
for i in range(1000):
  if not ans:
    for j in pnl:
      if (n + i) % j == 0:
          break
      elif j == pnl[-1]:
          ans = n+i
print(ans)

Submission status: Wrong Answer

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

if is_prime(x):
    print(x)
    sys.exit()

for i in range(x,int(1e5)):
    for j in range(2,x):
        if i % j == 0:
            break
        elif j == x-1:
            print(i)
            sys.exit()

print(None)

Submission status: Wrong Answer

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

if is_prime(x):
    print(x)
    sys.exit()

for i in range(x,int(1e5)):
    for j in range(2,x):
        if i % j == 0:
            break
        elif j == x-1:
            print(i)
            sys.exit()

Submission status: Wrong Answer

Solution code:
import sys

x = int(input())

for i in range(x+1,int(1e5)):
    for j in range(2,x):
        if i % j == 0:
            break
        elif j == x-1:
            print(i)
            sys.exit()

Submission status: Wrong Answer

Solution code:
import math
x = int(input().split()[0])
def get_sieve_of_eratosthenes(n):
    prime = []
    limit = math.sqrt(n)
    data = [i + 1 for i in range(1, n)]
    while True:
        p = data[0]
        if limit <= p:
            return prime + data
        prime.append(p)
        data = [e for e in data if e % p != 0]

data = get_sieve_of_eratosthenes(2*x+100)
for i in data:
  if i > x:
    print(i)
    break

Submission status: Wrong Answer

Solution code:
import math
x = int(input().split()[0])
def get_sieve_of_eratosthenes(n):
    prime = []
    limit = math.sqrt(n)
    data = [i + 1 for i in range(1, n)]
    while True:
        p = data[0]
        if limit <= p:
            return prime + data
        prime.append(p)
        data = [e for e in data if e % p != 0]

data = get_sieve_of_eratosthenes(2*x)
for i in data:
  if i > x:
    print(i)
    break

Submission status: Wrong Answer

Solution code:
x = int(input())
for i in range(x,x+1000):
  if all([i%j!=0 for j in range(2,1000)]):
    print(i)
    break

Submission status: Wrong Answer

Solution code:
from collections import deque

X = int(input())
N = 10**5+4
N_sq=N**(1/2)

check = deque(range(2,N+1))
search = deque([])

for n in range(N):
    if len(check)<=0:
        break
        
    c = check.popleft()
    search.append(c)

    check = deque([ _ for _ in check if _%c != 0])
    
    if c > N_sq:
        search.extend(check)
        break
        
for s in search:
    if X < s:
        print(s)
        break

Submission status: Wrong Answer

Solution code:
from collections import deque

X = int(input())
N = 10**5+4
N_sq=N**(1/2)

check = deque(range(2,N+1))
search = deque([])

for n in range(N):
    if len(check)<=0:
        break
        
    c = check.popleft()
    search.append(c)

    check = deque([ _ for _ in check if _%c != 0])
    
    if c > N_sq:
        search.extend(check)
        break
        
for s in search:
    if X < s:
        print(s)

Submission status: Wrong Answer

Solution code:
X = int(input())

flg = ''

for i in range(X, 2 * X):
  for j in range(2, i):
    if i % j == 0:
      break
    else:
      flg = True
      
  if flg == True:
    print(i)
    exit()

Submission status: Wrong Answer

Solution code:
X = int(input())

for i in range(X, 2 * X):
  flg = False
  for j in range(2, i-1):
    if X % j == 0:
      flg = True
    
  if flg == False:
    print(i)
    exit()

Submission status: Wrong Answer

Solution code:
x = int(input())

while True:
    for i in range(2, int(-(-x**0.5//1))+1):
        if x%i == 0:
            break
    else:
        print(x)
        break
    x+=1

Submission status: Wrong Answer

Solution code:
import math

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

if __name__=='__main__':
  x=int(input())
  ans=get_sieve_of_eratosthenes(10**5)
  for i in ans:
    if i<x:
      continue
    else:
      print(i)
      break

Submission status: Wrong Answer

Solution code:
x = int(input())

def pcheck(n):
    for i in range(2, n):
        if n % i == 0:
            return True
    return False
while True:
    if pcheck(x) == True:
        a = x
        break
    else:
        x += 1

print(a)

Submission status: Wrong Answer

Solution code:
X=int(input())
for i in range(X,10**6):
  for j in range(2,i):
    if i%j==0:
      break
    if j==i-1:
      print(i)
      exit()

Submission status: Wrong Answer

Solution code:
from math import floor,sqrt
x = int(input())

if x==2 :
  print(2)
elif x == 3:
  print(3)
else:
  pass

while True:
  if all(x % i != 0 for i in range(2,int(floor(sqrt(x)))+1)) == True:
    print(x)
    exit()
  else:
    x += 1

Submission status: Wrong Answer

Solution code:
import math
x = int(input())
if x % 2 == 0:
  n = x + 1
else:
  n = x + 2
while True:
  isPrime = True
  for i in range(2, int(math.sqrt(n))):
    if n % i == 0:
      isPrime = False
      break
  if isPrime:
    print(n)
    break
  n += 2