Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)  
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};


int diff(int n,int x,int y){
  int a2[n];
  int b2[n];
  int difference = 0;
  REP(i,n){
    a2[i] = x%2;
    b2[i] = y%2;
    x /= 2;
    y /= 2;
    if(a2[i]!=b2[i]){
      difference++;
    }
  }
  return difference;
}

/*int diff(int n,int a2[n],int b2[n]){
   REP(i,n){
    if(a2[i]!=b2[i]){
      difference++;
    }
  }
  return difference;
}*/

int ten(int n,int *a2){
  int ans = 0;
  REP(i,n){
    ans += pow(2,i) * a2[i];
  }
  return ans;
}

int main(){

  int n,a,b;
  cin>>n>>a>>b;
  int a2[n];
  int b2[n];
  int x = a;
  int y = b;
  int difference = 0;
  REP(i,n){
    a2[i] = x%2;
    b2[i] = y%2;
    x /= 2;
    y /= 2;
    if(a2[i]!=b2[i]){
      difference++;
    }
  }
  if(difference%2==0){
    cout<<"NO"<<endl;
    return 0;
  }
  cout<<"YES"<<endl;


  vector<int> changeable;
  REP(i,n){
    changeable.pb(i);
  }

  cout<<ten(a2)<<endl;
  REP(i,n-1){
    //固定するやつを決める
    int kotei;
    //differenceを調べる
    //int dif = diff(n,a2,b2);
    int p = 0;
    while(1){
      int q = changeable[p];
      if(a2[q]!=b2[q]){
        kotei = q;
        break;
      }
      p++;
    }
    int koteiNum;
    //固定する要素を外す
    REP(j,changeable.size()){
      if(changeable[j]==kotei){
        changeable.erase(changeable.begin() + j);
        break;
      }
    }
    for(int j = 1;j<pow(2,n-i-1);j++){
      int t = 0;
      while(1){
        if(j%pow(2,t+1)!=0){
          break;
        }
        t++;
      }
      if(a2[changeable[t]]==0){
        a2[changeable[t]] = 1;
      }else{
        a2[changeable[t]] = 0;
      }
      cout<<ten(a2)<<endl;
    }
    if(a2[kotei] = 1){
      a2[kotei] = 0;
    }else{
      a2[kotei] = 1;
    }
  }

  cout<<ten(b2)<<endl;

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:84:13: error: invalid conversion from 'int*' to 'int' [-fpermissive]
   84 |   cout<<ten(a2)<<endl;
      |             ^~
      |             |
      |             int*
a.cc:84:12: error: too few arguments to function 'int ten(int, int*)'
   84 |   cout<<ten(a2)<<endl;
      |         ~~~^~~~
a.cc:46:5: note: declared here
   46 | int ten(int n,int *a2){
      |     ^~~
a.cc:110:13: error: invalid operands of types 'int' and '__gnu_cxx::__promote<double>::__type' {aka 'double'} to binary 'operator%'
  110 |         if(j%pow(2,t+1)!=0){
      |            ~^~~~~~~~~~~
      |            |    |
      |            int  __gnu_cxx::__promote<double>::__type {aka double}
a.cc:120:17: error: invalid conversion from 'int*' to 'int' [-fpermissive]
  120 |       cout<<ten(a2)<<endl;
      |                 ^~
      |                 |
      |                 int*
a.cc:120:16: error: too few arguments to function 'int ten(int, int*)'
  120 |       cout<<ten(a2)<<endl;
      |             ~~~^~~~
a.cc:46:5: note: declared here
   46 | int ten(int n,int *a2){
      |     ^~~
a.cc:129:13: error: invalid conversion from 'int*' to 'int' [-fpermissive]
  129 |   cout<<ten(b2)<<endl;
      |             ^~
      |             |
      |             int*
a.cc:129:12: error: too few arguments to function 'int ten(int, int*)'
  129 |   cout<<ten(b2)<<endl;
      |         ~~~^~~~
a.cc:46:5: note: declared here
   46 | int ten(int n,int *a2){
      |     ^~~