2*x=a+k

For what minimum value of a , x<=a ?

k is constant (can be either even or odd).

x , a , k >= 0

my code:

```
#include <bits/stdc++.h>
#define ll int
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll t;
cin>>t;
while(t--)
{
ll a,k;
cin>>a>>k;
if(a==0 and k%2==0){
cout<<k<<"\n";
continue;
}
if((a+k)%2==0 and (a+k)/2<=a)
{
cout<<a<<"\n";
continue;
}
ll s=a+k;
if(s%2!=0)
s++ ,a++;
else
s+=2,a+=2;
while((s/2)>a)
{
if(s%2!=0)
s++ ,a++;
else
s+=2 ,a+=2;
}
cout<<a<<"\n";
}
}
```