segtree_Point_Maxvalt; ll@q; t.malloc(q,1); ll n=0; rep(q){ ll@a,@x; if(a==1) t.change(n++,x); else wt(t.getMaxVal(n-x,n))s; }