#include using namespace std; #define int long long std::ostream &operator<<(std::ostream &dest, __int128_t value) { std::ostream::sentry s(dest); if (s) { __uint128_t tmp = value < 0 ? -value : value; char buffer[128]; char *d = std::end(buffer); do { --d; *d = "0123456789"[tmp % 10]; tmp /= 10; } while (tmp != 0); if (value < 0) { --d; *d = '-'; } int len = std::end(buffer) - d; if (dest.rdbuf()->sputn(d, len) != len) { dest.setstate(std::ios_base::badbit); } } return dest; } using Int = __int128; Int sqrt(Int A){ Int L = 0, R = LLONG_MAX; while(L+1>a>>b>>c; A=a;B=b;C=c; Int P=(A-sqrt(A*A-3*B))/3,Q=(A+sqrt(A*A-3*B))/3; { Int L=INT_MIN,R=-Q; while(calc(L-1)>calc(L)) L--; while(calc(R)>calc(R+1)) R++; while(calc(L)>calc(L+1)) L++; while(calc(R-1)>calc(R)) R--; while(L+1=0) L=M; else R=M; } cout<calc(L)) L--; while(calc(R)>calc(R+1)) R++; while(calc(L)>calc(L+1)) L++; while(calc(R-1)>calc(R)) R--; //cout<