func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long mod = 1e9 + 7;   template <typename T, typename U>   ostream &operator<<(ostream &os, pair<T, U> p) {     os <<  (  << p.first <<  ,  << p.second <<  ) ;     return os;   }   template <typename T, typename U>   istream &operator>>(istream &is, pair<T, U> &p) {     is >> p.first >> p.second;     return is;   }   template <typename T>   istream &operator>>(istream &is, vector<T> &v) {     for (int i = 0; i < int(v.size()); ++i) is >> v[i];     return is;   }   template <typename T>   ostream &operator<<(ostream &os, vector<T> v) {     for (T x : v) os << x <<    ;     return os;   }   template <typename T>   ostream &operator<<(ostream &os, set<T> s) {     for (T x : s) os << x <<    ;     return os;   }   template <typename T>   ostream &operator<<(ostream &os, multiset<T> s) {     for (T x : s) os << x <<    ;     return os;   }   template <typename T, typename U>   ostream &operator<<(ostream &os, map<T, U> m) {     for (auto x : m) os << x <<    ;     return os;   }   template <typename T>   T sum(vector<T> v) {     T summ = 0;     for (int i = 0; i < int(int(v.size())); ++i) summ += v[i];     return summ;   }   long long mod_pow(long long a, long long b) {     long long sol = 1;     while (b) {       if (b & 1) {         sol = (sol * a) % mod;         b--;       } else {         a = (a * a) % mod;         b /= 2;       }     }     return sol;   }   long long rem(long long a, long long b) {     long long res = a % b;     return res < 0 ? res + b : res;   }   void test_case() {     int n;     cin >> n;     vector<pair<char, int>> ops(2 * n);     for (int i = 0; i < int(2 * n); ++i) {       char type;       cin >> type;       if (type ==  + ) {         ops[i].first =  + ;       } else {         ops[i].first =  - ;         cin >> ops[i].second;       }     }     stack<int> bought;     reverse(ops.begin(), ops.end());     vector<int> answer;     for (auto p : ops) {       char type = p.first;       int buy = p.second;       if (type ==  - ) {         if (!bought.empty() && buy > bought.top()) {           cout <<  NO n ;           return;         }         bought.push(buy);       } else {         if (bought.empty()) {           cout <<  NO n ;           return;         }         answer.push_back(bought.top());         bought.pop();       }     }     reverse(answer.begin(), answer.end());     cout <<  YES n  << answer <<   n ;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     int t = 1;     for (int i = 0; i < int(t); ++i) test_case();     return 0;   }   