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



Sample input:
10


Sample output:
9

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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

Submission status: Accepted

Solution code:
#abc097b

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)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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())

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
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))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

#2の2乗から順番に見ていく
#入力を超えたらその時点の値をマックスとして保持
#更新していく
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)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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)]))

Submission status: Accepted

Solution code:
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

Submission status: Accepted

Solution code:
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())

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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

Submission status: Accepted

Solution code:
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])

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# 入力
n = int(input())

# 処理
# i^m (i=1,2,...)を返し続ける関数
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: # 2^mがnを超えた時点で打ち切る
        break

    m += 1

# 出力
print(ans)

Submission status: Accepted

Solution code:
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;

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

# from numpy import array, sum

MAX_DIVIDER = 32 # 32 ** 2 = 1024 > 1000

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding:utf-8 -*-
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)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
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)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
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))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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):
        # print(b**p)
        if(max < b**p <= X):
            max = b**p
print(max)

Submission status: Accepted

Solution code:
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):
        # print(b**p)
        if(max < b**p <= X):
            max = b**p
print(max)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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)]))

Submission status: Accepted

Solution code:
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])

Submission status: Accepted

Solution code:
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_)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#! /usr/bin/env python3

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)

Submission status: Accepted

Solution code:
#! /usr/bin/env python3

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)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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()))

Submission status: Accepted

Solution code:
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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from math import sqrt
X=int(input())
sqrt_X=int(sqrt(X))
ans=1
##最後は含まないので＋１する必要がある
for b in range(1,sqrt_X + 1):
    ##pは2から始めまる
    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)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

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)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

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)

Submission status: Accepted

Solution code:
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

Submission status: Accepted

Solution code:
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():
    # a, b, c, d = [int(a) for a in input().split()]
    res = solve(int(input()))
    print(res)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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:
                # print(f"{b}**{p}={b**p}")
                ls.append(b**p)
                p += 1
            else:
                # print(f"break{b}**{p}={b**p}, m{m}")
                break
        b += 1
    print(max(ls))