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

Solution (Python):
import math
x=int(input())
ans=0
if x<=3:
    print(1)
    exit()
for i in range(2,int(math.sqrt(x)//1)+1):
    j=2
    tmp=i**j
    while tmp<x:
        tmp=i**j
        j+=1
        if tmp<=x and tmp>ans:
            ans=tmp
print(ans)

Solution (Python):
x = int(input())
ans = 1
for i in range(2, int(x ** 0.5) + 1):
    n = 1
    while n * i <= x:
        n *= i
    ans = max(ans, n)
print(ans)

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

for i in range(2, X):
    for j in range(1, X):
        if j**i > X:
            break
        else:
            ans = max(ans, j**i)
if X == 1:
    print(1)
else:
    print(ans)

Solution (Python):


def solve(x):
    if x == 1:
        return 1
    f = 2
    l = [1]
    while f * f <= x:
        d = f
        while d <= x:
            l.append(d)
            d *= f
        f += 1
    return max(l)



def main():
    X = int(input())
    print(solve(X))
    return

if __name__ == '__main__':
    main()

Solution (Python):
X = int(input())

res = 1
for i in range(X):
    for p in range(2, X):
        if i ** p <= X:
            res = max(res, i ** p)
        else:
            break
print(res)

Solution (Python):
X = int(input())
ans = 0
for i in range(1,X+1):
    for j in range(2,11):
        tmp = i**j
        if ans < tmp <= X:
            ans = tmp
print(ans)

Solution (Python):
X=int(input())
ans=0
for i in range(1,X+1):
    for j in range(2,11):
        tmp=i**j
        if ans<tmp<=X:
            ans=tmp
print(ans)

Solution (Python):
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
def gcd(*numbers): reduce(math.gcd, numbers)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
count = 0
ans = 0

N = k()
if N == 1:
    print(1)
    sys.exit()

for i in range(N,-1,-1):
    for j in range(1,int(N**0.5)+1):
        for k in range(2,11):
            if j**k == i:
                print(i)
                sys.exit()

Solution (Python):
import sys
X = int(input())

if not ( 1 <= X <= 1000 ):
    sys.exit()

result = 1
for I in range(1,32):
    for J in range(2,10):
        if I ** J <= X and result <= I ** J:
            result = I ** J

print(result)

Solution (Python):
x = int(input())
if x == 1:
  print("1")
  exit()
  
ans = 0
for b in range(2,int(x**(1/2)+1)):
  for p in range(2,1000):
    tmp = pow(b,p)
    if tmp<=x:
      ans = max(ans,pow(b,p))
    else:
      break
      
print(ans)

Solution (Python):
x = int(input())

if x <= 3:
  print(x)
  exit()

ans = 0
for i in range(2, int(x**0.5)+1):
  s = 0
  t = 1
  while i**t <= x:
    s = i**t
    t += 1
  ans = max(ans, s)
print(ans)

Solution (Python):
X=int(input())

M=1
for b in range(2,X+1):
    if b*b<=X:
        a=b*b
        while a*b<=X:
            a*=b
        M=max(M,a)

print(M)

Solution (Python):
x=int(input())
ans=0
for b in range(1,int(x**(1/2)+1)):
    for p in range(1,11):
        if b**p<=x and b**p>ans:
            ans=b**p
print(ans)

Solution (Python):
x = int(input())

if x <= 3:
  print(x)
  exit()

ans = 0
for i in range(2, int(x**0.5)+1):
  s = 0
  t = 1
  while i**t <= x:
    s = i**t
    t += 1
  ans = max(ans, s)
print(ans)

Solution (Python):
X=int(input())
s=set(i**j for i in range(40) for j in range(2,10) if i**j<=X)
print(max(s))

Solution (Python):
X=int(input())
s=set(pow(i,j) for i in range(40) for j in range(2,10) if pow(i,j)<=X)
print(max(s))

Solution (Python):
X = int(input())
tab = set([1])
for i in range(1,X+1):
    for j in range(2,X+1):
        if i**j <= X:
            tab.add(i**j)
        else:
            break
print(max([i for i in tab]))

Solution (Python):
X = int(input())
tab = set([])
for i in range(1,1000):
    for j in range(2,1000):
        if i**j <= 1000:
            tab.add(i**j)
        else:
            break

print(max([i for i in tab if i <= X]))

Solution (Python):
x = int(input())
k = 0

for i in range(1,1000):
    for j in range(2,1000):
        if i ** j <= x:
            k = max(k,i ** j)
        else:
            break
    if x // 2 < i:
        break

print(k)

Solution (Python):
x=int(input())
ans=1
for b in range(2,50):
    n=b*b
    while n<=x:
        ans=max(ans,n)
        n*=b
print(ans)

Solution (Python):
import math
n = int(input())
ans = 1

for i in range(1,math.ceil(math.sqrt(n))):
    for j in range(2,11):
        if i ** j > n and j > 2:
            ans = max(ans,i ** (j-1))
            break

print(ans)

Solution (Python):
X = int(input())

ans = 1
for b in range(1, X + 1):
    for p in range(2, 11):
        a = b ** p
        if a <= X and ans < a:
           ans = a

print(ans)

Solution (Python):
x=int(input())
ma=1
for i in range(2,x):
  ex=i**2
  for j in range(x):
    if ex*i>x:
      if ex>ma and ex<=x:
        ma=ex
      break
    ex=ex*i
print(ma)

Solution (Python):
X = int(input())
ans = 0
for b in range(1, 1001):
    for p in range(2, 1001):
        if b**p <= X:
            if b**p > ans:
                ans = b**p
        else:
            break

print(ans)

Solution (Python):
import math as math
n = int(input())
li = [1]
nroot = int(math.sqrt(n))
for i in range(2,nroot+1):
    for j in range(2,100):
        if i**j <= n:
            li.append(i**j)
        else:
            break
print(max(li))

Solution (Python):
x = int(input())
if x <= 3:
  print(1)
  exit()
res = 0
for i in range(2, 33):
  for j in range(2, 12):
    a = i ** j
    if a <= x:
      res = max(res, a)
print(res)

Solution (Python):
X = int(input())

max_num = 1
for i in range(1, X + 1):
    for j in range(2, X + 1):
        num = i ** j
        if num <= X:
            if num > max_num:
                max_num = num
        else:
            break

print(max_num)

Solution (Python):
a=int(input())
result=[]
for i in range(1,a+1):
    for j in range(2,a+1):
        if j>=10:
            continue
        if i**j<=a:
            result.append(i**j)
result.append(1)
print(max(result))

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()


def main():
    X = int(input())
    if X < 4:
        print(1)
        return
    ans = 1
    for b in range(2, int(X ** 0.5) + 2):
        for p in range(11):
            if b ** p > X: break
            ans = max(ans, b ** p)
    print(ans)

if __name__ == "__main__":
    main()

Solution (Python):
def resolve():
    X = int(input())
    A = [1]
    for i in range(2, 33):
        for j in range(2, 11):
            tmp = i**j
            if tmp <= X:
                A.append(tmp)
            else:
                break
    print(max(A))


resolve()

Solution (Python):
X = int(input())
print(max(set(b**p for b in range(1,100) for p in range(2,10) if b**p<=X)))

Solution (Python):
x=int(input())
a=1
for b in range(1,x+1):
    for p in range(2,x+1):
        t=b**p
        if t>x:
            break
        a=max(a,t)
print(a)

Solution (Python):
x=int(input())
lst=[1]
for i in range(2,32):
    for j in range(2,10):
        if i**j<=1000:
            lst.append(i**j)

for i in range(1000):
    a=x-i
    if a in lst:
        print(a)
        exit()

Solution (Python):
import math
x=int(input())
ans=0
for i in range(1,32):
  for j in range(2,10):
    if i**j<=x:
      ans=max(ans,i**j)
print(ans)

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

Solution (Python):
X=int(input())
p=[]
p.append(1)
for i in range(2,1000):
  for j in range(2,10):
    p.append(pow(i,j))
p.sort()
ans=0
for i in range(len(p)):
  if p[i]>X:
    break
  ans=p[i]
print(ans)

Solution (Python):
def actual(X):
    pow_nums = [1]

    for i in range(2, 40 + 1):
        for j in range(2, 40 + 1):
            if i ** j <= 1000:
                pow_nums.append(i ** j)

    pow_nums = sorted(set(pow_nums))

    return [pow_num for pow_num in pow_nums if pow_num <= X][-1]


X = int(input())
print(actual(X))

Solution (Python):
x = int(input())

expo = [0]*(x+1)
expo[1] = 1

for i in range(2,x+1):
    v = i*i
    while v <= x:
        expo[v] = 1
        v *= i
        
for i in range(x,-1,-1):
    if expo[i]:
        print(i)
        exit()

Solution (Python):
n = int(input())
ex = [False]*(n+1)
ex[1] = True
for i in range(2, n+1):
    v = i*i
    if v>n: break
    while(v<=n):
        ex[v]=True
        v*=i
for i in range(1, n+1)[::-1]:
    if ex[i]:
        print(i)
        break

Solution (Python):
X = int(input())

beki = []

for i in range(1, 33):
    for j in range(2, 11):
        beki.append(i**j)

for i in range(X):
    if X-i in beki:
        print(X-i)
        exit()

Solution (Python):
x = int(input())
l = set([1])
i = 1
while i < x:
    j = 2
    while j < 10:
        if i**j <= x:
            l.add(i**j)
        j += 1
    i += 1

print(max(l))

Solution (Python):
x=int(input())

def pow(b,x):
    res=b
    while True:
        if res*b<=x:
            res=res*b
        else:
            break
    return res


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

Solution (Python):
x,l=int(input()),[0]*1001;l[1]=1
for i in range(2,int(x**0.5)+1):
  if l[i]==0:j=i*i
  while 1:
    if j>x:break
    else:l[j]=1;j*=i
for i in range(x,-1,-1):
  if l[i]==1:print(i);break

Solution (Python):
x,l=int(input()),[0]*1001;l[1]=1
for i in range(2,x+1):
  if l[i]==0:j=i*i
  while 1:
    if j>x:break
    else:l[j]=1;j*=i
for i in range(x,-1,-1):
  if l[i]==1:print(i);break

Solution (Python):
l=[0,1,0,0,1,0,0,0,1,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1]
for i in range(int(input()),0,-1):
  if l[i]==1:print(i);break

Solution (Python):
from collections import defaultdict

def readInt():
  return int(input())
def readInts():
  return list(map(int, input().split()))
def readChar():
  return input()
def readChars():
  return input().split()

x = readInt()
l = [0]*(x+1)
l[1]=1

for i in range(2,len(l)):
  if l[i]==0:
    j = i*i
    while 1:
      if j>len(l)-1:
        break
      else:
        l[j]=1
        j*=i


for i in range(len(l)-1,-1,-1):
  if l[i]==1:
    print(i)
    break

Solution (Python):
x = int(input())

if x == 1:
    print("1")
    exit()


def func(p):
    q = p
    while q < x:
        q *= p
        if q == x:
            return q
    if q / p == p:
        return 1
    else:
        return q // p


z = []
a = 2

while a <= x:
    z.append(func(a))
    a += 1

print(max(z))

Solution (Python):
x = int(input())
ans = 1
for b in range(1, x):
  for p in range(2, x):
    if b**p <= x: ans = max(ans, b**p)
    else: break
print(ans)

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

Solution (Python):
X = int(input())
A = []
k=20
for i in range(1,int(X**0.5)+1):
    for j in range(k):
        if i**j<=X:
            A.append(i**j)
        elif i++j > X:
            k = j+1
            break
print(max(A))

Solution (Python):
def is_prime(n):
    if n <= 1:
        return False

    for i in range(2, n):
        if n % i == 0:
            return False

    return True

X = int(input())
lis = [i for i in range(1,34)]
num = []

for i in lis:
    for j in range(2, 11):
        if i**j <= X:
            num.append(i**j)

print(max(num))

Solution (Python):
import sys, os, math, bisect, itertools, collections, heapq, queue

from decimal import Decimal
from collections import defaultdict



sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)


MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    if N == 1:
        print(1)
        exit()

    b, p = 2, 1
    ret = []
    while b ** p <= N:
        if b ** (p + 1) <= N:
            p += 1
            ret.append(b ** p)
        else:
            b += 1
            p = 1

    ret.sort(reverse=True)
    print(ret[0])


if __name__ == '__main__':
    main()

Solution (Python):
import math
X=int(input())
a=math.sqrt(X)
b=int(a)
ans=1
for i in range (2,b+1):
    for j in range(2,10):
        if i**j <=X <i**(j+1):
            ans=max(ans,i**j)
            break

print(ans)

Solution (Python):
def main():
    X = int(input())
    maxi = 1
    if X <= 2:
        print(1)
        return
    for b in range(2, X):
        for p in range(2, X):
            if b**p > X:
                break
            else:
                maxi = max(maxi, b**p)
    print(maxi)
main()

Solution (Python):
X=int(input())
ans=1
for a in range(2,33):
  for b in range(2,11):
    if a**b>X:
      break
    if a**b<=X and a**b>ans:
      ans=a**b
print(ans)

Solution (Python):
t = set([])

for i in range(1,32):
    for s in range(2,32):
        if i**s<1001:
            t.add(i**s)
            
t = list(t)

t.append(1001)

t.sort(reverse = True)

x = int(input())

for i in range(len(t)-1):
    if t[i]>x>=t[i+1]:
        print(t[i+1])
        break

Solution (Python):






X = int(input())





for i in range(X+1)[::-1]:
    for j in range(2,i):
        p = 2
        flag = False
        while flag == False:
            if j**p == i:
                print(i)
                flag = True
                break
            elif j**p > i:
                break
            else:
                p += 1
        if flag:
            break
    else:
        continue
    break
else:
    print(1)

Solution (Python):
x = int(input())
A = [a**b for a in range(1, 35) for b in range(2, 10) if a**b <= x]
A.sort()
print(A[-1])

Solution (Python):
s=set()
s.add(1)
x=1001
for i in range(2,1000):
    k=i*i
    while k<x:
        s.add(k)
        k*=i

l=[i for i in range(1001)]
for i in range(1,1001):
    if i in s:
        l[i]=i
    else:
        l[i]=l[i-1]
print(l[int(input())])

Solution (Python):
A=int(input())
B=[1]*8
for i in range(2,10):
  for j in range(A+1):
    if j**i <= A:
      B[i-2]= j**i
    else:break
print(max(B))

Solution (Python):
x = int(input())
ans = 1

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

Solution (Python):
def resolve():
    X = int(input())
    ans = 1
    for b in range(1000 + 1, 1, -1):
        for p in range(2, 10 + 1):
            if b ** p <= X:
                ans = max(ans, b ** p)
    print(ans)


resolve()

Solution (Python):
def mi():
    return map(int, input().split())

def ii():
    return int(input())

def main():
    X = ii()
    l = []
    for b in range(1, 1001):
        if b == 1:
            l.append(1)
            continue
        a = b*b
        while a <= X:
            l.append(a)
            a *= b
    print(max(l))

if __name__ == '__main__':
    main()

Solution (Python):
x = int(input())
count = 1
for i in range(1,x+1):
    for n in range(2,10):
        if i**n <= x:count = max(i**n,count)
print(count)

Solution (Python):
x = int(input())
count = 1
for i in range(1,x+1):
    for n in range(2,10):
        if i**n <= x:
            count = max(i**n,count)
print(count)

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

Solution (Python):
x=int(input())
ans=1
for i in range(1,1000+1):
    for j in range(2,11):
        if i**j<=x:
            ans=max(ans,i**j)

print(ans)

Solution (Python):
x=int(input())
ans=1
for i in range(1,1000+1):
    for j in range(2,11):
        if i**j<=x:
            ans=max(ans,i**j)

print(ans)

Solution (Python):
x=int(input())
ans=1
for i in range(1,1000+1):
    for j in range(2,11):
        if i**j<=x:
            ans=max(ans,i**j)

print(ans)

Solution (Python):
x=int(input())
ans=1
for i in range(1,1000+1):
    for j in range(2,11):
        if i**j<=x:
            ans=max(ans,i**j)

print(ans)

Solution (Python):
x=int(input())
ans=1
for i in range(1,1000+1):
    for j in range(2,11):
        if i**j<=x:
            ans=max(ans,i**j)

print(ans)

Solution (Python):
x=int(input())
ans=1
for i in range(1,1000+1):
    for j in range(2,11):
        if i**j<=x:
            ans=max(ans,i**j)

print(ans)

Solution (Python):
x=int(input())
ans=1
for i in range(1,1000+1):
    for j in range(2,11):
        if i**j<=x:
            ans=max(ans,i**j)

print(ans)

Solution (Python):
x=int(input())
ans=1
for i in range(1,1000+1):
    for j in range(2,11):
        if i**j<=x:
            ans=max(ans,i**j)

print(ans)

Solution (Python):
x=int(input())
ans=1
for i in range(1,1000+1):
    for j in range(2,11):
        if i**j<=x:
            ans=max(ans,i**j)

print(ans)

Solution (Python):
x=int(input())
ans=1
for i in range(1,1000+1):
    for j in range(2,11):
        if i**j<=x:
            ans=max(ans,i**j)

print(ans)

Solution (Python):
x=int(input())
ans=1
for i in range(1,1000+1):
    for j in range(2,11):
        if i**j<=x:
            ans=max(ans,i**j)

print(ans)

Solution (Python):
x=int(input())
ans=1
for i in range(1,1000+1):
    for j in range(2,11):
        if i**j<=x:
            ans=max(ans,i**j)

print(ans)

Solution (Python):
x=int(input())
ans=1
for i in range(1,1000+1):
    for j in range(2,11):
        if i**j<=x:
            ans=max(ans,i**j)

print(ans)

Solution (Python):
x=int(input())
ans=1
for i in range(1,1000+1):
    for j in range(2,11):
        if i**j<=x:
            ans=max(ans,i**j)

print(ans)

Solution (Python):
x=int(input())
ans=1
for i in range(1,1000+1):
    for j in range(2,11):
        if i**j<=x:
            ans=max(ans,i**j)

print(ans)

Solution (Python):
x=int(input())
ans=1
for i in range(1,1000+1):
    for j in range(2,11):
        if i**j<=x:
            ans=max(ans,i**j)

print(ans)

Solution (Python):
x=int(input())
ans=1
for i in range(1,1000+1):
    for j in range(2,11):
        if i**j<=x:
            ans=max(ans,i**j)

print(ans)

Solution (Python):
x=int(input())
ans=1
for i in range(1,1000+1):
    for j in range(2,11):
        if i**j<=x:
            ans=max(ans,i**j)

print(ans)

Solution (Python):
from math import sqrt
X = int(input())
N = int(sqrt(X))
ans = N**2
for i in range(N,0,-1):
  for j in range(X):
    if abs(X-i**j) < abs(X-ans) and i**j <= X:
      ans = i**j

print(ans)

Solution (Python):
X = int(input())
ans = 0
for i in range(1, 33):
    for j in range(2, 11):
        if i**j > X:
            break
        ans = max(ans, i**j)
print(ans)

Solution (Python):
x = int(input())

ans = 0
for i in range(1,32):
    for p in range(2,10):
        y = i**p
        if y > 1000:
            break
        if ans < y <= x:
            ans = y
print(ans)

Solution (Python):
import sys
input = sys.stdin.buffer.readline

def main():
    x = int(input())

    b = 1
    p = 2

    a = []

    for i in range(int(x ** 0.5) + 1):
        for j in range(int(x ** 0.5) + 1):
            if (b+i) ** (p+j) <= x:
                a.append((b+i) ** (p+j))

    print(max(a))

if __name__ == '__main__':
    main()

Solution (Python):
X=int(input())
check=[False]*(X+1)
check[1]=True
for i in range(2,X+1):
  temp=i*i
  while temp<=X:
    check[temp]=True
    temp*=i
for i in range(X,0,-1):
    if check[i]==True:
      print(i)
      exit()

Solution (Python):
import math
x = int(input())
if x == 1 or x== 2 or x==3:
  print(1)
  exit()

s = math.floor(math.sqrt(x))

def l(k,p):
  q = int(math.floor(math.log(p)/math.log(k)))
  if k ** (1+q) <= p:
    return(1+q)
  else:
    return(q)

ans = 0
for i in range(2,s+1):
  ans = max(ans, i ** l(i,x))
  if ans == x:
    print(x)
    exit()
  
print(ans)

Solution (Python):
import math
x = int(input())
if x == 1 or x== 2 or x==3:
  print(1)
  exit()

s = math.floor(math.sqrt(x))

def l(k,p):
    return(int(math.floor(math.log(p)/math.log(k))))

ans = 0
for i in range(2,s+1):
  if i ** (1 + l(i,x)) <= x:
    ans = max(ans, i ** (1+l(i,x)))
  else:
    ans = max(ans, i ** l(i,x))
  if ans == x:
    print(x)
    exit()
  
print(ans)

Solution (Python):
from bisect import bisect_right

x = int(input())
l = []

for i in range(2, 10):
    j = 1
    while j ** i <= 1000:
        y = j ** i
        if y not in l:
            l.append(y)
        j += 1

l.sort()
print(l[bisect_right(l, x)-1])

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

Solution (Python):
x=int(input())
hantei=1
for i in range(2,33):
  jou=2
  while i**jou<=x:
    if hantei< i**jou:
      hantei=i**jou
    jou+=1
print(hantei)

Solution (Python):
x=int(input())
ans=0
for i in range(2,10):
    for j in range(1,1001):
        tmp=j**i
        if tmp<=x:
            ans=max(tmp,ans)
print(ans)

Solution (Python):
import math

if __name__ == '__main__':
    n =int(input())
    a = int(math.sqrt(n))

    max=1
    for i in range(2,a+1):
        now = i*i
        while now <= n:
            if max < now:
                max =now
            now = now*i
    print(max)

Solution (Python):
x=int(input())
l=[]

if x==1:
    print(1)

else:

    for i in range(2,x+1):
        for j in range(1,x+1):
            y=j**i
            if y<=x:
                l.append(y)
            elif y>x:
                break
    print(max(l))

Solution (Python):
import math

X = int(input())
ans = 1
flg = False
for i in range(X, 0, -1):
    if flg:
        break
    for j in range(2, int(math.sqrt(i)) + 1):
        temp = i
        while True:
            if temp % j != 0:
                break
            elif temp / j == 1:
                print(i)
                flg = True
            temp = temp // j
        if flg:
            break
if not flg:
    print(1)

Solution (Python):
x = int(input())
c = [1]
for i in range(2,32):
    num = 2
    while i**num <= x:
        c.append(i**num)
        num += 1
print(max(c))

Solution (Python):
n = int(input())

max_ = 1
for i in range(2, n):
  k = i
  c = 1
  while k <= n:
    k *= i
    c += 1
  if c > 2:
    max_ = max(max_, k//i)
print(max_)

Solution (Python):
x = int(input())

ans = []
if x == 1:
  print(1)
  exit()

for i in range(2,x+1):
  for j in range(2,x+1):
    if i**j > x:
      break
    ans.append(i**j)

if len(ans)==0:
  print(0)
else:
  print(max(ans))

Solution (Python):
x = int(input())
ans = 0
for b in range(1, 32): 
    for p in range(2, 10): 
        tmp = b**p
        if tmp <= x and tmp >= ans:
            ans = tmp
print(ans)

Solution (Python):

import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

X = ir()
answer = 1
for y in range(2, X):
    temp = y * y
    if temp > X:
        continue
    while temp * y <= X:
        temp *= y
    if temp > answer:
        answer = temp

print(answer)

Solution (Python):
X = int(input())

dammy=[]
for b in range(1,101):
    for p in range(2,10):
        dammy.append(b**p)
        dammy.sort()

for i in range(101):
    if dammy[i]>X:
        print(dammy[i-1])
        break

Solution (Python):
X = int(input())
count = [1]
for x in range (2,50):
    for y in range (2,10):
        if x ** y <= X:
            count.append(x ** y)
print(max(count))

Solution (Python):
x=int(input())

s=set([1])

for b in range(2,x):
  for p in range(2,11):
    if b**p>x:
      break
    s.add(b**p)
print(max(s))

Solution (Python):
X = int(input())

if X == 1:
    print(1)
    exit()

ans = [False] * (X + 1)
for i in range(2, X + 1):
    v = i * i
    while v <= X:
        ans[v] = True
        v *= i

for i in range(X, -1, -1):
    if ans[i]:
        print(i)
        exit()

Solution (Python):
X = int(input())
A = []
for i in range(1,X+1):
    for j in range(2,100):
        if i**j > X:
            break
        A.append(i**j)
print(max(A))

Solution (Python):
n = int(input())
ans = 0
for i in range(1,1000):
  for j in range(2, 10):
    if i**j <= n:
      ans = max(ans, i**j)
print(ans)

Solution (Python):
import math
x=int(input())
lis=[1]
for i in range(2,math.ceil(math.sqrt(x))):
  n=i*i
  while n<=x:
    lis.append(n)
    n*=i

print(max(lis))

Solution (Python):
X = int(input())
ans = 10 ** 9
for i in range(1,32):
  for j in range(2,10):
    if i ** j <= X: ans = min(ans,X -  i ** j)
print(X - ans)

Solution (Python):
import math
x = int(input())
ans = 0
for b in range(1, int(math.sqrt(x))+1):
    p = 1
    if b != 1:
        while b**p <= x:
            p += 1
    if b**(p-1) > ans:
        ans = b**(p-1)
print(ans)

Solution (Python):
import sys
import math
x = int(input())
ans = 0
for i in range(1, x+1):
    for j in range(2, x+2):
        if pow(i, j) <= x:
            ans = max(pow(i, j), ans)
        else:
            break
print(ans)

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

Solution (Python):
import math
f= False

x=int(input())
for i in range(x):
	for j in range(1, 1+int(math.sqrt(x))):
		for k in range(2,10):
			if x == j**k:
				print(x)
				f=True
				break
		if f:
			break
	if f:
		break
	x-=1

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

Solution (Python):
import collections

def primes(x):
    res = []
    a = 2
    while x >= a*a:
        while x % a == 0:
            x //= a
            res.append(a)
        a += 1
    if x != 1:
        res.append(x)
    return res

x = int(input())
if x < 4:
    print(1)
else:
    for i in reversed(range(2,x+1)):
        p = primes(i)
        ctr = collections.Counter(p)
        cnt = ctr[p[0]]
        if cnt >= 2 and all([cnt == v for v in ctr.values()]):
            print(i)
            break

Solution (Python):
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

x = ni()

num = 1

for i in range(100):
  for j in range(2,10):
    if i**j <= x:
      num = max(num,i**j)

print(num)

Solution (Python):
import math
x = int(input())
ans = 1 
n = math.floor(math.sqrt(x))
for i in range(2, n+1): 
    a = i 
    while a < x:
        a *= i 
        if a <= x: ans = max(ans, a)
print(ans)

Solution (Python):
x = int(input())

tmp = 2
ans = 1

while tmp*tmp <= x:
    cur = tmp*tmp
    while cur*tmp <= x:
        cur *= tmp
    ans = max(ans, cur)
    tmp += 1

print(ans)

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

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

Solution (Python):
import math
x = int(input())
if x < 4:
    print(1)
    exit()

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

Solution (Python):
import math
x = int(input())

L = []
for i in range(2,int(math.floor(math.sqrt(x)))+1):
  for j in range(x//i + 1):
    if i ** j <= x:
      L.append(i ** j)
      
if L == []:
  print("1")
else:
  print(max(L))

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

ans = [1]
limit = int(math.sqrt(X))
for i in range(2, limit+1):
    p = 2
    while i ** p <= X:
        ans.append(i ** p)
        p += 1

print(max(ans))

Solution (Python):
X = int(input())
m = 1
for b in range(2, X):
    p = 2
    while b ** p <= X:
        m = max(b ** p, m)
        p += 1
print(m)

Solution (Python):
x = int(input())
ans =[1]
for i in range(2,x):
  b=i
  p=2
  while b**p<=x:
    if b**p<=x:
      ans.append(b**p)
    p +=1
print(max(ans))

Solution (Python):
x = int(input())
ans = [1]
for i in range(2, x):
  b = i
  p = 2
  while b ** p <= x:
    if b ** p <= x:
      ans.append(b ** p)
    p += 1
print(max(ans))

Solution (Python):
import sys
n = int(input())
nums = [125,216,343,1000]
for i in range(n,0,-1):
    if i in nums:
        print(i)
        sys.exit()
    if ((i**(1/2))%1 == 0) or ((i **(1/3))%1 == 0) or  ((i **(1/5))%1 == 0) or ((i **(1/7))%1 == 0) or ((i **(1/9))%1 == 0):
        print(i)
        sys.exit()
print(1)

Solution (Python):
x=int(input())
ans=0
for i in range(1,32):
  for j in range(2,10):
    if x>=i**j:
      ans=(max(ans,i**j))
print(ans)

Solution (Python):
x = int(input())

ans = 0
for b in range(1, 1001):
    for n in range(2, 10):
        a = b ** n
        if a <= x:
            ans = max(ans, a)
print(ans)