#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using namespace __gnu_pbds; #define all(x) (x).begin(), (x).end() #define pb push_back #define eb emplace_back #define xx first #define yy second #define sz(x) (int)(x).size() #define gc getchar #define IO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0) #define mp make_pair #ifndef ONLINE_JUDGE # define LOG(x) (cerr << #x << " = " << (x) << endl) #else # define LOG(x) ((void)0) #endif using ll = long long; using ull = unsigned long long ; using ld = long double ; using str = string; using ordered_set=tree, null_type, less>, rb_tree_tag, tree_order_statistics_node_update>; const double PI=acos(-1); const ll INF = 1LL<<62; const ll MINF = -(1LL<<62); template T getint() { T val=0; char c; bool neg=false; while((c=gc()) && !(c>='0' && c<='9')) { neg|=c=='-'; } do { val=(val*10)+c-'0'; } while((c=gc()) && (c>='0' && c<='9')); return val*(neg?-1:1); } //mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); uniform_int_distribution(0, n-1)(rng) vector> cut; vector> harvest; ll when; void gen(ll a, ll x, ll y) { ll atlo=a+1; ll X=x, Y=y+atlo-1; for(ll i=atlo;i>=1;--i) { for(ll j=0;j ends={x+atlo-1, y+atlo-1}; ll c=atlo; while(c-1>n; if(n==0) { cut={{0,0,0}}; harvest={{0,0}}; when=1; }else { when=63-__builtin_clzll(n); for(ll i=0;i<=60;++i) { if((1LL<