// C++11 #include #include #include #include #include #include #include "bits/stdc++.h" #include #include #include #include using namespace std; inline long long GetTSC() { long long lo, hi; asm volatile ("rdtsc": "=a"(lo), "=d"(hi)); return lo + (hi << 32); } inline double GetSeconds() { return GetTSC() / 2.8e9; } struct XorShift { uint64_t x = 88172645463325252ULL; XorShift() {} void setSeed(uint64_t seed) { x = seed; } uint64_t next() { x ^= x << 13; x ^= x >> 7; x ^= x << 17; return x; } int nextInt(int n) { uint64_t upper = 0xFFFFFFFFFFFFFFFFULL / n * n; uint64_t v = next(); while (v >= upper) { v = next(); } return v % n; } double nextDouble() { uint64_t v = next() >> 11; // 53bit return (double)v / (1ULL << 53); } }; const double TO = 9.9; const double eps = 1e-7; const double inf = 1e7; const int N = 10000; char S[N]; int R[N]; const int CLICK = 1; const int FM = 5; const string FS[FM] = {"hand", "lily", "factory", "casino", "grimoire"}; const int FP[FM] = {1, 10, 120, 2000, 25000}; const int FB[FM] = {150, (int)2e3, (int)3e4, (int)6e5, (int)1e7}; const int FA[FM] = { 15, (int)2e4, (int)3e5, (int)6e6, (int)1e8}; const int BUY = 2; const int SELL = BUY + FM; const int REF = BUY + FM * 2; double starttime, gt; int tt,ctt; XorShift xs; void init(){ int n; scanf("%d%s", &n, S); } long calc_score(){ long r = 0; return r; } void solve(){ long c = 0; int bcount[FM] = {1, 0, 0, 0, 0}; int acount[FM] = {0, 0, 0, 0, 0}; long bcost[FM]; long acost[FM]; for(int i=0; i=0; i--){ if(acost[i] <= c){ tr = REF + i; c -= acost[i]; acount[i]++; acost[i] *= 10; break; } if(bcost[i] <= c){ tr = BUY + i; c -= bcost[i]; bcount[i]++; bcost[i] += bcost[i] / 5 + (bcost[i] % 5 ? 1 : 0); break; } } } R[t] = tr; if(tr == CLICK){ c += bcount[0] * pow(2, acount[0]); } for(int i=1; i= BUY && ri < BUY + FM){ cout << "buy " << FS[ri - BUY] << endl; }else if(ri >= REF && ri < REF + FM){ cout << "reinforce " << FS[ri - REF] << endl; }else if(ri >= SELL && ri < SELL + FM){ cout << "sell " << FS[ri - SELL] << endl; } scanf("%s", s); } } int main() { srand((unsigned) time(NULL)); xs.setSeed(rand() % 65536 || 65537); double mainstart = GetSeconds(); cerr << setprecision(10); init(); cerr << "init_time: " << GetSeconds() - mainstart << endl; solve(); output(); cerr << "main_time: " << GetSeconds() - mainstart << endl; return 0; }