Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; (i) < (int) (n); (i) ++)
using namespace std;

vector<int> dfs(int left, int len, int s, int t) {
        assert(s != t);
        if (len == 2) {
                return vector<int>{ s, t };
        }
        int m = left + len / 2;
        bool swapped = false;
        if (s > t) {
                swap(s, t);
                swapped = true;
        }
        if (s < m && m <= t) {
                int u = left;
                while (u % 2 == s % 2) {
                        u ++;
                }
                assert(u < m);
                int uu = u + len / 2;
                if (s == u || uu == t) {
                        puts("Wei");
                        return 0;
                }
                auto l = dfs(left, len / 2, s, u);
                auto r = dfs(m, len / 2, uu, t);
                for (auto it : r) {
                        l.push_back(it);
                }
                assert(l.size() == len);
                if (swapped) {
                        reverse(l.begin(), l.end());
                }
                return l;
        } else { 
                vector<int> res;
                if (s < m && t < m) {
                        auto l = dfs(left, len / 2, s, t);
                        int u = l[1];
                        int uu = u + len / 2;
                        int ss = s + len / 2;
                        auto r = dfs(m, len / 2, ss, uu);
                        res.push_back(s);
                        for (auto it : r) {
                                res.push_back(it);
                        }
                        for (int i = 1; i < l.size(); i ++) {
                                res.push_back(l[i]);
                        }
                } else {
                        auto r = dfs(m, len / 2, s, t);
                        int u = r[1];
                        int uu = u - len / 2;
                        int ss = s - len / 2;
                        auto l = dfs(left, len / 2, ss, uu);
                        res.push_back(s);
                        for (auto it : l) {
                                res.push_back(it);
                        }
                        for (int i = 1; i < r.size(); i ++) {
                                res.push_back(r[i]);
                        }
                }
                assert(res.size() == len);
                if (swapped) {
                        reverse(res.begin(), res.end());
                }
                return res;
        }
}

int main() {
        int n, a, b;
        scanf("%d%d%d", &n, &a, &b);
        int ac = __builtin_popcount(a);
        int bc = __builtin_popcount(b);
        if (ac % 2 == bc % 2) {
                puts("NO");
                return 0;
        }
        puts("YES");
        auto ans = dfs(0, (1 << n), a, b);
        assert(ans.size() == (1 << n));
        rep(i, ans.size()) {
                printf("%d ", ans[i]);
        }
        printf("\n");
        return 0;
}


Compiler output:
a.cc: In function 'std::vector<int> dfs(int, int, int, int)':
a.cc:25:32: error: could not convert '0' from 'int' to 'std::vector<int>'
   25 |                         return 0;
      |                                ^
      |                                |
      |                                int