Problem:
 Score : 200 points    Problem Statement You are given a positive integer X .
Find the largest perfect power that is at most X .
Here, a perfect power is an integer that can be represented as b^p , where b is an integer not less than 1 and p is an integer not less than 2 .      Constraints  1  ≤  X  ≤  1000  X is an integer.         Input Input is given from Standard Input in the following format:  X       Output Print the largest perfect power that is at most X .        Sample Input 1 10      Sample Output 1 9  There are four perfect powers that are at most 10 : 1 , 4 , 8 and 9 .
We should print the largest among them, 9 .       Sample Input 2 1      Sample Output 2 1       Sample Input 3 999      Sample Output 3 961

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

def resolve():
    x=int(input())
    ans=0
    
    
    for i in range(1,34):
        if i>x:
            break
        for j in range(2,10):
            y=i**j
            if y<x:
                ans=max(y,ans)
            elif y==x:
                ans=max(y,ans)
                break
            else:
                break
    print(ans)
resolve()

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

def resolve():
    x=int(input())
    ans=0
    for i in range(1,33):
        if i>x:
            break
        for j in range(2,11):
            y=i**j
            if y<x:
                ans=max(y,ans)
            elif y==x:
                ans=max(y,ans)
                break
            else:
                break
    print(ans)
resolve()

Solution (Python):
x=int(input())
A=[1]
for i in range(2,x+1):
    p=2
    if i**p>x:
        break
    while i**p<=x:
        A.append(i**p)
        p+=1
print(max(A))

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

for i in range(1,33):
    for j in range(2,9):
        tmp = i**j
        if tmp <= x:
            a.append(tmp)

print(max(a))

Solution (Python):
import sys
import math
x = int(input())
li = [1]
for i in range(2,32):
    tmp = 2
    while (i ** tmp <= 1000):
        li.append(i ** tmp)
        tmp += 1
for i in range(x, 0, -1):
    if (i in li):
        print(i)
        sys.exit()

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

def resolve():
    x=int(input())
    ans=0
    for i in range(1,33):
        for j in range(2,11):
            y=i**j
            if y<x:
                ans=max(y,ans)
            elif y==x:
                ans=max(y,ans)
                break
            else:
                break
    print(ans)
resolve()

Solution (Python):
X=int(input())
A=[1]
for i in range(2,X+1):
    k=2
    while True:
        Z=i**k
        if Z<=X:
            A.append(Z)
            k+=1
        else:
            break
print(max(A))

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

def resolve():
    x=int(input())
    l=[]
    for i in range(1,33):
        for j in range(2,11):
            y=i**j
            if y<x:
                l.append(y)
            elif y==x:
                l.append(y)
                break
            else:
                break
    print(max(l))
resolve()

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

num_list = []
for i in range(1, int(1000**0.5)+1):
    for j in range(2, 11):
        if i**j <= 1000:
            num_list.append(i**j)

for num in sorted(num_list, reverse=True):
    if num <= X:
        print(num)
        break

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

def it():
  for i in range(2, X):
    x = i*i
    if x > X: return 0
    
    while x*i <= X:
      x *= i
    yield x
  
print(max(it()))

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

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

Solution (Python):
X = int(input())
N = [1]
j = 2

while True:
  i = 2
  flag = False
  while True:
    n = i ** j
    if n <= X:
      N.append(n)
      flag = True
      i += 1
    else:
      break
  if flag:
    j += 1
  else:
    break
print(max(N))

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

ans = 0
for b in range(1, 1001):
    for p in range(2, 10):
        if pow(b, p) <= X:
            ans = max(ans, pow(b, p))
print(ans)

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

print(ans)

Solution (Python):
x = int(input())
a = [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,
     676,784,841,900,961]
b =[]
for num in a:
  if x >= num:
    b.append(num)
print(max(b))

Solution (Python):

import sys
import math
from bisect import bisect_left, bisect_right, insort_left, insort_right
from collections import defaultdict, deque, Counter
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from heapq import heappop, heappush
from itertools import accumulate, groupby, product, permutations, combinations, combinations_with_replacement
from math import ceil, floor, factorial, log, sqrt, sin, cos
from operator import itemgetter
from string import ascii_lowercase, ascii_uppercase, digits
sys.setrecursionlimit(10**7)
rs = lambda: sys.stdin.readline().rstrip()
ri = lambda: int(rs())
rf = lambda: float(rs())
rs_ = lambda: [_ for _ in rs().split()]
ri_ = lambda: [int(_) for _ in rs().split()]
rf_ = lambda: [float(_) for _ in rs().split()]
INF = float('inf')
MOD = 10 ** 9 + 7
PI = math.pi

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

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

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

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

Solution (Python):
X = int(input())
ma = 0
for b in range(1, int(X ** 0.5) + 1):
    n = b
    while 1 < n * b <= X:
        n *= b
    ma = max(ma, n)
print(ma)

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

Solution (Python):
X=int(input())
a=2
temp=1
ans=1
l=[]
if X==1:
    print(1)
    exit()
else:
    for i in range(2,41):
        for j in range(2,11):
            if i**j<=X:
                l.append(i**j)
print(max(l))

Solution (Python):
X = int(input())
ans = [1]
for i in range(2, X):
    v = i * i
    while v <= X:
        ans.append(v)
        v *= i
print(max(ans))

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

Solution (Python):
X = int(input())
fact = [1]
for i in range(2, 40):
  cnt = 1
  p = i
  while(p <= 1000):
    if(cnt >= 2):
      fact.append(p)
    p = p*i
    cnt += 1
fact.sort()
ans = 0
for n in fact:
  if(n <= X):
    ans = n
  else:
    break
print(ans)

Solution (Python):
import math
x = int(input())
root = int(math.sqrt(x))
m = 1
for i in range(2, root+1):
    for j in range(2, root+1):
        if m < i**j and i**j <= x:
            m = i**j

print(m)

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

Solution (Python):
X=int(input())
ans=0
for i in range(1,33):
    for j in range(2,11):
        now=i**j
        if ans<now and now<=X:
            ans=now

print(ans)

Solution (Python):
import math

def Next(): return input()
def NextInt(): return int(Next())
def NextInts(): return map(int,input().split())
def Nexts(): return map(str,input().split())
def NextIntList(): return list(map(int,input().split()))
def RowInts(n): return [input() for i in range(n)]


n = int(input())
ju = [False for i in range(1001)]
ju[1] = True
for i in range(2,32):
  now = i**2
  while(now <= 1000):
    ju[now] = True
    now *= i
for i in range(n,0,-1):
  if(ju[i]):
    print(i)
    break

Solution (Python):
x = int(input())
ans = 1
for b in range(1, int(1000**.5)+1):
    for p in range(2, 10):
        y = b**p
        if y <= x and ans < y:
            ans = y
print(ans)

Solution (Python):
from math import sqrt
x = int(input())
l = []
for i in range(1, x + 1):
    for j in range(1, int(sqrt(i)) +1):
        for k in range(2, 10):
            if j ** k == i:
                l.append(i)
print(max(l))

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

Solution (Python):
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

s = set()
for i in range(1,50):
    for j in range(2,10):
        if i**j > 1000:
            break
        s.add(i**j)
n = inp()
for i in range(n,0,-1):
    if i in s:
        print(i)
        break

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

ans = 1
for i in range(2, X + 1):
    tmp = i
    flag = False
    while tmp * i <= X:
        flag = True
        tmp *= i
    if flag:
        ans = max(ans, tmp)

print (ans)

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

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

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

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

n = [1]
for i in range(2, 1001):
  p = 2
  while i ** p <= 1000:
    n.append(i**p)
    p += 1
while not x in n:
  x -= 1
print(x)

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

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

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

x = int(input())
ans = 1
for i in range(2, x + 1):
    j = i
    while True:
        j *= i
        if j > x:
            if abs(x - ans) >= abs(x - j//i) and j//i != i:
                ans = j//i
            break
print(ans)

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

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

print(ans)

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

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

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

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

Solution (Python):
X = int(input())
num = [1]
for i in range(1, 33):
    b = i+1
    p = 2
    while b ** p <= 1000 and b ** p not in num:
        num.append(b ** p)
        p += 1
        
ans = sorted([num[i] for i in range(len(num)) if num[i] <= X])
print(ans[-1])

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):
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())
li = []

for i in range(1,32):
    for j in range(2,11):
        x = i**j
        if x <= 1000:
            li.append(x)

li.sort()

for i in range(len(li)):
    if li[i] == n:
        print(n)
        exit()
    elif li[i] > n:
        print(li[i-1])
        exit()

Solution (Python):
x = int(input())
if x==1:
  print(1)
  exit()
ans = 1
for i in range(x, 0, -1):
  m = i
  div = []
  for j in range(2,int(m**0.5)+2):
    if m%j==0:
      count = 0
      while m%j ==0:
        m //= j
        count += 1
      div.append(count)
  if m!= 1:
    div.append(1)
  count = div[0]
  for c in div:
    if c!= count or count ==1:
      break
  else:
    print(i)
    exit()
print(ans)

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

Solution (Python):
import sys
import math

input = sys.stdin.readline
MOD = 1000000007

X = int(input())

sa = 100000
res = 0

if X == 1:
    print(1)
else:
    for i in range(2,X):
        a = int(math.log(X,i)+0.00000004)
        if (sa > (X - (i**a))) & ( a != 1):
            sa = X - (i**a)
            res = i**a

    print(res)

Solution (Python):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil
from operator import itemgetter
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
inf = 10**17
mod = 10**9 + 7

n=I()
beki=[]
for k in range(2,11):
    for i in range(1,100):
        if i**k<=n:
            beki.append(i**k)
print(max(beki))

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

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

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

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

print(ans)

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


def main():
    X = int(input())
    A = []
    for b in range(1, 1000):
        for p in range(2, 1000):
            if b**p <= X:
                A.append(b**p)
            else:
                break
    print(max(A))


main()

Solution (Python):
x=int(input())
keep=0
for i in range(1,1000):
  for j in range(2,10):
    if keep<=i**j and i**j<=x:
      keep=i**j
print(keep)

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

Solution (Python):
X=int(input())
ans=1
for b in range(1,X+1):
  for p in range(2,X+1):
    if b**p>X:
      break
    elif b**p>ans:
      ans=b**p
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):
x = int(input())

bekijo = 1
for i in range(2,x+1):
    for j in range(2,x+1):
        if i ** j > x: break
        bekijo = max(bekijo, i**j)
        
print(bekijo)

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

Solution (Python):
X = int(input())
ans = 0
for i in range(1,100):
  for p in range(2,100):
    tmp = i ** p
    if(tmp <= X):
      ans = max(tmp,ans)
    else:
      pass
print(str(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())
li = [False] * (x + 1)
li[1] = True

for i in range(x):
    for j in range(2, x):
        if i ** j > x:
            break
        li[i ** j] = True

for i in reversed(range(x + 1)):
    if li[i]:
        print(i)
        break

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):
for i in range(1,int(input())+1)[::-1]:
  for j in range(2,int(i**(1/2))+1):
    if i%j==0:
      temp=i
      while temp%j==0:
        temp//=j
      if temp==1:print(i);exit()
print(1)

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):
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop

import collections

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

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

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

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i, )
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

if x == 1:
    print(1)
else:
    ans = []
    ok = 0
    for i in range(x, 1, -1):    
        tmp = make_divisors(i)
        for j in tmp[:-1]:
            for k in range(1,10):
                if j**k == tmp[-1]:
                    ok = 1
                    break
        
        if ok == 1:
            break

    print(i)

Solution (Python):

import re
import math
from collections import defaultdict
import itertools
from copy import deepcopy
import random
from heapq import heappop,heappush
import time
import os
import queue
import sys
import datetime
from functools import lru_cache
readline=sys.stdin.readline
sys.setrecursionlimit(2000)

alphabet="abcdefghijklmnopqrstuvwxyz"
mod=int(10**9+7)
inf=int(10**20)
def yn(b):
    if b:
        print("yes")
    else:
        print("no")
def Yn(b):
    if b:
        print("Yes")
    else:
        print("No")
def YN(b):
    if b:
        print("YES")
    else:
        print("NO")
class union_find():
    def __init__(self,n):
        self.n=n
        self.P=[a for a in range(N)]
        self.rank=[0]*n
 
    def find(self,x):
        if(x!=self.P[x]):self.P[x]=self.find(self.P[x])
        return self.P[x]
 
    def same(self,x,y):
        return self.find(x)==self.find(y)
 
    def link(self,x,y):
        if self.rank[x]<self.rank[y]:
            self.P[x]=y
        elif self.rank[y]<self.rank[x]:
            self.P[y]=x
        else:
            self.P[x]=y
            self.rank[y]+=1
 
    def unite(self,x,y):
        self.link(self.find(x),self.find(y))
 
    def size(self):
        S=set()
        for a in range(self.n):
            S.add(self.find(a))
        return len(S)
def is_power(a,b):
    now=b
    while now<a:
        now*=b
    if now==a:return True
    else:return False
def bin_(num,size):
    A=[0]*size
    for a in range(size):
        if (num>>(size-a-1))&1==1:
            A[a]=1
        else:
            A[a]=0
    return A
def get_facs(n,mod_=0):
    A=[1]*(n+1)
    for a in range(2,len(A)):
        A[a]=A[a-1]*a
        if(mod>0):A[a]%=mod_
    return A
def comb(n,r,mod,fac):
    if(n-r<0):return 0
    return (fac[n]*pow(fac[n-r],mod-2,mod)*pow(fac[r],mod-2,mod))%mod
def next_comb(num,size):
    x=num&(-num)
    y=num+x
    z=num&(~y)
    z//=x
    z=z>>1
    num=(y|z)
    if(num>=(1<<size)):return False
    else:
        return num
def get_primes(n,type="int"):
    A=[True]*(n+1)
    A[0]=False
    A[1]=False
    for a in range(2,n+1):
        if A[a]:
            for b in range(a*2,n+1,a):
                A[b]=False
    if(type=="bool"):return A
    B=[]
    for a in range(n+1):
        if(A[a]):B.append(a)
    return B
def is_prime(num):
    if(num<=2):return False
    i=2
    while i*i<=num:
       if(num%i==0):return False
       i+=1
    return True
def ifelse(a,b,c):
    if a:return b
    else:return  c
def join(A,c=" "):
    n=len(A)
    A=list(map(str,A))
    s=""
    for a in range(n):
        s+=A[a]
        if(a<n-1):s+=c
    return s
def factorize(n,type_="dict"):
    b = 2
    list_ = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            list_.append(b)
        b+=1
    if n > 1:list_.append(n)
    if type_=="dict":
        dic={}
        for a in list_:
            if a in dic:
                dic[a]+=1
            else:
                dic[a]=1
        return dic
    elif type_=="list":
        return list_
    else:
        return None
def floor_(n,x=1):
    return x*(n//x)
def ceil_(n,x=1):
    return x*((n+x-1)//x)
def hani(x,min_,max_):
    ret=x
    if x<min_:ret=min_
    if x>max_:ret=max_
    return ret
def seifu(x):
    return x//abs(x)


def main():
    x=int(input())
    F=factorize(x)
    ans=0
    for a in range(1,1001):
        for b in range(2,100):
            if a**b<=x:
                ans=max(ans,a**b)
    print(ans)
main()

Solution (Python):
from math import sqrt
x = int(input())
ans = 1
for i in range(2, int(sqrt(x)) + 1):
    n = i * i
    e = 2
    while n <= x:
        e += 1
        n = pow(i, e)
    ans = max(ans, pow(i, e - 1))
print(ans)

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

Solution (Python):
n=int(input())
ans=0
if n==1:
    print(1)
    exit()


for i in range(n):
    for j in range(2,11):
        if i**j<=n:
           ans=max(ans,i**j) 
print(ans)

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

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

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

i=2
ans=0
while i*i<x:
    j=2
    while i**j<=x:
        ans=max(ans,i**j)
        j +=1
    i += 1
print(ans)

Solution (Python):
x=int(input())
ans=1
for i in range(1,x+1):
    for j in range(2,50):
        for k in range(2,50):
            if i==j**k:
                ans=j**k
print(ans)

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

i = 2
ans = 1
while i * i < x:
    j = 2
    while i**j <= x:
        ans = max(ans, i**j)
        j += 1
    i += 1
print(ans)

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

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

i = 2
ans = 0
while i * i < x:
    j = 2
    while i**j <= x:
        ans = max(ans, i**j)

        j += 1

    i += 1
print(ans)

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

def main():
    X = int(readline())
    ans = 1
    for b in range(1, math.floor(X**(1/2))+1):
        for p in range(2, math.floor(math.log2(X))+1):
            if b ** p <= X:
                ans = max(ans, b ** p)
    
    print(ans)


if __name__ == '__main__':
    main()

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

def main():
    X = int(readline())
    ans = 1
    for b in range(1, math.floor(X**(1/2))+1):
        for p in range(2, 11):
            if b ** p <= X:
                ans = max(ans, b ** p)
    
    print(ans)


if __name__ == '__main__':
    main()

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

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

Solution (Python):
import math
X=int(input())
max_num = 0
for i in range(2,10):
  tei = math.floor(X**(1/i))
  if (tei+1)**i <= X: tei = tei + 1
  if max_num < tei**i:
    max_num = tei**i
print(max_num)

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

if X == 1:
  list.append(1)


elif X == 2 or X == 3:
  list.append(2)
  
else:
  for b in range(2, X):
    p = 2
    
    
    while b ** p <= X:
      list.append(b ** p)
      p += 1
      
print(max(list))

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

if X == 1:
  list.append(1)

elif X == 2 or X == 3:
  list.append(2)
  
else:
  for b in range(2, X):
    p = 2
    while b ** p <= X:
      list.append(b ** p)
      p += 1
      
print(max(list))

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

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

Solution (Python):
x=int(input())
s={1,}
for b in range(2,x):
    for p in range(2,100000):
        tmp=b**p
        if tmp>x:
            break
        s.add(tmp)
print(max(s))

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


_max = 1
for i in range(1, x+1):
    for j in range(2, x+1):
        if pow(i, j) > _max and pow(i, j) <= x:
            _max = pow(i, j)
        if pow(i, j) > x:
            break

print(_max)

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

Solution (Python):
import sys
a = [1]
for i in range(2,34):
    for j in range(2,13):
        if i**j <= 1000 : 
            a.append(i**j)   
x = int(input())
for k in range(x,0,-1):
    if k in a:
        print(k)
        sys.exit()

Solution (Python):
import sys
import time
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    X = int(readline())
    r = int(X**0.5)
    ans = 1
    for i in range(r,0,-1):
        tmp = i
        if i ==1:
            break
        while tmp<=X:
            ans = max(ans,tmp)
            tmp *=i
    print(ans)




if __name__ == '__main__':
    main()

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

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

Solution (Python):
from statistics import median


from fractions import gcd
from itertools import combinations 
from collections import deque
from collections import defaultdict
import bisect










import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    x = int(input())
    ma_ = 1
    for i in range(1,x):
        for j in range(2,x):
            if i**j <= x:
                ma_ = max(ma_,i**j)
            else:
                break
        
    print(ma_)
if __name__ == '__main__':
  main()

Solution (Python):

import math
x = int(input())
num = math.floor(x ** 0.5)
ans = 1

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

print(ans)

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

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

print(ans)

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

for i in range(2, 100):
    n = 2
    while i**n <= x:
        ans.append(i**n)
        n += 1

print(max(ans))

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


for i in range(1, 100):
    if i**2 > x:
        ans = (i - 1)**2
        break

for i in range(1, 100):
    if i**3 > x:
        ans = max(ans, (i - 1)**3)
        break

for i in range(1, 100):
    if i**5 > x:
        ans = max(ans, (i - 1)**5)
        break

for i in range(1, 100):
    if i**7 > x:
        ans = max(ans, (i - 1)**7)
        break

print(ans)

Solution (Python):
import math
k=int(input())
kouho=1
for i in range(2,32):
    for j in range(2,10):
        a=i**j
        if a>k:
            break
        if a>kouho:
            kouho=a
print(kouho)

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

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


if __name__ == '__main__':
    main()

Solution (Python):
def main():
    from bisect import bisect_left

    x = int(input())

    cands = [1]
    for b in range(2, x + 1):
        for p in range(2, x + 1):
            pw = b ** p
            if pw > x: break
            cands.append(pw)

    cands.sort()

    i = bisect_left(cands, x)
    if i == len(cands) or x < cands[i]:
        i -= 1
    print(cands[i])


if __name__ == '__main__':
    main()

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

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

print(ans)

Solution (Python):

import sys
from bisect import bisect_left,bisect_right
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    X=int(input())
    l=[]
    for i in range(1,33):
        for j in range(2,11):
            l.append(i**j)
    l.sort()
    print(l[bisect_right(l,X)-1])

if __name__ == '__main__':
    main()

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

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

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

for i in range(1,1001):
    for j in range(2,1001):
        K = pow(i,j)
        if K > X:
            break
        ans = max(ans,K)

print(ans)

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

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

print(ans)

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

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

print(a)

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

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

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

        
    
print(ans)