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

using namespace std;

int main()

{

	int n,a[15][15],b[15];

	for(int i=1;i<=3;i++)

		for(int j=1;j<=3;j++)

		    cin>>a[i][j];

	cin>>n;

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

	    cin>>b[i];

	for(int i=1;i<=3;i++)

	{

		for(int j=1;j<=3;j++)

		{

			for(int k=1;k<=n;k++)

			{

				if(a[i][j]==b[k])

				{

					a[i][j]=0;

					break;

				}

			}

		}

	}

	int i,j,flag=0;

	if(a[1][1]==0&&a[2][2]==0&&a[3][3]==0)

	    flag=1;

	else if(a[1][3]==0&&a[2][2]==0&&a[3][1]==0)

	    flag=1;

	for(i=1;i<=3;i++)

	{

		if(a[i][1]==0&&a[i][2]==0&&a[i][3]==0)

		    flag=1;

		else if(a[1][i]==0&&a[2][i]==0&&a[3][i]==0)

		    flag=1;

	}

	if(flag==1)

	    cout<<"Yes"<<endl;

	else

	    cout<<"No"<<endl;

	return 0;

}

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

#include <stdlib.h>

 

int main()

{

  int a[3][3];

  int n, b,c[3][3]={0},count;

 

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

    for(int j=0; j<3; j++){

      scanf("%d",&a[i][j] );

    }

  }

  scanf("%d",&n );

 

  for(int k=0; k<n; k++)

  {

    scanf("%d",&b);

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

      for(int j=0; j<3; j++){

        if(a[i][j] == b)

          c[i][j] = 1;

      }

    }

  }

 

  if(c[0][0]+c[1][1]+c[2][2]==3||c[0][2]+c[1][1]+c[2][0]==3){

      puts("Yes");

      return 0;

    }

 

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

      if(c[i][0]+c[i][1]+c[i][2]==3||c[0][i]+c[1][i]+c[2][i]==3){

        puts("Yes");

        return 0;

      }

    }

 

    puts("No");

 

    return 0;

}

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

using namespace std;

int main()

{

	int a[3][3];

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

	{

		for(int j=0;j<3;j++)

		{

			cin>>a[i][j];

		}

	}

	int t,b;

	cin>>t;

	while(t--)

	{

		cin>>b;

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

		{

			for(int j=0;j<3;j++)

			{

				if(a[i][j]==b)

				  a[i][j]=0;

			}

		}

	}

	bool flag1=0,flag2=0,flag3=0;

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

	{

		for(int j=0;j<3;j++)

		{

			if(a[i][j])

			  break;

			if(j==2&&a[i][j]==0)

			  flag1=1;

		}

	}

	for(int j=0;j<3;j++)

	{

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

		{

			if(a[i][j])

			  break;

			if(i==2&&a[i][j]==0)

			  flag2=1;

		}

	}

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

	{

		if(a[i][i])

		  break;

		if(i==2&&a[i][i]==0)

		  flag3=1;

	}

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

	{

		if(a[i][2-i])

		  break;

		if(i==2&&a[i][2-i]==0)

		  flag3=1;

	}

	if(flag1||flag2||flag3)

	  cout<<"Yes"<<endl;

	else

	  cout<<"No"<<endl;

 } 

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

#include <stdlib.h>

 

int main()

{

  int a[3][3];

  int n, b,c[3][3]={0},count;

 

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

    for(int j=0; j<3; j++){

      scanf("%d",&a[i][j] );

    }

  }

  scanf("%d",&n );

 

  for(int k=0; k<n; k++)

  {

    scanf("%d",&b);

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

      for(int j=0; j<3; j++){

        if(a[i][j] == b)

          c[i][j] = 1;

      }

    }

  }

 

  if(c[0][0]+c[1][1]+c[2][2]==3||c[0][2]+c[1][1]+c[2][0]==3){

      puts("Yes");

      return 0;

    }

 

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

      if(c[i][0]+c[i][1]+c[i][2]==3||c[0][i]+c[1][i]+c[2][i]==3){

        puts("Yes");

        return 0;

      }

    }

 

    puts("No");

 

    return 0;

}

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

#include<algorithm>

#include<cmath>

#include<cstdlib>

#include<cstdio>

#include<cstring>

#include<iomanip>

#include<string>

#include<set>

#include<map>

#include<vector>

#include<queue>

#include<stack>

#include<utility>

#define PI acos(-1.0)

using namespace std;

int a[3][3];

int main() {

	int n;

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

		for(int j = 0; j < 3; j++) {

			scanf("%d",&a[i][j]);

		}

	}

	cin >> n;

	int b;

	while(n--) {

		cin >> b;

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

			for(int j = 0; j < 3; j++) {

				if(a[i][j] == b) {

					a[i][j] = 0;

					break;

				}

			}

		}

	}

	int flag = 0;

	int ans = 0;

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

		ans = 0;

		for(int j = 0; j < 3; j++) {

			if(a[i][j] == 0) ans++;

			else break;

		}

		if(ans == 3) {

			flag = 1;

			break;

		}

	}

	if(flag) cout << "Yes" << endl;

	else {

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

			ans = 0;

			for(int j = 0; j < 3; j++) {

				if(a[j][i] == 0) ans++;

				else break;

			}

			if(ans == 3) {

				flag = 1;

				break;

			}

		}

		if(flag) cout << "Yes" << endl;

		else{

			if((a[0][0] == 0 && a[1][1] == 0 && a[2][2] == 0)||(a[0][2] == 0 && a[1][1] == 0 && a[2][0] == 0)){

				flag = 1;

			}

			if(flag) cout << "Yes" << endl;

			else cout << "No" << endl;

		}

	}



	return 0;

}

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



int main(){

	int arr[3][3], flag[3][3] = {0};

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

		for(int j = 0; j < 3; j++){

			scanf("%d", &arr[i][j]);

		}

	}

	int n;

	scanf("%d", &n);

	int brr[n];

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

		scanf("%d", &brr[i]);

		for(int j = 0; j < 3; j++){

			for(int k = 0; k < 3; k++){

				if(arr[j][k] == brr[i]){

					flag[j][k] = 1;

				}

			}

		}

	}

	int check = 0;

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

		if(flag[i][0] && flag[i][1] && flag[i][2]){

			check = 1;

		}

	}

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

		if(flag[0][i] && flag[1][i] && flag[2][i]){

			check = 1;

		}

	}

	if(flag[0][0] && flag[1][1] && flag[2][2]){

		check = 1;

	}

	if(flag[0][2] && flag[1][1] && flag[2][0]){

		check = 1;

	}

	(check) ? puts("Yes") : puts("No");

	return 0;

}


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

using namespace std;

int main()

{

	int a[15],b,i,p[15]={0};

	for(i=1;i<=9;i++)

		cin>>a[i];

	int n;

	cin>>n;

	for(int j=0;j<n;j++)

	{

		cin>>b;

		for(i=1;i<=9;i++)

			if(b==a[i])

				p[i]=1;

	}

	if(p[5]==1)

	{

		if(p[2]==1&&p[8]==1) cout<<"Yes"<<endl;

		else if(p[1]==1&&p[9]==1) cout<<"Yes"<<endl;

		else if(p[3]==1&&p[7]==1) cout<<"Yes"<<endl;

		else if(p[4]==1&&p[6]==1) cout<<"Yes"<<endl;

		else if(p[1]==1)

		{

			if(p[2]==1&&p[3]==1) cout<<"Yes"<<endl;

			else if(p[4]==1&&p[7]==1) cout<<"Yes"<<endl;

		}

		else if(p[9]==1)

		{

			if(p[3]==1&&p[6]==1) cout<<"Yes"<<endl;

			else if(p[7]==1&&p[8]==1) cout<<"Yes"<<endl;

			else cout<<"No"<<endl;

		}

	}

	else if(p[1]==1)

		{

			if(p[2]==1&&p[3]==1) cout<<"Yes"<<endl;

			else if(p[4]==1&&p[7]==1) cout<<"Yes"<<endl;

			else if(p[9]==1)

		{

			if(p[3]==1&&p[6]==1) cout<<"Yes"<<endl;

			else if(p[7]==1&&p[8]==1) cout<<"Yes"<<endl;

			else cout<<"No"<<endl;

		}

		}

		else if(p[9]==1)

		{

			if(p[3]==1&&p[6]==1) cout<<"Yes"<<endl;

			else if(p[7]==1&&p[8]==1) cout<<"Yes"<<endl;

			else cout<<"No"<<endl;

		}

	else cout<<"No"<<endl;

	 

	return 0;

}

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



int main(){

	int arr[3][3], flag[3][3] = {0};

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

		for(int j = 0; j < 3; j++){

			scanf("%d", &arr[i][j]);

		}

	}

	int n;

	scanf("%d", &n);

	int brr[n];

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

		scanf("%d", &brr[i]);

		for(int j = 0; j < 3; j++){

			for(int k = 0; k < 3; k++){

				if(arr[j][k] == brr[i]){

					flag[j][k] = 1;

				}

			}

		}

	}

	int check = 0;

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

		if(flag[i][0] && flag[i][1] && flag[i][2]){

			check = 1;

		}

	}

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

		if(flag[0][i] && flag[1][i] && flag[2][i]){

			check = 1;

		}

	}

	if(flag[0][0] && flag[1][1] && flag[2][2]){

		check = 1;

	}

	if(flag[0][2] && flag[1][1] && flag[2][0]){

		check = 1;

	}

	(check) ? puts("Yes") : puts("No");

	return 0;

}


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

#include <algorithm>

using namespace std;

#define LL long long

#define MAX_SIZE 1010

int n, m;

LL r, a;

LL x[MAX_SIZE], y[MAX_SIZE], z[MAX_SIZE], t[MAX_SIZE];



int main()

{

	cin >> n >> m;

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

		cin >> x[i] >> y[i] >> z[i];



	int P[8][3] = { { 1,1,1 },{ 1,1,-1 },{ 1,-1,1 },{ 1,-1,-1 },{ -1,1,1 },{ -1,1,-1 },{ -1,-1,1 },{ -1,-1,-1 } };

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

		for (int j = 0; j < n; ++j)

			t[j] = x[j] * P[i][0] + y[j] * P[i][1] + z[j] * P[i][2];

		sort(t, t + n);

		a = 0;

		for (int k = n - m; k < n; ++k)

			a += t[k];

		if (r < a)

			r = a;

	}

	cout << r << endl;

	return 0;

}

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

#include <algorithm>

using namespace std;

#define LL long long

#define MAX_SIZE 1010

int n, m;

LL r, a;

LL x[MAX_SIZE], y[MAX_SIZE], z[MAX_SIZE], t[MAX_SIZE];



int main()

{

	scanf("%d %d", &n, &m);

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

		scanf("%lld %lld %lld", &x[i], &y[i], &z[i]);



	int P[8][3] = { { 1,1,1 },{ 1,1,-1 },{ 1,-1,1 },{ 1,-1,-1 },{ -1,1,1 },{ -1,1,-1 },{ -1,-1,1 },{ -1,-1,-1 } };

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

		for (int j = 0; j < n; ++j)

			t[j] = x[j] * P[i][0] + y[j] * P[i][1] + z[j] * P[i][2];

		sort(t, t + n);

		a = 0;

		for (int k = n - m; k < n; ++k)

			a += t[k];

		if (r < a)

			r = a;

	}

	printf("%lld\n", r);

	return 0;

}

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

#include <algorithm>

using namespace std;

#define LL long long

#define MAX_SIZE 1010

int n, m;

LL r, a;

LL x[MAX_SIZE], y[MAX_SIZE], z[MAX_SIZE], t[MAX_SIZE];



int main()

{

	ios::sync_with_stdio(false);

	cin >> n >> m;

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

		cin >> x[i] >> y[i] >> z[i];



	int P[8][3] = { { 1,1,1 },{ 1,1,-1 },{ 1,-1,1 },{ 1,-1,-1 },{ -1,1,1 },{ -1,1,-1 },{ -1,-1,1 },{ -1,-1,-1 } };

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

		for (int j = 0; j < n; ++j)

			t[j] = x[j] * P[i][0] + y[j] * P[i][1] + z[j] * P[i][2];

		sort(t, t + n);

		a = 0;

		for (int k = n - m; k < n; ++k)

			a += t[k];

		if (r < a)

			r = a;

	}

	cout << r << endl;

	return 0;

}

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

#include <algorithm>

using namespace std;

#define LL long long

#define MAX_SIZE 1010

int n, m;

LL r, a;

LL x[MAX_SIZE], y[MAX_SIZE], z[MAX_SIZE], t[MAX_SIZE];



int main()

{

	scanf("%d %d", &n, &m);

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

		scanf("%lld %lld %lld", &x[i], &y[i], &z[i]);



	int P[8][3] = { { 1,1,1 },{ 1,1,-1 },{ 1,-1,1 },{ 1,-1,-1 },{ -1,1,1 },{ -1,1,-1 },{ -1,-1,1 },{ -1,-1,-1 } };

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

		for (int j = 0; j < n; ++j)

			t[j] = x[j] * P[i][0] + y[j] * P[i][1] + z[j] * P[i][2];

		sort(t, t + n);

		a = 0;

		for (int k = n - m; k < n; ++k)

			a += t[k];

		if (r < a)

			r = a;

	}

	printf("%lld\n", r);

	return 0;

}

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

# include "cstdio"

# include "algorithm" 



using namespace std;



const int maxm=1000+10; 



int n,	//n个蛋糕 

	m; 	//取出m个蛋糕 



long long 

	dp[9][maxm], 

	ans,now; 



int main(){

	long long x,y,z;

	register int i,j; 

	scanf("%d%d",&n,&m);

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

		scanf("%lld%lld%lld",&x,&y,&z); 

		dp[1][i]=x+y+z; 

		dp[2][i]=x+y-z;

		dp[3][i]=x-y+z;

		dp[4][i]=-x+y+z;

		dp[5][i]=x-y-z;

		dp[6][i]=-x-y+z;

		dp[7][i]=-x+y-z;

		dp[8][i]=-x-y-z;

	}

	for(i=1;i<=8;i++){

		sort(dp[i]+1,dp[i]+1+n,greater<long long>());

		now=0; 

		for(j=1;j<=m;j++){

			now+=dp[i][j]; 

		}

		ans=max(ans,now); 

	}

	printf("%lld",ans); 

	return 0; 

} 

// Optimized solution to the same problem (faster):
# include "cstdio"

# include "algorithm" 

 

const int maxm=1000+10; 

 

int n,	//n个蛋糕 

	m; 	//取出m个蛋糕 

 

long long 

	dp[5][maxm], 

	ans,now1,now2; 

 

inline long long read(){

	long long s=0,w=1;

	char ch=getchar();

	while(ch<'0' || ch>'9'){

		if(ch=='-') w=-w;

		ch=getchar();

	}

	while(ch>='0' && ch<='9'){

		s=s*10+ch-'0';

		ch=getchar();

	}

	return s*w;

}



inline long long max(long long x,long long y){

	return x>y?x:y; 

} 



inline bool comp(long long x,long long y){

	return x>y?true:false; 

} 



int main(){

	long long x,y,z;

	register int i,j; 

	n=read(),m=read();

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

		x=read(),y=read(),z=read(); 

		dp[1][i]=x+y+z; //-x-y-z

		dp[2][i]=x+y-z;	//-x-y+z

		dp[3][i]=x-y+z;	//-x+y-z

		dp[4][i]=x-y-z;	//-x+y+z

	}

	for(i=1;i<=4;i++){

		std::sort(dp[i]+1,dp[i]+1+n,comp);

		now1=now2=0; 

		for(j=1;j<=m;j++){

			now1+=dp[i][j];

			now2+=dp[i][n-j+1]; 

		}

		now1=now1>0?now1:-now1;

		now2=now2>0?now2:-now2; 

		ans=max(ans,max(now1,now2)); 

	}

	printf("%lld",ans); 

	return 0; 

} 

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

# include "cstdio"

# include "cmath"

# include "algorithm" 



using namespace std;



const int maxm=1000+10; 



int n,	//n个蛋糕 

	m; 	//取出m个蛋糕 



long long 

	dp[5][maxm], 

	ans,now1,now2; 



inline long long read(){

	long long s=0,w=1;

	char ch=getchar();

	while(ch<'0' || ch>'9'){

		if(ch=='-') w=-w;

		ch=getchar();

	}

	while(ch>='0' && ch<='9'){

		s=s*10+ch-'0';

		ch=getchar();

	}

	return s*w;

}



int main(){

	long long x,y,z;

	register int i,j; 

	n=read(),m=read();

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

		x=read(),y=read(),z=read(); 

		dp[1][i]=x+y+z; //-x-y-z

		dp[2][i]=x+y-z;	//-x-y+z

		dp[3][i]=x-y+z;	//-x+y-z

		dp[4][i]=x-y-z;	//-x+y+z

	}

	for(i=1;i<=4;i++){

		sort(dp[i]+1,dp[i]+1+n,greater<long long>());

		now1=now2=0; 

		for(j=1;j<=m;j++){

			now1+=dp[i][j];

			now2+=dp[i][n-j+1]; 

		}

		ans=max(ans,max(abs(now1),abs(now2))); 

	}

	printf("%lld",ans); 

	return 0; 

} 

// Optimized solution to the same problem (faster):
# include "cstdio"

# include "algorithm" 

 

const int maxm=1000+10; 

 

int n,	//n个蛋糕 

	m; 	//取出m个蛋糕 

 

long long 

	dp[5][maxm], 

	ans,now1,now2; 

 

inline long long read(){

	long long s=0,w=1;

	char ch=getchar();

	while(ch<'0' || ch>'9'){

		if(ch=='-') w=-w;

		ch=getchar();

	}

	while(ch>='0' && ch<='9'){

		s=s*10+ch-'0';

		ch=getchar();

	}

	return s*w;

}



inline long long max(long long x,long long y){

	return x>y?x:y; 

} 



inline bool comp(long long x,long long y){

	return x>y?true:false; 

} 



int main(){

	long long x,y,z;

	register int i,j; 

	n=read(),m=read();

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

		x=read(),y=read(),z=read(); 

		dp[1][i]=x+y+z; //-x-y-z

		dp[2][i]=x+y-z;	//-x-y+z

		dp[3][i]=x-y+z;	//-x+y-z

		dp[4][i]=x-y-z;	//-x+y+z

	}

	for(i=1;i<=4;i++){

		std::sort(dp[i]+1,dp[i]+1+n,comp);

		now1=now2=0; 

		for(j=1;j<=m;j++){

			now1+=dp[i][j];

			now2+=dp[i][n-j+1]; 

		}

		now1=now1>0?now1:-now1;

		now2=now2>0?now2:-now2; 

		ans=max(ans,max(now1,now2)); 

	}

	printf("%lld",ans); 

	return 0; 

} 

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

#include<algorithm>

using namespace std;



int main(){

  int n,k,i;

  long long int x,y,z,a[8][1000],sum=0,ans=0;

  cin>>n>>k;

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

    cin>>x>>y>>z;

    a[0][i]=x+y+z;

    a[1][i]=x+y-z;

    a[2][i]=x-y+z;

    a[3][i]=x-y-z;

    a[4][i]=-x+y+z;

    a[5][i]=-x+y-z;

    a[6][i]=-x-y+z;

    a[7][i]=-x-y-z;

  }

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

    sort(a[i],a[i]+n);

    sum=0;

    for(int j=n-1;j>=n-k;j--)

      sum+=a[i][j];

    if(ans<sum)

      ans=sum;

  }

  cout << ans<<endl;

}

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

#include<algorithm>

using namespace std;

int main(){

  int n,m;

  long x,y,z,s[8][1000],sum,ans=0;

  scanf("%d %d",&n,&m);

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

    scanf("%ld %ld %ld",&x,&y,&z);

    s[0][i]=x+y+z;

    s[1][i]=x+y-z;

    s[2][i]=x-y+z;

    s[3][i]=x-y-z;

    s[4][i]=-1*x+y+z;

    s[5][i]=-1*x+y-z;

    s[6][i]=-1*x-y+z;

    s[7][i]=-1*x-y-z;

  }

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

    sort(s[i],s[i]+n);

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

    sum=0;

    for(int j=n-1;j>=n-m;j--)

      sum+=s[i][j];

    ans=max(ans,sum);

  }

  printf("%ld\n",ans);

}

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

#include <vector>





int main(void) {

    int N;

    std::vector<int> nest,primes;

    std::vector<int> mod;



    std::cin >> N;



    nest.resize(55556);



    int idx = 2;

    while(idx < 55556) {

        if(nest[idx] == 0) {

            int i = 1;

            while(true) {

                if(i * idx + idx > 55555)

                    break;

                nest[i * idx + idx] = 1;

                i++;

            }

        }

        idx++;

    }



    for(int i = 2; i < nest.size(); i++) {

        if(nest[i] == 0 && i%5==1)

            mod.push_back(i);

    }





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

        std::cout << mod[i] << " ";

    }



    return 0;

}


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

int f(int n){for(int i=3;i<n;i+=2)if(n%i == 0)return 0;return 1;}int main(){int N;std::cin>>N;int c=0,i=0;while(c<N){int n=11+i*10;if(f(n)){std::cout<<n<<" ";c++;}i++;}}


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

#include<algorithm>

#include<vector>

#include<string>

#include<cmath>



using namespace std;



int main(){

    int N;

    cin>>N;



    vector<int> prime;



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

        prime.push_back(1);

    }

    for(int i=2;i<sqrt(55555);i++){

        if(prime[i]){

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

                prime[i*(j+2)] = 0;

            }

        }

    }





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



    vector<int> ans;



    for(int i=0; ans.size()<N;i++){

        if(prime[i] == 1 && i % 5 == 1){

            ans.push_back(i);

        }

    }



    for(int i=0;i<ans.size();i++) cout<<ans[i]<<" ";



    cout<<endl;

}


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

using namespace std;



int main(){

    int N;

    cin >> N;



    int p = 10;

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

        while(1){

            bool isPrime = true;

            p++;

            for(int j=2;j*j<=p;j++) if(p % j == 0) isPrime = false;

            if(isPrime && p%5 == 1) {

                cout << p << " ";

                break;

            } 

            

        }

    }



    cout << endl;

}

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

#include<algorithm>

#include<vector>

#include<string>

#include<queue>

#include<stack>

#include<set>

using namespace std;



int INF = 1e9 + 7;



typedef long long ll;

typedef pair<int, int> P;



vector<int> arr(55560);



void Eratosthenes() {

	int n = 55556;



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

		arr[i] = 1;

	}

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

		if (arr[i]) {

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

				arr[i *(j + 2)] = 0; 

			}

		}

	}



	int j = 1;

	arr[1] = 0;

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

		if (arr[i] && i%5 == 1) {

			arr[j] = i;

			j++;

		}

	}

}



int main() {

	int n;

	cin >> n;

	Eratosthenes();

	

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

		cout << arr[i] << " ";

	}

}

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

using namespace std;



typedef long long ll;

typedef pair<int, int> P;

typedef tuple<int, int, int> T;



int MOD=1e9+7;

ll INF=1e18;



int dx[]={1, -1, 0, 0};

int dy[]={0, 0, 1, -1};



bool is_prime[60000];

int prime[60000];

void eratos(int n){

    for(int i=0; i<=n; i++) is_prime[i]=true;

    is_prime[0]=false, is_prime[1]=false;



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

        if(is_prime[i]){

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

                is_prime[i*j]=false;

            }

        }

    }



    int cnt=0;

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

        if(is_prime[i] && i%5==1){

            prime[cnt]=i;

            cnt++;

        }

    }

}



int main(){

    int n; cin>>n;

    eratos(55550);

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

        cout << prime[i] << " ";

    }

}

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

#include <vector>

#define N 55555

using namespace std;

int n, pr[N+5];

vector<int> vt;



int main() {

	int i, j, k, x, sum;

	cin>>n;

	for(i=2; i<=N; i++) pr[i] = 1;

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

		if(pr[i]) for(j=i*2; j<=N; j+=i) pr[j] = 0;

	}

	for(i=11; i<=N; i+=5) {

		if(pr[i]) {

			cout<<i<<' ';

			n--;

			if(!n) return 0;

		}

	}

	return 0;

}

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

using namespace std;

int n;

int main() {

	int i, j;

	cin>>n;

	for(i=11; n; i+=10) {

		for(j=2; j*j<=i; j++) if(i%j==0) break;

		if(j*j>i) {

			cout<<i<<' ';

			n--;

		}

	}

	return 0;

}

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

using namespace std;

const int N=55556,M=56;

int a[N],b[N],c[M];

int n,l;

void work (void)

{

	int i,j;

	i=1;

	j=1;

	while (i<=n)

	{

		if (b[j]%5==1)

		{

			c[i]=b[j];

			i++;

		}

		j++;

	}

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

	cout<<c[i]<<" ";

}

int main (void)

{

	int i,j,t;

	l=1;

	cin>>n;

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

	{

		j=1;

		if (a[i]==0)

		{

			b[l]=i;

			l++;

		}

		for (j=1;j<l;j++)

		{

			t=i*b[j];

			if (t<=55555)

			a[t]=1;

	   else break;

	        if (i%b[j]==0)

	        break;

		}

	}

	work ();

	return 0;

}


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

using namespace std;

const int N=56;

int a[N]={0,11,31,41,61,71,101,131,151,181,191,211,241,251,271,281,311,331,401,421,431,461,491,521,541,571,601,631,641,661,691,701,751,761,811,821,881,911,941,971,991,1021,1031,1051,1061,1091,1151,1171,1181,1201,1231,1291,1301,1321,1361,1381};

int n;

void work (void)

{

	int i;

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

	cout<<a[i]<<" ";

}

int main (void)

{

	cin>>n;

	work ();

	return 0;

}


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



using namespace std;



typedef long long ll;



vector<int> calc(int n)

{

  const int sz = 55556;

  vector<int> sieve(sz, 1);

  sieve[0] = sieve[1] = 0;



  for (int i = 2; i < (int)sieve.size(); ++i) {

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

      sieve[i * m] = 0;

    }

  }

  int cnt = 0;

  vector<int> ret;

  for (int i = 2; i < (int)sieve.size() && cnt < n; ++i) {

    if (sieve[i] && (i % 5 == 1)) {

      ++cnt;

      ret.push_back(i);

    }

  }



  return ret;

}



int main()

{

  int n;

  scanf("%d", &n);

  vector<int> p = calc(n);

  copy(p.begin(), p.end(), ostream_iterator<int>(cout, " "));

  printf("\n");



  return 0;

}


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



using namespace std;



typedef long long ll;



const int INF = 1000000000;



void sieve(vector<int>& primes)

{

  int n = primes.size();

  primes[0] = primes[1] = 0;

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

    if (not primes[i]) { continue; }

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

      primes[j] = 0;

    }

  }

}



int main()

{

  int N; scanf("%d", &N);

  int upper = 55555;

  vector<int> primes(upper + 5, 1);

  sieve(primes);

  int cnt = 0;

  vector<int> ans;

  for (int p = 2; p <= 55555; ++p) {

    if (primes[p] and (p % 5) == 1) {

      ans.push_back(p);

      if (++cnt == N) { break; }

    }

  }

  printf("%d", ans[0]);

  for (int i = 1; i < N; ++i) {

    printf(" %d", ans[i]);

  }

  printf("\n");

  return 0;

}


// Fastest known solution for this problem: