func_code_string: #include <bits/stdc++.h>   #pragma GCC optimize( Ofast )   #pragma GCC optimize( unroll-loops )   #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native )   using namespace std;   using ll = long long;   using ull = unsigned long long;   using db = double;   using ld = long double;   template <typename T>   using V = vector<T>;   template <typename T>   using VV = vector<vector<T>>;   constexpr ll mod = 1000000007;   constexpr ll INF = 1000000099;   constexpr ll LINF = (ll)(1e18 + 99);   const ld PI = acos((ld)-1);   const vector<ll> dx = {-1, 1, 0, 0}, dy = {0, 0, -1, 1};   template <typename T, typename U>   inline bool chmin(T& t, const U& u) {     if (t > u) {       t = u;       return 1;     }     return 0;   }   template <typename T, typename U>   inline bool chmax(T& t, const U& u) {     if (t < u) {       t = u;       return 1;     }     return 0;   }   template <typename T>   inline T gcd(T a, T b) {     return b ? gcd(b, a % b) : a;   }   inline void yes() { cout <<  YES  <<   n ; }   inline void no() { cout <<  NO  <<   n ; }   template <typename T, typename Y>   inline T mpow(T a, Y n) {     T res = 1;     for (; n; n >>= 1) {       if (n & 1) res = res * a;       a = a * a;     }     return res;   }   template <typename T>   V<T> prefix_sum(const V<T>& v) {     int n = v.size();     V<T> ret(n + 1);     for (ll i = 0; i < (ll)(n); ++i) ret[i + 1] = ret[i] + v[i];     return ret;   }   template <typename T>   istream& operator>>(istream& is, vector<T>& vec) {     for (auto&& x : vec) is >> x;     return is;   }   template <typename T, typename Y>   ostream& operator<<(ostream& os, const pair<T, Y>& p) {     return os <<  {  << p.first <<  ,  << p.second <<  } ;   }   template <typename T>   ostream& operator<<(ostream& os, const V<T>& v) {     os <<  { ;     for (auto e : v) os << e <<  , ;     return os <<  } ;   }   template <typename... Args>   void debug(Args&... args) {     for (auto const& x : {args...}) {       cerr << x <<    ;     }     cerr <<   n ;   }   template <typename T, typename Y, T(F_up)(T, T), Y(F_gt)(T, Y)>   struct BUPSegTree {     int sz, ex;     T ini_d;     vector<T> dat;     BUPSegTree(vector<T> init, T _ini_d) : ini_d(_ini_d) {       int n = (int)(init.size());       ex = 1;       while ((1 << ex) < n) ex++;       sz = (1 << ex);       dat = vector<T>(2 * sz, ini_d);       for (int i = 0; i < n; ++i) dat[sz + i] = init[i];       for (int i = sz - 1; i > 0; --i) dat[i] = F_up(dat[2 * i], dat[2 * i + 1]);     }     void up_q(int p, T x) {       for (dat[p += sz] = x; p > 1; p >>= 1) {         dat[p >> 1] = F_up(dat[p], dat[p ^ 1]);       }     }     T get_q(int l, int r) {       T res = ini_d;       for (l += sz, r += sz; l < r; l >>= 1, r >>= 1) {         if (l & 1) {           res = F_gt(res, dat[l]);           ++l;         }         if (r & 1) {           --r;           res = F_gt(res, dat[r]);         }       }       return res;     }   };   ll my_max(ll a, ll b) { return max(a, b); }   signed main() {     cin.tie(0);     cerr.tie(0);     ios::sync_with_stdio(false);     cout << fixed << setprecision(20);     ll n;     cin >> n;     set<int> addse;     V<int> buyt(n);     V<int> addt(n);     BUPSegTree<ll, ll, my_max, my_max> buymx(V<ll>(n * 2, -1), -1);     for (ll i = 0; i < (ll)(n * 2); ++i) {       char c;       cin >> c;       if (c ==  + )         addse.insert(i);       else {         int x;         cin >> x;         --x;         buyt[x] = i;         buymx.up_q(i, x);       }     }     for (ll i = 0; i < (ll)(n); ++i) {       ll b = buyt[i];       auto itr = addse.lower_bound(b);       if (itr == addse.begin()) {         no();         return 0;       }       --itr;       ll a = *itr;       if (buymx.get_q(a, b) > i) {         no();         return 0;       }       addt[i] = a;       addse.erase(itr);     }     yes();     V<pair<int, int>> ans(0);     for (ll i = 0; i < (ll)(n); ++i) ans.emplace_back(addt[i], i);     sort((ans).begin(), (ans).end());     for (ll i = 0; i < (ll)(n); ++i) cout << ans[i].second + 1 <<    ;     cout <<   n ;   }   