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:
l=[0,1,0,0,1,0,0,0,1,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
for i in range(int(input()),0,-1):
  if l[i]==1:print(i);break

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

def readInt():
  return int(input())
def readInts():
  return list(map(int, input().split()))
def readChar():
  return input()
def readChars():
  return input().split()

x = readInt()
l = [0]*(x+1)
l[1]=1

for i in range(2,len(l)):
  if i*i>len(l)-1:
    break
  else:
    l[i]=1
    l[i*i]=1

for i in range(len(l)-1,-1,-1):
  if l[i]==1:
    print(i)
    break

Submission status: Wrong Answer

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          
    if q / p == p:
        return 1
    else:
        return q / p


z = []
a = 2

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

print(max(z))

Submission status: Wrong Answer

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 = 2

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

print(max(z))

Submission status: Wrong Answer

Solution code:
x = int(input())

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


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


z = []
a = 2

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

print(max(z))

Submission status: Wrong Answer

Solution code:
x = int(input())

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


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


z = []
a = 2

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

print(max(z))

Submission status: Wrong Answer

Solution code:
x = int(input())

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


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


z = []
a = 2

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

print(max(z))

Submission status: Wrong Answer

Solution code:
x = int(input())

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


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


z = []
a = 2

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

print(max(z))

Submission status: Wrong Answer

Solution code:
x = int(input())

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


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


z = []
a = 2

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

print(max(z))

Submission status: Wrong Answer

Solution code:
x = int(input())

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


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


z = []
a = 2

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

print(max(z))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def is_prime(n):
    if n <= 1:
        return False

    for i in range(2, n):
        if n % i == 0:
            return False

    return True

X = int(input())
lis = [i for i in range(40) if is_prime(i)]
num = []

for i in lis:
    for j in range(2, 11):
        if i**j <= X:
            num.append(i**j)

if X == 1:
    print(1)
else:
    print(max(num))

Submission status: Wrong Answer

Solution code:
import math
X = int(input())
b = int(math.sqrt(X))

print(b**2)

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

Solution code:
import math

def eratosthenes(limit):
    A = [i for i in range(2, limit+1)]
    P = []
    time = 0
    
    while True:
        prime = min(A)
        
        if prime > math.sqrt(limit):
            break
            
        P.append(prime)
            
        i = 0
        while i < len(A):
            if A[i] % prime == 0:
                A.pop(i)
                continue
            i += 1
            
    for a in A:
        P.append(a)
            
    return P

def main():
    X = int(input())
    if X == 1:
        print(1)
        return
    else:
        P = eratosthenes(int(math.sqrt(X)))
        maxi = 1
        for p in P:
            e =  p**2
            while e*p <= X:
                e *= p
            maxi = max(maxi, e)

        print(maxi)
        
main()

Submission status: Wrong Answer

Solution code:
t = set([])

for i in range(1,32):
    for s in range(2,32):
        if i**s<1001:
            t.add(i**s)
            
t = list(t)

t.sort(reverse = True)

x = int(input())

for i in range(len(t)-1):
    if t[i]>x>=t[i+1]:
        print(t[i+1])
        break

Submission status: Wrong Answer

Solution code:
t = set([])

for i in range(32):
    for s in range(32):
        if i**s<1001:
            t.add(i**s)
            
t = list(t)

t.sort(reverse = True)

x = int(input())

for i in range(len(t)-1):
    if t[i]>x>=t[i+1]:
        print(t[i+1])
        break

Submission status: Wrong Answer

Solution code:

t = []

for i in range(31):
    for s in range(31):
        t.append(i**s)
        
t.sort()

t.reverse()

x = int(input())

for i in range(len(t)-1):
    if t[i]<=x<t[i+1]:
        print(t[i])
        break

Submission status: Wrong Answer

Solution code:
import math

x = int(input())

t = int(math.sqrt(x))

print(t*t)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# coding: utf-8

# In[18]:


X = int(input())


# In[19]:


for i in range(X)[::-1]:
    for j in range(2,i):
        p = 2
        flag = False
        while flag == False:
            if j**p == i:
                print(i)
                flag = True
                break
            elif j**p > i:
                break
            else:
                p += 1
        if flag:
            break
    else:
        continue
    break
else:
    print(1)


# In[ ]:

Submission status: Wrong Answer

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

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

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,1100)]
    x = I()
    i = 0
    while l[i] <= x:
        i += 1
    print(l[i-1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from math import sqrt
X = int(input())
N = int(sqrt(X))
ans = N**2
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
 
for n in range(X,-1,-1):
  f = factorization(n)
  if len(f) == 1 and f[0][1] > 1:
    ans = max(f[0][0]**f[0][1],ans)
    break

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for n in range(X,-1,-1):
  f = factorization(n)
  if len(f) == 1 and f[0][1] > 1:
    print(f[0][0]**f[0][1])
    exit()
print(1)

Submission status: Wrong Answer

Solution code:
x = int(input())

for i in range(x,0,-1):
  j = int(i**0.5)
  if i==j**2:
    print(i)
    exit()

Submission status: Wrong Answer

Solution code:
from math import sqrt


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-sqrt(n) // 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 not arr:
        arr.append([n, 1])

    return arr


# input
X = int(input())

# check
for n in range(X, 1, -1):
    fact = factorization(n)

    if len(fact) == 1 and fact[0][1] > 1:
        print(n)
        exit(0)
else:
    print(1)

Submission status: Wrong Answer

Solution code:
from math import sqrt


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-sqrt(n) // 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 not arr:
        arr.append([n, 1])

    return arr


# input
X = int(input())

# check
for n in range(X, 1, -1):
    fact = factorization(n)

    if len(fact) == 1:
        print(n)
        exit(0)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

x_root = math.sqrt(x)
print(int(x_root)**2)

Submission status: Wrong Answer

Solution code:
x = int(input())

b = 1
p = 2

a = []

i = 0
j = 0
while (b+i) ** (p+j) <= x:
    i = 0
    while (b+i) ** p <= x:
            a.append((b+i) ** (p+j))
            i += 1
    j += 1

print(max(a))

Submission status: Wrong Answer

Solution code:
x = int(input())

b = 1
p = 2

a = [b ** p]

i = 0
j = 0
while (b+i) ** (p+j) <= x:
    while True:
        if (b+i) ** p <= x:
            a.append((b+i) ** (p+j))
        else:
            break
        i += 1
    j += 1

print(max(a))

Submission status: Wrong Answer

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

s = math.floor(math.sqrt(x))

def l(k,p):
  if int(math.floor(math.log(p)/math.log(k))) == 1:
    return(0)
  else:
    return(int(math.floor(math.log(p)/math.log(k))))

ans = 0
for i in range(2,s+1):
  ans = max(ans, i ** l(i,x))
  
print(ans)

Submission status: Wrong Answer

Solution code:
import math
x = int(input())
s = math.floor(math.sqrt(x))
if x == 1:
  print(1)
  exit()
if x == 2 or 3:
  print(2)
  exit()
  
def l(k,p):
  return(int(math.floor(math.log(p)/math.log(k))))

ans = 0
for i in range(2,s+1):
  ans = max(ans, i ** l(i,x))
  
print(ans)

Submission status: Wrong Answer

Solution code:
import math
x = int(input())
s = math.floor(math.sqrt(x))
if x == 1:
  print(1)
  exit()

def l(k,p):
  return(int(math.floor(math.log(p)/math.log(k))))

ans = 0
for i in range(2,s+1):
  ans = max(ans, i ** l(i,x))
  
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math

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

Solution code:
import sys
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque
from decimal import *

import numpy as np

import math

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

    print(a*a)

Submission status: Wrong Answer

Solution code:
x = int(input())

import math
ans = []
for i in range(0,x):
  if math.sqrt(i).is_integer():
    ans.append(i)
print(max(ans))

Submission status: Wrong Answer

Solution code:
x = int(input())

import math
ans = []
for i in range(0,x+1):
  if math.sqrt(i).is_integer():
    ans.append(i)
print(max(ans))

Submission status: Wrong Answer

Solution code:
x = int(input())

import math

for i in range(x,0,-1):
  if math.sqrt(i).is_integer():
    #print(math.sqrt(i))
    print(int(i))
    break

Submission status: Wrong Answer

Solution code:
x = int(input())

for b in reversed(range(1, x+1)):
    for p in reversed(range(2, x+1)):
        a = b**p
        if a <= x:
            print(a)
            exit()
print(1)

Submission status: Wrong Answer

Solution code:
x = int(input())
r = int(x**0.5)
for i in reversed(range(1, x+1)):
    for j in range(1, r+1):
        for k in range(2, r+1):
            if i == j**k:
                print(i)
                exit()

Submission status: Wrong Answer

Solution code:
X = int(input())

for i in range(101):
    if i**2 > X:
        print((i-1)**2)
        print(i-1)
        break

Submission status: Wrong Answer

Solution code:
X = int(input())

for i in range(100):
    if i**2 > X:
        print((i-1)**2)
        break

Submission status: Wrong Answer

Solution code:
X = int(input())
count = [1]
for x in range (1,50):
    for y in range (1,10):
        if x ** y <= X:
            count.append(x ** y)
print(max(count))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x=int(input())
ans=0
for i in range(33):
  if x<(i+1)**2:
    print(i**2)
    break

Submission status: Wrong Answer

Solution code:
x=int(input())
ans=0
for i in range(32):
  if x>=(i+1)**2:
    ans=(i+1)**2
  else:
    print(ans)
    break

Submission status: Wrong Answer

Solution code:
x=int(input())
ans=0
for i in range(31):
  if x>=(i+1)**2:
    ans=(i+1)**2
  else:
    print(ans)
    break

Submission status: Wrong Answer

Solution code:
X = int(input())

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

print(ans)

Submission status: Wrong Answer

Solution code:
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
X = int(input())
A = [1]
for i in range(1,X+1):
    for j in range(2,100):
        if i**j > X:
            break
        f = factorization(i**j)
        if len(f) == 1 and f[0][1] != 1:
            A.append(i**j)
print(max(A))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def primes(x):
    res = []
    a = 2
    while x >= a*a:
        while x % a == 0:
            x //= a
            res.append(a)
        a += 1
    if x != 1:
        res.append(x)
    return res

x = int(input())
if x < 4:
    print(1)
else:
    for i in reversed(range(4,x+1)):
        p = primes(i)
        if len(p) > 1 and len(set(p)) == 1:
            print(i)
            break

Submission status: Wrong Answer

Solution code:
n=int(input())

r=int(n**0.5)
ans=0
if (r+1)*(r+1)<=n:
  print((r+1)**2)
else:
  print(r**2)

Submission status: Wrong Answer

Solution code:
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

x = ni()

num = 1

for i in range(100):
  for j in range(10):
    if i**j <= x:
      num = max(num,i**j)

print(num)

Submission status: Wrong Answer

Solution code:
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

x = ni()

num = 1

for i in range(100):
  for j in range(10):
    if i**j <= x:
      num = i**j

print(num)

Submission status: Wrong Answer

Solution code:
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

x = ni()

num = 1

for i in range(100):
  if i**2 <= x:
    num = i**2

print(num)

Submission status: Wrong Answer

Solution code:
x = int(input())
ans = 1 # 1^b = 1
for i in range(x+1,1,-1): # [x,2]
    a = i # a^1
    while a < x:
        a *= i # a^b,(b>=2)
        if a <= x:
            print(a)
            exit()
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans = 1 # 1^b
# n = math.floor(math.sqrt(x))
for i in range(2,x+1):
    a = i# a^1
    while a < x:
        a *= a # a^{<=2}
        if a <= x: ans = max(ans, a)
print(ans)

Submission status: Wrong Answer

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

ans = 2
n = math.ceil(math.sqrt(x))
for a in range(n,1,-1):
    if a*a <= x:
        ans = a*a
        break
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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)
      
if L == []:
  print("0")
else:
  print(max(L))

Submission status: Wrong Answer

Solution code:
X = int(input())

ans = -1
for p in range(1, 1000+1):
    for b in range(2, 10):
        t = b**p
        if t <= X:
            if ans < t:
                ans = t
        else:
            break

print(ans)

Submission status: Wrong Answer

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

def factorization(n):
    factor_list = []
    if n <= 1:
        return factor_list
    limit = int(math.sqrt(n))+1
    for i in range(2, limit):
        if n % i == 0:
            factor = i
            exponent = 1
            n //= i
            while n % i == 0:
                n //= i
                exponent += 1
            factor_list.append([factor, exponent])
    if n >= limit:
        factor_list.append([n, 1])
    return factor_list

for i in range(X, 0, -1):
    lis = factorization(i)
    if len(lis) == 1 and lis[0][1] >= 2:
        print(i)
        exit()

print(1)

Submission status: Wrong Answer

Solution code:
import sys
n = int(input())
nums = [125,216,343]
for i in range(n,0,-1):
    if i in nums:
        print(i)
        sys.exit()
    if ((i**(1/2))%1 == 0) or ((i **(1/3))%1 == 0) or  ((i **(1/5))%1 == 0) or ((i **(1/7))%1 == 0) or ((i **(1/9))%1 == 0):
        print(i)
        sys.exit()
print(1)

Submission status: Wrong Answer

Solution code:
import sys
n = int(input())
for i in range(n,0,-1):
    if ((i**(1/2))%1 == 0) or ((i **(1/3))%1 == 0) or  ((i **(1/5))%1 == 0) or ((i **(1/7))%1 == 0) or ((i **(1/9))%1 == 0):
        print(i)
        sys.exit()
print(1)

Submission status: Wrong Answer

Solution code:
import sys
n = int(input())
for i in range(n,0,-1):
    if ((i**(1/2))%1 == 0) or ((i **(1/3))%1 == 0):
        print(i)
        sys.exit()
print(1)

Submission status: Wrong Answer

Solution code:
import sys
n = int(input())
def factorization(n): #素因数分解のプログラム([素因数,指数]のリストのリストで出力→24→[[2, 3], [3, 1]])
    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 
for i in range(n,0,-1):
    k = factorization(i)
    for j in range(len(k)):
        if k[j][1] % 2 != 0:
            break
    else:
        print(i)
        sys.exit()
print(1)

Submission status: Wrong Answer

Solution code:
import sys
n = int(input())
def factorization(n): #素因数分解のプログラム([素因数,指数]のリストのリストで出力→24→[[2, 3], [3, 1]])
    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 
for i in range(n,0,-1):
    k = factorization(i)
    for j in range(len(k)):
        if k[j][1] % 2 != 0:
            break
    else:
        print(i)
        sys.exit()

Submission status: Wrong Answer

Solution code:
X = int(input())
n = 0
while n**2 <= X:
    n+=1
print((n-1)**2)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
if N==1:
  print(1)
else:
  for i in reversed(range(1, N)):
    num = str(i**(0.5))
    check = num[num.index('.'):]
    if len(check)==2 and check==('.0'):
      print(i)
      break

Submission status: Wrong Answer

Solution code:
X = int(input())
nums = set([1])
for i in range(2, int(1000 ** .5) +1):
    b = 2
    while True:
        temp = i ** b
        if temp > 1000:
            break
        nums.add(temp)
        b += 1
sorted_nums = sorted(list(nums), reverse=True)
# print(f"nums:{sorted_nums}", file=sys.stderr)
for i in range(len(sorted_nums) - 1):
    if sorted_nums[i] > X >= sorted_nums[i + 1]:
        print(sorted_nums[i + 1])

Submission status: Wrong Answer

Solution code:
X = int(input())
primes = [2]

def is_prime(x, primes):
    for p in primes:
        if x % p == 0:
            return False
    return True
for i in range(3, int(1000 * .5) + 1, 2):
    if is_prime(i, primes):
        primes += [i]

exponential_num = [1]
for p in primes:
    i = 2
    while True:
        temp_exp = p ** i
        if temp_exp <= 1000:
            exponential_num += [temp_exp]
        else:
            break
        i += 1
exponential_num = sorted(exponential_num, reverse=True)
# print(f"exp:{exponential_num}", file=sys.stderr)
if X >= exponential_num[0]:
    print(exponential_num[0])
else:
    for i in range(len(exponential_num) - 1):
        if exponential_num[i] > X >= exponential_num[i + 1]:
            print(exponential_num[i + 1])

Submission status: Wrong Answer

Solution code:
X = int(input())
primes = [2]

def is_prime(x, primes):
    for p in primes:
        if x % p == 0:
            return False
    return True
for i in range(3, int(1000 * .5) + 1, 2):
    if is_prime(i, primes):
        primes += [i]

exponential_num = [1]
for p in primes:
    i = 2
    while True:
        temp_exp = p ** i
        if temp_exp <= 1000:
            exponential_num += [temp_exp]
        else:
            break
        i += 1
exponential_num = sorted(exponential_num, reverse=True)
# print(f"exp:{exponential_num}", file=sys.stderr)
if X == 1:
    print(1)
elif X > exponential_num[0]:
    print(exponential_num[0])
else:
    for i in range(len(exponential_num) - 1):
        if exponential_num[i] > X >= exponential_num[i + 1]:
            print(exponential_num[i + 1])