Language: C++

include <bits/stdc++.h>
using namespace std;
 
#define int long long
signed main(){
 
    ios_base::sync_with_stdio(0);
    cin.tie(0);
 
    int N;
    cin >> N;
 
    map<int, int> A;
    map<int, int> B;
    vector<int> vA;
    deque<int> vB;
 
    for(int i = 0; i < N; i++){
 
        int ai;
        cin >> ai;
        A[ai]++;
        vA.push_back(ai);
    }
 
    for(int i = 0; i < N; i++){
 
        int ai;
        cin >> ai;
        B[ai]++;
        vB.push_back(ai);
    }
 
 
 
    for(map<int,int>::iterator iter = B.begin(); iter != B.end(); iter++){
 
        if (B[iter->first] > N - A[iter->first]) {
            cout << "No";
            return 0;
        }
 
    }
 
    cout << "Yes" << "\n";
 
    map<int,int>::reverse_iterator iter = B.rbegin();
 
    for(int i = 0; i < N; i++){
 
        while (1){
 
            if (iter == B.rend()){
                iter = B.rbegin();
            }
            else if ( vA[i] == iter->first || iter->second == 0) {
               iter++;
            }
            else {
                cout << iter->first << " ";
                iter->second --;
                break;
            }
 
        }
/*
       if ( vA[i] == vB.front() ) {
            cout << vB.back() << " ";
            vB.pop_back();
        }
 
        else{
            cout << vB.front() << " ";
            vB.pop_front();
        }*/
    }
 
 
 
 
 
    }

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include <bits/stdc++.h>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:7:5: error: 'ios_base' has not been declared
    7 |     ios_base::sync_with_stdio(0);
      |     ^~~~~~~~
a.cc:8:5: error: 'cin' was not declared in this scope
    8 |     cin.tie(0);
      |     ^~~
a.cc:13:5: error: 'map' was not declared in this scope
   13 |     map<int, int> A;
      |     ^~~
a.cc:4:13: error: expected primary-expression before 'long'
    4 | #define int long long
      |             ^~~~
a.cc:13:9: note: in expansion of macro 'int'
   13 |     map<int, int> A;
      |         ^~~
a.cc:4:13: error: expected primary-expression before 'long'
    4 | #define int long long
      |             ^~~~
a.cc:14:9: note: in expansion of macro 'int'
   14 |     map<int, int> B;
      |         ^~~
a.cc:15:5: error: 'vector' was not declared in this scope
   15 |     vector<int> vA;
      |     ^~~~~~
a.cc:4:13: error: expected primary-expression before 'long'
    4 | #define int long long
      |             ^~~~
a.cc:15:12: note: in expansion of macro 'int'
   15 |     vector<int> vA;
      |            ^~~
a.cc:16:5: error: 'deque' was not declared in this scope
   16 |     deque<int> vB;
      |     ^~~~~
a.cc:4:13: error: expected primary-expression before 'long'
    4 | #define int long long
      |             ^~~~
a.cc:16:11: note: in expansion of macro 'int'
   16 |     deque<int> vB;
      |           ^~~
a.cc:22:9: error: 'A' was not declared in this scope
   22 |         A[ai]++;
      |         ^
a.cc:23:9: error: 'vA' was not declared in this scope
   23 |         vA.push_back(ai);
      |         ^~
a.cc:30:9: error: 'B' was not declared in this scope
   30 |         B[ai]++;
      |         ^
a.cc:31:9: error: 'vB' was not declared in this scope
   31 |         vB.push_back(ai);
      |         ^~
a.cc:4:13: error: expected primary-expression before 'long'
    4 | #define int long long
      |             ^~~~
a.cc:36:13: note: in expansion of macro 'int'
   36 |     for(map<int,int>::iterator iter = B.begin(); iter != B.end(); iter++){
      |             ^~~
a.cc:36:50: error: 'iter' was not declared in this scope
   36 |     for(map<int,int>::iterator iter = B.begin(); iter != B.end(); iter++){
      |                                                  ^~~~
a.cc:36:58: error: 'B' was not declared in this scope
   36 |     for(map<int,int>::iterator iter = B.begin(); iter != B.end(); iter++){
      |                                                          ^
a.cc:38:34: error: 'A' was not declared in this scope
   38 |         if (B[iter->first] > N - A[iter->first]) {
      |                                  ^
a.cc:39:13: error: 'cout' was not declared in this scope
   39 |             cout << "No";
      |             ^~~~
a.cc:45:5: error: 'cout' was not declared in this scope
   45 |     cout << "Yes" << "\n";
      |     ^~~~
a.cc:4:13: error: expected primary-expression before 'long'
    4 | #define int long long
      |             ^~~~
a.cc:47:9: note: in expansion of macro 'int'
   47 |     map<int,int>::reverse_iterator iter = B.rbegin();
      |         ^~~
a.cc:53:17: error: 'iter' was not declared in this scope
   53 |             if (iter == B.rend()){
      |                 ^~~~
a.cc:53:25: error: 'B' was not declared in this scope
   53 |             if (iter == B.rend()){
      |                         ^
a.cc:56:23: error: 'vA' was not declared in this scope
   56 |             else if ( vA[i] == iter->first || iter->second == 0) {
      |                       ^~