题目
UKE
#include <bits/stdc++.h>
using namespace std;
#define _ " "
#define endl "\n"
#define int long long
#define IOS ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
vector<int> a;
signed main()
{
IOS;
for(int i=0;i<60;i++)
{
for(int j=i+1;j<60;j++)
{
for(int k=j+1;k<60;k++)
{
int x = (1ll<<i)+(1ll<<j)+(1ll<<k);
a.push_back(x);
}
}
}
sort(a.begin(),a.end());
int q;
cin>>q;
while(q--)
{
int x;
cin>>x;
if(x<=6) cout<<-1;
else cout<<*prev(upper_bound(a.begin(),a.end(),x));
cout<<endl;
}
return 0;
}