#include <bits/stdc++.h>
using namespace std;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef pair<LL, LL> PLL;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

void pl(set<int>& s, int i, int& lb){
  while(true){
	if(!s.count(i)){
	  s.insert(i);
	  break;
	}
	s.erase(i);
	--i;
  }
  if(SZ(s) == 1 && s.count(0))
	lb = 1e9+10;
  else
	while(s.count(lb)) ++lb;
}

int main(){
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  int N; cin >> N;
  int lb = 1;
  set<int> xs;
  REP(i,N){
	int x; cin >> x;
	if(x < lb-1 || (x == lb-1 && SZ(xs) != lb-1))
	  cout << "No" << endl;
	else{
	  cout << "Yes" << endl;
	  pl(xs,x,lb);
	}
  }
  
  return 0;
}
### Prompt

Please provide a cpp coded solution to the problem described below:

Example

Input

6
2
3
1
1
4
2


Output

Yes
Yes
Yes
No
Yes
No

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef pair<LL, LL> PLL;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

void pl(set<int>& s, int i, int& lb){
  while(true){
	if(!s.count(i)){
	  s.insert(i);
	  break;
	}
	s.erase(i);
	--i;
  }
  if(SZ(s) == 1 && s.count(0))
	lb = 1e9+10;
  else
	while(s.count(lb)) ++lb;
}

int main(){
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  int N; cin >> N;
  int lb = 1;
  set<int> xs;
  REP(i,N){
	int x; cin >> x;
	if(x < lb-1 || (x == lb-1 && SZ(xs) != lb-1))
	  cout << "No" << endl;
	else{
	  cout << "Yes" << endl;
	  pl(xs,x,lb);
	}
  }
  
  return 0;
}
```