D. Equalization
bitmasks; brute force; dp; graphs; math
You are given two non-negative integers \(x\) and \(y\).You can perform the following operation any number of times (possibly zero): choose a positive integer \(k\) and divide either \(x\) or \(y\) by \(2^k\) rounding down. The cost of this operation is \(2^k\). However, there is an additional constraint: you cannot select the same value of \(k\) more than once.Your task is to calculate the minimum possible cost in order to make \(x\) equal to \(y\).
The first line contains a single integer \(t\) (\(1 \le t \le 10^5\)) — the number of test cases.The only line of each test case contains two integers \(x\) and \(y\) (\(0 \le x, y \le 10^{17}\)).
For each test case, print a single integer — the minimum possible cost in order to make \(x\) equal to \(y\).
In the first example, you can proceed as follows: choose \(k=1\) and divide \(y\) by \(2\). After that, \(x\) and \(y\) are equal to \(0\).In the second example, you can proceed as follows: choose \(k=2\) and divide \(x\) by \(4\); choose \(k=1\) and divide \(y\) by \(2\). After that, \(x\) and \(y\) are equal to \(1\).In the third example, numbers already are equal.