#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
using namespace std;
map<int,char> e;
void read(int& x){
    x=0;
    int y=1;
    char ch=getchar();
    while (ch<'0'||ch>'9'){
        if (ch=='-') y=-1;
        ch=getchar();
    }
    while (ch>='0'&&ch<='9'){
        x=x*10+ch-'0';
        ch=getchar();
    }
    x=x*y;
}
int main(){
	int x,i,n,now=1,cnt=0;
	read(n);
	for (i=1;i<=n;++i){
		read(x);
		if (x<now){
			printf("No\n");
			continue;
		}
		printf("Yes\n");
		while (e[x]>0&&x>0){
			e[x]=0;
			--cnt;
			--x;
		}
		++cnt;
		e[x]=1;
		while (e[now]>0&&now<=500010){
			++now;
		}
		now=min(now,cnt);
		if (!x) now=1e9;
	}
	return 0;
}
### Prompt

Please create a solution in Cpp to the following problem:

Example

Input

6
2
3
1
1
4
2


Output

Yes
Yes
Yes
No
Yes
No

### Response

```cpp
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
using namespace std;
map<int,char> e;
void read(int& x){
    x=0;
    int y=1;
    char ch=getchar();
    while (ch<'0'||ch>'9'){
        if (ch=='-') y=-1;
        ch=getchar();
    }
    while (ch>='0'&&ch<='9'){
        x=x*10+ch-'0';
        ch=getchar();
    }
    x=x*y;
}
int main(){
	int x,i,n,now=1,cnt=0;
	read(n);
	for (i=1;i<=n;++i){
		read(x);
		if (x<now){
			printf("No\n");
			continue;
		}
		printf("Yes\n");
		while (e[x]>0&&x>0){
			e[x]=0;
			--cnt;
			--x;
		}
		++cnt;
		e[x]=1;
		while (e[now]>0&&now<=500010){
			++now;
		}
		now=min(now,cnt);
		if (!x) now=1e9;
	}
	return 0;
}
```