Language: C++

#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cwchar>
#include <cwctype>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <codecvt>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, n) for(int i = 1; i <= (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize("Ofast")
using namespace std;
typedef int64_t ll;
typedef long double ld;
const ll INF=(1LL<<60);
const ld pi=acosl(1);
const ll mod = 1000000007;
//const ll mod = 998244353;
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const int ddx[8]={1,0,-1,-1,-1,0,1,1};
const int ddy[8]={1,1,1,0,-1,-1,-1,0};

bool check(ll n){
  //2の倍数をk個
  for(ll k=1;k<n;k++){
    if((n-2*k)%3!=0)continue;
    ll l=(n-2*k)/3;
    if(!(1<=3*l&&3*l<=15000))continue;
    if(!(1<=2*k&&2*k<=5000))continue;
    //cout<<k<<" "<<l<<endl;
    rep(i,3*l)cout<<2*(i+1)<<" ";
    rep(i,2*k)cout<<3*(2*i+1)<<" ";
    cout<<endl;
    return true;
  }
  return false;
}

bool solve(){
  ll n;cin>>n;
  if(n==3){
    cout<<"2 5 63"<<endl;
  }
  else if(n==4){
    cout<<"2 5 20 63"<<endl;
  }
  else if(n==6){
    cout<<"2 5 63 630 1260 2520"<<endl;
  }
  else if(n==19999){
      ll k=5000;
      ll l=3333;
      ll count1=0;
      for(ll i=-1;;){
        i++;
        if((2*(i+1))%3==0){
          continue;
        }
        count1++;
        cout<<2*(i+1)<<" ";
        if(count1==3*l)break;
      }
      //cout<<"count= "<<count1<<endl;
      rep(i,2*k){
        cout<<3*(i+1)<<" ";
        count1++;
      }
      //cout<<"count= "<<count1<<endl;
      cout<<endl;
          return 0;

    }
  }
  else check(n);
  return false;
  //rep(i,20001)if(!check(i))cout<<i<<endl;
}

signed main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);cout<<fixed;
  cout<<setprecision(30);
  if(solve())return 1;
}


Compiler output:
a.cc:144:3: error: expected unqualified-id before 'else'
  144 |   else check(n);
      |   ^~~~
a.cc:145:3: error: expected unqualified-id before 'return'
  145 |   return false;
      |   ^~~~~~
a.cc:147:1: error: expected declaration before '}' token
  147 | }
      | ^
a.cc: In function 'bool solve()':
a.cc:143:3: warning: control reaches end of non-void function [-Wreturn-type]
  143 |   }
      |   ^