func_code_string: #include <bits/stdc++.h>   using namespace std;   int it[1000100 * 5], a[1000100];   char s[1000100];   void incIT(int node, int l, int r, int pos, int k) {     if (pos < l || pos > r) return;     if (l == r) {       it[node] += k;       return;     }     incIT(node * 2, l, (l + r) / 2, pos, k);     incIT(node * 2 + 1, (l + r) / 2 + 1, r, pos, k);     it[node] = it[node * 2] + it[node * 2 + 1];   }   int findAndDec(int node, int l, int r, int pos, int k) {     if (l == r) {       it[node] -= k;       return l;     }     int res = 0;     if (it[node * 2] >= pos)       res = findAndDec(node * 2, l, (l + r) / 2, pos, k);     else       res = findAndDec(node * 2 + 1, (l + r) / 2 + 1, r, pos - it[node * 2], k);     it[node] = it[node * 2] + it[node * 2 + 1];     return res;   }   int main() {     cin.sync_with_stdio(false);     int n, m;     cin >> n >> m;     for (int i = 0; i < m; ++i) cin >> a[i];     int cnt = 0;     for (int i = 0; i < n; ++i) {       int x;       cin >> x;       if (x == -1) {         int mm = upper_bound(a, a + m, it[1]) - a;         for (int j = mm - 1; j >= 0; --j) findAndDec(1, 1, n, a[j], 1);       } else {         s[++cnt] =  0  + x;         incIT(1, 1, n, cnt, 1);       }     }     int len = 0;     while (it[1] > 0) {       int pos = findAndDec(1, 1, n, 1, 1);       s[len++] = s[pos];     }     s[len] =   0 ;     if (len == 0)       cout <<  Poor stack!  << endl;     else       cout << s << endl;     return 0;   }   