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 sys


def solve(X: int):
    i = 2
    vals = [1]
    while i * i <= X:
        tmp = i
        while tmp <= X:
            
            vals.append(tmp)
            tmp *= i
        i += 1
    vals.sort()
    ret = vals[-1]
    print(ret)
    return


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):
x = int(input())

ans = 1

for i in range(2,int(1000**0.5)+1):
    cnt = 2
    while True:
        s = i**cnt
        if s > x:
            break
        cnt += 1
        ans = max(s,ans)

print(ans)

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

ans = 1

for i in range(2,int(1000**0.5)+1):
    cnt = 2
    while True:
        s = i**cnt
        if s > x:
            break
        cnt += 1
        ans = max(s,ans)

print(ans)

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

ans = 1

for i in range(2,int(1000**0.5)+1):
    cnt = 2
    while True:
        s = i**cnt
        if s > x:
            break
        cnt += 1
        ans = max(s,ans)

print(ans)

Solution (Python):
beki = [1]
def get_beki(n):
    for i in range(2,n):
        for j in range(2,n):
            if i**j > n:
                break
            beki.append(i**j)

X = int(input())
get_beki(X)
print(max(beki))

Solution (Python):
X = int(input())
ans = 1
for i in range(32):
  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(1, 32):
    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(1, 32):
    for j in range(2, 10):
        if (i ** j <= x) and (i ** j >= ans):
            ans = i ** j
print(ans)

Solution (Python):


from sys import stdout
from bisect import bisect_left as binl
from copy import copy, deepcopy
from collections import defaultdict


mod = 1


def intin():
    input_tuple = input().split()
    if len(input_tuple) <= 1:
        return int(input_tuple[0])
    return tuple(map(int, input_tuple))


def intina():
    return [int(i) for i in input().split()]


def intinl(count):
    return [intin() for _ in range(count)]


def modadd(x, y):
    global mod
    return (x + y) % mod


def modmlt(x, y):
    global mod
    return (x * y) % mod


def lcm(x, y):
    while y != 0:
        z = x % y
        x = y
        y = z
    return x


def combination(x, y):
    assert(x >= y)

    if y > x // 2:
        y = x - y

    ret = 1

    for i in range(0, y):
        j = x - i
        i = i + 1

        ret = ret * j
        ret = ret // i

    return ret


def get_divisors(x):
    retlist = []
    for i in range(1, int(x**0.5) + 3):
        if x % i == 0:
            retlist.append(i)
            retlist.append(x // i)
    return retlist


def get_factors(x):
    retlist = []
    for i in range(2, int(x**0.5) + 3):
        while x % i == 0:
            retlist.append(i)
            x = x // i
    retlist.append(x)
    return retlist


def make_linklist(xylist):
    linklist = {}
    for a, b in xylist:
        linklist.setdefault(a, [])
        linklist.setdefault(b, [])
        linklist[a].append(b)
        linklist[b].append(a)
    return linklist


def calc_longest_distance(linklist, v=1):
    distance_list = {}
    distance_count = 0
    distance = 0
    vlist_previous = []
    vlist = [v]
    nodecount = len(linklist)

    while distance_count < nodecount:
        vlist_next = []
        for v in vlist:
            distance_list[v] = distance
            distance_count += 1
            vlist_next.extend(linklist[v])
        distance += 1
        vlist_to_del = vlist_previous
        vlist_previous = vlist
        vlist = list(set(vlist_next) - set(vlist_to_del))

    max_distance = -1
    max_v = None
    for v, distance in distance_list.items():
        if distance > max_distance:
            max_distance = distance
            max_v = v

    return (max_distance, max_v)


def calc_tree_diameter(linklist, v=1):
    _, u = calc_longest_distance(linklist, v)
    distance, _ = calc_longest_distance(linklist, u)
    return distance





def main():
    x = intin()

    ans = 1

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

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
X = int(input())
i = 2
A = [0 for _ in range(X+1)]
A[1] = 1
while i**2 <= X:
  A[i**2] = i**2
  p = 3
  while i**p <= X:
    A[i**p] = i**p
    p += 1
  i += 1
print(max(A))

Solution (Python):
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    x = f()[0]
    a = [0]*10001

    a[1] = 1
    for i in range(2,1000):
        if i*i <= 1000:
            a[i*i] = 1
            k = 3
            while i**k <= 1000:
                a[i**k] = 1
                k += 1
        else:
            break

    for i in range(x, 0, -1):
        if a[i] == 1:
            print(i)
            break


solve()

Solution (Python):
n = int(input())
b = 2
p = 2
max_n = 1
while True:
    power = b**p
    if power <= n:
        max_n = max(power, max_n)
        p += 1
    else:
        p = 2
        b += 1
    if b == 33:
        break
print(max_n)

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

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

Solution (Python):
x=int(input())
l=[]
for i in range(1,34):
    for j in range(2,11):
        y=i**j
        if x>1000:
            break
        l.append(y)
for i in range(x):
    if x-i in l:
        print(x-i)
        break

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

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

Solution (Python):
X=int(input())
A=[]
for k in range(X):
    x=X-k
    for i in range(2,10):
        if float.is_integer(x**(1/i)):
            A.append(x)
        else:
            continue
if X==1000:
    print(1000)
else:
    print(max(A))

Solution (Python):
n = int(input())
ans = 1
for i in range(1,1001):
    for j in range(2,1001):
        if i**j > n:
            break
        if ans < i**j <= n:
            ans = i**j
print(ans)

Solution (Python):
import itertools as its

X = int(input())

pows = []
for p in range(1, 1000+1):
    for q in range(2, 1000+1):
        n = p**q
        if n > X:
            break
        else:
            pows.append(n)

pows.sort(reverse=True)

print(pows[0])

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

Solution (Python):
x = int(input())
ans = [b**p for b in range(1001) for p in range(2,10)
      if b**p <= x]
print(max(ans))

Solution (Python):
X=int(input())
Y=int((X**(1/2)))

v=[1]
for i in range(2,Y+1):
    j = 2
    while(i**j<=X):
        v.append(i**j)
        j+=1
print(max(v))

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

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

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

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

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

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

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

Solution (Python):
x=int(input())
l=[]
for i in range(1,33):
    for j in range(2,11):
        if i**j<=1000:
            l.append(i**j)
s=sorted(list(set(l)))
for i in s:
    if x<i or x==1000:
        print(s[s.index(i)-1])
        break

Solution (Python):
import sys
import math

def isExponential(i : int) -> bool:
    for j in range(2,math.ceil(math.sqrt(i))+1):       
        devidend = i
        devisor = j
        
        while 1:
            
            if devidend % devisor != 0:
                break
            else:
                if devidend == devisor:
                    return True
                else:
                    devidend //= devisor
    return False

x = int(input())
if x == 1:
    print(1)
for i in range(x,0,-1):
    if isExponential(i) == True:
        print(i)
        
        break

Solution (Python):
import sys
import math

def isExponential(i : int) -> bool:
    
    for j in range(2,i):       
        devidend = i
        devisor = j
        
        while 1:
            
            if devidend % devisor != 0:
                break
            else:
                if devidend == devisor:
                    return True
                else:
                    devidend //= devisor
    return False

x = int(input())
if x == 1:
    print(1)
for i in range(x,0,-1):
    if isExponential(i) == True:
        print(i)
        
        break

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

Solution (Python):
def main():
  N = int(input())
  b = 2
  s = set()
  s.add(1)
  while b**2 <= N:
    p = 2
    while b**p <= N:
      s.add(b**p)
      p += 1
    b += 1

  print(max(s))


if __name__ == "__main__":
  main()

Solution (Python):
x=int(input())
y=int(x**0.5)+1
ans_list=[]
for i in range(y):
    for j in range(10):
        if i**j<=x:
            ans_list.append(i**j)
ans_list.sort()
print(ans_list[-1])

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

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

print(max)

Solution (Python):

import math

def read_input():
    x = int(input())
    return x


def submit():
    x = read_input()
    max_root = int(math.floor(math.sqrt(x)))

    max_square = 1
    for i in range(2, max_root + 1):
        test = i
        while test <= x:
            if test > max_square:
                max_square = test
            test *= i

    print(max_square)


if __name__ == '__main__':
    submit()

Solution (Python):
ls = [1]
for i in range(2, 32):
    if i in ls:
        continue
    temp = i ** 2
    while temp <= 1000:
        ls.append(temp)
        temp *= i
ls.sort(reverse=True)

x = int(input())
print([i for i in ls if i <= x][0])

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

print(max)

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

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

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

Solution (Python):
X = int(input())
x = int(X ** 0.5)
ans = [1]

for i in range(2,x+1):
    y = i
    while i <= X:
        i = i*y
    ans.append(i//y)
print(max(ans))

Solution (Python):

import numpy as np
import math
import re

n = int(input())

l = []
for i in range(n):
    for j in range(2,32):
        if i**j <= n:
            l.append(i**j)
        else:
            break;
if n == 1:
    print(1)
else:
    print(max(l))

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

z=[]
for i in range(1,32):
  for j in range(2,15):
    if i**j <= X:
      z.append(i**j)
    else:
      continue

print(max(z) if len(z) != 0 else 0)

Solution (Python):
def is_power(n):
    for p in range(2, 10):
        for b in range(1, 32):
            if b**p == n:
                return True
            if b**p > n:
                break

    return False


x = int(input())
for i in range(x, 0, -1):
    if is_power(i):
        print(i)
        break

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

for i in range(2, 32):
    for j in range(2,10):
        if i**j <= x:
            z = max(z,i**j)
    
print(z)

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

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

for i in range(2, int(math.sqrt(X))+1) :
    for j in range(2, int(math.log2(X))+1) :
        if (i**j <= X):
            max_num = max(max_num, i**j)
        else:
            break
print(max_num)

Solution (Python):
X=int(input())
l=[]
for i in range(1,X+1):
    for j in range(2,11):
        if i**j>X:
            break
        l.append(i**j)
l.sort()
print(l[-1])

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

Solution (Python):
n=int(input())
ans=1
for i in range(2,int(n**0.5)+1):
    for k in range(2,10):
        if i**k>n:break
        ans=max(ans,i**k)
print(ans)

Solution (Python):
import sys
from collections import Counter

x = int(input())
ans = 0

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

print(ans)

Solution (Python):
X = int(input())
x = int(X**0.5)
num = []
if X <= 3 :
    print(1)
else :
    for b in range(2,x+1) :
        p = 2
        while b**p <= X :
            p += 1
        num.append(b**(p-1))
    print(max(num))

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

Solution (Python):
n = int(input())
x = [1]
for i in range(2,40):
    j = i
    c = 2
    while True:
        k = j ** c
        if k <= n:
            x.append(k)
            c += 1
        else:
            break
print(max(x))

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

Solution (Python):

import sys


def solve(X: int):
    v = [1]
    for i in range(2, X + 1):
        sq = i
        while True:
            sq *= i
            if X < sq:
                break
            v.append(sq)
    print(sorted(v)[-1])



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 sys
input = sys.stdin.readline

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

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

for i in range(2, 1001):
    for j in range(2,11):

        temp = i**j

        if temp <= x:
            L.append(temp)
        else:
            break

L.sort()

print(L[-1])

Solution (Python):
import sys

X = int(input())

X_l = list(range(1,X+1))
box = set()

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

for i in X_l:
    for j in range(2, X+1):
        if i ** j in X_l:
            box.add(i ** j)
        elif i ** j > X:
            break

print(max(box))

Solution (Python):

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

for i in range(1, 32):
    for j in range(2, 10):
        if i ** j == x:
            print(x)
            exit()
        elif i ** j < x and i ** j not in lst:
            lst.append(i ** j)
        elif i ** j > x:
            break
            
lst.append(x)
lst = sorted(lst)

print(lst[lst.index(x) - 1])

Solution (Python):
import math

X = int(input())

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

l.sort()

print(l.pop())

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

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


if __name__ == '__main__':
	main()

Solution (Python):
import bisect
n=int(input())
l=[1]
for i in range(2,int(1000**0.5)+1):
    j=2
    while i**j<=1000:
        l.append(i**j)
        j+=1
l=list(set(l))
l.sort()
print(l[bisect.bisect_left(l,n+1)-1])

Solution (Python):
x =int(input())
p = 2
bpmax = 1
for b in range(2,int(x**0.5)+1):
    while b ** p <= x:
        bpmax=max(bpmax, b ** p)
        p += 1      
    else:
        p = 2
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)

print(ans)

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

bekijosu=[1]

for i in range(2, 1001):
    for j in range(2,10):
        if i ** j <= 1000:
            bekijosu.append(i ** j)

print(max([n for n in bekijosu if n <= X]))

Solution (Python):
import math
N = int(input())
m = 0
for i in range(int(math.sqrt(N))):
  n = i + 1
  tmp = 1
  for j in range(N):
    tmp *= n
    if tmp > N:
      break
    if tmp > m:
      m = tmp
print(m)

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

print(max(list))

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

for b in range(1, x+1):
    for p in range(2, 100):
        num = pow(b, p)
        if num <= x:
            ans.append(num)
        else:
            break

print(max(ans))

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

bekijos = set()
for b in range(1, 1001, 1):
  for p in range(2, 1001, 1):
    a = b**p
    if a > 1000: break
    bekijos.add(a)

xs = set()
for x in range(1, X+1, 1):
  xs.add(x)    
    
print(max(bekijos&xs))

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

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

vmax = 0
for i in range(2, N):
	v = i ** 2
	if N < v:
		break
	while True:
		v *= i
		if N < v:
			vmax = max(vmax, v // i)
			
			break

print(vmax)

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

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

Solution (Python):

import sys
INF = float("inf")


def solve(X: int):

    cand = [1]
    for i in range(2, 34):
        beki = i*i
        while beki*i <= X:
            beki *= i
        if beki <= X:
            cand.append(beki)
    print(max(cand))

    return


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):
X=int(input())
res=1
for i in range(1,X+1):
    for j in range(2,11):
        for k in range(35):
            if i==k**j:
                res=i
print(res)

Solution (Python):
ans = 0

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

Solution (Python):
import math
ans = 0
X = int(input())
if X<4:
    print(1)
else:
    for i in range(2,math.ceil(math.sqrt(X))):
        for j in range(math.ceil(math.log(X)/math.log(i))+1):
            if i**j <= X:
                ans = max(i**j,ans)
    print(ans)

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

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

nums = [1]
for i in range(2, 32):
    for j in range(2, 11):
        n = i ** j
        if n > X:
            break
        nums.append(n)

print(max(nums))

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

answer = 1
for b in range(2, 41):
    for p in range(2, 11):
        if x < b ** p:
            break
        answer = max(answer, b**p)

print(answer)

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

exp=set([1])
for i in range(2, 32):
	v = i*i
	while v <= x:
		exp.add(v)
		v *= i
print(max(exp))

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

Solution (Python):
s = int(input())
p = 0

for i in range(1,32):
    for j in range(2,10):
        k = i ** j
        if k <= s:
            if k > p:
                p = k
print(p)

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

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

print(ans)

Solution (Python):
X = int(input())
b = 1
p = 2
ans = 0
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):
n=int(input())
ans=0
for i in range(40):
  if i**2 <= n and ans<=i**2:
    ans=i**2
  if i**3 <= n and ans<=i**3:
    ans=i**3
  if i**5 <= n and ans<=i**5:
    ans=i**5
  if i**7 <= n and ans<=i**7:
    ans=i**7
print(ans)

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

Solution (Python):



b = int(input())
max = 0

for i in range(1, 33):
    for j in range(2, 11):
        val = i**j
        if val > b:
            break
        
        if max < val:
            max = val

print(max)

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

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

Solution (Python):
X = int(input())
ans = []
for b in range(1, X//2):
    for p in range(2, X//2):
        t = b**p
        if (t <= X):
            ans.append(t)
if (len(ans) == 0):
    print(1)
else:
    print(max(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())
y = []
for i in range(1,33):
  for j in range(2,11):
    y.append(i**j)
    
ans = 1
for i in y:
  if i <= x:
    ans = max(ans, i)
print(ans)

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

Solution (Python):
X = int(input())
lists = []
max = 1
for i in range(1,X+1):
    for j in range(2,X+1):
        if i**j <= X:
            if max < i**j:
                max = i**j
        elif i**j > X:
            break
print(max)

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

def isPrime(n):
  if n%2 == 0 or n%3 == 0: return True
  if n<3: return False
  for i in range( 2, int(n**0.5) +1):
    if n%i == 0: return False
  return True

primes = [i for i in range(1, 32) if isPrime(i)]

def isExp(n):
  if n==1: return True
  for i in [p for p in primes if p<int(n**0.5)+1]:
    p = 0
    while i**p<=n:
      if i**p == n: return True
      p+=1
  return False

def solve():
  for i in range(x,0,-1):
    if isExp(i): return i

print(solve())

Solution (Python):
import math
X = int(input())
answer = 0
for i in range(1,math.ceil(X**0.5)+1):
  for j in range(2,11):
    if i**j <= X:
      answer = max(i**j,answer)

print(answer)

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

ans = 1

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

print(ans)

Solution (Python):
import math
x = int(input())
t = math.floor(x ** (1/2))
a = [1]
for i in range(2, t+1):
    b = i
    while (b <= x):
        a.append(b)
        b *= i
print(max(a))

Solution (Python):

X = int(input())
ans = 0
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):
X = int(input())
r = int(X ** 0.5)
ans = 0
for i in range(1, r + 1):
    a = 0
    for j in range(1, 11):
        if i ** j <= X:
            a = i ** j
        else:
            break
    ans = max(ans, a)
print(ans)

Solution (Python):
import bisect
a = []
for pw in range(2,1001):
    for x in range(1,1001):
        nw = x**pw
        if nw > 1000:
            break
        a.append(nw)
a = sorted(a)
x = int(input())
y = bisect.bisect_right(a,x)
print(a[y-1])

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

Solution (Python):
x = int(raw_input())
ans = 1
for b in range(1,35):
	for p in range(2,10):
		tmp = b ** p
		if tmp <= x:
			ans = max(ans, tmp)
print ans

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

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

x = []

for i in range(1, 33):
  x = x +[i ** j for j in range(2, 10)]

x.sort()

import bisect

b = bisect.bisect_right(x, n)

print(x[b-1])

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

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

def my_pow(b,p):
    tmp = 1
    for i in range(0,p):
        tmp *= b
    return tmp

res = []
for b in range(2,100):
    for p in range(2,10):
        beki = my_pow(b,p)
        if beki > X:
            break;
        res.append(beki)

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

print(max(res))

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

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

Solution (Python):
import math

n = int(input())
limit = int(math.sqrt(n))
ansi = 0
exp = [1]
i = 2
beki = 1
while i <= limit:
    temp = i**beki
    if temp <= n:
        exp.append(temp)
        beki += 1
    else:
        beki = 1
        i += 1

exp.sort()
print(str(exp[-1]))

Solution (Python):
import math
x = int(input())
ans = 1
for b in range(2,int(math.sqrt(x)) + 1):
	m = b
	while(m * b <= x):
		m*=b
	ans = max(ans,m)
print(ans)

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

def check(num):
    for i in range(2, 33):
        j = i * i
        while j < num:
            j *= i
        else:
            if j == num:
                return True
    return False

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

while True:
    if check(n):
        print(n)
        exit()
    n -= 1
    if n == 1:
        break

print(1)

Solution (Python):
from sys import stdin
X=int(stdin.readline().rstrip())
dif=1000
for i in range(1,32):
    for j in range(2,10):
        if pow(i,j) > X:
          break
        if X-pow(i,j) < dif:
            dif=X-pow(i,j)
            ans=pow(i,j)
print(ans)

Solution (Python):
x=int(input())
t=[1]
for n in range(2, int(x**0.5)+1):
    for p in range(2, 11):
        v = n**p
        if v > x:
            break
        t.append(v)
print(max(t))

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

Solution (Python):
import math
X = int(input())
max_num = []
temp_max = 0
for i in range(1,int(math.sqrt(X))+1):
    for j in range(1,10):
        if i**j <= X:
            if i**j > temp_max:
                temp_max = i**j
print(temp_max)

Solution (Python):


x = int(input())

ans = 0

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

print(ans)

Solution (Python):
def judge(x):
    for i in range(2, x):
        t = x
        while t != 1:
            if t % i == 0:
                t //= i
            else:
                break
            if t == 1:
                return True
    return False


x = int(input())

ans = 1

for i in range(x, 1, -1):
    if judge(i):
        ans = i
        break

print(ans)

Solution (Python):
a=int(input())
ans=1
for i in range(40):
  for j in range(2,11):
    if i**(j+1)>a and i**j<=a:
      ans=max(ans,i**j)
      break
print(ans)

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

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

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

beki = []
for i in range(1,40):
  for j in range(2,10):
    if i**j <= 1000 and i**j not in beki:
      beki.append(i**j)
beki.sort()

index = bisect.bisect(beki, x)
print(beki[index-1])

Solution (Python):
x = int(input())
j = 2
a = 0
t = 0
if x == 1:
    print("1")
    exit()
for i in range(2,32):
    j = 2
    while True:
        t = i ** j
        if t <= x:

            j += 1
            a = max(a,t)
        else:
            break
print(a)

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

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

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

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

from math import sqrt
for i in range(1, X + 1):
    if i == 1:
        ans = i
    for b in range(2, int(sqrt(i)) + 1):
        tmp = b * b
        while tmp < i:
            tmp *= b
        if tmp == i:
            ans = i

print(ans)

Solution (Python):

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