Approach hintTry it first, then revealHide
Since x is at most 10^12, the smaller cube root is at most 10^4. Fix a, then binary search for an integer b with b^3 = x - a^3; avoid floating-point cbrt, which can be off by one.
Since x is at most 10^12, the smaller cube root is at most 10^4. Fix a, then binary search for an integer b with b^3 = x - a^3; avoid floating-point cbrt, which can be off by one.