stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

bool p(int n)

{

    if (n == 3 || n==2)

        {return true;}

    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;

}

int np(int n)

{

    int prime = n;

    bool x = false;

    while (!x)

    {

        prime++;



        if (p(prime))

            {x= true;}

    }



    return prime;

}





int main()

{

    int n;

    cin>>n;

    if(p(n))

    {

        cout<<n<<endl;

        return 0;

    }

    else

    cout << np(n);

    return 0;}


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

}
// Slower C++ solution:
#include <iostream>

#include <stdlib.h>

#include <string.h>



using namespace std;



int prime(long n);



int main()

{

    long n;

    cin>>n;

    /*if(n==2 || n==3)

    {

        cout<<n;

        return 0;

    }*/

    while(1)

    {

        if(prime(n))

        {

            cout<<n;

            break;

        }

        else

        {

            if(n%2)

        {

            n+=2;

        }

        else

            n++;

        }

    }



    return 0;

}

int prime(long n)

{

    long i;

    int flag=1;

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

    {

        if(!(n%i))

        {

            flag=0;

            break;

        }

    }

    return flag;

}


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

}
// 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.613613191653108x):
#include<iostream>

#include <algorithm>

#include<vector>

using namespace std;

bool is_prime(long long j)

{

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

	{

		if (j % i == 0)

		{

			return false;

		}

	}

	return true;

}

long long  solveitabdo(long long x)

{

	for (int  i = x; i < 1e9+7; i++)

	{

		if (is_prime(i))

		{

			return i;

		}

	}

}

int main()

{

	long long x;

	cin >> x;

	cout << solveitabdo(x);

}
// 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.7329598190287991x):
#include<iostream>

#include <algorithm>

#include<vector>

using namespace std;

bool is_prime(long long j)

{

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

	{

		if (j % i == 0)

		{

			return false;

		}

	}

	return true;

}

long long  solveitabdo(long long x)

{

	for (int  i = x; i < 1e9+7; i++)

	{

		if (is_prime(i))

		{

			return i;

		}

	}

}

int main()

{

	long long x;

	cin >> x;

	cout << solveitabdo(x);

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

}

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

#include <algorithm>

#include<vector>

using namespace std;

bool is_prime(long long j)

{

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

	{

		if (j % i == 0)

		{

			return false;

		}

	}

	return true;

}

long long  solveitabdo(long long x)

{

	for (int  i = x; i < 1e9+7; i++)

	{

		if (is_prime(i))

		{

			return i;

		}

	}

}

int main()

{

	long long x;

	cin >> x;

	cout << solveitabdo(x);

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

}


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

#include <algorithm>

#include<vector>

using namespace std;

bool is_prime(long long j)

{

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

	{

		if (j % i == 0)

		{

			return false;

		}

	}

	return true;

}

long long  solveitabdo(long long x)

{

	for (int  i = x; i < 1e9+7; i++)

	{

		if (is_prime(i))

		{

			return i;

		}

	}

}

int main()

{

	long long x;

	cin >> x;

	cout << solveitabdo(x);

}
// Slower C++ solution:
#include<iostream>

#include<string>

#include<algorithm>

#include<cstdlib>

#include<stack>

#include<queue>

#include<vector>

using namespace std;

bool arr[100100];

vector<long long int>v;

void sieve()

{

    long long int a, b, c, i, j, k;

    v.push_back(2);

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

    {

        if (arr[i] == false)

        {

            v.push_back(i);

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

            {

                arr[j] = true;

            }

        }

    }

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

    {

        if (arr[i] == false)

            v.push_back(i);

    }



}

int main()

{

	long long int a, b, c, d, i, j, k, m, l, t;

    sieve();

    cin >> a;

    l = 0;

    long long int h = v.size() - 1;

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

   b = it - v.begin();

   cout << v[b] << endl;

  

    return 0;

}

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

#include <algorithm>

#include<vector>

using namespace std;

bool is_prime(long long j)

{

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

	{

		if (j % i == 0)

		{

			return false;

		}

	}

	return true;

}

long long  solveitabdo(long long x)

{

	for (int  i = x; i < 1e9+7; i++)

	{

		if (is_prime(i))

		{

			return i;

		}

	}

}

int main()

{

	long long x;

	cin >> x;

	cout << solveitabdo(x);

}
// 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.608753554084016x):
#include <bits/stdc++.h>

 

using namespace std;

 

typedef long long ll;

 

const int N = 1e6+5;

 

bool is_prim(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(true){

        if(is_prim(x)){

            cout << x << "\n";

            return 0;

        }

        x++;

    }

    //

}
// 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.7277407512337153x):
#include <bits/stdc++.h>

 

using namespace std;

 

typedef long long ll;

 

const int N = 1e6+5;

 

bool is_prim(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(true){

        if(is_prim(x)){

            cout << x << "\n";

            return 0;

        }

        x++;

    }

    //

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

}

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

 

using namespace std;

 

typedef long long ll;

 

const int N = 1e6+5;

 

bool is_prim(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(true){

        if(is_prim(x)){

            cout << x << "\n";

            return 0;

        }

        x++;

    }

    //

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

}


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

 

using namespace std;

 

typedef long long ll;

 

const int N = 1e6+5;

 

bool is_prim(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(true){

        if(is_prim(x)){

            cout << x << "\n";

            return 0;

        }

        x++;

    }

    //

}
// Slower C++ solution:
#include<iostream>

#include<string>

#include<algorithm>

#include<cstdlib>

#include<stack>

#include<queue>

#include<vector>

using namespace std;

bool arr[100100];

vector<long long int>v;

void sieve()

{

    long long int a, b, c, i, j, k;

    v.push_back(2);

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

    {

        if (arr[i] == false)

        {

            v.push_back(i);

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

            {

                arr[j] = true;

            }

        }

    }

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

    {

        if (arr[i] == false)

            v.push_back(i);

    }



}

int main()

{

	long long int a, b, c, d, i, j, k, m, l, t;

    sieve();

    cin >> a;

    l = 0;

    long long int h = v.size() - 1;

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

   b = it - v.begin();

   cout << v[b] << endl;

  

    return 0;

}

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

 

using namespace std;

 

typedef long long ll;

 

const int N = 1e6+5;

 

bool is_prim(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(true){

        if(is_prim(x)){

            cout << x << "\n";

            return 0;

        }

        x++;

    }

    //

}
// 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.6097863550702944x):
#include<bits/stdc++.h>

using namespace std;

int is_prime(int x)

{

    int i;

    if(x==2){

        return 1;

    }

    if(x%2==0){

        return 0;

    }

    for(i=3;i<=sqrt(x);i=i+2){

        if(x%i==0){

            return 0;

        }

    }

    return 1;

}

int main()

{

   int x;

   cin>>x;

   while(1){

    if(1==is_prime(x)){

        cout<<x<<endl;

        break;

    }

    else{

        x++;

    }

   }

   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.7288499406104085x):
#include<bits/stdc++.h>

using namespace std;

int is_prime(int x)

{

    int i;

    if(x==2){

        return 1;

    }

    if(x%2==0){

        return 0;

    }

    for(i=3;i<=sqrt(x);i=i+2){

        if(x%i==0){

            return 0;

        }

    }

    return 1;

}

int main()

{

   int x;

   cin>>x;

   while(1){

    if(1==is_prime(x)){

        cout<<x<<endl;

        break;

    }

    else{

        x++;

    }

   }

   return 0;

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

}

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

using namespace std;

int is_prime(int x)

{

    int i;

    if(x==2){

        return 1;

    }

    if(x%2==0){

        return 0;

    }

    for(i=3;i<=sqrt(x);i=i+2){

        if(x%i==0){

            return 0;

        }

    }

    return 1;

}

int main()

{

   int x;

   cin>>x;

   while(1){

    if(1==is_prime(x)){

        cout<<x<<endl;

        break;

    }

    else{

        x++;

    }

   }

   return 0;

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

}


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

using namespace std;

int is_prime(int x)

{

    int i;

    if(x==2){

        return 1;

    }

    if(x%2==0){

        return 0;

    }

    for(i=3;i<=sqrt(x);i=i+2){

        if(x%i==0){

            return 0;

        }

    }

    return 1;

}

int main()

{

   int x;

   cin>>x;

   while(1){

    if(1==is_prime(x)){

        cout<<x<<endl;

        break;

    }

    else{

        x++;

    }

   }

   return 0;

}
// Slower C++ solution:
#include<iostream>

#include<string>

#include<algorithm>

#include<cstdlib>

#include<stack>

#include<queue>

#include<vector>

using namespace std;

bool arr[100100];

vector<long long int>v;

void sieve()

{

    long long int a, b, c, i, j, k;

    v.push_back(2);

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

    {

        if (arr[i] == false)

        {

            v.push_back(i);

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

            {

                arr[j] = true;

            }

        }

    }

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

    {

        if (arr[i] == false)

            v.push_back(i);

    }



}

int main()

{

	long long int a, b, c, d, i, j, k, m, l, t;

    sieve();

    cin >> a;

    l = 0;

    long long int h = v.size() - 1;

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

   b = it - v.begin();

   cout << v[b] << endl;

  

    return 0;

}

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

using namespace std;

int is_prime(int x)

{

    int i;

    if(x==2){

        return 1;

    }

    if(x%2==0){

        return 0;

    }

    for(i=3;i<=sqrt(x);i=i+2){

        if(x%i==0){

            return 0;

        }

    }

    return 1;

}

int main()

{

   int x;

   cin>>x;

   while(1){

    if(1==is_prime(x)){

        cout<<x<<endl;

        break;

    }

    else{

        x++;

    }

   }

   return 0;

}
// Slower C++ solution:
// https://atcoder.jp/contests/abc149/tasks/abc149_c

#include <bits/stdc++.h>

using namespace std;

#define int long long

#define REP(i, n) FOR(i, 0, n)

#define REPR(i, n) for (int i = n - 1; i >= 0; i--)

#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)

#define ALL(obj) (obj).begin(), (obj).end()

#define ALLR(obj) (obj).rbegin(), (obj).rend()

#define DIV(a, b) ((a - 1) / b + 1)



const int SZ = 1e5 + 10;



// constexprな素数列挙(エラトステネスの篩)

// https://259-momone.hatenablog.com/entry/2018/05/06/015026

template <int N> struct Prime {

    bool b[N + 1]; // trueなら素数

    constexpr Prime() : b() {

        for (int_fast64_t i = 0; i <= N; ++i)

            b[i] = true;

        b[0] = b[1] = false;

        for (int_fast64_t i = 2; i <= N; ++i) {

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

                b[j] = false;

        }

    }

};



signed main() {

    ios::sync_with_stdio(false);

    cin.tie(0);

    int X;

    cin >> X;

    constexpr auto prime = Prime<SZ>();

    while (true) {

        if (prime.b[X]) {

            cout << X << endl;

            break;

        }

        X++;

    }

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 1.170438906977887x):
// https://atcoder.jp/contests/abc149/tasks/abc149_c

#include <bits/stdc++.h>

using namespace std;

#define int long long

#define REP(i, n) FOR(i, 0, n)

#define REPR(i, n) for (int i = n - 1; i >= 0; i--)

#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)

#define ALL(obj) (obj).begin(), (obj).end()

#define ALLR(obj) (obj).rbegin(), (obj).rend()

#define DIV(a, b) ((a - 1) / b + 1)



const int SZ = 1e5 + 10;



// constexprな素数列挙(エラトステネスの篩)

// https://259-momone.hatenablog.com/entry/2018/05/06/015026

template <int N> struct Prime {

    bool b[N + 1]; // trueなら素数

    constexpr Prime() : b() {

        for (int_fast64_t i = 0; i <= N; ++i)

            b[i] = true;

        b[0] = b[1] = false;

        for (int_fast64_t i = 2; i <= N; ++i) {

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

                b[j] = false;

        }

    }

};

Prime<SZ> prime;



signed main() {

    ios::sync_with_stdio(false);

    cin.tie(0);

    int X;

    cin >> X;

    while (true) {

        if (prime.b[X]) {

            cout << X << endl;

            break;

        }

        X++;

    }

    return 0;

}