#![allow(dead_code, unused_imports, unused_macros, non_snake_case)] use proconio::{ input, marker::{Bytes, Chars, Usize1}, }; fn main() { input! { n: i64 } println!("{}", sqrt_floor(n)); } pub fn sqrt_floor(x: i64) -> i64 { let c = (64 - x.leading_zeros() + 1) / 2; let mut v = if c < 32 { 1 << c } else { 3_037_000_499 }; while v * v > x { v = (v + x / v) / 2; } v }