/*
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 1773 Accepted Submission(s): 1060
*/
#include<iostream>
#include<cmath>
int main()
{
using namespace std;
unsigned long long result;
unsigned short n,count,number;
cin>>n;
cin.get();
while(n--)
{
cin>>count>>number;
cout<<(unsigned long long )pow(2,count-number)<<endl;
}
return 0;
}
/*
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
int main()
{
int T,i,j;
long long n;
int N,K;
scanf("%d",&T);
for(i=0;i<T;i++)
{
scanf("%d",&N);
scanf("%d",&K);
printf("%I64d\n",n=pow(2,N-K));
}
return 0;
}
*/