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):
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

x = int(input())


if x < 4:
    print(1)
else:
    for i in range(x,3,-1):
        if len(factorization(i)) == 1:
            if factorization(i)[0][1] != 1:
                print(i)
                
                break
        else:
            for k in range(1,len(factorization(i))):
                if factorization(i)[k-1][1] != factorization(i)[k][1] or factorization(i)[k-1][1] == 1:
                    break
            else:
                print(i)
                break

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

for j in range(10, 1, -1):
    if int(pow(X, (1/j)) + 1)**j <= X:
        ans = max(int(pow(X, (1/j))+1)**j, ans)
    else:
        ans = max(int(pow(X, (1/j)))**j, ans)

print(ans)

Solution (Python):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from heapq import heapify, heappop, heappush
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

X = INT()











def prime_decomposition(n):
    i = 2
    table = []
    while i * i <= n:
        while n % i == 0:
            n /= i
            table.append(i)
        i += 1
    if n > 1:
        table.append(n)
    return table

x = X
r = [1]
for i in range(2, x + 1):
    c = 2
    while i ** c <= x:
        r.append(i ** c)
        c += 1
ans = sorted(r)[-1]
print(ans)


exit()


for x in range(X, 0, -1):
    prime = prime_decomposition(x)
    c = Counter(prime)
    
    value = c.values()
    
    print(c)
    for v in value:
        d = v
    if len(c) == 1 and d >= 2:
        print(x)
        exit()
    elif x == 1:
        print(x)
        exit()

Solution (Python):
from math import sqrt
X=int(input())
ans=0
for i in range(1,int(sqrt(X))+1):
    now=i
    b=2
    while i!=1 and X>=i**b:
        now=i**b
        b+=1
    ans=max(ans, now)
print(ans)

Solution (Python):
x = int(input())
num = [1,1001]
for i in range(2,33):
    j = 2
    while i**j<=1000:
        num.append(i**j)
        j += 1
num = sorted(num)

def binary_search(li,k):
    left = 0
    right = len(li)
    while left < right:
        mid = (left+right)//2
        if li[mid]<=x and x<li[mid+1]:
            return li[mid]
        elif li[mid] < x:
            left = mid+1
        else:
            right = mid
print(binary_search(num,x))

Solution (Python):
from heapq import heappush, heappop
from itertools import permutations, accumulate, combinations
from math import pi, ceil, floor
import numpy as np
from collections import defaultdict, deque
from operator import itemgetter
from bisect import bisect_left, bisect_right, insort_left, insort_right
import sys
input = sys.stdin.readline


INF = float("inf")


def main():
    n = int(input())
    ans = 1
    now = 1
    for i in range(2, int(n ** 0.5) + 1):
        j = 1
        while i ** j <= n:
            now = i ** j
            j += 1
        ans = max(ans, now)
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
x=int(input())
if x==1000:
  print(1000)
  exit()
l=[1]
for i in range(2,32):
  k=2
  while i**k<=1000:
    l.append(i**k)
    k+=1
l=sorted(l)
for i in range(len(l)-1):
  if l[i]<=x<l[i+1]:
    print(l[i])
    exit()
print(961)

Solution (Python):
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_tuple(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_col(H):
    '''
    H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) 
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret)))


def read_matrix(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    


MOD = 10**9 + 7
INF = 2**31  

from collections import defaultdict, Counter, deque
from operator import itemgetter
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  

X = read_a_int()



candi = []
for i in range(1, 1000 + 1):
    for j in range(2, 11):
        tmp = pow(i, j)
        if tmp > 1000:
            break
        candi.append(tmp)
candi.sort()
print(candi[bisect_right(candi, X) - 1])

Solution (Python):

















import sys
sys.setrecursionlimit(10000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    x = int(input())
    
    a = 1
    for i in range(1,x):
        for j in range(2,x):
            if i**j <= x:
                a = max(a,i**j)
            else:
                break
    print(a)
if __name__ == '__main__':
  main()

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

Solution (Python):
k = []
for i in range(1,40):
  for j in range(2,30):
    if i**j <= 1000:
      k.append(i**j)
L = set(k)
P = list(L)
P.sort()
X = int(input())
ans = 0
if X == 1000:
  print(1000)
else:
  for i in range(len(P)):
    if X<P[i]:
      print(ans)
      break
    else:
      ans = P[i]

Solution (Python):
x = int(input())
n = [1]
for i in range(2, 1001):
    p = 2
    while i ** p <= 1000:
        n.append(i ** p)
        p += 1
while not x in n:
    x -= 1

print(x)

Solution (Python):
x=int(input())
a=set()
for i in range(1,1001):
  for j in range(2,34):
    t=i**j
    if t<=x:
      a.add(i**j)
a=list(a)
a.sort()
print(a[-1])

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

for i in range(x,-1,-1):
  for k in range(int(i**0.5)+1):
    for j in range(11):
      if k**j>i:
        break
      if k**j==i:
        print(i)
        exit()

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

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

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

ans = 0
for i in range(1,1001):
    for j in range(2,11):
        tmp = i ** j
        if tmp <= X:
            ans = max(ans, i ** j)

print(ans)

Solution (Python):
x = int(input())
ans = 1
if x == 1:
  print(ans)
  exit()
for i in range(x//2):
  if i**2 <= x < (i+1)**2:
    ans = i**2
    break
    
for i in range(3,10):
  for j in range(ans):
    if ans < j**i <= x:
      ans = j**i
      
print(ans)

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

print(ans)

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    x = int(input())
    m = 0
    for i in range(1, 1000):
        for j in range(2, 100):
            k = pow(i, j)
            if k <= x:
                m = max(m, k)
    print(m)


if __name__ == '__main__':
    resolve()

Solution (Python):
x = int(input())
ma = 0
for i in range(1,100):
    for j in range(2,100):
        if i**j <= x:
            ma = max(ma,i**j)
print(ma)

Solution (Python):
def main():
    x = int(input())
    answer = 1
    b = 2
    while b <= x:
        p = 2
        while pow(b, p) <= x:
            answer = max(answer, pow(b, p))
            p += 1
        b += 1
    print(answer)


if __name__ == '__main__':
    main()

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

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

Solution (Python):
def main():
    X = int(input())
    ans = set()
    for i in range(1, 1000):
        for p in range(2, 30):
            if X < i**p:
                break
            ans.add(i**p)
    print(max(ans))


if __name__ == '__main__':
    main()

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

for i in range(1,33):
    for j in range(2,11):
        if x >= i**j:
            ans.append(i**j)
print(max(ans))

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

for i in range(1,34):
    for j in range(2,11):
        if x >= i**j:
            ans.append(i**j)
print(max(ans))

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

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

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

beki = []
for i in range(1,32):
    beki.append(i**2)
for i in range(1,11):
    beki.append(i**3)
for i in range(1,6):
    beki.append(i**4)
for i in range(1,4):
    beki.append(i**5)
for j in range(6,10):
    beki.append(2**j)
    
beki = sorted(beki, reverse=True)
for a in beki:
    if a <= X:
        print(a)
        break

Solution (Python):
x=int(input())
ans = 1
if x>=4:
  b=2
  while b**2<=x:
    p=2
    while b**p<=x:
      p+=1
    if b**(p-1)>ans:
      ans=b**(p-1)
    b+=1
print(ans)

Solution (Python):
import math
x = int(input())
ans = 1
for i in range(2, int(x ** 0.5) + 1):
    p = 1
    while i ** p <= x:
        p += 1
    ans = max(ans, i ** (p - 1))
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):
n = int(input())
array = []
array.append(1)
for i in range(2,32):
  cnt = 2
  num = i**cnt
  while num<=1000:
    array.append(num)
    cnt += 1
    num = i**cnt 

array.sort()
ans = 0
l = len(array)
for i in range(l):
  if array[i]<=n:
    ans = array[i]
print(ans)

Solution (Python):
import sys

input = lambda: sys.stdin.readline().rstrip()

N = int(input())
expo = set()
for i in range(1, 32):
    for j in range(2, 10):
        if i ** j > 1000:
            break
        expo.add(i ** j)
expo = sorted(list(expo), reverse=True)
for e in expo:
    if e <= N:
        print(e)
        exit()

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

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

ans = 1
for i in range(int(math.sqrt(X))+1):
    for j in range(int(math.sqrt(X))+1):
        if i**j <= X and ans < i**j:
            ans = i**j
print(ans)

Solution (Python):
import math
n=int(input())
ans = 1
for i in range(int(math.sqrt(n))+1):
  for j in range(int(math.sqrt(n))+1):
    if i**j <= n and ans < i ** j:
      ans = i**j
print(ans)

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

res = 1
for i in range(2,x+1):
    p = 2
    while i**p<=x:
        res = max(res,i**p)
        p += 1
print(res)

Solution (Python):
x = int(input())
mx = 1
for i in range(2,32):
  j = 2
  while i**j <= x:
    if i**j > mx:
      mx = i**j
    j += 1
print(mx)

Solution (Python):

import sys


def ilog(b: int, x: int):
    if b == 1:
        return 0
    lb = 0
    rb = x.bit_length()
    while lb + 1 < rb:
        m = (lb + rb) // 2
        if b ** m <= x:
            lb = m
        else:
            rb = m
    return lb


def solve(X: int):
    print(max(
        b ** ilog(b, X)
        for b in range(1, X + 1)
        if b ** 2 <= X
    ))


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  
    solve(X)


if __name__ == '__main__':
    main()

Solution (Python):
import math
X = int(input())
maxv = [1]

for i in range(1,32):
    for j in range(2,11):
        if i**j > X:
            if j != 2:
                maxv.append(i**(j-1))
            break

print(max(maxv))

Solution (Python):


data=int(input())

array=[]

for i in range(1,34):
  for j in range(2,11):
    if (i**j)<=data:
      array.append(i**j)

print(max(array))

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

Solution (Python):
















X = int(input())
ans = 0
if X == 1:
    ans = 1
else:
    for i in range(2,33):
        j = i
        while j*i<=X:
            ans = max(j*i,ans)
            j = j*i
print(ans)

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

num_list = []
for i in range(1, 33):
    if i ** 2 > X:
        break
    for j in range(2, 11):
        N = i ** j
        if N > X:
            break
        else:
            num_list.append(N)
print(sorted(set(num_list))[-1])

Solution (Python):
N = int(input())
ans = []
for i in range(1,35):
    for j in range(2,11):
        if i**j <= N:
            ans.append(i**j)
print(max(ans))

Solution (Python):
x = int(input())
a = set([1])
for i in range(2, -~1000):
    b = i**2
    while b <= x:
        a = a | set([b])
        b *= i
print(sorted(a)[-1])

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

ans_list = [1]

for i in range(2,x+1):
    cnt = 2
    while True:
        tmp = i ** cnt
        if tmp > x:
            break
        ans_list += [tmp]
        cnt += 1
        
    
ans_list.sort()

for i in ans_list[::-1]:
    if i <= x:
        print(i)
        break

Solution (Python):
X = int(input())
List = [0]*(X+1)
List[1] = 1
for i in range(2,X+1):
    v = i**2
    while(v<=X):
        List[v]=1
        v*=i
        
for i in range(1,X+1)[::-1]:
    if List[i]==1:
        print(i)
        break

Solution (Python):
X = int(input())
List = [0]*(X+1)
List[1] = 1
for i in range(2,X+1):
    v = i**2
    while(v<=X):
        List[v]=1
        v*=i
        
for i in range(1,X+1)[::-1]:
    if List[i]==1:
        print(i)
        break

Solution (Python):
import math, sys
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from copy import deepcopy
from functools import lru_cache
from heapq import heapify, heappop, heappush
from itertools import accumulate, combinations, permutations
input = sys.stdin.readline
mod = 10**9 + 7
ns = lambda: input().strip()
ni = lambda: int(input().strip())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

def main():
    x = ni()

    ans = [1]

    for b in range(2, int(x**0.5) + 1):
        p = 2
        while b**p <= x:
            ans.append(b**p)
            p += 1
            
    print(max(ans))

if __name__ == '__main__':
    main()

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

used = {}
for b in range(2,int(math.sqrt(x))+1):
  p=2
  while(b**p<=x):
    used[b**p]=True
    p+=1

ans=0
for key in used.keys():
  ans = max(ans,key)

print(ans)

Solution (Python):
icase=0
if icase==0:
    bpmax=0
    x=int(input())
    for b in range(1,32):
        for p in range(2,10):
            bp=b**p
            if bp<=x:
                bpmax=max(bpmax,bp)
            else:
                break
    print(bpmax)

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

Solution (Python):
X=int(input())
H=[1]

i=2
while i<=X**0.5:
    j=2
    while i**j<=X:
        H.append(i**j)
        j+=1
    i+=1

print(sorted(H)[-1])

Solution (Python):
def main():
  ans = 0
  n = int(input())
  if n == 1:
    ans = 1
  else:
    for i in range(1, n//2 + 1):
      for j in range(2, 10):
        if ans < i**j <= n :
          ans = i**j
  print(ans)

if __name__ == '__main__':
  main()

Solution (Python):
import sys
X = int(input())
for i in range(X, 0, -1):
    for j in range(1,32):
        for k in range(2,10):
            if i == j ** k:
                print(i)
                sys.exit()

Solution (Python):

def myAnswer(X:int) -> int:
   numbers = [i for i in range(2,X+1)]
   ans = 1
   for p in numbers:
      i = 2
      while True:
         if(p**i <= X):
            ans = max(p**i,ans)
            i += 1
         else:
            break
   return ans


def modelAnswer():
   tmp=1
def main():
   X = int(input())
   print(myAnswer(X))
if __name__ == '__main__':
   main()

Solution (Python):
import math

X = int(input())
maxBeki = 1
for b in range(1, X, 1):
    for p in range(2, X, 1):
        if b**p <= X:
            maxBeki = max(maxBeki, b ** p)
        else:
            break
print(maxBeki)

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())
ans = 1
for i in range(2, int(x ** 0.5) + 1):
    j = 1
    while i ** j <= x:
        ans = max(ans, i ** j)
        j += 1
print(ans)

Solution (Python):
X = int(input())
se = set(n**e for n in range(32) for e in range(2,11) if n**e <= X)

answer = max(se)
print(answer)

Solution (Python):










from bisect import bisect

exp = [1, 4, 8, 9, 16, 16, 25, 27, 32, 36, 49, 64, 64, 64, 81, 81, 100, 121, 125, 128, 144, 169, 196, 216, 225, 243,
       256, 256, 256, 289, 324, 343, 361, 400, 441, 484, 512, 512, 529, 576, 625, 625, 676, 729, 729, 729, 784, 841,
       900, 961, 1000]

x = int(input())
print(exp[bisect(exp, x) - 1])

Solution (Python):
List=[1]
for i in range(2,32):
  j=2
  while(i**j<=1000):
    List.append(i**j)
    j+=1

x=int(input())
for i in range(x,0,-1):
  if (List.count(i)>0):
    print(i)
    break

Solution (Python):
import math
def main():
    X = int(input())
    ma = 1
    for b in range(2, X):
        for p in range(2, X):
            if b**p <= X:
                if ma < b**p:
                    ma = b**p
            else:
                break
    print(ma)  
main()

Solution (Python):

x = int(input())
e = 0

if x == 1:
    e = 1
else:
    for b in range(1, x + 1):
        for p in range(2, x + 1):
            if b ** p > x:
                break
            else:
                e = max(e, b ** p)

print(e)

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

num = 1
for i in range(1 ,int(sqrt(x) + 1)):
    for j in range(2, 100):
        if i ** j <= x:
            num = max(num, i ** j)
        else:
            break 

print(num)

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



ans = 0
i = 1
p = 2
if x == 1:
    print(1)
else:
    while p <= 1000:
        while pow(p, i) <= x:
            if pow(p, i)<= x:
                ans = max(ans, pow(p, i))
            i += 1
        i = 2
        p += 1
    print(ans)

Solution (Python):
import math
X = int(input())
c = 1
for b in range(2,math.floor(math.sqrt(X)+1)):
  p = 2
  while b**p <= X:
    p+=1
  c = max(c,b**(p-1))
print(c)

Solution (Python):
import sys
IS = lambda: sys.stdin.readline().rstrip()
II = lambda: int(IS())
MII = lambda: list(map(int, IS().split()))

def main():
    x = II()
    if x == 1: print(1); exit(0)
    b = 2; p = 2
    maxv = 0
    while True:
        if b**2 > x: break
        if b**p > x:
            maxv = max(maxv, b**(p-1))
            b += 1; p = 2
            continue
        p += 1
    print(maxv)

if __name__ == '__main__':
    main()

Solution (Python):
n=int(input())
q=[j**k for j in range(1,32) for k in range(2,11)]
for i in range(len(q)):
  if q[i]>1000:
    q[i]=0
q.sort(reverse=True)
x=0
while q[x]>n:
  x+=1
print(q[x])

Solution (Python):
import math

x = int(input())

ans = 0
exponent = []

for i in range(1,int(math.sqrt(x))+1):
  for j in range(2, int(math.log(x, 2))+1):
    ans = i ** j
    exponent.append(ans)

exponent.sort()
exponent = [i for i in exponent if i <= x]

if x == 1:
  print(1)
else:
  print(max(exponent))

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

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

ans = 1
for b in range(2, X + 1):
    p = 2
    while True:
        res = b ** p
        if (res > X):
            break
        else:
            p += 1
            ans = max(ans, res)

print(ans)

Solution (Python):
r = range(1,32)
x = int(input())
print(max(b**p for p in r[1:] for b in r if b**p <= x))

Solution (Python):
a=int(input())
b=set()
ans=0
for i in range(1,a+1):
    for j in range(1,33):
        for k in range(2,10):
            if j**k==i:
                ans=i
print(ans)

Solution (Python):
X = int(input())
ans = 1
for b in range(1,101):
    for p in range(2,10):
        if X >= b**p and b**p > ans:
            ans = b**p
print(ans)

Solution (Python):
X = int(input())
ans = 1
for b in range(1,101):
    for p in range(2,10):
        if X >= b**p and b**p > ans:
            ans = b**p
print(ans)

Solution (Python):
N = int(input())
li = []
for i in range(1,100):
    for j in range(2,20):
        if i**j<=10000:
            li.append(i**j)
li2 = list(set(li))
li2.sort()
ans = 0
for k in range(len(li2)):
    if (li2[k-1]<=N)&(li2[k]>N):
        ans = li2[k-1]
print(ans)

Solution (Python):
N = int(input())
max_n = 0
for i in range(1000+1):
  for j in range(2,1000+1):
    if i**j > max_n:
      if i**j <=N:
        max_n = i**j
      else:
        break 
print(max_n)

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

p = [1]

for i in range(1, X):
    for j in range(2, 11):
        if i**j <= X:
            p.append(i**j)
        else:
            break

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

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

y=sorted(y)
print(y[-1])

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

l = []
for i in range(1, 32):
    for j in range(2, 10):
        if i ** j <= 1000:
            l.append(i ** j)

l = sorted(list(set(l)), reverse = True)

for i in range(len(l)):
    if l[i] <= X:
        print(l[i])
        break

Solution (Python):

import math
X = int(input())
ans = 0

for i in range(1, math.floor(math.sqrt(X)+1)):
    for j in range(1, math.floor(math.sqrt(X)+1)):
        if i**j <= X:
            ans = max(i**j, ans)
print(ans)

Solution (Python):
x=int(input())
l=[]
for i in range(1,x+1):
    for k in range(2,11):
        z = i**k
        if z <= x:
            l.append(z)
print(max(l))

Solution (Python):
x=int(input())
l=[]
for i in range(1,1000+1):
    for k in range(2,11):
        z = i**k
        if z <= x:
            l.append(z)
print(max(l))

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

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

res = []
for i in range(1, 33):
  for j in range(2, 10):
    cand = i ** j
    if x >= cand:
      res.append(cand)
res = sorted(res)
print(res[-1])

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

root_list=[]
for i in range(1,33):
  for j in range(2,10):
    if i**j<=X:
      root_list.append(i**j)

root_list.sort()

print(root_list[-1])

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

if __name__ == "__main__":
    main()

Solution (Python):
x = int(input())
ans = 0
for i in range(1,100)[::-1]:
  for j in range(2,11)[::-1]:
    if i**j <= x:
      ans = max(ans, i**j)
print(ans)

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

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

b = 2
ans = 0

while b ** 2 <= X:
    p = 2
    while b ** p <= X:
        p += 1
    ans = max(ans, b ** (p-1))
    b += 1

print(ans)

Solution (Python):
x = int(input())
print(sorted([b ** p if b ** p <= x else 1 for b in range(1, 1001) for p in range(2, 11)])[-1])

Solution (Python):
x = int(input())
a = list()
a.append(1)
for i in range(2,32):
    j = 2  
    while i**j<1001:
        a.append(i**j)
        j= j+1
a = sorted(a)[::-1]
for i in range(len(a)):
    if a[i]<=x:
        print(a[i])
        break

Solution (Python):
x = int(input())
s = []
for p in range(2, 11):
    for b in range(1, 1001):
        if b ** p <= x:
            s.append(b ** p)
        else:
            break
print(sorted(s)[-1])

Solution (Python):
from __future__ import print_function

import sys

import re
import array
import copy
import functools
import operator

import math
import string
import fractions
from fractions import Fraction
from fractions import gcd



import collections
import itertools
import bisect

import random
import time

import heapq
from heapq import heappush
from heapq import heappop
from heapq import heappushpop
from heapq import heapify
from heapq import heapreplace
from queue import PriorityQueue as pq
from queue import Queue

from itertools import accumulate

from collections import deque
from collections import Counter

from operator import mul
from functools import reduce

input = sys.stdin.readline


def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return


def lcm(n, m):
    return int(n * m / gcd(n, m))


def coprimize(p, q):
    common = fractions.gcd(p, q)
    return (p // common, q // common)


def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom


def find_gcd(list_l):
    x = reduce(gcd, list_l)
    return x


def main():
    X = int(input().strip())
    if X==1:
        print(1)
        return
    ans=0
    for i in range(2,32):
        for j in range(2,100000):
            if i**j>X:
                break
            else:
                ans=max(ans,i**j)
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
x=int(input())
beki=1
for b in range(1,int(1000*0.5)+1):
    for p in range(2,10):
        if b**p<=x:
            beki=max(beki,b**p)
print(beki)

Solution (Python):
import sys

def resolve():
    X = int(input())
    cands = [1, 4, 8, 9, 16, 25, 27, 32, 36, 49, 64, 81, 100, 121, 125, 128, 144, 169, 196, 216, 225, 243, 256, 289, 324, 343, 361, 400, 441, 484, 512, 529, 576, 625, 676, 729, 784, 841, 900, 961, 1000]
    for i in range(len(cands)):
        if cands[i] > X:
            print(cands[i-1])
            return
    print(cands[-1])

if '__main__' == __name__:
    resolve()

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

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

b = 2
ans = 0
while b ** 2 <= x:
    p = 2
    while b ** p <= x:
        p += 1
    ans = max(ans, b ** (p-1))
    b += 1
print(ans)

Solution (Python):

import math

X = int(input())


ans = 0
for i in range(int(math.sqrt(X))+1):
    for x in range(11):
        
        if i**x <= X and i**x > ans:
            ans = i**x
print(ans)

Solution (Python):
a = int(input())
b = [1]
for i in range(2, 100):
    for j in range(2,100):
        b.append(i**j)
b.sort()
for i in range(1,len(b)):
    if b[i] > a:
        print(b[i-1])
        break

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

ans = 1

for i in range(2,int(X**0.5)+1):
    tmp = 1
    while tmp * i <= X:
        tmp *= i
    ans = max(ans,tmp)
    
print(ans)

Solution (Python):
import math
X = int(input())
i_max = math.floor(math.sqrt(X))

result = 1
for i in range(2,i_max+1,1):
    for j in range(2,X):
        n = (i**j)
        if (n > X):
            break
        else:
            result = max(result, n)

print(result)

Solution (Python):
import math
X = int(input())
i_max = math.floor(math.sqrt(X))

result = 1
for i in range(2,i_max+1,1):
    for j in range(1,X):
        n = (i**j)
        if (n > X):
            break
        else:
            result = max(result, n)

print(result)

Solution (Python):
import sys
x = int(input())
if (x == 1000):
    print(1000)
    sys.exit()
list = []
list.append(1)
for i in range(30):
    tmp = (i+2)**2
    while (tmp <= 1000):
        list.append(tmp)
        tmp = tmp*(i+2)
list.sort()
tmp = list[0]
for i in list:
    if (i > x):
        print(tmp)
        sys.exit()
    tmp = i

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

Solution (Python):
x = int(input())
vis = [False for _ in range(x+1)]
vis[1] = True
for i in range(2,x+1):
  tmp = i*i
  while tmp < x+1:
    vis[tmp] = True
    tmp *= i
best = 1
for i in range(1,x+1):
  if vis[i]:
    best = i
print(best)

Solution (Python):
x=int(input())
l=[1]
for i in range(2,int(x**0.5)+1):
    j=1
    while i**(j+1)<=x:
        j+=1
    l.append(i**j)


print(max(l))

Solution (Python):
L = [0 for _ in range(1001)]
L[1] = 1
for i in range(2, 32):
  base = i * i
  while base <= 1000:
    L[base] = 1
    base *= i
X = int(input())
while L[X] == 0:
  X -= 1
print(X)

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

lst=[1]
for p in range(2,10):
    i=2
    while i ** p <= X:
        lst.append(i ** p)
        i+=1

print(max(lst))

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):
from math import ceil

x=int(input())
ans=1
for b in range(2,ceil(x**0.5)):
    p=2
    while b**p<=x:
        ans=max(b**p,ans)
        p+=1
print(ans)

Solution (Python):
X = int(input())
limit = int(X ** 0.5)
ans = -1
prob_ans = []

if X == 1:
    ans = 1
for i in range(2, limit+1):
    p = 2
    while True:
        tmp = i ** p
        if tmp > X:
            break
        ans = max(ans, tmp)
        p += 1

print(ans)

Solution (Python):
import bisect,collections,copy,itertools,math,numpy,string
def I(): return int(input())
def S(): return input()
def LI(): return list(map(int,input().split()))
def LS(): return list(input().split())

X = I()
kouho = []
ans = 1
kouho.append(1)
for i in range(2,1000):
    j = 1
    while i**j<=1000:
        j += 1
        if i**j<=1000:
            kouho.append(i**j)
kouho.sort()
for x in kouho:
    if x<=X:
        ans = x
    else:
        break
print(ans)