Given a stream of integers, design a data structure that can insert an incoming value in the stream and query_sum(lo, hi) which queries the sum of all values in the data structure between lo and hi inclusive. Note that lo and hi here correspond to the bounds on the values.
Is there a way to do both operations in O(log n) time?