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: Wrong Answer

Solution code:
import math
x = int(input())
print(int(math.sqrt(x))**2)

Submission status: Wrong Answer

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

# AtCoder Beginner Contest
# Problem B

if __name__ == '__main__':
    x = int(input())

    from math import sqrt

    print(int(sqrt(x)) ** 2)

Submission status: Wrong Answer

Solution code:
X = int(input())

for i in range(35):
    e = i * i
    if X < e:
        print((i-1)*(i-1))
        break

Submission status: Wrong Answer

Solution code:
import math
n=int(input())
#a,b,c,d=map(int,input().split())
k=pow(n,0.5)
ans=0
for i in range(math.floor(k)+1):
	for j in range(2,n):
		if(i*j<=n):
			ans=i*j
print(ans)

Submission status: Wrong Answer

Solution code:
x = int(input())
import math
y = int(math.sqrt(x)) - 1
for i in range(y,y+2):
    if i ** 2 <= x and (i + 1)** 2 > x:
        print(i ** 2)

Submission status: Wrong Answer

Solution code:
n = int(input())
x = int(n**(1/2))
i = x
while(x*i <= n):
  i += 1
print(x*(i-1))

Submission status: Wrong Answer

Solution code:
X = int(input())

m = 0
for b in range(1, 100):
    for p in range(2, 20):
        val = b ** p
        if val > 1000:
            continue
        if m < val < X:
            m = val
        # print(val)

print(m)

Submission status: Wrong Answer

Solution code:
ansList = [x**2 for x in range(1,32)]

X = int(input())
temp = 0
for l in ansList:
    if(X > l):
        temp = l

print(temp)

Submission status: Wrong Answer

Solution code:
X = int(input())

for i in range(35):
    e = i * i
    if X <= e:
        print((i-1)*(i-1))
        break

Submission status: Wrong Answer

Solution code:
#coding: utf-8
import math

x = int(input())

maxcount = int(math.sqrt(x))
print(maxcount * maxcount)

Submission status: Wrong Answer

Solution code:
X = int(input())
a = [i**2 for i in range(32)]
max = 0
for i in a:
    if i <= X:
        max = i
print(max)

Submission status: Wrong Answer

Solution code:
from math import sqrt
x = int(input())
print((int(sqrt(x)))**2)

Submission status: Wrong Answer

Solution code:
x=int(input())
i=1
ans=1
while i**2 <=x:
   ans=i**2
   i+=1
print(ans)

Submission status: Wrong Answer

Solution code:
def check(n):
    m = 2
    dic = {}
    while n > 1:
        if n%m == 0:
            while n%m == 0:
                if m in dic:
                    dic[m] += 1
                else:
                    dic[m] = 1
                n //= m
        m += 1
    lis = []
    for i in dic.values():
        lis.append(i)
    if len(lis) == 1 and lis[0] != 1:
        return True
    else:
        return False
x = int(input())
if x == 1:
    print(1)
    quit()
for i in range(x+1):
    if check(x-i):
        print(x-i)
        quit()

Submission status: Wrong Answer

Solution code:
X = int(input())

m = 0
for b in range(1, 100):
    for p in range(2, 10):
        val = b ** p
        if val > 1000:
            continue
        if m < val < X:
            m = val
        # print(val)

print(m)

Submission status: Wrong Answer

Solution code:
import math
X = int(input())
maximumList = []
#1^10 = 1、2^10 = 1024だから、pは最大でも9

for i in range(2, 10):
   maximumList.append((math.floor(X**(1/i)))**i)
print(max(maximumList))

Submission status: Wrong Answer

Solution code:
import sys
import math
if __name__ == "__main__":
    X = int(input())
    buf = int(math.sqrt(X))
    buf = pow(buf, 2)
    print(buf)

Submission status: Wrong Answer

Solution code:
x = int(input())

for i in range(32):
    if i*i <= x:
        ans = i*i
print(ans)

Submission status: Wrong Answer

Solution code:
import sys

stdin = sys.stdin

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

x = ni()
max = 1

for i in range(1, x+1):
    if i**2 <= x:
        max = i**2
print(max)

Submission status: Wrong Answer

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

    beki = [1,]
    for i in range(2,35):
        for j in range(2,10):
            if i**j<= 1000:
                beki.append(i**j)
    beki.sort()
    for i in range(len(beki)):
        if beki[i]>X:
            return beki[i-1]


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

Submission status: Wrong Answer

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

for i in range(1,32):
    for j in range(2,9):
        l.append(i ** j)
        
l = list(sorted(set(l)))
c = 1        
for i in range(len(l)):
    if l[i] <= x <= l[i+1]:
        c = l[i]
        break
print(c)

Submission status: Wrong Answer

Solution code:
x = int(input())
max = 0
for i in range(1000):
    if i**2 <= x:
        max = i**2
print(max)

Submission status: Wrong Answer

Solution code:
X = int(input())
i = 1
while i**2 <= X:
    i += 1
if i != 1:
    print((i-1)**2)
else:
    print(1)

Submission status: Wrong Answer

Solution code:
X=int(input())
for I in range(1,X+1):
	if pow(I,2)<=X:
		C=pow(I,2)
	else:
		break
print(C)

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

Solution code:
import math

X = int(input())

sqrt_x = int(math.sqrt(X))

print(sqrt_x * sqrt_x)

Submission status: Wrong Answer

Solution code:
X = int(input())

max_beki = 0
i = 0
while i * i <= X:
    beki = i * i
    if beki > max_beki:
        max_beki = beki
    i += 1

print(max_beki)

Submission status: Wrong Answer

Solution code:
X = int(input())
for i in range(40):
  if i*i > X:
    a = i-1
    break
ans = a*a
print(ans)

Submission status: Wrong Answer

Solution code:
x = int(input())
flag = False
while True:
    if flag:
        break
    for i in range(x):
        for j in range(x):
            if i ** j == x:
                print(i ** j)
                flag = True
                break
            if i ** j > x:
                break
    x -= 1

Submission status: Wrong Answer

Solution code:
import sys
X = int(input())
for i in range(X+1):
    if i**2 > X:
        print((i-1)**2)
        sys.exit()
    elif i**2 == X:
        print(i**2)
        sys.exit()

Submission status: Wrong Answer

Solution code:
x=int(input())
i=1
ans=0
while i**2 <=x:
   ans=i**2
   i+=1
print(ans)

Submission status: Wrong Answer

Solution code:
import math
x=int(input())
root_x=int(math.sqrt(x))
print(x*x)

Submission status: Wrong Answer

Solution code:
import math
X = int(input())
Y = int(math.sqrt(X))
print(Y*Y)

Submission status: Wrong Answer

Solution code:
import math

X = int(input())

print(int(math.sqrt(X)) **2)

Submission status: Wrong Answer

Solution code:
n = int(input())
i = 0
if n == 1:
  print(1)
else:
  for i in range(1, n+1):
    if i**2 > n:
      print((i-1)**2)
      break

Submission status: Wrong Answer

Solution code:
import math
X = int(input())
print(math.floor(math.sqrt(X))**2)

Submission status: Wrong Answer

Solution code:
n = int(input())
x = int(n**(1/2))
print(x*x)

Submission status: Wrong Answer

Solution code:
from math import sqrt, floor, ceil


X = int(input())

max_beki = 0
for i in range(floor(sqrt(X)) + 1):
    beki = i * i
    if beki > max_beki:
        max_beki = beki

print(max_beki)

Submission status: Wrong Answer

Solution code:
x = int(input())
c = 1
while True:
    if(c ** 2 > x):
        print((c - 1) ** 2)
        break
    else:
        c += 1

Submission status: Wrong Answer

Solution code:
X = int(input())

i = 1
while i **2 <= X:
    i += 1

print((i - 1) ** 2)

Submission status: Wrong Answer

Solution code:
import math
n=int(input())
#a,b,c,d=map(int,input().split())
k=pow(n,0.5)
ans=0
for i in range(math.floor(k)+1):
	ans=i*i
print(ans)

Submission status: Wrong Answer

Solution code:
X = int(input())
Ans = 1
for i in range(X+1):
    if int(i**.5)**2==i:
        Ans = i
print(Ans)

Submission status: Wrong Answer

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

for i in range(X, 0, -1):
    tmp = int(math.sqrt(i))
    if tmp*tmp == i:
        print(tmp)
        break

Submission status: Time Limit Exceeded

Solution code:
a=int(input())
d=0
for i in range(33):
  b=i
  while b<a:
    b=b*i
  c=b/i
  if d>c:
    d=c
print(d)

Submission status: Time Limit Exceeded

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)
print(c)

Submission status: Time Limit Exceeded

Solution code:
import math
X = int(input())
def expo(x):
    ans = 1
    for i in reversed(range(1,x+1)):
        for j in range(int(math.sqrt(x))+1):
            for k in range(2,x+1):
                if i == j**k:
                    ans = i
                    return ans
    return ans
print(expo(X))

Submission status: Time Limit Exceeded

Solution code:
X=int(input())
res=[]
for b in range(1,1000):
  for p in range(2,1000):
    if b**p<=X :
      res.append(b**p)
print(res[-1])

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
while True:
    for i in range(n):
        for j in range(2, 10):
            if n == i**j:
                print(n)
                exit()
    n -= 1

Submission status: Time Limit Exceeded

Solution code:
x = int(input())
ans = []
if x == 1:
    print(1)
    exit()

for i in range(1, x + 1):
    for j in range(2, 101):
        for k in range(2, 101):
            number = j ** k
            if number == i:
                ans.append(i)
print(max(ans))

Submission status: Time Limit Exceeded

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

for b in range(1,x+1):
  for q in range(2,x+2):
    a = b**q
    if a <=x:
      c.append(a)

C = set(c)
print(max(C))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
x = int(input())

if x == 1:
    print("1")
    exit()


def func(p):
    q = p
    while q < x:
        q *= p
        if q == x:
            return q
            break

    if q / p == p:
        return 1
    else:
        return q / p


z = []
a = 1

while a <= x:
    z.append(func(a))
    a += 1

print(max(z))

Submission status: Time Limit Exceeded

Solution code:
x = int(input())


def func(p):
    q = 1
    while q <= x:
        q *= p
    return q / p


z = []
a = 1
y = x ** 0.5

while a <= y:
    z.append(func(a))
    a += 1

print(max(z))

Submission status: Time Limit Exceeded

Solution code:
x = int(input())


def func(p):
    q = 1
    while q <= x:
        q *= p
    return q / p


z = []
a = 1

while a <= x:
    z.append(func(a))
    a += 1

print(max(z))

Submission status: Time Limit Exceeded

Solution code:
x = int(input())

b = 1
p = 2

a = []

for i in range(x):
    for j in range(x):
        if (b+i) ** (p+j) <= x:
            a.append((b+i) ** (p+j))

print(max(a))

Submission status: Time Limit Exceeded

Solution code:
X=int(input())
ans=1
for i in range(1000):
  for n in range(1000):
    if i**n<=X:
      ans=i**n
print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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)
print(c)

Submission status: Time Limit Exceeded

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)
print(c)

Submission status: Time Limit Exceeded

Solution code:
def pow(x, n):
    if n == 0:
        return 1
    value = pow(x, int(n / 2))
    value *= value
    if n % 2 == 1:
        value *= x
    return value


x = int(input())
li = [False] * (x + 1)
li[1] = True

for i in range(x):
    for j in range(2, x):
        idx = pow(i, j)
        if idx < x + 1:
            li[idx] = True

for i in reversed(range(x + 1)):
    if li[i]:
        print(i)
        break

Submission status: Time Limit Exceeded

Solution code:
x = int(input())
li = [False] * (x + 1)
li[1] = True

for i in range(x):
    for j in range(2, x):
        idx = i ** j
        if idx < x + 1:
            li[idx] = True

for i in reversed(range(x + 1)):
    if li[i]:
        print(i)
        break

Submission status: Time Limit Exceeded

Solution code:
x = int(input())
li = [False] * (x + 1)
li[1] = True

for i in range(x):
    for j in range(2, x):
        if i ** j < x + 1:
            li[i ** j] = True

for i in reversed(range(x + 1)):
    if li[i]:
        print(i)
        break

Submission status: Time Limit Exceeded

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)
print(c)

Submission status: Time Limit Exceeded

Solution code:
from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations # (string,3) 3回
from collections import deque
from collections import defaultdict
import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    x = int(input())
    ma_ = 1
    for i in range(1,x):
        for j in range(2,x):
            if i**j <= x:
                ma_ = max(ma_,i**j)
    print(ma_)
if __name__ == '__main__':
  main()

Submission status: Time Limit Exceeded

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

for i in range(1, 1001):
  for j in range(2, 1001):
    num = i ** j
    if num < X:
      break
    ans = num

print(ans)

Submission status: Time Limit Exceeded

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

for i in range(1, 1001):
  for j in range(2, 1001):
    num = i ** j
    if num >= ans and num <= X:
      ans = num

print(ans)

Submission status: Time Limit Exceeded

Solution code:
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
#from itertools import combinations # (string,3) 3回
#from collections import deque
#import collections.defaultdict
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    x = int(input())
    # なんとか^2じゃない
    a = 1
    for i in range(1,x):
        for j in range(2,x):
            if i**j <= x:
                a = max(a,i**j)
    print(a)
if __name__ == '__main__':
  main()

Submission status: Time Limit Exceeded

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)
print(c)

Submission status: Time Limit Exceeded

Solution code:
import math
def main():
    X = int(input())
    ma = 1
    for b in range(2, X):
        for p in range(2, X):
            if b**p <= X:
                if ma < b**p:
                    ma = b**p
    print(ma)  
main()

Submission status: Time Limit Exceeded

Solution code:
x = int(input())
vis = [False for _ in range(1001)]
for i in range(1,1001):
  tmp = i
  while (tmp < 1001):
    vis[tmp] = True
    tmp *= i
best = 0
for i in range(x+1):
  if vis[i] and i > best:
    best = i
print(i)

Submission status: Time Limit Exceeded

Solution code:
x=int(input())

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

Submission status: Time Limit Exceeded

Solution code:
def Exponential(x):

    ans = 0
    if x == 1:
        ans = 1
    else:
        for i in range(1, x + 1):
            for w in range(2, x + 1):
                if i ** w <= x:
                    ans = max(ans, i ** w)

    return ans

def main():
    x = int(input())
    print(Exponential(x))

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
X = int(input())

def han(X):
  i = 1
  while 1:
    i += 1
    if X**(1/i) == int(X**(1/i)):
      return True
    if X**(1/i) < 1:
      return False
    
while 1:
  if X == 1000:
    print(X)
    break  
  elif han(X):
    print(X)
    break
  X -= 1

Submission status: Time Limit Exceeded

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)
            
print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
x = int(input())
ans = 0
for a in range(1,1000):
  for b in range(1,1000):
    if a**b <= 1000:
      ans = max(ans,a**b)
print(ans)

Submission status: Time Limit Exceeded

Solution code:
X = int(input())

ans = []
for i in range(1000):
    for j in range(1000):
        if i**j > X:
            continue
        ans.append(i**j)
print(max(ans))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import numpy as np
X = int(input())
ans = 1
for b in range(int(np.ceil(np.sqrt(X)))):
    p = 0
    while b**p <= X:
        p += 1
    p -= 1
    ans = max(ans, b**p)
print(ans)

Submission status: Time Limit Exceeded

Solution code:
x = int(input())

ans = 0

for i in range(1, 51):

 tmp = i

 while tmp * i < x + 1:

  tmp = tmp * i

  ans = max(ans, tmp)

print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
m = 1

for i in range(1, 34):
  count = 2
  
  while i ** count <= n:
    m = max(m, i**count)
    count += 1
print(m)

Submission status: Time Limit Exceeded

Solution code:
x=int(input())
i=0
a=[]
while x>=i**2:
    i+=1
    a.append((i-1)**2)
    j=0
    while x>=i**j:
        j+=1
        a.append((i-1)**j)
print(max(a))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
import math
n = math.floor(N**0.5)
P = []
for i in range(2,n+1):
    J = 1
    for j in range(len(P)):
        if i % P[j] != 0:
            J = 0
            break
    if J == 1:
        P.append(i)
A = [1]
for i in range(len(P)):
    p = P[i]
    x = 1
    j = 1
    while x**j <= N :
        if x**j <= N:
            A.append(x**j)
            j += 1
ans = max(A)
print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
import math
n = math.floor(N**0.5)
P = []
for i in range(2,n+1):
    J = 1
    for j in range(len(P)):
        if i % P[j] != 0:
            J = 0
            break
    if J == 1:
        P.append(i)
A = [1]
for i in range(len(P)):
    p = P[i]
    x = 1
    j = 1
    while x**j <= N :
        if x**j <= N:
            A.append(x**j)
ans = max(A)
print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
X = int(input())

max_v = 1

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

Submission status: Time Limit Exceeded

Solution code:
X = int(input())
a = 0
for i in range(1,X+1):
    for l in range(2,1000):
        if i**l <= X and i**l > a:
            a = i**l
print(a)

Submission status: Time Limit Exceeded

Solution code:
import sys
X = int(input())
res = 0
for b in range(1, X+1):
    for p in range(2, X+2):
        val = b**p
        if (val <= X) and (val > res):
            res = val
print(res)

Submission status: Time Limit Exceeded

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)
print(c)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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)
print(ans)

Submission status: Time Limit Exceeded

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

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

print(res)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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)
print(max(list))

Submission status: Time Limit Exceeded

Solution code:
X = int(input())

max_ = 0

for i in range(X):
  power=1
  while i**(power+1)<=X:
    power+=1
  if i**power>max:
    max=i**power
    
print(max_)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
ans = 0
for j in range(1,10000):
    for k in range(1,10000):
        if N > j ** k:
            if ans < j ** k:
                ans = j ** k
 
print(ans)

Submission status: Time Limit Exceeded

Solution code:
X = int(input())
beki = set()
beki.add(1)

for i in range(2, X + 1):
    for j in range(2, X+1):
        if i ** j <= X:
            beki.add(i**j)
print(max(beki))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
num = 2
idx = 1
nums = [1]
while True:
  if num**idx > N:
    if idx == 2 or num ==1:
      break
    else:
      num += 1
      idx = 0
      continue
  else:
    nums.append(num**idx)
    idx += 1
nums.sort(key=lambda x:-x)
print(nums[0])

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
num = 2
idx = 1
nums = [1]
while True:
  if num**idx > N:
    if idx == 2:
      break
    else:
      num += 1
      idx = 0
      continue
  else:
    nums.append(num**idx)
    idx += 1
nums.sort(key=lambda x:-x)
print(nums[0])

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
num = 2
idx = 1
nums = []
while True:
  if num**idx > N:
    if idx == 2:
      break
    else:
      num += 1
      idx = 0
      continue
  else:
    nums.append(num**idx)
    idx += 1
nums.sort(key=lambda x:-x)
print(nums[0])

Submission status: Time Limit Exceeded

Solution code:
X = int(input())
ans = [1]
if X == 1 or X == 2:
	print(1)
else:
	for i in range(2, X + 1):
		num = i
		count = 1
		while num ** i <= X:
			count += 1
			ans.append(num ** i)
	print(max(ans))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
if n<=3:
  print(1)
else:
  ans=4
  for i in range(2,int(n**(1/2)+1)):
    e=2
    while i**e<=n:
      if i**e>ans:
        ans=i**e
        e+=1
  print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
ans = 0
for i in range(1,1001):
    for j in range(1,1001):
        if ans < i**j < n:
            ans = i**j
print(ans)

Submission status: Time Limit Exceeded

Solution code:
X = int(input())
x = int(X**0.5)
num = []
for b in range(1,x+1) :
    p = 2
    while b**p <= X :
        p += 1
    num.append(b**(p-1))
print(max(num))

Submission status: Time Limit Exceeded

Solution code:
X = int(input())

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

print(ans)

Submission status: Time Limit Exceeded

Solution code:
X = int(input())
lists = []
max = 1
for i in range(1,X+1):
    for j in range(2,X+1):
        if i**j <= X:
            if max < i**j:
                max = i**j
print(max)

Submission status: Time Limit Exceeded

Solution code:
X = int(input())
ans = []
i = 1
while (int((X ** (1 / i)) // 1) ** i) <= X:
    ans.append(int((X ** (1 / i)) // 1) ** i)
    i += 1
print(max(ans))

Submission status: Time Limit Exceeded

Solution code:
X = int(input())

ans = 1

for i in range(1, X+1):
    for j in range(2, X+1):
        bp = i**j
        if bp <= X and bp > ans:
            ans = bp

print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
X=int(input())
i=2
li=1
while X**(1/i)>=2:
  s=int(X**(1/i))
  li=max(li,s**i)
print(li)

Submission status: Time Limit Exceeded

Solution code:
num=[]
for i in range(32):
  stack=i*i
  while stack<=1000:
    num.append(stack)
    stack*=i
num.sort()
num.reverse()
n=int(input())
for i in num:
  if i<=n:
    print(i)
    exit()

Submission status: Time Limit Exceeded

Solution code:
from itertools import product


def solve(string):
    x = int(string)
    ans = [1] + [i**j for i, j in product(range(1, x + 1), repeat=2) if j > 1 and i**j <= x]
    return str(max(ans))


if __name__ == '__main__':
    print(solve(input()))

Submission status: Time Limit Exceeded

Solution code:
import math

beki=[]
beki.append(1)
x=int(input())
for i in range(int(math.sqrt(x))):
  p=2
  while(i**p<=x):
    beki.append(i**p)
    p+=1
print(beki)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
X = int(input())

count = []
if X == 1:
    print(1)
else:
    for i in range(1,X):
        for b in range(2,X):
            factorial = i**b
            if factorial <= X:
                count.append(factorial)

    print(max(count))

Submission status: Time Limit Exceeded

Solution code:
x = int(input())
ans = 1
l = [1]
for b in range(x):
	for p in range(x):
		ans = b**p
		if b >0 and p >=2 and ans <=x:
			l.append(ans)
print(max(l))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
X = int(input())
b = 1
MAX = 1
flag = 0
while b <= X:
    p = 2
    while p <= 10:
        beki = b**p
        if beki <= X:
            if beki >= MAX:
                MAX = beki
            else:
                p+=1
        else:
            if p == 2:
                flag = 1
            break
    if flag == 1:
        break
    b+=1
print(MAX)

Submission status: Time Limit Exceeded

Solution code:
X = int(input())
b = 1
MAX = 1
while b <= X:
    p = 2
    while p <= 10:
        beki = b**p
        if beki <= X:
            if beki >= MAX:
                MAX = beki
            else:
                p+=1
        else:
            break
    b+=1
print(MAX)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
i=2
ans=[1]
while(i**2 <= n ):
  j=2
  while( i**(j+1) <=n ):
    j+=1
  ans.append( i**j)

print( max(ans) )

Submission status: Time Limit Exceeded

Solution code:
X = int(input())
 
ans = 0
p = 2
A = set()
for i in range(X):
  if(i in A):
    continue
  p = 1
  while(True):
    p += 1
    power = i ** p
    if(power <= X):
      A.add(power)
      tmp = power
      pass
    else:
      break
  if(ans<tmp):
    ans = tmp
  if(p == 2):
    break
  
print(ans)

Submission status: Time Limit Exceeded

Solution code:
X = int(input())
 
ans = 0
p = 2
for i in range(X):
  p = 1
  while(True):
    p += 1
    if(i ** p <= X):
      tmp = i ** p
      pass
    else:
      break
  if(ans<tmp):
    ans = tmp
  if(p == 2):
    break
  
print(ans)

Submission status: Time Limit Exceeded

Solution code:
#標準入力
X = int(input())

max_beki = 1
for i in range(1,X):
  for j in range(2,X):
    beki = i ** j
    
    if beki > max_beki:
      if beki <= X:
        max_beki = beki
 
print(max_beki)

Submission status: Time Limit Exceeded

Solution code:
#標準入力
X = int(input())

max_beki = 1
for i in range(1,X):
  for j in range(2,X):
    beki = i ** j
    
    if beki > max_beki:
      if beki <= X:
        max_beki = beki
      
print(max_beki)

Submission status: Time Limit Exceeded

Solution code:
from math import sqrt

x = int(input())
xr = int(sqrt(x))

l=[1]
for i in range(1,xr+1):
    t=[]
    for j in range(2,xr):
        if i**j <= x:
            t.append(i**j)
        else:
            break
    l = l+t
l = list(set(l))
l.sort()


left=0
right=len(l)
center=0

while left < right:
    center = (left+right)//2
    if l[center] == x:
        break
    elif l[center] < x:
        left = center
    else:
        right = center

print(l[center])

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
X = int(input())
num = [1]
for i in range(1,X):
  temp = i
  while temp*i<=X:
    temp=temp*i
    num.append(temp)
    
print(num[-1])

Submission status: Time Limit Exceeded

Solution code:
hoge = [False] * 1080

for i in range(1, 1080):
 x = i*i
 while(x < 1080):
  hoge[x] = True
  x *= i

X = input()

while not hoge[X]: X -= 1
print X