Help me in solving IRSTXOR problem

My issue

My code

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

void solve(){
    long long c;
    cin>>c;
    long long d=0LL;
    while(pow(2,d)<c){
        d++;
    }
    long long a=0LL, b=0LL;
    bool change=true;
    for(long long i=d-1;i>=0;i--){
        if(i==d-1){
            a|=(1<<i);
        }
        else{ 
            if(c & (1<<i)){
                b|=(1<<i);
            }else{
                a|=(1<<i);
                b|=(1<<i);
            }
        }
    }
    cout<<a*b<<endl;
}

int main() {
	int t;
	cin>>t;
	while(t--){
	    solve();
	}
	return 0;
}

Problem Link: IRSTXOR Problem - CodeChef

@shivam108k
like the logic is quite simple just write C in Binary for intuition
ex for 10
1010 (in binary)
now we know we have 2^3 and 2^1 bit set and 2^2 and 2^0 and not set which is total 5;
now to maximize the product i’ll make (msd +5) * (sum of rest set bit+5)= (8+5)*(2+5)=91;