//https://www.hackerrank.com/challenges/and-product
import java.io.*;

public class Solution {
  public static void main(String[] args) throws IOException {
    StringBuffer sb = new StringBuffer();
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

    //For each test
    for(short T = Short.parseShort(br.readLine()); T > 0; --T){

      //Get input
      String[] line = br.readLine().split(" ");
      final long A = Long.parseLong(line[0]);
      final long B = Long.parseLong(line[1]);
      
      //Get output
      long C = B - A;
      for(long t = C; (t = C & (C-1)) > 0; C = t){}
      C = A & B & -(C << 1);
      
      //Print output
      sb.append(C).append("\n");
    }
    System.out.print(sb);
  }
}

@@ -270,16 +270,20 @@
 m.in));%0A
+    
 %0A    //F
@@ -359,16 +359,22 @@
 ; --T)%7B%0A
+      
 %0A      /
@@ -569,13 +569,10 @@
 C = 
-B - A
+1L
 ;%0A  
@@ -588,41 +588,35 @@
 ong 
-t = C; (t = C & (C-1)) %3E 0; C = t
+D = B - A; C %3C= D; C %3C%3C= 1L
 )%7B%7D%0A
@@ -638,16 +638,9 @@
  & -
-(C %3C%3C 1)
+C
 ;%0A  

Update and-product.java