AtCoder Beginner Contest 077 - Around Square

Find the largest square number not exceeding N. Here, a square number is an integer that can be represented as the square of an integer.

-----Constraints-----
 - 1 \leq N \leq 10^9
 - N is an integer.

-----Input-----
Input is given from Standard Input in the following format:
N

-----Output-----
Print the largest square number not exceeding N.

-----Sample Input-----
10

-----Sample Output-----
9

10 is not square, but 9 = 3 × 3 is. Thus, we print 9.

Difficulty: EASY

Starter code:

Solutions:
n = int(input())
print(int(n ** 0.5) ** 2)


n = int(input())
sq = n ** 0.5 // 1
print(int(sq ** 2))


import sys
N = int(input())
if N == 1:
	print('1')
elif N == 2:
	print('1')
else:
	for i in range(N):
		if i ** 2 > N:
			print((i - 1) ** 2)
			return
		else:
			pass


import math
n = int(input())
print(int(math.sqrt(n)) * int(math.sqrt(n)))


X = int(input())
print(int(X ** 0.5) ** 2)


import math
N = int(input())
print(math.floor(N ** 0.5) ** 2)


n = int(input())
i = 1
while i * i <= n:
	i += 1
i = i - 1
print(i * i)


import math
n = int(input())
for i in range(10 ** 9):
	if math.sqrt(n) == int(math.sqrt(n)):
		print(n)
		break
	n -= 1


n = int(input())
ans = 0
for i in range(100001):
	if i ** 2 <= n:
		ans = i ** 2
print(ans)


import math
N = int(input())
n = math.floor(math.sqrt(N)) ** 2
print(n)


N = int(input())
print(int(N ** 0.5) ** 2)


a = int(input())
i = 0
while i ** 2 <= a:
	i = i + 1
print((i - 1) ** 2)


n = int(input())
print(int(n ** (1 / 2)) ** 2)


n = int(input())
for i in range(1, 10 ** 5):
	p = i ** 2
	if p > n:
		print((i - 1) ** 2)
		break


n = int(input())
import math
print(math.floor(n ** 0.5) ** 2)


from math import sqrt
n = int(input())
print(int(sqrt(n)) ** 2)


print(int((int(input()) ** 0.5 // 1) ** 2))


import math
N = int(math.sqrt(int(input())))
print(N * N)


import math
a = int(input())
b = math.sqrt(a)
n = math.ceil(b)
m = math.floor(b)
print(m ** 2)


N = int(input())
print(int((N ** (1 / 2) // 1) ** 2))


print(int((pow(int(input()), 1 / 2) // 1) ** 2))


N = int(input())
i = 1
while i ** 2 <= N:
	i = i + 1
print((i - 1) ** 2)


n = int(input())
x = int(n ** 0.5)
print(x * x)


x = int(input())
for i in range(10 ** 5):
	if i ** 2 > x:
		a = (i - 1) ** 2
		break
print(a)


N = int(input())
ans = 1
for i in range(N + 1):
	if i * i <= N:
		ans = i
	else:
		break
print(ans ** 2)


N = int(input())
while N ** 0.5 % 1:
	N -= 1
print(N)


n = int(input())
res = 1
for i in range(100000):
	if i ** 2 > n:
		break
	res = i * i
print(res)


import math
N = int(input())
for i in range(N):
	x = N - i
	if int(math.sqrt(x)) == math.sqrt(x):
		print(x)
		break


import math
n = int(input())
tmp = int(math.sqrt(n))
print(tmp ** 2)


n = int(input())
p = int(n ** 0.5)
a = 1
ans = 1
while a <= p:
	if a ** 2 <= n:
		ans = max(ans, a ** 2)
	a += 1
print(ans)


import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce
rr = lambda : sys.stdin.readline().rstrip()
rs = lambda : sys.stdin.readline().split()
ri = lambda : int(sys.stdin.readline())
rm = lambda : list(map(int, sys.stdin.readline().split()))
rl = lambda : list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10 ** 9 + 7
n = ri()
a = int(n ** 0.5)
print(a ** 2)


import math

def answer(n: int) -> int:
	return int(math.sqrt(n)) ** 2

def main():
	n = int(input())
	print(answer(n))

def __starting_point():
	main()
__starting_point()


n = int(input())
ans = 0
for i in range(1, 10 ** 5):
	if i ** 2 <= n:
		ans = i ** 2
print(ans)


N = int(input())
i = 1
if N == 1:
	print(i)
else:
	while i <= N:
		if i * i > N:
			print((i - 1) * (i - 1))
			break
		i += 1


N = int(input())
x = 1
while x ** 2 <= N:
	x += 1
x -= 1
print(x ** 2)


n = int(input())
ans = 1
for i in range(1, n + 1):
	if i * i > n:
		ans = (i - 1) ** 2
		break
print(ans)


import math
a = int(input())
print(math.floor(a ** 0.5) ** 2)


import math
a = int(input())
n = int(math.sqrt(a))
print(n ** 2)


import math
x = int(input())
y = math.sqrt(x)
z = y // 1
a = z ** 2
print(int(a))


import math
x = int(input())
y = int(math.sqrt(x))
print(y * y)


print(int(int(input()) ** (1 / 2)) ** 2)


def multiple(n):
	a = []
	for i in range(1, int(n ** 0.5) + 1):
		a.append(i * i)
	return a
n = int(input())
a = multiple(n)
ans = 10 ** 18
for i in a:
	if n - i < 0:
		continue
	ans = min(ans, abs(n - i))
print(n - ans)


A = int(input())
A = A ** 0.5
A = int(A)
A = A * A
print(A)


import math
print(int(math.sqrt(int(input()))) ** 2)


N = int(input())
ans = 1
for i in range(1, N):
	if i * i > N:
		break
	ans = max(ans, i * i)
print(ans)


import math
a = int(math.sqrt(int(input())) // 1)
print(a * a)


import math
n = int(input())
print(math.floor(n ** (1 / 2)) ** 2)


n = int(input())
i = 1
tmp = 1
while True:
	if i ** 2 <= n:
		tmp = i ** 2
	else:
		break
	i += 1
print(tmp)


N = int(input())
m = int(pow(N, 1 / 2))
print(m * m)


n = int(input())
c = 1
for i in range(10 ** 5):
	if i ** 2 <= n:
		c = i ** 2
	else:
		break
print(c)


n = int(input())
while n ** 0.5 % 1 != 0:
	n -= 1
print(n)


import math
N = int(input())
ans = 1
for i in range(1, math.floor(math.sqrt(N)) + 1):
	if i * i <= N:
		ans = i * i
print(ans)


N = int(input())
for i in range(1, N + 1):
	if i * i > N:
		print((i - 1) * (i - 1))
		return
print(1)


n = int(input())
ans = 0
max = int(n ** 0.5) + 1
for i in range(1, max, 1):
	tmp = i ** 2
	if tmp <= n:
		ans = tmp
print(ans)


from math import sqrt
n = int(input())
for i in range(1, int(sqrt(n)) + 1):
	if i ** 2 > n:
		print((i - 1) ** 2)
		break
else:
	print(i ** 2)


N = int(input())
n = 1
while n * n <= N:
	n += 1
print((n - 1) ** 2)


a = int(input())
a = int(a ** 0.5)
print(a ** 2)


a = int(input())
b = int(a ** 0.5)
print(b * b)


N = int(input())
for i in range(1, 10 ** 9):
	if i ** 2 == N:
		print(i ** 2)
		break
	elif i ** 2 > N:
		print((i - 1) ** 2)
		break


n = int(input())
m = int(n ** 0.5)
print(m * m)


import math
print(round(math.sqrt(int(input())) // 1) ** 2)


def main():
	N = int(input())
	a = 1
	i = 0
	prev = 0
	while a <= N:
		i += 1
		prev = a
		if a > N:
			break
		else:
			a = i * i
	print(prev)
main()


n = int(input())
for i in range(1, n + 2):
	if i * i > n:
		print((i - 1) * (i - 1))
		return


n = int(input())
while n > 0:
	tmp = n ** (1 / 2)
	if tmp == int(tmp):
		print(n)
		break
	n -= 1


import math
N = int(input())
print(math.floor(N ** (1 / 2)) ** 2)


i = input
print(int(int(i()) ** 0.5) ** 2)


import math
N = int(input())
c = int(math.sqrt(N))
print(c ** 2)


n = int(input())
ans = 1
loop = 3
for i in range(1, 100000):
	if i ** 2 <= n:
		ans = i ** 2
print(ans)


N = int(input())
print(int(pow(N, 0.5) // 1) ** 2)


n = int(input())
sqn = n ** 0.5 // 1
print(int(sqn ** 2))


import math
t = int(input())
a = int(math.sqrt(t))
print(a * a)


n = int(input())
for i in range(100000):
	if n >= (10 ** 5 - i) ** 2:
		print((10 ** 5 - i) ** 2)
		return


y = int(input())
p = pow(y, 0.5)
print(pow(int(p), 2))


N = int(input())
ans = 0
for i in range(1, 10 ** 5):
	n = i ** 2
	if n <= N:
		ans = n
	else:
		break
print(ans)


n = int(input())
for i in range(n, 0, -1):
	j = int(i ** 0.5)
	if int(j) ** 2 == i:
		break
print(i)


i = int(input())
i = int(i ** (1 / 2))
print(i ** 2)


N = int(input())
from math import sqrt, floor
for i in range(1, floor(sqrt(N)) + 2):
	if i ** 2 > N:
		print((i - 1) ** 2)


n = int(input())
a = int(n ** 0.5)
print(a * a)


from math import sqrt
n = int(input())
for i in range(int(sqrt(n) + 1)):
	if i ** 2 <= n:
		ans = i ** 2
print(ans)


n = int(input())
import math
print(pow(int(math.sqrt(n)), 2))


import math
ans = math.floor(int(input()) ** 0.5)
print(ans * ans)


import sys
from io import StringIO
import unittest
import math

class TestClass(unittest.TestCase):

	def assertIO(self, input, output):
		(stdout, stdin) = (sys.stdout, sys.stdin)
		(sys.stdout, sys.stdin) = (StringIO(), StringIO(input))
		resolve()
		sys.stdout.seek(0)
		out = sys.stdout.read()[:-1]
		(sys.stdout, sys.stdin) = (stdout, stdin)
		self.assertEqual(out, output)

	def test_入力例_1(self):
		input = '10'
		output = '9'
		self.assertIO(input, output)

	def test_入力例_2(self):
		input = '81'
		output = '81'
		self.assertIO(input, output)

	def test_入力例_3(self):
		input = '271828182'
		output = '271821169'
		self.assertIO(input, output)

def resolve():
	N = int(input())
	print(math.floor(math.sqrt(N)) ** 2)

def __starting_point():
	resolve()
__starting_point()


n = int(input())
ans = 0
k = 1
while k ** 2 <= n:
	ans = k ** 2
	k += 1
print(ans)


a = int(input())
print(int(a ** (1 / 2)) ** 2)


N = int(input())
i = 0
while i * i <= N:
	i += 1
i -= 1
print(i * i)


import sys
sys.setrecursionlimit(10 ** 6)
n = int(input())
ans = 1
for i in range(0, n):
	if (ans + 1) ** 2 > n:
		break
	ans += 1
print(ans ** 2)


N = int(input())
a = 1
while a * a <= N:
	a += 1
print((a - 1) ** 2)


x = int(input())
print(int(x ** 0.5) ** 2)


N = int(input())
for i in range(N + 1):
	if i ** 2 == N:
		print(i ** 2)
		return
	elif i ** 2 > N:
		print(max((i - 1) ** 2, 1))
		return


N = int(input())
from math import floor, sqrt
ans = floor(sqrt(N)) ** 2
print(ans)


N = int(input())
C = 0
if N == 1:
	print(1)
	return
for i in range(1, N):
	if i ** 2 < N:
		C = i ** 2
	elif i ** 2 == N:
		C = i ** 2
		break
	elif i ** 2 > N:
		break
print(C)


n = int(input())
for i in range(n):
	if int((n - i) ** 0.5) == (n - i) ** 0.5:
		print(n - i)
		return


import math
N = int(input())
ans = N
for i in range(N):
	if math.sqrt(ans).is_integer():
		print(ans)
		break
	ans -= 1


print(pow(int(pow(int(input()), 0.5)), 2))


N = int(input())
k = 1
while k * k <= N:
	k += 1
print((k - 1) * (k - 1))


import math
n = int(input())
for i in range(10 ** 5):
	if n < i ** 2:
		print((i - 1) ** 2)
		break


import math
a = int(input())
c = int(pow(a, 0.5))
print(c ** 2)


N = int(input())
for i in range(int(N ** 0.5) + 3):
	if i ** 2 > N:
		print((i - 1) ** 2)
		break


import math
n = int(input())
r = int(math.sqrt(n))
print(r ** 2)


N = int(input())
if int((N + 1) ** 0.5) ** 2 == N:
	print(N)
else:
	print(int(N ** 0.5) ** 2)


from math import sqrt
n = int(input())
ans = int(sqrt(n))
if (ans + 1) * (ans + 1) <= n:
	print((ans + 1) * (ans + 1))
elif ans * ans <= n:
	print(ans * ans)
else:
	print((ans - 1) * (ans - 1))


n = int(input())
x = 1
while x * x <= n:
	x += 1
x -= 1
print(x * x)


import math
e = int(input())
print(math.floor(e ** (1 / 2)) ** 2)