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: Runtime Error

Solution code:
a = int(input())
b = True
def hantei(n, x):
  for i in range(n):
    if n % i == 0:
      x = not x
      return x
while b is True:
  hantei(a, b)
  a += 1
  if not b:
    print(a)

Submission status: Runtime Error

Solution code:
#include <iostream>

using namespace std;

bool is_prime(long long x) {
  for (long long i = 2; i*i <= x; i++) {
    if (x % i == 0) { return false; }
  }
  return x != 1;
}

int main() {
  int x; cin >> x;

  for (int i = x; ; i++) {
    if (is_prime(i)) {
      cout << i << endl;
      return 0;
    }
  }
  return 0;
}

Submission status: Runtime Error

Solution code:
# coding: utf-8
import pkg
from itertools import combinations as comb
import numpy as np


# 参考:
# エラトステネスの篩
# https://blog.mktia.com/how-to-output-prime-numbers-in-python/
# https://python.ms/eratosthenes/#_2-%E9%AB%98%E9%80%9F%E7%89%88

	# p:素数　a:任意の自然数
	# a**p≡a mod p
	# a**(p-1)≡1 (mod p) ※Pで割ったあまりが1
	
	
def main():
	x = int(input())
	while not IsPrime(x):
		x += 1
	print(x)

def IsPrime(n):
	if n < 2:
		return False
	elif n == 2:
		return True
	elif n % 2 == 0:
		return False
	
	sqrtN = int(n**0.5)
	for i in range(3, sqrtN, 2):
		if n%i == 0:
			return False
	return True


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


if __name__ == '__main__':
	main()

Submission status: Runtime Error

Solution code:
x=int(input())
import math
def usinig_sqrt(limit):
    for k in range(x,limit+1):
        
        factor = 0
        if k%2==0 and l != 2:
            continue
        for divisor in range(2,math.floor(math.sqrt(k))+1):
            if k%divisor == 0:
                factor += 1
        if factor == 0:
            print(k)
            exit()
         
print(usinig_sqrt(100000))

Submission status: Runtime Error

Solution code:
x=int(input())
p=x**0.5
while any(X%i==0 for i in range(2,x//1+1)):
  x+=1
else:
  print(x)

Submission status: Runtime Error

Solution code:
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long  ll;
typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef double ld;
typedef complex<ld> Point;
const ll INF = mod * mod;
typedef pair<int, int> P;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define per(i,a,b) for(int i=a;i>b;i--)
#define rep0(i,n) for(int i=0;i<n;i++)
#define per0(i,n) for(int i=n;i>=0;i--)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
const ld eps = 1e-6;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
 

bool is_Prime(int a){
    bool flag = true;
    rep(i, 2, int(sqrt(a))+1){
        if(a % i == 0){ flag = false; break;}
    }
    return flag;
}
void solve() {
    int x; cin >> x;
    //cout << is_Prime(x);
    while(!is_Prime(x)){
        x++;
    }
    cout << x;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	solve();
	return 0;
}

Submission status: Runtime Error

Solution code:
import sympy

pg = sympy.primerange(2, 100001)

x = int(input())

for p in pg:
    if p >= x:
        print(p)
        break

Submission status: Runtime Error

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%93Rabin_primality_test
    """
    # 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 < 2_047:
        witnesses = [2]
    elif n < 1_373_653:
        witnesses = [2, 3]
    elif n < 9_080_191:
        witnesses = [31, 73]
    elif n < 25_326_001:
        witnesses = [2, 3, 5]
    elif n < 3_215_031_751:
        witnesses = [2, 3, 5, 7]
    elif n < 4_759_123_141:
        witnesses = [2, 7, 61]
    elif n < 1_122_004_669_633:
        witnesses = [2, 13, 23, 1662803]
    elif n < 2_152_302_898_747:
        witnesses = [2, 3, 5, 7, 11]
    elif n < 3_474_749_660_383:
        witnesses = [2, 3, 5, 7, 11, 13]
    elif n < 341_550_071_728_321:
        witnesses = [2, 3, 5, 7, 11, 13, 17]
    elif n < 3_825_123_056_546_413_051:
        witnesses = [2, 3, 5, 7, 11, 13, 17, 19, 23]
    elif n < 318_665_857_834_031_151_167_461:
        witnesses = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37]
    else:  # precisely, n < 3_317_044_064_679_887_385_961_981 (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: Runtime Error

Solution code:
from sympy import nextprime

X = input()
X = int(X)

print(nextprime(X))

Submission status: Runtime Error

Solution code:
import math
N = int(input())
flag = 0
while flag == 0:
  lst = []
  for i in range(1, math.ceil(N**0.5)):
    if N%i == 0:
      if i**2 = N:
        lst.append(i)
      else:
        lst.append(i)
        lst.append(N//i)
  if len(lst) == 2:
    flag = 1
  else:
    N += 1
print(N)

Submission status: Runtime Error

Solution code:
from sympy import nextprime
n=int(input())

print (nextprime(n))

Submission status: Runtime Error

Solution code:
from sympy import isprime
from sympy import nextprime
X = int(input())
if isprime(X):
    print(X)
else:
    print(nextprime(X))

Submission status: Runtime Error

Solution code:
import math
from sys import exit
X = int(input())

while True:
    for i in range(2, math.floor(math.sqrt(X) + 1)):
        flag = True
        if X % i == 0:
            flag = False
            break
    if flag:
        print(X)
        exit()
    X += 1

Submission status: Runtime Error

Solution code:
def resolve():
    n = int(input())
    if n==2:
        print("2")
    for j in range(10000):
        flag = 1
        a = int((n+j)**0.5)+1
        for i in range(2, a+1):
            if (n+i) % j == 0:
                flag = -1
            if i == a and flag ==1:
                print(n+j)
                exit()
resolve()

Submission status: Runtime Error

Solution code:
n=int(input())
bool_1=True
while(1):
	for i in range(n**0.5//1):  
		if n % i ==0: 
			bool_1=False
			break
    n+=1      
    if bool_1:break
print(bool_1)

Submission status: Runtime Error

Solution code:
n=int(input()) 
m=10**5+4 
for i in range(n,m): 
	lst=[] 
	if all(( i % j) !=0 for  j in range(2,int(n**0.5//1+1))): 
		print(i,j) 
		break

Submission status: Runtime Error

Solution code:
n=int(input())
m=10**5+1
for j in range()
for i in range(n,m):
  for j in range(2,int(n**0.5//1+1)):
    i % i==0:
      print(i)
      break

Submission status: Runtime Error

Solution code:
from math import sqrt

x = int(input()) - 1
if x >= 2:
    pnums = []
    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

Submission status: Runtime Error

Solution code:
import sys
x=int(input())
for i in range(x,2*x+1):
  for j in range(2,i**0.5+1):
    if i%j==0:
      break
  else:
    print(j)
    sys.exit()

Submission status: Runtime Error

Solution code:
x = int(input())

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

Submission status: Runtime Error

Solution code:
import fractions as gcd

a, b = map(int, input().split())
print(a*b // gcd(a,b))

Submission status: Runtime Error

Solution code:
def get_sieve_of_eratosthenes(n):
    prime = [2]
    limit = int(n ** 0.5)
    data = [i + 1 for i in range(2, n, 2)]
    while True:
        p = data[0]
        if limit <= p:
            return prime + data
        prime.append(p)
        data = [e for e in data if e % p != 0]
print(get_sieve_of_eratosthenes(int(input())[-1])

Submission status: Runtime Error

Solution code:

import math
x=int(input())
serach_number = 100000


def sieve_of_eratosthenes(target, c):
    k=0
    dest = int(math.sqrt(target))
    target_list = list(range(2, target + 1))
    prime_list = []

    while True:
        num_min = min(target_list)
        if num_min >= dest:
            prime_list.extend(target_list)
            break
        prime_list.append(num_min)
        if num_min>=x:
            k=1
        if k==1:
            print(num_min)
            return
        i = 0

        while True:
            if i >= len(target_list):
                break
            elif target_list[i] % num_min == 0:
                target_list.pop(i)
            i += 1




sieve_of_eratosthenes(serach_number, c)

Submission status: Runtime Error

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

serach_number = 100000


def sieve_of_eratosthenes(target):
    dest = int(math.sqrt(target))
    target_list = list(range(2, target + 1))
    prime_list = []

    while True:
        num_min = min(target_list)
        if num_min >= dest:
            prime_list.extend(target_list)
            break
        prime_list.append(num_min)
        if num_min<x:
            b=num_min

        i = 0

        while True:
            if i >= len(target_list):
                break
            elif target_list[i] % num_min == 0:
                target_list.pop(i)
            i += 1

    a=prime_list.index(b)
    print(prime_list[a+1])


sieve_of_eratosthenes(serach_number)

Submission status: Runtime Error

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

X=int(input())
while is_prime(X):
  X+=1
print(X)

Submission status: Runtime Error

Solution code:
import math
def main(X):
    max_search = min(101, (math.sqrt(X)+1 if math.sqrt(X) % 1 == 0 else math.ceil(math.sqrt(X))))
    if X <= 3:
        return X
    SosuuFlg = False
    while SosuuFlg == False:
        for i in range(2, max_search):
            if X % i == 0:
                break
        else:
            SosuuFlg = True
            return X
        X += 1
        
X = int(input())
print(main(X))

Submission status: Runtime Error

Solution code:
# import math これだとエラーになる 3.4なので
from fractions import gcd
a, b = map(int, input().split())

print((a*b)//gcd(a, b))

Submission status: Runtime Error

Solution code:
# import math これだとエラーになる 3.4なので
from fractions import gcd
a, b = map(int, input().split())

print(int((a*b)//gcd(a, b)))

Submission status: Runtime Error

Solution code:
import math
a, b = map(int, input().split())

print(int((a*b)//math.gcd(a, b)))

Submission status: Runtime Error

Solution code:
import sys
import bisect
import math
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

def get_primenumber(number):
    prime_list = []
    #2からnumberまでの数字をsearch_listに入れる
    search_list = list(range(2,number+1))
    while True:
      #search_listの先頭の値が√nの値を超えたら処理終了
      if search_list[0] > math.sqrt(number):
        #prime_listにsearch_listを結合
        prime_list.extend(search_list)
        break
      else:
        #search_listの先頭をprime_listに入れる
        head_num = search_list[0]
        prime_list.append(head_num)
        #search_listの先頭をpopする
        search_list.pop(0)
        #head_numの倍数を取り除く
        search_list = [num for num in search_list if num % head_num != 0]
    return prime_list


X = ni()
l = get_primenumber(10 ** 5)
idx = bisect.bisect_left(l, X)
print(l[idx])

Submission status: Runtime Error

Solution code:

def prime_list_eratosthenes(n):
    if not isinstance(n, int):
        raise TypeError('n is int type.')
    if n < 2:
        raise ValueError('n is more than 2')
    prime = [2]
    limit = int(n**0.5)
    data = [i + 1 for i in range(2, n, 2)]
    while True:
        p = data[0]
        if limit <= p:
            return prime + data
        prime.append(p)
        data = [e for e in data if e % p != 0]
def prime_list_eratosthenes_from(n_from, n_to):
    from bisect import bisect_left
    data = prime_list_eratosthenes(n_to)
    i = bisect_left(data, n_from)
    return data[i:]
x = int(input())
d = prime_list_eratosthenes_from(x, 100000)
print(d[0])

Submission status: Runtime Error

Solution code:
import math
N = int(input())
def main(val):
  for i in range(2,math.floor(math.sqrt(val)):
   if val % i == 0:
     return True
  return False
while(True):
  if main(N) == False:
	print(N)
	break
  N += 1

Submission status: Runtime Error

Solution code:
import math
X=int(input())
for i in range(0,20):
  a=X+i
  b=a**0.5
  for j in range(2,math.floor(b)+1):
    if a%b!=0:
      print(a)
       break
break

Submission status: Runtime Error

Solution code:
def main():
  import math
  X=int(input())
  for i in range(0,20):
    a=X+i
    b=a**0.5
    for j in range(2,math.floor(b)):
      if a%b!=0:
        print(a)
        break
  break

main()

Submission status: Runtime Error

Solution code:
import math
X=int(input())
for i in range(0,X):
  a=X+i
  c=int(math.sqrt(a))
  for j in range(2,c):
    if a%j!=0:
      print(a)
break

Submission status: Runtime Error

Solution code:
def main():
  X=int(input())
  for i in X:
    a=X+i
    if all(a%j!=0 for j in range(2,a)):
      print(a)
  break
main()

Submission status: Runtime Error

Solution code:
x = int(input())
if x == 2:
  print(2)
  
else:
  var = x
  while True:
    for _ in range(2,var):
      if var%_ != 0:
        ind = True
      else:
        ind = False
        break
    if ind == True:
      break  
    else:
      var+=1  
print(var)

Submission status: Runtime Error

Solution code:
a=0dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd

Submission status: Runtime Error

Solution code:
X = int(input())
from sympy import nextprime
print(nextprime(X))

Submission status: Runtime Error

Solution code:
x = int(input())

# エラトステネスの篩
def Eratosthenes(n):
    if n < 2:
        return None
    prime = [2]
    limit = math.ceil(n**0.5)
    data = list(range(3, n+1, 2))
    p = -1
    while p < limit:
        p = data[0]
        prime.append(p)
        data = [d for d in data if d%p != 0]
    return prime + data


prime = Eratosthenes(10**5+3)
if x in prime:
    print(x)
else:
    import bisect
    min_prime_index = bisect.bisect_right(prime, x)
    print(prime[min_prime_index])

Submission status: Runtime Error

Solution code:
X = int(input())

import math
#----エラトステネスの篩--------
def get_primenumber(number):
    prime_list = []
    #2からnumberまでの数字をsearch_listに入れる
    search_list = list(range(2,number+1))
    while True:
      #search_listの先頭の値が√nの値を超えたら処理終了
      if search_list[0] > math.sqrt(number):
        #prime_listにsearch_listを結合
        prime_list.extend(search_list)
        break
      else:
        #search_listの先頭をprime_listに入れる
        head_num = search_list[0]
        prime_list.append(head_num)
        #search_listの先頭をpopする
        search_list.pop(0)
        #head_numの倍数を取り除く
        search_list = [num for num in search_list if num % head_num != 0]
    return prime_list
  
  num_list = get_primenumber(10**5+1)
  
  import sys

for i in range(len(num_list)):
    if X <= num_list[i]:
        print(num_list[i])
        sys.exit()

Submission status: Runtime Error

Solution code:
import math
n = input()
i = 11

if n == 8 or n ==9:
  print(11)
  i = 0
elif n == 2 or n== 3 or n == 5 or n == 7:
  print(n)
  i = 0
elif n <= 7 and n%2 == 0:
  print(n+1)
  i = 0

while i != 0:
  j = 3
  js = int(math.sqrt(i))
  while j <= js:
    if  i%j == 0:
      break
    elif j == js or j == js-1:
      print(i)
      break
      i = 0
    else:
      if j%2 == 0:
        j += 1
      else:
        j += 2
  if i%2 == 0:
    i += 1
  else:
    i += 2

Submission status: Runtime Error

Solution code:
X = int(input())
def isPrime(N):
  for i in range(2, ceil(N ** (1/2)):
    if N % i == 0:
      return False
  return True
while isPrime(X) == False:
  X += 1
print(X)

Submission status: Runtime Error

Solution code:
x = int(input())

#def prime number discriminator
def prime_or_not(a):
  b = 0
  for i in range(a):
    if a % i == 0:
      b += 1
    if b >= 1:
      return 0:
    else:
      return 1:

ans = 0

while ans =< 0:
  ans += primt_or_not(a)
  a += 1
print(a - 1)

Submission status: Runtime Error

Solution code:
from sympy import isprime


i=int(input())
judge=not isprime(i)
while judge:
    i+=1
    judge=not isprime(i)
print(i)

Submission status: Runtime Error

Solution code:
import math
def primecheck(x):
    primes =[]
    for i in range(2,math.ceil(x)):
        if x % i == 0:
            return False
            break 
    return True


x = int(input())
for i in range(x,10**5):
    if primecheck(i):
        break
print(i)

Submission status: Runtime Error

Solution code:
from sympy import nextprime
import math

def primejdg(n):
    A = 0
    if n % 2 == 0:
        return False
    else:
        A += n

    for i in range(3, round(math.sqrt(A)) + 1, 2):
        if A % i == 0:
            return False
    return True

x = input()
X = int(x)

if X == 2:
    print(2)
elif primejdg(X) == True:
    print(X)
else:
    print(nextprime(X))

Submission status: Runtime Error

Solution code:
x = int(input())

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

Submission status: Runtime Error

Solution code:
from sympy import nextprime

x = input()
X = int(x)

print(nextprime(X))

Submission status: Runtime Error

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

def is_prime3(q,k=50):
    q = abs(q)
    #計算するまでもなく判定できるものははじく
    if q == 2: return True
    if q < 2 or q&1 == 0: return False

    #n-1=2^s*dとし（但しaは整数、dは奇数)、dを求める
    d = (q-1)>>1
    while d&1 == 0:
        d >>= 1
    
    #判定をk回繰り返す
    for i in range(k):
        a = random.randint(1,q-1)
        t = d
        y = pow(a,t,q)
        #[0,s-1]の範囲すべてをチェック
        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
 i = X
cnt = 0
flg = is_prime3(i)
if flg == False:
    while flg==False:
        i += 1
        cnt = i
        flg = is_prime3(i)
    print(cnt)
else:
    print(i)

Submission status: Runtime Error

Solution code:
while true:
  print(yaruki())

Submission status: Runtime Error

Solution code:
while true:

Submission status: Runtime Error

Solution code:
X = int(input())
from sympy import primerange, sieve
L = list(sieve.primerange(X, 10**5))
print(L[0])

Submission status: Runtime Error

Solution code:
X = int(input())
from sympy import sieve
L = [i for i in sieve.primerange(X,10**5)]
print(L[0])

Submission status: Runtime Error

Solution code:
X = map(int,input().split())
from sympy import sieve
L = [i for i in sieve.primerange(X,23)]
print(L[0])

Submission status: Runtime Error

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


x = int(input())

prime = [True] * (100004)
prime[2] = True

def e_prime(x):
	i = 2
	flag = False
	if(i==x):flag=True
	while True:
		if prime[i]:
			if(flag==True):
				return i
			else:
				for j in range(i**2,len(prime),i):
					prime[j]=False
		i+=1

print(e_prime(x))

Submission status: Runtime Error

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


x = int(input())

prime = [True] * (100004)
prime[2] = True

def e_prime(x):
	i = 2
	flag = False
	while True:
		if prime[i]:
			if(flag==True):
				return i
			else:
				for j in range(i**2,len(prime),i):
					prime[j]=False
		i+=1
		if(i==x):flag=True

print(e_prime(x))

Submission status: Runtime Error

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


x = int(input())

prime = [True] * (1000000)
prime[2] = True

def e_prime(x):
	i = 2
	flag = False
	while True:
		if prime[i]:
			if(flag==True):
				return i
			else:
				for j in range(i**2,len(prime),i):
					prime[j]=False
		i+=1
		if(i==x):flag=True

print(e_prime(x))

Submission status: Runtime Error

Solution code:
from sympy import nextprime
x = int(input())
print(nextprime(x-1))

Submission status: Runtime Error

Solution code:
from sympy import sieve

X=int(input())

PL=[i for i in sieve.primerange(1, 10**5+1)]

PL.append(X)
PL.sorted()

ID=PL.index(X)

print(ID+1)

Submission status: Runtime Error

Solution code:
from sympy import prime, sieve

x = int(input())
pos = sieve.search(x)

if pos[0] == pos[1]:
    print(x)
else:
    print(prime(pos[1]))

Submission status: Runtime Error

Solution code:
import sympy


def main():
    x = int(input())
    result = 0
    while True:
        if sympy.isprime(x):
            result = x
            break
        x += 1
    print(result)


if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
def judge_prime(num):
    FLAG = True
    
    for i in range(2, int(np.sqrt(num))+1):
        if (num%i == 0):
            FLAG = False
    
    if (num == 2):
        FLAG = True
    
    return(FLAG)

X = int(input())

while (True):
    flag = judge_prime(X)
    
    if (flag):
        break
    
    X += 1

print(X)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
import sympy
x=int(input())
r=sympy.nextprime(x)
print(r)

Submission status: Runtime Error

Solution code:
import sympy
x=int(input())
r=sympy.nextprime(50)
print(r)

Submission status: Runtime Error

Solution code:
import sympy
x=int(input())
print sympy.nextprime(x)

Submission status: Runtime Error

Solution code:
import sympy
n=int(input())
if sympy.isprime(n):
    print(n)
else:
    print(sympy.nextprime(n))

Submission status: Runtime Error

Solution code:
import sympy
n=int(input())
if sympy.isprime(n):
    print(n)
else:
    print(sympy.nextprimt(n))

Submission status: Runtime Error

Solution code:
num = int(input())
if num == 2:
	print(2)
    exit()

flag = False
while True:
    for i in range(2, int(num**0.5)+1):
        if num % i ==0:
            flag = False
            break
        else:
            flag = True
    if flag:
        print(num)
        exit()
    else:
        num+=1

Submission status: Runtime Error

Solution code:
import math
print(int(math.sqrt(x)))
for i in range(2, int(math.sqrt(x)) + 2):
    if x % i == 0:
        x += 1
print(x)

Submission status: Runtime Error

Solution code:
pip install sympy 
x = int(input())
from sympy import nextprime
print(nextprime(x - 1))

Submission status: Runtime Error

Solution code:
x = int(input())
from sympy import nextprime
print(nextprime(x - 1))

Submission status: Runtime Error

Solution code:
x = int(input())


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

	print(x)
	break

Submission status: Runtime Error

Solution code:
x = int(input())


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

Submission status: Runtime Error

Solution code:
X = int(input())
XX=np.arange(X,X+10**4)

s=0
for j in XX:
    if (s==1):
        break
    for i in range(2, j+1):
        N= j % i
#        print('j=' ,j ,' i=' ,i, N)
        if (N ==  0 and i==j ):
            print(j)
            s=1
        if (N ==  0):
          #  print('true')
            break
#        else:
#            print(j)

Submission status: Runtime Error

Solution code:
X = int(input())
XX=np.arange(X,X+10**4)

s=0
for j in XX:
    if (s==1):
        break
    for i in range(2, j+1):
        N= j % i
#        print('j=' ,j ,' i=' ,i, N)
        if (N ==  0 and i==j ):
            print(j)
            s=1
        if (N ==  0):
          #  print('true')
            break
#        else:
#            print(j)

Submission status: Runtime Error

Solution code:
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
#print(li)
for i in range(x):
    if i>=n and li[i]:
        print(i)
        break

Submission status: Runtime Error

Solution code:
x = int(input())
while True:
	xs = [n for i in range(x) if x % n == 0]
    if len(xs) > 2:
      break
	x += 1
print(x)

Submission status: Runtime Error

Solution code:
x = int(input())
while True:
	xs = [n for i in range(x) if x % n == 0]
    if len(xs) > 2:
      break
	x += 1
print(x)

Submission status: Runtime Error

Solution code:
import sympy

n = int(input())

if sympy.isprime(n):
    print(n)
else:
    res = sympy.nextprime(n, 1)
    print(res)

Submission status: Runtime Error

Solution code:
x=int(input())
while 1:
  for i in range(int(x**0.5+1)):
    if x//i==0:
      x+=1
      break
  else:
    print(X)
    break

Submission status: Runtime Error

Solution code:
import numpy as np
X =int(input())
 
if X == 2:
    print(X)
 
else:
    s = np.array([2])
    
    for i in range(2, 10**5 + 3):
        res = True
        for j in s:
            if (i % j) == 0:
                res = False
                break
        
        if res == True:
            s = np.append(s, i)
            if i >= X:
                print(i)
                break

Submission status: Runtime Error

Solution code:
import math

x = int(input())

def is_prime(n):
  for i in range(int(math.sqrt(n))):
    if(n%i==0):
      return False
  return True

for i in range(x, x+100):
  if is_prime(i):
    print(i)
    exit()

Submission status: Runtime Error

Solution code:
a,b,k = map(int, input().split())

if(a<k):
  k -= a
  a = 0
else:
  tmp = k
  k -= a
  a -= tmp
  
if(b<k):
  b = 0
else:
  b -= k

print("{0} {1}".format(a,b))

Submission status: Runtime Error

Solution code:
def read_int(): return int(input())

def prime(num):
    for n in range(2,int(sqrt(num))):
        if num % n == 0:
            return False
            break
    return True
  
def solution(K):
    while not prime(K):
        K += 1
    print(K)
    
K = read_int()
print(solution(K))

Submission status: Runtime Error

Solution code:
x = int(input())

import bisect

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

primess = primes(x)
index = bisect.bisect_left(primess,x)
print(primess[index])

Submission status: Runtime Error

Solution code:
x = int(input())

from bitarray import bitarray
import bisect

def index_to_number(i): return 2*i+3
def number_to_index(n): return (n-3)//2

LIMIT_NUMBER = 50
LIMIT_INDEX = number_to_index(LIMIT_NUMBER)+1

odd_primes = bitarray(LIMIT_INDEX)
# index  0 1 2 3
# number 3 5 7 9

odd_primes.setall(True)

for i in range(LIMIT_INDEX):
    if odd_primes[i] is False:
        continue
    n = index_to_number(i)
    for m in range(n**2, LIMIT_NUMBER, 2*n):
        odd_primes[number_to_index(m)] = False

primes = [index_to_number(i) for i in range(LIMIT_INDEX)
          if odd_primes[i] is True]
primes.insert(0,2)

index = bisect.bisect_left(primes,x)
print(primes[index])

Submission status: Runtime Error

Solution code:
from sympy import nextprime
from sympy import isprime

X = int(input())

if isprime(X) == True:
	print(nextprime(X))
else:
	print(X)

Submission status: Runtime Error

Solution code:

import math

input1 = int(input())

if input1 == 2:
    print(2)

else:

    for b in range(100000):
        result = 0
        X = input1 + b
        for a in range(int(math.sqrt(X))):
            if X % (a + 2) == 0:
                result += 1
                break
            else:
                result += 0
        if result == 0:
            break

print(X)

Submission status: Runtime Error

Solution code:
input1 = int(input())

from sympy import nextprime
print(nextprime(input1))

Submission status: Runtime Error

Solution code:
def is_prime(x, i):
  if i*i > x:
    return True
  elif x % i == 0:
    return False
  else:
    is_prime(x, i+1)
  
def gen_prime(x):
  if is_prime(x, 2):
    return x
  else:
    gen_prime(x+1)
    
if __name__ == "__main__":
  import sys
  sys.setrecursionlimit(10240)
  x = int(input())
  print(gen_prime(x))

Submission status: Runtime Error

Solution code:
def is_prime(x, i):
  if i*i > x:
    return True
  elif x % i == 0:
    return False
  else:
    is_prime(x, i+1)
  
def gen_prime(x):
  if is_prime(x, 2):
    return x
  else:
    gen_prime(x+1)
    
if __name__ == "__main__":
  x = int(input())
  print(gen_prime(x))

Submission status: Runtime Error

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

n=int(input())

x=n
for i in range(n,10**5): 
   if is_prime(i):
       break


print (i)