Q: how can i get index of min element from segment tree by doing following operations? operation1: for every query add a value in the range[l, r] in an array
operation2: find the index of the minimum value in the range;
input will be like this 
number_of_elements number_of_queries
element1,
elements2,
. 
.
.
.  
last_element
query-1 (query format: l r add_value)
query-2
query-3
.
.
.
.
last_query

Note: after every query, the arr should be reset to default values
ex: [1,2,3,4,5]
query 2 4 5 (l,r, add value)
[1,2,3,4,5] -> [1 2 8 9 10]
ans - 2 (index of element 8)
before the next query arr should be reset to default
[1 2 8 9 10] -> [1 2 3 4 5]
then proceed to next query
below is the link to my implementation of the segment tree 
https://ideone.com/kI0Tbi
please help me with this problem, 
