stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;





typedef long long ll;



ll ub;

bitset <10000010> prime;

vector <ll> primelist ;





void sieve(ll n) {

	prime.set (); // set all bits to 1

	prime [0] = prime [1] = 0; // 0 and 1 are not primes



	for (ll i = 4; i <= n; i += 2) { // even > 2 is not prime

		prime[i] = 0;

	}



	for (ll i = 3; (i * i) <= n; i += 2) { // the odd numbers are primes?

		if (prime[i]) { // i is still marked as prime?

			for (ll j = i * i; j < n; j += i) {

				prime[j] = 0; // multiples of i are not primes

			}

		}

	}



	for (ll i = 2; i <= n; i++) { // create list of primes in [0..ub]

		if (prime[i]) {

			primelist.push_back(i);

		}

	}

}



bool isPrime( ll n )

{

	// O(1) for numbers n <= ub!

	if (n <= ub) return prime[n];



	// takes a little longer if n > ub!

	for (int i = 0; i < (int) primelist .size (); i++) {

		if (n % primelist [i] == 0) {

			return false;

		}

	}



	return true;

}



int main()

{

    ios_base::sync_with_stdio( false ); 

    cin.tie( NULL );



	ll x;

	cin >> x;



	ub = 100500;

 	sieve(ub);



 	if(isPrime(x)) cout << x << endl;

 	else 

 	{

 		ll a;

 		for (a = x; true; ++a)

 		{

 			if(isPrime(a)){

 				break;

 			}

 		}



 		cout << a << endl;

 	}



    return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<math.h>

int main()

{

    long long int X,i,j,d,prym,num;

    scanf("%lld",&X);

    if(X==1||X==2)

    {

        printf("2");

    }

    else if(X==3)

    {

        printf("3");

    }

    else

    {

        for(i=X; 1; i++)

        {

            for(j=2; j<=sqrt(i); j++)

            {

                if(i%j==0)

                {

                    num=0;

                    break;

                }

                else num=1;

            }

            if(num==1)

            {

                printf("%lld",i);

                break;

            }

        }

    }



    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <bits/stdc++.h>

using namespace std;



bool prime[1000001];



int sieve(int n){

  for(int i=2;i<1000001;i++){

    prime[i]=true;

  }

  prime[0]=false;

  prime[1]=false;

  for(long long i=2;i<1000001;i++){

    if(prime[i]==true){

        for(long long j=i*i;j<1000001;j+=i){

            prime[j]=false;

        }

    }

    if(i==n && prime[n]==true){

        return n;

    }else if(prime[i]==true && i>n){

        return i;

    }

  }

}



int main()

{

    int n;

    scanf("%d",&n);

    printf("%d\n",sieve(n));

    return 0;

}




// Optimized solution to the same problem (faster):
#include<iostream>

#include<algorithm>

#include<cstring>

#include<cmath>

#include<iomanip>

#include<string>

using namespace std;

int main(){

    long long int x,c=0;

    cin>>x;

    if(x==2)

    {

        cout<<x<<endl;



    }

    else{while(1){

    for (int i=2;i<=sqrt(x);i++)

    {

        if(x%i==0){c++;

        break;}

    }

    if(c==0)

    {

        cout<<x<<endl;

        break;

    }

    else{x++;

    c=0;

    }

}}

    return 0;



}




// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>



using namespace std;



#define TC ll t; cin >> t; while(t--)

typedef long long ll;

#define mx 100005



int main()

{

    //freopen("input.txt", "r", stdin);

    //freopen("output.txt", "w", stdout);

    ll x,i;

    cin >> x;

    bool vis[mx];

    memset(vis,0,sizeof(vis));

    for(i=2;i<=mx;i++)

    {

        if(vis[i]) continue;

        if(i>=x) break;

        for(ll j=i;j<=mx;j+=i) vis[j]=1;

    }

    cout << i << endl;

    return 0;

}


// Optimized solution to the same problem (faster):
#include<iostream>

#include<algorithm>

#include<cstring>

#include<cmath>

#include<iomanip>

#include<string>

using namespace std;

int main(){

    long long int x,c=0;

    cin>>x;

    if(x==2)

    {

        cout<<x<<endl;



    }

    else{while(1){

    for (int i=2;i<=sqrt(x);i++)

    {

        if(x%i==0){c++;

        break;}

    }

    if(c==0)

    {

        cout<<x<<endl;

        break;

    }

    else{x++;

    c=0;

    }

}}

    return 0;



}




// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

#define rep(i,n) for (int i=0; i<(int)(n); i++)

#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)

using namespace std;

using ll = long long;

using P = pair<int, int>;



int main() {

  int x; cin >> x;

  const int lim = 100003;

  vector<int> p(lim);

  for (int i=2; i<=lim; i++) {

    for (int j=i; j<=lim; j+=i) {

      p[j]++;

    }

  }



  rep(i,lim+1) {

    if (p[i] == 1 && i >= x) {

      cout << i << endl;

      break;

    }

  }

  return 0;

}

// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

#define rep(i,n) for (int i=0; i<(int)(n); i++)

#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)

using namespace std;

using ll = long long;

using P = pair<int, int>;



bool is_prime(int x) {

  if (x==1) false;

  for (int i=2; i*i<=x; i++) {

    if (x % i == 0) return false;

  }

  return true;

}



int main() {

  int x; cin >> x;

  while(!is_prime(x)) {

    x++;

  }

  cout << x << endl;

  return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;



typedef long long ll;

typedef pair<int, int> pi;



#define rep(i, n) for (int i = 0; i < n; i++)

#define rep_op(i, a, n) for (int i = a; i < n; i++)

#define rep_d(j, n) for (int j = n; j >= 0; j--)

#define rep_d_op(j, n, a) for (int j = n; j >= a; j--)



template <class T>

inline bool chmax(T &a, T b)

{

    if (a < b)

    {

        a = b;

        return 1;

    }

    return 0;

}

template <class T>

inline bool chmin(T &a, T b)

{

    if (a > b)

    {

        a = b;

        return 1;

    }

    return 0;

}



const int MOD = 1000000007;



const vector<int> dx = {1, 0};

const vector<int> dy = {0, 1};

const ll INF = 1LL << 60;



// int max = *std::max_element(vec.begin(), vec.end());

// int sum = accumulate(list, list + size, 0);



int GCD(int a, int b) { return b ? GCD(b, a % b) : a; }



// n以下の素数を列挙する

class Prime

{

public:

    const int n;

    vector<bool> is_prime;

    vector<int> primes;

    Prime(int size) : n(size), is_prime(n + 1, true)

    {

        is_prime[0] = false;

        is_prime[1] = false;

        for (int i = 2; i <= n; ++i)

        {

            if (!is_prime[i])

                continue;

            primes.push_back(i);

            int tmp = 2 * i;

            while (tmp <= n)

            {

                is_prime[tmp] = false;

                tmp += i;

            }

        }

    }



    bool check(int x) { return is_prime[x]; }

};



int main()

{

    int x;

    cin >> x;

    vector<int> pr;

    Prime prime(100003);

    for (int p : prime.primes)

    {

        pr.push_back(p);

    }



    rep(i, pr.size())

    {

        if (x <= pr[i])

        {

            cout << pr[i] << endl;

            break;

        }

    }

}


// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;



typedef long long ll;

typedef pair<int, int> pi;



#define rep(i, n) for (int i = 0; i < n; i++)

#define rep_op(i, a, n) for (int i = a; i < n; i++)

#define rep_d(j, n) for (int j = n; j >= 0; j--)

#define rep_d_op(j, n, a) for (int j = n; j >= a; j--)



template <class T>

inline bool chmax(T &a, T b)

{

    if (a < b)

    {

        a = b;

        return 1;

    }

    return 0;

}

template <class T>

inline bool chmin(T &a, T b)

{

    if (a > b)

    {

        a = b;

        return 1;

    }

    return 0;

}



const int MOD = 1000000007;



const vector<int> dx = {1, 0};

const vector<int> dy = {0, 1};

const ll INF = 1LL << 60;



// int max = *std::max_element(vec.begin(), vec.end());

// int sum = accumulate(list, list + size, 0);



int GCD(int a, int b) { return b ? GCD(b, a % b) : a; }



bool is_prime(int x)

{

    if (x <= 1)

    {

        return false;

    }

    for (int i = 2; i * i <= x; i++)

    {

        if (x % i == 0)

        {

            return false;

        }

    }

    return true;

}



int main()

{

    int x;

    cin >> x;

    while (!is_prime(x))

    {

        x++;

    }

    cout << x << endl;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;



int main() {

  int x;

  cin >> x;

  if(x==2){

    cout << 2 << endl;

    return 0;

  }

  vector<int> p={2};

  for(int i=3;i<x;i++){

    int cou=0;

    for(int j=0;j<p.size();j++){

      if(i%p.at(j)!=0)

        cou++;

    }

    if(cou==p.size())

      p.push_back(i);

  }

  for(int i=x;i<2*x;i++){

    int cou=0;

    for(int j=0;j<p.size();j++){

      if(i%p.at(j)!=0)

        cou++;

    }

    if(cou==p.size()){

      cout << i << endl;

      return 0;

    }

  }

}

// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;



bool IsPrime(int num){

   if (num == 2) return true;

    else if (num % 2 == 0) return false; 

    double sqrtNum = sqrt(num);

    for (int i = 3; i <= sqrtNum; i += 2){

        if (num % i == 0)

            return false;

    }

    return true;

}



int main() {

  int x;

  cin >> x;

  int i=x;

  while(!IsPrime(i))i++;

  cout << i << endl;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

#define int long long int

#define MAX 1000007

#define MOD 1000000007

#define FO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

using namespace std;

vector <int> v;

void SieveOfEratosthenes(int n) 

{ 

	//n = 100005;

    // Create a boolean array "prime[0..n]" and initialize 

    // all entries it as true. A value in prime[i] will 

    // finally be false if i is Not a prime, else true. 

    bool prime[n+1]; 

    memset(prime, true, sizeof(prime)); 

  

    for (int p=2; p*p<=n; p++) 

    { 

        // If prime[p] is not changed, then it is a prime 

        if (prime[p] == true) 

        { 

            // Update all multiples of p greater than or  

            // equal to the square of it 

            // numbers which are multiple of p and are 

            // less than p^2 are already been marked.  

            for (int i=p*p; i<=n; i += p) 

                prime[i] = false; 

        } 

    } 

  

    // Print all prime numbers 

    for (int p=2; p<=n; p++) 

       if (prime[p]) 

          v.push_back(p);

}

void solve() {

 	int n;

 	cin >> n;

 	SieveOfEratosthenes(100005);

 	auto it = (lower_bound(v.begin(), v.end(), n) - v.begin());

    cout << v[it];

    return;

}

int32_t main() {

    FO;

    solve();

    return 0;

}


// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

#define int long long int

#define MAX 1000007

#define MOD 1000000007

#define FO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

using namespace std;

bool isPrime(int n)  

{  

    // Corner cases  

    if (n <= 1)  return false;  

    if (n <= 3)  return true;  

    

    // This is checked so that we can skip   

    // middle five numbers in below loop  

    if (n%2 == 0 || n%3 == 0) return false;  

    

    for (int i=5; i*i<=n; i=i+6)  

        if (n%i == 0 || n%(i+2) == 0)  

           return false;  

    

    return true;  

}  

  

// Function to return the smallest 

// prime number greater than N 

int nextPrime(int N) 

{ 

  

    // Base case 

    if (N <= 1) 

        return 2; 

  

    int prime = N; 

    bool found = false; 

  

    // Loop continuously until isPrime returns 

    // true for a number greater than n 

    while (!found) { 

  

        if (isPrime(prime)) { 

            found = true; 

            break;

        }

        else

        prime++;

    } 

  

    return prime; 

}

void solve() {

 	int n;

 	cin >> n;

 	cout << nextPrime(n);

    return;

}

int32_t main() {

    FO;

    solve();

    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;



using lint = long long;



int main() {

    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

    int x;

    cin >> x;

    vector<int> sieve((int)1e5+101, 1);

    sieve[0] = sieve[1] = 0;

    int res = 0;

    for (int i = 4; i <= (int)1e5+100; i += 2) sieve[i] = 0;

    for (int i = 3; i*i <= (int)1e5+100; i += 2)

    	if (sieve[i]) 

    		for (int j = i*i; j <= (int)1e5+100; j += 2*i) {

    			sieve[j] = 0;

    		}

	for (int i = x; i <= 2*x; ++i)

		if (sieve[i]) {

			cout << i << '\n';

			break;

		}

}

// Optimized solution to the same problem (faster):
#include<bits/stdc++.h>

using namespace std;



using lint = long long;



int main() {

    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

    int x;

    cin >> x;

    /*

    vector<int> sieve((int)1e5+101, 1);

    sieve[0] = sieve[1] = 0;

    int res = 0;

    for (int i = 4; i <= (int)1e5+100; i += 2) sieve[i] = 0;

    for (int i = 3; i*i <= (int)1e5+100; i += 2)

    	if (sieve[i]) 

    		for (int j = i*i; j <= (int)1e5+100; j += 2*i) {

    			sieve[j] = 0;

    		}

	for (int i = x; i <= 2*x; ++i)

		if (sieve[i]) {

			cout << i << '\n';

			break;

		}

		*/

    for (int i = x; i <= 2*x; ++i) {

    	bool works = 1;

    	for (int j = 2; j*j <= i; ++j) {

    		if (i % j == 0) {

    			works = 0;

    			break;

    		}

    	}

    	if (works) {

    		cout << i << '\n';

    		break;

    	}

    }

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include "bits/stdc++.h"



typedef long long ll;

using namespace std;



int main() {

    int x;

    cin >> x;



    int n = 2;

    while (true) {

        bool ok = true;

        for (int i = 2; i < n; ++i) {

            if (n % i == 0) {

                ok = false;

                break;

            }

        }

        if (ok && x <= n) {

            cout << n;

            return 0;

        }

        n++;

    }

}


// Optimized solution to the same problem (faster):
#include "bits/stdc++.h"



typedef long long ll;

using namespace std;



bool isPrime(int n) {

    if (n < 2) return false;

    for (int i = 2; i * i < n; ++i) {

        if (n % i == 0) return false;

    }

    return true;

}



int main() {

    int x;

    cin >> x;

    while (!isPrime(x)) x++;

    cout << x;

    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

#define rep(i,n) for (int i = 0; i < (n); i++)

using namespace std;

using ll = long long;

using P = pair<int, int>;



#define PMAX 200000



vector<int> eratosthenes (int n) {

    vector<bool> is_prime(n+1);

    rep(i, n) is_prime[i] = true;



    vector<int> p;

    for (int i = 2; i <= n; i++) {

        if (is_prime[i]) {

            for (int j = i*2; j <= n; j += i) {

                is_prime[j] = false;

            } 

            p.emplace_back(i);

        }

    }

    return p;

}



int main()

{

    int x;

    cin >> x;

    for (const auto tmp : eratosthenes(PMAX)) {

        if (tmp >= x ) {

            cout << tmp << endl;

            return 0;

        }

    }

    return 0;

}

// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

#define rep(i,n) for (int i = 0; i < (n); i++)

using namespace std;

using ll = long long;

using P = pair<int, int>;



#define PMAX 200000





int main()

{

    int x;

    cin >> x;

    bool okflag;

    for (int i = x; i < PMAX; i++) {

        okflag = true;

        for (int j = 2; j*j <= i; j++) {

            if (i % j == 0) okflag = false;

        }

        if (okflag) {

            cout << i << endl;

            return 0;

        }

    }

    

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>





#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)

#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)

#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)

#define all(c) (c).begin(),(c).end()

#define sz(v) (int)(v).size()



using namespace std;

typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;

const int MD = (int)1e9 + 7; typedef vector<ll> VL;

void dbg(){ cerr << "\n"; }  template <class T, class ...T2>

void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }

template <class T> void amax(T& a,T b){ a=max(a,b);}





vector<bool> eratos ( int n){

	vector<bool> prime(n+20, 0);

	prime[2] = true; prime[0] = prime[1] = false;

	for(int i = 3; i <= n; i += 2) prime[i] = true, prime[i+1] = false;

	int limit = (int)sqrt((double)n) + 1;

	for(int i = 3; i <= limit; i += 2){

		if(!prime[i]) continue;

		for(int j = i * i, k = i * 2; j <= n; j += k) prime[j] = false;

	}

	return prime;

}



int main() {

	//cin.tie(0); ios_base::sync_with_stdio(false);

	auto pr = eratos(150000);

	int x, ans =0;

	cin >>x;

	//for(auto x :pr) cerr<<x<<" "; cerr<<"\n";

	

	for(int i=x; ;i++){

		if(pr[i] ==true){ cout <<i <<"\n"; break;}

	}

	return 0;

}




// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>



#define rep2(x,fr,to) for(int x=(fr);x<(to);x++)

#define rep(x,to) for(int x=0;x<(to);x++)

#define repr(x,fr,to) for(int x=(fr);x>=(to);x--)

#define all(c) c.begin(),c.end()

#define sz(v) (int)v.size()



using namespace std;

typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;

typedef vector<ll> VL; const int MD = 1e9 + 7;

void dbg(){cerr<<"\n";} template <typename T,typename ...T2> void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }



bool isPrime( int x ){

	if ( x < 2 ) return false;

	else if ( x == 2 ) return true;

	if ( x % 2 == 0 ) return false;

	int limit = (int)sqrt((double)x) + 1;

	for ( int i = 3; i <= limit; i += 2 ){

		if ( x % i == 0 ) return false;

	}



	return true;

}

int main()

{

	cin.tie(0); ios_base::sync_with_stdio(false);

	int n; cin >>n;

	rep2(i, n , MD){

		if(isPrime(i)){

			cout << i <<"\n"; return 0;

		}

	}

	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
//

// Created by Mahmoud Rashad on 11/27/19.

//



#include <bits/stdc++.h>





using namespace std;



typedef vector<int> vi;

typedef pair<int, int> ii;

typedef vector<pair<ii, ii>> vii;



void sieve(vector<bool> &isPrime, int n) {

    isPrime.resize(n + 1, true);

    isPrime[0] = isPrime[1] = false;

    for (int i = 2; i * i <= n; ++i) {

        if (isPrime[i]) {

            for (int j = i * i; j <= n; j += i) {

                isPrime[j] = false;

            }

        }

    }

}



int main() {

#ifndef ONLINE_JUDGE

//    freopen("input.txt", "r", stdin);

//    freopen("output.out", "w", stdout);

#endif

    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0), cout.precision(10), cout << fixed;



    vector<bool> isPrime;

    sieve(isPrime, 200005);

    int x;

    cin >> x;

    while(true) {

        if (isPrime[x]) {

            cout << x << '\n';

            return 0;

        }

        ++x;

    }



}

// Optimized solution to the same problem (faster):
#include <stdio.h>



int isPrime(int x)

{

    int i;

    if(x==2)

        return 1;

    if(x%2==0)

        return 0;

    for(i=3; i<=x/2; i+=2)

    {

        if(x%i==0)

            return 0;

    }

    return 1;

}



int main()

{

    int n, i;

    scanf("%d", &n);



    for(i=n; i<=1000000; i++)

    {

        if(isPrime(i))

        {

            printf("%d\n", i);

            break;

        }

    }



    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>



using namespace std;

const int N=2e5+5,mod=1e9+7;

#define ll long long

bool vis[N];

int a[N];

int main()

{

    ios_base::sync_with_stdio(0);

    cin.tie(0);cout.tie(0);

    int n;

    cin>>n;

    for(ll i=2;i<N;i++)if(!vis[i])

    {

        if(i>=n) return cout<<i<<endl,0;

        for(ll j=i*i;j<N;j+=i)

            vis[j]=1;

    }



    return 0;

}


// Optimized solution to the same problem (faster):
#include <stdio.h>



int isPrime(int x)

{

    int i;

    if(x==2)

        return 1;

    if(x%2==0)

        return 0;

    for(i=3; i<=x/2; i+=2)

    {

        if(x%i==0)

            return 0;

    }

    return 1;

}



int main()

{

    int n, i;

    scanf("%d", &n);



    for(i=n; i<=1000000; i++)

    {

        if(isPrime(i))

        {

            printf("%d\n", i);

            break;

        }

    }



    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

#define sz 200009

using namespace std;

typedef long long ll;

int vis[sz+7];

void sieve()

{

  ll i,j;

  vis[0]=vis[1]=1;

  for (i=4; i<=sz; i+=2) vis[i]=1;



  for(i=3; i<=sz; i+=2)

  {

     if (vis[i]==0)

     {

       for (j=i*i; j<=sz; j+=i) vis[j]=1;

     }

  }

}

int main()

{

  sieve();



  int i,n=0;

  cin>>n;

  for(i=n; ; i++)

  {

  	if(vis[i]==0) {

  		cout<<i<<endl;

  		break;

  	}

  }

  return 0;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>



int isPrime(int x)

{

    int i;

    if(x==2)

        return 1;

    if(x%2==0)

        return 0;

    for(i=3; i<=x/2; i+=2)

    {

        if(x%i==0)

            return 0;

    }

    return 1;

}



int main()

{

    int n, i;

    scanf("%d", &n);



    for(i=n; i<=1000000; i++)

    {

        if(isPrime(i))

        {

            printf("%d\n", i);

            break;

        }

    }



    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

#define n 200005

using namespace std;

vector<long long >v(n,0);

vector<long long >prime;

long long i,j;

void sieve()

{

    for(i=3; i*i<=n; i+=2)

    {

        for(j=i*i; j<=n; j+=(i+i))

        {

            v[j-1]=1;

        }

    }

    prime.push_back(2);

    for(i=3; i<n; i+=2)

    {

        if(v[i-1]==0)

        {

            //cout<<i<<endl;

            prime.push_back(i);

        }

    }

}

int main()

{

    sieve();

    long long num,t;

    cin>>num;

    for(i=0;i<n;i++)

    {

        if(prime[i]>=num)

        {

            cout<<prime[i]<<endl;

            break;

        }

    }

    return 0;

}


// Optimized solution to the same problem (faster):
#include <stdio.h>



int isPrime(int x)

{

    int i;

    if(x==2)

        return 1;

    if(x%2==0)

        return 0;

    for(i=3; i<=x/2; i+=2)

    {

        if(x%i==0)

            return 0;

    }

    return 1;

}



int main()

{

    int n, i;

    scanf("%d", &n);



    for(i=n; i<=1000000; i++)

    {

        if(isPrime(i))

        {

            printf("%d\n", i);

            break;

        }

    }



    return 0;

}


// Fastest known solution for this problem: