add segment tree code