Help me in solving MAXX problem

My issue

include <bits/stdc++.h>
using namespace std;

int main() {
// your code goes here
int t;
cin>>t;
while(t–)
{
long long x;
cin>>x;
if(x==1)
{
cout<<(x+1)<<" “<<x+2<<endl;
continue;
}
if(x%2==1)
{
cout<<(x&(x-1))<<” “<<1<<endl;
}
else
{
if(x & (x - 1))
cout<<(x&(x-1))<<” “<<x-(x&(x-1))<<endl;
else
{
cout<<(x<<1ll)<<” "<<x<<endl;
}
}

}
return 0;

}
what is wrong here? why isn’t it working

My code

#include <bits/stdc++.h>
using namespace std;

int main() {
	// your code goes here
	int t;
	cin>>t;
	while(t--)
	{
	    long long x;
	    cin>>x;
	    if(x==1)
	    {
	        cout<<(x+1)<<" "<<x+2<<endl;
	        continue;
	    }
	    if(x%2==1)
	    {
	        cout<<(x&(x-1))<<" "<<1<<endl;
	    }
	    else
	    {
	        if(x & (x - 1))
	        cout<<(x&(x-1))<<" "<<x-(x&(x-1))<<endl;
	        else
	        {
	            cout<<(x<<1ll)<<" "<<x<<endl;
	        }
	    }
	    
	    
	}
	return 0;

}

Problem Link: XOR And Multiply Practice Coding Problem - CodeChef

@shadowcoder_72
your logic is not right
plzz refer my c++ code for better understanding of the logic

#include <bits/stdc++.h>
using namespace std;

int main() {
	// your code goes here
	int t;
	cin>>t;
	while(t--)
	{
	    long long int x;
	    cin>>x;
	    long long int a=x;
	    long long int lg=log2(x);
	    lg++;
	    long long int b=x<<lg;
	    b+=a;
	    cout<<a<<" "<<b<<endl;
	}
	return 0;
}