Problem:


Score : 200 points

Problem Statement

You are given a positive integer X.
Find the largest perfect power that is at most X.
Here, a perfect power is an integer that can be represented as b^p, where b is an integer not less than 1 and p is an integer not less than 2.

Constraints

1 ≤ X ≤ 1000

X is an integer.

Input

Input is given from Standard Input in the following format:

X

Output

Print the largest perfect power that is at most X.

Sample Input 1

10

Sample Output 1

9

There are four perfect powers that are at most 10: 1, 4, 8 and 9.
We should print the largest among them, 9.

Sample Input 2

1

Sample Output 2

1

Sample Input 3

999

Sample Output 3

961



Sample input:
10


Sample output:
9

Submission status: Wrong Answer

Solution code:
# coding: utf-8

X=int(input())

ans=1

for i in range(2,35):
    k=2
    while i**k<X:
        k+=1
    if k>=3:
        ans=max(ans,i**(k-1))

print(ans)

Submission status: Wrong Answer

Solution code:
X=int(input())
max=1
for i in range(1, X):
  for j in range(2, X):
    if i**j<=X:
      if i**j>max:
        max=i**j
      else:
        break
print(max)

Submission status: Wrong Answer

Solution code:
X=int(input())
max=1
for i in range(1, X):
  for j in range(2, X):
    if i**j<=X:
      if max>1:
        max=i**j
      else:
        break
print(max)

Submission status: Wrong Answer

Solution code:
X=int(input())
if X==1:
  max=1
if X==2:
  max=1
else:
  for i in range(1, X):
    for j in range(2, X):
      if i**j<=X:
        max=i**j
      else:
        break
print(max)

Submission status: Wrong Answer

Solution code:
X=int(input())
if X==1:
  max=1
if X==2:
  max=1
else:
  for i in range(1, X):
    for j in range(2, X):
      if i**j<=X:
        max=i**j
print(max)

Submission status: Wrong Answer

Solution code:
X=int(input())
if X==1 or 2:
  max=1
else:
  for i in range(1, X):
    for j in range(2, X):
      if i**j<=X:
        max=i**j
print(max)

Submission status: Wrong Answer

Solution code:
X=int(input())
if X==1:
  max=1
else:
  for i in range(1, X):
    for j in range(2, X):
      if i**j<=X:
        max=i**j
print(max)

Submission status: Wrong Answer

Solution code:
X=int(input())
for i in range(1, X):
  for j in range(2, X):
    if i**j<=X:
      max=i**j
print(max)

Submission status: Wrong Answer

Solution code:
x=int(input())

ans=1

for i in range(2,x):
  a=i
  while a*i<=x:
    a*=i
  if ans<a:
    ans=a

print(ans)

Submission status: Wrong Answer

Solution code:
import  math

n = int(input())

s = math.floor(math.sqrt(n))
print(s ** 2)

Submission status: Wrong Answer

Solution code:
X=int(input())
import math
num = []
for i in range(1,X+1):
    if i == int(math.sqrt(i)) ** 2:
        num.append(i)
print(max(num))

Submission status: Wrong Answer

Solution code:
X=int(input())
import math
num = []
for i in range(1,X+1):
    if i == math.sqrt(i**2):
        num.append(i)
print(max(num))

Submission status: Wrong Answer

Solution code:
X = int(input())

ans = 0
for i in range(2, X+1):
  n = i*i
  while n <= X:
    ans = max(ans, n)
    n *= i
print(ans)

Submission status: Wrong Answer

Solution code:
X = int(input())

ans = 0
for i in range(2, X):
  n = i
  while n <= X:
    ans = max(ans, n)
    n *= i
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())

print(int(n**0.5)**2)

Submission status: Wrong Answer

Solution code:
x=int(input())
i=1
while i**2<1000:
  i+=1
  if i**2>x:
    print((i-1)**2)
    break

Submission status: Wrong Answer

Solution code:
X = int(input())

import math

while not float.is_integer(math.sqrt(X)):
  X -= 1

print(X)

Submission status: Wrong Answer

Solution code:
X = int(input())
n = 1
while n ** 2 <= X:
  n += 1

if n ** 2 == X:
  print(X)
else:
  print((n-1) ** 2)

Submission status: Wrong Answer

Solution code:
x = int(input())
y = 0
for i in range(1,x):
    for j in range(2,x):
        if i**j <= x:
            y = max(y, i**j)
        else:
            break
print(y)

Submission status: Wrong Answer

Solution code:
x = int(input())
y = 0
for i in range(x):
    for j in range(2,x):
        if i**j <= x:
            y = max(y, i**j)
        else:
            break
print(y)

Submission status: Wrong Answer

Solution code:
y = 0
x = int(input())
for i in range(1000**2+1):
    x2 = i**2
    if x2 <= x:
        y = x2
print(y)

Submission status: Wrong Answer

Solution code:
y = 0
x = int(input())
for i in range(1001):
    x2 = i**2
    if x2 <= x:
        y = x2
print(y)

Submission status: Wrong Answer

Solution code:
X = int(input())
S = []
for i in range(1,35):
    a = i**2
    S.append(a)
S.sort(reverse=True)
for e in S:
    if e <= X:
        print(e)
        exit()

Submission status: Wrong Answer

Solution code:
X = int(input())
for i in range(1,35):
    a = i**2
    if a > X:
        print((i-1)**2)
        exit()

Submission status: Wrong Answer

Solution code:
x = int(input())
r = []
for i in range(1,999):
    if i*i >= 1000:
        break
    r.append(i*i)
r.reverse()
for y in r:
    if x >= y:
        print(y)
        break

Submission status: Wrong Answer

Solution code:
x = int(input())
y = int(x**0.5)
print(y*y)

Submission status: Wrong Answer

Solution code:
x = int(input())

for i in range(x):
    for j in range(2, 10):
        if (x-i)**(1/j) % 1 == 0:
            print(x-i)
            exit()

Submission status: Wrong Answer

Solution code:
x = int(input())

for i in range(x):
    for j in range(2, 31):
        if (x-i)**(1/j) % 1 == 0:
            print(x-i)
            exit()

Submission status: Wrong Answer

Solution code:
x = int(input())

if x == 1:
    print(1)
else:
    for i in range(x):
        for j in range(2, 32):
            if (x-i)**(1/j) % 1 == 0:
                print(x-i)
                exit()

Submission status: Wrong Answer

Solution code:
x = int(input())

for i in range(x):
    for j in range(2, 32):
        if (x-i)**(1/j) % 1 == 0:
            print(x-i)
            exit()

Submission status: Wrong Answer

Solution code:
N = int(input())


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])

    if temp != 1:
        arr.append([temp, 1])

    if arr == []:
        arr.append([n, 1])

    return arr


for i in range(N+1)[::-1]:
    if len(factorization(i)) == 1 and factorization(i)[0][1] > 1:
        print(i)
        exit()

print(1)

Submission status: Wrong Answer

Solution code:
x = int(input())

for i in range(40,0,-1):
    for j in range(40,1,-1):
        if i**j<=x:
            print(i**j)
            exit()

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
X = int(input())
ans = [1]
for i in range(2, 1 + int(X ** (1/2))):
    ans.append(i)
    while i < X:
        i *= i
        if i <= X:
            ans.append(i)
print(max(ans))

Submission status: Wrong Answer

Solution code:
import numpy as np
X = int(input())
ans = 1
for b in range(2, 1+int(np.ceil(np.sqrt(X)))):
    p = 0
    while np.power(b, p) <= X:
        print(np.power(b, p))
        p += 1
    p -= 1
    ans = max(ans, np.power(b, p))
print(ans)

Submission status: Wrong Answer

Solution code:

x = int(input())

a = int((x ** 0.5)//1)

print(a**2)

Submission status: Wrong Answer

Solution code:
X=int(input())
n=1
for b in range(2,X):
   p=2
   while(True):
      x=b**p
      if x<=X:
         n=x
         p+=1
      else:
         break
   
print(n)

Submission status: Wrong Answer

Solution code:
X=int(input())
n=1
for b in range(2,X):
   p=2
   while(True):
      x=b**p
      print(x)
      if x<=X:
         n=x
         p+=1
      else:
         break
   
print(n)

Submission status: Wrong Answer

Solution code:
x = int(input())
ans = 1
for i in range(35):
    for j in range(15):
        if i**j > x:
            break
        else:
            ans = max(i**j,ans)
print(ans)

Submission status: Wrong Answer

Solution code:
x = int(input())

for i in range(10**10):
    if i**2 > x:
        break
    ans = i**2
print(ans)

Submission status: Wrong Answer

Solution code:
x = int(input())
ans = 1
while ans**2 <= x:
    ans+=1
print((ans-1)**2)

Submission status: Wrong Answer

Solution code:
x = int(input())
ans = 1
while ans**2 < x:
    ans+=1
print(max((ans-1)**2,1))

Submission status: Wrong Answer

Solution code:
x = int(input())
c = 1

for b in range(1, x):
  for p in range(2, x):
    if x < b**p:
      break
      c = max(c,b**p)
print(c)

Submission status: Wrong Answer

Solution code:
x = int(input())
c = 1

for b in range(1, x):
  for p in range(2, x):
    if b**p <= x:
      print(b**p)
    else:
      print(c)

Submission status: Wrong Answer

Solution code:
import math
x = int(input())
for i in range(x,0,-1):
  if math.sqrt(i).is_integer()==True:
    print(i)
    exit()

Submission status: Wrong Answer

Solution code:
x=int(input())
ans=0
for i in range(1,x):
    for j in range(2,x):
        if i**j <= x:
            ans = max(ans, i**j)
        else:break
print(ans)

Submission status: Wrong Answer

Solution code:
x=int(input())
if x==1:
    print(1)
if x==2:
    print(2)
    exit()
ans=0
for i in range(2,int(x**0.5)+1):
    a=i
    while a*i<=x:
        a*=i
    ans=max(ans,a)
print(ans)

Submission status: Wrong Answer

Solution code:
x=int(input())
if x==1:
    print(1)
ans=0
for i in range(2,int(x**0.5)+1):
    a=i
    while a*i<=x:
        a*=i
    ans=max(ans,a)
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
from math import floor, sqrt, log

x = int(sys.stdin.readline().rstrip())

def main():
    res = [1]
    for b in range(2, x+1):
        p_max = floor(log(x, b))
        if p_max == 1:
            break
        res.append(b ** p_max)
    return max(res)

if __name__ == '__main__':
    ans = main()
    print(ans)

Submission status: Wrong Answer

Solution code:
x=int(input())
if x==1:
    print(1)
ans=0
for i in range(2,int(x**0.5)+1):
    a=i
    while a*i<x:
        a*=i
    ans=max(ans,a)
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
from math import floor, sqrt, log

x = int(sys.stdin.readline().rstrip())

def main():
    b_max = floor(sqrt(x))
    res = [1]
    for b in range(2, b_max + 1):
        p_max = floor(log(x, b))
        res.append(b ** p_max)
    return max(res)

if __name__ == '__main__':
    ans = main()
    print(ans)

Submission status: Wrong Answer

Solution code:
import sys
from math import floor

x = int(sys.stdin.readline().rstrip())

def main():
    res = [1]
    i = 2
    while x ** (1 / i) >= 2:
        res.append(floor(x ** (1 / i)) ** i)
        i += 1
    
    return max(res)

if __name__ == '__main__':
    ans = main()
    print(ans)

Submission status: Wrong Answer

Solution code:
from math import log
x = int(input())
ans = 1

for b in range(2,int(x**0.5//1)+1):
    ans = max(b**int(log(x,b)//1),ans)

print(ans)

Submission status: Wrong Answer

Solution code:
x = int(input())

ans = 0

for i in range(2, 51):

 tmp = i

 while tmp * i < x + 1:

  tmp = tmp * i

  ans = max(ans, tmp)

print(ans)

Submission status: Wrong Answer

Solution code:
print(int(int(input())**(1/2))**2)

Submission status: Wrong Answer

Solution code:
n=int(input())
minsa=1000
for a in range(1,32):
  for b in range(1,10):
    l=a**b
    sa=n-l
    if sa>=0:
      minsa=min(sa,minsa)
print(n-minsa)

Submission status: Wrong Answer

Solution code:
n=int(input())
l=int(n**0.5)
print(l**2)

Submission status: Wrong Answer

Solution code:
import math
n = int(input())
for i in reversed(range(n + 1)):
    if math.sqrt(i).is_integer():
        print(i)
        break

Submission status: Wrong Answer

Solution code:
def main():
    X = int(input())
    candidates = [1, X]
    c_append = candidates.append
    for i in range(2, int(X**0.5)+1):
        for j in range(2, int(X**0.5)+1):
            powered = i ** j
            if powered > X:
                break
            else:
                c_append(powered)
    ans = max(candidates)
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import math

x = int(input())
ans = 1
for b in range(2, 32):
    p = 2
    if b ** p > x:
        break
    while b ** (p + 1) <= x:
        p += 1
    ans = b ** p
print(ans)

Submission status: Wrong Answer

Solution code:
X = int(input())
import math


x_root = math.floor(math.sqrt(X))
y = 1
for b in range(x_root, X+1):
    for p in range(2, X):
        tmp = b**p
        if y < tmp:
            if tmp <= X:
                y = tmp
            else:
                break
print(y)

Submission status: Wrong Answer

Solution code:
import math
ans = 0
X = int(input())
if(X == 1):
	print(1)
	exit()
for i in range(X+1):
	Y = int(math.sqrt(i))
	if(Y*Y == i and i > ans):
		ans = i
print(ans)

Submission status: Wrong Answer

Solution code:
import math
ans = 0
X = int(input())
if(X == 1):
	print(1)
	exit()
for i in range(X):
	Y = int(math.sqrt(i))
	if(Y*Y == i and i > ans):
		ans = i
print(ans)

Submission status: Wrong Answer

Solution code:
x=int(input())
i=1
while x>=i**2:
    i+=1
print((i-1)**2)

Submission status: Wrong Answer

Solution code:
x=int(input())
i=0
while x>i**2:
    i+=1
print((i-1)**2)

Submission status: Wrong Answer

Solution code:
x = int(input())
ans = 0
for b in range(1, x):
    for p in range(2, x):
        if b ** p <= x:
            ans = max(ans, b**p)

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
X = int(input())


ans = 0

for i in range(1,X + 1):
  for j in range(2,X + 1):
    x = i ** j
    if x <= X:
      ans = max(i ** j,ans)
    if x > X:
      break
      

print(ans)

Submission status: Wrong Answer

Solution code:
X = int(input())


ans = 0

for i in range(1,X + 1):
  for j in range(2,i + 1):
    x = i ** j
    if x <= X:
      ans = max(i ** j,ans)
    if x > X:
      break
      

print(ans)

Submission status: Wrong Answer

Solution code:
X = int(input())


ans = 0

for i in range(1,X + 1):
  for j in range(2,i + 1):
    x = i ** j
    if x <= X:
      ans = max(i ** j,ans)
      

print(ans)

Submission status: Wrong Answer

Solution code:
X = int(input())
ans = 0

for i in range(1,X + 1):
  for j in range(1,i + 1):
    if j ** 2 == i:
      ans = max(i,ans)

print(ans)

Submission status: Wrong Answer

Solution code:
X = int(input())
ans = 0

for i in range(1,X + 1):
  for j in range(1,i + 1):
    if j ** 2 == i:
      ans = i

print(ans)

Submission status: Wrong Answer

Solution code:
import math
X = int(input())
ans = 0
for i in range(1,X + 1):
  if math.sqrt(i) ** 2 == i: 
    ans = i

print(ans)

Submission status: Wrong Answer

Solution code:
x=int(input())
ans=0
for p in range(2,10):
    b=int(x**(1/p))
    while b**p>x:
        b -= 1
    ans=max(ans,b**p)
print(ans)

Submission status: Wrong Answer

Solution code:
x=int(input())
n=int(x**.5)+10
while n**2>x:
    n -= 1
print(n**2)

Submission status: Wrong Answer

Solution code:
x=int(input())
n=int(x**.5)
while n**2>x:
    n -= 1
print(n**2)

Submission status: Wrong Answer

Solution code:
import math
x=int(input())
ans=[1]
for i in range(2,x+1):
    #print(i)
    k=math.ceil(math.log(x,i))
    if k>=2:
        ans.append(i**k)
print(max(ans))
#print(ans)

Submission status: Wrong Answer

Solution code:
import math
x=int(input())
ans=[1]
for i in range(2,x+1):
    #print(i)
    k=math.floor(math.log(x,i))
    if k>=2:
        ans.append(i**k)
print(max(ans))
#print(ans)

Submission status: Wrong Answer

Solution code:
import math
x=int(input())
ans=[1]
for i in range(2,x+1):
    #print(i)
    k=math.floor(math.log(x,i))
    ans.append(i**(k+1))
print(max(ans))
#print(ans)

Submission status: Wrong Answer

Solution code:
import math
x=int(input())
ans=[1]
for i in range(2,x+1):
    #print(i)
    k=math.ceil(math.log(x,i))
    ans.append(i**k)
print(max(ans))
#print(ans)

Submission status: Wrong Answer

Solution code:
import math
x=int(input())
ans=[1]
for i in range(2,x+1):
    #print(i)
    k=math.floor((math.log(x,i)))
    ans.append(i**k)
print(max(ans))
#print(ans)

Submission status: Wrong Answer

Solution code:
import math
x=int(input())
ans=[1]
for i in range(2,x+1):
    #print(i)
    k=int(math.log(x,i))
    if k>=2:
        ans.append(i**k)
print(max(ans))
#print(ans)

Submission status: Wrong Answer

Solution code:
import math
x=int(input())
ans=[]
if x<=3:
    print(1)
else:
    for i in range(2,x):
        #print(i)
        k=int(math.log(x,i))
        if k>=2:
            ans.append(i**k)
    print(max(ans))
    #print(ans)

Submission status: Wrong Answer

Solution code:
import math
x=int(input())
ans=[]
if x<=3:
    print(1)
else:
    for i in range(2,int(math.sqrt(x))+1):
        #print(i)
        k=int(math.log(x,i))
        ans.append(i**k)
    print(max(ans))
    #print(ans)

Submission status: Wrong Answer

Solution code:
import math
x = int(input())
for i in range(x,0,-1):
  if math.sqrt(i).is_integer():
    print(i)
    break

Submission status: Wrong Answer

Solution code:
n=int(input())
a=[]
for i in range(33):
  for j in range(12):
    a.append(i**j)
a.sort()
for i in range(len(a)):
  if a[i]>n:
    print(a[i-1])
    break

Submission status: Wrong Answer

Solution code:
A=[1]
X=int(input())
for i in range(1,33):
  for j in range(1, 11):
    if i**j<X+1:
      A.append(i**j)
print(max(A))

Submission status: Wrong Answer

Solution code:
A=[1]
X=int(input())
for i in range(1,33):
  for j in range(1, 11):
    if i**j<X:
      A.append(i**j)
print(max(A))

Submission status: Wrong Answer

Solution code:
a = int(input())
for _ in range(a):
    b = [i for i in range(2,a+1) if a%i==0]
    if all(i%b[0] == 0 for i in b) and len(b) != 1:
        print(a)
        break
    a -= 1

Submission status: Wrong Answer

Solution code:
X=int(input())
ans=1
for b in range(1,int(X**(1/2))+1):
  for p in range(2,X):
    ans=max(ans,b**p)
print(ans)

Submission status: Wrong Answer

Solution code:
X=int(input())
ans=1
for b in range(1,int(X**(1/2))+1):
  for p in range(2,int(X/b)+1):
    ans=max(ans,b**p)
print(ans)

Submission status: Wrong Answer

Solution code:
X=int(input())
ans=0
for b in range(1,int(X**(1/2))+1):
  for p in range(2,int(X/b)+1):
    ans=max(ans,b**p)
print(ans)

Submission status: Wrong Answer

Solution code:
#lst = [int(i) for i in input().split()]
x = int(input())
m = 1
for i in range(2, 10):
    print(x ** (1 / i))
    tmp = int(x ** (1 / i) + 0.00001) ** i
    print(tmp)
    if x >= tmp > m:
        m = tmp
print(m)

Submission status: Wrong Answer

Solution code:
x = int(input())
m = 1
for i in range(2, 10):
  tmp = int(x ** (1 / i)) ** i
  if tmp > m:
      m = tmp
print(m)

Submission status: Wrong Answer

Solution code:
x = int(input())
m = 1
for i in range(2, 11):
  tmp = int(x ** (1 / i)) ** i
  if tmp > m:
      m = tmp
print(m)

Submission status: Wrong Answer

Solution code:
import math
x = int(input())
x_sq = math.sqrt(x)
x_sq = math.floor(x_sq)
print(x_sq**2)

Submission status: Wrong Answer

Solution code:
n = int(input())

ans = [1,]
for i in range(40):
    for j in range(20):
        if i**j <= n:
            ans.append(i**j)
print(max(ans))

Submission status: Wrong Answer

Solution code:
n = int(input())

ans = [1,]
for i in range(40):
    if i**2 <= n:
        ans.append(i**2)

print(max(ans))

Submission status: Wrong Answer

Solution code:
n = int(input())

ans = [1,]
for i in range(40):
    if i**2 < n:
        ans.append(i**2)

print(max(ans))

Submission status: Wrong Answer

Solution code:
n = int(input())

ans = [1,]
for i in range(40):
    if i**2 < n:
        ans.append(i**2)
    else:
        break

print(max(ans))

Submission status: Wrong Answer

Solution code:
N = int(input())

for i in range(1,33):
  if N < i**2:
    break
print((i-1)**2)

Submission status: Wrong Answer

Solution code:
ls=[1,2,4,8,16,32,64,128,256,512,3,9,27,81,243,729,
    25,125,625,36,216,49,343,100,1000,
   121,144,169,196,225,289,324,361,400,
   441,484,529,576,625,676,781,841,900,961,1001]
n=int(input())
for i in range(len(ls)):
  if ls[i]>n:
    print(ls[i-1])
    break

Submission status: Wrong Answer

Solution code:
x = int(input())

ans = 0

for i in range(1, 35):
    for j in range(2, 11):
        if 0 <= x - i**j < x - ans:
            ans = i**j        
        elif x - i**j < 0 or x - ans < x - i**j:
            break

print(ans)

Submission status: Wrong Answer

Solution code:
N=int(input())
ans=1
for i in range(N):
    for j in range(35):
        for k in range(10):
            if i==j**k :ans=i
print(ans)

Submission status: Wrong Answer

Solution code:
X = int(input())
ans = 1
for i in range(2,X):
    for j in range(2,X):
        if i ** j > ans and i ** j <= X:
            ans = i ** j
        else:
            break
print(ans)

Submission status: Wrong Answer

Solution code:
X =int(input())

A = [1]
for i in range(1, 20):
    for j in range(2, 20):
        if i**j <= X:
            A.append(i**j)
print(max(A))

Submission status: Wrong Answer

Solution code:
X =int(input())

A = [1]
for i in range(1, 50):
    for j in range(2, 100):
        if i**j < X:
            A.append(i**j)
print(max(A))

Submission status: Wrong Answer

Solution code:
X =int(input())

A = [1]
for i in range(1, 50):
    for j in range(2, 50):
        if i**j < X:
            A.append(i**j)
print(max(A))

Submission status: Wrong Answer

Solution code:
n = int(input())

ans = 0
for i in range(1000):
  for j in range(20):
    if i**j > n:
      break
    ans = max(ans, i**j)
print(ans)

Submission status: Wrong Answer

Solution code:
##### 解けた #####

from math import log,floor,sqrt

X=int(input())
maxx=1 # 最大値

# 基数
for b in range(2,floor(sqrt(X))+1):
    p=max(2,floor(log(X,b))) # b^p

    if maxx<b**p: # 最大値を更新
        maxx=b**p

print(maxx)

Submission status: Wrong Answer

Solution code:
A = int(input())
k = int(A ** 0.5)
print(k**2)

Submission status: Wrong Answer

Solution code:

def pff(m):
    pf = {}
    for i in range(2, int(m ** 0.5) + 1):
        while m % i == 0:
            pf[i] = pf.get(i, 0) + 1
            m //= i
    if m > 1: pf[m] = 1
    return pf
def examB():
    X = I()
    ans = 0
    for i in range(X,0,-1):
        cur = pff(i)
        flag = True
        for j in cur.values():
            if j%2==1:
                flag = False
        if flag:
            ans = i
            break
    print(ans)

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examB()

Submission status: Wrong Answer

Solution code:
n = int(input())

k = 1000
maxk = 0

for j in range(n,1,-1):#5,4,3,2で回す時
	for i in range(j-1,1,-1):
		#print(j,i)
		if j%i ==0 :
			k = j
			t = i
			while k>=t :
				#print('-------')
				#print(k,t)
				k = k/t
				#print(k)
				if k == 1 and maxk < j:				
					maxk = j
					#print('Yes')
					break
				
print(maxk)

Submission status: Wrong Answer

Solution code:
a=int(input())
import math
b=int(math.log(a, 2))
c=1
if b!=1:
  for i in range(2,b+1,1):
    c=max(c,int(a**(1/i))**i)
print(c)

Submission status: Wrong Answer

Solution code:
a=int(input())
import math
b=int(math.sqrt(a))+1
b=32
c=1
if b!=1:
  for i in range(2,b+1,1):
    c=max(c,int(a**(1/i))**i)
print(c)

Submission status: Wrong Answer

Solution code:
a=int(input())
import math
b=int(math.sqrt(a))+1
c=1
if b!=1:
  for i in range(2,b+1,1):
    c=max(c,int(a**(1/i))**i)
print(c)

Submission status: Wrong Answer

Solution code:
a=int(input())
import math
b=int(math.sqrt(a))
c=1
if b!=1:
  for i in range(2,b+1,1):
    c=max(c,int(a**(1/i))**i)
print(c)

Submission status: Wrong Answer

Solution code:
a=int(input())
import math
b=int(math.sqrt(a))
c=1
if b!=1:
  for i in range(2,b-1,1):
    c=max(c,int(a**(1/i))**i)
print(c)

Submission status: Wrong Answer

Solution code:
a=int(input())
import math
b=int(math.sqrt(a))
c=1
for i in range(2,b-1,1):
  c=max(c,int(a**(1/i))**i)
print(c)

Submission status: Wrong Answer

Solution code:
a=int(input())
import math
b=int(math.sqrt(a))
c=1
for i in range(b):
  c=max(c,int(a**(1/(i+1)))**(i+1))
print(c)

Submission status: Wrong Answer

Solution code:
a=int(input())
import math
b=int(math.sqrt(a))
c=1
for i in range(b):
  c=max(c,(int(a**(1/(b+1))))**(b+1))
print(c)

Submission status: Wrong Answer

Solution code:
a=int(input())
import math
b=int(math.sqrt(a))
print(int(b**2))

Submission status: Wrong Answer

Solution code:
a=int(input())
import math
b=int(math.sqrt(a))
print(b**2)

Submission status: Wrong Answer

Solution code:
a=float(input())
import math
b=int(math.sqrt(a))
print(b**2)

Submission status: Wrong Answer

Solution code:
a=int(input())
import math
b=int(math.sqrt(a))
print(b)

Submission status: Wrong Answer

Solution code:
def ans(n):
    pow_2 = int(n**(0.5))
    #print(pow_2)
    ans = pow_2**2
    for i in range(1,11):
        if i**3 <= n:
            ans = max((i**3),ans)
    print(ans)
n = int(input())
for i in range(n,n+1):
    ans(i)

Submission status: Wrong Answer

Solution code:
n = int(input())
pow_2 = int(n**(0.5))
#print(pow_2)
ans = pow_2**2
for i in range(1,11):
    if i**3 <= n:
        ans = max((i**3),ans)
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
pow_2 = int(n**(0.5))
print(pow_2)
ans = pow_2**2
for i in range(1,11):
    if i**3 <= n:
        ans = max((i**3),ans)
print(ans)

Submission status: Wrong Answer

Solution code:
X = int(input())
m = 0
if X == 1:
    print(1)
    exit(0)
for i in range(1, X + 1):
    for j in range(2, X + 1):
        tmp = i ** j
        if m <= tmp <= X:
            m = tmp
        else:
            break
print(m)

Submission status: Wrong Answer

Solution code:
x = int(input())

for i in range(10000):
    if i * i > x:
        print((i-1)**2)
        import sys
        sys.exit()
    elif i * i == x:
        print(i**2)
        import sys
        sys.exit()

Submission status: Wrong Answer

Solution code:
x = int(input())

for i in range(100):
    if i * i > x:
        print((i-1)**2)
        import sys
        sys.exit()
    elif i * i == x:
        print(i**2)
        import sys
        sys.exit()

Submission status: Wrong Answer

Solution code:
x = int(input())

for i in range(100):
    if i * i >= x:
        print((i-1)**2)
        import sys
        sys.exit()

Submission status: Wrong Answer

Solution code:
x = int(input())

for i in range(100):
    if i * i > x:
        print((i-1)**2)
        import sys
        sys.exit()

Submission status: Wrong Answer

Solution code:
n=int(input())
l=list(range(1,n+1))
l=sorted(l,reverse=True)
ans=0
for i in l:
    for j in range(2,10):
        if ans!=0:
            break
        if pow(i,1/j)%1==0:
            ans=i
            break
        
print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
l=list(range(1,n+1))
l=sorted(l,reverse=True)
ans=0
for i in l:
    for j in range(2,10):
        if pow(i,1/j)%1==0:
            ans=i
            break
        
    if ans!=0:
        break
print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
l=list(range(1,n+1))
l=sorted(l,reverse=True)
ans=0
for i in l:
    if pow(i,0.5)%1==0:
        ans=i
        break
        
print(ans)

Submission status: Wrong Answer

Solution code:
X = int(input())
for i in range(1,40):
  if i*i == X:
    print(i*i)
    exit()
  if i*i > X:
    print((i-1)*(i-1))
    exit()

Submission status: Wrong Answer

Solution code:
X = int(input())
import math

for i in range(1,40):
  if i*i > X:
    print((i-1)*(i-1))
    exit()

Submission status: Wrong Answer

Solution code:
x=int(input())
l=[1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196, 225, 256, 289, 324, 361, 400, 441, 484, 529, 576, 625, 676, 729, 784, 841, 900, 961]
ans=[]
for i in l:
  if i<=x:
    ans.append(i)
print(max(ans))

Submission status: Wrong Answer

Solution code:
x=int(input())
l=[]
for i in range(1,1001):
  if (i ** .5).is_integer():
    if i<=x:
      l.append(i)
    else:
      break
print(max(l))

Submission status: Wrong Answer

Solution code:
X = int(input())
ans = set()
for i in range(1,int(X)):
	for j in range(2,11):
		if i**j <X:
			ans.add(i**j)

ans_list = list(ans)
if len(ans_list)==0:
	print(1)
else:
	print(max(ans_list))

Submission status: Wrong Answer

Solution code:
N = int(input())
import math
n = math.floor(N**0.5)
P = []
for i in range(2,n+1):
    J = 1
    for j in range(len(P)):
        if i % P[j] == 0:
            J = 0
            break
    if J == 1:
        P.append(i)
A = [1]
for i in range(len(P)):
    p = P[i]
    x = 2
    while p**x <= N :
        A.append(p**x)
        x += 1
ans = max(A)
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
P = []
for i in range(2,N+1):
    J = 1
    for j in range(len(P)):
        if i % P[j] == 0:
            J = 0
            break
    if J == 1:
        P.append(i)
A = [1]
for i in range(len(P)):
    p = P[i]
    j = 2
    while p**j <= N :
        A.append(p**j)
        j += 1
ans = max(A)
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
import math
n = math.floor(N**0.5)
P = []
for i in range(2,n+1):
    J = 1
    for j in range(len(P)):
        if i % P[j] == 0:
            J = 0
            break
    if J == 1:
        P.append(i)
A = [1]
for i in range(len(P)):
    p = P[i]
    j = 2
    while p**j <= N :
        A.append(p**j)
        j += 1
ans = max(A)
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
import math
n = math.floor(N**0.5)
P = []
for i in range(2,n+1):
    J = 1
    for j in range(len(P)):
        if i % P[j] == 0:
            J = 0
            break
    if J == 1:
        P.append(i)
A = [1]
for i in range(len(P)):
    p = P[i]
    j = 1
    while p**j <= N :
        A.append(p**j)
        j += 1
ans = max(A)
print(ans)

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
n = math.floor(N**0.5)
print(n**2)

Submission status: Wrong Answer

Solution code:
x=int(input())
count=[]
for i in range(1,x+1):
  for j in range(1,100):
    if i**j<=x:
      count.append(i**j)
print(max(count))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x=int(input())
m=1
for i in range(1,x):
    for j in range(2,x):
        if i**j<=x:
            m=max(1,i**j)
        else:
            break
print(m)

Submission status: Wrong Answer

Solution code:
x=int(input())
a=[]
for i in range(1,x+1):
    for j in range(1,x+1):
        if i**j<=x:
            a.append(i**j)
print(max(set(a)))

Submission status: Wrong Answer

Solution code:
import math as m
x=int(input())
print((m.floor(x**0.5))**2)

Submission status: Wrong Answer

Solution code:
import math as m
x=int(input())
print(m.floor(x**0.5))

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
X=int(input())

ans=0
for i in range(2,X+1):
    temp=i*i
    while temp<=X:
        temp*=i
    if temp!=i*i:
        ans=max(ans,temp//i)

print(ans)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
X=int(input())

n=0
while X>=n**2:
    n+=1

print((n-1)**2)