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:
import math 
x = int(input())
ans = 0

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

Submission status: Accepted

Solution code:
X=int(input())
ans=1
X_max=int(X**0.5)

for i in range(1,X_max+1):
    for j in range(1,X):
        if i**j <= X:
            ans=max(ans,i**j)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    X = int(input())
    ma = 1
    for b in range(1, X+1):
        for p in range(2, X+5):
            if b**p > X:
                break
            ma = max(ma, b**p)
    print(ma)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
x=int(input())
ans=0
for i in range(1,34):
    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 = 1
for b in range(2, 40):
    p = 2
    while True:
        val = b ** p
        if val > X:
            break
        ans = max(ans, val)
        p += 1

print(ans)

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:
# 2020/02/29
# AtCoder Beginner Contest 097 - B

# Binary Search
def binSearch (tlis, tval):
    lf = 0
    rg = len(tlis)
    while(lf <= rg):
        ct = int((lf + rg) / 2)
        if tlis[ct] < tval:
            lf = ct + 1
        elif tlis[ct] > tval:
            rg = ct - 1
        else:
            return ct
    if tlis[ct] != tval:
        if tlis[ct] < tval:
            return ct
        else:
            return ct - 1
    else:
        return ct

# Input
x = int(input())
pl = list()

pl.append(1)
for i in range(2, 32):
    j = 2
    wkv = i ** j
    while(wkv <= 1000):
        pl.append(wkv)
        j = j + 1
        wkv = i ** j

# Search
pl.sort()
idx = binSearch(pl, x)
ans = pl[idx]

# Output
print(ans)

Submission status: Accepted

Solution code:
X=int(input())

ans=1
for i in range(2,int(X**0.5)+1):
    j = 1
    n = i
    while n*i <= X:
        n *= i
        j += 1
    ans = max(ans, n)

print(ans)

Submission status: Accepted

Solution code:
from itertools import accumulate, permutations, combinations, product, combinations_with_replacement, groupby
from math import floor, ceil, sqrt, factorial, log
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict
from heapq import heappop, heappush, heappushpop
from itertools import product
import sys
stdin = sys.stdin
mod = 10**9 + 7


def ns(): return stdin.readline().rstrip()


def ni(): return int(ns())


def na(): return list(map(int, stdin.readline().split()))


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

Submission status: Accepted

Solution code:
import math
x = int(input())
xmax = int(math.sqrt(1000))
ans = 0
for i in range(1, xmax + 1): #b
    for j in range(2, 11): #p
        tmp = pow(i, j)
        #print(tmp, i, j)
        if tmp <= x:
            ans = max(ans, tmp)
            #print('a')
        else:
            break
print(ans)

Submission status: Accepted

Solution code:
import math
X=int(input())
ans=0
if X==1:
	print(1)
else:
	for i in range(1,X//2):
		for j in range(2,11):
			tmp=i**j
			if tmp<=X:
				ans=max(ans,tmp)
	print(ans)

Submission status: Accepted

Solution code:
def main():
    X=int(input())
    if X==1 or X==2 or X==3:
        print(1)
    else:
        li=[]
        for p in range(2,10):
            for n in range(2,100):
                if n**p<=X:
                    li.append(n**p)
                else:
                    break
        li.sort(reverse=True)
        print(li[0])
if __name__=="__main__":
    main()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
x = int(input())

ans = 1
for i in range(x + 1):
    for j in range(int(pow(x, 0.5)) + 1):
        for k in range(int(pow(x, 0.5)) + 1):
            if i == pow(j, k) and ans < i:
                ans = i
print(ans)

Submission status: Accepted

Solution code:
X = int(input())

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

for i in range(2, 50):
    if i*i<=X:
        p = i*i
        
        while p*i<=X:
            p *= i
        
        ans = max(ans, p)
    else:
        break

print(ans)

Submission status: Accepted

Solution code:
beki = [0] * 1010
beki[1] = 1
for i in range(2, 1001):
        t = i*i
        while t<1001:
                beki[t] = 1
                t *= i
ans = 1
for i in range(int(input())+1):
        if beki[i]: ans = i
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())
if x == 1:
    print(1)
    exit()
l = []
l.append(1)
for i in range(2, x+1):
    j = 2
    while i**j <= x:
        l.append(i**j)
        j += 1
#print(l)
l.sort()
print(l[-1])

Submission status: Accepted

Solution code:
X = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
X = int(input())

ans = 1
for i in range(2,101) :
    for j in range(2,11) :
        bek = i ** j
        if bek <= X :
            ans = max(ans, bek)

print(ans)

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    ans = set()
    for a in range(N+1):
        for b in range(2, 31):
            if a**b > N:
                continue
            ans.add(a**b)
    print(max(ans))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#097_B
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:
import math
x = int(input())
ans = 1
for i in range(2, math.floor(math.sqrt(x)) + 1):
  b = i
  while b*i <= x:
    b *= i
  ans = max(ans, b)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for b in range(1, x):
    power = b * b
    for p in range(2, x):
        if power > x:
            break
        if power > ans:
            ans = power
        power *= b
print(ans)

Submission status: Accepted

Solution code:
x = int(input())
result = [1]
for i in range(2,x):
    c = 1
    while i**(c+1) <= x:
        c += 1
    if c != 1:
        result.append(i**c)
print(max(result))

Submission status: Accepted

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

for x in range(X):
  for y in range(2,int(X**0.5)):
    tmp=x**y
    if tmp>ans and tmp<=X:
      ans = tmp
    elif tmp > X:
      break
print(ans)

Submission status: Accepted

Solution code:
import math
x = int(input())
rooted = math.sqrt(x)
max_num = 1
l = 2
while True:
    i = 2
    if l > rooted:
        break
    while True:
        beki = pow(l,i)
        i += 1
        if beki <= x:
            if beki == x:
                print(x)
                exit()
            else:
                if beki > max_num:
                    max_num = beki
        else:
            l += 1
            break
print(max_num)

Submission status: Accepted

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

#----------
X = int(input().strip())
#----------
candidate=set()
max_num = int( 1000**(1/2) )
for i in range( 1, max_num + 1 ):
    for j in range( 2, max_num + 1 ):
        calc = i**j
        
        if calc <= 1000:
            candidate.add(i**j)

ans=0
for i in candidate:
  if i <= X and ans < i:
    ans = i

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X=int(input())

X_=int(X**0.5)+1

ans=1
for i in range(2,X+1):
    for j in range(2,X_):
        bi=i
        while True:
            if bi%j!=0:
                break
            bi//=j
            if bi==1:
                ans=i

print(ans)

Submission status: Accepted

Solution code:
x = int(input())
y = []
for i in range(1,33):
    for j in range(2,11):
        if i**j <= x:
            y.append(i**j)
print(max(y))

Submission status: Accepted

Solution code:
X = int(input())
res = 0
for b in range(1, 33):
  for p in range(2, 10):
    if b ** p <= X:
      res = max(res, b ** p)
print(res)

Submission status: Accepted

Solution code:
import math


x = int(input())
ans = 1
num = 1
for i in range(2, int(math.sqrt(x) + 1)):
    j = 1
    while i ** j <= x:
        num = i ** j
        j += 1
    ans = max(num, ans)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    x=INT()
    flg=0
    for i in range(x,0,-1):
        for j in range(2,10):
            for k in range(32):
                if k**j==i:
                    flg=1
        if flg==1:
            ct=i
            break
    print(ct)
            
if __name__ == '__main__':
    do()

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())
M = 1
for i in range(1, X):
    for p in range(2, 10):
        if M < i ** p <= X:
            M = i ** p

print(M)

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(c,b**p)
print(c)

Submission status: Accepted

Solution code:
X = int(input())
answer = 1
sq = []
for i in range(2, 32):
    for j in range(2, 11):
        if i**j <= 1000:
            sq.append(i**j)
sq.sort()
for i in range(2, X+1):
    if i in sq:
        answer = i
# print(sq)
print(answer)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X=int(input())
import math
Xroot=math.ceil(math.sqrt(X))
ans=1
for b in range(2,Xroot+1):
  p=2
  while b**p<=X:
    p+=1
  if p!=2 and b**(p-1)>ans:
    ans=b**(p-1)
print(ans)

Submission status: Accepted

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

for b in range(1, 32):
    for p in range(2, 10):
        num = b**p
        if num <= x:
            beki.append(num)

beki = sorted(set(beki), reverse= True)

print(beki[0])

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:
import sys
x = int(input())

ans = 0
for i in reversed(range(1, x + 1)):
    for j in reversed(range(2, x+1)):
        if i % j != 0:
            continue
        w = i // j
        p = 1
        while w % j == 0:
            w //= j
            p += 1
        if w == 1 and p >= 2:
            print(i)
            sys.exit()
print(1)

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs = sys.stdin.buffer.readlines

# mod=10**9+7
# rstrip().decode('utf-8')
# map(int,input().split())
# import numpy as np

def main():
	x=int(input())
	
	s=set()
	
	for i in range(1,40):
		for j in range(2,10):
			a=i**j
			if a<=1000:
				s.add(a)
	
	li=list(s)
	li.sort()
	
	for i in range(x,0,-1):
		if i in li:
			print(i)
			exit(0)
			
	
	
	
if __name__ == "__main__":
	main()

Submission status: Accepted

Solution code:
x = int(input())
ans = 1
y = x**(1/2)
y = int(y)
for i in range(2,y+1):
    j = 1
    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,100):
    for j in range(2,10):
        if i**j > x:
            break
        ans = max(ans,i**j)
print(ans)

Submission status: Accepted

Solution code:
import math
x=int(input())
if x<4:
    print(1)
else:
    buf=0
    while buf==0 and x>1:
        r=int(math.sqrt(x))
        for i in range(2,r+1):
            ans=1
            while ans<x:
                ans*=i
            if ans==x:
                buf=1
                break
        if buf==0:
            x-=1
    print(x)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())
L = []
for i in range(33):
    for j in range(2, 10):
        x = i ** j
        if x <= X:
            L.append(x)

print(max(L))

Submission status: Accepted

Solution code:
x=int(input())
exp=[0]*(x+1)
exp[1]=1
ans=0
for i in range(2,x+1):
    t=i*i
    while t<=x:
        exp[t]=1
        t*=i

for i in range(1,x+1):
    if exp[i]:
        ans=max(i,ans)
print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
x = int(input())
ans = 1
for i in range(2,int(x**1/2) + 1):
    p = 2
    while True:
        if i**p > x: break
        else:
            ans = max(ans,i**p)
            p += 1
print(ans)

Submission status: Accepted

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

for i in range(100):
    for j in range(2,10):
        if i**j <= a:
            l.append(i**j)
print(max(l))

Submission status: Accepted

Solution code:
X = int(input())
ans = 1
for m in range(1,32):
    for k in range(2,11):
        if m**k > X: break
        ans = max(ans, m**k)
print(ans)

Submission status: Accepted

Solution code:
x = int(input())
while 1:
    for b in range(1, x+1):
        for p in range(2, 15):
            if b ** p == x:
                print(x)
                exit()
    x -= 1

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin

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

x = ni()
ans = 0
for i in range(100):
    for j in range(2,11):
        p = i**j
        if p <= x:
            ans = max(ans, p)
        else:
            continue

print(ans)

Submission status: Accepted

Solution code:
import math
X=int(input())
ans=0
N=int(math.sqrt(X))
for i in range (N+1):
	for j in range (10):
		if i**j<=X:
			ans=max(ans,i**j)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from fractions import gcd
# from datetime import date, timedelta
# from heapq import *
import heapq
import math
from collections import defaultdict, Counter, deque
from bisect import *
import itertools
import fractions
import sys
sys.setrecursionlimit(10 ** 7)
MOD = 10 ** 9 + 7
# input = sys.stdin.readline


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


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)

    # divisors.sort()
    return divisors


def factorize(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct


def is_prime(n):
    if n == 1:
        return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True


def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

def modpow(a, n, mod):
    res = 1
    while n > 0:
        if n & 1:
            res = res * a % mod
        a = a * a % mod
        n >>= 1
    return res


def modinv(a, mod):
    return modpow(a, mod - 2, mod)


def cnk(a, b):
    MOD = 10**9+7
    ret = 1
    for i in range(b):
        ret *= (a-i)
        ret %= MOD
        ret = ret * modinv(i+1, MOD) % MOD
    return ret




def main():
    x = int(input())
    ans = x
    l = []
    for b in range(1, 1001):
        for p in range(2,10):
            v = b ** p
            if v > x:
                break

            if x >= v:
                l.append(v)
    l.sort()
    if len(l) != 0:
        print(l[-1])
    else:
        print(1)



            


    




    


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
x = int(input())

ans = 0
for b in range(1, 1001):
    for p in range(2, 1001):
        if b ** p > x:
            break
        ans = max(ans, b ** p)
        
print(ans)

Submission status: Accepted

Solution code:
# 2020/02/15
# AtCoder Beginner Contest 097 - B

# Input
x = int(input())

expolist = list()

# Make list
for i in range(1, 32):
    for j in range(2, 10):
        expo = i ** j
        if expo > x:
            break
        else:
            expolist.append(expo)

# Output
print(max(expolist))

Submission status: Accepted

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

Submission status: Accepted

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

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(ans, i ** j)

print(ans)

Submission status: Accepted

Solution code:
def main():
    X = int(input())
    ans = []
    for b in range(1, 100):
        for p in range(2, 10):
            if b**p <= X:
                ans.append(b**p)
    print(max(ans))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
X = int(input())
res = 0
for b in range(1, 1000):
  for p in range(2, 11):
    if pow(b, p) <= X: res = max(res, pow(b, p))
print(res)

Submission status: Accepted

Solution code:
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')

def main():
    X=I()
    ans = 1
    for b in range(2,X):
        p=2
        while True:
            if b**p<=X:
                ans = max(ans, b**p)
            else:
                break
            p+=1
    print(ans)
    
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
X = int(input())

cand = [1]
for i in range(2, X+1):
    cnt = 0
    x = X
    while x:
        x //= i
        cnt += 1
    if cnt > 2:
        cand.append(i**(cnt-1))
print(max(cand))

Submission status: Accepted

Solution code:
x = int(input())
ans_lis = []
for i in range(1,1000):
    for j in range(2,11):
        if i**j<=x:
            ans_lis.append(i**j)
ans_lis.sort()
print(ans_lis[-1])

Submission status: Accepted

Solution code:
X=int(input())

ans=0
for i in range(1,40):
    for j in range(2,100):
        n=pow(i,j)
        if n>X:
            break
        ans=max(ans,n)
        
print(ans)

Submission status: Accepted

Solution code:
def main():
    limit = int(input())
    answer = 1
    for i in range(2, limit):
        j = 2
        while i ** j <= limit:
            if answer <= i ** j:
                answer = i ** j
            j += 1
    print(answer)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

output = 1
for i in range(1,32):
    for j in range(2, 10):
        p = i ** j
        if p > X:
            break
        if p > output:
            output = p
print(output)

Submission status: Accepted

Solution code:
x = int(input())
expo = [0] * (x + 1)
expo[1] = 1
for i in range(2, x + 1):
    v = i*i
    while v <= x:
        expo[v] = 1
        v *= i
for i in range(x,0,-1):
    if expo[i]:
        print(i)
        quit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import bisect


def main():
    X = int(input())
    result = []
    for i in range(1, 33):
        result += [i ** j for j in range(2, 10)]
    result.sort()
    index = bisect.bisect_right(result, X)

    print(result[index - 1])


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n=int(input())
m=-1
for p in range(2,10):
    for b in range(1,32):
        if b**p<=n:
            m=max(m,b**p)
        else:break
print(m)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# 10

n = int(input())

l = [1] # !

for i in range(1, n+1):
    for j in range(2, int(n**0.5)):
        if n >= i**j:
            l.append(i**j)
print(max(l))

Submission status: Accepted

Solution code:
n = int(input())

l = [1]

for i in range(1, n+1):
    for j in range(2, int(n**0.5)):
        if n >= i**j:
            l.append(i**j)
            #print(l)
print(max(l))

Submission status: Accepted

Solution code:
def resolve():
    x = int(input())
    l = [1]

    for i in range(2, 1001):
        j = 2
        while i ** j <= 1000:
            l.append(i ** j)
            j += 1

    l = [i for i in l if i <= x]
    ans = max(l)
    print(ans)

resolve()

Submission status: Accepted

Solution code:
x = int(input())

pre = 0
arr = []
for b in range(331,):
    for p in range(2,33):
        if b ** p <= x:
            arr.append(b**p)

print(max(arr))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

m = 1

for i in range(1, 32):
    for j in range(2, 10):
        p = pow(i, j)
        if p > x:
            break
        if p > m:
            m = p

print(m)

Submission status: Accepted

Solution code:
x=int(input())
li=[]
for i in range(32):
  for j in range(2,6):
    if pow(i,j)<=x:
      li.append(pow(i,j))
print(max(li))

Submission status: Accepted

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

Submission status: Accepted

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

ans = -1
for i in range(1, int(math.sqrt(n)) + 1):
  j = 2
  while i ** j <= n:
    if i == 1:
      ans = 1
      break
    ans = max(ans, i ** j)
    j += 1
print(ans)

Submission status: Accepted

Solution code:
X = int(input())
ans = 1
i = 2
while i * i <= X:
    j = 1
    maxi = i
    while i ** j <= X:
        maxi = i ** j
        j += 1
    ans = max(ans, maxi)
    i += 1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

sq = int(math.sqrt(X))
m = 1
for b in range(2, sq+1):  # ここで2が1になると1のp乗となり永遠にループが回り続ける
    p = 2
    tmp = b ** p
    while tmp <= X:
        m = max(tmp, m)
        p += 1
        tmp = b ** p
print(m)

Submission status: Accepted

Solution code:
import collections
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
X=int(input())
for i in range(X):
  l=prime_factorize(X-i)
  c=collections.Counter(l)
  m=list(c.values())
  n=collections.Counter(m)
  if len(n)==1 and m[0]!=1:
    print(X-i)
    exit()
print(1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())
lis = []
for i in range(1,100):
    for j in range(2,10):
        lis.append(i**j)
lis.sort()
#print(lis)
for i in range(1001):
    if lis[i+1] == x:
        print(lis[i+1])
        break
    elif lis[i+1] > x:
        print(lis[i])
        break

Submission status: Accepted

Solution code:
x=int(input())

max=-1

for i in range(0,int(x**0.5+1)):
    for j in range(1,int(x**0.5+1)):
        if(i**j <= x and i**j >= max):
            max = i**j

print(max)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())
S = []
for i in range(1,35):
    for j in range(2,11):
        a = i**j
        if a <= X:
            S.append(a)
S.sort(reverse=True)
for e in S:
    if e <= X:
        print(e)
        exit()

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(2, math.ceil(x**0.5)):
    for j in range(1, 12):
        if(maximum < i**j <= x):
            maximum = i**j
            
print(maximum)

Submission status: Accepted

Solution code:
x = int(input())
ans = 1
for i in range(2, x+1):
    tmp = i
    flag = False
    while tmp * i <= x:
        flag = True
        tmp *= i
    if flag:
        ans = max(ans, tmp)

print(ans)

Submission status: Accepted

Solution code:
import math
x=int(input())
ans=1
for i in range(2,math.ceil(x**(0.5))):
  j=2
  tmp = i**j
  while tmp<=x and x!=1:
    ans = max(ans, tmp)
    j+=1
    tmp = i**j
print(ans)

Submission status: Accepted

Solution code:
import math
x=int(input())
if x==1:
  print(1)
  exit()
  
ans = 0
for i in range(2,math.ceil(x**(0.5))):
  j=2
  tmp = i**j
  while tmp<=x:
    ans = max(ans, tmp)
    j+=1
    tmp = i**j
print(ans)

Submission status: Accepted

Solution code:
X = int(input())
b = 1
ans = 0
while(1):
    b += 1
    p = 1
    if (b**2) > X:
        break
    while(1):
        p += 1
        if X < (b**(p+1)) and (b**p) <= X:
            ans = max(ans,b**p)
            break
if X==1:
    print(1)
    exit()
if X==2 or X == 3:
    print(1)
    exit()

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
list=[]
for i in range(32):
	for j in range(2,10):
		ans=i**j
		if ans<=n:
			list.append(ans)
print(max(list))

Submission status: Accepted

Solution code:
import math

X=int(input())
max=0
for i in range(int(math.sqrt(X))):
    num=i+1
    j=0
    while True:
        buf=pow(num,j)
        if buf>max:
            max=buf
        j=j+1
        if (buf==pow(num,j))or(pow(num,j)>X):
            break
print(max)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
l = []
l.append(1)
for i in range(2,40):
  b = i**2
  while b <= 1000:
    l.append(b)
    b*= i
l.sort()

for i in range(len(l)):
  if n < l[i]:
    print(l[i-1])
    exit()
print(1000)

Submission status: Accepted

Solution code:
n=int(input())
ans=int(1)
for i in range(1,n):
    for j in range(2,10):
        if ans<=pow(i,j)<=n:
            ans=pow(i,j)

print(ans)