Given an array A consist of N integers. (N <= 10^5). There are Q (Q <= 10^5) queries of two types:
1 x y: Increase x smallest elements, each by 1 which satisfy the following condition: all elements greater than or equal to y. (1 <= x <= N, 0 <= y <= 10^9).
2 l r: Count the number of elements in array A have value in range [l..r]. (1 <= l <= r <= 10^9).
I haven't found an approach to process queries type 1 yet. Could someone help me? Thanks.