Problem:


Score : 200 points

Problem Statement

You are given a positive integer X.
Find the largest perfect power that is at most X.
Here, a perfect power is an integer that can be represented as b^p, where b is an integer not less than 1 and p is an integer not less than 2.

Constraints

1 ≤ X ≤ 1000

X is an integer.

Input

Input is given from Standard Input in the following format:

X

Output

Print the largest perfect power that is at most X.

Sample Input 1

10

Sample Output 1

9

There are four perfect powers that are at most 10: 1, 4, 8 and 9.
We should print the largest among them, 9.

Sample Input 2

1

Sample Output 2

1

Sample Input 3

999

Sample Output 3

961



Sample input:
10


Sample output:
9

Submission status: Accepted

Solution code:
X = int(input())

sq = [a ** 2 for a in range(32)[1:]]
sq += [a ** 3 for a in range(11)[1:]]
sq += [a ** 4 for a in range(6)[1:]]
sq += [a ** 5 for a in range(4)[1:]]
sq += [a ** 6 for a in range(4)[1:]]
sq += [a ** 7 for a in range(4)[1:]]
sq += [a ** 8 for a in range(4)[1:]]
sq += [a ** 9 for a in range(4)[1:]]
sq = [a for a in sq if a <= X]
print(max(sq))

Submission status: Accepted

Solution code:
x = int(input())
ans = 0
for i in range(int(x ** (1/2)) + 1):
  for j in range(10):
    if i ** j <= x and ans < i ** j:
      ans = i ** j
    else:
      continue
print(ans)

Submission status: Accepted

Solution code:
x = int(input())

up = int(x ** 0.5) + 1
max_n = 1
for i in range(1, up):
    for j in range(2, x):
        if i ** j > x:
            break
        if i ** j > max_n:
            max_n = i ** j

print(max_n)

Submission status: Accepted

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

for i in range(2,200):
    if i*i > 1000:
        break
    for j in range(2,100):
        if i**j > 1000:
            break
        l.append(i**j)
l.append(1005)
l.sort()
for i in range(len(l)):
    if l[i]>x:
        print(l[i-1])
        exit(0)

Submission status: Accepted

Solution code:
x = int(raw_input())
ans = 1
for b in range(2,50):
  for p in range(2,15):
    n = b**p
    if n <= x:
      ans = max(ans, n)
print ans

Submission status: Accepted

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

Submission status: Runtime Error

Solution code:
import math

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

Submission status: Runtime Error

Solution code:
import sys

X = int(sys.stdin.readline())
ans = 0
for i in range(X+1):
  	for j in range(11):
      	tmp = pow(i, j)
        if tmp <= X:
          	ans = max(ans, tmp)
print(ans)

Submission status: Runtime Error

Solution code:
X = int(input())
S = set()
for i in range(2,X):
  b = 1
  while(i**b<=X):
    S.add(i**b)
    b += 1
ans = max(S)
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import math
a = int(input())
for i in range(a, 0, -1):
  for j in range(2, 10):
    if i == int(math.paw(i, 1/j)) ** j:
      print(i)
      break
  else:
    continue
  break

Submission status: Runtime Error

Solution code:
x = int(input())
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: Runtime Error

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

Submission status: Runtime Error

Solution code:
x = int(input())
import math
a = math.sqrt(x)
b = a - a%1
ans = []
for i in range(b):
  for j in range(b):
    if i**j < x and x < i**(j+1):
      ans.append(int(i**j))
print(max(ans))

Submission status: Runtime Error

Solution code:
x = int(input())
import math
a = math.sqrt(x)
b = a - a%1
ans = []
for i in range(b):
  for j in range(b):
    if i**j < x and x < i**(j+1):
      ans.append(i**j)
print(max(ans))

Submission status: Runtime Error

Solution code:
X=int(input())

A=[]
for i in range(X):
  for j in range(X):
    b=i+1
    p=j+1
    if b**p>X:
      break
    elif p>=2 and b**p not in A:
      A.append(b**p)
print(max(A))

Submission status: Runtime Error

Solution code:
X=int(input())

A=[]
for b in range(1,X):
  for p in range(2,X):
    if b**p>X:
      break
    elif b**p<=X:
      A.append(b**p)

print(max(A))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
def f(x,b):
    p = 2
    while b**p<=x:
        p += 1
    if p==2:
        return(0)
    else:
        return b**(p-1)

x = int(input())
if x in [1,2]:
    print(1)
else:
    ans = 1
    for i in range(2,x):
        ans = max(ans,f(x,i))
print(ans)

Submission status: Runtime Error

Solution code:
def f(x,b):
    p = 2
    while b**p<=x:
        p += 1
    if p==2:
        return(0)
    else:
        return b**(p-1)

x = int(input())
if x in [1,2]:
    print(1)
else:
    ans = 0
    for i in range(2,x):
        ans = max(ans,f(x,i))
print(ans)

Submission status: Runtime Error

Solution code:
def f(x,b):
    p = 2
    while b**p<=x:
        p += 1
    if p==2:
        return(0)
    else:
        return b**(p-1)

x = int(input())
if x==1:
    print(1)
else:
    ans = 0
    for i in range(2,x):
        ans = max(ans,f(x,i))
print(ans)

Submission status: Runtime Error

Solution code:
X = int(input())
check =[]
check2=[]
for i in range(1,33):
    for s in range(2,11):
        check.append(pow(i,s))


for i in check:
    if i<X:
        check2.append(i)

print(max(check2))

Submission status: Runtime Error

Solution code:
X = int(input())
check =[]
check2=[]
for i in range(1,33):
    for s in range(2,11):
        check.append(pow(i,s))
print(check)

for i in check:
    if i<X:
        check2.append(i)

print(max(check2))

Submission status: Runtime Error

Solution code:
n=(int)(input())
a=[]
for i in range(2, n):
  temp = i ** 2
  while(temp <= n):
    a.append(temp)
    temp *= i
a = sorted(set(a))
#print(a)
print(list(i for i in a if i <= n)[-1])

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
x = int(input())
ans = 1
for b in range(1,x+1):
    for p in range(2,x+1):
        a = pow(b,p)
        if a > ans and a <= x:
            ans = a
        if a>x:
            break
    if a > x:
        continue
print(ans)

Submission status: Runtime Error

Solution code:
x = int(input())
ans = set()
for b in range(1,x):
    for p in range(2,x):
        if pow(b,p) > x:
            break
        else:
            ans.add(pow(b,p))
    if max(ans) > x:
        break
print(max(ans))

Submission status: Runtime Error

Solution code:
x = int(input())
ans = set()
for b in range(1,x+1):
    for p in range(2,x+1):
        if pow(b,p) >= x:
            break
        else:
            ans.add(pow(b,p))
    if max(ans) >= x:
        break
print(max(ans))

Submission status: Runtime Error

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

def expo(x,i):
    while x % i == 0:
        x = x//i
    if x == 1:
        return True
    else:
        return False

while x >= 1:
    for j in range(2,int(math.sqrt(x))+1):
        if expo(x, j) == True:
            print(x)
            break
    if expo(x,j) == True:
        break
    else:
        x -= 1

Submission status: Runtime Error

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

print(ans)

Submission status: Runtime Error

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

print(ans)

Submission status: Runtime Error

Solution code:
import math
x = int(input())
ans = (int(math.sqrt(X)))**2
for i in range(1,int(math.sqrt(x)+2)):
  for j in range(2,10):
    if i ** j <= x and i**j > ans:
      ans = i**j
    else:
      break
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
X = int(input())

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

ans = 0

for b in range(2, int(x**0.5)+2):
  temp = b
  while temp <= X:
    ans = max(ans, temp)
    temp *= b

print(ans)

Submission status: Runtime Error

Solution code:
x = int(input())

ans = 0
for i in range(1, int(x**0.5)+1):
    for j in range(2, x):
        tmp = i ** j
        #tmp = pow(i, j)
        if tmp > x:
            tmp = i ** (j-1)
            #tmp = pow(i, j-1)
            #print(tmp, i, j)
            break
    ans = max(tmp, ans)

print(ans)

Submission status: Runtime Error

Solution code:
x = int(input())

ans = 0
for i in range(1, int(x**0.5)+1):
    for j in range(2, x):
        tmp = pow(i, j)
        if tmp > x:
            tmp = pow(i, j-1)
            #print(tmp, i, j)
            break
    ans = max(tmp, ans)

print(ans)

Submission status: Runtime Error

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: Runtime Error

Solution code:
import math
def main():
  x = int(input())
  sum=0
  if x==0 or x==1:
    sum=x
  else:
    for i in range(2,int(math.sqrt(x))+1):
      j=2
      while True:
         if pow(i,j)<=x:
          if pow(i,j)>sum:
            sum=pow(i,j)
        else:
          break
        j+=1
  print(sum)
main()

Submission status: Runtime Error

Solution code:
import math

x = int(input())
ans = [1]
s = int(math.sqrt(x))
if s >= 2:
    for i in range(2,s+1):
        temp = i
        while True:
            temp *= i
            if temp <= n:
                ans.append(temp)
            else:
                break

print(max(ans))

Submission status: Runtime Error

Solution code:
import math

x = int(input())
ans = [1]
s = math.sqrt(x)
if s >= 2:
    for i in range(2,s+1):
        temp = i
        while True:
            temp *= i
            if temp <= n:
                ans.append(temp)
            else:
                break

print(max(ans))

Submission status: Runtime Error

Solution code:
X = int(input())
tab = set([])
for i in range(1,X+1):
    for j in range(2,X+1):
        if i**j <= X:
            tab.add(i**j)
        else:
            break
print(max([i for i in tab]))

Submission status: Runtime Error

Solution code:
a=int(input())
result=[]
for i in range(1,a+1):
    for j in range(2,a+1):
        if j>=10:
            continue
        if i**j<=a:
            result.append(i**j)
print(max(result))

Submission status: Runtime Error

Solution code:
x = int(input())
l = set([])
i = 1
while i < x:
    j = 2
    while j < 10:
        if i**j <= x:
            l.add(i**j)
        j += 1
    i += 1

print(max(l))

Submission status: Runtime Error

Solution code:
l=[0,1,0,0,1,0,0,0,1,1,0,0,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= 1
    while q <= x:
        q *= p
    return q / p


z = []
a = 2


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


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

print(max(z))

Submission status: Runtime Error

Solution code:
x = int(input())


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


z = []
a = 2

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

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

print(max(z))

Submission status: Runtime Error

Solution code:
x = input(int, )


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


ctn = []
a = 1

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

print(max(ctn))

Submission status: Runtime Error

Solution code:
x = input(int, )


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


ctn = []
a = 1

while a <= x ** (1/2):
    ctn.append(func(a))
    a += 1

print(max(ctn))

Submission status: Runtime Error

Solution code:
x = input(int, )

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

l = []
a = 1

while a <= x ** (1/2):
    l.append(func(a))
    a += 1

print(l.sort([-1]))

Submission status: Runtime Error

Solution code:
A=int(input())
B=[1]*8
for i in range(2,10):
  for j in range(A+1):
    if j**i <= A:
      B[i-2]= j**i
    else:break
B=B.sort()
print(B[-1])

Submission status: Runtime Error

Solution code:
A=int(input())
B=[1]*8
for i in range(2,10):
  for j in range(A+1):
    if j**i <= A:
      B[i-2]= j**i
    else:break
print(B.sort()[-1])

Submission status: Runtime Error

Solution code:
A=int(input())
B=[1]*8
for i in range(2:10):
  for j in range(A+1):
    if j**i <= A:
      B[i-2]= j**i
    else:break
print(B.sort()[-1])

Submission status: Runtime Error

Solution code:
A=int(input())
B=[1]*9
for i in range(1:10):
  for j in range(A+1):
    if j**i <= A:
      B[i]= j**i
    else:break
print(B.sort()[-1])

Submission status: Runtime Error

Solution code:
import sys
import math
import itertools as it
def I():return int(sys.stdin.readline().replace("\n",""))
def I2():return map(int,sys.stdin.readline().replace("\n","").split())
def S():return str(sys.stdin.readline().replace("\n",""))
def L():return list(sys.stdin.readline().replace("\n",""))
def Intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def Lx(k):return list(map(lambda x:int(x)*-k,sys.stdin.readline().replace("\n","").split()))

if __name__ == "__main__":
    l = [i*i for i in range(1,int(math.sqrt(1000))+1)]
    x = I()
    i = 0
    while l[i] <= x:
        i += 1
    print(l[i-1])

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:

a,b = map(int,input().split())

#print(a+b)
print(a*b)

Submission status: Runtime Error

Solution code:
if __name__ == '__main__':
    n =int(input())
    a = int(math.sqrt(n))

    max=1
    for i in range(2,a+1):
        now = i*i
        while now <= n:
            if max < now:
                max =now
            now = now*i
    print(max)

Submission status: Runtime Error

Solution code:
import math

if __name__ == '__main__':
    n =int(input())
    a = int(math.sqrt(n))

    print(a*

Submission status: Runtime Error

Solution code:
if __name__ == '__main__':
    n =int(input())
    a = int(math.sqrt(n))

    print(a*a)

Submission status: Runtime Error

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

if x==1:
    print(1)

else:

    for i in range(2,x+1):
        for j in range(1,x+1):
            y=j**i
            if y<=x:
                l.append(y)
            elif y>x:
                break
print(max(l))

Submission status: Runtime Error

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

if x==1:
    print(1)

else:

    for i in range(2,x+1):
        for j in range(1,x+1):
            y=j**i
            if 1<=y and y<=x:
                l.append(y)
            elif y>x:
                break
print(max(l))

Submission status: Runtime Error

Solution code:
x = int(input())

ans = []

for i in range(2,x+1):
  for j in range(2,x+1):
    if i**j > x:
      break
    ans.append(i**j)
      
print(max(ans))

Submission status: Runtime Error

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

L = []
for i in range(2,int(math.floor(math.sqrt(x)))+1):
  for j in range(x//i + 1):
    if i ** j <= x:
      L.append(i ** j)
      
print(max(L))

Submission status: Runtime Error

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

L = []
for i in (2,int(math.floor(math.sqrt(x)))+1):
  for j in (range(x//i)):
    if i ** j <= x:
      L.append(i**j)
      
print(max(L))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())
X = set()
for i in range(2,32):
  for j in range(2, 10):
    if pow(i,j) <= N:
      X.add(pow(i, j))
    else:
      break
print(max(X))

Submission status: Runtime Error

Solution code:
N = int(input())
X = {}
for i in range(2,32):
  for j in range(2, 10):
    if pow(i,j) <= X:
      X.add(pow(i, j))
    else:
      break
print(max(X))

Submission status: Runtime Error

Solution code:
x = int(input())
s = set()
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: Runtime Error

Solution code:
x = int(input())
ans = [1]
b = 2
p = 2
while b**p < x:
  while b**p<x:
    ans.append(b**p)
    p += 1
  b += 1
  p = 2
print(ans[-1] if ans[-1]<x else ans[-2])

Submission status: Runtime Error

Solution code:
x = int(input())
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: Runtime Error

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 (math.ceil(i ** (1/5)))**5 == i:
        print(i)
        break

Submission status: Runtime Error

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 math.isclose(math.log(i, j), round(math.log(i, j)), rel_tol = 0.0000001):
            print(i)
            exit()
    if i == 1:
        print(1)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
x = int(input())
ans = 1
for i in range(x, 0, -1):
  m = i
  div = []
  for j in range(2,int(m**0.5)+2):
    if m%j==0:
      count = 0
      while m%j ==0:
        m //= j
        count += 1
      div.append(count)
  if m!= 1:
    div.append(1)
  count = div[0]
  for c in div:
    if c!= count or count ==1:
      break
  else:
    print(i)
    exit()
print(ans)

Submission status: Runtime Error

Solution code:
X = int(input())

e = [0 for _ in range(X+1)]
e[1] = 1
for i in range(2, X):
    v = i*i
    while v <= X:
        e[v] = 1
        v *= b
        
for i in range(X, 0, -1):
    if e[i] == 1:
        print(i)
        break

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
x = int(input())
for i in range(x, 0, -1):
  ans = i
  div = []
  for j in range(2,(x**0.5)+1):
    count = 0
    if i%j ==0:
      while i%j==0:
        i //= j
        count += 1
      div.append(count)
  if len(div) == 1 and div[0] > 1:
    print(ans)

Submission status: Runtime Error

Solution code:
import math
x = int(input())
res = 0
for b in range(1, int(math.sqrt(X))+1): # sqrt(X)付近まで探索
    for p in range(2, int(math.sqrt(X))+2): # sqrt(X)付近まで探索
        val = b**p
        if (val <= X) and (val > res): # X以下かつその値が最大値なら値を更新
            res = val
print(res)

Submission status: Runtime Error

Solution code:
x = int(input())
res = 0
for b in range(1, int(math.sqrt(X))+1): # sqrt(X)付近まで探索
    for p in range(2, int(math.sqrt(X))+2): # sqrt(X)付近まで探索
        val = b**p
        if (val <= X) and (val > res): # X以下かつその値が最大値なら値を更新
            res = val
print(res)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

for i in range(2, 100):
    n = 2
    while i**n <= x:
        ans.append(i**n)
        n += 1

print(max(ans))

Submission status: Runtime Error

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from heapq import heapify, heappop, heappush
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

X = INT()
# ans = 0
# for b in range(1, 1000):
#     for p in range(2, 1000):
#         tmp = b ^ p
#         # print(tmp)
#         if tmp <= X:
#             ans = max(ans, tmp)
#             # print(tmp)
#         else:
#             break
# print(ans)
def prime_decomposition(n):
    i = 2
    table = []
    while i * i <= n:
        while n % i == 0:
            n /= i
            table.append(i)
        i += 1
    if n > 1:
        table.append(n)
    return table

x = X
r = []
for i in range(2, x + 1):
    c = 2
    while i ** c <= x:
        r.append(i ** c)
        c += 1
ans = sorted(r)[-1]
print(ans)



exit()


for x in range(X, 0, -1):
    prime = prime_decomposition(x)
    c = Counter(prime)
    # print(c.values())
    value = c.values()
    # print(v)
    print(c)
    for v in value:
        d = v
    if len(c) == 1 and d >= 2:
        print(x)
        exit()
    elif x == 1:
        print(x)
        exit()

Submission status: Runtime Error

Solution code:
x=int(input())
l=[1]
for i in range(2,32):
  k=2
  while i**k<1000:
    l.append(i**k)
    k+=1
l=sorted(l)
for i in range(len(l)):
  if l[i]<=x<l[i+1]:
    print(l[i])
    exit()
print(961)

Submission status: Runtime Error

Solution code:
i = int(input())
for n in range(1, i):
	if (n ** .5).is_integer():
		num = n
print(num)

Submission status: Runtime Error

Solution code:
X = int(input())

for i in range(X):
    for j in range(2, X):
        if X >= i**j:
            ans = i**j
        else:
            break
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import math
x = int(input())
if x==1:
  print(1)
  exit()

used = dictionary()
for b in range(2,int(math.sqrt(x))+1):
  p=2
  while(b**p<=x):
    used[b**p]=True
    p+=1

ans=0
for key,itm in used:
  ans = max(ans,key)

print(ans)

Submission status: Runtime Error

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

used = dictionary()
for b in range(2,sqrt(x)):
  p=2
  while(b**p<=x):
    used[b**p]=True
    p+=1
ans=0
for key,itm in used:
  ans = max(ans,key)

print(ans)

Submission status: Runtime Error

Solution code:
x = int(input)
for i in range(x**0.5):
  if x <= i**2:
    break
    print((i-1)**2)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import math
x = int(input())
ans = []
for j in range(math.ceil(math.sqrt(x))):
    for k in range(2,x):
        if j ** k <= x:
            ans.append(j ** k)
print(max(ans))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
X = int(input())
while(1):
    for i in range(2,11):
        f = pow(X,1.0/float(i))
        if(1-f%1<=10**-8):
            print(X)
            exit()
    X-=1

Submission status: Runtime Error

Solution code:
x = input()
y = 0
if x==1:
    print(1)
else:
    for a in range(2,33):
        for b in range (2,10):
            if b==2 and a**b>x:
                print(y)
            elif a**b<x:
                y=max(a**b,y)

Submission status: Runtime Error

Solution code:
x,y = map(int,input().split())
a = list(map(int,input().split()))
b = set(a[1:])
for i in range(x-1):
    a = list(map(int,input().split()))
    b = b & set(a[1:])
print(len(b))

Submission status: Runtime Error

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

if X == 1:
  print(X)
else:
  # p
  for i in range(2, int(X**0.5)+1):
    n=1
    a=i
    # b
    while n < X : #超えたら中断
      n *= a
      ans.append(n)
    if n // a > x:
      x = (n//a)
      #print(ans)
print(max(i for i in ans if i <= X))

Submission status: Runtime Error

Solution code:
import math
import string


def readints():
    return list(map(int, input().split()))


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


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]

#N = int(input())
#s = [input() for i in range(N)]
#M = int(input())
#t = [input() for i in range(M)]
# print(s)
# print(t)

h, w = map(int, input().split())
if (w == 1) or(h == 1):
    print(1)
    exit()

sum = 0

sum += (math.ceil(w/2))*(math.ceil(h/2))  # 切り上げ
sum += (math.floor(w/2))*(math.floor(h/2))  # 切り捨て

print(sum)

Submission status: Runtime Error

Solution code:
a = int(input())
for i in range(a):
  a = a-i
  for k in range(2,10):
    if int(a**(1/k))**k == a:
      print(a)
      break
  else:
      continue
  break

Submission status: Runtime Error

Solution code:
X=int(input())
li=[x**p for x in range(2,32) for p in range(2,35) if x**p<=X]
print(max(li))

Submission status: Runtime Error

Solution code:
X = int(input())

se = set(n**e)
for n in range(32):
    for e in range(2,11):
        if n**e <= X:
            exit()

answer = max(se)
print(answer)

Submission status: Runtime Error

Solution code:
X = int(input())

se = set()
for n in range(32):
    for e in range(2,11):
        if n**e <= X:
            se = set(n**e)

answer = max(se)
print(answer)