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())
ans = 1

n = int(x**0.5)
for i in range(n, 1, -1):
    j = 2
    while True:
        m = i**j
        if m > x:
            break
        if ans < m:
            ans = m
        j += 1

print(ans)

Solution (Python):
X=int(input())
if X==1:
  print(1)
else:
  ans=0
  import math
  for i in range(2,int(math.sqrt(X))+1):
    val=i*i
    while val*i<=X:
      val=val*i
    ans=max(ans,val)
    if ans==X:
      break
  print(ans)

Solution (Python):
from math import floor
X = int(input())
if X != 1000:
    tmp = []
    for i in range(2,100):
        tmp.append(floor(X**(1/i))**i)
    print(max(tmp))
else:
    print(1000)

Solution (Python):
import math
n = int(input())
j = 2
tmp = 0
Max = 1
for i in range(2,n):
  while(n > tmp):
    tmp = i**j
    j+=1
    if(Max < tmp and n >= tmp):
      Max = tmp
  j = 2
  tmp = 0
print(Max)

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

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

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

ans = [1]
for b in range(2, int(math.sqrt(X))+1):
  p = 2
  while True:
    if b**p <= X:
      ans.append(b**p)
      p+=1
    else:
      break
print(max(ans))

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

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

Solution (Python):
candidates = set([1])

for b in range(2, int(1000**1/2)+1):
  p = 2
  while b**p <= 1000:
    candidates.add(b**p)
    p += 1

X = int(input())

for c in sorted(candidates, reverse=True):
  if c <= X:
    print(c)
    exit()

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

Solution (Python):
x = int(input())
max_num = 0
for elm1 in range(1,int(x ** 0.5) + 1):
    for elm2 in range(1,int(x ** 0.5) + 1):
        tmp_num = elm1 ** elm2
        if tmp_num <= x and tmp_num >= max_num:
            max_num = tmp_num
        else:
            continue
print(max_num)

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect

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()))
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):
x = int(input())
ans = [1]
for i in range(2, x):
    for j in range(2,11):
        ad = i**j
        if ad > x:
            break
        ans.append(ad)
print(max(ans))

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

for i in range(x, 0, -1):
    for j in range(2, i):
        s = i
        while s%j == 0:
            t = s % j
            s = s // j
            if s == 1 and t == 0:
                print(i)
                exit()       
print(1)

Solution (Python):
x=int(input())
a=[]
for i in range(40):
    for j in range(2,10):
        if i**j <= x:
            a.append(i**j)
b=list(set(a))
b.sort()


print(max(b))

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

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

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

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

Solution (Python):
import numpy as np
x = int(input())
upper = int(np.sqrt(x))
ans = 1

for i in range(2,upper+1):
    ct = 0
    while i**ct <= x:
        ct += 1       
    ans = max(ans,i**(ct-1))
    
print(ans)

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

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

print(c)

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

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

z = []
for p in range(2,10):
    for b in range(1,32):
        if b**p <= x:
            z.append(b**p)
print(max(z))

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

Solution (Python):
import bisect as bi

X=int(input())

l=[]

for p in range(2,11):
    l.extend([x**p for x in range(1,int(1000**(1/p))+2)])

l.sort()

ind=bi.bisect_right(l,X)-1
print(l[ind])

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

Solution (Python):
def solve():
    x = int(input())
    if x < 4:
        return 1
    elif x < 8:
        return 4
    elif x < 9:
        return 8
    l = [i**j for i in range(1,x+1) for j in range(2,int(x**0.5)) if i**j<=x]
    return max(l)
        
if __name__ == '__main__':
    print(solve())

Solution (Python):
N = int(input())
l = {1}
for i in range(2,32):
  j = 2
  while(i ** j <= N):
    l.add(i ** j)
    j += 1

for i in range(N, 0, -1):
  if(i in l):
    print(i)
    break

Solution (Python):
N=int(input())
ans=1
S=[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]
    
i=0
while S[i] <= N:
    i+=1
    if len(S)<=i:
        break
    
print(S[i-1])

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

Solution (Python):
X = int(input())
m = 1
for i in range(1, 40):
    for j in range(2, 15):
        beki = i ** j
        if beki > X:
            continue
        if m < beki:
            m = beki
print(m)

Solution (Python):
x = int(input())
c = 1
for i in range(2,11):
  for n in range(1,32):
    ni = n**i
    if ni > c and x >= ni:
      c = ni
print(c)

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

if x == 1000 :
    print(1000)
else :
    beki = []
    for i in range(2, 10) :
        beki.append(int(x ** (1 / i)) ** i)

    print(max(beki))

Solution (Python):
import math
X = int(input())
n = math.ceil(X**0.5+1)
lst = []
if X == 1 or X == 2 or X == 3:
  print(1)
  exit()
for i in range(2, n):
  a = 2
  while i**a <= X:
    lst.append(i**a)
    a += 1
lst.sort()
print(lst[-1])

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

for i in range(2, X):
    for j in range(2, X):
        e = i ** j
        if e <= X:
            if e > ans:
                ans = e
        else:
            break

print(ans)

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

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

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

Solution (Python):
x = int(input())
a = [1]
for i in [2, 3, 5, 6, 7, 10, 11, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 24, 26, 27, 28, 29, 30, 31]:
    j = 2
    while i**j <= 1000:
        a.append(i**j)
        j += 1
a = sorted(a)
for k in a:
    if k<=x:
        ans = k
    else:
        break
        
print(ans)

Solution (Python):
import math
X=int(input())
u=int(math.sqrt(X))+1
ans=1
for i in range(2,u):
  tmp=1
  while i**tmp<=X:
    tmp+=1
  ans=max(ans,i**(tmp-1))
  
print(ans)

Solution (Python):
x = int(input())
ans = []
if x < 4:
  print(1)
else:
  for i in range(2, x):
    temp = i
    if i**2 == x:
      print(x)
      break
    elif i**2 > x:
      print(max(ans))
      break
    else:
      while True:
        temp *= i
        if temp > x:
          temp //= i
          break
      ans.append(temp)

Solution (Python):
import bisect

X = int(input())

ex = [1]
for i in range(2,33):
    x = i*i
    while x <= 1000:
        ex.append(x)
        x = x*i

ex = list(set(ex))
ex.sort()
        
print(ex[bisect.bisect_right(ex, X)-1])

Solution (Python):
x=int(input())
l=[1]
for i in range(2,32):
    for k in range(2,10):
        if i**k<=1000:
            l.append(i**k)
        else:
            break
l=list(set(l))
l.sort()

for i in range(1,len(l)):
    if x<l[i]:
        print(l[i-1])
        break
else:print(1000)

Solution (Python):
def slove():
    import sys
    input = sys.stdin.readline
    x = int(input().rstrip('\n'))
    mt = 0
    for i in range(1, 1001):
        for j in range(2, 1001):
            if i ** j > x:
                break
            else:
                mt = max(mt, i ** j)
    print(mt)


if __name__ == '__main__':
    slove()

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

ans = 1
for i in range(1,x):
    for j in range(2,11):
        if pow(i,j) <= x and ans <= pow(i,j):
            ans = i**j
print(ans)

Solution (Python):
import sys

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

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

print(ans)

Solution (Python):
n=int(input())
b=[]
for i in range(30):
    i+=2
    s=i*i
    while s <=1000:
        b.append(s)
        s=s*i
ans=1
for i in range(len(b)):
    if b[i] <= n and ans < b[i] :
        ans=b[i]
print(ans)

Solution (Python):
import math
x=int(input())
n=int(math.sqrt(x))
ans=0
for i in range(1,n+1):
    for j in range(2,10):
        if i**j>x:
            continue
        elif ans<i**j:
            ans=i**j
        else:
            pass
print(ans)

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

Solution (Python):
X=int(input())
ans=0
for i in range(2,10):
  tmp=int(pow(X,1/i)+1)**i
  if tmp > X:
    tmp=int(pow(X,1/i))**i
  ans=max(ans,tmp)
print(ans)

Solution (Python):
x = int(input())
output = 1
if x == 1:
    print(1)

else:
    for i in range(2, 33):
        for k in range(2, 10):
            if output < i ** k <= x:
                output = i ** k

    print(output)

Solution (Python):

X = int(open(0).read())

max_exp=1
exp=0
for i in range(1,X+1):

    for j in range(2,X+1):

        exp = i**j
        if exp > X:
            break
        if max_exp < exp:
            max_exp = exp
print(max_exp)

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

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

max_v = 1

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

Solution (Python):
x = int(input())
beki = sorted({b**p for b in range(1,100) for p in range(2,100)})
print(max(i for i in beki if i <= x))

Solution (Python):
N=int(input())
l=[1]
import math
for n in range(2,N+1):
    for p in range(2,N+1):
        if n**p<=N:
            l.append(n**p)
        else:
            break
print(max(l))

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

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

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

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

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

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

ans=0

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

min=x-1
for i in range(2,x+1):
        a=i*i
        while a <= x:
            b=x-a
            if b <= min and b >= 0:
                min=b
                ans=a
                
            a *=i
print(ans)

Solution (Python):
X = int(input())
a = 0
for i in range(1,X+1):
    for l in range(2,11):
        if i**l <= X and i**l > a:
            a = i**l
print(a)

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

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

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

L = [1]
b = 2
while b <= X**0.5:
    p = 2
    while b**p <= X:
        L.append(b**p)
        p += 1
    b += 1
    
print(max(L))

Solution (Python):
x=int(input())
max=0
if x==1:
    print(1)
else:
    for i in range(1,x):
        for j in range(3,x):
            if i**j>x:
                if x>=i**(j-1)>max:
                    max=i**(j-1)
                break
    print(max)

Solution (Python):
N = int(input())
ans = 0
if N ==1:
  print(1)
  exit()
else:
  for i in range(int(N**0.5)+1):
    for j in range(100):
      if i**j<=N:
        ans =max(ans,i**j)
      else:
        break
print(ans)

Solution (Python):
x = int(input())
li,p,ans = [],1,0

for b in range(2,int(x**0.5//1)+1):
    while b**p<=x:
        ans = max(ans,b**p)
        p += 1
        li.append(b**(p-1))
        if b**p>x:
            p = 1
            break
if x <= 3:
    print(x)
else:
    print(max(li))

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

Solution (Python):
import sys

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

    if x <= 3:
        print(1)
        sys.exit()

    
    s = set()
    for i in range(2,31+1): 
        r = i*i
        while r <= 1000:
            s.add(r)
            r *= i
    t = list(s)
    t.sort()
    t.reverse()

    for i in t:
        if i <= x:
            print(i)
            sys.exit()

bb097()

Solution (Python):
import math

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

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

s = set()
for i in range(1, 32):
    for j in range(2, 10):
        if i**j <= 1000:
            s.add(int(i**j))

l = [int(i) for i in s]
l = sorted(l)

ans = 0
for i in l:
    if i <= x:
        ans = i
    else:
        break

print(ans)

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

num_list = []
for x in range(1, X + 1):
    for i in range(2, 11):
        if (x ** i) <= X:
            num_list.append(x ** i)
        else:
            break


print(max(num_list))

Solution (Python):
from sys import exit
n = int(input())
powlist = set()
k = 2
chance = True
if n == 1:
    print(1)
    exit()
while chance:
    for i in range(1, n):
        key = i**k
        if key <= n:
            powlist.add(key)
        else:
            k += 1
            judge = i
            break
    if judge == 2:
        chance = False
print(max(powlist))

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):
r=range(1,32)
l=range(2,32)
x=int(input())
arr=[]
for i in r:
    for j in l:
        if i**j<=x:
            arr.append(i**j)
print(max(arr))

Solution (Python):
import math
X=int(input())
ans=0
for i in range(1,int(math.sqrt(X))+1):
  for j in range(2,X+2):
    val=i**j
    if val<=X and val>ans:
      ans=val
print(ans)

Solution (Python):
import math
X = int(input())
res = 0
for b in range(1, int(math.sqrt(X))+1):
    for p in range(2, int(math.sqrt(X))+2):
        val = b**p
        if (val <= X) and (val > res):
            res = val
print(res)

Solution (Python):
import sys
X = int(input())
res = 0
for b in range(1, -(-X//2)+1):
    for p in range(2, -(-X//2)+2):
        val = b**p
        if (val <= X) and (val > res):
            res = val
print(res)

Solution (Python):
n=int(input())
def gauss_2(n):
    g=0
    while g<=n**(1/2):
        g+=1
    return g-1

def gauss_3(n):
    g=0
    while g<=n**(1/3):
        g+=1
    return g-1
def gauss_4(n):
    g=0
    while g<=n**(1/4):
        g+=1
    return g-1
def gauss_5(n):
    g=0
    while g<=n**(1/5):
        g+=1
    return g-1
def gauss_6(n):
    g=0
    while g<=n**(1/6):
        g+=1
    return g-1
def gauss_7(n):
    g=0
    while g<=n**(1/7):
        g+=1
    return g-1

if n<=3:
    print(1)
elif n not in (125,216,343,512,729,1000):
    print(max(gauss_2(n)**2,gauss_3(n)**3,gauss_4(n)**4,gauss_5(n)**5,gauss_6(n)**6,gauss_7(n)**7))
else:
    print(n)

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

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

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

print(ans)

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

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

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

print(ans)

Solution (Python):
import math

n = int(input())

best_num = 1

for i in range(1, int(math.sqrt(n))+1):
  for j in range(1, 10):
    if i**j <= n and best_num < i**j:
      best_num = i**j

print(best_num)

Solution (Python):
import math

x = int(input())

x_sqrt = int(math.sqrt(x))

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

print(ans)

Solution (Python):
import math
from bisect import  bisect_right

X = int(input())

s = list([1])

for i in range(2,math.ceil(1000**0.5)):
    for j in range(2,9):
        if i**j > 1000:
            break
        else:
            s.append(i**j)

s.sort()
print(s[bisect_right(s,X) -1])

Solution (Python):
x = int(input())
ans = 0
while True:
    i = 2
    while i < 11:

        if round(x**(1/i),1)==round((x**(1/i)),8):
            ans = x
            break
        i += 1
    if ans != 0:
        break
    x -= 1

print(ans)

Solution (Python):
Y=[0]*1001
Y[1]=1
for i in range(2,34):
  for j in range(2,10):
    if i**j<=1000:
      Y[i**j]=i**j


for i in range(1,1001):
  if Y[i]==0:
    Y[i]=Y[i-1]
print(Y[int(input())])

Solution (Python):
x = int(input())
if x < 4:
  print(1)
  exit()
import math
result = 1
for i in range(2,x+1):
  if math.floor(math.log(x,i)+1/100000) > 1:
    result = max(result, i ** math.floor(math.log(x,i)+1/100000))
  
print(result)

Solution (Python):
n = int(input())
lis = [i**j for i in range(1, 32) for j in range(2, 10) if i**j <= n]
lis = list(set(lis))
lis.sort()
print(lis[-1])

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

Solution (Python):
X=int(input())
a=0
for i in range(40):
  for j in range(2,20):
    if i**j<=X:
      a=max(a,i**j)
print(a)

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

Solution (Python):
import sys
from collections import defaultdict
sys.setrecursionlimit(200000)
input = sys.stdin.readline

N, = map(int, input().split())

ans = 1

for i in range(2, N):
    c = 2
    if i ** c <= N:
        while (i ** c) <= N:
            c += 1
    else:
        continue
    ans = max(ans, i ** (c - 1))

print(ans)

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

Solution (Python):
X = int(input().strip())
ans = 1
for i in range(2, int(X**0.5)+1):
  now = i
  while True:
    now *= i
    if now > X: break
    ans = max(ans, now)

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

Solution (Python):
X = int(input())
if X == 1:
    print(1)
    exit()

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

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

Solution (Python):

def main():
    X = int(input())
    cand = [1]
    for i in range(2, int(X ** 0.5) + 1):
        p = 2
        while i ** p <= X:
            cand.append(i ** p)
            p += 1
    ans = max(cand)
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):

def main():
    X = int(input())
    cand = {1}
    for i in range(2, int(X ** 0.5) + 1):
        p = 2
        while i ** p <= X:
            cand.add(i ** p)
            p += 1
    ans = max(cand)
    print(ans)


if __name__ == "__main__":
    main()

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

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

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

print(x)

Solution (Python):
x = int(input())
Powers = [1]
for i in range(2,32):
  k = i**2
  while k<=1000:
    Powers += [k]
    k *= i
Powers.sort(reverse = True)
for power in Powers:
  if power <= x:
    print(power)
    break

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

res = 1
for b in range(2, x):
    if b**2 > x:
        break
    i = 2
    while b**(i + 1) <= x:
        i += 1
    if i > 1:
        res = max(res, b**i)
print(res)

Solution (Python):
import sys
from functools import reduce
import copy
import math


sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    X = int(inputs[0])
    max = 1
    for x in range(1, X + 1):
        for y in range(2, X + 1):
            c = x ** y
            if c <= X:
                max = c if c > max else max
            else:
                break
    return max


def string_to_int(string):
    return list(map(int, string.split()))


if __name__ == "__main__":
    ret = solve(inputs(1))
    print(ret)

Solution (Python):
import math

def sol(ans, i):
  for j in range(2,1001):
    tmp_ans = math.pow(i,j)
    if tmp_ans > X: return ans
    elif ans < tmp_ans: ans = tmp_ans
  return ans

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

ans = -1 * float('inf')
for i in range(1,1001):
  ans = sol(ans,i)
print(int(ans))

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

for i in range(1, 100):
    for j in range(2, 100):
        tmp = i**j
        if tmp <= x:
            ans = max(ans, tmp)
print(ans)

Solution (Python):
X=int(input())
a=0
for i in range(40):
    for j in range(2,20):
        if i**j<=X:
            a=max(a,i**j)
print(a)

Solution (Python):

import sys
import math
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)

x = int(input())

ans = 0
for b in range(1, x + 1):
    for p in range(2, math.floor(math.sqrt(x))+2):
        tmp = b ** p
        
        if (tmp <= x):
            ans = max(ans, tmp)
print(ans)

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

Solution (Python):
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
    
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())
soFar = 1
for i in range(1, x):
    for j in range(2, x):
        current = i ** j
        if current <= x:
            soFar = max(soFar, current)
        else:
            break
print(soFar)

Solution (Python):

X = int(input())

for i in range(X,0,-1):
    for b in range(1,X+1):
        for q in range(2,10):
            if i == b**q:
                print(i)
                exit()
            else:
                pass

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

Solution (Python):
x = int(input())
xMax = 0
for i in range(2, 10):
    for j in range(32):
        if j ** i > x:
            break
        if xMax < j ** i:
            xMax = j ** i

print(xMax)

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):
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())
n = [1]
for i in range(2, x):
  c = 2
  while True:
    if i**c > x:
      break
    n.append(i**c)
    c += 1
print(max(n))

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

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

for i in sorted(ans, reverse=True):
    if i <= X:
        print(i)
        exit()
    else:
        continue

Solution (Python):
X = int(input())
A = [1]
a = 2
while a**2 <= 1000:
    tmp = a**2
    while tmp <= 1000:
        A.append(tmp)
        tmp *= a
    a += 1
A = sorted(A)
A
for i in range(len(A)):
    if A[i] > X:
        break
if X == 1000:
    print(1000)
else:
    print(A[i-1])

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

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 6)


def main():
    x=int(input())
    if x==1:
        print(1)
        exit()
    ans=0
    b=32
    for p in range(2,11):
        while b**p>x:
            b-=1
            if b==1:
                print(ans)
                exit()
        ans=max(ans,b**p)

main()

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 6)


def main():
    x=int(input())
    if x==1:
        print(1)
        exit()
    ans=0
    for b in range(2,33):
        for p in range(2,11):
            if b**p>x:break
            ans=max(ans,b**p)
    print(ans)

main()

Solution (Python):
x=int(input())
beki=[0,1]
for i in range(2,1001):
    tmp=i
    while(1):
        tmp*=i
        if tmp<=1000:
            beki.append(tmp)
        else:
            break
beki.sort()
for i in range(len(beki)):
    if beki[i]<=x:
        ans=beki[i]
print(ans)

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

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

Solution (Python):
L = [1]
for b in range(2,32):
  for p in range(2,10):
    n = int(b**p)
    if n not in L and n <= 1000:
      L.append(n)
L = sorted(L)
X = int(input())
s = sum(x<=X for x in L)
print(L[s-1])

Solution (Python):

import sys


def ILI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def ISI(): return map(int, sys.stdin.readline().rstrip().split())
def II(): return int(sys.stdin.readline().rstrip())
def ISS(): return sys.stdin.readline().rstrip().split()
def IS(): return sys.stdin.readline().rstrip()

N = II()
max = 0
val = 0
if N != 1:
    for i in range(2, N+1):
        p = 2
        while val < N:
            if i ** p <= N:
                val = i ** p
                p += 1
            else:
                break
            if max < val:
                max = val
else:
    max = 1
print(max)

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

import math
ans = 1
for i in range(2, math.ceil(math.sqrt(x)) + 1):
    tmp = i
    while tmp <= x:
        tmp *= i
    ans = max(ans, tmp // i)

print(ans)

Solution (Python):
x = int(input())
c = 1
for b in range(2,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())
L=[]
for p in range(2,10):
    for b in range(1,32):
        l=b**p
        L.append(l)
R=[i for i in L if i<=x]
print(max(R))

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

Solution (Python):
X=int(input())
mx=1
if X==1:
    print(1)
    exit()
for i in range(2,int(X**0.5)+1):
    p=2
    while i**p<=X:
        temp=i**p
        mx=max(temp,mx)
        p+=1

print(mx)

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

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

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

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