 # Direct-I intern

```Consider an infinite binary tree defined as follows.
for a node labelled v its left child will be labelled 2*v and its right child will be labelled 2*v+1. The root is labelled as 1.
You are given n ranges [a1, b1], [a2, b2], ..... [an, bn]. ai <= bi for all i.
Each range [ai,bi] denotes a set of all integers from ai to bi. For instance [5,9] represents the set {5,6,7,8,9}.
You are also given an integer T.
Let S be a set representing the union of all the given ranges.
You have to find the number of pairs (x,y) such that the lca(x,y) is T where x is any element from S and y is any element from S and x != y.
lca is the least common ancestor of the nodes labelled x and y. Refer http://en.wikipedia.org/wiki/Lowest_common_ancestorfor exact definition.
Input:
You are given two arrays A and B. (A[i], B[i]) denote a set represented by the range. If you select C language you will have two more variables A_len and B_len denoting the lengths of respective arrays.
You are given an integer T.
Ouput:
Write to stdout (print to the screen) the count of the pairs whose lca is T.
Constraints:
1 <= length(A) = length(```