#include #include using namespace std; using ll = long long; int op(int lhs, int rhs){return max(lhs, rhs);} constexpr int e(){return -(1 << 30);} int main() { ios::sync_with_stdio(false); cin.tie(0); int Q; cin >> Q; atcoder::segtree seg(Q + 1); int cur = 0; while(Q--){ int cmd, x; cin >> cmd >> x; if(cmd == 1){ seg.set(cur, x); cur++; }else{ cout << seg.prod(max(0, cur - x), cur) << '\n'; } } }