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

#define mx 100001

#define tc int t;cin>>t;for(int raf=1;raf<=t;raf++)

#define fm cout<<"Case "<<raf<<": "

using namespace std;

bool prime[100005];

void sieve()

{

	int n=100004;

	int p=sqrt(n);

	for(int i=4;i<=n;i+=2)prime[i]=1;

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

		if(!prime[i])

		{

			for(int j=i*i;j<=n;j+=i) prime[j]=1;

		}

	}

	prime[1]=1;



}

int main()

{

    int b,c,d,e,f,i,j,n;

    cin>>n;

    sieve();

    for(i=n;;i++)

    {

        if(!prime[i])

        {

            cout<<i<<endl;

            break;

        }

    }

    return 0;

}


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

#include <ext/pb_ds/assoc_container.hpp>

#include <ext/pb_ds/tree_policy.hpp>



using namespace std;

using namespace __gnu_pbds;



#define Q int t; scanf("%d", &t); for(int q=1; q<=t; q++)

typedef long long int lli;

typedef pair<int, int> pi;

#define oset tree<int, null_type,greater<int>, rb_tree_tag,tree_order_statistics_node_update>



bool isprime(int n)

{

    bool fl = false;

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

        if(n%i == 0){

            fl = true;

            break;

        }

    }

    return fl;

}



int main()

{

    int n;

    cin >> n;

    while(isprime(n)){

        n++;

    }

    cout << n;



    return 0;

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

#define mx 100001

#define tc int t;cin>>t;for(int raf=1;raf<=t;raf++)

#define fm cout<<"Case "<<raf<<": "

using namespace std;

bool prime[100005];

void sieve()

{

	int n=100004;

	int p=sqrt(n);

	for(int i=4;i<=n;i+=2)prime[i]=1;

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

		if(!prime[i])

		{

			for(int j=i*i;j<=n;j+=i) prime[j]=1;

		}

	}

	prime[1]=1;



}

int main()

{

    int b,c,d,e,f,i,j,n;

    cin>>n;

    sieve();

    for(i=n;;i++)

    {

        if(!prime[i])

        {

            cout<<i<<endl;

            break;

        }

    }

    return 0;

}


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

using namespace std;

int main(){

    int t,i,p=0,j,ans;

    cin>>t;

    if(t==2){

        cout<<"2"<<endl;

    }

    else{

    i=t;

    while(1){

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

        if(i%j==0){

            p++;

        }}

    if(p==0){

            ans=i;

            goto e;

    }

    p=0;

i++;}



e:

    cout<<ans<<endl;}

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

#define mx 100001

#define tc int t;cin>>t;for(int raf=1;raf<=t;raf++)

#define fm cout<<"Case "<<raf<<": "

using namespace std;

bool prime[100005];

void sieve()

{

	int n=100004;

	int p=sqrt(n);

	for(int i=4;i<=n;i+=2)prime[i]=1;

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

		if(!prime[i])

		{

			for(int j=i*i;j<=n;j+=i) prime[j]=1;

		}

	}

	prime[1]=1;



}

int main()

{

    int b,c,d,e,f,i,j,n;

    cin>>n;

    sieve();

    for(i=n;;i++)

    {

        if(!prime[i])

        {

            cout<<i<<endl;

            break;

        }

    }

    return 0;

}


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



using namespace std;



int main()

{

    int x;

    scanf("%d",&x);

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

    {

        if(x%i==0)

        {

            x++;

            i=1;

            continue;

        }



    }

    printf("%d",x);

    return 0;

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

#define mx 100001

#define tc int t;cin>>t;for(int raf=1;raf<=t;raf++)

#define fm cout<<"Case "<<raf<<": "

using namespace std;

bool prime[100005];

void sieve()

{

	int n=100004;

	int p=sqrt(n);

	for(int i=4;i<=n;i+=2)prime[i]=1;

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

		if(!prime[i])

		{

			for(int j=i*i;j<=n;j+=i) prime[j]=1;

		}

	}

	prime[1]=1;



}

int main()

{

    int b,c,d,e,f,i,j,n;

    cin>>n;

    sieve();

    for(i=n;;i++)

    {

        if(!prime[i])

        {

            cout<<i<<endl;

            break;

        }

    }

    return 0;

}


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

using namespace std;

bool isPrime(int num);



int main()

{

	ios_base::sync_with_stdio(false);

	cin.tie(NULL);

	int x;

	cin>>x;

	bool a=true, b;

	while(a)

	{

		b=isPrime(x);

		if(!b)	x++;

		else

		{

			cout<<x;

			a=false;

		}

	}

}

bool isPrime(int num)

{

	bool flag = true;

	for (int i = 2; i <= num / 2; i++)

	{

		if (num % i == 0)

		{

			flag = false;

			break;

		}

	}

	return flag;

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



using namespace std;



void solve(){

    long long count, n;

    cin>>n;

    while(true){

        count = 0;

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

            if(n % i == 0){

                count++;

                break;

            }

        }

        if(count == 0){

            cout<<n;

            break;

        }

        n++;

    }

    

}



int main(){

    solve();

    return 0;

}

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



int isprime(int num)

{

	int i = 2, count=0;

	while(i<num)

	{

		if(num % i == 0)

		    count++;

		

		i++;

	}

	if(count > 1)

	return 0;

	else

		return 1;

}

int main()

{

	int num, i;

	scanf("%d", &num);

	i = num;

	for(i = num; ; i++)

	{

		if(isprime(i))

		break;

	}

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

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

#include<string>

#include<cmath>

#include<vector>

using std::cin;

using std::cout;

using std::vector;

int prime(int n)

{

	int flag=0,i,j;

	for(i=n;;i++)

	{

		flag=1;

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

		{

			if(i%j==0){

				flag=0;

				break;

			}

		}

		if(1==flag)

			break;

	}

	return i;

}

int main(){

	int n;

	cin>>n;

	cout<<prime(n);

	return 0;

}

			


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



int isprime(int num)

{

	int i = 2, count=0;

	while(i<num)

	{

		if(num % i == 0)

		    count++;

		

		i++;

	}

	if(count > 1)

	return 0;

	else

		return 1;

}

int main()

{

	int num, i;

	scanf("%d", &num);

	i = num;

	for(i = num; ; i++)

	{

		if(isprime(i))

		break;

	}

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

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

#define mx 100001

#define tc int t;cin>>t;for(int raf=1;raf<=t;raf++)

#define fm cout<<"Case "<<raf<<": "

using namespace std;

bool prime[100005];

void sieve()

{

	int n=100004;

	int p=sqrt(n);

	for(int i=4;i<=n;i+=2)prime[i]=1;

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

		if(!prime[i])

		{

			for(int j=i*i;j<=n;j+=i) prime[j]=1;

		}

	}

	prime[1]=1;



}

int main()

{

    int b,c,d,e,f,i,j,n;

    cin>>n;

    sieve();

    for(i=n;;i++)

    {

        if(!prime[i])

        {

            cout<<i<<endl;

            break;

        }

    }

    return 0;

}


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



int isprime(int num)

{

	int i = 2, count=0;

	while(i<num)

	{

		if(num % i == 0)

		    count++;

		

		i++;

	}

	if(count > 1)

	return 0;

	else

		return 1;

}

int main()

{

	int num, i;

	scanf("%d", &num);

	i = num;

	for(i = num; ; i++)

	{

		if(isprime(i))

		break;

	}

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

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

#include <ext/pb_ds/assoc_container.hpp>

#include <ext/pb_ds/tree_policy.hpp>



using namespace std;

using namespace __gnu_pbds;



#define Q int t; scanf("%d", &t); for(int q=1; q<=t; q++)

typedef long long int lli;

typedef pair<int, int> pi;

#define oset tree<int, null_type,greater<int>, rb_tree_tag,tree_order_statistics_node_update>



bool isprime(int n)

{

    bool fl = false;

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

        if(n%i == 0){

            fl = true;

            break;

        }

    }

    return fl;

}



int main()

{

    int n;

    cin >> n;

    while(isprime(n)){

        n++;

    }

    cout << n;



    return 0;

}


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



int isprime(int num)

{

	int i = 2, count=0;

	while(i<num)

	{

		if(num % i == 0)

		    count++;

		

		i++;

	}

	if(count > 1)

	return 0;

	else

		return 1;

}

int main()

{

	int num, i;

	scanf("%d", &num);

	i = num;

	for(i = num; ; i++)

	{

		if(isprime(i))

		break;

	}

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

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

using namespace std;

int main(){

    int t,i,p=0,j,ans;

    cin>>t;

    if(t==2){

        cout<<"2"<<endl;

    }

    else{

    i=t;

    while(1){

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

        if(i%j==0){

            p++;

        }}

    if(p==0){

            ans=i;

            goto e;

    }

    p=0;

i++;}



e:

    cout<<ans<<endl;}

}


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



int isprime(int num)

{

	int i = 2, count=0;

	while(i<num)

	{

		if(num % i == 0)

		    count++;

		

		i++;

	}

	if(count > 1)

	return 0;

	else

		return 1;

}

int main()

{

	int num, i;

	scanf("%d", &num);

	i = num;

	for(i = num; ; i++)

	{

		if(isprime(i))

		break;

	}

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

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



using namespace std;



int main()

{

    int x;

    scanf("%d",&x);

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

    {

        if(x%i==0)

        {

            x++;

            i=1;

            continue;

        }



    }

    printf("%d",x);

    return 0;

}


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



int isprime(int num)

{

	int i = 2, count=0;

	while(i<num)

	{

		if(num % i == 0)

		    count++;

		

		i++;

	}

	if(count > 1)

	return 0;

	else

		return 1;

}

int main()

{

	int num, i;

	scanf("%d", &num);

	i = num;

	for(i = num; ; i++)

	{

		if(isprime(i))

		break;

	}

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

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

using namespace std;

bool isPrime(int num);



int main()

{

	ios_base::sync_with_stdio(false);

	cin.tie(NULL);

	int x;

	cin>>x;

	bool a=true, b;

	while(a)

	{

		b=isPrime(x);

		if(!b)	x++;

		else

		{

			cout<<x;

			a=false;

		}

	}

}

bool isPrime(int num)

{

	bool flag = true;

	for (int i = 2; i <= num / 2; i++)

	{

		if (num % i == 0)

		{

			flag = false;

			break;

		}

	}

	return flag;

}


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



int isprime(int num)

{

	int i = 2, count=0;

	while(i<num)

	{

		if(num % i == 0)

		    count++;

		

		i++;

	}

	if(count > 1)

	return 0;

	else

		return 1;

}

int main()

{

	int num, i;

	scanf("%d", &num);

	i = num;

	for(i = num; ; i++)

	{

		if(isprime(i))

		break;

	}

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

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

#include<bits/stdc++.h>

using namespace std;



bitset<100010> prime;

const int ub = 100003;



void sieve()

{

    prime.set();

    prime[0] = prime[1] = 0;



    for(int I = 4; I<=ub; I+=2)

    {

        prime[I] = 0;

    }



    for(int I = 3; I*I<=ub; I+=2)

    {

        if(prime[I])

        {

            for(int J = I*I; J<=ub; J+=I)

            {

                prime[J] = 0;

            }

        }

    }



}



int main()

{

    ios_base::sync_with_stdio(false);

    cin.tie(NULL);



    sieve();

    int N;

    cin>>N;

    while(!prime[N])N++;

    cout<<N<<endl;

    return 0;

}


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



int isprime(int num)

{

	int i = 2, count=0;

	while(i<num)

	{

		if(num % i == 0)

		    count++;

		

		i++;

	}

	if(count > 1)

	return 0;

	else

		return 1;

}

int main()

{

	int num, i;

	scanf("%d", &num);

	i = num;

	for(i = num; ; i++)

	{

		if(isprime(i))

		break;

	}

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

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



using namespace std;



void solve(){

    long long count, n;

    cin>>n;

    while(true){

        count = 0;

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

            if(n % i == 0){

                count++;

                break;

            }

        }

        if(count == 0){

            cout<<n;

            break;

        }

        n++;

    }

    

}



int main(){

    solve();

    return 0;

}

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

#include<math.h>

int main()

{

    int i,j,x,n,r=0;

    scanf("%d", &x);

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

    {

        r=0;

        if(i==2)

        {

           break;

        }

        else

        {

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

        {

            if(i%j==0)

            {

                r=0;

                break;

            }

            else

                r=1;



        }

        }

        if(r==1)

            break;

    }

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

    return 0;

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

#include<string>

#include<cmath>

#include<vector>

using std::cin;

using std::cout;

using std::vector;

int prime(int n)

{

	int flag=0,i,j;

	for(i=n;;i++)

	{

		flag=1;

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

		{

			if(i%j==0){

				flag=0;

				break;

			}

		}

		if(1==flag)

			break;

	}

	return i;

}

int main(){

	int n;

	cin>>n;

	cout<<prime(n);

	return 0;

}

			


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

#include<math.h>

int main()

{

    int i,j,x,n,r=0;

    scanf("%d", &x);

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

    {

        r=0;

        if(i==2)

        {

           break;

        }

        else

        {

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

        {

            if(i%j==0)

            {

                r=0;

                break;

            }

            else

                r=1;



        }

        }

        if(r==1)

            break;

    }

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

    return 0;

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

#define mx 100001

#define tc int t;cin>>t;for(int raf=1;raf<=t;raf++)

#define fm cout<<"Case "<<raf<<": "

using namespace std;

bool prime[100005];

void sieve()

{

	int n=100004;

	int p=sqrt(n);

	for(int i=4;i<=n;i+=2)prime[i]=1;

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

		if(!prime[i])

		{

			for(int j=i*i;j<=n;j+=i) prime[j]=1;

		}

	}

	prime[1]=1;



}

int main()

{

    int b,c,d,e,f,i,j,n;

    cin>>n;

    sieve();

    for(i=n;;i++)

    {

        if(!prime[i])

        {

            cout<<i<<endl;

            break;

        }

    }

    return 0;

}


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

#include<math.h>

int main()

{

    int i,j,x,n,r=0;

    scanf("%d", &x);

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

    {

        r=0;

        if(i==2)

        {

           break;

        }

        else

        {

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

        {

            if(i%j==0)

            {

                r=0;

                break;

            }

            else

                r=1;



        }

        }

        if(r==1)

            break;

    }

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

    return 0;

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

#include <ext/pb_ds/assoc_container.hpp>

#include <ext/pb_ds/tree_policy.hpp>



using namespace std;

using namespace __gnu_pbds;



#define Q int t; scanf("%d", &t); for(int q=1; q<=t; q++)

typedef long long int lli;

typedef pair<int, int> pi;

#define oset tree<int, null_type,greater<int>, rb_tree_tag,tree_order_statistics_node_update>



bool isprime(int n)

{

    bool fl = false;

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

        if(n%i == 0){

            fl = true;

            break;

        }

    }

    return fl;

}



int main()

{

    int n;

    cin >> n;

    while(isprime(n)){

        n++;

    }

    cout << n;



    return 0;

}


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

#include<math.h>

int main()

{

    int i,j,x,n,r=0;

    scanf("%d", &x);

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

    {

        r=0;

        if(i==2)

        {

           break;

        }

        else

        {

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

        {

            if(i%j==0)

            {

                r=0;

                break;

            }

            else

                r=1;



        }

        }

        if(r==1)

            break;

    }

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

    return 0;

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

using namespace std;

int main(){

    int t,i,p=0,j,ans;

    cin>>t;

    if(t==2){

        cout<<"2"<<endl;

    }

    else{

    i=t;

    while(1){

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

        if(i%j==0){

            p++;

        }}

    if(p==0){

            ans=i;

            goto e;

    }

    p=0;

i++;}



e:

    cout<<ans<<endl;}

}


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

#include<math.h>

int main()

{

    int i,j,x,n,r=0;

    scanf("%d", &x);

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

    {

        r=0;

        if(i==2)

        {

           break;

        }

        else

        {

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

        {

            if(i%j==0)

            {

                r=0;

                break;

            }

            else

                r=1;



        }

        }

        if(r==1)

            break;

    }

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

    return 0;

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



using namespace std;



int main()

{

    int x;

    scanf("%d",&x);

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

    {

        if(x%i==0)

        {

            x++;

            i=1;

            continue;

        }



    }

    printf("%d",x);

    return 0;

}


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

#include<math.h>

int main()

{

    int i,j,x,n,r=0;

    scanf("%d", &x);

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

    {

        r=0;

        if(i==2)

        {

           break;

        }

        else

        {

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

        {

            if(i%j==0)

            {

                r=0;

                break;

            }

            else

                r=1;



        }

        }

        if(r==1)

            break;

    }

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

    return 0;

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

using namespace std;

bool isPrime(int num);



int main()

{

	ios_base::sync_with_stdio(false);

	cin.tie(NULL);

	int x;

	cin>>x;

	bool a=true, b;

	while(a)

	{

		b=isPrime(x);

		if(!b)	x++;

		else

		{

			cout<<x;

			a=false;

		}

	}

}

bool isPrime(int num)

{

	bool flag = true;

	for (int i = 2; i <= num / 2; i++)

	{

		if (num % i == 0)

		{

			flag = false;

			break;

		}

	}

	return flag;

}


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

#include<math.h>

int main()

{

    int i,j,x,n,r=0;

    scanf("%d", &x);

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

    {

        r=0;

        if(i==2)

        {

           break;

        }

        else

        {

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

        {

            if(i%j==0)

            {

                r=0;

                break;

            }

            else

                r=1;



        }

        }

        if(r==1)

            break;

    }

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

    return 0;

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

#include<bits/stdc++.h>

using namespace std;



bitset<100010> prime;

const int ub = 100003;



void sieve()

{

    prime.set();

    prime[0] = prime[1] = 0;



    for(int I = 4; I<=ub; I+=2)

    {

        prime[I] = 0;

    }



    for(int I = 3; I*I<=ub; I+=2)

    {

        if(prime[I])

        {

            for(int J = I*I; J<=ub; J+=I)

            {

                prime[J] = 0;

            }

        }

    }



}



int main()

{

    ios_base::sync_with_stdio(false);

    cin.tie(NULL);



    sieve();

    int N;

    cin>>N;

    while(!prime[N])N++;

    cout<<N<<endl;

    return 0;

}


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

#include<math.h>

int main()

{

    int i,j,x,n,r=0;

    scanf("%d", &x);

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

    {

        r=0;

        if(i==2)

        {

           break;

        }

        else

        {

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

        {

            if(i%j==0)

            {

                r=0;

                break;

            }

            else

                r=1;



        }

        }

        if(r==1)

            break;

    }

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

    return 0;

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



using namespace std;



void solve(){

    long long count, n;

    cin>>n;

    while(true){

        count = 0;

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

            if(n % i == 0){

                count++;

                break;

            }

        }

        if(count == 0){

            cout<<n;

            break;

        }

        n++;

    }

    

}



int main(){

    solve();

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.2894166209901945x):
#include<stdio.h>//khata



int isPrime(int n)

{

    int i;



    if(n <= 1)

        return 0;

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

    {

        if(n%i == 0)

            return 0;

    }

    return 1;

}



int finding_prime(int n)

{

    while(isPrime(n) != 1)

    {

        n++;

    }



    return n;

}



int main()

{

    int x, returned;



    scanf("%d", &x);



    returned = isPrime(x);



    if(returned == 1)

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



    else if(returned == 0)

    {

        x=finding_prime(x);

    }



    if(returned == 0)

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



    return 0;

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

#include<string>

#include<cmath>

#include<vector>

using std::cin;

using std::cout;

using std::vector;

int prime(int n)

{

	int flag=0,i,j;

	for(i=n;;i++)

	{

		flag=1;

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

		{

			if(i%j==0){

				flag=0;

				break;

			}

		}

		if(1==flag)

			break;

	}

	return i;

}

int main(){

	int n;

	cin>>n;

	cout<<prime(n);

	return 0;

}

			


// Faster C++ solution for the same problem (measured speedup: 5.246725241044152x):
#include<stdio.h>//khata



int isPrime(int n)

{

    int i;



    if(n <= 1)

        return 0;

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

    {

        if(n%i == 0)

            return 0;

    }

    return 1;

}



int finding_prime(int n)

{

    while(isPrime(n) != 1)

    {

        n++;

    }



    return n;

}



int main()

{

    int x, returned;



    scanf("%d", &x);



    returned = isPrime(x);



    if(returned == 1)

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



    else if(returned == 0)

    {

        x=finding_prime(x);

    }



    if(returned == 0)

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



    return 0;

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

#define mx 100001

#define tc int t;cin>>t;for(int raf=1;raf<=t;raf++)

#define fm cout<<"Case "<<raf<<": "

using namespace std;

bool prime[100005];

void sieve()

{

	int n=100004;

	int p=sqrt(n);

	for(int i=4;i<=n;i+=2)prime[i]=1;

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

		if(!prime[i])

		{

			for(int j=i*i;j<=n;j+=i) prime[j]=1;

		}

	}

	prime[1]=1;



}

int main()

{

    int b,c,d,e,f,i,j,n;

    cin>>n;

    sieve();

    for(i=n;;i++)

    {

        if(!prime[i])

        {

            cout<<i<<endl;

            break;

        }

    }

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 7.296528560505047x):
#include<stdio.h>//khata



int isPrime(int n)

{

    int i;



    if(n <= 1)

        return 0;

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

    {

        if(n%i == 0)

            return 0;

    }

    return 1;

}



int finding_prime(int n)

{

    while(isPrime(n) != 1)

    {

        n++;

    }



    return n;

}



int main()

{

    int x, returned;



    scanf("%d", &x);



    returned = isPrime(x);



    if(returned == 1)

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



    else if(returned == 0)

    {

        x=finding_prime(x);

    }



    if(returned == 0)

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



    return 0;

}