Doubt in this offline query based general question

We have to handle Q queries on the array and in each query we are asked to find number of pairs {a,b} present at the moment in the array whose value are such that a<=x and b<=y for {x,y} given in the query.

Problem Link :-Codechef Bulbs

Please share the approach as I am not getting any tutorial for this problem

Please help . Thanks in advance.

@l_returns @tmwilliamlin @egor Can you explain this to me?

@mazumder7 please provide editorial or some hint to this question.

N*log(N)*log(N) ??
Segment/fenwick tree with list of values ( Bi ) at each node ?
Binary search for finding number of values given b in range 1 to a

Can you explain algorithm more clearly step by step thanks for your effort.