stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#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;

        }

    }

}


// Faster C++ solution for the same problem (measured speedup: 1.8835510757404246x):
#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;

}
// Slower C++ solution:
#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;

    }

  }

}

// Faster C++ solution for the same problem (measured speedup: 1.6908177622459437x):
#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;

}
// Slower C++ solution:
#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;

}


// Faster C++ solution for the same problem (measured speedup: 1.8541179128212437x):
#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;

}
// Slower C++ solution:
#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;

		}

}

// Faster C++ solution for the same problem (measured speedup: 1.7391798249389954x):
#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;

    	}

    }

}
// Slower C++ solution:
#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++;

    }

}


// Faster C++ solution for the same problem (measured speedup: 1.562833416224198x):
#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 * i < n; ++i) {

            if (n % i == 0) {

                ok = false;

                break;

            }

        }

        if (ok && x <= n) {

            cout << n;

            return 0;

        }

        n++;

    }

}
// Slower C++ solution:
#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++;

    }

}


// Faster C++ solution for the same problem (measured speedup: 1.6137993963959336x):
#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;

}
// Slower C++ solution:
#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;

}

// Faster C++ solution for the same problem (measured speedup: 2.835746147949652x):
#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;

}
// Slower C++ solution:
#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;

}




// Faster C++ solution for the same problem (measured speedup: 1.3221402027818365x):
#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;

}
// Slower C++ solution:
//

// 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;

    }



}

// Faster C++ solution for the same problem (measured speedup: 1.6050448049736437x):
#include<bits/stdc++.h>



using namespace std;



void prime(int n){

    int i,c=0;

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

        if(n%i==0){

            c++;

            break;

        }

    }

    if(c==0){

        cout<<n;

        exit(0);

    }

}



int main(){

    int n,i;

    cin>>n;

    i=n;

    while(i>=n){

        prime(i);

        i++;

    }

    return 0;

}
// Slower C++ solution:
#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;

}


// Faster C++ solution for the same problem (measured speedup: 1.7237576943150061x):
#include<bits/stdc++.h>



using namespace std;



void prime(int n){

    int i,c=0;

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

        if(n%i==0){

            c++;

            break;

        }

    }

    if(c==0){

        cout<<n;

        exit(0);

    }

}



int main(){

    int n,i;

    cin>>n;

    i=n;

    while(i>=n){

        prime(i);

        i++;

    }

    return 0;

}
// Slower C++ solution:
//

// 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;

    }



}

// Faster C++ solution for the same problem (measured speedup: 1.5495779295493937x):
#include<iostream>

using namespace std;

int main()

{

	int i,j,n,count;

	cin>>n;

	for(j=n;j<n+1000;j++)

	{

	count=0;

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

	{

		if(j%i==0)

		count+=1;

		

	}

		if (count==0)

		{

		cout<<j;

		exit(0);

		}

	}

	return 0;

}
// Slower C++ solution:
#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;

}


// Faster C++ solution for the same problem (measured speedup: 1.6641883583090042x):
#include<iostream>

using namespace std;

int main()

{

	int i,j,n,count;

	cin>>n;

	for(j=n;j<n+1000;j++)

	{

	count=0;

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

	{

		if(j%i==0)

		count+=1;

		

	}

		if (count==0)

		{

		cout<<j;

		exit(0);

		}

	}

	return 0;

}
// Slower C++ solution:
//

// 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;

    }



}

// Faster C++ solution for the same problem (measured speedup: 1.597721316394816x):
#include <bits/stdc++.h>



using namespace std;

int prime(int n) 

{ 

    if (n <= 1) 

        return 0; 

  

   

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

        if (n % i == 0) 

            return 0; 

  

    return 1; 

} 

int main()

{

   int n=0,x,a,b;

    cin>>x;

    



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

    {

       int d=prime(i);

        if(d)

        {

            cout<<i;

            break;

        }

    }

    

    

    return 0;

}
// Slower C++ solution:
#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;

}


// Faster C++ solution for the same problem (measured speedup: 1.715892543293761x):
#include <bits/stdc++.h>



using namespace std;

int prime(int n) 

{ 

    if (n <= 1) 

        return 0; 

  

   

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

        if (n % i == 0) 

            return 0; 

  

    return 1; 

} 

int main()

{

   int n=0,x,a,b;

    cin>>x;

    



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

    {

       int d=prime(i);

        if(d)

        {

            cout<<i;

            break;

        }

    }

    

    

    return 0;

}
// Slower C++ solution:
//

// 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;

    }



}

// Faster C++ solution for the same problem (measured speedup: 1.627361774983055x):
#include<bits/stdc++.h>

#define     sc(a)       scanf("%d",&a)

#define     sc2(a,b)    scanf("%d%d",&a,&b)

#define     line        "\n"

#define     space       " "

#define     MAX         100010

#define     MOD         1000000007

#define     Q           int nn ; scanf("%d",&nn); for (int xx=0;xx<nn;xx++)

#define     ff          first

#define     ss          second

#define     pf(a)       printf("%d\n",a)

#define     pfs(a)      printf("%d ",a)

#define     pf2(a,b)    printf("%d %d\n",a,b)

#define     itm(it)     map<int,int>:: iterator it

#define     its(it)     set<int>:: iterator it

#define     ac_sort(v)  sort(v.begin(),v.end())

#define     dc_sort(v)  sort(v.rbegin(),v.rend())

typedef long long lld;

using namespace std;

int main()

{

    int n ; sc(n);

    bool f =0, flag =0;

    while (n){

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

            if (n%x==0) flag=1;

        }

        if (flag==0){

            break;

        }

        else flag=0,n++;

    }

    pf(n);

}
// Slower C++ solution:
#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;

}


// Faster C++ solution for the same problem (measured speedup: 1.7477252799227807x):
#include<bits/stdc++.h>

#define     sc(a)       scanf("%d",&a)

#define     sc2(a,b)    scanf("%d%d",&a,&b)

#define     line        "\n"

#define     space       " "

#define     MAX         100010

#define     MOD         1000000007

#define     Q           int nn ; scanf("%d",&nn); for (int xx=0;xx<nn;xx++)

#define     ff          first

#define     ss          second

#define     pf(a)       printf("%d\n",a)

#define     pfs(a)      printf("%d ",a)

#define     pf2(a,b)    printf("%d %d\n",a,b)

#define     itm(it)     map<int,int>:: iterator it

#define     its(it)     set<int>:: iterator it

#define     ac_sort(v)  sort(v.begin(),v.end())

#define     dc_sort(v)  sort(v.rbegin(),v.rend())

typedef long long lld;

using namespace std;

int main()

{

    int n ; sc(n);

    bool f =0, flag =0;

    while (n){

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

            if (n%x==0) flag=1;

        }

        if (flag==0){

            break;

        }

        else flag=0,n++;

    }

    pf(n);

}