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())
res=0
for b in range(x+1):
    for p in range(2,x+2):
        if res<(b**p)<=x:
            res=b**p
        elif b**p>x:
            break
print(res)

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

Solution (Python):
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 6)
mod = 10**9+7
cnt = 0
ans = 0
num = []
inf = float("inf")
al = "abcdefghijklmnopqrstuvwxyz"
AL = al.upper()

N = k()
if N == 1:
    print(1)
    sys.exit()
 
for i in range(N,-1,-1):
    for j in range(1,int(N**0.5)+1):
        for k in range(2,11):
            if j**k == i:
                print(i)
                sys.exit()

Solution (Python):
import sys

input = sys.stdin.buffer.readline
in_n = lambda: int(input())
in_nn = lambda: map(int, input().split())
in_s = lambda: input().rstrip().decode('utf-8')
in_map = lambda: [s == ord('.') for s in input() if s != ord('\n')]

MOD = 10**9 + 7
INF = 8 * 10**18


def main():

    x = in_n()

    dp = [False] * 1100
    dp[1] = True

    for i in range(2, 110):
        for j in range(2, 20):
            now = i**j
            if now <= 1000:
                dp[now] = True
            else:
                break

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


if __name__ == '__main__':
    main()

Solution (Python):


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


if __name__ == "__main__":
    main()

Solution (Python):
from math import *

x = int(input())

lst1 = list(range(2, int(sqrt(1000)) + 1))
lst2 = [1, 1000]

for n in lst1:
   i = 2
   while n ** i < 1000:
      lst2.append(n ** i)
      i += 1

lst2 = list(set(lst2))
lst2.sort()

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

print(lst2[-1])

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

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

Solution (Python):
def answer(x: int) -> int:
    if x < 4 :
        return 1

    result = 1
    for b in range(2, x + 1):
        for p in range(2, x + 1):
            exp = pow(b, p)
            if exp <= x:
                result = max(result, exp)
            else:
                break

    return result


def main():
    x = int(input())
    print(answer(x))


if __name__ == '__main__':
    main()

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

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

Solution (Python):

import sys
input=sys.stdin.readline

def main():
    n = int(input())
    answers=[]

    if n<=3:
        print(n)
        exit()

    for b in range(2,n):
        
        for p in range(2,11):
            if b**p > n:
                break
            elif b**p <=n:
                answers.append(b**p)
            else:
                continue
    print(max(answers))
                

if __name__=="__main__":
    main()

Solution (Python):
import math

X = int(input())

ans = 1
for b in range(int(math.sqrt(X)) + 1):
    for p in range(10):
        if b ** p <= X:
            ans = max(ans, b ** p)
        else:
            break

print(ans)

Solution (Python):
x = int(input())
ans = 1000000
for b in range(1,32):
    for p in range(2,10):
        if x-b**p < 0:
            continue
        ans = min(ans,abs(x-(b**p)))
print(x-ans)

Solution (Python):
x = int(input())
ans = 1
cnt = 1
for i in range(1,x):
    cnt = i
    for j in range(9):
        cnt *= i
        if cnt > x:
            break
        if cnt > ans:
            ans = cnt
print(ans)

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

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

Solution (Python):
a=int(input())
d=0
e=0
for i in range(40):
  b=i+2
  while b<=a:
    b=b*(i+2)
    e=e+1
  c=b/(i+2)
  if e>1:
    if d<=c:
      d=c
      e=0
  else:
    e=0
if d==0:
  print(1)
else:
  print(int(d))

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

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

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

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

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

ans = 0
for i in range(1, int(X**0.5)+1):
    for j in range(2, 1000):
        tmp = pow(i, j)
        if tmp > X:
            break
        ans = max(ans, tmp)

print(ans)

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

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

ans = 1
for i in range(2,N+1):
    tmp = 2
    while i**tmp<=N:
        ans = max(ans,i**tmp)
        tmp += 1
print(ans)

Solution (Python):
import sys
 
X = int(sys.stdin.readline())
ans = 0
for i in range(X+1):
    for j in range(2, 11):
        tmp = pow(i, j)
        if tmp <= X:
            ans = max(ans, tmp)
print(ans)

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

ans = 0
for i in range(1, int(X**0.5)+1):
    for j in range(2, 1000):
        tmp = pow(i, j)
        if tmp > X:
            break
        ans = max(ans, tmp)

print(ans)

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

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

Solution (Python):
n=int(input())
ans=1
for b in range(2,100):
    tmp=b
    for p in range(2,10):
        tmp*=b
        if tmp<=n :
            ans=max(ans,tmp)
print(ans)

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

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

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

print(ans)

Solution (Python):
X = int(input())
n = 1
if X<=3:
    print(1)
elif X==4:
    print(4)
else:
    n = 4
    for i in range(2,int(X**0.5)+1):
        b = i
        k = 1
        while b**k<=X:
            k += 1
        k -= 1
        if k>=2:
            n = max(n,b**k)
    print(n)

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

X = int(input())

s = set([1])
for i in range(min(2, X), X):
    cnt = 2
    while i**cnt<=X:
        s.add(i**cnt)
        cnt += 1

print(max(s))

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

Solution (Python):
MAX = 35
N = int(input())
ans = 1
for i in range(2,MAX+1):
  t = i*i
  while t <= N:
    ans = max(ans,t)
    t *= i
print(ans)

Solution (Python):
x = int(input())
bekis = [1]
for i in range(2,35):
    for j in range(2,15):
        v = i**j
        if v > x: break
        bekis.append(v)

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

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

if __name__ == "__main__":
    main()

Solution (Python):
import sys, math
lines = [s.rstrip("\n") for s in sys.stdin.readlines()]
x, = [int(num) for num in lines.pop(0).split(" ")]
max_base = int(math.sqrt(x))
max = 1
for base in range(2, max_base + 1):
    i = 2
    while True:
        tmp_max = base ** i
        if tmp_max <= x:
            if tmp_max > max:
                max = tmp_max
            i += 1
        else:
            break
print(max)

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

ans=[]

if n==1:
    print('1')
    sys.exit()

for i in range(n//2):
    for j in range(n//2):
        if i**j<=n:
            ans.append(i**j)

print(max(ans))

Solution (Python):
x = int(input())
expotential = [0] * (x + 1)
expotential[1] = 1
for b in range(2, x+1):
	t = b * b
	while(t <= x):
		expotential[t] = 1
		t *= b
for i in range(x, 0, -1):
	if expotential[i]:
		print(i)
		break

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

Solution (Python):
X = int(input())
lst = [1]
for i in range(2, 32):
    for j in range(2, 10):
        x = i ** j
        if x <= 1000:
            lst.append(x)
if X in lst:
    print(X)
else:
    lst.append(X)
    lst2 = sorted(lst)
    n = lst2.index(X)
    print(lst2[n-1])

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

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

print(ans)

Solution (Python):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

x = int(input())

def prime_factorize(n):
    prime_factors = {}
    i = 2
    while i ** 2 <= n:
        exp = 0
        while n % i == 0:
            exp += 1
            n //= i
        if exp:
            prime_factors[i] = exp
        i += 1

    if n != 1:
        prime_factors[n] = 1
    return prime_factors

ans = 1
for i in range(2, x + 1):
    prime_factors = prime_factorize(i)
    exps = set(prime_factors.values())
    if len(exps) == 1 and exps != {1}:
        ans = i
print(ans)

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

Solution (Python):
x = int(input())
max_val = 1
for i in range(1, x):
    for j in range(2, x):   
        val = i ** j
        if val > x:
            break
        elif val > max_val:
            max_val = val
print(max_val)

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

print(ans)

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

if ans == 0:
    ans = 1

print(ans)

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

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

maxi = 0

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

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

print(maxi)

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

Solution (Python):
X = int(input())
nums = set()
nums.add(1)
for b in range(2, 40):
    p = 2
    while True:
        if b**p <= 1000:
            nums.add(b**p)
            p += 1
        else:
            break
ans = -1
for num in nums:
    if num <= X:
        ans = max(ans, num)
print(ans)

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

ls = []
for i in range(2,math.floor(math.sqrt(X))+1):
  for j in range(2,10):
    if i ** j <= X:
      ls.append(i ** j)
      
print(max(ls) if ls else 1)

Solution (Python):
def main():
    x = int(input())
    expo_list = []

    for i in range(1, 1000):
        for j in range(2, 10):
            expo_list.append(i ** j)

    expo_list.sort(reverse=True)

    for expo in expo_list:
        if expo <= x:
            print(expo)
            break


if __name__ == "__main__":
    main()

Solution (Python):
def factorization(n):
    arr = []
    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
            arr.append((i, cnt))
    if temp != 1:
        arr.append((temp, 1))
    if arr == []:
        arr.append((n, 1))
    return arr

def solve():
    X = int(input())
    for i in range(X, 0, -1):
        F = factorization(i)
        mi = min(f[1] for f in F)
        if mi > 1 and all([f[1] % mi == 0 for f in F]):
            print(i)
            exit()
    print(1)

if __name__ == "__main__":
    solve()

Solution (Python):




def resolve():
    import sys
    input = sys.stdin.readline

    x = int(input().rstrip())

    num_set = set()
    for i in range(1, x+1):
        num = i * i
        while num <= x and i not in num_set:
            num_set.add(num)
            num = num * i

    print(max(num_set))

if __name__ == "__main__":
    resolve()

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

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

    now = i
    while now * i <= x:
        now *= i
    if now > ans:
        ans = now

print(ans)

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

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

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

while True:
    a=prime_factorize(X)
    temp=[]
    c=1
    sw=True
    if len(a)==1:
        sw=False
    for i in range(len(a)-1):
        if a[i]!=a[i+1]:
            temp.append(c)
            c=0
        c+=1
    temp.append(c)

    for j in range(len(temp)-1):
        if temp[j]!=temp[j+1] or temp[j]==1:
            sw=False
    if sw==True:    
        print(X)
        exit()
    X-=1

Solution (Python):
n = int(input())
t = [1, 4, 8, 9, 16, 25, 27, 32, 36, 49, 64, 81, 100,
     125, 121, 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, 1024, 1296]

res = 0
for tt in t:
    res = tt if tt <= n else res
print(res)

Solution (Python):
n = int(input())
s = set()
for i in range(1, 32):
    s.add(i ** 2)

for i in range(1, 11):
    s.add(i ** 3)

for i in range(1, 7):
    s.add(i ** 4)

for i in range(1, 5):
    s.add(i ** 5)
    s.add(i ** 6)
    s.add(i ** 7)
    s.add(i ** 8)
    s.add(i ** 9)
    s.add(i ** 10)

t = list(s)
t.sort()
t = [x for x in t if x <= 1000]

res = 0
for tt in t:
    res = tt if tt <= n else res
print(res)

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

Solution (Python):
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

x = ri()
max_ = 0
for i in range(int(x**0.5), 0, -1):
    for j in range(1, 10):
        if i**j <= x:
            max_ = max(i**j, max_)
        else:
            break
print(max_)

Solution (Python):
X = int(input())
exps = []
for b in range(1,34):
  for p in range(2,11):
    x = b**p
    if x < 1001:
      exps.append(x)
exps = list(set(exps))
exps.sort()
for a in exps[::-1]:
  if X >= a:
    print(a)
    break

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

table = [False] * -~x
table[1] = True
for i in range(2, 32):
    j = i * i
    while j <= x:
        table[j] = True
        j *= i

print(max(i for i in range(x + 1) if table[i]))

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

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

Solution (Python):



from fractions import gcd
from itertools import combinations,permutations,accumulate, product 

from collections import deque,defaultdict,Counter
import decimal
import re
import math
import bisect














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


from sys import stdin
readline = stdin.readline
def readInts():
  return list(map(int,readline().split()))
def readTuples():
    return tuple(map(int,readline().split()))
def I():
  return int(readline())
x = I()
ans = 1
for b in range(2,1001):
    for p in range(2,24):
        if b**p <= x:
            ans = max(ans,b**p)
        else:
            break
print(ans)

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

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

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

print(ans)

Solution (Python):
import math
X = int(input())
ans = 1
Y = math.floor(math.sqrt(X))
for i in range(2, Y+1):
    for j in range(2, 10):
        a = i**j
        if a <= X:
            ans = max(ans, a)
print(ans)

Solution (Python):
import collections
X = int(input())
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

for i in range(X):
  J = X - i
  d = collections.Counter(prime_factorize(J))
  dv = list(d.values())
  if len(set(dv)) == 1 and dv[0] >= 2:
    print(J)
    break
  if dv == []:
    print(1)
    break

Solution (Python):
def m_pow(x, n) -> int:
    """
    O(log n)
    """
    if n == 0:
        return 1

    K = 1
    while n > 1:
        if n % 2 != 0:
            K *= x
        x *= x
        n //= 2

    return (K * x)


ans = 1
x = int(input())
for i in range(2, 1001):
    for j in range(2, 1001):
        n = m_pow(i, j)
        if n <= x:
            ans = max(n, ans)
        else:
            break

print(ans)

Solution (Python):
X = int(input())
s = [0] * (X + 1)
for i in range(1, 1001):
    for j in range(2, 1001):
        n = i**j
        if n > X: break
        s[n] += 1
for i in range(X, 0, -1):
    if s[i]:
        print(i)
        exit()

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

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

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

Solution (Python):
import math
def resolve():
    x = int(input())
    sqrt_x = int(math.sqrt(x))
    al = list()
    for i in range(2, 10):
        for j in range(sqrt_x, 0, -1):
            if j**i <= x:
                al.append(j**i)
                break
    al = sorted(al)
    print(al[-1])
resolve()

Solution (Python):
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    x = int(readline())
    s = set()

    for i in range(1, 1001):
        for j in range(2, 16):
            if i ** j <= x:
                s.add(i ** j)
            else:
                break

    l = list(s)
    l.sort(reverse=True)

    print(l[0])


if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
import math as m
if n < 4:
  print(1)
  exit(0)
  
perfect = 1
for b in range(2,int(n**0.5)+1):
  p = int(m.log(n,b))
  x = b**(p+1)
  if x > n:
    x = b**p
  perfect = max(perfect,x)
  
  if perfect == n:
    break

print(perfect)

Solution (Python):
n = int(input())
a = {1}
for b in range(2,n):
  p = 2
  x = b**p
  while x <= n:
    a.add(x)
    x = b**p
    p += 1

print(max(a))

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

Solution (Python):
X = int(input())
S = set([1])
for i in range(2,X):
  b = 2
  while(i**b<=X):
    S.add(i**b)
    b += 1

ans = max(S)
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())
pr = [1]
for i in range(2,32):
    for j in range(2,10):
        if (i**j <= 1000)&(i**j not in pr):
            pr.append(i**j)
print(max([k for k in pr if k <= x]))

Solution (Python):
x=int(input())
m=-1000
if 1<=x<=3:
  print(1)
  exit()
else:
  for b in range(2,x+1):
   for p in range(2,11):
    if x>=b**p:
      m=max(m,b**p)
   

print(m)

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

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

print(ans)

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

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

def check_p(X,b):
	p = 0
	while b**(p+1) <= X:
		p+=1
	return b**p

ans=1
for b in range(2,int(math.sqrt(X))+1):
	ans = max(ans,check_p(X,b))

print(ans)

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

Solution (Python):
import math
X = int(input())
list1 = []

for i in range(2,X+1):
  for j in range(2,int((X + 1)/2)):
    a = math.log10(i)/math.log10(j)
    if a.is_integer():
      list1.append(i)
if list1 == []:
  print(1)
else:
  print(max(list1))

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

Solution (Python):
from bisect import *
A = {1}
for p in range(2,11):
    for b in range(2,33):
        A.add(b**p)
A = list(A)
A.sort()
X = int(input())
print(A[bisect_right(A,X)-1])

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

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




def RD(): return input().rstrip().decode()
def II(): return int(input())
def FI(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))



def main():
	x=II()

	li=set([1])

	for i in range(2,35):
		for j in range(2,11):
			if i**j<=1001:
				li.add(i**j)
			else:
				break

	li=list(li)
	li.sort(reverse=True)

	

	for i in li:
		if i<=x:
			print(i)
			exit()










if __name__ == "__main__":
	main()

Solution (Python):
X=int(input())
max = 1
for i in range(2,33):
    k = 2
    while True:
        n = i**k
        if n > X:
            break
        if n > max:
            max = n
        k += 1
print(max)

Solution (Python):
def main():
    X = int(input())
    maxi = 1
    if X <= 2:
        print(1)
        return
    for b in range(2, X):
        for p in range(2, X):
            if b**p > X:
                break
            else:
                maxi = max(maxi, b**p)
    print(maxi)
main()

Solution (Python):
x = int(input())
mx = 0
for b in range(1, int(1000 ** 0.5) + 1):
    for p in range(2, 10):
        if mx < b ** p <= x:
            mx = b ** p
print(mx)

Solution (Python):



from fractions import gcd
from itertools import combinations,permutations,accumulate, product 

from collections import deque,defaultdict,Counter
import decimal
import re
import math















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


from sys import stdin
readline = stdin.readline
def readInts():
  return list(map(int,readline().split()))
def readTuples():
    return tuple(map(int,readline().split()))
def I():
  return int(readline())
x = I()
ans = -1
for b in range(1,x+2):
    for p in range(2, x+2):
        if b**p > x:
            break
        ans = max(ans, b**p)
print(ans)

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

Solution (Python):
import math
X = int(input())
beki = []
beki.append(1)
Xruto = math.sqrt(X)
Xruto = math.floor(Xruto)
for i in range(2, Xruto+1):
    for j in range(10):
        a = pow(i, j)
        if a <= X:
            beki.append(a)
        else:
            break
print(max(beki))

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

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
ans = 1
for i in range(X):
  Y = X - i
  f = collections.Counter(prime_factorize(Y))
  if len(set(f.values())) == 1 and list(f.values())[0] > 1 :
    ans = Y
    break
print(ans)

Solution (Python):
from bisect import bisect_right


cands = []
for i in range(2, 400):
    cur = i
    while cur * i <= 1000:
        cands.append(cur * i)
        cur *= i
cands.sort()

X = int(input())
if X == 1:
    print(1)
else:
    print(cands[bisect_right(cands, X) - 1])

Solution (Python):
x = int(input())
ans = [1]
for i in range(2, 1001):
    p = 2
    while i**p <= x:
        ans.append(i**p)
        p += 1
ans.sort(reverse=True)

print(ans[0])

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

Solution (Python):
x = int(input())
ans = 0
for i in range(33):
    for j in range(2,11):
        if pow(i,j) > x: break
        ans = max(ans,pow(i,j))

print(ans)

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

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

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

max_expo = 1

for p in range(2,10):
  for b in range(X):
    if max_expo < (b**p) <= X:
      max_expo = (b**p)
print(max_expo)

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())
ex = [0 for i in range(1001)]
ex[1] = 1

for i in range(2, 1001):
  tmp = i * i
  while tmp <= 1000:
    ex[tmp] = 1
    tmp *= i
  
for i in range(x, 0, -1):
  if ex[i] == 1:
    print(i)
    break

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

Solution (Python):
a = int(input())
ans = 0
i = 1
while i*i <= a:
  for j in range(1, 1000):
    if i**j <= a and ans < i**j:
      ans = i**j
    if i**j > a:
      break;
  i += 1
print(ans)

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

beki = {1}
for b in range(2,32):
    for p in range(2,10):
        if b**p<=x:
            beki.add(b**p)
        else:
            break
            
beki = sorted(beki)
            
print(beki.pop(-1))

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

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

if x <= 3:
  print(x)
  exit()

ans = 0
for i in range(2, int(x**0.5)+1):
  s = i
  t = 1
  while s < x:
    t += 1
    s = i**t
    if ans < s and s <= x: ans = s
print(ans)

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

A=[1]
for b in range(2,32):
  for p in range(2,10):
    if b**p>X:
      break
    elif b**p not in A:
      A.append(b**p)
print(max(A))

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

l = [1]

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

Solution (Python):
import math

x = int(input())

k = int(math.sqrt(x))

l = [1]

for i in range(2, k+1):
    j = 2
    while i ** j <= x:
        l.append(i ** j)
        j += 1

print(max(l))

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

ans = 1

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

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

li = [1]
for i in range(2,32):
    cnt = 2
    while i**cnt<=x:
        li += [i**cnt]
        cnt +=1

print(max(li))

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

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

ans=0

for b in range(1, int(x**(1/2)+1)):
    for p in range(2, 20):
        c = b**p
        if c<=x:
            ans=max(ans, c)

print(ans)

Solution (Python):
import math
X=int(input())
x=int((X**(1/2))//1)
A=[]
y=int(math.log2(X)//1)
for i in range(x+1):
    for j in range(y+1):
        if i**j<=X:
            A.append(i**j)
print(max(A))

Solution (Python):

import math
X = int(input())
def expo(x):
    ans = 1
    for i in reversed(range(1,x+1)):
        for j in range(int(math.sqrt(x))+1):
            for k in range(2,int(math.sqrt(x))):
                if i == j**k:
                    ans = i
                    return ans
    return ans
print(expo(X))