#include<bits/stdc++.h>
using namespace std;
int main()
{
int t;cin>>t;
while(t–)
{
int n,k;cin>>n>>k;
int times=n;
int bit=log2(k)+1;
int l=pow(2,bit)-1,s=pow(2,(bit-1));
//cout<<l<<s<<endl;
if(n==1)cout<<k<<endl;
else{if(bit>1){
if(n%2==0){cout<<s<<" "<<s-1<<" ";times-=2;
while(times--)cout<<k<<" ";cout<<endl;
}
else{
cout<<s+1<<" "<<s-1<<" "<<"1"<<" ";times-=3;
while(times--)cout<<k<<" ";cout<<endl;
}
}
else{
while(times--)cout<<"1 ";cout<<endl;
}
}
}
}
may cookoff Best cake What is wrong with my code?