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

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

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

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

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

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


print(a)

Solution (Python):
X = int(input())
res = 1
x=int(X**0.5+1)
for i in range(2,x):
    t = i**2
    while t<=X:
        t = t*i
    res = max(res,t//i)
print(res)

Solution (Python):

import math

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

    ex = []

    b = int(math.sqrt(X))
    ex.append(b * b)
    for b in range(2, 11):
        for p in range(3, 10):
            if b ** p <= X:
                ex.append(b ** p)
            else:
                break

    print(max(ex))


if __name__ == '__main__':
    main()

Solution (Python):
import math
a=int(input())
b=[]
for i in range(2,11):
    if math.ceil(a**(1/i))>=2:
        b.append((math.ceil(a**(1/i))**i if math.ceil(a**(1/i))**i<=a else math.floor(a**(1/i))**i))
print(max(b)if a>3else 1)

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

Solution (Python):
N=int(input())
ans=1
for i in range(2,N):
  temp=i
  while temp*i <= N:
    temp=temp*i
    ans=max(ans,temp)
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())
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
ans = 1
for b in range(X):
    if b== 0 or b == 1:
        continue
    p = 2
    while b ** p <= X:
        n = b ** p
        p += 1
    if ans < n:
        ans = n
print(ans)

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

Solution (Python):
X = int(input())
max_num = 1
for i in range(1,X+1):
  for p in [2,3,5,7]:
    calc = i**p
    if(calc <= X):
      max_num = max(max_num, calc)
print(max_num)

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

Solution (Python):
X = int(input())
m = 0
for b in range(1,40):
    for p in range(2,15):
        t = b ** p
        if t <= X:
            m = max(m, t)

print(m)

Solution (Python):
import math
x = int(input())
h = math.floor(math.sqrt(x))
c = []
for i in range(h+1):
    for j in range(h+1):
        if i**j<=x:
            c.append(i**j)
print(max(c))

Solution (Python):

import sys
import math
input = sys.stdin.readline

X = int(input())
val = int(math.sqrt(1000)) + 1

ans = 1
for p in range(2, 10):
    for b in range(1, val):
        tmp = max(ans, pow(b, p))
        if tmp > X:
            break
        ans = tmp
print(ans)

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

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

n=2
p=2
max=0
b_flag=True
while True:
    n+=1
    
    while True:
        if n**p>X:
            break
        elif max<n**p:
            max=n**p
        p+=1

    p = 2
    b_flag=True
    if n**p>X:
        break
print(max)

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

Solution (Python):
X=int(input())
check=0
maxx=0

if(X<=3):
    print(1)
    quit()

for i in range(2,1001):
    for j in range(2,1001):
       check=i**j
       if(check>X):
           break
       if(maxx<check ):
           maxx=check

print(maxx)

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

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

ans.sort(reverse= True)

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

Solution (Python):
X=int(input())
check=0
maxx=0

if(X<=3):
    print(1)
    quit()

for i in range(2,1001):
    for j in range(2,1001):
       check=i**j
       if(check>X):
           break
       if(maxx<check ):
           maxx=check

print(maxx)

Solution (Python):



def main():
    """Function."""
    x = int(input())

    max_val = 0
    min_diff = 1000
    for i in range(1, 32):
        for j in range(2, 10):
            temp = i ** j
            if temp > x:
                break
            else:
                temp_dif = x - temp
                if temp_dif < min_diff:
                    min_diff = temp_dif
                    max_val = temp

    print(max_val)


if __name__ == "__main__":
    main()

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

n=int(math.sqrt(X))
ans=0

if(X==1 or X==2 or X==3):
    print(1)
else:
    for i in range(2,n+1):
        j=2
        while(i**j<=X):
            if(i**j>ans):
                ans=i**j
            j+=1
    print(ans)

Solution (Python):
x=int(input())
while sum(round(x**(1/k))**k!=x for k in [2,3,5,7])==4:
  x-=1
print(x)

Solution (Python):
x=int(input())
while round(x**0.5)**2!=x and round(x**(1/3))**3!=x and round(x**(1/5))**5!=x and round(x**(1/7))**7!=x:
  x-=1
print(x)

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

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

print(ans)

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

if X == 1:
    ans = 1
else:
    b = 2
    p = 2
    ans = b ** p
    while b <= X:
        while True:
            tmp = b ** p
            if tmp <= X:
                ans = max(ans, tmp)
                p += 1
            else:
                break
        p = 2
        b += 1

print(ans)

Solution (Python):
x = int(input())
res = 0
for i in range(1,int(x**.5)+1):
    for j in range(2,1000):
        if i ** j > x:
            break
        res = max(res, i ** j)
print(res)

Solution (Python):
X =int(input())
max = 1 
for k in range(X):
    for j in range(X):
        if k**2 > X:
            break
        elif k**j > X:
            sub_max = k**(j-1)
            if sub_max >= max:
                max = sub_max
            break
            
print(max)

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

Solution (Python):
from math import sqrt


def main():
    x = int(input())
    res = 1
    for i in range(2, int(sqrt(x)) + 1):
        b = i ** 2
        while b <= x:
            res = max(res, b)
            b *= i
    print(res)


if __name__ == '__main__':
    main()

Solution (Python):

X = int(input())
import math
a = [math.pow(i,j) for j in range(2,11) for i in range(1,32) if math.pow(i,j)<=X]
print(int(max(a)))

Solution (Python):
from statistics import mean, median,variance,stdev
import sys
import math
import fractions
def j(a):
    if a==1: print("Yes")
    else :print("No")


def ct(x,y):
    if (x>y):print("")
    elif (x<y): print("")
    else: print("")

def ip():
    return int(input())

x = ip()                              






num = 1
max = 1
for i in range(1,x+1):
    for j in range(2,x+1):
        l = pow(i,j)
        if l>x: break
        elif l > max: max = l
print(max)

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

a=[1]
for i in range(2,33):
	for j in range(2,11):
		x=i**j
		if x<=1000:
			a.append(x)

a=list(set(a))
a.sort()
	
def binarySearch(value, xList):
    low=0
    high=len(xList)
    while low!=high:
        mid=(low+high)//2
        if xList[mid]<=value:
            low=mid+1
        else:
            high=mid
    return xList[low-1]
		
print(binarySearch(n,a))

Solution (Python):
import math

X = int(input())
max_exp = 0

for b in range(1,50) :
    for p in range(2,10) :
        exp = int(math.pow(b,p))
        if (exp > X) :
            continue
        if (max_exp < exp)  :
            max_exp = exp

print(max_exp)

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


list1=[1]
for i in range(2,32):
  n=2
  while i**n <= 1000:
    list1.append(i**n)
    n+=1

list1.sort()


list1=[i for i in list1 if i <= x]

print(max(list1))

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

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

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

def addList(i):
    for p in range(2,10):
        if i**p <= X:
            expoList.append(i**p)
        else:
            break

for q in range(1,32):
    addList(q)

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

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

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

Solution (Python):
n = int(input())
ans = 1
list_a = []
for i in range(2, n+1):
    for b in range(1, 100):
        for p in range(2, 10):
            if i == b**p and i<=n:
                ans = i
                list_a.append([i, b, p])
print(ans)

Solution (Python):
x = int(input())
m = 0
for b in range(1, 32):
  p = 2
  while b**p <= x:
    if m < b**p:
      m = b**p
    p += 1
    if b == 1:
      break
print(m)

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

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

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

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

b=[]

for k in range(2,10):
	for i in range(1,32):
		if i**k<=1000:
			b.append(i**k)

c=[]
for i in b:
	if a>=i:
		c.append(i)
print(max(c))

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

upper_b=int(math.sqrt(x))

for i in range(1,upper_b+1):
  for j in range(2,11):
    if i**j <=x:
      tmp=max(tmp,i**j)
print(tmp)

Solution (Python):
list = [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]
x = int(input())

for i in sorted(list,reverse = True):
  if x >= i:
    print(i)
    break

Solution (Python):
x = int(input())
a =[1]
c = 1
n = 2
while c <= 33:
    n = 2
    c += 1
    while c**n<=1000:
        a.append(c**n)
        n += 1
for i in range(len(a)):
    if a[i] > x:
        a[i] = -1000
    else:
        a[i] -= x
print(a[a.index(max(a))]+x)

Solution (Python):
import math
x=int(input())
if x==1 or x==2 or x==3:
  print(1)
  exit()
a=int(math.sqrt(x))
m=0
b=0
for i in range(2,a+1):
  b=1
  while True:
    b*=i
    if b>x:
      break
    if b>m:
      m=b
print(m)

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

i = 2
max_num = 1
while i <= a:
    j = 2
    temp = 0
    while i**j <= a:
        temp = i**j
        j+=1

    if temp > max_num and temp <= a:
        max_num = temp
    i+=1
print(max_num)

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

Solution (Python):
z=int(input())
x=[]
for i in range(31):
  for j in range(10):
    if (i+1)**(j+2)<=z:
      x.append((i+1)**(j+2))
print(max(x))

Solution (Python):
def main():
    x = int(input())
    if x == 1:
        print(1)
        return

    m = 1
    for b in range(2, x):
        p = 2
        while True:
            e = b ** p
            if e > x:
                break
            if e > m:
                m = e
            p += 1

    print(m)

if __name__ == "__main__":
    main()

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

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

Solution (Python):
import math

x = int(input())

pow_list = [1, 1000]
i = 2
while i**2 < 1000:
    j = 2
    while i**j < 1000:
        pow_list.append(i**j)
        j += 1
    i += 1

pow_list = set(pow_list)

for i in range(x, 0, -1):
    if i in pow_list:
        res = i
        break

print(res)

Solution (Python):
n=int(input())
 
mx=1
for i in range(2,11):
    mx=max(mx,int(n**(1/i)+0.0000000000001)**i)
 
print( mx)

Solution (Python):
import itertools
X = int(input())
table = [0] * 1001
for b, p in itertools.product(range(1, 32), range(2, 10)):
    if b ** p < 1001:
        table[b ** p] = 1
print(X - table[X::-1].index(1))

Solution (Python):
import itertools
X = int(input())
table = [0] * 1001
for b, p in itertools.product(range(1, 32), range(2, 10)):
    if b ** p < 1001:
        table[b ** p] = 1
print(X - table[X::-1].index(1))

Solution (Python):
X = int(input())
for i in range(X,0,-1):
    for j in [2,3,5,7,11]:
        if round(pow(i,1/j),10).is_integer():
                print(i)
                exit()

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

result = 1

for i in range(2, 33):
    for j in range(2, 11):
        r = i**j
        if r <= X:
            result = max(result, r)

print(result)

Solution (Python):
x = int(input())
c = 1
for i in range(2,32):
  for j in range(2,10):
    b = i ** j
    if b > x: 
      break
    elif b > c:
      c = b
print(c)

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

for b in range(1, 33):
    for p in range(2, 10):
        exp = pow(b, p)
        if exp > X:
            break
        else:
            max_e = max(exp, max_e)

print(max_e)

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

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

Solution (Python):
x = int(input())
l = [1, 4, 8, 16, 32, 64, 128, 256, 512, 9, 27, 81, 243, 729, 25, 125, 625, 36, 216, 49, 343, 100, 1000, 121, 144, 169, 196, 225, 289, 324, 361, 400, 441, 484, 529, 576, 26**2, 28**2, 29**2, 900, 31**2]
l = list(set(l))
l.sort()
for i in range(len(l)):
  if x < l[i]:
    print(l[i-1])
    break
  elif x == 1:
    print('1')
    break
  elif x == 1000:
    print('1000')
    break

Solution (Python):
import math

x = int(input())

rx = math.sqrt(x)
ceil = int(math.ceil(rx))
ans = 1
for i in range(2, ceil):
    num = 1
    while num <= x:
        num *= i

    if ans < (num / i):
        ans = int((num / i))
print(ans)

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

ans = 0
for b in range(1001):
    for p in range(2, 10):
        if b ** p <= x and b ** p > ans:
            ans = b ** p

print(ans)

Solution (Python):
L = []
for b in range(1001) :
    for p in range(2,12) :
        l = b**p
        if l <= 2000 :
            L.append(l)
L = sorted(list(set(L)))
X = int(input())
for i in range(len(L)+1) :
    if L[i] <= X < L[i+1] :
        print(L[i])
        break

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

sys.setrecursionlimit(10**5)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

x = ni()

if x == 1:
    print(1)
    
else:
    ans = 0
    for b in range(2,40):
        for p in range(2,11):
            if ans < b**p <= x:
                ans = b**p
                
            if b**p > x:
                break
            
    print(ans)

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

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

Solution (Python):
n=int(input())
i=2
ans=[1]
while(i**2 <= n ):
  j=2
  while( i**(j+1) <=n ):
    j+=1
  ans.append( i**j)
  i+=1

print( max(ans) )

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

if(X==1):
    print(1)
else:
    data=[]
    for b in range(1,35):
        for p in range(2,10):
            xt=b**p
            if(xt>1000):
                break
            data.append(xt)

    dist=abs(data[0]-X)
    ans=data[0]
    for i in range(1,len(data)):
        if(data[i]<=X and abs(data[i]-X)<=dist):
            dist=abs(data[i]-X)
            ans=data[i]

    print(ans)

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

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

ans = 1
for b in range(2, 1000):
  c = b
  for p in range(2, 1000):
    c *= b
    if c > X:
      break
    ans = max(ans, c)
print(ans)

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

flag = False
if N<4:
  print(1)
else:
  for i in range(N):
    for j in range(2, round(math.sqrt(N-i))+1):
        a = math.log(N-i, j)
        b = math.modf(a)
        if b[0] == 0.0 or b[0] > 0.99999:
          flag = True
          print(round(j**a))
          break
    if flag:
      break

Solution (Python):
X = input()
res = 0
for p in range(2, 10):
	for b in range(1, int(1000 ** 0.5) + 1):
		cand = b ** p
		if cand > X:
			break
		res = max(res, cand)
print res

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

ar = []

for i in range(2, 11):
  for j in range(1, 40):
    if j ** i <= x:
      ar.append(j ** i)
print(max(ar))

Solution (Python):
def factorize(m):
  facs=[]
  i=2
  if m==1:
    return [0]
  while m>1:
    j=0
    if m%i!=0:
      i+=1
    while m%i==0:
      j+=1
      m/=i
      if m%i!=0:
        facs.append(j)
        i+=1
        break
  return facs

def GCM(m,n):
  if m>n:
    m,n=n,m
  gcm=m
  while gcm>1:
    if n%gcm==0 and m%gcm==0:
      return gcm
    else:
      gcm-=1
  return 1

def GCM_many(s):
  gcm=s[0]
  for i in range(1,len(s)):
    gcm=GCM(gcm,s[i])
  return gcm

n=int(input())
if n==1:
  print(1)
  exit()
for i in range(1, n+1)[::-1]:
  facs=factorize(i)
  if GCM_many(facs)>1:
    print(i)
    exit()
print(1)

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

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

Solution (Python):
import math
X = int(input())
Xr = int(math.sqrt(X))
ans = 1
for i in range(2, Xr + 1):
    t = i ** int(round(math.log(X, i), 10))
    if t > ans:
        ans = t
print(ans)

Solution (Python):
import sys
x=int(input())
ok=[]
for i in range(x+1):
  ok.append(False)
ok[1]=True
for b in range(2, x+1):
  y=b*b
  while y<=x:
    ok[y]=True
    y*=b
for i in range(x):
  if ok[x-i]:
    print(x-i)
    sys.exit()

Solution (Python):

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

Solution (Python):
import math


def run(X):
    ret = 1
    for i in range(2, X):
        for j in range(2, int(math.log2(X))):
            tmp = i**j
            if tmp > X:
                break
            ret = max(ret, tmp)
    return ret


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


if __name__ == '__main__':
    main()

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

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

Solution (Python):


x = int(input())

res=1

for b in range(1,32):
  for p in range(2,9):
    n=b**p
    if n > x:
      break
    res=max(res,n)

print(res)

Solution (Python):
X = int(input())
L = [1]
for i in range(2, 32):
	j = 2
	while True:
		if i ** j > 1000:
			break
		else:
			if L.count(i ** j) == 0:
				L.append(i ** j)
			j += 1
L = sorted(L)

ans = 1
for i in L:
	if X >= i:
		ans = i
	else:
		break

print(ans)

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

for b in range(2,X+1):
  p = 2
  while b**p <=X:
    if r < b**p:
       r = b**p
    p = p+1

print(r)

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

Solution (Python):
x = int(input())
ans = 1
if x != 1:
    for i in range(x):
        for f in range(2,x):
            z = i**f
            if z > x:
                break
            elif z > ans:
                ans = z
    print(ans)
else:
    print(ans)

Solution (Python):
X = int(input())
ans = []
for b in range(1, 100):
    for p in range(2, 100):
        if b**p <= X:
            ans .append(b**p)
        else:
            break

print(max(ans))

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

l = [1]

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

l2 = [n for n in l if n<=X]

print(max(l2))

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

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

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

    
print(ans)

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

maxnum = 0
for j in range(2, 11):
    for i in range(1, x+1):
        if i**j <= x:
            maxnum = i**j if i**j >= maxnum else maxnum
 
print(maxnum)

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

Z = []
for i in range(1,100):
    for j in range(2,100):
        if i ** j > X:
            break
        else:
            Z.append(i ** j)
    
print(max(Z))

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

Solution (Python):
x = int(input())
m = 1
b = 2
while b*b <= x:
  p = 2
  while b**p <= x:
    m = max(m, b**p)
    p += 1
  b += 1
print(m)

Solution (Python):

x = int(input())

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

exp_list.sort()
in_list = [i for i in exp_list if i <= x]
print(in_list[-1])

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

Solution (Python):
x = int(input())
p = 2
list_prob = []
ind = 0
i = 1
while p < 11:
    ind = i ** p
    while ind < 1001:
        list_prob.append(int(i ** p))
        i += 1
        ind = i ** p
    i = 1
    p += 1
list_prob.append(1001)
list_prob.sort()
while i < len(list_prob):
    if list_prob[i] <= x and list_prob[i+1] > x:
        print(list_prob[i])
        break
    i += 1

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

Solution (Python):
x = int(input())
exp = [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]

if x in exp:
    print(x)
else:
    exp.append(x)
    exp.sort()
    print(exp[exp.index(x)-1])

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

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

print(ans)

Solution (Python):
import math
x = int(input())
if x < 4:
    print(1)
    exit()
else:
    m = int(math.sqrt(x))
    p = int(math.log2(x))
    ans = 0
    for i in range(2, m+1):
        for j in range(2, p+1):
            if i**j <= x:
                ans = max(ans, i**j)
    print(ans)

Solution (Python):
arr = [0 for _ in range(1001)]
arr[1] = 1
for i in range(2,32):
    if arr[i]==1:
        continue
    tmp=i*i
    while tmp <=1000:
        arr[tmp]=1
        tmp*=i

for x in range(int(input()),0,-1):
    if arr[x]==1:
        print(x)
        break

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

if x==1000:
  max=1000
for i in range(2,10):
  y=int(math.pow(x,1.0/float(i)))
  if max<y**i:
    max=y**i
print(max)

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

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

print(max_exp)

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

temp = [0 for _ in range(1001)]
for i in range(1, 32):
    for j in range(2,10):
        hoge = i ** j
        if hoge > 1000:
            break
        else:
            temp[hoge] = 1

for i in range(x, -1, - 1):
    if temp[i] == 1:
        print(i)
        exit()

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

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

max_result = 0

for b in range(1, 33):
    
    for p in range(2, 11):
        canditate = b**p
        if canditate <= x and canditate > max_result:
            max_result = canditate

print(max_result)

Solution (Python):

import sys
x = int(input())
while True:
    for b in range(1, x + 1):
        for p in range(2, 20):
            if x == b ** p:
                print(x)
                sys.exit()
    x -= 1

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

def is_exponential(n,j):
    tmp = 1

    while (tmp < j):
        tmp *= n
        if tmp == j:
            return 1
        elif tmp > j:
            return 0

j = X
while (j > 0):
    res = []
    for i in range(2, j):
        res.append(is_exponential(i,j))
    if sum(res) > 0:
        print(j)
        break
    j -= 1
    if j == 0:
        print(X)

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

Solution (Python):


import math

N = int(input())

b = 2
p = 2
ans = 1
while b <= math.sqrt(N):
  tmp = b ** p
  while tmp <= N:
    tmp *= b
    
  ans = max(ans, tmp // b)
  b += 1

print(ans)

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

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

print(ans)

Solution (Python):
x = int(input())
max=round(x**0.5)+1

index=1
maxA=0
while index<max:
    index2=2
    while True:
        if index**index2<=x:
            if index**index2>maxA:
                maxA=index**index2
            index2+=1
            if index==1:
                break
        else:
            break
    index+=1
print(maxA)

Solution (Python):
def is_exp(num):
	for b in range(2, 33):
		num_copy = num
		counter = 0
		while not num_copy % b:
			num_copy /= b
			counter += 1
		if num_copy == 1:
			if counter == 1:
				return False
			else:
				return True
	else:
		return False

N = int(input())
if N <= 3:
	print(1)
else:
	for num in range(N,0,-1):
		if is_exp(num):
			print(num)
			break

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

for b in range(N):
    if N < b**2:
        break
    for p in range(N):
        if m < b**p:
            if N >= b**p:
                m = b**p
            else:
                break

print(m)

Solution (Python):
import math

x=int(input())
ma=1

for i in range(2,int(x**0.5)+1):
    lo=int(math.log(x,i))
    a=i**lo
    b=i**(lo+1)
    if a<=x :
        ma=max(ma,a)
    if b<=x :
        ma=max(ma,b)

print(ma)

Solution (Python):
x,ans = int(input()),[]
for i in range(x):
    for l in range(x-2):
        if (i+1)**(l+2) <= x: ans.append((i+1)**(l+2)) 
        else:break
print("1" if ans == [] else max(ans))

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

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

Solution (Python):
lst = [1]
X = int(raw_input())

cnt = 2
now = 4
while cnt <= X:
	if now <= X and now not in lst:
		lst.append(now)
		now = now * cnt
	else:
		cnt = cnt + 1
		now = cnt * cnt
lst.sort()
print lst[-1]

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

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

beki = [1]
for b in range(2,32):
    for p in range(2,1000):
        if b**p <= 1000:
            beki.append(b**p)
        else:
            break

beki.sort()
beki = beki[::-1]

for a in beki:
    if a <= X:
        print(a)
        break

Solution (Python):
x = int(input())
cardinal = 2
exponential = 2
pows = set([1])
def makePows(cardinal, exponential, maxNum):
    resultPow = pow(cardinal, exponential)
    if resultPow > maxNum:
        return

    makePows(cardinal+1, exponential, maxNum)
    makePows(cardinal, exponential+1, maxNum)

    pows.add(resultPow)

makePows(cardinal, exponential, 1000)

for i in sorted(pows):
    if x < i:
        break
    maxPow = i

print(maxPow)