Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=200005,INF=1<<30;

int main(){
    
    int N;cin>>N;
    multiset<int,vector<int>,greater<int>> MS;
    vector<int> A((1<<N));
    for(int i=0;i<(1<<N);i++){
        cin>>A[i];
    }
    
    sort(all(A));
    
    for(int i=0;i<(1<<N)-1;i++){
        MS.insert(A[i]);
    }
    
    bool ok=true;
    
    vector<int> B;
    B.push_back(A[A.size()-1]);
    
    int kai=1;
    
    for(int k=0;k<N;k++){
        for(int i=0;i<kai;i++){
            auto it=MS.upper_bound(B[i]);
            if(it==MS.end()){
                ok=false;
            }else{
                MS.erase(it);
                B.push_back(*it);
            }
        }
        if(!ok) break;
        kai*=2;
        sort(all(B));
        reverse(all(B));
    }
    
    if(ok) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    
}



Compiler output:
In file included from /usr/include/c++/14/set:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:158,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_multiset.h: In instantiation of 'class std::multiset<int, std::vector<int>, std::greater<int> >':
a.cc:10:44:   required from here
   10 |     multiset<int,vector<int>,greater<int>> MS;
      |                                            ^~
/usr/include/c++/14/bits/stl_multiset.h:130:29: error: no type named 'value_type' in 'struct std::greater<int>'
  130 |         rebind<_Key>::other _Key_alloc_type;
      |                             ^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_multiset.h:133:54: error: no type named 'value_type' in 'struct std::greater<int>'
  133 |                        key_compare, _Key_alloc_type> _Rep_type;
      |                                                      ^~~~~~~~~
/usr/include/c++/14/bits/stl_multiset.h:137:58: error: no type named 'value_type' in 'struct std::greater<int>'
  137 |       typedef __gnu_cxx::__alloc_traits<_Key_alloc_type> _Alloc_traits;
      |                                                          ^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_multiset.h:738:49: error: using invalid field 'std::multiset<_Key, _Compare, _Alloc>::_M_t'
  738 |         count(const _Kt& __x) const -> decltype(_M_t._M_count_tr(__x))
      |                                                 ^~~~
/usr/include/c++/14/bits/stl_multiset.h:823:30: error: using invalid field 'std::multiset<_Key, _Compare, _Alloc>::_M_t'
  823 |         -> decltype(iterator(_M_t._M_lower_bound_tr(__x)))
      |                              ^~~~
/usr/include/c++/14/bits/stl_multiset.h:829:30: error: using invalid field 'std::multiset<_Key, _Compare, _Alloc>::_M_t'
  829 |         -> decltype(iterator(_M_t._M_lower_bound_tr(__x)))
      |                              ^~~~
/usr/include/c++/14/bits/stl_multiset.h:853:30: error: using invalid field 'std::multiset<_Key, _Compare, _Alloc>::_M_t'
  853 |         -> decltype(iterator(_M_t._M_upper_bound_tr(__x)))
      |                              ^~~~
/usr/include/c++/14/bits/stl_multiset.h:859:30: error: using invalid field 'std::multiset<_Key, _Compare, _Alloc>::_M_t'
  859 |         -> decltype(iterator(_M_t._M_upper_bound_tr(__x)))
      |                              ^~~~
/usr/include/c++/14/bits/stl_multiset.h:881:7: error: no type named 'value_type' in 'struct std::greater<int>'
  881 |       equal_range(const key_type& __x)
      |       ^~~~~~~~~~~
/usr/include/c++/14/bits/stl_multiset.h:885:7: error: no type named 'value_type' in 'struct std::greater<int>'
  885 |       equal_range(const key_type& __x) const
      |       ^~~~~~~~~~~
/usr/include/c++/14/bits/stl_multiset.h:892:21: error: no type named 'value_type' in 'struct std::greater<int>'
  892 |         -> decltype(pair<iterator, iterator>(_M_t._M_equal_range_tr(__x)))
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_multiset.h:892:46: error: using invalid field 'std::multiset<_Key, _Compare, _Alloc>::_M_t'
  892 |         -> decltype(pair<iterator, iterator>(_M_t._M_equal_range_tr(__x)))
      |                                              ^~~~
/usr/include/c++/14/bits/stl_multiset.h:898:21: error: no type named 'value_type' in 'struct std::greater<int>'
  898 |         -> decltype(pair<iterator, iterator>(_M_t._M_equal_range_tr(__x)))
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_multiset.h:898:46: error: using invalid field 'std::multiset<_Key, _Compare, _Alloc>::_M_t'
  898 |         -> decltype(pair<iterator, iterator>(_M_t._M_equal_range_tr(__x)))
      |                                              ^~~~
a.cc: In function 'int main()':
a.cc:19:18: error: no matching function for call to 'std::multiset<int, std::vector<int>, std::greater<int> >::insert(__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
   19 |         MS.insert(A[i]);
      |         ~~~~~~~~~^~~~~~
/usr/include/c++/14/bits/stl_multiset.h:553:9: note: candidate: 'template<class _InputIterator> void std::multiset<_Key, _Compare, _Alloc>::insert(_InputIterator, _InputIterator) [with _Key = int; _Compare = std::vector<int>; _Alloc = std::greater<int>]'
  553 |         insert(_InputIterator __first, _InputIterator __last)
      |         ^~~~~~
/usr/include/c++/14/bits/stl_multiset.h:553:9: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_multiset.h:565:7: note: candidate: 'void std::multiset<_Key, _Compare, _Alloc>::insert(std::initializer_list<_Tp>) [with _Key = int; _Compare = std::vector<int>; _Alloc = std::greater<int>]'
  565 |       insert(initializer_list<value_type> __l)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_multiset.h:565:43: note:   no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} to 'std::initializer_list<int>'
  565 |       insert(initializer_list<value_type> __l)
      |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
a.cc:31:24: error: 'class std::multiset<int, std::vector<int>, std::greater<int> >' has no member named 'upper_bound'
   31 |             auto it=MS.upper_bound(B[i]);
      |                        ^~~~~~~~~~~
a.cc:32:23: error: 'class std::multiset<int, std::vector<int>, std::greater<int> >' has no member named 'end'
   32 |             if(it==MS.end()){
      |                       ^~~
a.cc:35:20: error: 'class std::multiset<int, std::vector<int>, std::greater<int> >' has no member named 'erase'
   35 |                 MS.erase(it);
      |                    ^~~~~