Find Square Root Using Binary Search
Compute the integer square root of a non-negative number using binary search.
Input format
A single non-negative integer X (X ≤ 10^12).
Output format
Print the integer square root of X — the largest integer r with r·r ≤ X.
Constraints
- Values fit in a 64-bit signed integer
- Trailing whitespace and a trailing newline are ignored by the judge
Read from stdin, write to stdout. Sample cases below show the exact format.
Sample cases
Example 1
Input
25Expected output
5Example 2
Input
27Expected output
5