#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <climits>
#include <cmath>
#include <complex>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <cstdint>
using namespace std;
typedef long long ll;
#define MP make_pair
#define PB push_back
#define inf 1000000007
#define mod 1000000007
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)

int main(){
    int n;
    cin >> n;
    set<int> st;
    bool flag = 0;
    int c = 1;
    rep(i,n){
        int a;
        cin >> a;
        if(flag){
            cout << "No" << endl;
            continue;
        }
        if(a==c-1){
            if(st.lower_bound(a+1)==st.end()){
                cout << "Yes" << endl;
                flag = 1;
            }else{
                cout << "No" << endl;
            }
        }else if(a < c){
            cout << "No"<< endl;
        }else{
            cout << "Yes" << endl;
            int k= -1;
            for(int i=a;i>=1;i--){
                if(st.find(i)!=st.end()){
                    st.erase(i);
                    if(i==1)flag = 1;
                }else{
                    k = i;
                    st.insert(i);
                    break;
                }
            }
            if(k==c){
                while(st.count(c)){
                    c++;
                }
            }
        }            
    }    
    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 <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <climits>
#include <cmath>
#include <complex>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <cstdint>
using namespace std;
typedef long long ll;
#define MP make_pair
#define PB push_back
#define inf 1000000007
#define mod 1000000007
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)

int main(){
    int n;
    cin >> n;
    set<int> st;
    bool flag = 0;
    int c = 1;
    rep(i,n){
        int a;
        cin >> a;
        if(flag){
            cout << "No" << endl;
            continue;
        }
        if(a==c-1){
            if(st.lower_bound(a+1)==st.end()){
                cout << "Yes" << endl;
                flag = 1;
            }else{
                cout << "No" << endl;
            }
        }else if(a < c){
            cout << "No"<< endl;
        }else{
            cout << "Yes" << endl;
            int k= -1;
            for(int i=a;i>=1;i--){
                if(st.find(i)!=st.end()){
                    st.erase(i);
                    if(i==1)flag = 1;
                }else{
                    k = i;
                    st.insert(i);
                    break;
                }
            }
            if(k==c){
                while(st.count(c)){
                    c++;
                }
            }
        }            
    }    
    return 0;
}

```