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==1:
	print(1)
else:
	for i in range(1,X//2):
		for j in range(2,11):
			tmp=i**j
			if tmp<=X:
				ans=max(ans,tmp)
	print(ans)

Solution (Python):
def main():
    X=int(input())
    if X==1 or X==2 or X==3:
        print(1)
    else:
        li=[]
        for p in range(2,10):
            for n in range(2,100):
                if n**p<=X:
                    li.append(n**p)
                else:
                    break
        li.sort(reverse=True)
        print(li[0])
if __name__=="__main__":
    main()

Solution (Python):

x = int(input())

ans = 1
for i in range(x + 1):
    for j in range(int(pow(x, 0.5)) + 1):
        for k in range(int(pow(x, 0.5)) + 1):
            if i == pow(j, k) and ans < i:
                ans = i
print(ans)

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

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

for i in range(2, 50):
    if i*i<=X:
        p = i*i
        
        while p*i<=X:
            p *= i
        
        ans = max(ans, p)
    else:
        break

print(ans)

Solution (Python):
beki = [0] * 1010
beki[1] = 1
for i in range(2, 1001):
        t = i*i
        while t<1001:
                beki[t] = 1
                t *= i
ans = 1
for i in range(int(input())+1):
        if beki[i]: ans = i
print(ans)

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

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

l.sort()
print(l[-1])

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

ans = 1
for i in range(2,int(X**.5)+1):
    j = 2
    while i ** j <= X:
        ans = max(ans, i ** j)
        j += 1

print(ans)

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

ans = 1
for i in range(2,101) :
    for j in range(2,11) :
        bek = i ** j
        if bek <= X :
            ans = max(ans, bek)

print(ans)

Solution (Python):
def main():
    N = int(input())
    ans = set()
    for a in range(N+1):
        for b in range(2, 31):
            if a**b > N:
                continue
            ans.add(a**b)
    print(max(ans))


if __name__ == '__main__':
    main()

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):
import math
x = int(input())
ans = 1
for i in range(2, math.floor(math.sqrt(x)) + 1):
  b = i
  while b*i <= x:
    b *= i
  ans = max(ans, b)
print(ans)

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

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

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

for b in range(1, x):
    power = b * b
    for p in range(2, x):
        if power > x:
            break
        if power > ans:
            ans = power
        power *= b
print(ans)

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

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

for x in range(X):
  for y in range(2,int(X**0.5)):
    tmp=x**y
    if tmp>ans and tmp<=X:
      ans = tmp
    elif tmp > X:
      break
print(ans)

Solution (Python):
import math
x = int(input())
rooted = math.sqrt(x)
max_num = 1
l = 2
while True:
    i = 2
    if l > rooted:
        break
    while True:
        beki = pow(l,i)
        i += 1
        if beki <= x:
            if beki == x:
                print(x)
                exit()
            else:
                if beki > max_num:
                    max_num = beki
        else:
            l += 1
            break
print(max_num)

Solution (Python):



X = int(input().strip())

candidate=set()
max_num = int( 1000**(1/2) )
for i in range( 1, max_num + 1 ):
    for j in range( 2, max_num + 1 ):
        calc = i**j
        
        if calc <= 1000:
            candidate.add(i**j)

ans=0
for i in candidate:
  if i <= X and ans < i:
    ans = i

print(ans)

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

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

X_=int(X**0.5)+1

ans=1
for i in range(2,X+1):
    for j in range(2,X_):
        bi=i
        while True:
            if bi%j!=0:
                break
            bi//=j
            if bi==1:
                ans=i

print(ans)

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

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

Solution (Python):
import math


x = int(input())
ans = 1
num = 1
for i in range(2, int(math.sqrt(x) + 1)):
    j = 1
    while i ** j <= x:
        num = i ** j
        j += 1
    ans = max(num, ans)
print(ans)

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

Solution (Python):
import math
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    x=INT()
    flg=0
    for i in range(x,0,-1):
        for j in range(2,10):
            for k in range(32):
                if k**j==i:
                    flg=1
        if flg==1:
            ct=i
            break
    print(ct)
            
if __name__ == '__main__':
    do()

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())
M = 1
for i in range(1, X):
    for p in range(2, 10):
        if M < i ** p <= X:
            M = i ** p

print(M)

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

Solution (Python):
X = int(input())
answer = 1
sq = []
for i in range(2, 32):
    for j in range(2, 11):
        if i**j <= 1000:
            sq.append(i**j)
sq.sort()
for i in range(2, X+1):
    if i in sq:
        answer = i

print(answer)

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

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

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

for b in range(1, 32):
    for p in range(2, 10):
        num = b**p
        if num <= x:
            beki.append(num)

beki = sorted(set(beki), reverse= True)

print(beki[0])

Solution (Python):

x = int(input())
ans = 0
 
for i in range(1,33):
    for j in range(2,10):
        t = i**j
        if t <= x:
            ans = max(t,ans)
print(ans)

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

ans = 0
for i in reversed(range(1, x + 1)):
    for j in reversed(range(2, x+1)):
        if i % j != 0:
            continue
        w = i // j
        p = 1
        while w % j == 0:
            w //= j
            p += 1
        if w == 1 and p >= 2:
            print(i)
            sys.exit()
print(1)

Solution (Python):
import sys

read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs = sys.stdin.buffer.readlines






def main():
	x=int(input())
	
	s=set()
	
	for i in range(1,40):
		for j in range(2,10):
			a=i**j
			if a<=1000:
				s.add(a)
	
	li=list(s)
	li.sort()
	
	for i in range(x,0,-1):
		if i in li:
			print(i)
			exit(0)
			
	
	
	
if __name__ == "__main__":
	main()

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

print(ans)

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

Solution (Python):
import math
x=int(input())
if x<4:
    print(1)
else:
    buf=0
    while buf==0 and x>1:
        r=int(math.sqrt(x))
        for i in range(2,r+1):
            ans=1
            while ans<x:
                ans*=i
            if ans==x:
                buf=1
                break
        if buf==0:
            x-=1
    print(x)

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

Solution (Python):
X = int(input())
L = []
for i in range(33):
    for j in range(2, 10):
        x = i ** j
        if x <= X:
            L.append(x)

print(max(L))

Solution (Python):
x=int(input())
exp=[0]*(x+1)
exp[1]=1
ans=0
for i in range(2,x+1):
    t=i*i
    while t<=x:
        exp[t]=1
        t*=i

for i in range(1,x+1):
    if exp[i]:
        ans=max(i,ans)
print(ans)

Solution (Python):

x = int(input())
ans = 1
for i in range(2,int(x**1/2) + 1):
    p = 2
    while True:
        if i**p > x: break
        else:
            ans = max(ans,i**p)
            p += 1
print(ans)

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

for i in range(100):
    for j in range(2,10):
        if i**j <= a:
            l.append(i**j)
print(max(l))

Solution (Python):
X = int(input())
ans = 1
for m in range(1,32):
    for k in range(2,11):
        if m**k > X: break
        ans = max(ans, m**k)
print(ans)

Solution (Python):
x = int(input())
while 1:
    for b in range(1, x+1):
        for p in range(2, 15):
            if b ** p == x:
                print(x)
                exit()
    x -= 1

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

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))

x = ni()
ans = 0
for i in range(100):
    for j in range(2,11):
        p = i**j
        if p <= x:
            ans = max(ans, p)
        else:
            continue

print(ans)

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

print(ans)

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

Solution (Python):
from fractions import gcd


import heapq
import math
from collections import defaultdict, Counter, deque
from bisect import *
import itertools
import fractions
import sys
sys.setrecursionlimit(10 ** 7)
MOD = 10 ** 9 + 7



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


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 factorize(n):
    fct = []  
    b, e = 2, 0  
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct


def is_prime(n):
    if n == 1:
        return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True


def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

def modpow(a, n, mod):
    res = 1
    while n > 0:
        if n & 1:
            res = res * a % mod
        a = a * a % mod
        n >>= 1
    return res


def modinv(a, mod):
    return modpow(a, mod - 2, mod)


def cnk(a, b):
    MOD = 10**9+7
    ret = 1
    for i in range(b):
        ret *= (a-i)
        ret %= MOD
        ret = ret * modinv(i+1, MOD) % MOD
    return ret




def main():
    x = int(input())
    ans = x
    l = []
    for b in range(1, 1001):
        for p in range(2,10):
            v = b ** p
            if v > x:
                break

            if x >= v:
                l.append(v)
    l.sort()
    if len(l) != 0:
        print(l[-1])
    else:
        print(1)



            


    




    


if __name__ == '__main__':
    main()

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

ans = 0
for b in range(1, 1001):
    for p in range(2, 1001):
        if b ** p > x:
            break
        ans = max(ans, b ** p)
        
print(ans)

Solution (Python):




x = int(input())

expolist = list()


for i in range(1, 32):
    for j in range(2, 10):
        expo = i ** j
        if expo > x:
            break
        else:
            expolist.append(expo)


print(max(expolist))

Solution (Python):
x=int(input())
maxim=0
for i in range(2,32):
    for j in range(2,10):
        temp=i**j
        if temp<=x and maxim<temp:
            maxim=temp
print(maxim if maxim>0 else 1)

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

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 = 0
for i in range(1, 100):
    for j in range(2, 100):
        if i ** j <= X:
            ans = max(ans, i ** j)

print(ans)

Solution (Python):
def main():
    X = int(input())
    ans = []
    for b in range(1, 100):
        for p in range(2, 10):
            if b**p <= X:
                ans.append(b**p)
    print(max(ans))


if __name__ == '__main__':
    main()

Solution (Python):
import sys
input = sys.stdin.readline
X = int(input())
res = 0
for b in range(1, 1000):
  for p in range(2, 11):
    if pow(b, p) <= X: res = max(res, pow(b, p))
print(res)

Solution (Python):











import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log 
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')

def main():
    X=I()
    ans = 1
    for b in range(2,X):
        p=2
        while True:
            if b**p<=X:
                ans = max(ans, b**p)
            else:
                break
            p+=1
    print(ans)
    
if __name__ == '__main__':
    main()

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

cand = [1]
for i in range(2, X+1):
    cnt = 0
    x = X
    while x:
        x //= i
        cnt += 1
    if cnt > 2:
        cand.append(i**(cnt-1))
print(max(cand))

Solution (Python):
x = int(input())
ans_lis = []
for i in range(1,1000):
    for j in range(2,11):
        if i**j<=x:
            ans_lis.append(i**j)
ans_lis.sort()
print(ans_lis[-1])

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

ans=0
for i in range(1,40):
    for j in range(2,100):
        n=pow(i,j)
        if n>X:
            break
        ans=max(ans,n)
        
print(ans)

Solution (Python):
def main():
    limit = int(input())
    answer = 1
    for i in range(2, limit):
        j = 2
        while i ** j <= limit:
            if answer <= i ** j:
                answer = i ** j
            j += 1
    print(answer)


if __name__ == '__main__':
    main()

Solution (Python):
X = int(input())
l = []
if X < 4:
  print(1)
else:
  for i in range(2, int(X ** 0.5) + 1):
    j = 2
    while i ** j <= X:
      l.append(i ** j)
      j += 1
  l.sort()
  print(l[-1])

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

output = 1
for i in range(1,32):
    for j in range(2, 10):
        p = i ** j
        if p > X:
            break
        if p > output:
            output = p
print(output)

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,0,-1):
    if expo[i]:
        print(i)
        quit()

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

Solution (Python):


import bisect


def main():
    X = int(input())
    result = []
    for i in range(1, 33):
        result += [i ** j for j in range(2, 10)]
    result.sort()
    index = bisect.bisect_right(result, X)

    print(result[index - 1])


if __name__ == "__main__":
    main()

Solution (Python):
n=int(input())
m=-1
for p in range(2,10):
    for b in range(1,32):
        if b**p<=n:
            m=max(m,b**p)
        else:break
print(m)

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

Solution (Python):


n = int(input())

l = [1] 

for i in range(1, n+1):
    for j in range(2, int(n**0.5)):
        if n >= i**j:
            l.append(i**j)
print(max(l))

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

l = [1]

for i in range(1, n+1):
    for j in range(2, int(n**0.5)):
        if n >= i**j:
            l.append(i**j)
            
print(max(l))

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

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

    l = [i for i in l if i <= x]
    ans = max(l)
    print(ans)

resolve()

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

pre = 0
arr = []
for b in range(331,):
    for p in range(2,33):
        if b ** p <= x:
            arr.append(b**p)

print(max(arr))

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

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

m = 1

for i in range(1, 32):
    for j in range(2, 10):
        p = pow(i, j)
        if p > x:
            break
        if p > m:
            m = p

print(m)

Solution (Python):
x=int(input())
li=[]
for i in range(32):
  for j in range(2,6):
    if pow(i,j)<=x:
      li.append(pow(i,j))
print(max(li))

Solution (Python):
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)

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

ans = -1
for i in range(1, int(math.sqrt(n)) + 1):
  j = 2
  while i ** j <= n:
    if i == 1:
      ans = 1
      break
    ans = max(ans, i ** j)
    j += 1
print(ans)

Solution (Python):
X = int(input())
ans = 1
i = 2
while i * i <= X:
    j = 1
    maxi = i
    while i ** j <= X:
        maxi = i ** j
        j += 1
    ans = max(ans, maxi)
    i += 1

print(ans)

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

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

sq = int(math.sqrt(X))
m = 1
for b in range(2, sq+1):  
    p = 2
    tmp = b ** p
    while tmp <= X:
        m = max(tmp, m)
        p += 1
        tmp = b ** p
print(m)

Solution (Python):
import collections
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
X=int(input())
for i in range(X):
  l=prime_factorize(X-i)
  c=collections.Counter(l)
  m=list(c.values())
  n=collections.Counter(m)
  if len(n)==1 and m[0]!=1:
    print(X-i)
    exit()
print(1)

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

Solution (Python):
x = int(input())
lis = []
for i in range(1,100):
    for j in range(2,10):
        lis.append(i**j)
lis.sort()

for i in range(1001):
    if lis[i+1] == x:
        print(lis[i+1])
        break
    elif lis[i+1] > x:
        print(lis[i])
        break

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

max=-1

for i in range(0,int(x**0.5+1)):
    for j in range(1,int(x**0.5+1)):
        if(i**j <= x and i**j >= max):
            max = i**j

print(max)

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

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

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

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

for i in range(2, math.ceil(x**0.5)):
    for j in range(1, 12):
        if(maximum < i**j <= x):
            maximum = i**j
            
print(maximum)

Solution (Python):
x = int(input())
ans = 1
for i in range(2, x+1):
    tmp = i
    flag = False
    while tmp * i <= x:
        flag = True
        tmp *= i
    if flag:
        ans = max(ans, tmp)

print(ans)

Solution (Python):
import math
x=int(input())
ans=1
for i in range(2,math.ceil(x**(0.5))):
  j=2
  tmp = i**j
  while tmp<=x and x!=1:
    ans = max(ans, tmp)
    j+=1
    tmp = i**j
print(ans)

Solution (Python):
import math
x=int(input())
if x==1:
  print(1)
  exit()
  
ans = 0
for i in range(2,math.ceil(x**(0.5))):
  j=2
  tmp = i**j
  while tmp<=x:
    ans = max(ans, tmp)
    j+=1
    tmp = i**j
print(ans)

Solution (Python):
X = int(input())
b = 1
ans = 0
while(1):
    b += 1
    p = 1
    if (b**2) > X:
        break
    while(1):
        p += 1
        if X < (b**(p+1)) and (b**p) <= X:
            ans = max(ans,b**p)
            break
if X==1:
    print(1)
    exit()
if X==2 or X == 3:
    print(1)
    exit()

print(ans)

Solution (Python):
n=int(input())
list=[]
for i in range(32):
	for j in range(2,10):
		ans=i**j
		if ans<=n:
			list.append(ans)
print(max(list))

Solution (Python):
import math

X=int(input())
max=0
for i in range(int(math.sqrt(X))):
    num=i+1
    j=0
    while True:
        buf=pow(num,j)
        if buf>max:
            max=buf
        j=j+1
        if (buf==pow(num,j))or(pow(num,j)>X):
            break
print(max)

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

Solution (Python):
n = int(input())
l = []
l.append(1)
for i in range(2,40):
  b = i**2
  while b <= 1000:
    l.append(b)
    b*= i
l.sort()

for i in range(len(l)):
  if n < l[i]:
    print(l[i-1])
    exit()
print(1000)

Solution (Python):
n=int(input())
ans=int(1)
for i in range(1,n):
    for j in range(2,10):
        if ans<=pow(i,j)<=n:
            ans=pow(i,j)

print(ans)

Solution (Python):
x = int(input().strip())
ans = 0
for b in range(1, 1001, 1):
    for p in range(2, 1001, 1):
        rep = b ** p
        if x < rep:
            break
        ans = max(ans, rep)
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())
ans=0
for i in range(1,x+1):
  for j in range(2,12):
    if i**j<=x:
      ans=max(ans,i**j)
    else:
      break
print(ans)

Solution (Python):
import math
N = int(input())
max = 0
for i in range(int(math.sqrt(N)+1)):
	for j in range(10):
		if(i**j>max and i**j <=N):
			max = i**j
print(max)

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

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

for x in range(1, X):
    for y in range(2, X):
        if x ** y <= X:
            ans = max(ans, x ** y)
        else:
            break

print(ans)

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

for i in range(2, int(x**(0.5))+1):
  j = 2
  while True:
    k = i**j
    if k > x:
      break
    else:
      ans = max(ans, k)
      j += 1
      
print(ans)

Solution (Python):
x = input()
y = 1
for i in range(1, 1001):
    for n in range(2, 10):
        if i ** n <= x and i ** n > y:
            y = i ** n
print y

Solution (Python):
x = int(input())
ans = []
for i in range(1, 1000):
    for j in range(2, 11):
        if i**j <= x:
            ans.append(i**j)
print(sorted(ans)[-1])

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

Solution (Python):
import sys
X = int(input())
L = []
for i in range(1,32):
  for j in range(1,10):
    if X < i**j:
      if j != 2:
        L.append(i**(j-1))
        break
      break
    elif X == i**j and j != 1:
      print(i**j)
      sys.exit(0) 
print(max(L))

Solution (Python):
import math

X = int(input())
ans = 1

for b in range(2, math.ceil(math.sqrt(X)) + 1):
    p = 2

    while b ** p <= X:
        p += 1

    ans = max(ans, b ** (p - 1))

print(ans)

Solution (Python):



cand=[0,1]
for i in range(2,32):
    temp=i
    while True:
        temp*=i
        if temp<=1000:
            cand.append(temp)
        else:
            break

cand.sort()

X=int(input())

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

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

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

result = 0
for i in range(2,x+1):
  beki = 2
  while (i**beki) <= x:
    if result < i**beki:
      result = i**beki 
    beki+=1

if result == 0:
  print(1)
else:
  print(result)

Solution (Python):
x = int(input())
seen = [0] * 1001
ans = 1
for i in range(x):
    if(seen[i]): pass
    cur = i
    if(i > 1):
        while (cur <= x):
            cur *= i
            if(cur <= x): ans = max(ans, cur)
print(ans)

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

x = 0

L = [0]

if X == 1:
  print(X)

else:
  for i in range(2,int(X ** 0.5) + 1):
    n = 1
    a = i
    while n < X :
      n *= a
      L.append(n)
    if n // a > x:
      x = (n // a)
  
  print(max(i for i in L if i <= X))

Solution (Python):
x = int(input())
ans = 0
for a in range(2,x):
  for b in range(2,10):
    if a**b <= x:
        ans = max(ans,a**b)
        
if x == 1:
    print(1)
    exit()
print(ans)

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

ans = []
for i in range(1, 1000):
    for j in range(2, 11):
        if i**j > X:
            continue
        ans.append(i**j)
print(max(ans))

Solution (Python):
import math
x = int(input())
seen = [0] * 1001
ans = 1
for i in range(x):
    if(seen[i]): pass
    cur = i
    if(i > 1):
        while (cur <= x):
            cur *= i
            if(cur <= x): ans = max(ans, cur)
print(ans)

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

maxv = 0
for i in range(1,100):
    for j in range(2,100):
        a = i ** j
        a = max(a, i**j)
        if i ** j <= x and maxv < a:
            maxv = a

print(maxv)

Solution (Python):

X=int(input())
A=[]
for i in range(1,X+1):
    for j in range(2,X+2):
        if i**j<=X:
            A.append(i**j)
        else:
            break
A.sort()


print(A[len(A)-1])

Solution (Python):


X=int(input())

ans=1

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

print(ans)

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

Solution (Python):
X=int(input())
out=1
for i in range(2, int(pow(X, 1/2))+1):
  j=2
  while i**(j+1)<=X:
    j+=1
  if out<i**j:
    out=i**j
print(out)

Solution (Python):
X = int(input())
def is_beki(N):
    for i in range(2,int(N**.5)+1):
        if N%(i**2)==0:
            k = 1
            while k<N:
                k *= i
            if N == k:
                return True
    return False

for x in range(X, 1, -1):
    if is_beki(x):
        print(x)
        break
else:
    print(1)

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

ans=1

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

print(ans)

Solution (Python):
x = int(input())
r = 0
for b in range(1, int(x**0.5)+1):
    for q in range(1, x+1):
        t = b**q
        if r < t <= x:
            r = t
        if t > x:
            break
print(r)

Solution (Python):
import  math
 
n = int(input())
s = math.floor(math.sqrt(n))

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

print(ans)

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

sq = int(math.sqrt(X))

m = 1
for b in range(2, sq+1):
    p = 2
    tmp = b ** p
    while tmp <= X:
        m = max(tmp, m)
        p += 1
        tmp = b ** p

print(m)

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

sq = int(math.sqrt(X))

m = 1
for b in range(2, sq+1):
    p = 2
    tmp = b ** p
    while tmp <= X:
        m = max(tmp, m)
        p += 1
        tmp = b ** p

print(m)

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

sq = int(math.sqrt(X))

candidates = [1]
for b in range(2, sq+1):
    p = 2
    tmp = b ** p
    while tmp <= X:
        candidates.append(tmp)
        p += 1
        tmp = b ** p

print(sorted(candidates)[-1])

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

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

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