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
for i in range(2, X):
  n = i*i
  while n <= X:
    ans = max(ans, n)
    n *= i
print(ans)

Solution (Python):

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

Solution (Python):
import math
x=int(input())
y=math.ceil(math.sqrt(x))
ans=1
for i in range(y):
    for j in range(y):
        if ans<=i**j<=x:
            ans=i**j
        else:
            continue
print(ans)

Solution (Python):
X = int(input())
l = [1]
for i in range(2,32):
  p = 2
  while i ** p <= 1000:
   l.append(i ** p)
   p += 1

while not X in l:
  X -= 1

print(X)

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

s = set([1])
for i in range(2,x):
    for j in range(2,10):
        if (i**j) <= x:
            s.add(i**j)

print(max(list(s)))

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

s = set([1])
for i in range(2,501):
    for j in range(2,10):
        if (i**j) <= x:
            s.add(i**j)

print(max(list(s)))

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

s = set([1])
for i in range(2,501):
    for j in range(2,501):
        if (i**j) <= x:
            s.add(i**j)

print(max(list(s)))

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

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

Solution (Python):
import sys
input = sys.stdin.readline
X = int(input())
x = int(X ** (1/2))
ans = 1
for i in range(2,x+1) :
    a = 1
    e = 0
    while a == 1 :
        k = i ** e
        if k > X :
            k = i ** (e-1)
            a = 0
            break
        e+=1
    ans = max(ans,k)
print(ans)

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

Solution (Python):
import math
X = int(input())
bp = {b**p for b in range(1,int(math.sqrt(X))+1) for p in range(2,10) if b**p <= X}
print(max(bp))

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 = []

for i in range(2, int(x**0.5)+2):
    for j in range(2, 10):
        if i**j <= x:
            res.append(i**j)
if x == 1:
    print(1)
else:
    print(max(res))

Solution (Python):
import sys
input = sys.stdin.readline
X = int(input())
ans = [1]
for i in range(2, 1 + int(X ** (1/2))):
    ans.append(i)
    x = i
    while x < X:
        x *= i
        if x <= X:
            ans.append(x)
print(max(ans))

Solution (Python):

 
import math
import itertools
import sys
import copy
 




X = int(input())

ans = 1
b = 2
while X >= b :
  p = 2
  while X >= b**p :
    ans = max(ans, b**p)
    p += 1
  b += 1
print (ans)

Solution (Python):
def main():
    x = int(input())
    ans = 0
    d = 0
    if x == 1:
        return 1
    for i in range(2, x):
        d = i
        p = 2
        while d ** p <= x:
            ans = max(ans, d ** p)
            p += 1
    return ans


if __name__ == '__main__':
    print(main())

Solution (Python):
from bisect import bisect_left
import math
n = int(input())
lst = []
lst.append(1)
for i in range(2, int(math.sqrt(1000)) + 1):
    for j in range(2, 10):
        if i ** j <= 1000 and i ** j not in lst:
            lst.append(i ** j)

lst.sort()
print(lst[bisect_left(lst, n) - 1] if n not in lst else lst[bisect_left(lst, n)])

Solution (Python):
import numpy as np
X = int(input())
ans = 1
for b in range(2, 1+int(np.ceil(np.sqrt(X)))):
    p = 0
    while np.power(b, p) <= X:
        p += 1
    p -= 1
    ans = max(ans, np.power(b, p))
print(ans)

Solution (Python):
import math
n = int(input())
if n == 1:
    print(1)
    exit()
minx = int(math.sqrt(n)//1)
ans = 0
for i in range(2,minx+1):
    f = 1
    while True:
        if i**f > n:
            ans = max(ans,i**(f-1))
            break
        f+=1
print(ans)

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

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

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

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

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

Solution (Python):

li=[]
for i in range(1,int(1000**0.5)+1):
  for j in range(2,11):
    tmp=i**j
    if tmp>1000:
      break
    else:
      li.append(tmp)
l=(sorted(set(li)))
x=int(input())

ans=0
for i in l[::-1]:
  if i<=x:
    print(i)
    exit()

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

if x ==1:
    print(1)

else:
    flag = False
    for i in range(x):
        for k in range(x-1):
            for j in range(2, 10):
                if x-i == (k+1)**j:
                    flag = True
                    print(x-i)
                    break
            if flag:
                break
        if flag:
            break

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

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

Solution (Python):
import sys
from math import floor, sqrt, log

x = int(sys.stdin.readline().rstrip())

def main():
    res = [1]
    for b in range(2, x+1):
        p = 2
        while b ** p <= x:
            res.append(b ** p)
            p += 1
    return max(res)

if __name__ == '__main__':
    ans = main()
    print(ans)

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

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

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

Solution (Python):
import math

x = int(input())
x_rt = int(math.sqrt(x))

arr = [1]
for i in range(2, x_rt + 1):
    bas = i
    while bas * i <= x:
        bas *= i
        arr.append(bas)

ans = max(arr)
print(ans)

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

ans = 0

if x == 1:

 print(1)

 exit()

for i in range(2, 51):

 tmp = i

 while tmp * i < x + 1:

  tmp = tmp * i

  ans = max(ans, tmp)

print(ans)

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):
n=int(input())
minsa=1000
for a in range(1,32):
  for b in range(2,10):
    l=a**b
    sa=n-l
    if sa>=0:
      minsa=min(sa,minsa)
print(n-minsa)

Solution (Python):


x = int(input())

kk = [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]

ans = [i for i in kk if (i <= x)]
print(ans[-1])

Solution (Python):
n = int(input())
l = []
if n == 1:
    print(1)
else:
    for i in range(1, n + 1):
        for j in range(2, n + 1):
            if i ** j > n:
                break
            l.append(i ** j)
    l = list(set(l))
    l = sorted(l)
    ans = 0
    for i in range(len(l)):
        if l[i] > n:
            break
        ans = l[i]
    print(ans)

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

Solution (Python):
def main():
    X = int(input())
    candidates = [1]
    c_append = candidates.append
    max_range = int(X**0.5) + 1
    for i in range(2, max_range):
        for j in range(2, max_range):
            powered = i ** j
            if powered > X:
                break
            else:
                c_append(powered)
    ans = max(candidates)
    print(ans)

if __name__ == "__main__":
    main()

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

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

for i in range(2, 34):
  count = 2
  
  while i ** count <= n:
    m = max(m, i**count)
    count += 1
print(m)

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

Solution (Python):
import math

x = int(input())
ans = 1
for b in range(2, 32):
    p = 2
    if b ** p > x:
        break
    while b ** (p + 1) <= x:
        p += 1
    ans = max(ans, b ** p)
print(ans)

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

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

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

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

print(ans)

Solution (Python):
x = int(input())
num = []
for b in range(1,x):
    for p in range(2,11):
        num.append(b**p)
num.sort(reverse = True)
for val in num:
    if val <=x:
        print(val)
        break
if x ==1:
    print(1)

Solution (Python):
from math import sqrt

X = int(input())

result = 1
for i in range(2, int(sqrt(X)) + 1):
    t = i * i
    while t <= X:
        if t > result:
            result = t
        t *= i
print(result)

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

print(ans)

Solution (Python):
import bisect

x = int(input())

pows = [1]
for i in range(2, x+1):
	p = 2
	while i**p <= x:
		pows.append(i**p)
		p+=1
pows.sort()

print(pows[bisect.bisect(pows, x)-1])

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

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


ans = 0

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

print(ans)

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


ans = 0

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

print(ans)

Solution (Python):
x=int(input())
ans=0
for p in range(2,10):
    b=int(x**(1/p))+1
    while b**p>x:
        b -= 1
    ans=max(ans,b**p)
print(ans)

Solution (Python):
import math
x=int(input())
ans=[1]
for i in range(2,x+1):
    
    k=int(math.log(x,i))
    if k>=2:
        if i**(k+1) <= x:
            ans.append(i**(k+1))
        else:
            ans.append(i**k)
print(max(ans))

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

ans = 0
for b in range(int(x**0.5 + 1)):
    for q in range(20):
        if b ** q > x:
            break
        ans = max(ans, b**q)

print(ans)

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

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

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

print(ans)

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




for b in range(1,x + 1):
  for p in range(2,int(math.log2(x)) + 1):
    if b ** p <= x:
      exp.add(b ** p)
if len(exp) == 0:
  print(1)
else:
  print(max(exp))

Solution (Python):
n=int(input())
a=[]
for i in range(33):
  for j in range(2,12):
    a.append(i**j)
a.sort()
for i in range(len(a)):
  if a[i]>n:
    print(a[i-1])
    break

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

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

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

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

Solution (Python):

import sys


def solve(X: int):
    ans = 0
    for b in range(1, 32):
        for p in range(2, 10):
            bp = b**p
            if bp > X:
                pass
            else:
                ans = max(ans, bp)

    print(ans)


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

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

ans = 0
for b in range(1, 31+1):
    for p in range(2, 31+1):
        bp = b**p
        if ans <= bp and bp <= X:
            ans = bp

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 math
ceil = 1000
X = int(input())
ans = 1
for p in range(2, 11):
  for b in range(2, int(math.sqrt(ceil))+1):
    tmp = b ** p
    if tmp > X: break
    else: ans = max(tmp, ans)
    
print(ans)

Solution (Python):
import math
ceil = 1000
X = int(input())
ans = 1
for p in range(2, 11):
  for b in range(2, int(math.sqrt(ceil))+1):
    tmp = b ** p
    if tmp > X: break
    if tmp > ans: ans = tmp
    
print(ans)

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

l = [1]
for b in range(2, 32):
    p = 2
    while b ** p <= 1000:
        l.append(b ** p)
        p += 1
l.sort()
l.append(10**5)

for i in range(len(l)):
    if l[i] > x:
        print(l[i-1])
        exit()
print(l)

Solution (Python):

x = int(input())
m = 1
for i in range(2, 10):
    tmp = int(x ** (1 / i) + 0.00001) ** i
    if x >= tmp > m:
        m = tmp
print(m)

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

ans = 1
for b in range(1, 32):
    for p in range(2, 9):
        if b ** p > ans and b ** p <= X:
            ans = b ** p

print(ans)

Solution (Python):

X = int(input())




ans = 1

for b in range(1,32):
    for p in range(2,9):
        if b**p > ans and b**p <= X:
            ans = b**p
            
print(ans)

Solution (Python):
N = int(input())
res=[]

res.append(1)

for i in range(2,33):
  for j in range(1,10):
    if N < i**j:
      if j-2!=0:
        res.append(i**(j-1))
      break
print(max(res))

Solution (Python):
ls=[1,2,4,8,16,32,64,128,256,512,3,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,625,676,781,841,900,961,1001]
ls.sort()
n=int(input())
for i in range(len(ls)):
  if ls[i]>n:
    print(ls[i-1])
    break

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

number = [i for i in range(1,34)]
beki = []
for i in number:
    for j in range(2,11):
        if i ** j <= x:
            beki.append(i**j)
ans = max(beki)
print(ans)

Solution (Python):
import math as m
X = int(input())
end = m.floor(m.sqrt(X))
ans = 1
for i in range(2, end+1):
    now = i
    while now * i <= X:
        ans = max(ans, now* i)
        now *= i
print(ans)

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

ans = 0

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

print(ans)

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

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

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

ans = 1

for b in range(32,0, -1):
    for p in range(2,11):
        if b**p <= x and ans <= b**p:
            ans = b**p

print(ans)

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

m,c=1,2
while c*c<=X:
	i=2
	while c**i<=X:
		m=max(m,c**i)
		i+=1
	c+=1
print(m)

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

Solution (Python):
X = int(input())
if X != 1:
  A =[]
  for b in range(1,int(X**0.5)+1):
    for p in range(2,X):
      if b**p > X:
        A.append(b**(p-1))
        break
  print(max(A))
else:
  print(1)

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

A = [1]
for i in range(1, 50):
    for j in range(2, 50):
        if i**j <= X:
            A.append(i**j)
print(max(A))

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

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

ans = 0
for i in range(1000):
  for j in range(2,20):
    if i**j > n:
      break
    ans = max(ans, i**j)
print(ans)

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

l = [1]

for i in range(2, 32):
    a = i
    while a*i <= 1000:
        a *= i
        l.append(a)

l.sort(reverse=True)

for c in l:
    if c <= x:
        print(c)
        exit()

Solution (Python):
N = int(input())
ans = 1000
ans2 = 0
for i in range(1000):
  for j in range(2,10):
    if N - i**j < 0:
      break
    if ans > N - i ** j:
      ans = N - i**j
      ans2 = i**j
print(ans2)

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

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

exp.sort()
for e in exp:
    if e > x:
        break
    ans = e
else:
    ans = 1000

print(ans)

Solution (Python):
A = int(input())
m = 0
for i in range(2,10):
  for j in range(40):
    k = j ** i 
    if A >= k:
      m = max(m,j**i)
print(m)

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

Solution (Python):
def pff(m):
    pf = {}
    for i in range(2, int(m ** 0.5) + 1):
        while m % i == 0:
            pf[i] = pf.get(i, 0) + 1
            m //= i
    if m > 1: pf[m] = 1
    return pf
def examB():
    X = I()
    ans = 0
    for i in range(X,0,-1):
        cur = pff(i)
        flag = True
        now = 0
        for j in cur.values():
            if j==1:
                flag = False
            if now==0:
                now = j
            else:
                if now%j!=0 and j%now!=0:
                    flag = False
        if flag:
            ans = i
            break
    print(ans)

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examB()

Solution (Python):
def pff(m):
    pf = {}
    for i in range(2, int(m ** 0.5) + 1):
        while m % i == 0:
            pf[i] = pf.get(i, 0) + 1
            m //= i
    if m > 1: pf[m] = 1
    return pf
def examB():
    X = I()
    ans = 0
    for i in range(X,0,-1):
        cur = pff(i)
        flag = True
        now = 0
        for j in cur.values():
            if j==1:
                flag = False
            if now==0:
                now = j
            else:
                if now!=j:
                    flag = False
        if flag:
            ans = i
            break
    print(ans)

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examB()

Solution (Python):

import sys, math, itertools, heapq, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**8)
inf = float('inf')
ans = 1
count = 0
j=2
x=int(input())
for i in range(2,x):
    while i**j<=x:
        ans=max(ans,i**j)
        j+=1
    j=2
print(ans)

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

k = 1000
maxk = 1

for j in range(n,1,-1):
	for i in range(j-1,1,-1):
		
		if j%i ==0 :
			k = j
			t = i
			while k>=t :
				
				
				k = k/t
				
				if k == 1 and maxk < j:				
					maxk = j
					
					break
				
print(maxk)

Solution (Python):
def ans(n):
    pow_2 = int(n**(0.5))
    pow_exeption = [32,128,243]
    
    ans = pow_2**2
    for i in pow_exeption:
        if i <= n:
            ans = max(i,ans)
    for i in range(1,11):
        if i**3 <= n:
            ans = max((i**3),ans)
        
    return(ans)
n = int(input())
for i in range(n,n+1):
    print(ans(i))

Solution (Python):

import math

def main():
    X = int(input())
    max_num = 1
    for b in range(1,X+1):
        for p in range(2,X+1):
            current = b ** p
            if current <= X:
                max_num = max(max_num,current)
            else:
                break
    print(max_num)        
            
            

if __name__ == "__main__":
    main()

Solution (Python):

import math

def main():
    X = int(input())
    max_num = 1
    for b in range(1,X+1):
        for p in range(2,X+1):
            current = b ** p
            if current <= X:
                max_num = max(max_num,current)
            else:
                break
    print(max_num)        
            
            

if __name__ == "__main__":
    main()

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

ans = 1
for i in range(10000):
    for p in range(2,10000):
        if i**p > x:
            break
        else:
            if i**p > ans:
                ans = i**p

print(ans)

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

Solution (Python):
x = int(input())
import math
if x < 4 :
    print(1)
elif 4 <= x :
    exponetiallist = []
    pmax = math.floor(math.log2(x))
    for b in range(2, x + 1) :
        for p in range(2, pmax +1) :
            if b ** p <= x :
                exponetiallist += [b ** p]
    print(max(exponetiallist))

Solution (Python):
import math
x = int(input())
limit = math.ceil(math.sqrt(x))
min_diff = x - 1
for b in range(2, limit):
  temp_b = b
  while temp_b <= x:
    temp_b *= b
  bp = int(temp_b / b)
  if bp == x:
    print(x)
    exit()
  elif x - bp < min_diff:
    min_diff = x - bp
print(x - min_diff)

Solution (Python):
def main():
    X = int(input())
    ans = 0
    for i in range(1, 1000):
        n = i
        for _ in range(2, 1000):
            n *= i
            if n > X:
                break
            ans = max(ans, n)
    print(ans)

main()

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

Solution (Python):
X = int(input())
ans = 1
a = 2
while a*a<=X:
    r = a*a
    while r<=X:
        ans = max(ans, r)
        r*=a
    a+=1

print(ans)

Solution (Python):
from sys import stdin
import bisect
from itertools import accumulate
import numpy as np

n = int(stdin.readline().rstrip())

li = [1]

for i in range(2,34):
    for s in range(2,10):
        if i**s <= 1000:
            li.append(i**s)
        else:
            break
    
li = list(set(li))

li.sort()

print(li[bisect.bisect(li,n)-1])

Solution (Python):
X=int(input())
l=[]
for i in range(1,32):
  for j in range(2,10):
    l +=[i**j]
    if i**j>1000:
      break
se=set(l)
for k in range(X):
  if X-k in se:
    print(X-k)
    break

Solution (Python):
x = int(input())
ans = 0
for b in range(1, int(x ** 0.5) + 1):
  for p in range(1, int(x ** 0.5) + 1):
    if b ** p > x:
      continue
    ans = max(ans, b ** p)
print(ans)

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

ans = 0
for i in range(1, 35):
    for j in range(2, 10):
        if ans < i**j and i**j <= X:
            ans = i**j

print(ans)

Solution (Python):

x = int(input())

b = 2
perfect_power = 0

if x < 4:
    perfect_power = 1
else:
    while b < x:
        p = 2
        while b ** p <= x:
            perfect_power = max(perfect_power, b ** p)
            p += 1
        b += 1

print(perfect_power)

Solution (Python):
X = int(input())
ans = set()
for i in range(1,int(X)):
	for j in range(2,11):
		if i**j <= X:
			ans.add(i**j)

ans_list = list(ans)
if len(ans_list)==0:
	print(1)
else:
	print(max(ans_list))

Solution (Python):
N = int(input())
import math
n = math.floor(N**0.5)

A = [1]
for i in range(2,n+1):
    j = 2
    while i**j <= N :
        A.append(i**j)
        j += 1
ans = max(A)
print(ans)

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

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

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

Solution (Python):


X=int(input())


ans=1
for i in range(2,X+1):
    temp=i*i
    while temp<=X:
        temp*=i
    if temp!=i*i:
        ans=max(ans,temp//i)

print(ans)

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

Solution (Python):


x=int(input())
ans=[]
if x==1:
    print(1)
else:
    for i in range(1,x+1):
        for j in range(2,x+1):
            if i**j<=x:
                ans.append(i**j)
            else:
                break
    ans.sort(reverse=True)
    print(ans[0])

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())
flag = [0 for i in range(X+1)]
flag[1] = 1

for i in range(2, X+1):
  v = i*i
  while(v <= X):
    flag[v] = 1
    v *= i
    
for i in range(X, 0, -1):
  if flag[i] == 1:
    print(i)
    break

Solution (Python):
x = int(input())
m = 1
for i in range(2, x):
    p = 2
    while pow(i, p) <= x:
        if m <= pow(i, p):
            m = pow(i, p)
        p += 1
print(m)

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

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()

def main():
    x=int(input())
    a=1
    for i in range(2,x+1):
        j=2
        while True:
            k=i**j
            if k>x:
                break
            if k>a:
                a=k
            j+=1
    print(a)

main()

Solution (Python):
def factorization(n):
    s = set()
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            s.add(cnt)

    if temp!=1:
        s.add(1)

    if s==set():
        s.add(1)

    return s
  
n = int(input())
if n < 4:
  print(1)
else:
  for i in range(n, 0, -1):
    s = factorization(i)
    if len(s)==1 and s.pop()>=2:
        print(i)
        break

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

Solution (Python):
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

x = inp()
for i in range(x,0,-1):
    for b in range(1,33):
        for p in range(2,11):
            if i == b**p:
                print(i)
                quit()

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

Solution (Python):
X=int(input())
c=[]
for i in range(0,X):
  for k in range(2,10):
    if (i+1)**k<=X:
      c.append((i+1)**k)
print(max(c))

Solution (Python):
N = int(input())
se = set(x**e for x in range(33) for e in range(2,11) if x**e<=N)
print(max(se))

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


def main():
    X = int(input())
    
    ans = 1
    for a in range(2, math.ceil(math.sqrt(X))):
        b = 2
        while a**(b+1) <= X:
            b += 1
        ans = max(ans, a**b)

    print(ans)

if __name__ == '__main__':
    main()

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

n = 1
for b in range(1,X):
    for p in range(2,X):
        if b**p <= X:
            if n < b**p:
                n = b**p
        else:
            break
    if b**2 > X:
        break

print(n)

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

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