#include using namespace std; #define ALL(x) (x).begin(), (x).end() #define REP(i, n) for(ll i=0; i<(ll)(n); i++) int lob(const auto& v, auto x) { return lower_bound(ALL(v),x)-v.begin(); } bool chmax(auto& a, auto b) { return ab ? a=b, true : false; } using ll=long long; const int INF=1e9+10; const ll INFL=4e18; using VI=vector; using VVI=vector; using VL=vector; using VVL=vector; using PL=pair; using VP=vector; using WG=vector>>; #ifdef LOCAL #include "./debug.hpp" #else #define debug(...) #define print_line #endif /// @brief ビット演算 namespace Bit{ /// @brief 1であるビットの個数を返す int PopCount(int n) { return __builtin_popcount(n); } /// @brief 1であるビットの個数を返す int PopCount(ll n) { return __builtin_popcountll(n); } /// @brief popcountの偶奇を返す int Parity(int n) { return __builtin_parity(n); } /// @brief popcountの偶奇を返す int Parity(ll n) { return __builtin_parityll(n); } /// @brief 最上位ビットの位置を返す int TopBit(int n) { return n ? 31-__builtin_clz(n) : -1; } /// @brief 最上位ビットの位置を返す int TopBit(ll n) { return n ? 63-__builtin_clzll(n) : -1; } /// @brief 2進表現の長さを返す int BitLength(int n) { return n ? 32-__builtin_clz(n) : 1; } //// @brief 2進表現の長さを返す int BitLength(ll n) { return n ? 64-__builtin_clzll(n) : 1; } /// @brief 最下位ビットの位置を返す int LowBit(int n) { return n ? __builtin_ctz(n) : -1; } /// @brief 最下位ビットの位置を返す int LowBit(ll n) { return n ? __builtin_ctzll(n) : -1; } /// @brief 2のべき乗か否かを返す bool IsPowerOfTwo(int n) { return n && (n&-n)==n; } /// @brief 0~n-1 ビットを立てたビットマスクを返す ll Mask(int n) { return (1LL<>i&1); } /// @brief 整数 n の2進表現を返す /// @param len ビット数 /// @param rev 反転するか否か string ToBinary(ll n,int len=32,bool rev=false) { string ret; for(int i=0; i>N; VL B; for(int i=0; i<30; i++) if(Bit::HasBit(N,i)) B.push_back(i); if(B.size()==1) { cout<<-1<>T; while(T--) solve(); }