Language: C++

//#include <ext/pb_ds/assoc_container.hpp> 
//#include <ext/pb_ds/tree_policy.hpp>
//#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <iterator>
#include <functional>
#include <limits>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cassert>
#include <unordered_map>
#include <unordered_set>
#include <stack>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define trace(x) cerr << #x << ": " << x << " " << endl;
 
typedef int64_t ll;
 
#define endl '\n'
#define int ll
ll mod=1e9+7;
ll mod1=1e9+5;
ll power(ll a,ll b)
{
    if(b==0) return 1;
    else if(b%2==0)
        return power(((((a)%mod)*((a)%mod))%mod),b/2)%mod;
    else return (((a)%mod)*(power(((((a)%mod)*((a)%mod))%mod),b/2)%mod))%mod;
}
inline ll inverse(ll a,ll md) {
  a %= md;
  if (a < 0) a += md;
  ll b = md, u = 0, v = 1;
  while (a) {
    ll t = b / a;
    b -= t * a; swap(a, b);
    u -= t * v; swap(u, v);
  }
  assert(b == 1);
  if (u < 0) u += md;
  return u;
}
  
  
 //using namespace __gnu_pbds;
 //#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
//find_by_order(k)  returns iterator to kth element starting from 0;
//order_of_key(k) returns count of elements strictly smaller than k;
//erase,insert same as normal set
//mt19937 mrand(chrono::high_resolution_clock::now().time_since_epoch().count()); //for randomized solution
const int ce=1e9+7;
ll fast_mod(ll input)
{
    return input < ce ? input : input%ce;
}

int32_t main()
{
    IOS
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    #endif    
    
    int n;
    cin>>n;
    int a[n+1];
    for(int i=1;i<=n;i++)
        cin>>a[i];
    int b[n+1];
    for(int i=1;i<=n;i++)
        cin>>b[i];
    reverse(b+1,b+n+1);
    vector<pair<int,int>> v;
    for(int i=1;i<=n;i++)
    {
        if(a[i]==b[i])
        {
            v.push_back(i);
        }
    }
    if(v.size()%2)
    {
        cout<<"No"<<endl;
        return 0;
    }
    if(v.size()==0)
    {
        cout<<"Yes"<<endl;
        for(int i=1;i<=n;i++)
            cout<<b[i]<<" ";
        return 0;
    }
    if(b[v[0]]==b[v.back()])
    {
        cout<<"No";
        return 0; 
    }
    for(int i=0;i<v.size()/2;i++)
        swap(b[i],b[v.size()-1-i]);
    for(int i=1;i<=n;i++)
    {
        if(a[i]==b[i])
        {
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
        for(int i=1;i<=n;i++)
            cout<<b[i]<<" ";
}    


Compiler output:
a.cc: In function 'int32_t main()':
a.cc:89:24: error: no matching function for call to 'std::vector<std::pair<long int, long int> >::push_back(ll&)'
   89 |             v.push_back(i);
      |             ~~~~~~~~~~~^~~
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:8:
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::pair<long int, long int>; _Alloc = std::allocator<std::pair<long int, long int> >; value_type = std::pair<long int, long int>]'
 1283 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:35: note:   no known conversion for argument 1 from 'll' {aka 'long int'} to 'const std::vector<std::pair<long int, long int> >::value_type&' {aka 'const std::pair<long int, long int>&'}
 1283 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::pair<long int, long int>; _Alloc = std::allocator<std::pair<long int, long int> >; value_type = std::pair<long int, long int>]'
 1300 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:30: note:   no known conversion for argument 1 from 'll' {aka 'long int'} to 'std::vector<std::pair<long int, long int> >::value_type&&' {aka 'std::pair<long int, long int>&&'}
 1300 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
a.cc:104:9: error: no match for 'operator[]' (operand types are 'll [(n + 1)]' {aka 'long int [(n + 1)]'} and '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long int, long int> >, std::pair<long int, long int> >::value_type' {aka 'std::pair<long int, long int>'})
  104 |     if(b[v[0]]==b[v.back()])
      |         ^
a.cc:104:18: error: no match for 'operator[]' (operand types are 'll [(n + 1)]' {aka 'long int [(n + 1)]'} and '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long int, long int> >, std::pair<long int, long int> >::value_type' {aka 'std::pair<long int, long int>'})
  104 |     if(b[v[0]]==b[v.back()])
      |                  ^