| refactoring + SegmentTree