Regarding HORRIBLE-SPOJ

Implemented Segment tree for finding query and updation.
Getting TLE.How can I optimize to get AC?

HORRIBLE-SPOJ

My Code:

Lazy propagation… Google it … Lazy propagation is an effective way of range update range query with complexit(log n)