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):
X = int(input())
nums = set([1])
for i in range(2, int(1000 ** .5) +1):
    b = 2
    while True:
        temp = i ** b
        if temp > 1000:
            break
        nums.add(temp)
        b += 1
sorted_nums = sorted(list(nums), reverse=True)

if X >= sorted_nums[0]:
    print(sorted_nums[0])
else:
    for i in range(len(sorted_nums) - 1):
        if sorted_nums[i] > X >= sorted_nums[i + 1]:
            print(sorted_nums[i + 1])

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

ans = 0



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

print(ans)

Solution (Python):
x=int(input())
i=1
mx=i
while(i**2<x):
  i+=1
  j=2
  while(i**j<=x):
    j+=1
  if i**(j-1)>mx:
    mx=i**(j-1)
print(mx)

Solution (Python):
from math import ceil
def main():
    x = int(input())
    r = 0
    for i1 in range(1, ceil(x**0.5) + 1):
        beki = 2
        while True:
            num = pow(i1, beki)
            if num <= x:
                r = max(r, num)
            else:
                break
            if num == pow(i1, beki - 1):
                break
            beki += 1

    print(r)

if __name__ == '__main__':
    main()

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

ans = 1



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

print(ans)

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

ans = 0

for a in range(1, 32):
    for b in range(2, 10):
        if x >= a ** b:
            ans = max(ans, a**b)

print(ans)

Solution (Python):
X=int(input())
a_max=1
for b in range(2,X//2):
  a=1
  p=2
  while a<X:
    a=b**p
    p+=1
    if X >= a > a_max:
      a_max=a
print(a_max)

Solution (Python):
X=int(input())
a=1
b=2
p=2
while b<=int(X**.5):
    if b**p<=X:
        a=max(a,b**p)
        p+=1
    else:
        b+=1
        p=2
print(a)

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

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

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

Solution (Python):
import math
X=int(input())
x=math.floor(math.sqrt(X))
l=list()
for i in range(1,x+1):
  for n in range(1,7):
    if i**n<=X and i**(n+1)>=X:
      l.append(i**n)

print(max(l))

Solution (Python):
x=int(input())
print(max([i**j for i in range(33) for j in range(2,10) if i**j<=x]))

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

Solution (Python):
x=int(input())
ans=1
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)

Solution (Python):
def main():
    X = int(input())
    L = [False]*1001
    for i in range(1,41):
        for j in range(2,11):
            temp = i**j
            if temp > X:
                break
            L[temp] = True
    m = 0
    for i in range(X+1):
        if L[i]:
            m = i
    print(m)





if __name__ == '__main__':
    main()

Solution (Python):
n=input()
l=len(n)
n=int(n)
ans=0
for i in range(2,7*l):
    t=int(n**(1/i))
    for j in range(3):
        if (t+j)**i<=n:
            ans=max((t+j)**i,ans)
print(ans)

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

expotential_set = set()
for i in range(1, 1000):
    for j in range(2, 10):
        expotential_set.add(pow(i, j))

expotential_list = sorted(list(expotential_set))

distance = 10000000000000
for num in expotential_list:
    if num <= x and abs(num - x) < distance:
        distance = abs(num - x)
        ans = num

print(ans)

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

    ans = 1
    for i in range(2, 11):
        for j in range(32):
            if j ** i <= X:
                if j ** i > ans:
                    ans = j ** i

    print(ans)


if __name__ == "__main__":
    main()

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

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

l = [1]

for i in range(2, int(x ** 0.5)+1):
    t = 2
    while True:
        if i ** t <= x:
            l.append(i ** t)
            t += 1
        else:
            break

l.sort()

print(l[-1])

Solution (Python):
X = int(input())
ans = {1}
for i in range(2, 40):
    y = 2
    while i ** y <= X:
        ans.add(i ** y)
        y += 1
print(sorted(list(ans))[-1])

Solution (Python):

import sys
input = sys.stdin.readline









x = int(input())

A = [1]
for i in range(x+1):
    for j in range(2,x+1):
        if i**j <= x and i**j not in A:
            A.append(i**j)
        if i**j > x:
            break

print(max(A))

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

ans = 1

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

Solution (Python):
import bisect
x = int(input())
ex = [1]

for b in range(2, 32):
  for p in range(2, 10):
    if b**p <= 1000:
      ex.append(b**p)
    else:
      break
      
ex.sort()
r = bisect.bisect_right(ex, x)
    
print(ex[r-1])

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

Solution (Python):
x = int(input())
S = set()
S.add(1)
for b in range(2, int(1000**0.5) + 1):
	for p in range(2, 10):
		if b**p > 1000:
			break
		S.add(b**p)
for n in range(x, 0, -1):
	if n in S:
		print(n)
		exit()

Solution (Python):
X = int(input())
c = {i ** j for i in range(34) for j in range(2, 11) if i ** j <= 1000}
print(max([i for i in c if i <= X]))

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,1000):
    for j in range(2,10):
        n = i**j
        if n <= x:
            ans = max(ans,n)
print(ans)

Solution (Python):
import bisect
x=int(input())
a=[1]
b=2
i=2
while b<=997:
    while b**i<=1000:
        a.append(b**i)
        i+=1
    b+=1
    i=2
a=sorted(list(set(a)))
print(a[bisect.bisect(a,x)-1])

Solution (Python):
x=int(input())
ans=0
num=x+100
for i in range(1,33):
    for j in range(2,11):
        a=x-(i**j)
        if a>=0 and num>a:
            ans=x-a
            num=a
print(ans)

Solution (Python):
x = int(input())
ans = 1
for i in range(1,int(x**0.5)+1):
    for j in range(2,x//2 + 1):
        if x >= i**j:
            ans = max(i**j, ans)


print(ans)

Solution (Python):


import sys






























def main():
    mod = 1000000007                
    inf = float('inf')              
    
    sys.setrecursionlimit(10**6)    
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
    
    x = ii()
    L = [False] * (x+1)
    L[1] = True
    for i in range(2, 32):
        for j in range(2, 10):
            if pow(i, j) <= x:
                L[pow(i, j)] = True
    
    for num in range(x, 0, -1):
        if L[num]:
            print(num)
            exit()



if __name__ == "__main__":
    main()

Solution (Python):
X = int(input())
val = 1
for b in range(1, int(X**0.5)+1):
    for p in range(2,X):
        if b**p > X:
            break
        else:
            val = max(val, b**p)
print(val)

Solution (Python):

def inp():
    return(int(input()))



def inlist():
    return(list(map(int, input().split())))



def instr():
    s = input()
    return(list(s[:len(s)]))



def invr():
    return(map(int, input().split()))


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

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 = 0
if x == 1:
    print(1)
else:
    for i in range(1,x+1):
        cnt = 2
        while cnt<x:
            if i**cnt > x:
                break
            else:
                ans = max(ans,i**cnt)
                cnt+=1
                

    print(ans)

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

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

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

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

Solution (Python):
x=int(input())
l=[0]*(x+1)

if x==1:
    print(1)
    exit()
    
for i in range(1,x):
    for j in range(2,1000):
        if i**j>x:
            break
        l[i**j]=1

for i in reversed(range(x+1)):
    if l[i]==1:
        print(i)
        exit()

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

Solution (Python):
x = int(input())
if x == 1000:
    print(1000)
else :
    for _ in range(1000):
        if all(x**(1/i)!=int(x**(1/i)) for i in range(2, 100)):
            x -= 1
        else :
            print(x)
            break

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())
X = set()
for i in range(1,32):
  for j in range(2, 10):
    if pow(i,j) <= N:
      X.add(pow(i, j))
    else:
      break
print(max(X))

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

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

Solution (Python):
x = int(input())
n = set()
n.add(1)
for i in range(2,33):
    a = i
    beki = 2
    while a**beki <= x:
        n.add(a**beki)
        beki += 1
        if a**beki > x:
            break

print(max(n))

Solution (Python):
x = int(input())
maxx = 1
for i in range(1, x):
  for j in range(2, x):
    expx = i ** j
    if expx <= x:
      if maxx <= expx:
        maxx = expx
    else:
      break
print(maxx)

Solution (Python):






import sys
input = sys.stdin.readline

import math

import bisect
from collections import defaultdict
from collections import deque
from functools import lru_cache






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






def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]


def Yes(): print("Yes"); return
def No(): print("No"); return


def inv(n): return pow(n, MOD-2, MOD)


kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret


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


def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors


def lcm(a, b):
    return a * b // gcd (a, b)


def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count


def Base_10_to_n(X, n):
  if (int(X/n)):
    return Base_10_to_n(int(X/n), n)+[X%n]
  return [X%n]






N = inputI()
if N < 4:
  print(1)
  exit()

M = 0
for i in range(2,N+1):
  f = factorization(i)
  shisuu = [q for p,q in f]
  m = min(shisuu)
  if m != 1:
    r = [i%m for i in shisuu]
    if sum(r) == 0:
      M = i
    
print(M)

Solution (Python):
a = set()
for i in range(1, 35):
    for j in range(2, 10):
        a.add(i ** j)
b = []
for i in a:
    if i <= 1000:
        b.append(i)

b.sort(reverse=True)
x = int(input())
for i in b:
    if i <= x:
        print(i)
        break

Solution (Python):
import sys, re
from math import ceil, floor, sqrt, pi, factorial
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left
from functools import reduce

def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_list(N): return [s_list() for _ in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    n = i_input()

    max_num = 0
    for i in range(1,n+1):
        for j in range(2,int(sqrt(n+1))):
            tmp = pow(i, j)
            if tmp <= n:
                max_num = max(max_num, tmp)
        
    print(max_num if max_num != 0 else 1)

if __name__ == '__main__':
    main()

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

if X < 4:
    print(1)
    exit()

ans = 1
for x in range(2,X-1):
    for p in range(2,X-1):
        if(x**p > X): break
        ans = max(ans, x**p)

print(ans)

Solution (Python):
x = int(input())
s = {1}
for i in range(1, x):
    for j in range(2, x):
        if i**j <= x:
            s.add(i**j)
        else:
            break
print(max(s))

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

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

Solution (Python):
x=int(input())
saidai=0
beki=0

for i in range(1,x+1):
    for j in range(2,int(10)):
        if x>=i**j>saidai:
            saidai=i**j
            
        if saidai>x:
            break
    if saidai>x:
        break
print(saidai)

Solution (Python):
def resolve():
	x = int(input())
	ans = 0
	for i in range(1, 100):
		for j in range(2, 11):
			v = i**j
			if x >= v:
				ans = max(ans, v)
	print(ans)
resolve()

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

Solution (Python):

import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial
from bisect import bisect_left 
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
pri = lambda x: print(*x, sep='\n')

X = int(input())

res = 1
for i in range(2, X):
    if X < i:
        break
    for j in range(2, 10):
        val = pow(i, j)
        if X < val:
            break
        if res < val:
            res = val
print(res)

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

Solution (Python):



x = int(input())

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

print(ans)

Solution (Python):
from math import floor

x = int(input())

ans = 1
for i in range(2, floor(x ** 0.5) + 1):
    temp = i ** 2
    while temp * i <= x:
        temp *= i
    if temp > ans:
        ans = temp
print(ans)

Solution (Python):
x = int(input())
lst = [i**2 for i in range(1,32)]+[8,27,125,216,343,512,1000]+[32,243]+[128]+[1001]
lst.sort()
for i in range(len(lst)):
    if lst[i]<=x<lst[i+1]:
        print(lst[i])

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    
    X=int(input())
    ans=0
    for i in range(1,int(1000*0.5)):
        for j in range(2,15):
            if i**j<=X:
                ans=max(ans,i**j)
    print(ans)    
resolve()

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

lis = []
for n in range(32):
    for e in range(2,11):
        if n**e <= x:
            lis.append(n**e)
se = set(lis)
print(max(se))

Solution (Python):
a = int(input())
m = 1
for i in range(a//2+1):
    for j in range(1,10):
        if a>=i**j and m <i**j:
            m = i**j
        if a < i**j:
            break
print(m)

Solution (Python):
nums = []

for i in range(1,100):
    for j in range(2,100):
        nums.append(pow(i,j))
    
nums.sort(reverse=True)

X = int(input())

for i in nums:
    if i <= X:
        print(i)
        break

Solution (Python):
from bisect import bisect_right

expo = sorted(list(set([b**p for b in range(1, int(1000**0.5)+1) for p in range(2, 10) if b**p <= 1000])))
X = int(input())

print(expo[bisect_right(expo, X)-1])

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

ans = [1]
for i in range(2, 1001):
  p = 2
  while i**p <= 1000:
    ans.append(i**p)
    p += 1
while not x in ans:
  x -= 1
print(x)

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

for a in range(2, X+1):
    p = 2
    
    while a**p<=X:
        ans = max(ans, a**p)
        p += 1

print(ans)

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

ans = 0
for b in range(1, X + 1):
    p = 2
    while b ** p <= X:
        ans = max(ans, b ** p)
        if b == 1: break
        p += 1

print(ans)

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

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

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

print(ans)

Solution (Python):
x = int(input())
if x == 1:
  print(1)
elif x==2:
  print(1)
else:
  candidates = []
  for i in range(x):
    for j in range(2,x):
      t = i**j
      if x>=t:
        candidates.append(t)
      else:
        break
  print(max(candidates))

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

ans = 1
for b in range(1, 32):
    for p in range(2, 10):
        if b**p <= x:
            ans = max(ans, b**p)

print(ans)

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

x = int(input())
ans = 1

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

print(ans)

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

Solution (Python):
ans=1
x=int(input())
for i in range(1,101):
  for j in range(2,11):
    m=i**j
    if x>=m:ans=max(ans,m)
print(ans)

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

for i in range(32):
    for j in range(2,10):
        if i**j > X:
            break
        a.append(i**j)

print(max(a))

Solution (Python):
X=int(input())
a=[]

for i in range(32):
    for j in range(2,10):
        if i**j<= 1000:
            a.append(i**j)
            continue
        break

for i in sorted(list(set(a)))[::-1]:
    if i <= X:
        print(i)
        break

Solution (Python):
import sys
import math
import bisect

def main():
    A = []
    for i in range(1, 33):
        for j in range(2, 11):
            val = i ** j
            if val <= 1200:
                A.append(val)
            else:
                break
    A.sort()
    x = int(input())
    p = bisect.bisect_right(A, x)
    print(A[p-1])


if __name__ == "__main__":
    main()

Solution (Python):
a = int(input())
mx = 1

for i in range(2,a):
    j=2
    while i**j <= a:
        mx = max(i**j,mx)
        j+=1

print(mx)

Solution (Python):
a = int(input())
mx = 1

for i in range(2,a):
    j=2
    while i**j <= a:
        mx = max(i**j,mx)
        j+=1

print(mx)

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

Solution (Python):
import numpy as np
whole = np.array(list({i**j for i in range(1, 32) for j in range(2, 32) if i**j <= 1000}))
whole.sort()

X = int(input())

print(whole[np.where(whole<=X)].max())

Solution (Python):
import sys
input = sys.stdin.readline
def main():
    X = int(input())
    ans = 0
    for i in range(1,X+1):
        for j in range(2,X+2):
            if i**j <= X:
                ans = max(ans, i**j)
            else:
                break
    print(ans)

if __name__ == '__main__':
    main()

Solution (Python):
import math
x = int(input())
for i in range(x,0,-1):
    if math.sqrt(i)%1 == 0  or (math.ceil(i ** (1/3)))**3 == i or (math.ceil(i ** (1/5)))**5 == i:
        print(i)
        break

Solution (Python):
x = int(input())
p = []
for i in range(2, 1000):
    for j in range(2, int(i ** 0.5) + 1):
        if i / j % 1 == 0:
            break
    else:
        p.append(i)

for i in range(x):
    X = x - i
    L = []
    while X > 1:
        for j in p:
            if X / j % 1 == 0:
                L.append(j)
                X /= j
                break
            else:
                continue
    cnt = 0
    L_ = sorted(set(L))
    if len(L) > 1 and len(L_) == 1:
        print(x - i)
        exit()
    for k in range(len(L_)):
        if k == 0:
            cnt = L.count(L_[k])
            continue
        else:
            if L.count(L_[k]) == cnt:
                continue
            else:
                break
    else:
        if cnt != 1:
            print(x - i)
            break
        else:
            continue

Solution (Python):
from bisect import bisect_right
exps = [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]
print(exps[bisect_right(exps, int(input())) - 1])

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

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

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


X = INT()

ans = 1

for b in range(1, X+1):
	for p in range(2, 10):
		if b**p <= X:
			ans = max(ans, b**p)

print(ans)

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


X = INT()

ans = 1

for i in range(int(X**0.5)+1):
	for p in range(2, 10):
		if i** p <= X:
			ans = max(ans, i**p)

print(ans)

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


X = INT()
X += 0.1
 
ans = 1
for i in range(2, 10):
	if int(X**(1/i)) <= 1:
		break
	else:
		ans = max(ans, int(X**(1/i))**i)
 
print(ans)

Solution (Python):
import math

X = int(input())

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

for i in reversed(range(1, X+1)):
    for j in range(2, int(math.sqrt(i))+1):
        if abs(math.log(i, j) - round(math.log(i, j))) <= 0.0000001:
            print(i)
            exit()
    if i == 1:
        print(1)

Solution (Python):
A= int(input())
B=set([1])
for i in range(2,32):
	C = i
	while C*i <= 1000:
		C*=i
		B.add(C)
for i in reversed(range(1,A+1)):
	if i in B:
		print(i)
		exit()

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

ans = 1


def cal(a, b): return a ** b


a = int(math.sqrt(X))

for i in range(a, 2, -1):
    b = 2
    tmp = cal(i, b)
    while (tmp <= X):
        tmp = cal(i, b)
        if tmp <= X:
            ans = max(ans, tmp)
            b += 1
        else:
            b += 1
print(ans)

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

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 sys
input= lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**9)
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))

from collections import Counter
def resolve():
    X=int(input())
    if X<4 :print(1);return
    ans=0
    for i in range(2,X):
        temp=i**2
        if temp<=X:
            while(1):
                if temp*i>X:
                    ans=max(ans,temp)
                    
                    break
                temp*=i
    print(ans)


resolve()

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())
kouho = {1}
for i in range(2,32):
    p = i**2
    while p <= x:
        kouho.add(p)
        p *= i
print(max(kouho))

Solution (Python):
x=int(input())
c=1
if x<=3:
  print(c)
else:
  for i in range(2,min(32,x)):
    j=2
    while i**j<=x:
      c=max(c,i**j)
      j=j+1
  print(c)

Solution (Python):
import sys

input = sys.stdin.readline


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

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

    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
X = int(input())
res = 1
for i in range(2,32):
    p = 2
    while i**p <= X:
        if res < i**p:
            res = i**p
        p += 1
print(res)

Solution (Python):
x = int(input())
maxval = 0
for i in range(1,int(x**0.5)+1):
  for j in range(2,8):
    pwr = i**j
    if pwr<=x:
      maxval = max(maxval,pwr)
print(maxval)

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

    ans = [1]
    for b in range(1, 32):
        for p in range(2, 10):
            if b ** p <= X:
                ans.append(b**p)
    ans.sort()
    print(ans[-1])


if __name__ == "__main__":
    main()

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

ans = 1
for i in range(2, int(x**0.5)+1):
  p = 0
  while i**p <= x:
    if i**p > ans:
      ans = i**p
    p += 1

print(ans)

Solution (Python):
x = int(input())
a = []
if x==1:
    print(1)
else:
    for b in range(1,x+1):
        for i in range(2,x+1):
            c = b**i
            if c>x:
                break
            else:
                a.append(c)
    print(max(a))