Language: C++

#include <bits/stdc++.h>
using namespace std;
#define    FOR(i,a,n)       for(register int i=a,_=n+1;i^_;++i)
#define    FIR(i,n,a)       for(register int i=n,_=a-1;i^_;--i)
#define    VOR(i,a)         for(register int i=0,n=a.size();i^n;++i)
#define    VIR(i,a)         for(register int i=a.size()-1;~i;--i)
#define    SOR(i,a)         for(register auto i=a.begin();i!=a.end();++i)
#define    all(a)           (a).begin(),(a).end()
#define    vlb(a,n)         (lower_bound(all(a),n)-(a).begin())
#define    vub(a,n)         (upper_bound(all(a),n)-(a).begin())
#define    vlbx(a,n)        a[(lower_bound(all(a),n)-(a).begin())]
#define    vubx(a,n)        a[(upper_bound(all(a),n)-(a).begin())]
#define    mem(a,b)         memset(a,b,sizeof(a))
#define    pw(x)            (1ll<<(x))
#define    sz(x)            (int)x.size()
#define    INT              (1ll<<32)
#define    lowbit(x)        ((x)&(-x))
#pragma    comment(linker, "/STACK:1024000000,1024000000")
#define    lch              p<<1,l,mid
#define    rch              p<<1|1,mid+1,r
#define    ll               p<<1
#define    rr               p<<1|1
#define    queues           priority_queue
#define    pb               push_back
#define    mp(a,b)          make_pair(a,b)
#define    max(...)         _max(__VA_ARGS__)
#define    min(...)         _min(__VA_ARGS__)
#define    lb               lower_bound
#define    ub               upper_bound
#define    ff               first
#define    ss               second
#define    Buff             100000
//__attribute__((optimize("-O2")))
typedef    long long        LL;
typedef    pair<int,int>    PII;
typedef    pair<LL,LL>      PLL;
typedef    vector<char>     VB;
typedef    vector<int>      VI;
typedef    vector<LL>       VL;
typedef    vector<PII>      VII;
typedef    vector<PLL>      VLL;
const int       dx[]={ 0, 1, 0,-1, 0, 1,-1, 1,-1};
const int       dy[]={-1, 0, 1, 0,-1, 1,-1,-1, 1};
const LL        LINF=0xfcfcfcfcfcfcfcfll;
const int       MOD=1000000007;
const int       INF=0x3f3f3f3f;
const double    eps=0.00000001;
const double    ee=2.718281828459;
const double    pi=3.14159265358979323846l;
inline LL pmod(LL x,LL n,LL mod=MOD,LL res=1) { for(; n; x=x*x%mod,n>>=1)if(n&1)res=res*x%mod; return res; }
inline int myrand(int mod) { return ((LL)rand()<<32^(LL)rand()<<16^rand())%mod; }
inline int rand(int a,int b) { return a+myrand(b-a+1); }
template<class T>inline T _max(T a,T b) { return a>b?a:b; }
template<class T>inline T _min(T a,T b) { return a<b?a:b; }
template<class T>inline T _max(T a,T b,T c) { return _max(a,_max(b,c)); }
template<class T>inline T _min(T a,T b,T c) { return _min(a,_min(b,c)); }
template<class T>inline T _max(T a,T b,T c,T d) { return _max(a,_max(b,c,d)); }
template<class T>inline T _min(T a,T b,T c,T d) { return _min(a,_min(b,c,d)); }
inline char gtc() { static char bfi[Buff],*ci=bfi-1,*cl=ci; return ci==cl&&(cl=(ci=bfi-1)+fread(bfi,1,Buff,stdin),ci==cl)?EOF:*++ci; }
void readbit(double &ret,double bit=0.1,char chr=0) { if(chr=gtc(),isdigit(chr))ret+=(chr^'0')*bit,readbit(ret,bit*0.1); }
inline char _read(int &res,char flag=0,int sum=0,char chr=0) { while(chr=gtc(),!(isdigit(chr)||(chr^'-'?0:(chr=gtc(),flag=1)))) if(!~chr) return 0; while(isdigit(chr))sum=(sum+(sum<<2)<<1)+(chr^'0'),chr=gtc(); return (res=flag?-sum:sum,1); }
inline char _read(LL &res,char flag=0,LL sum=0,char chr=0) { while(chr=gtc(),!(isdigit(chr)||(chr^'-'?0:(chr=gtc(),flag=1)))) if(!~chr) return 0; while(isdigit(chr))sum=(sum+(sum<<2)<<1)+(chr^'0'),chr=gtc(); return (res=flag?-sum:sum,1); }
inline char _read(double &ret,char flag=0,LL sum=0,char chr=0) { while(chr=gtc(),!(isdigit(chr)||(chr^'-'?0:(chr=gtc(),flag=1)))) if(!~chr) return 0; while((isdigit(chr)))sum=(sum+(sum<<2)<<1)+(chr^'0'),chr=gtc(); if(ret=sum,!(chr^'.'))readbit(ret); return (ret=flag?-ret:ret,1); }
inline char _read(char &ch,char chr=0) { while(chr=gtc(),!(chr^' ')||!(chr^'\n')||!~chr) if(!~chr) return 0; return ch=chr; }
inline char _read(char *p,char chr=0) { while(chr=gtc(),!(chr^' ')||!(chr^'\n')||!~chr) if(!~chr) return 0; while(chr^'\n'&&~chr)*p++=chr,chr=gtc(); return !(*p=0); }
inline void ptc(char ch=0) { static char bfo[Buff],*co=bfo-1,*coe=co+Buff; if(!ch||(*++co=ch,co==coe))fwrite(bfo,1,co-bfo+1,stdout),co=bfo-1; }
void _out(int x) { if(x<0)ptc('-'),x=-x; if(x>9)_out(x/10); ptc(x%10^'0'); }
void _out(LL x) { if(x<0)ptc('-'),x=-x; if(x>9)_out(x/10); ptc(x%10^'0'); }
inline void _out(double x,int n=6) { if(x<0)ptc('-'),x=-x; _out((LL)x),x-=(LL)x,ptc('.'); while(n--)x*=10; _out(LL(x+0.5)); }
inline void _out(const char ch) { ptc(ch); }
inline void _out(const char *p) { while(*p)ptc(*p++); }
void read() {}
void _out_() {}
template<class T>inline char read(T &head) { return _read(head); }
template<class T>inline char read(T *head) { return _read(head); }
template<class T,class ...U>char read(T &head,U &...tail) { return _read(head),read(tail...); }
template<class T,class ...U>char read(T *head,U &...tail) { return _read(head),read(tail...); }
template<class T,class ...U>char read(T &head,U *...tail) { return _read(head),read(tail...); }
template<class T,class ...U>char read(T *head,U *...tail) { return _read(head),read(tail...); }
template<class T,class ...U>void _out_(T head,U ...tail) { _out(' '),_out(head),_out_(tail...); }
template<class T,class ...U>void out(T head,U ...tail) { _out(head),_out_(tail...),_out('\n'); }
#ifndef ONLINE_JUDGE
void _debug_() {}
void _debug(int x) { _out(x); }
void _debug(LL x) { _out(x); }
void _debug(double x) { _out(x); }
void _debug(const char ch) { _out(ch); }
void _debug(const char *p) { _out(p); }
template<class T,class ...U>void _debug_(T head,U ...tail) { _out(' '),_out(head),_debug_(tail...); }
template<class ...T>void debug(T ...tail) { static int cnt=0; _debug_("#####",++cnt,'|',tail...,'\n'),ptc(); }
#endif
/**_________________________head.end__________________________**/

const int N=1000005;
int a[10]={0,2,3,5,7,11,13};
VI v;
VII b;
int c[4]={0,2,33,2995};

/**_______________________main().begin________________________**/
int main() {
    ios::sync_with_stdio(0),cin.tie(0);
#ifndef ONLINE_JUDGE
//    freopen("in.txt","r",stdin);
//    freopen("out.txt","w",stdout);
#endif   ///main code begin......
    FOR(i,1,30000)FOR(j,1,6) {
        if(i%a[j]==0) {
            v.pb(i);
            break;
        }
    }
    int len=v.size();
    FOR(i,0,len-1) {
        int x=30030-v[i];
        if(v[i]>=x)break;
        if(vlbx(v,x)==x) {
            if(x^c[1]&&x^c[2]&&x^c[3]&&
               v[i]^c[1]&&v[i]^c[2]&&v[i]^c[3])
            b.pb(mp(v[i],x));
        }
    }
    int n;
    cin>>n;
    if(n&1) {
        printf("2 33 29995");
        FOR(i,0,(n-3)/2-1)printf(" %d %d",b[i].ff,b[i].ss);
    }
    else {
        printf("%d %d",b[0].ff,b[i].ss);
        FOR(i,1,n/2-1)printf(" %d %d",b[i].ff,b[i].ss);
    }
#ifndef out__   ///code end......
    ptc();
#endif
    return 0;
}
/**________________________main().end_________________________**/

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


Compiler output:
a.cc: In function 'int main()':
a.cc:107:9: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
  107 |     FOR(i,1,30000)FOR(j,1,6) {
      |         ^
a.cc:3:46: note: in definition of macro 'FOR'
    3 | #define    FOR(i,a,n)       for(register int i=a,_=n+1;i^_;++i)
      |                                              ^
a.cc:3:50: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
    3 | #define    FOR(i,a,n)       for(register int i=a,_=n+1;i^_;++i)
      |                                                  ^
a.cc:107:5: note: in expansion of macro 'FOR'
  107 |     FOR(i,1,30000)FOR(j,1,6) {
      |     ^~~
a.cc:107:23: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
  107 |     FOR(i,1,30000)FOR(j,1,6) {
      |                       ^
a.cc:3:46: note: in definition of macro 'FOR'
    3 | #define    FOR(i,a,n)       for(register int i=a,_=n+1;i^_;++i)
      |                                              ^
a.cc:3:50: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
    3 | #define    FOR(i,a,n)       for(register int i=a,_=n+1;i^_;++i)
      |                                                  ^
a.cc:107:19: note: in expansion of macro 'FOR'
  107 |     FOR(i,1,30000)FOR(j,1,6) {
      |                   ^~~
a.cc:114:9: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
  114 |     FOR(i,0,len-1) {
      |         ^
a.cc:3:46: note: in definition of macro 'FOR'
    3 | #define    FOR(i,a,n)       for(register int i=a,_=n+1;i^_;++i)
      |                                              ^
a.cc:3:50: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
    3 | #define    FOR(i,a,n)       for(register int i=a,_=n+1;i^_;++i)
      |                                                  ^
a.cc:114:5: note: in expansion of macro 'FOR'
  114 |     FOR(i,0,len-1) {
      |     ^~~
a.cc:127:13: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
  127 |         FOR(i,0,(n-3)/2-1)printf(" %d %d",b[i].ff,b[i].ss);
      |             ^
a.cc:3:46: note: in definition of macro 'FOR'
    3 | #define    FOR(i,a,n)       for(register int i=a,_=n+1;i^_;++i)
      |                                              ^
a.cc:3:50: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
    3 | #define    FOR(i,a,n)       for(register int i=a,_=n+1;i^_;++i)
      |                                                  ^
a.cc:127:9: note: in expansion of macro 'FOR'
  127 |         FOR(i,0,(n-3)/2-1)printf(" %d %d",b[i].ff,b[i].ss);
      |         ^~~
a.cc:130:34: error: 'i' was not declared in this scope
  130 |         printf("%d %d",b[0].ff,b[i].ss);
      |                                  ^
a.cc:131:13: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
  131 |         FOR(i,1,n/2-1)printf(" %d %d",b[i].ff,b[i].ss);
      |             ^
a.cc:3:46: note: in definition of macro 'FOR'
    3 | #define    FOR(i,a,n)       for(register int i=a,_=n+1;i^_;++i)
      |                                              ^
a.cc:3:50: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
    3 | #define    FOR(i,a,n)       for(register int i=a,_=n+1;i^_;++i)
      |                                                  ^
a.cc:131:9: note: in expansion of macro 'FOR'
  131 |         FOR(i,1,n/2-1)printf(" %d %d",b[i].ff,b[i].ss);
      |         ^~~