Hi all of you. here is some very common algorithms in the form of class. writing those in contests was waste of time so you just need copy and paste the class (modify as per your need) ans use it.
Segment Tree and Lazy Propagation
Tree (dfs, bfs, lca, diameter)
HLD (heavy light decomposition with Segment Tree and Lazy Propagation