Language: C++

//INCLUDE
//------------------------------------------
#include <bits/stdc++.h>
//DEFINE
//------------------------------------------
#define ll long long
#define ld long double
#define ALLv(a)  (a).begin(),(a).end()
#define ALL(a,n)  (a),(a)+n
#define vi vector<long long>
#define vd vector<long double>
#define vs vector<string>
//CONST
//------------------------------------------
#define INF 1010000000000000017LL
#define MOD 1000000007LL
#define EPS 1e-12
#define PI 3.14159265358979323846
//REPEAT
//------------------------------------------
#define   FOR(i,m,n) for(ll (i)=(m);   (i)<(n);  (i)++)
#define   REP(i,n)   for(ll (i)=0;     (i)<(n);  (i)++)
#define  REPS(i,x)   for(ll (i)=1;     (i)<=(x); (i)++)
#define  RREP(i,x)   for(ll (i)=(x)-1; (i)>=0;   (i)--)
#define RREPS(i,x)   for(ll (i)=(x);   (i)> 0;   (i)--)
#define  WREP(i,in,j,jn) REP(i,in)REP(j,jn)
//-----------------------------------------
#define ifYN(x) cout<<(x?"Yes":"No")<<"\n" 
#define dcml(n) fixed<<setprecision(n)

 
ll GCD(ll a,ll b) { return b ? GCD(b,a%b) : a; } 
ll LCM(ll a,ll b) { return a/GCD(a,b)*b; } 
ll Factorial(ll n){ ll m=1;while(n>=1)m*=n--;return m; } 
ll modPow(ll x,ll n,ll mod=MOD){ 
    return (!n?1:!n%2?modPow(x*x,n/2,mod)%mod:x%mod*modPow(x,n-1,mod)%mod); 
} 
using namespace std;
//-------------------------------------------
typedef pair<ll,ll> P;
int main(void){
    ll n;cin>>n;
    ll N=1<<n;
    vi s(N);
    REP(i,N) cin >> s[i];

    multiset<ll> S;
    REP(i,N)S.insert(s[i]);

    priority_queue q1,q2;
    auto it=S.end();it--;
    q1.push(*it);
    S.erase(it);

    while(S.size()!=0){
        while(q1.size()!=0){

            ll q=q1.top();q1.pop();
            auto it2=S.lower_bound(q);
            if(it2==S.begin()){cout<<"No\n";exit(0);}

            it2--;
            q2.push(*it2);S.erase(it2);
            q2.push(*it);
        }
        swap(q1,q2);
    }
    cout<<"Yes\n";
}

Compiler output:
a.cc: In function 'int main()':
a.cc:50:20: error: class template argument deduction failed:
   50 |     priority_queue q1,q2;
      |                    ^~
a.cc:50:20: error: no matching function for call to 'priority_queue()'
In file included from /usr/include/c++/14/queue:66,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:157,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_queue.h:691:9: note: candidate: 'template<class _Tp, class _Sequence, class _Compare, class _InputIterator, class _Alloc, class _Requires> priority_queue(_InputIterator, _InputIterator, const _Compare&, _Sequence&&, const _Alloc&)-> std::priority_queue<_Tp, _Sequence, _Compare>'
  691 |         priority_queue(_InputIterator __first, _InputIterator __last,
      |         ^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_queue.h:691:9: note:   candidate expects 5 arguments, 0 provided
/usr/include/c++/14/bits/stl_queue.h:679:9: note: candidate: 'template<class _Tp, class _Sequence, class _Compare, class _InputIterator, class _Alloc, class, class _Requires> priority_queue(_InputIterator, _InputIterator, const _Compare&, const _Sequence&, const _Alloc&)-> std::priority_queue<_Tp, _Sequence, _Compare>'
  679 |         priority_queue(_InputIterator __first, _InputIterator __last,
      |         ^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_queue.h:679:9: note:   candidate expects 5 arguments, 0 provided
/usr/include/c++/14/bits/stl_queue.h:671:9: note: candidate: 'template<class _Tp, class _Sequence, class _Compare, class _InputIterator, class _Alloc, class, class _Requires> priority_queue(_InputIterator, _InputIterator, const _Compare&, const _Alloc&)-> std::priority_queue<_Tp, _Sequence, _Compare>'
  671 |         priority_queue(_InputIterator __first, _InputIterator __last,
      |         ^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_queue.h:671:9: note:   candidate expects 4 arguments, 0 provided
/usr/include/c++/14/bits/stl_queue.h:663:9: note: candidate: 'template<class _Tp, class _Sequence, class _Compare, class _InputIterator, class _Alloc, class, class _Requires> priority_queue(_InputIterator, _InputIterator, const _Alloc&)-> std::priority_queue<_Tp, _Sequence, _Compare>'
  663 |         priority_queue(_InputIterator __first, _InputIterator __last,
      |         ^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_queue.h:663:9: note:   candidate expects 3 arguments, 0 provided
/usr/include/c++/14/bits/stl_queue.h:649:9: note: candidate: 'template<class _Tp, class _Sequence, class _Compare, class _InputIterator, class> priority_queue(_InputIterator, _InputIterator, const _Compare&, _Sequence&&)-> std::priority_queue<_Tp, _Sequence, _Compare>'
  649 |         priority_queue(_InputIterator __first, _InputIterator __last,
      |         ^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_queue.h:649:9: note:   candidate expects 4 arguments, 0 provided
/usr/include/c++/14/bits/stl_queue.h:638:9: note: candidate: 'template<class _Tp, class _Sequence, class _Compare, class _InputIterator, class> priority_queue(_InputIterator, _InputIterator, const _Compare&, const _Sequence&)-> std::priority_queue<_Tp, _Sequence, _Compare>'
  638 |         priority_queue(_InputIterator __first, _InputIterator __last,
      |         ^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_queue.h:638:9: note:   candidate expects 4 arguments, 0 provided
/usr/include/c++/14/bits/stl_queue.h:629:9: note: candidate: 'template<class _Tp, class _Sequence, class _Compare, class _InputIterator, class> priority_queue(_InputIterator, _InputIterator, const _Compare&)-> std::priority_queue<_Tp, _Sequence, _Compare>'
  629 |         priority_queue(_InputIterator __first, _InputIterator __last,
      |         ^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_queue.h:629:9: note:   candidate expects 2 arguments, 0 provided
/usr/include/c++/14/bits/stl_queue.h:594:9: note: candidate: 'template<class _Tp, class _Sequence, class _Compare, class _Alloc, class _Requires> priority_queue(std::priority_queue<_Tp, _Sequence, _Compare>&&, const _Alloc&)-> std::priority_queue<_Tp, _Sequence, _Compare>'
  594 |         priority_queue(priority_queue&& __q, const _Alloc& __a)
      |         ^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_queue.h:594:9: note:   candidate expects 2 arguments, 0 provided
/usr/include/c++/14/bits/stl_queue.h:590:9: note: candidate: 'template<class _Tp, class _Sequence, class _Compare, class _Alloc, class _Requires> priority_queue(const std::priority_queue<_Tp, _Sequence, _Compare>&, const _Alloc&)-> std::priority_queue<_Tp, _Sequence, _Compare>'
  590 |         priority_queue(const priority_queue& __q, const _Alloc& __a)
      |         ^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_queue.h:590:9: note:   candidate expects 2 arguments, 0 provided
/usr/include/c++/14/bits/stl_queue.h:585:9: note: candidate: 'template<class _Tp, class _Sequence, class _Compare, class _Alloc, class _Requires> priority_queue(const _Compare&, _Sequence&&, const _Alloc&)-> std::priority_queue<_Tp, _Sequence, _Compare>'
  585 |         priority_queue(const _Compare& __x, _Sequence&& __c, const _Alloc& __a)
      |         ^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_queue.h:585:9: note:   candidate expects 3 arguments, 0 provided
/usr/include/c++/14/bits/stl_queue.h:579:9: note: candidate: 'template<class _Tp, class _Sequence, class _Compare, class _Alloc, class _Requires> priority_queue(const _Compare&, const _Sequence&, const _Alloc&)-> std::priority_queue<_Tp, _Sequence, _Compare>'
  579 |         priority_queue(const _Compare& __x, const _Sequence& __c,
      |         ^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_queue.h:579:9: note:   candidate expects 3 arguments, 0 provided
/usr/include/c++/14/bits/stl_queue.h:573:9: note: candidate: 'template<class _Tp, class _Sequence, class _Compare, class _Alloc, class _Requires> priority_queue(const _Compare&, const _Alloc&)-> std::priority_queue<_Tp, _Sequence, _Compare>'
  573 |         priority_queue(const _Compare& __x, const _Alloc& __a)
      |         ^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_queue.h:573:9: note:   candidate expects 2 arguments, 0 provided
/usr/include/c++/14/bits/stl_queue.h:569:9: note: candidate: 'template<class _Tp, class _Sequence, class _Compare, class _Alloc, class _Requires> priority_queue(const _Alloc&)-> std::priority_queue<_Tp, _Sequence, _Compare>'
  569 |         priority_queue(const _Alloc& __a)
      |         ^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_queue.h:569:9: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_queue.h:563:7: note: candidate: 'template<class _Tp, class _Sequence, class _Compare> priority_queue(const _Compare&, _Sequence&&)-> std::priority_queue<_Tp, _Sequence, _Compare>'
  563 |       priority_queue(const _Compare& __x, _Sequence&& __s = _Sequence())
      |       ^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_queue.h:563:7: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_queue.h:558:7: note: candidate: 'template<class _Tp, class _Sequence, class _Compare> priority_queue(const _Compare&, const _Sequence&)-> std::priority_queue<_Tp, _Sequence, _Compare>'
  558 |       priority_queue(const _Compare& __x, const _Sequence& __s)
      |       ^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_queue.h:558:7: note:   candidate expects 2 arguments, 0 provided
/usr/include/c++/14/bits/stl_queue.h:554:9: note: candidate: 'template<class _Tp, class _Sequence, class _Compare, class _Seq, class _Requires> priority_queue()-> std::priority_queue<_Tp, _Sequence, _Compare>'
  554 |         priority_queue()
      |         ^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_queue.h:554:9: note:   template argument deduction/substitution failed:
a.cc:50:20: note:   couldn't deduce template parameter '_Tp'
   50 |     priority_queue q1,q2;
      |                    ^~
/usr/include/c++/14/bits/stl_queue.h:496:11: note: candidate: 'template<class _Tp, class _Sequence, class _Compare> priority_queue(std::priority_queue<_Tp, _Sequence, _Compare>)-> std::priority_queue<_Tp, _Sequence, _Compare>'
  496 |     class priority_queue
      |           ^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_queue.h:496:11: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_queue.h:818:5: note: candidate: 'template<class _Compare, class _Container, class _Allocator, class, class> std::priority_queue(_Compare, _Container, _Allocator)-> priority_queue<typename _Container::value_type, _Container, _Compare>'
  818 |     priority_queue(_Compare, _Container, _Allocator)
      |     ^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_queue.h:818:5: note:   candidate expects 3 arguments, 0 provided
/usr/include/c++/14/bits/stl_queue.h:811:5: note: candidate: 'template<class _InputIterator, class _ValT, class _Compare, class _Container, class, class, class> std::priority_queue(_InputIterator, _InputIterator, _Compare, _Container)-> priority_queue<_ValT, _Container, _Compare>'
  811 |     priority_queue(_InputIterator, _InputIterator, _Compare = _Compare(),
      |     ^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_queue.h:811:5: note:   candidate expects 2 arguments, 0 provided
/usr/include/c++/14/bits/stl_queue.h:801:5: note: candidate: 'template<class _Compare, class _Container, class, class> std::priority_queue(_Compare, _Container)-> priority_queue<typename _Container::value_type, _Container, _Compare>'
  801 |     priority_queue(_Compare, _Container)
      |     ^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_queue.h:801:5: note:   candidate expects 2 arguments, 0 provided
a.cc:50:23: error: class template argument deduction failed:
   50 |     priority_queue q1,q2;
      |                       ^~
a.cc:50:23: error: no matching function for call to 'priority_queue()'
/usr/include/c++/14/bits/stl_queue.h:691:9: note: candidate: 'template<class _Tp, class _Sequence, class _Compare, class _InputIterator, class _Alloc, class _Requires> priority_queue(_InputIterator, _InputIterator, const _Compare&, _Sequence&&, const _Alloc&)-> std::priority_queue<_Tp, _Sequence, _Compare>'
  691 |         priority_queue(_InputIterator __first, _InputIterator __last,
      |         ^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_queue.