68. LazyTreap in std.lazy and flat SparseTable storage (2026-11-21)
- Add
LazyTreap<T, F>tostd.lazy(no new module, no compiler privilege). Arena-backed randomized treap over a contiguous node arena with subtree-size-aware lazy tag pushdown (apply(v, left_sz, f),compose(new_f, old_f), optionalsplit(f, left_sz), optionalbefore(x, y)), supporting both value-ordered insertion (insert, for slope-trick / priority-with-lazy-updates) and 0-based implicit sequence operations (push,insert_at,apply_range,get), plusapply_all,take(k), andto_list. Stores pending tags as?FsoFneeds neitheridnorEq, and lowers all operation closures statically (0 std::function). Adopted byproto/ports/ecnerwala/cf2084g2.cp(895 -> 359 tokens, 1.05x of dream; 0.90x time vs C++ original onn = 500_000). Reverse: removeLazyTreapfromstdlib/lazy.cpand restore the hand-rolled treap incf2084g2.cp. - Flatten
SparseTablestorage instdlib/sparse.cp. Store allbit_width(n)levels in a single flatList<T>withunchecked:indexing in build andfold, matchingDisjointSparseTableand eliminating nestedstd::vectorheap allocations. Reverse: restorerows: List<List<T>>instdlib/sparse.cp.