stablegradients/pie-gem5-pairs huggingface dataset:
// 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.416416595604232x):
#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;}
// 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.7945955410071797x):
#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;}
// 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.6061972082919458x):
#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;

}
// 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.7249953320935414x):
#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;

}
// 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.137912913703267x):
#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;

}
// 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.395513784898679x):
#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;

}
// 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.7887492730275725x):
#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;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main()

{

	int n;

	cin>>n;

	while(1)

	{

		bool k = 0;

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

			k = 1;

			break;

		}

		if(!k) cout<<n,exit(0);

		n++;

	}

}

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

}


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

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;

}

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

}




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

}


// Faster C++ solution for the same problem (measured speedup: 5.140464345976982x):
#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<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: 33.30911044320525x):
#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<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: 9.316162718805309x):
#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<bits/stdc++.h>

using namespace std;

int main()

{

    int x,i,flag;

    cin>>x;

    while(1)

    {

        flag=0;

        if(x==2)

        {

            cout<<x;

            break;

        }

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

        {

            if(x%i==0)

            {

                flag=1;

                break;

            }



        }

        if(flag==0)

        {

            cout<<x;

            break;

        }

        else

            x++;



    }

}


// Faster C++ solution for the same problem (measured speedup: 5.185825033358658x):
#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<bits/stdc++.h>

#include<string.h>

#include<cstring>

#define pb push_back

#define FAST ios::sync_with_stdio(0);cin.tie(),cout.tie();

typedef long long ll;

const long double pi = acos(-1.0);

const int mod = 1e9+7;

using namespace std;

 int is_prime(int n)

 {

     int i, root;

     if(n == 2) {

         return 1;

     }

     if(n % 2 == 0) {

         return 0;

     }

     root = sqrt(n);

     for(i = 3; i <= root; i = i + 2) {

         if(n % i == 0) {

             return 0;

         }

     }

     return 1;

 }



 int main()

 {

     int n, m,i;

         scanf("%d", &n);

         for( i=n;;i++)

         {

             if(is_prime(i))

                break;

         }



     cout<<i<<endl;

     return 0;

 }


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

}