#include<bits/stdc++.h>
using namespace std;
int main(){
int t;
scanf("%d",&t);
long long x,y;
for(int i = 0; i < t; i++){
scanf("%lld%lld",&x,&y);
if(x < 2*y || (y & (x - 2 * y))) printf("-1\n");
else printf("%lld\n",x - 2 * y);
}
}
牛客小白月赛28 D
最新推荐文章于 2021-11-06 22:04:24 发布