Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vl;
#define rep(i, n) for(ll i = 0;i < n;i++)
#define all(i) i.begin(), i.end()
template<class T, class U> void cmax(T& a, U b) { if (a<b) a = b; }
template<class T, class U> void cmin(T& a, U b) { if (a>b) a = b; }

int main() {
  cin.tie(0); ios::sync_with_stdio(false);

  int m, k;
  cin >> m >> k;

  int n = (1<<m);

  if (m == 1) {
    if (k == 0) {
      cout << "0 0 1 1" << endl;
      return 0;
    } else {
      cout << -1 << endl;
      return 0;
    }
  }
  if (k >= n) 
    cout << -1 << endl;
    return 0;
  }

  cerr << n << endl;
  vector<int> ans;
  rep(i, n) {
    if (i == k) continue;
    ans.push_back(i);
  }
  ans.push_back(k);
  rep(i, n) {
    if (n-1-i == k) continue;
    ans.push_back(n-1-i);
  }
  ans.push_back(k);

  rep(i, n*2) {
    cout << ans[i] << " ";
  }
  cout << endl;
}


Compiler output:
a.cc:34:3: error: 'cerr' does not name a type
   34 |   cerr << n << endl;
      |   ^~~~
a.cc:7:19: error: expected unqualified-id before 'for'
    7 | #define rep(i, n) for(ll i = 0;i < n;i++)
      |                   ^~~
a.cc:36:3: note: in expansion of macro 'rep'
   36 |   rep(i, n) {
      |   ^~~
a.cc:36:7: error: 'i' does not name a type; did you mean 'vi'?
   36 |   rep(i, n) {
      |       ^
a.cc:7:32: note: in definition of macro 'rep'
    7 | #define rep(i, n) for(ll i = 0;i < n;i++)
      |                                ^
a.cc:36:7: error: 'i' does not name a type; did you mean 'vi'?
   36 |   rep(i, n) {
      |       ^
a.cc:7:38: note: in definition of macro 'rep'
    7 | #define rep(i, n) for(ll i = 0;i < n;i++)
      |                                      ^
a.cc:40:3: error: 'ans' does not name a type
   40 |   ans.push_back(k);
      |   ^~~
a.cc:7:19: error: expected unqualified-id before 'for'
    7 | #define rep(i, n) for(ll i = 0;i < n;i++)
      |                   ^~~
a.cc:41:3: note: in expansion of macro 'rep'
   41 |   rep(i, n) {
      |   ^~~
a.cc:41:7: error: 'i' does not name a type; did you mean 'vi'?
   41 |   rep(i, n) {
      |       ^
a.cc:7:32: note: in definition of macro 'rep'
    7 | #define rep(i, n) for(ll i = 0;i < n;i++)
      |                                ^
a.cc:41:7: error: 'i' does not name a type; did you mean 'vi'?
   41 |   rep(i, n) {
      |       ^
a.cc:7:38: note: in definition of macro 'rep'
    7 | #define rep(i, n) for(ll i = 0;i < n;i++)
      |                                      ^
a.cc:45:3: error: 'ans' does not name a type
   45 |   ans.push_back(k);
      |   ^~~
a.cc:7:19: error: expected unqualified-id before 'for'
    7 | #define rep(i, n) for(ll i = 0;i < n;i++)
      |                   ^~~
a.cc:47:3: note: in expansion of macro 'rep'
   47 |   rep(i, n*2) {
      |   ^~~
a.cc:47:7: error: 'i' does not name a type; did you mean 'vi'?
   47 |   rep(i, n*2) {
      |       ^
a.cc:7:32: note: in definition of macro 'rep'
    7 | #define rep(i, n) for(ll i = 0;i < n;i++)
      |                                ^
a.cc:47:7: error: 'i' does not name a type; did you mean 'vi'?
   47 |   rep(i, n*2) {
      |       ^
a.cc:7:38: note: in definition of macro 'rep'
    7 | #define rep(i, n) for(ll i = 0;i < n;i++)
      |                                      ^
a.cc:50:3: error: 'cout' does not name a type
   50 |   cout << endl;
      |   ^~~~
a.cc:51:1: error: expected declaration before '}' token
   51 | }
      | ^