stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
# 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; 

} 

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

}
// Slower C++ solution:
# 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; 

} 

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

}
// Slower C++ solution:
#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;

}

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

}
// Slower C++ solution:
#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;

}


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

}


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

}
// Slower C++ solution:
#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] << " ";

	}

}

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

    }

}
// Slower C++ solution:
#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;

}

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

}
// Slower C++ solution:
# 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;

}


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

}
// Slower C++ solution:
#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;

}


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

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

#include <string>



#define MOD 1000000007



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

#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)

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

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

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

#define DEBUG(x) cout << #x << ": " << x << endl



// five-five-everywhere.cpp ---

// author: Seong Yong-ju <sei40kr@gmail.com>



using namespace std;



int n;

bool ps[55556] = {false, false};



int main() {

  std::ios::sync_with_stdio(false);



  cin >> n;

  fill(&ps[2], ps + 55555, true);

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

    if (!ps[i]) {

      continue;

    }

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

      ps[j] = false;

    }

  }

  REP(i, 55556) { ps[i] = (ps[i] && i % 5 == 1); }



  int cnt = 0;

  REP(i, 55556) {

    if (ps[i]) {

      if (n <= ++cnt) {

        cout << i << endl;

        break;

      } else {

        cout << i << ' ';

      }

    }

  }



  return 0;

}


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

#include <iostream>

#include <string>



#define MOD 1000000007



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



// five-five-everywhere.cpp ---

// author: Seong Yong-ju <sei40kr@gmail.com>



using namespace std;



int n;

bool isprime[55556] = {false, false};



int main() {

  ios::sync_with_stdio(false);

  cin.tie(NULL);



  fill(&isprime[2], isprime + 55556, true);



  cin >> n;



  FOR(i, 2, floor(sqrt(55556) + 1)) {

    if (!isprime[i]) {

      continue;

    }

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

      isprime[j] = false;

    }

  }



  int cnt = 0;

  FOR(i, 2, 55556) {

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

      cout << i;



      if (n <= ++cnt) {

        cout << endl;

        break;

      } else {

        cout << ' ';

      }

    }

  }

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

using namespace std;

using ll = long long;

using pii = pair<int, int>;



int N;



int main() {

  cin.tie(0);

  ios_base::sync_with_stdio(false);

  cout << fixed << setprecision(10);

  

  cin >> N;

  vector<int> v;

  for (int i = 11; i <= 55555; i += 5) {

    int no = 0;

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

      if (i % j == 0) {

        no++;

        break;

      }

    }

    if (!no) v.emplace_back(i);

  }  

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

    cout << v[i] << " \n"[i + 1 == N];

  }



  return 0;

}

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

using namespace std;

using ll = long long;

using pii = pair<int, int>;



int N;



int main() {

  cin.tie(0);

  ios_base::sync_with_stdio(false);

  cout << fixed << setprecision(10);

  

  cin >> N;

  vector<int> p;

  for (int i = 11; p.size() < N; i += 5) {

    int flag = 1;

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

      if (i % j == 0) flag = 0;

    }

    if (flag) p.emplace_back(i);

  }

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

    cout << p[i] << " \n"[i + 1 == N];

  }



  return 0;

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

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

#define rep1(i,n) for(int i=1;i<=(int)n;i++)

#define rep2(i,j,n) for(int j=i;j<n;j++)

#define rep3(i,j,n) for(int j=i;j<=n;j++)

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

#define sp(n) cout << fixed << setprecision(n)

typedef long long ll;

using namespace std;

int pn[55]={11,31,41,61,71,91,101,131,151,181,

            191,211,241,251,271,281,311,331,401,421,

            431,461,491,521,541,571,601,641,661,691,

            701,751,761,811,821,881,911,941,971,991,

            1021,1051,1061,1091,1151,1171,1181,1201,1231,1291,

            1301,1321,1361,1381,1451

            };

int main(void){

    int n;cin>>n;

    vector<int> pr(55556,0);

    rep(i,55556){

        if(i==0||i==1)continue;

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

            if(pr[j]==0)pr[j]++;

        }

    }

    int cou=0;

    rep(i,55556){

        if(i==0||i==1)continue;

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

            cout<<i<<" ";

            cou++;

        }

        if(cou==n)break;

    }

    cout<<endl;

}


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

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

#define rep1(i,n) for(int i=1;i<=(int)n;i++)

#define rep2(i,j,n) for(int j=i;j<n;j++)

#define rep3(i,j,n) for(int j=i;j<=n;j++)

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

#define sp(n) cout << fixed << setprecision(n)

typedef long long ll;

using namespace std;

int pn[55]={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 main(void){

    int n;cin>>n;

    rep(i,n)cout<<pn[i]<<" ";

    cout<<endl;

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

using namespace std;

typedef long long ll;

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

#define reps(i, s, n) for(int i = (s), i##_len = (n); i < i##_len; i++)

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

#define rreps(i, e, n) for(int i = (n) - 1; i >= (e); i--)

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

#define sz(x) ((int)(x).size())

#define uniq(x) (x).erase(unique((x).begin(), (x).end()), (x).end())



const int MAX_A = 55555;

const int MAX_N = 55;



int n;

bool pf[MAX_A + 1];

vector<int> prime;



void create_prime() {

    rep(i, MAX_A + 1) pf[i] = true;

    pf[0] = pf[1] = false;

    

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

        if (!pf[i]) {

            continue;

        }

        

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

            pf[i * ii] = false;

        }

    }

    

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

        if (pf[i]) {

            prime.push_back(i);

        }

    }

}



bool is_prime(int n) {

    return pf[n];

}



int main() {

    cin.tie(0);

    ios::sync_with_stdio(false);

    

    cin >> n;

    create_prime();

    int cnt = 0;

    

    rep(i, n) {

        while(!pf[++cnt * 5 + 1]);

        printf("%d%s", cnt * 5 + 1, (i == (n - 1)) ? "\n" : " ");

    }

    

    return 0;

}

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

using namespace std;

typedef long long ll;

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

#define reps(i, s, n) for(int i = (s), i##_len = (n); i < i##_len; i++)

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

#define rreps(i, e, n) for(int i = (n) - 1; i >= (e); i--)

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

#define sz(x) ((int)(x).size())

#define uniq(x) (x).erase(unique((x).begin(), (x).end()), (x).end())



const int MAX_A = 55555;



int n;

bool pf[MAX_A + 1];



void create_prime() {

    rep(i, MAX_A + 1) pf[i] = true;

    pf[0] = pf[1] = false;

    

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

        if (!pf[i]) {

            continue;

        }

        

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

            pf[i * ii] = false;

        }

    }

}



bool is_prime(int n) {

    return pf[n];

}



int main() {

    cin.tie(0);

    ios::sync_with_stdio(false);

    

    cin >> n;

    create_prime();

    int cnt = 0;

    

    rep(i, n) {

        while(!pf[++cnt * 5 + 1]);

        printf("%d%s", cnt * 5 + 1, (i == (n - 1)) ? "\n" : " ");

    }

    

    return 0;

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

#include <algorithm>

#include <functional>

#include <map>

#include <ostream>

#include <queue>

#include <random>

#include <string>

#include <vector>

#include <cstdlib>

#include <cmath>

#include <cstring>



using std::cin;

using std::cout;

using std::cerr;

using std::endl;



using ll = long long;



inline void init() {

  cin.tie(0);

  std::ios::sync_with_stdio(false);

}



bool is_prime[300001];

std::vector<int> prime;



void eratosthenes(int n) {

  std::fill(is_prime, is_prime + 300000, true);



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



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

    if (is_prime[i]) {

      if (i <= 55555) prime.push_back(i);



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

        is_prime[i * j] = false;

      }

    }

  }



  return;

}



int main() {

  init();



  int N;



  cin >> N;



  eratosthenes(300000);



  std::vector<int> ans;



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

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

      ans.push_back(prime[i]);

      if (ans.size() == N) {

        break;

      }

    }

  }



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

    cout << ans[i] << " \n"[i == N - 1];

  }



  return 0;

}

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

#include <algorithm>

#include <vector>

#include <cstring>



using std::cin;

using std::cout;

using std::cerr;

using std::endl;



std::vector<int> eratosthenes() {

  bool is_prime[55556];

  std::vector<int> ret;



  std::fill(is_prime, is_prime + 55555, true);



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



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

    if (is_prime[i]) {

      ret.push_back(i);

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

        is_prime[i * j] = false;

      }

    }

  }



  return ret;

}





int main() {

  int n;



  cin >> n;



  std::vector<int> prime = eratosthenes(), ans;



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

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

      ans.push_back(prime[i]);

      if (int(ans.size()) == n) {

        break;

      }

    }

  }



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

    cout << ans[i] << " \n"[i == n - 1];

  }



  return 0;

}