I have an array of n elements unsorted,now a query q comes in a form of l,r,t where l<=r are indices of array and we have to find sum from l to r in a subarray where each element must be less than or equal to t.
n<=10^5
q<=10^5
ai(element of an array)<=10^5
t<=10^5
what is the most efficient data structure to solve this problem ?