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 math

X = int(input())

def main():
    hit_nums = set([1])
    
    limit = math.floor(math.sqrt(X))
    base = 2
    while base <= limit:
        curr = base
        while curr <= X:
            hit_nums.add(curr)
            curr *= base
        base += 1

    print(max(hit_nums))

if __name__ == "__main__":
    main()

Solution (Python):
import math


X = int(input())

r = 0

if X == 1:
    r = 1
else:
    for b in range(2, math.ceil(X ** 0.5)):
        for p in range(2, math.ceil(X ** 0.5)):
            if b ** p > X:
                break
            else:
                r = max(r, b ** p)

print(r)

Solution (Python):

x = int(input())
array = []
for i in range(1,33):
    for j in range(2,10):
        a = i**j
        if a <= x:
            array.append(a)
array.sort(reverse=True)
print(array[0])

Solution (Python):
n = int(input())
array = []
for i in range(1,33):
  for j in range(2,10):
    a = i**j
    if a <= n:
      array.append(a)
array.sort(reverse=True)
print(array[0])

Solution (Python):


x = int(input())

l = [False] * (x + 1)

l[1] = True
for i in range(2, x + 1):
    v = i * i
    while (v <= x):
        l[v] = True
        v *= i

res = x
for i in l[::-1]:
    if i is True:
        print(res)
        break
    res -= 1

Solution (Python):
import math

b = [0 for i in range(1001)]
for i in range(2, 1001):
    j = i * i
    while j < 1001:
        if b[j] == 1:
            break
        b[j] = 1
        j *= i
b[1] = 1
X = int(input())
for i in range(X, 0, -1):
    if b[i] == 1:
        print(i)
        break

Solution (Python):
X = int(input())
L = []
ANS = []
for i in range(1,33) :
    for j in range(2,11) :
        if i**j <= 1192 :
            l = i**j
            L.append(l)
L = list(set(L))
L = sorted(L)
for j in range(len(L)) :
    if L[j] <= X < L[j+1] :
        ans = L[j]
        ANS.append(ans)
print(max(ANS))

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

ans = 1

for b in range(2,32):
  for p in range(2,11):
    if b ** p <= N:
      ans = max(ans, b**p)

print(ans)

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

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

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

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

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

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

print(ans)

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

maxInt = 1

i = 2
while i * i <= x:
	exp = i * i
	while exp <= x:
		exp *= i
	else:
		maxInt = max(maxInt, exp // i)
		i += 1
print(maxInt)

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

import math
def is_beki(n):
  for i in range(2, int(math.sqrt(n)//1)+1):
    beki = i
    while beki <= n:
      if beki == n:
        return True
      beki = beki * i
  return False

if X == 1:
  print(1)
else:
  for i in range(X, 1, -1):
    if is_beki(i):
      break
  print(i)

Solution (Python):


from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W

def main():
    X = int(input())
    ans = 1
    for b in range(X, 0, -1):
        for p in range(10, 1, -1):
            if b ** p <= X:
                ans = max(ans, b ** p)

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
from collections import defaultdict
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
AtoZ = [chr(i) for i in range(65,65+26)]
atoz = [chr(i) for i in range(97,97+26)]

def inpl(): return list(map(int, input().split()))
def inpl_str(): return list(input().split())

li = [1]

for i in range(2,33):
	SUM = i
	while SUM <= 1000:
		SUM *= i
		li.append(SUM)

li = list(set(li))
li.sort()

N = int(input())
ind = bisect.bisect_right(li,N)
print(li[ind-1])

Solution (Python):
x = int(input())
out = 1
for i in range(2,33):
    for j in range(2,10):
        num = i**j
        if x >= num:
            out = max(out, num)
print(out)

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

Solution (Python):
X = int(input())
max_num = 1
for i in range(1, 32):
    for j in range(2, 10):
        q = i ** j
        if q <= X and max_num <= q:
            max_num = q
print(max_num)

Solution (Python):
X = int(input())
 
ans = 1
p = 2
A = set()
for i in range(2,X):
  if(i in A):
    continue
  p = 1
  while(True):
    p += 1
    power = i ** p
    if(power <= X):
      A.add(power)
      tmp = power
      pass
    else:
      break
  if(ans<tmp):
    ans = tmp
  if(p == 2):
    break
  
print(ans)

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

Solution (Python):
from math import sqrt

X = int(input())

ans_cand = [1]
for n in range(2,int(sqrt(X)+1)):
    res = n
    while res*n <= X:
        res *= n
        
    ans_cand.append(res)
    
print(max(ans_cand))

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

for x_i in range(x, 0, -1):
    for j in range(2, max(3, x_i)):
        n = 0
        while n**j < x_i:
            n += 1
        if n**j == x_i:
            print(x_i)
            exit()

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

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

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

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

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

Solution (Python):
x=int(input())
for i in range(x,0,-1):
    for p in range(1,int(i**.5)+1):
        for q in range(10):
            if i==p**q:
                print(i)
                break
        else:
            continue
        break
    else:
        continue
    break

Solution (Python):
import sys
x = int(input())
lis = [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]
lis.sort(reverse=True)
for nums in lis:
  if nums <= x:
    print(nums)
    sys.exit()

Solution (Python):
n=int(input())
s=set()
for i in range(1000):
    s=s|{i**j for j in range(2,10) if i**j<=1000}
l=sorted(s)
for (i,j) in enumerate(l):
    if n<j:
       print(l[i-1])
       break;
    elif n==j:
        print(n)
        break;

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

Solution (Python):
import sys 
import math

X = int(input())

a = [0 for i in range(X+1)]

a[1] = 1

for i in range(2,int(math.sqrt(X))+1):
    num = i*i
    while num <= X:
        a[num]=1
        num *= i

for i in range(1,X+1):
    if a[i] == 1:
        ans = i
print(ans)

Solution (Python):

x = int(input())
ans = 1
i = 2
minv = 100000
while i ** 2 <= x:
    n = 2
    while i ** n <= x:
        if minv > x - i ** n:
            minv = min(minv, x - i ** n)
            ans = i ** n
        n += 1
    i += 1
print(ans)

Solution (Python):

X = int(input())

max_beki = 1
for i in range(1,X):
  for j in range(2,X):
    beki = i ** j
    
    if beki > X:
      break
      
    elif beki > max_beki:
      max_beki = beki
 
print(max_beki)

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

Solution (Python):
list1=[]
for b in range(1,33):
    for p in range(2,11):
        if b**p not in list1 and b**p<=1000:
            list1.append(b**p)
        elif b**p>1000:
            break
list1.sort()
N=int(input())
ans=0
for i in range(len(list1)):
    if list1[i]<=N:
        ans=list1[i]
    else:
        break
print(ans)

Solution (Python):
import math
N=int(input())
def beki(x):
    b=2
    while b <= math.sqrt(x):
        p=2
        while b**p <=x:
            if b**p == x:
                return True
                break
            else:
                p+=1
        else:
            b+=1
    else:
        return False
while N>=2:
    if beki(N)==True:
        print(N)
        break
    else:
        N-=1
else:
    print(1)

Solution (Python):
import sys
import math
import collections
import itertools
import array
import inspect


sys.setrecursionlimit(10000)


def chkprint(*args):
    names = {id(v):k for k,v in inspect.currentframe().f_back.f_locals.items()}
    print(', '.join(names.get(id(arg),'???')+' = '+repr(arg) for arg in args))


def to_bin(x):
    return bin(x)[2:]



dp = None

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

    A = [1]
    for a in range(2, 100):
        for b in range(2, 10000):
            if a ** b <= 1000:
                A.append(a ** b)
            else:
                break

    print(sorted(filter(lambda a: a<=x, A))[-1])



main()

Solution (Python):
x = int(input())
exp_set = set()
exp_set.add(1)
for i in range(2, 32):
  p = 2
  while True:
    if i**p > 1000:
      break
    exp_set.add(i**p)
    p += 1
ans = 0
for ele in sorted(list(exp_set)):
  if ele > x:
    break
  ans = ele
print(ans)

Solution (Python):


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

    exp_list = [1]
    i = 2
    flag = 0

    while True:
        j = 2
        while True:
            if i ** j <= X:
                exp_list.append(i ** j)
                j += 1
            elif i ** 2 > X:
                flag = 1
                break
            else:
                break
        i += 1
        if flag == 1:
            break
    
    print(max(exp_list))

if __name__ == '__main__':
    main()

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

Solution (Python):
from math import sqrt

x = int(input())
xr = int(sqrt(x))

l=[1]
for i in range(1,xr+1):
    t=[]
    for j in range(2,xr):
        if i**j <= x:
            t.append(i**j)
        else:
            break
    l = l+t
l = list(set(l))
l.sort()


left=0
right=len(l)
center=0

while left < right:
    center = (left+right)//2
    if l[center] == x:
        break
    elif l[center] < x:
        left = center+1
    else:
        right = center

print(l[center])

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

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

Solution (Python):
x = int(input())
k = [[0], [0], [i*i for i in range(32) if i*i <= x]]
i = 2
while(len(k[i]) > 2):
  k.append([k[i][j]*j for j in range(len(k[i])) if k[i][j]*j <= x])
  i += 1
print(max([l[-1] for l in k]))

Solution (Python):
import math
X = int(input())
b_list = []
for b in range(1,int(math.sqrt(X))+1):
    for p in range(2,11):
        if b**p <=X:
            b_list.append(b**p)
print(max(b_list))

Solution (Python):
X = int(input())
ans = 1
if X > 1:
  for b in range(1, 32):
    for p in range(2, 11):
      if ans <= X and pow(b, p) <= X:
      	ans = max(ans, pow(b, p))
print(ans)

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

rtn = 0 
if X == 1:
    print(X)
else:
    for i in range(2,X//2):
        j = 2 
        while(True):
            tmp = i ** j
            if(tmp > X): 
                break 
            elif(tmp > rtn):
                rtn = tmp 
            j+=1
    print(rtn)

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

Solution (Python):
X=int(input())
power=[i for i in range(2,10)]
max_pow=0
for j in range(1,X+1):
    for pow_number in power:
        if pow(j, pow_number)<=X:
            max_pow=max(pow(j, pow_number), max_pow)
print(max_pow)

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

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

a=1
while a**2<=x:
    a+=1
b=1
while b**3<=x:
    b+=1
ans=max((a-1)**2,(b-1)**3)
if 32<=x:
    ans=max(ans,32)
if 243<=x:
    ans=max(ans,243)
if 128<=x:
    ans=max(ans,128)
print(ans)

Solution (Python):
def beki(n,X):
    
    x = 1
    while x*n <= X:
        x *= n
    if x == n:
        return 1
    else:
        return(x)

X = int(input())
a = 1

for n in range(X)[2:]:
    b = beki(n,X)
    if b > a:
        a = b

print(a)

Solution (Python):
x=int(input())
def beki(n):
    for i in range(2,32):
        k=n
        if k%i==0:
            t=0
            while k>=1:
                k/=i
                if k==1 and t>=1:
                    return True
                t+=1
y=1
for i in range (1,x+1):
    if beki(i)==True:
        y=i
print(y)

Solution (Python):
if __name__ == '__main__':
    X = int(input())

    if X == 1:
        print(1)
    else:
        res = 0
        for i in range(2, X):
            p = 2
            while True:
                temp = i ** p
                if temp <= X:
                    if res < temp:
                        res = temp
                    else:
                        p += 1
                else:
                    break
        print(res)

Solution (Python):

def main():
    x = int(input().strip())

    ns = []
    for i in range(1, 33):
        for j in range(2, 10):
            ns.append(i ** j)

    ns = list(set(ns))
    ns.sort()

    for i, n in enumerate(ns):
        if x < n:
            print(ns[i-1])
            return

if __name__ == '__main__':
    main()

Solution (Python):
X = int(input())
num = [1]
for i in range(2,X):
  temp = i
  while temp*i<=X:
    temp=temp*i
    num.append(temp)
    
print(sorted(num)[-1])

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

beki = 0
for p in range(2, 9):
    tmp = 0
    b = 1
    while tmp <= X:
        tmp = b**p
        if tmp > X:
            break
        beki = max(tmp, beki)
        b += 1

print(beki)

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

answer=1

for i in range(2,int(math.sqrt(X))+1):
 j=2
 while i**j<=X:
  answer=max(answer,i**j)
  j+=1

print(answer)

Solution (Python):
import math
x = int(input())
lis = [1]
for i in range(2, int(math.sqrt(x))+1):
    j = 2
    sample = 0
    while i ** j <= x:
        sample = i ** j
        j += 1
    if sample != 0:
        lis.append(sample)
print(max(lis))

Solution (Python):
X = int(input())
ans = 1
for b in range(1, 100):
  for p in range(2, 10):
    if ans < pow(b, p) and pow(b, p) <= X:
      ans = pow(b, p)
print(ans)

Solution (Python):
def f(x):
  s = set()
  s.add(1)
  for b in xrange(2, x+1):
    y = b
    for p in xrange(x+1):
      y *= b
      if y > x: break
      s.add(y)
  l = sorted(list(s))
  return l[-1]
  
X=int(raw_input())
print f(X)

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

for i in range(2, x):
    sum = i
    while sum * i <= x:
        sum = sum * i
        result.append(sum)

print(sorted(result)[-1])

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

Solution (Python):
import math

X = int(input())

ans = 1

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

print(ans)

Solution (Python):
import math

X = int(input())

ans = 1

for i in range(2,max(3, math.floor(math.sqrt(X))+1)):
  j = 2
  while i**j <= X:
    if i**j > ans:
      ans = i**j
    j += 1

print(ans)

Solution (Python):
import math

X = int(input())

ans = 1
for i in range(X+1):
  for j in range(2,max(math.floor(math.sqrt(X-i))+1,3)):
    beki = False
    tmp = X-i
    while True:
      if tmp%j != 0:
        if tmp == 1:
          beki = True
        break
      else:
        tmp //= j
    if beki:
      ans = X-i
      break
  if beki:
    break

print(ans)

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

Solution (Python):

import math

def solve(X):
	ans = X
	
	for b in range(2, X):
		p = math.log(ans, b) 
		if float.is_integer(p):
			return ans
	return 1

def solve2(X):
	
	for x in range(X, 1, -1):
		for p in range(2, x):
			for b in range(2, x):
				bp = b**p
				if bp == x:
					return x
				if bp >= x:
					break
	return 1

if __name__ == "__main__":
	X = int(input())
	print(solve2(X))

Solution (Python):
import math

x = int(input())

max_pow = 1
for i in range(1, math.ceil(math.sqrt(x))):
    for p in range(2, 9):
        i_p = i**p
        if i_p > x:  break
        if i_p > max_pow: max_pow = i_p
            
print(max_pow)

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

max_base = int(X**(1.0/2.0))

max_power = int(math.log(X)/math.log(2))
perfect_powers = [b**p for p in range(2,max_power+1) for b in range(1,max_base+1) if b**p <= X]
if perfect_powers:
    print(max(perfect_powers))
else: 
    print(1)

Solution (Python):
X, = map(int,raw_input().split())
m = 0
for b in range(1,100):
  for p in range(2,11):
    if b**p <= X:
      m = max(m, b**p)
print m

Solution (Python):
x = int(input())
if x != 1:
  a = []
  for i in range(2,34):
      n = i**2
      while n <= x:
          a.append(n)
          n = n*i

  print(max(a))
else:
  print(1)

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

powers = {1}

for p in range(2, 32):
    pw = p*p
    while pw <= X:
        powers.add(pw)
        pw *= p

print(max(powers))

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

Solution (Python):
n = int(input())
res = 1
for i in range(1,n+1):
    for k in range(2,1+n):
        num = i**k
        if num > n:
            break
        if num <= n :
            res = max(res,num)
    
print(res)

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

num = 0
for i in range(1, X + 1):
    if i**2 < X:
        num = i

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

        if ans < x:
            ans = x

print(ans)

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

a = 1
b = 2
while b**2 <= X:
  p = 2
  while b**p <= X:
    a = max(a, b**p)
    p += 1
  b += 1
print(a)

Solution (Python):
X = int(input())
x_max=0
if X==1:
    x_max=1
elif X==2:
    x_max=1
i=2
while i**2<=X:
    j=2
    while i**j<=X:
        if x_max<i**j:
            x_max = i**j
        j+=1
    i+=1
print(x_max)

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

num = 0
for i in range(1, X + 1):
    if i**2 < X:
        num = i

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

        if ans < x:
            ans = x

print(ans)

Solution (Python):
hoge = [False] * 1080
hoge [1] = True
for i in range(2, 1080):
 x = i*i
 while(x < 1080):
  hoge[x] = True
  x *= i

X = input()

while not hoge[X]: X -= 1
print X

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

Solution (Python):
X = int(input())
n = int(X**0.5)

result = 1
for i in range(2,n+1):
    p = 2
    while X>=pow(i,p):
        p += 1

    tmp = pow(i,p-1)
    if result <= tmp:
        result = tmp

print(result)

Solution (Python):
import math


X = int(input())

p = 2
q = 2
tmp = 4

while p < math.sqrt(X):
    q = 2
    while 1:
        if p ** q > X:
            break
        else:
            if tmp < p ** q:
                tmp = p ** q
            q += 1
    p += 1
if X > 3:
    print(tmp)
else:
    print(1)

Solution (Python):
import math


X = int(input())

p = 2
q = 2
tmp = 4

while p < math.sqrt(X):
    q = 2
    while 1:
        if p ** q > X:
            break
        else:
            if tmp < p ** q:
                tmp = p ** q
            q += 1
    p += 1
if X > 3:
    print(tmp)
else:
    print(1)

Solution (Python):
x = input()
ans = 1
for i in range(2, x/2):	
	for j in range(2, 1000):
		t = i ** j
		if t <= x:
			if ans < t:
				ans = t
		else :
			break
print ans

Solution (Python):
import math

def calcPow(X):
    num = int(math.sqrt(X))
    Max = 0

    if(X <= 3):
        return X

    for i in range(2,num+1):
        for j in range(2,X):
            if(pow(i,j) > X):
                if(pow(i,j-1) > Max):
                    Max = pow(i,j-1)
                    break
                break

    return Max


if __name__ == '__main__':
    X = int(input())

    print(calcPow(X))

Solution (Python):
N=int(input())
result = [1]
for i in range(2,1001):
  for j in range(2,11):
    if pow(i,j) <= N and pow(i,j) not in result:
      result.append(pow(i,j))
print(max(result))

Solution (Python):
N=int(input())
result = [1]
for i in range(2,1001):
  for j in range(2,11):
    if pow(i,j) <= N and pow(i,j) not in result:
      result.append(pow(i,j))
print(max(result))

Solution (Python):
x = int(input())
a = 1
b = 2
p = 2
while True:
    while True:
        if b**p <= x:
            a = max(a, b**p)
            p += 1
        else:
            p = 2
            break
    b += 1
    if b**p > x:
        break
print(a)

Solution (Python):
from itertools import chain, count, takewhile

x = int(input())

if x > 1:
  ps = takewhile(lambda p: 2**p <= x, count(2))
  bps = (takewhile(lambda y:y <= x, (b**p for b in count(1))) for p in ps)
  print(max(chain.from_iterable(bps)))
else:
  print(1)

Solution (Python):
x=int(input())
ans=1
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())
ans = 0
if X == 1:
	ans = 1
else:
  for b in range(1, 32):
    for p in range(2, 11):
      if ans <= X and pow(b, p) <= X:
      	ans = max(ans, pow(b, p))
print(ans)

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

Solution (Python):
x = int(input())
c = 1
for i in range(2,int(x**0.5) + 1):
    k = 2
    while True:
        if x < i**k:
            c = max(i**(k-1),c)
            break
        else: k += 1 
                
            
print(c)

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

b = 3
ans = 1

for i in range(2,X+1):
        t = i ** 2
        if t <= X:
            while(1):
                t = i ** b
                if t <= X:
                    b = b + 1
                else:
                    b = 3
                    t = t // i
                    ans = max(ans, t)
                    break

print(ans)

Solution (Python):
x=int(input())
mx=1
for i in range(2,32):
  p=2
  while i**p<=x:
    if i**p > mx:
      mx = i**p
    p+=1
print(mx)

Solution (Python):
n = int(input())
l = []
for i in range(1,101):
    for j in range(2,11):
        k = i**j
        if k <=n:
            l.append(k)
print('{}'.format(max(l)))

Solution (Python):
import sys
X = sys.stdin.readline() 
x = int(X)
n = 1
m = 1
ans = 1
for i in range(9):
    n=1
    b = i+2
    a = 1
    while n <= x:
        a+=1
        n = a**b
        if n<=x and n>=ans:
            ans = n
print(ans)

Solution (Python):
import math
x = int(input())
cand_list = [1]
for i in range(int(math.sqrt(x)), 1, -1):
    ans = i
    while(ans <= x):
        cand_list.append(ans)
        ans *= i

print(max(cand_list))

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

Solution (Python):
import math

X = int(input())

power = [1]
for i in range(2, X):
    if pow(i, 2) > X:
        break
    k = i
    j = 2
    while k <= X:
        if pow(i, j) > X:
            break
        power.append(pow(i, j))
        k = pow(i, j)
        j += 1

print(max(power))

Solution (Python):
from math import sqrt, log2, floor
MAX_X = 1000
ALL_EXPONENTIAL = [
    b**p
    for b in range(1, floor(sqrt(MAX_X)) + 1)
    for p in range(2, floor(log2(MAX_X)) + 1)]

X = int(input())
assert 1 <= X <= MAX_X
print(max(filter(lambda candidate: candidate <= X, ALL_EXPONENTIAL)))

Solution (Python):
X = int(input())
max = [1]
n = int(X**(1/2))
for b in range(2, n+1):
    p = 2
    while b**p < X:
        p += 1
    if b**p == X:
        max.append(b**p)
    else:
        max.append(b**(p-1))
max.sort(reverse = True)
print(max[0])

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

beki = []

for i in range(1,33):
  for j in range(2,10):
    if i**j <= X:
      beki.append(i**j)

print(max(beki))

Solution (Python):
A=input()
a=int(A)
b=round(a*(1/2))
n2=1
for i in range(2,b):
    for x in range(2,b):
        if n2 <= a:
            n1=(i)**(x)
            if n2 <= n1 and n1 <= a:
                n2 = n1
                
                n1
print(n2)

Solution (Python):
import math
def check(X):
	maximum = 0
	for i in range(1, math.floor(math.sqrt(X))+1):
		if i == 1:
			maximum = 1
			continue
		j = 2
		while True:
			tmp = i ** j
			if tmp > X:
				break
			if tmp >= maximum:
				maximum = tmp
			j += 1
	return maximum

print(check(int(input())))

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

Solution (Python):
X=int(input())
N=0
ans=0
for i in range(1,32):
    for k in range(2,11):
        N=i**k
        if N<=X and N>ans:
            ans=N
            
            
print(ans)

Solution (Python):
import sys

x = int(input())
b = 2
p = 2

max_num = 1
if x == 1:
  print(1)
  sys.exit()
while b ** p <= x:
  while b ** p <= x:
    if b ** p > max_num:
      max_num = b ** p
    p += 1

  p = 2
  b += 1

print(max_num)

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

    n = int(x ** 0.5)
    ans = []
    for i in range(2, n + 1):
        tmp = i
        while tmp * i <= x:
            tmp *= i
        ans.append(tmp)

    return max(ans)


print(abc097_b())

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

Solution (Python):
from sys import stdin


def main():
    X = int(stdin.readline().rstrip())
    max_ = 1
    for a in range(1, X):
        if a ** 2 > X:
            break
        for b in range(2, X):
            if a ** b <= X:
                max_ = max(max_, a ** b)
            else:
                break
    print(max_)


if __name__ == '__main__':
    main()

Solution (Python):
def getinputdata():

    
    array_result = []    
    data = input()
    array_result.append(data.split(" "))

    flg = True

    try:
        while flg:

            data = input()

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = True

            else:

                flg = False
    finally:

        return array_result

arr_data = getinputdata()

x = int(arr_data[0][0])

b = 1
p = 2
maxdata = 1

while b ** p < x:

    chkflg = True

    while chkflg:

        if b ** p <= x:

            if maxdata <= b ** p:
                
                maxdata = b ** p

            b += 1

        else:

            b = 2
            p += 1
            chkflg = False

print(maxdata)

Solution (Python):
import math

x = int(input())

b = 2
max_v = 1
while b < math.sqrt(x):
    p = 1
    while b**p <= x:
        
        max_v = max(max_v, b**p)
        p += 1
    b += 1

print(max_v)

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

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

max = 0
for i in range(0, X):
  for j in range(0, X):
    k = (i+1)**(j+2)
    if k > X:
      break
    if k > max:
      max = k

print(max)

Solution (Python):
X = int(input())
max1 = 1
max2 = 0

for b in range(1, X+1):
    for q in range(2, X+1):
        
            
        if b**q > X:
            break
        
        max1 = b**q
        
    if max1 > max2:
        max2 = max1
        
print(max2)

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

max=1
for i in range(1,X):
    for j in range(2,X):
        if i**j>max and i**j<=X:
            max=i**j
        elif i**j>X:
            break
print(max)

Solution (Python):

X = int(input())


max = 1
if X != 1:
    for b in range(2,X):
        y = 0
        p = 2
        while 1:
            pre_y = y
            y = pow(b,p)
            p += 1
            if y > X:
                if pre_y > max:
                    max = pre_y
                break
print(max)

Solution (Python):
import math


X = int(input())

ans = 1

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

print (ans)

Solution (Python):
X = int(input())
ret = 1
for i in range(2, 32):
    p = 2
    while i ** p <= X:
        ret = max(ret, i ** p)
        p += 1

print(ret)

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

Solution (Python):
X=int(input())
a=[]
for i in range(0,32):
  for j in range(2,11):
    if i**j<=X:
      a.append(i**j)
    else:
      pass
print(max(a))