#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
typedef pair<int,int> pii;

int main(){
  int n;
  cin >> n;

  vector<int> cnt(n+10, 0);
  int ones = 0, border = 0;
  rep(i,n){
    int x;
    cin >> x;
    if(x >= n+10){
      ones++;
      cout << "Yes" << endl;
    }else{
      if( cnt[0] or (x <= border and ones-x > 0) ){
	cout << "No" << endl;
      }else{
	cout << "Yes" << endl;
	cnt[x]++;
	while(cnt[x] == 2){
	  cnt[x] = 0; ones--;
	  x--; cnt[x]++;
	}
	ones++;
	//cout << x << " " << border << endl;
	while(cnt[border+1]) border++;
      }
    }
  }
}
### 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<vector>
#include<algorithm>
#include<set>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
typedef pair<int,int> pii;

int main(){
  int n;
  cin >> n;

  vector<int> cnt(n+10, 0);
  int ones = 0, border = 0;
  rep(i,n){
    int x;
    cin >> x;
    if(x >= n+10){
      ones++;
      cout << "Yes" << endl;
    }else{
      if( cnt[0] or (x <= border and ones-x > 0) ){
	cout << "No" << endl;
      }else{
	cout << "Yes" << endl;
	cnt[x]++;
	while(cnt[x] == 2){
	  cnt[x] = 0; ones--;
	  x--; cnt[x]++;
	}
	ones++;
	//cout << x << " " << border << endl;
	while(cnt[border+1]) border++;
      }
    }
  }
}
```