stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

#define M 1000000

bool marked[M];







void sieve(int n)

{

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

    {

        if (marked[i] == false)

        {

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

            {

                marked[j] = true;

            }

        }

    }

}

bool isPrime(int n)

{

    if (n < 2)

        return false;

    if (n == 2)

        return true;

    if (n % 2 == 0)

        return false;

    if (marked[n] == false) return true;

    else return false;

}

int main()

{

    int i,j,k,n,m;

    sieve(M);

    cin>>n;

    for(i=n; ; i++)

    {

        if(isPrime(i))

        {

            cout<<i;

            break;

        }

    }

}


// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;



#define TC int n;scanf("%d",&n);while(n--)

#define lld long long int



int main()

{

    int n=0,i=0;

    cin>>n;

    int k=sqrt(n);

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

    {

        if(n%i==0)

        {

            ++n;

            k=sqrt(n);

            i=1;

        }

    }

    cout<<n;

    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

#define NN 1000090

bool arr[NN]{};

int main() {

	int num; std::cin >> num;

	for (int x = 0; x < NN; x++)arr[x] = 1;



	for (int x = 2; x <= num+100; x++) {

		if (arr[x]) {

			for (int z = x + x; z <= num+100; z+=x) {

				arr[z] = 0;

			}

		}

	}



	if (arr[num]) std::cout << num;

	else {

		int a = num + 1;

		while (!arr[a]) { a++; };

		std::cout << a;

	}

}

// Optimized solution to the same problem (faster):
#include<bits/stdc++.h>

using namespace std;

int main()

{

    int n,i,j;

    cin>>n;

    for(i=n;;i++)

    {

        int f=0;

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

        {

            if(i%j==0) f=1;

        }

        if(f==0) break;

    }

    cout<<i;

    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
//2019.12.29

//PrimeNumeber.

#include<iostream>

#include<vector>

using namespace std;



struct PrimeNumber{//Check prime number.

	std::vector<int> jud;//0 or 1.

	

	PrimeNumber(int n):jud(n+1,-1){//constructor.

		jud[0]=jud[1]=0;

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

			if(jud[i]==-1){

				jud[i]=1;

				for(int j=i+i;j<=n;j+=i) jud[j]=0;

			}

		}

	}

};



int main(){

	PrimeNumber cla((int)2e5);

	

	int x;

	cin>>x;

	

	while(1){

		if(cla.jud[x]==1) break;

		x++;

	}

	

	cout<<x<<endl;

}


// Optimized solution to the same problem (faster):
/*

Date: 2019/12/29.

Name: AtCoder ABC149 C "Next Prime".

Category: Prime number.

*/

#include<iostream>

#include<vector>

using namespace std;



struct PrimeNumber{//Check prime number.

	std::vector<int> jud;//0 or 1.

	

	PrimeNumber(int n):jud(n+1,-1){//constructor.

		jud[0]=jud[1]=0;

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

			if(jud[i]==-1){

				jud[i]=1;

				for(int j=i+i;j<=n;j+=i) jud[j]=0;

			}

		}

	}

};



int main(){

	PrimeNumber cla((int)1e5+3);

	

	int x;

	cin>>x;

	

	while(1){

		if(cla.jud[x]==1) break;

		x++;

	}

	

	cout<<x<<endl;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

vector<int> prime;

vector<bool> tmp(100004, true);

void sieve(){

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

		if(tmp[i]){

			for(int j=i*i;j<100004;j+=i) tmp[j] = false;

		}

	}

	for(int i=2;i<100004;i++) if(tmp[i]) prime.push_back(i);

}



int main(){

  ios_base::sync_with_stdio(0); cin.tie(0);

  sieve();

  int n; cin >> n;

  auto idx = lower_bound(prime.begin(), prime.end(), n);

  cout << prime[idx-prime.begin()] << "\n";

  return 0;

}

// Optimized solution to the same problem (faster):
#include<bits/stdc++.h>

using namespace std;



int main(){

  ios_base::sync_with_stdio(0); cin.tie(0);

  int n; cin >> n;

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

  	int cnt = 0;

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

  		if(i%j == 0) cnt++;

	}

	if(cnt == 0){

		cout << i << "\n";

		break;

	}

  }

  return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define rep(i, a, b) for (int i = a; i < (int)b; i++)

#define all(v) v.begin(), v.end()

const int MOD = 1e9 + 7;

const int INF = 1e9;

//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122



vector<bool> Eratosthenes(int n) {

    vector<bool> prime(n + 1, true);

    prime[0] = false;

    if (n >= 1) prime[1] = false;

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

        if (!prime[i]) continue;

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

            prime[j] = false;

        }

    }

    return prime;

}



int main() {

    int n;

    cin >> n;

    vector<bool> prime = Eratosthenes(600000);

    rep(i, 0, 600000) {

        if (prime[i] && i >= n) {

            cout << i << endl;

            return 0;

        }

    }

    return 0;

}


// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define rep(i, a, b) for (int i = a; i < (int)b; i++)

#define all(v) v.begin(), v.end()

const int MOD = 1e9 + 7;

const int INF = 1e9;

//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122



bool is_prime(int x) {

    if (x == 1) return false;

    else if (x == 2) return true;

    else if (x % 2 == 0) return false;

    else {

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

            if (x % i == 0) return false;

        }

    }

    return true;

}



int main() {

    int n;

    cin >> n;

    rep(i, n, n + 10000) {

        if (is_prime(i)) {

            cout << i << endl;

            return 0;

        }

    }

    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <vector>

#include <string>

#include <algorithm>

#include <cstring>

#include <cstdlib>

#include <cmath>

using namespace std;

using ll = long long;



vector<int> prime_vector(int n) {

    int m = (int)sqrt(n - 1);



    vector<bool> q(n);

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

        if (q[i]) continue;

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

            q[j] = true;

        }

    }



    vector<int> p; p.reserve(n / log(n * 0.329));

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

        if (!q[i]) p.push_back(i);

    }

    return p;

}



int main() {

    int x;

    cin >> x;



    auto pv = prime_vector(200000);



    for (auto &p : pv) {

        if (p >= x) {

            cout << p << endl;

            break;

        }

    }



    return 0;

}

// Optimized solution to the same problem (faster):
#include <iostream>

#include <vector>

#include <string>

#include <algorithm>

#include <cstring>

#include <cstdlib>

#include <cmath>

using namespace std;

using ll = long long;



int main() {

    int x;

    cin >> x;



    for (int t = x;; t++) {

        int b = 1;

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

            if (t % i == 0) {

                b = 0;

                break;

            }

        }

        if (b) {

            cout << t << endl;

            break;

        }

    }



    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

const int N=1e5+5;

int a[N];

bool prime(int x){

	if(x<2)return false;

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

		if(x%i==0)return false;

	return true;

}

void div(int x){

	int cnt=0;

	for(int i=1;cnt<=x;i++)

		if(prime(i))a[++cnt]=i;

}

int find(int x){

    int l=1,r=x;

    while(l<=r){

        int mid=(l+r)/2;

        if(a[mid]>=x)r=mid-1;

        else l=mid+1;

    }

    return l;

}

int main(){

	std::ios::sync_with_stdio(0);

	int n;

	cin>>n;

	div(n);

	cout<<a[find(n)]<<'\n';

    return 0;

}

// Optimized solution to the same problem (faster):
#include<bits/stdc++.h>

#define mul(a,b,c) a*b%c

using namespace std;



typedef long long ll;



const ll prime[]={2,3,5,7,11,13,17,37};



ll qpow(ll x,ll y,ll p)

{

    ll res=1;

    while(y)

    {

        if(y&1)res=mul(res,x,p);

        x=mul(x,x,p);

        y>>=1;

    }

    return res;

}



bool MillerRabin(ll n,ll a)

{

    ll d=n-1,r=0;

    while(!(d&1))d>>=1,r++;

    ll z=qpow(a,d,n);

    if(z==1)return 1; 

    for(int i=0;i<r;i++)

    {

        if(z==n-1)return 1;

        z=mul(z,z,n);

    }

    return 0;

}



bool Miller_Rabin(ll n)

{

    if(n<=1)return 0;

    for(int i=0;i<8;i++)

    {

        if(n==prime[i])return 1;

        if(n%prime[i]==0)return 0; 

        if(!MillerRabin(n,prime[i]))return 0;

    }

    return true;

}



inline int read()

{

    int s=0,f=1;

    char ch=getchar();

    while(!isdigit(ch))

    {

        if(ch=='-')f=-1;

        ch=getchar();

    }

    while(isdigit(ch))

    {

        s=(s<<3)+(s<<1)+ch-48;

        ch=getchar();

    }

    return s*f;

}



inline void write(int x)

{

    if(x<0)putchar('-'),x=-x;

    if(x>9)write(x/10);

    putchar(x%10^48);

}



int n;



int main()

{

    n=read();

    while(!Miller_Rabin(n))n++;

    write(n);

    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

#define rep(i, n) for (int i = 0; i < (n); ++i)

using namespace std;

using ll = long long;

using P = pair<int, int>;



int p[200100];



void prime()

{

    rep(i, 200000) p[i] = 1;

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

    {

        if (p[i] == 0)

            continue;

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

        {

            p[j] = 0;

        }

    }

    return;

}



int main()

{

    prime();

    // rep(i, 100) if (p[i] == 1) cout << i << endl;

    int x;

    cin >> x;

    int ans = 0;

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

    {

        if (p[i] == 1)

        {

            ans = i;

            break;

        }

    }

    cout << ans << endl;

    return 0;

}

// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)

using P = pair<int, int>;

using ll = long long;



bool isPrime(int x)

{

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

    {

        if (x % i == 0)

            return false;

    }

    return true;

}



void solve()

{

    int x;

    cin >> x;

    int ans = 0;

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

    {

        if (isPrime(i))

        {

            ans = i;

            break;

        }

    }

    cout << ans << endl;

}



int main()

{

    solve();

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

using ll = long long;



vector<bool> getPrimeVec(ll max)

{

	vector<bool> v(max, true);

	v[0] = false; v[1] = false;



	for (ll i = 2; i < max; ++i)

	{

		if (v[i])

		{

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

				v[j] = false;

		}

	}

	return v;

}



int main(int argc, char **argv)

{

	int MAX = 100010;

	int x; cin >> x;

	vector<bool> v = getPrimeVec(MAX);



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

	{

		if (v[i])

		{

			std::cout << i << std::endl;

			return 0;

		}

	}		

}






// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;

using ll = long long;



bool isPrime(ll num)

{

	if (num < 2) return false;

	for (ll i = 2; i*i <= num; ++i)

	{

		if (num % i == 0)

			return false;

	}

	return true;

}



int main(int argc, char **argv)

{

	int x; cin >> x;

	while (!isPrime(x)){++x;}

	std::cout << x << std::endl;

}




// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

bool isPrime(int n)

{

	if(n==2 || n == 3) return true;

	if(n<=1) return false;

	if(n%2==0) return false;

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

		if(n%i==0)

			return false;

	return true;

}

int main() {

	// your code goes here

	int n;

	cin>>n;

	while(1)

	{

		if(isPrime(n))

		{

			cout<<n<<endl;

			break;

		}

		n++;

	}

	

	return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<math.h>

int main()

{

    long long int X,i,j,d,prym,num;

    scanf("%lld",&X);

    if(X==1||X==2)

    {

        printf("2");

    }

    else if(X==3)

    {

        printf("3");

    }

    else

    {

        for(i=X; 1; i++)

        {

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

            {

                if(i%j==0)

                {

                    num=0;

                    break;

                }

                else num=1;

            }

            if(num==1)

            {

                printf("%lld",i);

                break;

            }

        }

    }



    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
/******************************************************************************



                              Online C++ Compiler.

               Code, Compile, Run and Debug C++ program online.

Write your code in this editor and press "Run" button to compile and execute it.



*******************************************************************************/

#include<bits/stdc++.h>

using namespace std;



void solve()

{

    long n;

    cin>>n;

    int flag=1;

    long x=n;

    while(flag==1)

    {   

        int c=0;

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

            {

                if(x%i==0)

                {

                    c++;

                }

            }

        if(c==0)

        flag=2;

        x++;

    }

    cout<<(x-1)<<endl;

    

}

int main()

{

    solve();

    return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<math.h>

int main()

{

    long long int X,i,j,d,prym,num;

    scanf("%lld",&X);

    if(X==1||X==2)

    {

        printf("2");

    }

    else if(X==3)

    {

        printf("3");

    }

    else

    {

        for(i=X; 1; i++)

        {

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

            {

                if(i%j==0)

                {

                    num=0;

                    break;

                }

                else num=1;

            }

            if(num==1)

            {

                printf("%lld",i);

                break;

            }

        }

    }



    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

using namespace std;

int main()

{

int i,n,z,t,f=0;

cin>>n;

for(i=n;;i++)

{f=0;

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

{

if(i%t==0)

{f=1;

goto x;}

}

x:

if(f==0)

{z=i;

goto y;}

}

y:

cout<<i;

return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<math.h>

int main()

{

    long long int X,i,j,d,prym,num;

    scanf("%lld",&X);

    if(X==1||X==2)

    {

        printf("2");

    }

    else if(X==3)

    {

        printf("3");

    }

    else

    {

        for(i=X; 1; i++)

        {

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

            {

                if(i%j==0)

                {

                    num=0;

                    break;

                }

                else num=1;

            }

            if(num==1)

            {

                printf("%lld",i);

                break;

            }

        }

    }



    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

int n,i,j,temp=1;

int main()

{

cin>>n;

for(i=n;;i++)

{   temp=1;

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

    {

        if(i%j==0)

        {

        temp=0;    

        }

    }

    if(temp)

    {

        cout<<i;

        break;

    }

    

}

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<math.h>

int main()

{

    long long int X,i,j,d,prym,num;

    scanf("%lld",&X);

    if(X==1||X==2)

    {

        printf("2");

    }

    else if(X==3)

    {

        printf("3");

    }

    else

    {

        for(i=X; 1; i++)

        {

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

            {

                if(i%j==0)

                {

                    num=0;

                    break;

                }

                else num=1;

            }

            if(num==1)

            {

                printf("%lld",i);

                break;

            }

        }

    }



    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

using namespace std;

long long int prime(long long int n)

{

    if(n<=1){return prime(++n);}

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

    {

        if(n%i==0){return prime(++n);}

    }

    return n;

}

int main()

{

   long long int n;

   cin>>n;

   long long int x=prime(n);

   cout<<x;



}


// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<math.h>

int main()

{

    long long int X,i,j,d,prym,num;

    scanf("%lld",&X);

    if(X==1||X==2)

    {

        printf("2");

    }

    else if(X==3)

    {

        printf("3");

    }

    else

    {

        for(i=X; 1; i++)

        {

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

            {

                if(i%j==0)

                {

                    num=0;

                    break;

                }

                else num=1;

            }

            if(num==1)

            {

                printf("%lld",i);

                break;

            }

        }

    }



    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

int checkPrimeNumber(int n)

{

  int x = 1 ;



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

  {

      if(n%i == 0)

      {

          x= 0;

          break;

      }

  }

  return x;

}



int main()

{

    std::ios::sync_with_stdio(false);

    int n;

    cin>>n;

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

    {

      if(checkPrimeNumber(i))

        {

            cout<<i<<endl;

            return 0;

        }

    }



}


// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<math.h>

int main()

{

    long long int X,i,j,d,prym,num;

    scanf("%lld",&X);

    if(X==1||X==2)

    {

        printf("2");

    }

    else if(X==3)

    {

        printf("3");

    }

    else

    {

        for(i=X; 1; i++)

        {

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

            {

                if(i%j==0)

                {

                    num=0;

                    break;

                }

                else num=1;

            }

            if(num==1)

            {

                printf("%lld",i);

                break;

            }

        }

    }



    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

bool isPrime(int n)

{

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

    {

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

    }

    return true;

}

int main()

{

    ios_base::sync_with_stdio(false);

    int x;

    cin>>x;

    while(1)

    {

        if(isPrime(x))

        {

            cout<<x;

            break;

        }

        else x++;

    }

    return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<math.h>

int main()

{

    long long int X,i,j,d,prym,num;

    scanf("%lld",&X);

    if(X==1||X==2)

    {

        printf("2");

    }

    else if(X==3)

    {

        printf("3");

    }

    else

    {

        for(i=X; 1; i++)

        {

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

            {

                if(i%j==0)

                {

                    num=0;

                    break;

                }

                else num=1;

            }

            if(num==1)

            {

                printf("%lld",i);

                break;

            }

        }

    }



    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

int main()

{

    int n,i;

    cin>>n;



    again:

    int c=0;

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

  {

      if(n % i == 0)

      {

          c++;

          n++;

          goto again;



      }



  }

  if(c==0)

  {

      cout<<n;

  }

}




// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<math.h>

int main()

{

    long long int X,i,j,d,prym,num;

    scanf("%lld",&X);

    if(X==1||X==2)

    {

        printf("2");

    }

    else if(X==3)

    {

        printf("3");

    }

    else

    {

        for(i=X; 1; i++)

        {

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

            {

                if(i%j==0)

                {

                    num=0;

                    break;

                }

                else num=1;

            }

            if(num==1)

            {

                printf("%lld",i);

                break;

            }

        }

    }



    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

#define REP(i, n) for(int i = 0; i < (int)(n); i++)

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

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

#define INF 2e9

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

template <typename Iter> std::string join(Iter begin, Iter end, std::string const& separator){ std::ostringstream result; if (begin != end){ result << *begin++; }; while (begin != end){ result << separator << *begin++; }; return result.str(); }

using namespace std;

typedef long long ll;

void solve() {

  ll x;

  cin >> x;

  vector<ll> prime_list;

  FOR(i, 2, x * 2) {

    bool is_prime = true;

    for(auto j: prime_list) {

      if(i % j == 0) {

        is_prime = false;

        break;

      }

    }

    if(is_prime) {

      if(x <= i) {

        cout << i << endl;

        return;

      }

      prime_list.push_back(i);

    }

  }

}

int main() {

  cin.tie(0);

  ios::sync_with_stdio(false);

  solve();

  return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<math.h>

int main()

{

    long long int X,i,j,d,prym,num;

    scanf("%lld",&X);

    if(X==1||X==2)

    {

        printf("2");

    }

    else if(X==3)

    {

        printf("3");

    }

    else

    {

        for(i=X; 1; i++)

        {

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

            {

                if(i%j==0)

                {

                    num=0;

                    break;

                }

                else num=1;

            }

            if(num==1)

            {

                printf("%lld",i);

                break;

            }

        }

    }



    return 0;

}


// Fastest known solution for this problem: