Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> VI;
 
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
const int mod=1e9+7;

int main(){
  int n;cin>>n;
  int n0=(1<<n);
  priority_queue<int> ideal;
  rep(i,n0){
    int tmp;cin>>tmp;
    ideal.push(tmp);
  }
  priority_queue<int> ans;
  ans.push(ideal.top());ideal.pop();
  rep(I,n){
    vector<int> children;
    while(ans.size()){
      int t=ans.top();ans.pop();
      children.push_back(t);
      if(ideal.top()>=t){
        cout<<"No"<<endl;exit(0);
      }
      children.push_back(ideal.top());
      ideal.pop();
    }
    rep(i,children.size())ans.push(children[i]);
  }
  cout<<"Yes"<<endl;
}
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> VI;
 
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
const int mod=1e9+7;

int main(){
  int n;cin>>n;
  int n0=(1<<n);
  priority_queue<int> ideal;
  rep(i,n0){
    int tmp;cin>>tmp;
    ideal.push(tmp);
  }
  priority_queue<int> ans;
  ans.push(ideal.top());ideal.pop();
  rep(I,n){
    vector<int> children;
    while(ans.size()){
      int t=ans.top();ans.pop();
      children.push_back(t);
      if(ideal.top()>=t){
        cout<<"No"<<endl;exit(0);
      }
      children.push_back(ideal.top());
      ideal.pop();
    }
    rep(i,children.size())ans.push(children[i]);
  }
  cout<<"Yes"<<endl;
}


Compiler output:
a.cc:47:24: error: redefinition of 'template<class T> bool chmax(T&, const T&)'
   47 | template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
      |                        ^~~~~
a.cc:7:24: note: 'template<class T> bool chmax(T&, const T&)' previously declared here
    7 | template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
      |                        ^~~~~
a.cc:48:24: error: redefinition of 'template<class T> bool chmin(T&, const T&)'
   48 | template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
      |                        ^~~~~
a.cc:8:24: note: 'template<class T> bool chmin(T&, const T&)' previously declared here
    8 | template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
      |                        ^~~~~
a.cc:54:11: error: redefinition of 'const int mod'
   54 | const int mod=1e9+7;
      |           ^~~
a.cc:14:11: note: 'const int mod' previously defined here
   14 | const int mod=1e9+7;
      |           ^~~
a.cc:56:5: error: redefinition of 'int main()'
   56 | int main(){
      |     ^~~~
a.cc:16:5: note: 'int main()' previously defined here
   16 | int main(){
      |     ^~~~