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

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
#from math import gcd
import bisect
from collections import defaultdict
from collections import deque
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]

######OUTPUT######
def Yes(): print("Yes"); return
def No(): print("No"); return

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])
    return arr

#####MakeDivisors######
def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors

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

#####BitCount#####
def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count

#####ChangeBase#####
def Base_10_to_n(X, n):
  if (int(X/n)):
    return Base_10_to_n(int(X/n), n)+[X%n]
  return [X%n]


#############
# Main Code #
#############

N = inputI()
if N < 4:
  print(1)
  exit()

M = 0
for i in range(2,N+1):
  f = factorization(i)
  shisuu = [q for p,q in f]
  m = min(shisuu)
  if m != 1:
    r = [i%m for i in shisuu]
    if sum(r) == 0:
      M = i
    
print(M)

Submission status: Accepted

Solution code:
a = set()
for i in range(1, 35):
    for j in range(2, 10):
        a.add(i ** j)
b = []
for i in a:
    if i <= 1000:
        b.append(i)
# print(sorted(b))
b.sort(reverse=True)
x = int(input())
for i in b:
    if i <= x:
        print(i)
        break

Submission status: Accepted

Solution code:
import sys, re
from math import ceil, floor, sqrt, pi, factorial#, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left
from functools import reduce
# input = sys.stdin.readline 
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_list(N): return [s_list() for _ in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    n = i_input()

    max_num = 0
    for i in range(1,n+1):
        for j in range(2,int(sqrt(n+1))):
            tmp = pow(i, j)
            if tmp <= n:
                max_num = max(max_num, tmp)
        
    print(max_num if max_num != 0 else 1)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
X = int(input())

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

ans = 1
for x in range(2,X-1):
    for p in range(2,X-1):
        if(x**p > X): break
        ans = max(ans, x**p)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x=int(input())
saidai=0
beki=0

for i in range(1,x+1):
    for j in range(2,int(10)):
        if x>=i**j>saidai:
            saidai=i**j
            #print(i,j)
        if saidai>x:
            break
    if saidai>x:
        break
print(saidai)

Submission status: Accepted

Solution code:
def resolve():
	x = int(input())
	ans = 0
	for i in range(1, 100):
		for j in range(2, 11):
			v = i**j
			if x >= v:
				ans = max(ans, v)
	print(ans)
resolve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#import numpy as np
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
pri = lambda x: print(*x, sep='\n')

X = int(input())

res = 1
for i in range(2, X):
    if X < i:
        break
    for j in range(2, 10):
        val = pow(i, j)
        if X < val:
            break
        if res < val:
            res = val
print(res)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# B. Exponential
# https://atcoder.jp/contests/abc097/tasks/abc097_b

x = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
from math import floor

x = int(input())

ans = 1
for i in range(2, floor(x ** 0.5) + 1):
    temp = i ** 2
    while temp * i <= x:
        temp *= i
    if temp > ans:
        ans = temp
print(ans)

Submission status: Accepted

Solution code:
x = int(input())
lst = [i**2 for i in range(1,32)]+[8,27,125,216,343,512,1000]+[32,243]+[128]+[1001]
lst.sort()
for i in range(len(lst)):
    if lst[i]<=x<lst[i+1]:
        print(lst[i])

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    
    X=int(input())
    ans=0
    for i in range(1,int(1000*0.5)):
        for j in range(2,15):
            if i**j<=X:
                ans=max(ans,i**j)
    print(ans)    
resolve()

Submission status: Accepted

Solution code:
x = int(input())

lis = []
for n in range(32):
    for e in range(2,11):
        if n**e <= x:
            lis.append(n**e)
se = set(lis)
print(max(se))

Submission status: Accepted

Solution code:
a = int(input())
m = 1
for i in range(a//2+1):
    for j in range(1,10):
        if a>=i**j and m <i**j:
            m = i**j
        if a < i**j:
            break
print(m)

Submission status: Accepted

Solution code:
nums = []

for i in range(1,100):
    for j in range(2,100):
        nums.append(pow(i,j))
    
nums.sort(reverse=True)

X = int(input())

for i in nums:
    if i <= X:
        print(i)
        break

Submission status: Accepted

Solution code:
from bisect import bisect_right

expo = sorted(list(set([b**p for b in range(1, int(1000**0.5)+1) for p in range(2, 10) if b**p <= 1000])))
X = int(input())

print(expo[bisect_right(expo, X)-1])

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
X = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
X = int(input())

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

ans = 1
for b in range(1, 32):
    for p in range(2, 10):
        if b**p <= x:
            ans = max(ans, b**p)

print(ans)

Submission status: Accepted

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

x = int(input())
ans = 1

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
ans=1
x=int(input())
for i in range(1,101):
  for j in range(2,11):
    m=i**j
    if x>=m:ans=max(ans,m)
print(ans)

Submission status: Accepted

Solution code:
X=int(input())
a=[1]

for i in range(32):
    for j in range(2,10):
        if i**j > X:
            break
        a.append(i**j)

print(max(a))

Submission status: Accepted

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

for i in range(32):
    for j in range(2,10):
        if i**j<= 1000:
            a.append(i**j)
            continue
        break

for i in sorted(list(set(a)))[::-1]:
    if i <= X:
        print(i)
        break

Submission status: Accepted

Solution code:
import sys
import math
import bisect

def main():
    A = []
    for i in range(1, 33):
        for j in range(2, 11):
            val = i ** j
            if val <= 1200:
                A.append(val)
            else:
                break
    A.sort()
    x = int(input())
    p = bisect.bisect_right(A, x)
    print(A[p-1])


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
a = int(input())
mx = 1

for i in range(2,a):
    j=2
    while i**j <= a:
        mx = max(i**j,mx)
        j+=1

print(mx)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np
whole = np.array(list({i**j for i in range(1, 32) for j in range(2, 32) if i**j <= 1000}))
whole.sort()

X = int(input())

print(whole[np.where(whole<=X)].max())

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
def main():
    X = int(input())
    ans = 0
    for i in range(1,X+1):
        for j in range(2,X+2):
            if i**j <= X:
                ans = max(ans, i**j)
            else:
                break
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math
x = int(input())
for i in range(x,0,-1):
    if math.sqrt(i)%1 == 0  or (math.ceil(i ** (1/3)))**3 == i or (math.ceil(i ** (1/5)))**5 == i:
        print(i)
        break

Submission status: Accepted

Solution code:
x = int(input())
p = []
for i in range(2, 1000):
    for j in range(2, int(i ** 0.5) + 1):
        if i / j % 1 == 0:
            break
    else:
        p.append(i)

for i in range(x):
    X = x - i
    L = []
    while X > 1:
        for j in p:
            if X / j % 1 == 0:
                L.append(j)
                X /= j
                break
            else:
                continue
    cnt = 0
    L_ = sorted(set(L))
    if len(L) > 1 and len(L_) == 1:
        print(x - i)
        exit()
    for k in range(len(L_)):
        if k == 0:
            cnt = L.count(L_[k])
            continue
        else:
            if L.count(L_[k]) == cnt:
                continue
            else:
                break
    else:
        if cnt != 1:
            print(x - i)
            break
        else:
            continue

Submission status: Accepted

Solution code:
from bisect import bisect_right
exps = [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]
print(exps[bisect_right(exps, int(input())) - 1])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


X = INT()

ans = 1

for b in range(1, X+1):
	for p in range(2, 10):
		if b**p <= X:
			ans = max(ans, b**p)

print(ans)

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


X = INT()

ans = 1

for i in range(int(X**0.5)+1):
	for p in range(2, 10):
		if i** p <= X:
			ans = max(ans, i**p)

print(ans)

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


X = INT()
X += 0.1
 
ans = 1
for i in range(2, 10):
	if int(X**(1/i)) <= 1:
		break
	else:
		ans = max(ans, int(X**(1/i))**i)
 
print(ans)

Submission status: Accepted

Solution code:
import math

X = int(input())

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

for i in reversed(range(1, X+1)):
    for j in range(2, int(math.sqrt(i))+1):
        if abs(math.log(i, j) - round(math.log(i, j))) <= 0.0000001:
            print(i)
            exit()
    if i == 1:
        print(1)

Submission status: Accepted

Solution code:
A= int(input())
B=set([1])
for i in range(2,32):
	C = i
	while C*i <= 1000:
		C*=i
		B.add(C)
for i in reversed(range(1,A+1)):
	if i in B:
		print(i)
		exit()

Submission status: Accepted

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

ans = 1


def cal(a, b): return a ** b


a = int(math.sqrt(X))

for i in range(a, 2, -1):
    b = 2
    tmp = cal(i, b)
    while (tmp <= X):
        tmp = cal(i, b)
        if tmp <= X:
            ans = max(ans, tmp)
            b += 1
        else:
            b += 1
print(ans)

Submission status: Accepted

Solution code:
X = int(input())
ans = 1
for i in range(2,1000):
    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())
ans=0
for i in range(2,10):
    for j in range(1,1001):
        tmp=j**i
        if tmp <=x:
            ans=max(tmp,ans)
print(ans)

Submission status: Accepted

Solution code:
#print#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**9)
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))
#%%code
from collections import Counter
def resolve():
    X=int(input())
    if X<4 :print(1);return
    ans=0
    for i in range(2,X):
        temp=i**2
        if temp<=X:
            while(1):
                if temp*i>X:
                    ans=max(ans,temp)
                    #print(ans,i)
                    break
                temp*=i
    print(ans)

#%%submit!
resolve()

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())
kouho = {1}
for i in range(2,32):
    p = i**2
    while p <= x:
        kouho.add(p)
        p *= i
print(max(kouho))

Submission status: Accepted

Solution code:
x=int(input())
c=1
if x<=3:
  print(c)
else:
  for i in range(2,min(32,x)):
    j=2
    while i**j<=x:
      c=max(c,i**j)
      j=j+1
  print(c)

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline


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

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

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
x = int(input())

ans = 1
for i in range(2, int(x**0.5)+1):
  p = 0
  while i**p <= x:
    if i**p > ans:
      ans = i**p
    p += 1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    x=int(input())
    ans=0
    # 制約1<=x<=1000以下があるから、
    # i**jを考えるとき、iのmaxは33*33=961の33でjのmaxは2**9=512の9で
    for i in range(1,34):
        if i>x:
            break
        for j in range(2,10):
            y=i**j
            if y<x:
                ans=max(y,ans)
            elif y==x:
                ans=max(y,ans)
                break
            else:
                break
    print(ans)
resolve()

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    x=int(input())
    ans=0
    for i in range(1,33):
        if i>x:
            break
        for j in range(2,11):
            y=i**j
            if y<x:
                ans=max(y,ans)
            elif y==x:
                ans=max(y,ans)
                break
            else:
                break
    print(ans)
resolve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())
a = []

for i in range(1,33):
    for j in range(2,9):
        tmp = i**j
        if tmp <= x:
            a.append(tmp)

print(max(a))

Submission status: Accepted

Solution code:
import sys
import math
x = int(input())
li = [1]
for i in range(2,32):
    tmp = 2
    while (i ** tmp <= 1000):
        li.append(i ** tmp)
        tmp += 1
for i in range(x, 0, -1):
    if (i in li):
        print(i)
        sys.exit()

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    x=int(input())
    ans=0
    for i in range(1,33):
        for j in range(2,11):
            y=i**j
            if y<x:
                ans=max(y,ans)
            elif y==x:
                ans=max(y,ans)
                break
            else:
                break
    print(ans)
resolve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    x=int(input())
    l=[]
    for i in range(1,33):
        for j in range(2,11):
            y=i**j
            if y<x:
                l.append(y)
            elif y==x:
                l.append(y)
                break
            else:
                break
    print(max(l))
resolve()

Submission status: Accepted

Solution code:
X = int(input())

num_list = []
for i in range(1, int(1000**0.5)+1):
    for j in range(2, 11):
        if i**j <= 1000:
            num_list.append(i**j)

for num in sorted(num_list, reverse=True):
    if num <= X:
        print(num)
        break

Submission status: Accepted

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

def it():
  for i in range(2, X):
    x = i*i
    if x > X: return 0
    
    while x*i <= X:
      x *= i
    yield x
  
print(max(it()))

Submission status: Accepted

Solution code:
X = int(input())

ans = 0
for x in range(1,X+1):
  for i in range(2,11):
    t = x**i
    if t > X:
      break
    if ans < t:
      ans = t
print(ans)

Submission status: Accepted

Solution code:
X = int(input())
N = [1]
j = 2

while True:
  i = 2
  flag = False
  while True:
    n = i ** j
    if n <= X:
      N.append(n)
      flag = True
      i += 1
    else:
      break
  if flag:
    j += 1
  else:
    break
print(max(N))

Submission status: Accepted

Solution code:
X = int(input())

ans = 0
for b in range(1, 1001):
    for p in range(2, 10):
        if pow(b, p) <= X:
            ans = max(ans, pow(b, p))
print(ans)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
x = int(input())
a = [1,4,8,16,32,64,128,256,512,9,27,81,243,729,
     25,125,625,36,216,49,343,100,1000,121,144,
     169,196,225,289,324,361,400,441,484,529,576,
     676,784,841,900,961]
b =[]
for num in a:
  if x >= num:
    b.append(num)
print(max(b))

Submission status: Accepted

Solution code:
# region header
import sys
import math
from bisect import bisect_left, bisect_right, insort_left, insort_right
from collections import defaultdict, deque, Counter
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from heapq import heappop, heappush
from itertools import accumulate, groupby, product, permutations, combinations, combinations_with_replacement
from math import ceil, floor, factorial, log, sqrt, sin, cos
from operator import itemgetter
from string import ascii_lowercase, ascii_uppercase, digits
sys.setrecursionlimit(10**7)
rs = lambda: sys.stdin.readline().rstrip()
ri = lambda: int(rs())
rf = lambda: float(rs())
rs_ = lambda: [_ for _ in rs().split()]
ri_ = lambda: [int(_) for _ in rs().split()]
rf_ = lambda: [float(_) for _ in rs().split()]
INF = float('inf')
MOD = 10 ** 9 + 7
PI = math.pi
# endregion
X = ri()
ans = 0
for b in range(1, 1001):
    for p in range(2, 11):
        tmp = b ** p
        if tmp <= X:
            ans = max(ans, tmp)
print(ans)

Submission status: Accepted

Solution code:
x = int(input())
max_pow = []
for i in range(2, int(x**0.5) + 1):
    j = 2
    while i**j <= x:
        j += 1
    max_pow.append(i**(j - 1))
print(1 if x == 1 else max(max_pow))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())
ma = 0
for b in range(1, int(X ** 0.5) + 1):
    n = b
    while 1 < n * b <= X:
        n *= b
    ma = max(ma, n)
print(ma)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X=int(input())
a=2
temp=1
ans=1
l=[]
if X==1:
    print(1)
    exit()
else:
    for i in range(2,41):
        for j in range(2,11):
            if i**j<=X:
                l.append(i**j)
print(max(l))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())
fact = [1]
for i in range(2, 40):
  cnt = 1
  p = i
  while(p <= 1000):
    if(cnt >= 2):
      fact.append(p)
    p = p*i
    cnt += 1
fact.sort()
ans = 0
for n in fact:
  if(n <= X):
    ans = n
  else:
    break
print(ans)

Submission status: Accepted

Solution code:
import math
x = int(input())
root = int(math.sqrt(x))
m = 1
for i in range(2, root+1):
    for j in range(2, root+1):
        if m < i**j and i**j <= x:
            m = i**j

print(m)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X=int(input())
ans=0
for i in range(1,33):
    for j in range(2,11):
        now=i**j
        if ans<now and now<=X:
            ans=now

print(ans)

Submission status: Accepted

Solution code:
import math

def Next(): return input()
def NextInt(): return int(Next())
def NextInts(): return map(int,input().split())
def Nexts(): return map(str,input().split())
def NextIntList(): return list(map(int,input().split()))
def RowInts(n): return [input() for i in range(n)]


n = int(input())
ju = [False for i in range(1001)]
ju[1] = True
for i in range(2,32):
  now = i**2
  while(now <= 1000):
    ju[now] = True
    now *= i
for i in range(n,0,-1):
  if(ju[i]):
    print(i)
    break

Submission status: Accepted

Solution code:
x = int(input())
ans = 1
for b in range(1, int(1000**.5)+1):
    for p in range(2, 10):
        y = b**p
        if y <= x and ans < y:
            ans = y
print(ans)

Submission status: Accepted

Solution code:
from math import sqrt
x = int(input())
l = []
for i in range(1, x + 1):
    for j in range(1, int(sqrt(i)) +1):
        for k in range(2, 10):
            if j ** k == i:
                l.append(i)
print(max(l))

Submission status: Accepted

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