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

using namespace std;

vector <bool> isprime (100005,true);

vector<int> prime;

vector<int> spf(100005);

void s(int n){

    isprime[0]=false;

    isprime[1]=false;

    for(int i=0;i<=n+1;i++){

        if(isprime[i]){

            prime.push_back(i);

            spf[i]=i;

        }

        for(int j=0;j<(int)prime.size() && i*prime[j]<=n+1 && prime[j]<=spf[i];j++){

            isprime[i*prime[j]]=false;

            spf[i*prime[j]]=prime[j];

        }

    }

}

int main(){

    int n;

    cin>>n;

    s(100004);

    if(isprime[n]==1){

        cout<<n;

    }

    else{

        int i=n+1;

        while(!isprime[i]){

            i++;

        }

        cout<<i;

    }

}

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

using namespace std;

bool isPrime(int n) {

  if (n < 2) return false;

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

    if (n % i == 0) {

      return false;

    }

  }

  return true;

}

int main(){

    int n;

    cin>>n;

    if(isPrime(n)==true){

        cout<<n<<endl;

        return 0;

    }

    else {

        for(int i=n+1;;i++){

            if(isPrime(i)==true){

                cout<<i<<endl;

                return 0;

            }

        }

    }

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

using namespace std;

vector <bool> isprime (100005,true);

vector<int> prime;

vector<int> spf(100005);

void s(int n){

    isprime[0]=false;

    isprime[1]=false;

    for(int i=0;i<=n+1;i++){

        if(isprime[i]){

            prime.push_back(i);

            spf[i]=i;

        }

        for(int j=0;j<(int)prime.size() && i*prime[j]<=n+1 && prime[j]<=spf[i];j++){

            isprime[i*prime[j]]=false;

            spf[i*prime[j]]=prime[j];

        }

    }

}

int main(){

    int n;

    cin>>n;

    s(100004);

    if(isprime[n]==1){

        cout<<n;

    }

    else{

        int i=n+1;

        while(!isprime[i]){

            i++;

        }

        cout<<i;

    }

}

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

using namespace std;



bool isPrime(int p)

{

    if (p <= 1)

        return false;

    if (p<= 3)

     return true;

    if (p%2 == 0 || p%3 == 0)

         return false;



    for (int i=5; i*i<=p; i=i+2)

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

           return false;



    return true;

}

int nextPrime(int P)

{

    if (P <= 1)

        return 2;



    int prime = P;

    bool rslt = false;

    while (!rslt) {

        prime++;



        if (isPrime(prime))

            rslt = true;



    }



    return prime;

}

int main()

{

    int P;

    cin>>P;



           if(isPrime(P))

             cout<<P;

           else

              cout << nextPrime(P);

  return 0;

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

using namespace std;

vector <bool> isprime (100005,true);

vector<int> prime;

vector<int> spf(100005);

void s(int n){

    isprime[0]=false;

    isprime[1]=false;

    for(int i=0;i<=n+1;i++){

        if(isprime[i]){

            prime.push_back(i);

            spf[i]=i;

        }

        for(int j=0;j<(int)prime.size() && i*prime[j]<=n+1 && prime[j]<=spf[i];j++){

            isprime[i*prime[j]]=false;

            spf[i*prime[j]]=prime[j];

        }

    }

}

int main(){

    int n;

    cin>>n;

    s(100004);

    if(isprime[n]==1){

        cout<<n;

    }

    else{

        int i=n+1;

        while(!isprime[i]){

            i++;

        }

        cout<<i;

    }

}

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

using namespace std;

int main()

{

    int n,c,i;

    scanf("%d",&n);

    if(n==2)

    {

        printf("%d",n);

        return 0;

    }

    while(1)

    {

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

        {

            c=0;

            if(n%i==0)

            {

                c=1;

                break;



            }

        }

        if(c==0)

        {

            printf("%d",n);

            break;

        }

        n++;

    }

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

using namespace std;

vector <bool> isprime (100005,true);

vector<int> prime;

vector<int> spf(100005);

void s(int n){

    isprime[0]=false;

    isprime[1]=false;

    for(int i=0;i<=n+1;i++){

        if(isprime[i]){

            prime.push_back(i);

            spf[i]=i;

        }

        for(int j=0;j<(int)prime.size() && i*prime[j]<=n+1 && prime[j]<=spf[i];j++){

            isprime[i*prime[j]]=false;

            spf[i*prime[j]]=prime[j];

        }

    }

}

int main(){

    int n;

    cin>>n;

    s(100004);

    if(isprime[n]==1){

        cout<<n;

    }

    else{

        int i=n+1;

        while(!isprime[i]){

            i++;

        }

        cout<<i;

    }

}

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

using namespace std;

int main() {

    long long n;

    cin >> n;

    int flag = 0;

    for (n ; ; n++)

    {

        flag = 0;

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

        {

            if (n % j == 0) {

                flag = 1;

                break;

            }

        }

        if (!flag) {

            cout << n << endl;

            return 0;

        }

    }

    return 0;

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



using namespace std;

typedef long long ll ;

const int N =  1e5 ;

int main()

{

    vector<int>primes;

    int vis[100001];

    memset(vis , 0 , sizeof vis);

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

    {

        if(!vis[i])

        {

            primes.push_back(i);

            for(int j = i+i ; j <= N ;j+=i)

            {

                vis[j]=1;

            }

        }

    }

    primes.push_back(100003);

    ll n;

    cin >> n;

    cout << *lower_bound(primes.begin(),primes.end(),n) ;

    return 0;

}


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

using namespace std;

int main() {

    long long n;

    cin >> n;

    int flag = 0;

    for (n ; ; n++)

    {

        flag = 0;

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

        {

            if (n % j == 0) {

                flag = 1;

                break;

            }

        }

        if (!flag) {

            cout << n << endl;

            return 0;

        }

    }

    return 0;

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

using namespace std;

vector <bool> isprime (100005,true);

vector<int> prime;

vector<int> spf(100005);

void s(int n){

    isprime[0]=false;

    isprime[1]=false;

    for(int i=0;i<=n+1;i++){

        if(isprime[i]){

            prime.push_back(i);

            spf[i]=i;

        }

        for(int j=0;j<(int)prime.size() && i*prime[j]<=n+1 && prime[j]<=spf[i];j++){

            isprime[i*prime[j]]=false;

            spf[i*prime[j]]=prime[j];

        }

    }

}

int main(){

    int n;

    cin>>n;

    s(100004);

    if(isprime[n]==1){

        cout<<n;

    }

    else{

        int i=n+1;

        while(!isprime[i]){

            i++;

        }

        cout<<i;

    }

}

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

using namespace std;

int main ()

{

    int n,i,j;

    bool flag=true;

     cin>>n;

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

   {

       flag=true;

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

    {

        if(i%j==0)

        {

          flag=false;

          break;

        }

    }

    if(flag==true)

    {

        cout<<i<<endl;

        i=-1;

    }

   }





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



using namespace std;

typedef long long ll ;

const int N =  1e5 ;

int main()

{

    vector<int>primes;

    int vis[100001];

    memset(vis , 0 , sizeof vis);

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

    {

        if(!vis[i])

        {

            primes.push_back(i);

            for(int j = i+i ; j <= N ;j+=i)

            {

                vis[j]=1;

            }

        }

    }

    primes.push_back(100003);

    ll n;

    cin >> n;

    cout << *lower_bound(primes.begin(),primes.end(),n) ;

    return 0;

}


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

using namespace std;

int main ()

{

    int n,i,j;

    bool flag=true;

     cin>>n;

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

   {

       flag=true;

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

    {

        if(i%j==0)

        {

          flag=false;

          break;

        }

    }

    if(flag==true)

    {

        cout<<i<<endl;

        i=-1;

    }

   }





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

using namespace std;

vector <bool> isprime (100005,true);

vector<int> prime;

vector<int> spf(100005);

void s(int n){

    isprime[0]=false;

    isprime[1]=false;

    for(int i=0;i<=n+1;i++){

        if(isprime[i]){

            prime.push_back(i);

            spf[i]=i;

        }

        for(int j=0;j<(int)prime.size() && i*prime[j]<=n+1 && prime[j]<=spf[i];j++){

            isprime[i*prime[j]]=false;

            spf[i*prime[j]]=prime[j];

        }

    }

}

int main(){

    int n;

    cin>>n;

    s(100004);

    if(isprime[n]==1){

        cout<<n;

    }

    else{

        int i=n+1;

        while(!isprime[i]){

            i++;

        }

        cout<<i;

    }

}

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

using namespace std;

 

int main(){

	   

	ios_base::sync_with_stdio(false);

	cin.tie(NULL);

	int n;

	cin>>n;

	while(1){

	   bool flag = true;

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

	        if(n%i==0){

	            flag = false;

	            break;

	        }

	    }

	    if(flag) break;

	    n++;

	}

	cout<< n <<endl;

	 

return 0;

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



using namespace std;

typedef long long ll ;

const int N =  1e5 ;

int main()

{

    vector<int>primes;

    int vis[100001];

    memset(vis , 0 , sizeof vis);

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

    {

        if(!vis[i])

        {

            primes.push_back(i);

            for(int j = i+i ; j <= N ;j+=i)

            {

                vis[j]=1;

            }

        }

    }

    primes.push_back(100003);

    ll n;

    cin >> n;

    cout << *lower_bound(primes.begin(),primes.end(),n) ;

    return 0;

}


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

using namespace std;

 

int main(){

	   

	ios_base::sync_with_stdio(false);

	cin.tie(NULL);

	int n;

	cin>>n;

	while(1){

	   bool flag = true;

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

	        if(n%i==0){

	            flag = false;

	            break;

	        }

	    }

	    if(flag) break;

	    n++;

	}

	cout<< n <<endl;

	 

return 0;

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

typedef long long int lli;

using namespace std;

int check(lli n){

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

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

    }

    return 1;

}

int main(){

    ios_base::sync_with_stdio(false);

    cin.tie(NULL);cout.tie(NULL);\

    lli n;

    cin>>n;

    if(check(n)==1){

            cout<<n;

            return 0;

        }

    while(n++){

        if(check(n)==1){

            cout<<n;

            return 0;

        }

    }

	return 0;

}


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



int isPrime(int n)

{

    int i,count=0;



    if(n>1)



    {

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

        {

            if(n % i == 0)

            {

                count++;

                break;

            }

        }

    }

    if(n==1)

        return 0;

    else

    {



        if(count==0)

        {

            return 1;

        }



        else

        {

            return 0;

        }

    }

}



int main()



{

    int number,ans;



    scanf("%d",&number);

    while(1)

    {

        ans = isPrime(number);

        if(ans == 1)

        {

            printf("%d",number );

            break ;

        }

        else

            number ++ ;







    }

    return 0;











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

#include<bits/stdc++.h>

using namespace std;

void print(vector<int>vec,int n){

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

        cout<<vec[i]<<" ";

    }

}



bool isPrime(int n){

    

    int i;

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

        if(!(n%i)){

            break;

        }

    }

    if(i<=sqrt(n)){

        return 0;

    }

    return 1;

}



int nextPrime(int N){

    bool x = 0;

    int i=1;

    while(!x){

        if(isPrime(N+i)){

            x=1;

        }

        i++;

    }

    return N+i-1;

}



int main()

{

    int n;

    cin>>n;

    bool a = isPrime(n);

    if(a){

        cout<<n<<endl;

    }

    else{

        cout<<nextPrime(n)<<endl;

    }

    

    

}

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



int isPrime(int n)

{

    int i,count=0;



    if(n>1)



    {

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

        {

            if(n % i == 0)

            {

                count++;

                break;

            }

        }

    }

    if(n==1)

        return 0;

    else

    {



        if(count==0)

        {

            return 1;

        }



        else

        {

            return 0;

        }

    }

}



int main()



{

    int number,ans;



    scanf("%d",&number);

    while(1)

    {

        ans = isPrime(number);

        if(ans == 1)

        {

            printf("%d",number );

            break ;

        }

        else

            number ++ ;







    }

    return 0;











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

using namespace std;

int main()

{

int n,i,j;

cin>>n;

for(j=n;;j++)

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

{

   if(j%i==0)

    break;

    

    

}

if(i==(n/2)+1)

break;

}

cout<<j;

return 0;

}

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



int isPrime(int n)

{

    int i,count=0;



    if(n>1)



    {

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

        {

            if(n % i == 0)

            {

                count++;

                break;

            }

        }

    }

    if(n==1)

        return 0;

    else

    {



        if(count==0)

        {

            return 1;

        }



        else

        {

            return 0;

        }

    }

}



int main()



{

    int number,ans;



    scanf("%d",&number);

    while(1)

    {

        ans = isPrime(number);

        if(ans == 1)

        {

            printf("%d",number );

            break ;

        }

        else

            number ++ ;







    }

    return 0;











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

using namespace std;

vector <bool> isprime (100005,true);

vector<int> prime;

vector<int> spf(100005);

void s(int n){

    isprime[0]=false;

    isprime[1]=false;

    for(int i=0;i<=n+1;i++){

        if(isprime[i]){

            prime.push_back(i);

            spf[i]=i;

        }

        for(int j=0;j<(int)prime.size() && i*prime[j]<=n+1 && prime[j]<=spf[i];j++){

            isprime[i*prime[j]]=false;

            spf[i*prime[j]]=prime[j];

        }

    }

}

int main(){

    int n;

    cin>>n;

    s(100004);

    if(isprime[n]==1){

        cout<<n;

    }

    else{

        int i=n+1;

        while(!isprime[i]){

            i++;

        }

        cout<<i;

    }

}

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



int isPrime(int n)

{

    int i,count=0;



    if(n>1)



    {

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

        {

            if(n % i == 0)

            {

                count++;

                break;

            }

        }

    }

    if(n==1)

        return 0;

    else

    {



        if(count==0)

        {

            return 1;

        }



        else

        {

            return 0;

        }

    }

}



int main()



{

    int number,ans;



    scanf("%d",&number);

    while(1)

    {

        ans = isPrime(number);

        if(ans == 1)

        {

            printf("%d",number );

            break ;

        }

        else

            number ++ ;







    }

    return 0;











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

using namespace std;

bool isPrime(int n) {

  if (n < 2) return false;

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

    if (n % i == 0) {

      return false;

    }

  }

  return true;

}

int main(){

    int n;

    cin>>n;

    if(isPrime(n)==true){

        cout<<n<<endl;

        return 0;

    }

    else {

        for(int i=n+1;;i++){

            if(isPrime(i)==true){

                cout<<i<<endl;

                return 0;

            }

        }

    }

}


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



int isPrime(int n)

{

    int i,count=0;



    if(n>1)



    {

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

        {

            if(n % i == 0)

            {

                count++;

                break;

            }

        }

    }

    if(n==1)

        return 0;

    else

    {



        if(count==0)

        {

            return 1;

        }



        else

        {

            return 0;

        }

    }

}



int main()



{

    int number,ans;



    scanf("%d",&number);

    while(1)

    {

        ans = isPrime(number);

        if(ans == 1)

        {

            printf("%d",number );

            break ;

        }

        else

            number ++ ;







    }

    return 0;











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

using namespace std;



bool isPrime(int p)

{

    if (p <= 1)

        return false;

    if (p<= 3)

     return true;

    if (p%2 == 0 || p%3 == 0)

         return false;



    for (int i=5; i*i<=p; i=i+2)

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

           return false;



    return true;

}

int nextPrime(int P)

{

    if (P <= 1)

        return 2;



    int prime = P;

    bool rslt = false;

    while (!rslt) {

        prime++;



        if (isPrime(prime))

            rslt = true;



    }



    return prime;

}

int main()

{

    int P;

    cin>>P;



           if(isPrime(P))

             cout<<P;

           else

              cout << nextPrime(P);

  return 0;

}


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



int isPrime(int n)

{

    int i,count=0;



    if(n>1)



    {

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

        {

            if(n % i == 0)

            {

                count++;

                break;

            }

        }

    }

    if(n==1)

        return 0;

    else

    {



        if(count==0)

        {

            return 1;

        }



        else

        {

            return 0;

        }

    }

}



int main()



{

    int number,ans;



    scanf("%d",&number);

    while(1)

    {

        ans = isPrime(number);

        if(ans == 1)

        {

            printf("%d",number );

            break ;

        }

        else

            number ++ ;







    }

    return 0;











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

using namespace std;

int main()

{

    int n,c,i;

    scanf("%d",&n);

    if(n==2)

    {

        printf("%d",n);

        return 0;

    }

    while(1)

    {

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

        {

            c=0;

            if(n%i==0)

            {

                c=1;

                break;



            }

        }

        if(c==0)

        {

            printf("%d",n);

            break;

        }

        n++;

    }

}

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



int isPrime(int n)

{

    int i,count=0;



    if(n>1)



    {

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

        {

            if(n % i == 0)

            {

                count++;

                break;

            }

        }

    }

    if(n==1)

        return 0;

    else

    {



        if(count==0)

        {

            return 1;

        }



        else

        {

            return 0;

        }

    }

}



int main()



{

    int number,ans;



    scanf("%d",&number);

    while(1)

    {

        ans = isPrime(number);

        if(ans == 1)

        {

            printf("%d",number );

            break ;

        }

        else

            number ++ ;







    }

    return 0;











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



using namespace std;

typedef long long ll ;

const int N =  1e5 ;

int main()

{

    vector<int>primes;

    int vis[100001];

    memset(vis , 0 , sizeof vis);

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

    {

        if(!vis[i])

        {

            primes.push_back(i);

            for(int j = i+i ; j <= N ;j+=i)

            {

                vis[j]=1;

            }

        }

    }

    primes.push_back(100003);

    ll n;

    cin >> n;

    cout << *lower_bound(primes.begin(),primes.end(),n) ;

    return 0;

}


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



int isPrime(int n)

{

    int i,count=0;



    if(n>1)



    {

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

        {

            if(n % i == 0)

            {

                count++;

                break;

            }

        }

    }

    if(n==1)

        return 0;

    else

    {



        if(count==0)

        {

            return 1;

        }



        else

        {

            return 0;

        }

    }

}



int main()



{

    int number,ans;



    scanf("%d",&number);

    while(1)

    {

        ans = isPrime(number);

        if(ans == 1)

        {

            printf("%d",number );

            break ;

        }

        else

            number ++ ;







    }

    return 0;











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

using namespace std;

int main() {

    long long n;

    cin >> n;

    int flag = 0;

    for (n ; ; n++)

    {

        flag = 0;

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

        {

            if (n % j == 0) {

                flag = 1;

                break;

            }

        }

        if (!flag) {

            cout << n << endl;

            return 0;

        }

    }

    return 0;

}

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



int isPrime(int n)

{

    int i,count=0;



    if(n>1)



    {

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

        {

            if(n % i == 0)

            {

                count++;

                break;

            }

        }

    }

    if(n==1)

        return 0;

    else

    {



        if(count==0)

        {

            return 1;

        }



        else

        {

            return 0;

        }

    }

}



int main()



{

    int number,ans;



    scanf("%d",&number);

    while(1)

    {

        ans = isPrime(number);

        if(ans == 1)

        {

            printf("%d",number );

            break ;

        }

        else

            number ++ ;







    }

    return 0;











}