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

max_num = 0

for i in range(1,N+1):
	for j in range(2,N+2):
		if(i**j <= N):
			if(max_num < i**j):
				max_num = i**j
		else:
			break
			break

print(max_num)

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

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

for i in range(2,x):
    for j in range(2,x):
        if i**j > x :
            break
        else:
            max_num = max([max_num,i**j])


print(max_num)

Solution (Python):
import math
x=int(input())
maxn=1
for i in range(2,11):
    y=i
    v=False
    while True:
        if y*i>x:
            break
        y*=i
        v=True
    if (maxn<y)&v:
        maxn=y

xs=math.floor(x**0.5)**2
if maxn<xs:
    maxn=xs
print(maxn)

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

for b in range(X):
    if b**2 > X:
        break
    for p in range(1, X):
        tmp = b**p
        if tmp <= X:
            exps.add(tmp)
        else:
            break

print(max(exps) if X > 1 else 1)

Solution (Python):
from math import log
x = int(input())
lx = log(x)
ans = 1
for b in range(2, int(x**(1/2))+1):
    h = b
    while h*b <= x:
        h *= b
    if h > ans: ans = h

print(ans)

Solution (Python):
import math

x = int(input())

ans = 1
for b in range(2, int(math.sqrt(x)) + 1):
  for p in range(1, int(math.sqrt(x)) + 1):
    bp = b ** p
    if bp <= x:
      ans = max(bp, ans)
    else:
      break
      
print(ans)

Solution (Python):
from sys import stdin, stdout
a=int(input())
l=[]
for i in range(34):
    l.append(i*i)
    l.append(i**3)
    l.append(i**4)
    l.append(i**5)
    l.append(i**6)
    l.append(i**7)
    l.append(i**8)
    l.append(i**9)
    l.append(i**10)
l.sort()
for i in range(100):
    if l[i]>a:
        print(l[i-1])
        break

Solution (Python):
import math
X=int(input())
x=1
for i in range(X):
    for k in range(2,10):
        if((x<=i**k)&(i**k<=X)):
            x=i**k
print(x)

Solution (Python):
if __name__ == '__main__':
    a = int(input())
    list = []

    for x in range(31, 0, -1):
        for y in range(10, 1, -1):
            if pow(x, y) > a:
                pass
            elif a >= pow(x, y):
                list.append(pow(x, y))

    print(max(list))

Solution (Python):
from math import sqrt, log

X = int(raw_input())

m = 1
for b in range(2, int(sqrt(X))+2):
    for p in range(2, int(log(X, b)) +2):
        if b**p <= X:
            m = max(m, b**p)

print m

Solution (Python):


x=int(raw_input())
r=[]
for i in xrange(1,32):
 for j in xrange(2,32):
  if i**j<=1000:
   r.append(i**j)
r2=[]
for i in xrange(len(r)):
 y=x-r[i]
 if y>=0:
  r2.append(r[i])
print max(r2)

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

ans = 1
flag = False

for b in range(2, X):
    if flag:
        break
    p = 2
    while True:
        if b**p > X:
            if p != 2:
                ans = max(ans, b**(p - 1))
            else:
                flag = True
            break
        p += 1
print(ans)

Solution (Python):
X = int(input())
l = []
for p in range(2, 10):
    b = 1
    while b**p <= X:
        l.append(b**p)
        b += 1
print(max(l))

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

lst = [1]
p=2
for b in range(2, 32):
    for p in range(2, 10):
        if b**p <= X:
            lst.append(b**p)

print(max(lst))

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

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

Solution (Python):
d=[1, 4, 8, 9, 16, 25, 27, 32, 36, 49, 64, 81, 100, 121, 125, 128, 144, 169, 196, 216, 225, 243, 256, 289, 324, 343, 361, 400, 441, 484, 512, 529, 576, 625, 676, 729, 784, 841, 900, 961, 1000]
def f(input):
    h = 1
    for i in d:
        if input >= i:
            h = i
        else:
            print(h)
            return 0
    print(1000)
if __name__=='__main__':
    input=int(input())
    f(input)

Solution (Python):
def main():
    X = int(input())
    for x in reversed(range(1, X + 1)):
        for a in range(1, int(x ** 0.5) + 1):
            for b in range(1, x):
                v = a ** b
                if v > x:
                    break
                if v == x:
                    return x
    return 1

print(main())

Solution (Python):
import numpy as np
n = int(input())

result_list = []
for i in range(1,50,1):
  for j in range(2,10,1):
    if i ** j <= n:
      result_list.append(i**j)
    elif i ** j > n:
      break
      
print(max(result_list))

Solution (Python):


import math
X=int(input())
maxnum=0
p=int(math.log2(X))
for x in range(2,p+1):
    for y in range(int(math.sqrt(X))+1):
        if y**x<=X:
            maxnum=max(maxnum,y**x)
        else:
            break
print(max(1,maxnum))

Solution (Python):
x = int(input())
expo = set([1])
for b in range(2, x+1):
  v = b**2
  while v <= x:
    expo.add(v)
    v *= b
print(max(expo))

Solution (Python):
X = int(input())
expo = [False for i in range(X+1)]

def solve():
    expo[1] = 1
    for b in range(2,X+1):
        v = b*b
        while v <= X:
            expo[v] = True
            v *= b
    for i in range(X,0,-1):
        if expo[i]:
            print(i)
            return


if __name__ == '__main__':
    solve()

Solution (Python):
from math import sqrt

X = int(input())

expo = set([1])

for b in range(2, X + 1):
    v = b**2
    while (v <= X):
        expo.add(v)
        v *= b

print(max(expo))

Solution (Python):
X = int(input())
answer = 0
for b in range(1,X + 1):
    if b == 1 and answer == 0:
        answer = 1
        continue
    for p in range(2,X + 1):
        fact = b ** p
        if fact <= X:
            if fact > answer:
                answer = fact
        else:
            break
print(answer)

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




max = 1

for i in range(2,num):
    beki = 2
    cou = i**beki
    while i**beki <= num:
        beki += 1
    if max < i ** (beki-1):
        if beki > 2:
            max = i ** (beki-1)
print(max)

Solution (Python):
X =int(input())
L = set([1])
for i in range(2,36):
    for j in range(2,11):
        if i**j <=X:
            L.add(i**j)
print(max(L))

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
        if b**p > ans and b**p <= X:
            ans = b**p
print(ans)

Solution (Python):
X = int(input())
ans = 1
t = min(X, 100)
for b in range(1, t):
    for p in range(1, t):
        if b**p > ans and b**p <= X:
            ans = b**p
print(ans)

Solution (Python):
import math

x = int(input())

def func(num, n):
    root = num ** (1/n)
    return round(root) if num == round(root) ** n else root

slv = lambda b, p: math.floor(func(b, p)) ** p
print(max([slv(x, p) for p in range(2, 10)]))

Solution (Python):
X=int(input())
b=True
if X == 1:
	print(1)
else:
	while b:
		for i in range(2,10):
			if round((X ** (1/i)))**i == X:
				print(X)
				b=False
				break
		X =X-1

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**15
mod = 10**9+7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    x = I()
    r = 1
    for i in range(2,x):
        t = i*i
        while t <= x:
            if r < t:
                r = t
            t *= i

    return r



print(main())

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

L = []

for i in range(1, X + 1):
    for j in range(2, 11):
        if i ** j <= X:
            L.append(i ** j)

print(max(sorted(L)))

Solution (Python):
x = int(input())
s = set()
for i in range(1,100):
    for j in range(2,100):
        s.add(i**j)
for a in reversed(range(x+1)):
    if a in s:
        print(a)
        break

Solution (Python):
x = int(input())
s = set([1])
for b in range(32):
    for p in range(2,10):
        if b**p <= x:
            s.add(b**p)
print(sorted(list(s))[-1])

Solution (Python):


n = int(input())



def gen_bekis(m):
    n = 1
    while True:
       yield n ** m
       n += 1

ans = 0
m = 2
while True:
    
    beki_max = 0
    for beki in gen_bekis(m):
        if beki > n:
            break
        beki_max = beki

    if ans < beki_max:
        ans = beki_max
    elif beki_max == 1: 
        break

    m += 1


print(ans)

Solution (Python):
X = int(input())
se = set([1])
for i in range(2,33):
  k = i
  while(k <= 1000):
    k =k*i
    se.add(k)

for i in range(X,0,-1):
  if i in se:
    print(i)
    break;

Solution (Python):





MAX_DIVIDER = 32 

X =int(input())

li = set()

li.add(1)

b = 2
while b < MAX_DIVIDER:
	c = b * b
	while c <= 1000:
		li.add(c)
		c *= b
	b += 1

while X > 0:
	if X in li:
		print(X)
		break
	else:
		X -= 1

Solution (Python):
num = int(input())
li = [1]
for i in range(2,1001):
    for j in range(2,1001):
        if(i**j <= num):
            li.append(i**j)
        else:break
for i in sorted(list(set(li))):
    if(i <= num):
        temp = i
    else:
        break
print(temp)

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

max_e = 1
for b in range(2, X+1):
    p = 2
    e = b ** p
    while e <= X:
        if e > max_e:
            max_e = e
        p += 1
        e = b ** p
print(max_e)

Solution (Python):
N=int(input())
ans=0
for p in range(2,10):
  for b in range(34):
    if b**p<=N:
      ans=max(ans,b**p)
    
print(ans)

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

for k in range(2,10):
    for l in range(35):
        if l**k <= N:
            ans = max(ans,l**k)

print(ans)

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

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

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

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

i = 1
j = 2
T=[1]
while(True):
    i+=1
    j=2
    if i ** 2 > x: 
        break
    while(True):
        t = i ** j
        if t > x:
            T.append(i ** (j-1))
            break
        j+=1

print(max(T))

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

Solution (Python):

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

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

Solution (Python):
exp = [False, True] + [False for i in range(1000-1)]

for i in range(2, 32):
    j = 2
    while(i ** j <= 1000):
        e = i ** j
        exp[e] = True
        j+=1

X = int(input())

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

Solution (Python):
import math
a = [1]
x = int(input())
for p in range(2,10):
	for b in range(2,100):
		a.append(b**p)
a.sort()
t = a[::-1]
for i in t:
	if i <= x:
		print(i)
		exit(0)

Solution (Python):
import math

x = int(input())
if(x == 1):
    print('1')
    exit()

m = 0
for b in range(2, int(math.ceil(math.sqrt(x)))+1):
    p = 2
    while(b ** p <= x):
        p += 1
    if(m < b ** (p-1)):
        m = b ** (p-1)

print(m)

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

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

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

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

r = 1

for i in range(2,int(X ** 0.5) + 1):
    k = 2
    while i ** k <= X:
        r = max(r,i**k)
        k += 1

print(r)

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

Solution (Python):

if __name__ == "__main__":
    x = int(input())
    ans = float('-inf')
    for p in range(1,x+1):
        for b in range(2, x+2):
            if p**b <= x:
                ans = max(ans, p**b)
            else:
                break
    else:
        print(ans)

Solution (Python):
import math

x = int(input())
ans = 0

if x == 1 or x == 2 or x == 3:
	print(1)
else:
	for i in range(2, int(math.sqrt(x)) + 1):
		j = 2
		while i ** j <= x:
			if i ** j > ans:
				ans = i ** j
			j += 1

	print(ans)

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

res=0

for i in range(1,1000):
    for j in range(2,10):
        if res<i**j and i**j<=a:
            res=i**j

print(res)

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

for i in range(1,1000):
  for j in range(2,10):
    if n<i**j and i**j<=a:
      n=i**j
      
print(n)

Solution (Python):
x = int(input())
bp = list()
for b in range(1, x+1):
    for p in range(2, 1000):
        if pow(b, p) > x:
          break
        else:
          bp.append(pow(b, p))


print(max(bp))

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

Solution (Python):

X = int(input())
if X == 1:
    print(1)
else:
    ans = 0
    for b in range(2, int(X**0.5) + 1):
        for p in range(2, 11):
            if b ** p <= X :
                ans = max([ans, b**p])
    print(ans)

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

a = 2
b = 2
ans = 1

while(x >= a**b):
    while(x >= a ** b):
        if(ans < a**b):
            ans = a**b
        a += 1
    b += 1
    a = 2
print(ans)

Solution (Python):
from math import sqrt
x = int(input())
xx = int(sqrt(x)+1)
max = 1
for i in range(1, xx):
    for j in range(1, xx):
        if(max < i**j <= x):
            max = i**j
        elif(x < i**j):
            break
print(max)

Solution (Python):
import math
num = int(raw_input())
num_max = 1
root_num = int(math.sqrt(num)+1)
for i in range (2,root_num):
    count = i**2
    if count <= num:
        while True:
            if count > num:
                break
            else:
                count *= i
        count = count//i
    if count > num_max:
        num_max = count
print num_max

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

res = 1
for b in range(2,1001):
	p = 2
	while True:
		if pow(b,p) <= X:
			res = max(res, pow(b,p))
			p += 1
		else:
			break

print(res)

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
        if b**p > ans :
            ans = b**p
print(ans)

Solution (Python):
def Exponential():
    X = int(input())
    if X<1 or X>1000:
        return ("Oops! X is out of the range!")
    res=[1]
    for b in range(1, X+1):
        for p in range(2, X+1, 1): 
            if b**p <=X:
                res.append(b**p)
            else: break
    print(max(res))
    
Exponential()

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

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

ans = 1

for i in range(2, x):
    for j in range(2, 100):
        if i**j <= x:
            ans = max(ans, i**j)
        else:
            break

print(ans)

Solution (Python):
x=int(input())
a=0
for i in range(300):
    for j in range(2,11):
        if i**j>x: break
        if a<i**j: a=i**j   
print(a)

Solution (Python):

X = int(input())


def exponential(X):
    value = 1
    for n in range(34):
        for p in range(2, 10):
            tmp = n ** p
            if tmp > X:
                break
            else:
                value = max(value, tmp)
    return value


print(exponential(X))

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

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

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

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

def check_exponential_sqrt(x):
    r = math.sqrt(x)
    int_r = int(r)

    if abs(r-int_r) <= 0.0001:
        return 1
    else:
        return 0

def check_exponential(x):
    for b in range(1,int(math.sqrt(x))+1):
        ans = 1
        for p in range(1,x+1):
            if(ans == x):
                return 1
            elif(ans > x):
                break
            ans *= b





for i in reversed(range(1,X+1)):
    if check_exponential(i) == 1:
        print(i)
        break

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

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

Solution (Python):
from math import log, floor
x = int(input())
ans = 1
for b in range(2, x):
    p = floor(log(x,b))
    if p <= 1: continue
    tmp = b**p
    tmp2 = b**(p+1)
    if tmp2 <= x:
        tmp = tmp2
    ans = max(ans, tmp)

print(ans)

Solution (Python):
import numpy as np
import sys
X = int(input())
if X==1:
    print('1')
    sys.exit()
maxnum = 0
for i in range(2,int(np.sqrt(X))+1):
    num = i
    while num <= X:
        num *= i
        if num/i >maxnum:
            maxnum = num/i
print(int(maxnum))

Solution (Python):
import math
X = int(input())
max = 0
bRange = math.floor(math.sqrt(X))
pRange = math.floor(math.log(X,2))
for b in range(bRange + 1):
    for p in range(pRange + 1):
        if(max < b**p <= X):
            max = b**p
print(max)

Solution (Python):
import math
X = int(input())
max = 0
bRange = math.floor(math.sqrt(X))
pRange = math.floor(math.log(X,2))
for b in range(bRange + 1):
    for p in range(pRange + 1):
        
        if(max < b**p <= X):
            max = b**p
print(max)

Solution (Python):
X = int(input())
ans = 1
for n in range(2,32):
    a = n*n
    while a <= X:
        ans = max(ans, a)
        a *= n
print(ans)

Solution (Python):
import math
X = int(input())
max = 0
bRange = math.floor(math.sqrt(X))
pRange = math.floor(math.log(X,2))
for b in range(bRange + 1):
    for p in range(pRange + 1):
        
        if(max < b**p <= X):
            max = b**p
print(max)

Solution (Python):
r=range(1,32);x=input();print max(b**p*(b**p<=x)for p in r[1:]for b in r)

Solution (Python):
from math import sqrt, log
X = int(input())
print(X if X in [243, 1000] else max([1] + [pow(b, int(log(X, b))) for b in range(2, int(sqrt(X))+1)]))

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

expo = [1]

for b in range(2,x):
    v = b*b
    while v <= x:
        expo.append(v)
        v *= b

expo.sort()

print(expo[-1])

Solution (Python):
x = int(input())
a = int(x**(1/2))
max_ = -1

i = 2

while i <= a:
    j = 2
    while i**j <= x:
        if max_ <= i**j:
            max_ = i**j
        j += 1
    i += 1

if max_ < 0:
    print(1)
else:
    print(max_)

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

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

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

Solution (Python):
import math

X=int(input())
ans = 0
if X==1:
    print(X)
    exit()
else:
    
    for b in range(2,int(X**0.5)+1):
        p= int(math.log10(X)/math.log10(b))
        N= b**p
        ans = max(N,ans)

    print(ans)

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

max = 0
for j in range (x, 0, -1):
    for k in range(2, 10):
        if j**k <= x and max < j**k:
            max = j**k

print(max)

Solution (Python):
import math

x =input()
X = int(x)

if X == 1:
    output = 1
    print(output)
else:
    mylist = []
    for i in range(2,X+1):
        bekijo = i
        count = 0
        while bekijo <= X:
            bekijo = bekijo * i
            count = count +1
        if count > 1:
            mylist.append(int(bekijo/i))
    print(max(mylist))

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

Solution (Python):
x=input();ans=1;
for b in range(1,32):
 for p in range(2,32):
  if b**p<=x:ans=max(b**p,ans)
print(ans)

Solution (Python):
import math
n = int(input())
ans = 1
for i in range(2, n+1):
    a = i
    p = 2
    while True:
        b = a ** p
        p += 1
        if b <= n:
            ans = max(ans, b)
        else:
            break

print(ans)

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

if x == 1:
  print(1)
else:
  sol = 1
  for b in range(2, x):
    bp = b * b
    while bp <= x:
      sol = max(sol, bp)
      bp *= b
  print(sol)

Solution (Python):


N = int(input())
ans = 0
for b in range(1, 1000):
    for p in range(2, 1000):
        if b ** p <= N:
            ans = max(ans, b ** p)
        else:
            break
print(ans)

Solution (Python):


N = int(input())
ans = 0
for b in range(1, 100):
    for p in range(2, 100):
        if b ** p <= N : ans = max(ans, b ** p)
print(ans)

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

ans = 1
for i in range(2,int(math.sqrt(X))+1):
    k = i
    while(k*i<=X):k*=i
    if k > ans: ans=k
        
print(ans)

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

Solution (Python):
import math
 
X = int(input())
if X <= 3:
    ans = 1
else:
    b=2
    ans = 4 
    while(b <= math.sqrt(X)):
        p=2
        while(b ** p <= X):
            if b ** p > ans:
                ans = b ** p
            p += 1
        b += 1
print(ans)

Solution (Python):
X = int(input())
i=2
j=2
l = []
if(X<=3):
	print(1)
else:
	while((i**j)<=X):
		while((i**j)<=X):
			l.append(i**j)
			j= j+1
		i= i+1
		j=2
	print(max(l))

Solution (Python):
X=int(input())
ans=1
if X==1:
    print(ans)
else:
    for i in range(2,33):
        for j in range(2,10):
            if i**j>ans and i**j<=X:
                ans=i**j
            elif i**j>X:
                break
    print(ans)

Solution (Python):
X = int(input())
def f():
    yield 1
    for y in range(2, X.bit_length()):
        x = 0
        while (x+1)**y <= X:
            x += 1
        if x**y <= X:
            yield x**y
print(max(f()))

Solution (Python):
ans=[1]
for i in range(2,1000):
  cnt=2
  while i**cnt<=1000:
    ans.append(i**cnt)
    cnt+=1

x=int(input())
ans.sort()
for i in range(len(ans)):
  if ans[i]==x:
    print(ans[i])
    break
  elif ans[i]>x:
    print(ans[i-1])
    break

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

max = 1
temp = 1
for i in range(2,11,1): 
    for j in range(1,33,1):

        temp = j**i
        if temp > 1000:
            break
        elif X >= temp and temp > max:
            max = temp

print(max)

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

Solution (Python):
from math import sqrt

x = int(input())
sqrt_x = int(sqrt(x))

ans = 1

for b in range(1, sqrt_x+1):
    for p in range(2, sqrt_x+1):
        
        exp = (b)**(p)
        
        if exp<=x and ans<=exp:
            ans = exp
        
print(ans)

Solution (Python):
from math import sqrt
X=int(input())
sqrt_X=int(sqrt(X))
ans=1

for b in range(1,sqrt_X + 1):
    
    for p in range(2,sqrt_X+1):
        now_num = b**p
        if now_num <= X and ans <= now_num:
            ans =now_num
print(ans)

Solution (Python):
from math import sqrt
X=int(input())
sqrt_X=int(sqrt(X))
ans=1

for b in range(1,sqrt_X + 1):
    for p in range(2,sqrt_X):
        now_num = b**p
        if now_num <= X and ans <= now_num:
            ans =now_num
print(ans)

Solution (Python):



from math import sqrt
X=int(input())
sqrt_X=int(sqrt(X))
ans=1

for b in range(sqrt_X):
    for p in range(2,sqrt_X):
        now_num = (b+1)**p
        if now_num <= X and ans <= now_num:
            ans =now_num
print(ans)

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

Solution (Python):
from math import sqrt
X=int(input())
sqrt_X=int(sqrt(X))
ans=1

for b in range(sqrt_X):
    for p in range(sqrt_X):
        now_num = (b+1)**(p+2)
        if now_num <= X and ans <= now_num:
            ans =now_num
print(ans)

Solution (Python):
x = int(input())
a = []
for i in range(1,32):
    for j in range(2,11):
        b = i**j
        if b > x:
            break
        a.append(b)
a = list(set(a))
a.sort()

print(a[-1])

Solution (Python):
if __name__ == '__main__':
    x = int(input())
    
    ans = 1
    for b in range(2, x + 1):
        pw = b * b
        while True:
            if pw > x:
                break
            else:
                ans = max(ans, pw)
                pw *= b
    print(ans)

Solution (Python):



from math import sqrt
X=int(input())
sqrt_X=int(sqrt(X))
ans=1

for b in range(sqrt_X):
    for p in range(sqrt_X - 1):
        now_num = (b+1)**(p+2)
        if now_num <= X and ans <= now_num:
            ans =now_num
print(ans)

Solution (Python):
import math

x = int(raw_input())
rmax = 1
lmax = int(math.ceil(math.sqrt(x)))
for j in range(2, lmax):
    for k in range(2, 10 + 1):
        r = j ** k
        if r > x:
            break
        else:
            if r > rmax:
                rmax = r

print rmax

Solution (Python):
ALPHA = "abcdefghijklmnopqrstuvwxyz"
import math


def solve(x):
    b = 1
    for n in range(2, x):
        for k in range(2,12):
            if n ** k > x:
                break
            else:
                u = n**k
                b = max(b, u)
    return b


def main():
    
    res = solve(int(input()))
    print(res)


if __name__ == '__main__':
    main()

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

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

m = 1
for i in range(1, X):
    for j in range(2, X):
        k = i ** j

        if k <= X:
            m = max(k, m)
        else:
            break

print(m)

Solution (Python):
x = int(raw_input())
ans = 0
i = 2
while i*i<=x:
 j = 2
 while i**j<= x:
  if i**j >= ans:
   ans = i**j
  j+=1
 i+=1
print ans if x > 3 else 1

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

Solution (Python):
import sys

X = int(input())
array = []
for i in range(2, 11):
    for j in range(1, 33):
        if pow(j, i) > X:
            break
        else:
            array.append(pow(j, i))
        
print(max(array))

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

m = 0
b = 1
p = 2
ls = []

if x in (1,2,3):
    print(1)
else:
    while b <= x:
        p = 2
        while p <= x:
            if  b**p <= x:
                
                ls.append(b**p)
                p += 1
            else:
                
                break
        b += 1
    print(max(ls))

Solution (Python):

"""
B - Exponential
https://beta.atcoder.jp/contests/abc097/tasks/abc097_b

"""
import sys
from sys import stdin
input = stdin.readline


def solve(X):
    ans = 1
    for i in range(1, X+1):
        for j in range(2, X+1):
            t = i**j
            if t <= X:
                ans = max(ans, t)
            else:
                break
    return ans


def main(args):
    X = int(input())
    ans = solve(X)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

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

maxs = []
for i in range(x):
    max = 0
    for j in range(x):
        if (i+1) ** (j+2) <= x:
            max = (i+1) ** (j+2)
            maxs.append(max)
        else:
            if j == 0:
                max = (i+1) ** (j+2)
                break
    
    


maxs.sort()

print(maxs[-1])

Solution (Python):
x = int(input())
ma = 0
for i in range(33):
    if x  < i ** 2:
        ma = (i-1) ** 2
        break
for i in range(13):
    if x <  i ** 3:
        max([ma,(i-1) ** 3])
        ma = max([ma,(i-1) ** 3])
        break
for i in range(6):
    if x < i ** 5:
        ma = max([ma, (i-1) ** 5])
        break
print(ma)

Solution (Python):
X = int(input())
 
l = [1 for i in range(1001)]
k = 0
for i in range(1,33):
    for j in range(2,10):
        tmp = i ** j
        if tmp <= 1000:
            l[k] = tmp
            k += 1
        else :
            break
 
l.sort()
for i in range(1001):
    if X < l[i]:
        print(l[i-1])
        break
else :
    print(l[-1])

Solution (Python):
import math

x = int(input())
ans = 1

for i in range(int(math.sqrt(x)), 1, -1):
    tans = i
    while tans <= x:
        tans *= i
        if tans == x:
            print(tans)
            exit()
        else:
            continue
    ans = max(ans, tans//i)

print(ans)

Solution (Python):
X = int(input())
 
score = 0
half_x = round(X/2)
 
answer = 0
 
if X <= 3:
    print(1)
 
elif X <= 7:
    print(4)
 
else:
    while 1 < half_x:
        half_x -= 1
        
        for p in range(2, 10):
            
            score = pow(half_x,p)
            if score > X:
                continue
        
            if answer < score:
                answer = score
                
    print(answer)

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

num = list(range(2,32))

ans = 1
for i in range(len(num)):
  now = num[i]
  while now < x:
    now = now*num[i]
    if(now <= x and ans <= now):
      ans = now
print(ans)

Solution (Python):
x = int(input())
if x == 1:
  print(x)
else:
  L = [n**k for n in range(1, x//2) for k in range(2, 10) if n**k<=x]
  print (max(L))

Solution (Python):
X = int(input())
 
score =0
half_x = round(X/2)
 
answer = 0
 
if X < 3:
    print(1)
 
elif X <= 7:
    print(4)
 
else:
    while 1 < half_x:
        half_x -= 1
        
        for p in range(2, 10):
            
            score = pow(half_x,p)
            if score > X:
                continue
        
            if answer < score:
                answer = score
                
    print(answer)

Solution (Python):
import math
x=int(input())
log_x=int(math.log(x,2))
cand=[0 for i in range(1001)]
cand[0]=1
for i in range(2,1000):
    cand[i]=int(pow(x,1.0/i))**i
cand[1000]=1000
print(max(cand[:x+1]))