Language: C++

#include <bits/stdc++.h>
#ifdef local
#define debug(a...) qqbx(#a, a)
template <typename H, typename ...T> void qqbx(const char *s, const H &h, T&&...a) {
    for(; *s && *s != ','; ++s) if(*s != ' ') std::cerr<<*s;
    std::cerr<<" = "<<h<<(sizeof...(T) ? ", " : "\n");
    if constexpr(sizeof...(T)) qqbx(++s, a...);
}
#else
#define debug(...) ((void)0)
#endif // local
#define pb emplace_back
#define all(v) begin(v),end(v)

using namespace std;
const int MOD = 1000000007, N = 200025, inf = 2e9;
int a[N], b[N], ca[N], cb[N];
int A[N], B[N];
signed main() {
    ios_base::sync_with_stdio(0), cin.tie(0);
    int n;
    cin >> n;
    for(int i = 0; i < n; i++) cin >> a[i];
    for(int i = 0; i < n; i++) cin >> b[i];
    for(int i = 0; i < n; i++) ++ca[a[i]];
    for(int i = 0; i < n; i++) ++cb[b[i]];
    for(int i = 1; i <= n; i++) if(ca[i] + cb[i] > n) return cout << "No\n", 0;
    vector<pair<int,int>> pr;
    for(int i = 1; i <= n; i++) pr.pb(min(ca[i]+cb[i]), i);
    sort(pr.begin(), pr.end(), greater<>());
    int x = pr[0].second;
    int p = 0, q = 0;
    for(int i = 0; i < ca[x]; i++) A[p++] = x;
    int os = p;
    for(int i = 0; i < cb[x]; i++) B[q++] = x;
    for(int i = 1; i < n; i++) {
        auto [_, x] = pr[i];
        for(int j = 0; j < ca[x]; j++) A[p++] = x;
        for(int j = 0; j < cb[x]; j++) B[q++] = x;
    }
    rotate(B, B+os, B+n);
    cout << "Yes\n";
    for(int i = 0; i < n; i++) cout << B[i] << ' ';
    cout << '\n';
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:42: error: no matching function for call to 'min(int)'
   29 |     for(int i = 1; i <= n; i++) pr.pb(min(ca[i]+cb[i]), i);
      |                                       ~~~^~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   template argument deduction/substitution failed:
a.cc:29:42: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   29 |     for(int i = 1; i <= n; i++) pr.pb(min(ca[i]+cb[i]), i);
      |                                       ~~~^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   candidate expects 2 arguments, 1 provided