#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())


#define MAXN 500000

bitset<MAXN + 1 + 1> b;
bool full[MAXN + 1 + 1];
int lowest = -1;


bool ok(int depth) {
	if (b[0])return false;
	return depth > MAXN || !full[depth] || depth >= lowest;
}

void add(int depth) {
	lowest = max(lowest, depth);
	if (depth >= MAXN)return;
	while (1) {
		if (b[depth]) {
			b.reset(depth--);
		}
		else {
			b.set(depth);
			break;
		}
	}
	if (lowest <= MAXN && !b[lowest])lowest = depth;
	if (depth == 0)return;
	while (full[depth-1] && !full[depth] && b[depth]) {
		full[depth++] = true;
	}
}



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

	full[0] = true;
	int n;
	cin >> n;
	rep(i,n) {
		int x;
		cin >> x;
		if (ok(x)) {
			add(x);
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
	}
	
	return 0;
}
### Prompt

Please formulate a CPP solution to the following problem:

Example

Input

6
2
3
1
1
4
2


Output

Yes
Yes
Yes
No
Yes
No

### Response

```cpp
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())


#define MAXN 500000

bitset<MAXN + 1 + 1> b;
bool full[MAXN + 1 + 1];
int lowest = -1;


bool ok(int depth) {
	if (b[0])return false;
	return depth > MAXN || !full[depth] || depth >= lowest;
}

void add(int depth) {
	lowest = max(lowest, depth);
	if (depth >= MAXN)return;
	while (1) {
		if (b[depth]) {
			b.reset(depth--);
		}
		else {
			b.set(depth);
			break;
		}
	}
	if (lowest <= MAXN && !b[lowest])lowest = depth;
	if (depth == 0)return;
	while (full[depth-1] && !full[depth] && b[depth]) {
		full[depth++] = true;
	}
}



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

	full[0] = true;
	int n;
	cin >> n;
	rep(i,n) {
		int x;
		cin >> x;
		if (ok(x)) {
			add(x);
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
	}
	
	return 0;
}
```