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())
temp=0
ans=0
for i in range(33):
    for j in range(2,1001):
        if i**j<=x:
            if temp<i**j:
                temp = i ** j
                
        else:
            break
print(temp)

Submission status: Accepted

Solution code:
x = int(input())
import math 
ans = 1

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

print(ans)

Submission status: Accepted

Solution code:
x=int(input())
l=[]
for i in range(2,10):
    for j in range(1,32):
        a=j**i
        if a<=x:l.append(a)
        else:break
print(max(l))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())
ans = 1
for b in range(2, x + 1):
    power = b * b
    for p in range(2, x + 1):
        if power > x:
            break
        ans = max(ans, power)
        power *= b

print(ans)

Submission status: Accepted

Solution code:
import math

n = int(input())

best_num = 1

for i in range(1, int(math.sqrt(n))+1):
  for j in range(1, 10):
    if i**j <= n and best_num < i**j:
      best_num = i**j

print(best_num)

Submission status: Accepted

Solution code:
import math

x = int(input())

x_sqrt = int(math.sqrt(x))

ans = 1
for i in range(2, x_sqrt + 1):
    j = 1
    while i ** j <= x:
        ans = max(i ** j, ans)
        j += 1

print(ans)

Submission status: Accepted

Solution code:
import math
from bisect import  bisect_right

X = int(input())

s = list([1])

for i in range(2,math.ceil(1000**0.5)):
    for j in range(2,9):
        if i**j > 1000:
            break
        else:
            s.append(i**j)

s.sort()
print(s[bisect_right(s,X) -1])

Submission status: Accepted

Solution code:
x = int(input())
ans = 0
while True:
    i = 2
    while i < 11:
#        print(round(x**(1/i),1),round((x**(1/i)),8))
        if round(x**(1/i),1)==round((x**(1/i)),8):
            ans = x
            break
        i += 1
    if ans != 0:
        break
    x -= 1
#    print(x)
print(ans)

Submission status: Accepted

Solution code:
Y=[0]*1001
Y[1]=1
for i in range(2,34):
  for j in range(2,10):
    if i**j<=1000:
      Y[i**j]=i**j
#print(Y)

for i in range(1,1001):
  if Y[i]==0:
    Y[i]=Y[i-1]
print(Y[int(input())])

Submission status: Accepted

Solution code:
x = int(input())
if x < 4:
  print(1)
  exit()
import math
result = 1
for i in range(2,x+1):
  if math.floor(math.log(x,i)+1/100000) > 1:
    result = max(result, i ** math.floor(math.log(x,i)+1/100000))
  
print(result)

Submission status: Accepted

Solution code:
n = int(input())
lis = [i**j for i in range(1, 32) for j in range(2, 10) if i**j <= n]
lis = list(set(lis))
lis.sort()
print(lis[-1])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X=int(input())
a=0
for i in range(40):
  for j in range(2,20):
    if i**j<=X:
      a=max(a,i**j)
print(a)

Submission status: Accepted

Solution code:
x=int(input())
ans=1
for b in range(2,11):
  for p in range(2,34):
    if p**b<=x:
      ans=max(p**b,ans)
print(ans)

Submission status: Accepted

Solution code:
import sys
from collections import defaultdict
sys.setrecursionlimit(200000)
input = sys.stdin.readline

N, = map(int, input().split())

ans = 1

for i in range(2, N):
    c = 2
    if i ** c <= N:
        while (i ** c) <= N:
            c += 1
    else:
        continue
    ans = max(ans, i ** (c - 1))

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input().strip())
ans = 1
for i in range(2, int(X**0.5)+1):
  now = i
  while True:
    now *= i
    if now > X: break
    ans = max(ans, now)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from math import sqrt
X = int(input())
ans = 1
for i in range(2, int(sqrt(X))+1):
    j = 2
    while i**j <= X:
        ans = max(ans, i**j)
        j += 1
print(ans)

Submission status: Accepted

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

ans = 0
for b in range(1, X+1):
    for p in range(2, X+1):
        pow = b ** p
        if pow <= X:
            ans = max(ans, pow)
        else:
            break
print(ans)

Submission status: Accepted

Solution code:
X = int(input()); res = 1
for i in range(X):
  for j in range(2, 11):
    if i ** (j + 1) > X and i ** j <= X:
      res = max(res, i ** j)
      break
print(res)

Submission status: Accepted

Solution code:
# ABC097B - Exponential
def main():
    X = int(input())
    cand = [1]
    for i in range(2, int(X ** 0.5) + 1):
        p = 2
        while i ** p <= X:
            cand.append(i ** p)
            p += 1
    ans = max(cand)
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
# ABC097B - Exponential
def main():
    X = int(input())
    cand = {1}
    for i in range(2, int(X ** 0.5) + 1):
        p = 2
        while i ** p <= X:
            cand.add(i ** p)
            p += 1
    ans = max(cand)
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
x = int(input())
l = []
for b in range(1,x+1):
    for p in range(2,11):
        if b**p <= x:
            l += [b**p]
print(max(l))
# print(l)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
x = 1
for i in range(1,n):
    for j in range(2,n):
        k=i**j
        if k<=n:
            x=max(x,k)
        else:
            break

print(x)

Submission status: Accepted

Solution code:
x = int(input())
Powers = [1]
for i in range(2,32):
  k = i**2
  while k<=1000:
    Powers += [k]
    k *= i
Powers.sort(reverse = True)
for power in Powers:
  if power <= x:
    print(power)
    break

Submission status: Accepted

Solution code:
x = int(input())

res = 1
for b in range(2, x):
    if b**2 > x:
        break
    i = 2
    while b**(i + 1) <= x:
        i += 1
    if i > 1:
        res = max(res, b**i)
print(res)

Submission status: Accepted

Solution code:
import sys
from functools import reduce
import copy
import math


sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    X = int(inputs[0])
    max = 1
    for x in range(1, X + 1):
        for y in range(2, X + 1):
            c = x ** y
            if c <= X:
                max = c if c > max else max
            else:
                break
    return max


def string_to_int(string):
    return list(map(int, string.split()))


if __name__ == "__main__":
    ret = solve(inputs(1))
    print(ret)

Submission status: Accepted

Solution code:
import math

def sol(ans, i):
  for j in range(2,1001):
    tmp_ans = math.pow(i,j)
    if tmp_ans > X: return ans
    elif ans < tmp_ans: ans = tmp_ans
  return ans

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

ans = -1 * float('inf')
for i in range(1,1001):
  ans = sol(ans,i)
print(int(ans))

Submission status: Accepted

Solution code:
x = int(input())
ans = 1

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

Submission status: Accepted

Solution code:
X=int(input())
a=0
for i in range(40):
    for j in range(2,20):
        if i**j<=X:
            a=max(a,i**j)
print(a)

Submission status: Accepted

Solution code:
# ABC097b
import sys
import math
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)

x = int(input())

ans = 0
for b in range(1, x + 1):
    for p in range(2, math.floor(math.sqrt(x))+2):
        tmp = b ** p
        # print(tmp)
        if (tmp <= x):
            ans = max(ans, tmp)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
    
x=int(input())

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

Submission status: Accepted

Solution code:
x = int(input())
soFar = 1
for i in range(1, x):
    for j in range(2, x):
        current = i ** j
        if current <= x:
            soFar = max(soFar, current)
        else:
            break
print(soFar)

Submission status: Accepted

Solution code:
# B - Exponential
X = int(input())

for i in range(X,0,-1):
    for b in range(1,X+1):
        for q in range(2,10):
            if i == b**q:
                print(i)
                exit()
            else:
                pass

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())
xMax = 0
for i in range(2, 10):
    for j in range(32):
        if j ** i > x:
            break
        if xMax < j ** i:
            xMax = j ** i

print(xMax)

Submission status: Accepted

Solution code:
# ABC097 B  Exponential
x = int(input())
ans = 0

for i in range(1,33):
    for j in range(2,10):
        t = i**j
        if t <= x:
            ans = max(t,ans)
print(ans)

Submission status: Accepted

Solution code:
x = int(input())
n = [1]
for i in range(2, x):
  c = 2
  while True:
    if i**c > x:
      break
    n.append(i**c)
    c += 1
print(max(n))

Submission status: Accepted

Solution code:
X = int(input())
ans = []

for i in range(1, 34):
    for j in range(2, 10):
        if i ** j <= X:
            ans.append(i ** j)
        else:
            break

for i in sorted(ans, reverse=True):
    if i <= X:
        print(i)
        exit()
    else:
        continue

Submission status: Accepted

Solution code:
X = int(input())
A = [1]
a = 2
while a**2 <= 1000:
    tmp = a**2
    while tmp <= 1000:
        A.append(tmp)
        tmp *= a
    a += 1
A = sorted(A)
A
for i in range(len(A)):
    if A[i] > X:
        break
if X == 1000:
    print(1000)
else:
    print(A[i-1])

Submission status: Accepted

Solution code:
n = int(input())
ans = 1
for b in range(n):
    for p in range(2, 64):
        a = b**p
        if a <= n:
            ans = max(ans, a)
        else:
            break
print(ans)

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 6)


def main():
    x=int(input())
    if x==1:
        print(1)
        exit()
    ans=0
    b=32
    for p in range(2,11):
        while b**p>x:
            b-=1
            if b==1:
                print(ans)
                exit()
        ans=max(ans,b**p)

main()

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 6)


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

main()

Submission status: Accepted

Solution code:
x=int(input())
beki=[0,1]
for i in range(2,1001):
    tmp=i
    while(1):
        tmp*=i
        if tmp<=1000:
            beki.append(tmp)
        else:
            break
beki.sort()
for i in range(len(beki)):
    if beki[i]<=x:
        ans=beki[i]
print(ans)

Submission status: Accepted

Solution code:
x = int(input())
ans = 1
for i in range(1, 100):
    for j in range(2, 100):
        if i ** j <= x and i ** j > ans:
            ans = i ** j
print(ans)

Submission status: Accepted

Solution code:
import math
import sys
x = int(input())
for i in range(x,0,-1):
    for j in range(x,0,-1):
        for k in range(10,1,-1):
            if i == j**k:
                print(i)
                sys.exit()

Submission status: Accepted

Solution code:
L = [1]
for b in range(2,32):
  for p in range(2,10):
    n = int(b**p)
    if n not in L and n <= 1000:
      L.append(n)
L = sorted(L)
X = int(input())
s = sum(x<=X for x in L)
print(L[s-1])

Submission status: Accepted

Solution code:
#インポート
import sys

#入力用
def ILI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def ISI(): return map(int, sys.stdin.readline().rstrip().split())
def II(): return int(sys.stdin.readline().rstrip())
def ISS(): return sys.stdin.readline().rstrip().split()
def IS(): return sys.stdin.readline().rstrip()

N = II()
max = 0
val = 0
if N != 1:
    for i in range(2, N+1):
        p = 2
        while val < N:
            if i ** p <= N:
                val = i ** p
                p += 1
            else:
                break
            if max < val:
                max = val
else:
    max = 1
print(max)

Submission status: Accepted

Solution code:
x = int(input())

import math
ans = 1
for i in range(2, math.ceil(math.sqrt(x)) + 1):
    tmp = i
    while tmp <= x:
        tmp *= i
    ans = max(ans, tmp // i)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x=int(input())
L=[]
for p in range(2,10):
    for b in range(1,32):
        l=b**p
        L.append(l)
R=[i for i in L if i<=x]
print(max(R))

Submission status: Accepted

Solution code:
x = int(input())
b = 1
for i in range(1,x):
    for a in range(2,x):
        if i**a <= x:b = max(b,i**a)
        elif i**a > x: break
print(b)

Submission status: Accepted

Solution code:
X=int(input())
mx=1
if X==1:
    print(1)
    exit()
for i in range(2,int(X**0.5)+1):
    p=2
    while i**p<=X:
        temp=i**p
        mx=max(temp,mx)
        p+=1

print(mx)

Submission status: Accepted

Solution code:
x = int(input())
ans = 1
for i in range(1, x):
    for j in range(2, x):
        tmp = pow(i, j)
        if tmp <= x:
            ans = max(ans, tmp)
        else:
            break
print(ans)

Submission status: Accepted

Solution code:
x = int(input())
res = 1

for i in range(2, x):
  num = i * i
  while num <= x:
    res = max(res, num)
    num *= i
    
print(res)

Submission status: Accepted

Solution code:
import sys
import math
from fractions import gcd
# import queue
# from collections import Counter
# from itertools import accumulate
# from functools import reduce

def lcm(a, b):
    return a * b // gcd(a, b)

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

big_prime = 1000000007

"""
# 標準入力取得
## 文字列
 =  sys.stdin.readline().rstrip()
 =  list(sys.stdin.readline().rstrip())

## 数値
 =  int(sys.stdin.readline())
 =  map(int, sys.stdin.readline().split())
 =  list(map(int, sys.stdin.readline().split()))
 =  [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""

N =  int(sys.stdin.readline())

ans = 0
for i in range(1, 40):
    for j in range(2, 10):
        tmp = i ** j
        if tmp <= N:
            ans = max(tmp, ans)
print(ans)

Submission status: Accepted

Solution code:
s = set()
s |= { i*i for i in range(1, 33) }
s |= { i*i*i for i in range(1, 11) }
s |= { i*i*i*i*i for i in range(1, 5) }
s |= { i*i*i*i*i*i*i for i in range(1, 5) }
#print(sorted(s))
X = int(input())
r = max(filter(lambda i: i <= X, s))
print(r)

Submission status: Accepted

Solution code:
x = int(input())

ans = 1
for b in range(2, 32):
    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())
l = [1]

for i in range(2,32):
  for j in range(2,10):
    if i**j <= 1000:
      l.append(i**j)
      
l = sorted(l,reverse = True)

for k in sorted(list(range(1,x+1)),reverse = True):
  if k in l:
    print(k)
    exit()

Submission status: Accepted

Solution code:
import sys
from collections import deque
from collections import  Counter
import statistics
import math

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

x = ni()
li = []
for b in range(1, 34):
    for p in range(2, 34):
        num = b ** p
        if num <= 1000:
            li.append(num)
list.sort(li, reverse=True)
for i in range(len(li)):
    if x >= li[i]:
        print(li[i])
        break

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

Solution code:
import itertools
x = int(input())
score = 0

for b,p in itertools.product(range(1,33),range(2,10)):
    if b**p<=x: score = max(score, b**p)

print(score)

Submission status: Accepted

Solution code:
X = int(input())
m = 1
for i in range(1, 33):
    for j in range(2, 11):
        if i**j <= X and i**j > m:
            m = i**j
print(m)

Submission status: Accepted

Solution code:
X = int(input())
ans = 0
for i in range(1,100):
    for j in range(2,100):
        if i**j <= X:
            ans = max(i**j,ans)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x=int(input())

import math

#y=math.log(1000, 1)

res=[1]

for i in range(2,33):
	for j in range(2,10):
		y=i**j
		if y<=x:
			res.append(y)

print(max(res))

Submission status: Accepted

Solution code:
X = int(input())

ans = 1
for b in range(1, X+1):
    for p in range(2, 10): # 10はある程度大きい数で良い(2^10=1024)
        if b**p <= X and b**p > ans:
            ans = b**p

print(ans)

Submission status: Accepted

Solution code:
from math import sqrt
x=int(input())
c=1
for b in range(1,int(sqrt(x))+1):
  for p in range(2,10):
    if b**p<=x:
      c=max(b**p,c)
    else:
      break
print(c)

Submission status: Accepted

Solution code:
from math import sqrt
x=int(input())
c=1
for b in range(1,int(sqrt(x))+1):
  for p in range(2,x):
    if b**p<=x:
      c=max(b**p,c)
    else:
      break
print(c)

Submission status: Accepted

Solution code:
def main():
    import sys
    input = sys.stdin.readline
    x = int(input().rstrip('\n'))
    mp = 0
    for i in range(int(x ** 0.5) + 1):
        for j in range(int(x ** 0.5) + 1):
            p = pow(i, j)
            if p <= x:
                mp = max(p, mp)
    print(mp)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x=int(input())
import math
p=math.ceil(x**0.5)
ans=[1]
for i in range(2,p+1):
  j=2
  while True:
    if i**j<=x:
      ans.append(i**j)
    else:
      break
    j+=1
print(max(ans))

Submission status: Accepted

Solution code:
X = int(input())
ans = 1
for b in range(2, 40):
  for p in range(2, 11):
    if pow(b, p) <= X: ans = max(ans, pow(b, p))
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())
ans = 0
for i in range(33):
    for j in range(2,10):
        po = i ** j
        if po <= x:
            ans = max(ans,po)
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 n>=i**j:
      ans=max(ans,i**j)
print(ans)

Submission status: Accepted

Solution code:
x = int(input())
bp = 0
for i in range(x):
    for j in range(9):
        if((i+1)**(j+2)<=x):
            bp = max(bp,(i+1)**(j+2))
print(bp)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x=int(input())
ans=1
for b in range(1,x):
  for p in range(2,x):
    if x-b**p>=0:
      ans=max(ans,b**p)
    else:
      break
print(ans)

Submission status: Accepted

Solution code:
def resolve():
    x = int(input())
    ans = [1]
    for b in range(2, x + 1):
        p = 2
        while b ** p <= x:
            bp = b ** p
            ans.append(bp)
            p += 1
    print(max(ans))


if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
import math
def main():
    X = int(input())
    max_p = 1
    if X < 4: return max_p

    for p in range(2, int(math.sqrt(X))+1):
        q = p * p
        while q <= X:
            max_p = max(max_p, q)
            q *= p
    return max_p


if __name__ == '__main__':
    print(main())

Submission status: Accepted

Solution code:
x=int(input())
a=0
b=0
c=1
for i in range(100):
    for j in range(2,100):
        if i**j<=x:
            a=i**j
        else:
            b=a
            break
    if b>=c:
        c=b
print(c)

Submission status: Accepted

Solution code:
box=[0]*1001
for i in range(2,int(1000**0.5)+1):
    count=i
    point=2
    while 1000>count:
        try:
            count=i
            count=count**point
            box[count]=1
            point +=1
        except:break
box[1]=1
target=[]
for i in range(len(box)):
    if box[i]==1:target.append(i)

x=int(input())
if x==1000:print(x);exit()
ans=0
for i in target:
    if x>=i:ans=i
    else:print(ans);break

Submission status: Accepted

Solution code:
X = int(input())
arr = []

for i in range(1, X+2):
    for j in range(2, X+2):
        exp = i ** j
        if exp > X:
            break
        arr.append(exp)
        
arr.sort()
arr.reverse()
print(arr[0])

Submission status: Accepted

Solution code:
X = int(input())
a = 1
for i in range(1,X):
    for j in range(2,X):
        if i**j <= X:
            a = max(a,i**j)
        else:
            break

print(a)

Submission status: Accepted

Solution code:
x = int(input())
ans = 1
import math
for i in range(2,math.floor(math.sqrt(x))+1):
    b = i ** 2
    while b <= x:
        ans = max(b,ans)
        b *= i
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

X = int(input())

ans = 0
for b in range(1, 41):
    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())
li=[]
for i in range(1,1000):
    for j in range(2,11):
        if i**j<=x:
            li.append(i**j)
li=set(li)
li=sorted(list(li))

print(max(li))

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:
            ans = max(ans,i**j)
        else:
            break
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

max_beki = 1

for i in range(2,36):
    p = 2
    while True:
        if i ** p <= X:
            max_beki = max(max_beki, i ** p)
            p += 1
        else:
            break
print(max_beki)

Submission status: Accepted

Solution code:
X = int(input())
cans = [b**p for b in range(1,32) for p in range(2,10) if b**p <= X]
print(max(cans))

Submission status: Accepted

Solution code:
x=int(input())
a=1
for b in range(2,x):
    for p in range(2,x):
        t=b**p
        if t<=a:
            continue
        if x<t:
            break
        a=t
print(a)

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(x+1)[::-1]:
    for j in range(int(math.sqrt(1000))+1)[::-1]:
        for k in range(2,10):
            if i == j**k:
                print(i)
                exit()

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
c = 1
a = int(input())
for i in range(1, int(a ** 0.5) + 1):
  for j in range(2, int(a/ 2)):
    if i ** j <= a:
      c = max(c, i**j)
print(c)

Submission status: Accepted

Solution code:
X=int(input())

list=[]
if X==1:
    list.append(1)
for i in range(1,X):
    for j in range(2,X):
        if i**j <= X:
                list.append(i**j)
        else:
            break
print(max(list))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
n=int(input())
ans=1
for i in range(2,int(math.sqrt(n))+1):
  x=1
  while(x<n+1):
    x=i*x
  ans=max(ans,x//i)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
#n,m = map(int,input().split())
x = int(input())

prime_list = []
if x!=1:
    for i in range(2,int(math.sqrt(x))+1):
        j = 2
        while i**j<=x:
            prime_list.append(i**j)
            j+=1

    print(max(prime_list))
else:
    print(1)

Submission status: Accepted

Solution code:
x = int(input())
ans = 1
for i in range(1,36):
    for j in range(2,1001):
        if i**j<=x: ans = max(ans,i**j)
print(ans)

Submission status: Accepted

Solution code:
X = int(input())
a = 2
res = 1
while True:
  b = 2
  if a > 33:
    break
  while True:
    t = a ** b
    if t <= X:
      res = max(res, t)
      b += 1
    else:
      break
  a += 1

print(res)

Submission status: Accepted

Solution code:
x = int(input())
max_num = 0

for i in range(33):
    for j in range(2, 11):
        if i**j > x:
            break
        elif i**j >= max_num:
            max_num = i**j

print(max_num)

Submission status: Accepted

Solution code:
x=int(input())
n=set([1])
for i in range(2, int(x**0.5)+1):
  y=i**2
  while y<=x:
    n.add(y)
    y*=i
print(max(n))

Submission status: Accepted

Solution code:
import numpy as np

X = int(input())

def beki(num):
  for j in range(1, num+1):
    for k in range(2, 10):
      if j ** k == num:
        return True
  return False


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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from math import sqrt
n = int(input())
m = int(sqrt(n))
li = list(range(m + 1))
#0と1は考えない
for i in range(2, m + 1):
    while li[i] <= n:
        li[i] *= i
    li[i] = int(li[i] / i)
print(max(li))

Submission status: Accepted

Solution code:
n = int(input())
ans = 1
for i in range(2, 10):
    j = 1
    while ((j + 1)**i <= n):
        j += 1
        ans = max(ans, j ** i)
print(ans)

Submission status: Accepted

Solution code:
x = int(input())
ans = 1
for i in range(1, 32):
    for j in range(2, 12):
        num = i**j
        if num <= x:
            ans = max(num, ans)
print(ans)

Submission status: Accepted

Solution code:
import math
x=int(input())
if x<4:
    print(1)
else:
    k=0
    for i in range(int(math.sqrt(x))-1):
        l=0
        for j in range(x):
            if (i+2)**j>x:
                break
            else:
                l=(i+2)**j
        if l>k:
            k=l
    print(k)

Submission status: Accepted

Solution code:
X = int(input())

ans = []
for i in range(1,X+1):
  for j in range(2,11):
    n = i ** j
    if (n <= X):
      ans.append(n)
print(max(ans))

Submission status: Accepted

Solution code:
x = int(input())

print(max([n**e for n in range(1,32) for e in range(2,11) if n**e <= x]))

Submission status: Accepted

Solution code:
X = int(input())

maxX = 0
for i in range(1, 33):
    for j in range(2, 33):
        ij = i**j
        if ij > X:
            break
        maxX = max(maxX, ij)

print(maxX)

Submission status: Accepted

Solution code:
x = int(input())
ans = []
for b in range(1, 1000):
    for p in range(2, 10):
        tmp = b**p
        if tmp <= x:
            ans.append(tmp)
        else:
            break
print(max(*ans))

Submission status: Accepted

Solution code:
x = int(input())
ans = []
for b in range(1, 1000):
    for p in range(2, 1000):
        tmp = b**p
        if tmp <= x:
            ans.append(tmp)
        else:
            break
print(max(*ans))

Submission status: Accepted

Solution code:
import sys
input=sys.stdin.readline

x = int(input())

ans = 1
for b in range(1,x+1):
    for p in range(2,11):
        m = b**p
        if m <= x:
            ans = max(ans, m)
print(ans)

Submission status: Accepted

Solution code:
x = int(input())
ans = 1
for i in range(1, 32):
    for j in range(2, 10):
        p = pow(i, j)
        if p > x:
            break
        if p > ans:
            ans = p
print(ans)

Submission status: Accepted

Solution code:
import math

X=int(input())
max_num=math.ceil(math.sqrt(X))
if max_num**2>X:
    max_num-=1

num=max_num**2

for i in range(2,num):
    for j in range(3,X):
        p=i**j
        if p<=X and p>num:
            num=p
        elif p>X:
            break
        elif p==X:
            print(X)
            exit()

print(num)