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:
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 = []
for p in primes:
    i = 1
    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)

if X == 1:
    print(1)
elif X > exponential_num[0]:
    print(exponential_num[0])
else:
    for i, exp in enumerate(exponential_num):
        if exponential_num[i] > X >= exponential_num[i + 1]:
            print(exponential_num[i + 1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x=int(input())
ans=[1]
for i in range(2,50):
    y=2
    while i**y<=x:
        ans.append(i**y)
        y+=1
print(ans[-1])

Submission status: Wrong Answer

Solution code:
x = int(input())
a = 0
b = 0
while b <= x:
    a += 1
    c = pow(a, 2)
    b = c
a -= 1
c = pow(a, 2)
print(c)

Submission status: Wrong Answer

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

while True:
  if(math.sqrt(x).is_integer()):
    print(x)
    exit()
  else:
    x -= 1

Submission status: Wrong Answer

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

while True:
  #print(math.sqrt(x))
  if(str(math.sqrt(x))[-2] == "." and str(math.sqrt(x))[-1] == "0"):
    print(x)
    exit()
  else:
    x = x - 1

Submission status: Wrong Answer

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

while True:
  if(str(math.sqrt(x))[-2] == "."):
    print(x)
    exit()
  else:
    x = x - 1

Submission status: Wrong Answer

Solution code:
n=input()
l=len(n)
n=int(n)
ans=0
for i in range(2,7*l):
    t=int(n**(1/i))
    for j in range(3):
        if (t+j)**i<=n:
            ans=max(t**i,ans)
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x = int(input())
done = [0]*(x+1)
ans = 1
tmp = 0
for i in range(2, x):
  tmp = i
  while tmp*i <= x:
    if not done[tmp*i]:ans+=1
    done[tmp*i]=1
    tmp*=i
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# Python3 (3.4.3)
import sys
input = sys.stdin.readline

# -------------------------------------------------------------
# function
# -------------------------------------------------------------


# -------------------------------------------------------------
# main
# -------------------------------------------------------------
X = int(input())

print(int(X**.5)**2)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x = int(input())
while x >= 1:
    if x**(1 / 2) % 1 == 0:
        print(x)
        break
    else:
        x -= 1

Submission status: Wrong Answer

Solution code:
x = int(input())
while x >= 1:
    if str(x**(1/2) * 10)[-1] == "0":
        print(x)
        break
    else:
        x -= 1

Submission status: Wrong Answer

Solution code:
X = int(input())
val = 1
for b in range(1, int(X**0.5)+1):
    for p in range(2,X):
        if b**p > X:
            break
        else:
            val = b**p
print(val)

Submission status: Wrong Answer

Solution code:
X = int(input())
A = []
for i in range(2,10):
    for j in range(1, int(X**(1/i))+1):
        A.append(j**i)
print(X-min([abs(a - X) for a in A]))

Submission status: Wrong Answer

Solution code:
# For taking integer inputs.
def inp():
    return(int(input()))


# For taking List inputs.
def inlist():
    return(list(map(int, input().split())))


# For taking string inputs. Actually it returns a List of Characters, instead of a string, which is easier to use in Python, because in Python, Strings are Immutable.
def instr():
    s = input()
    return(list(s[:len(s)]))


# For taking space seperated integer variable inputs.
def invr():
    return(map(int, input().split()))


X = inp()
if X == 1:
    print(1)
else:
    res = 1
    for b in range(2, X):
        for p in range(2, X):
            a = b**p
            if a < X:
                res = max(a, res)
            else:
                break
    print(res)

Submission status: Wrong Answer

Solution code:
import math
X = int(input())
b = 1
for i in range(100,1,-1):
    a = math.floor(math.log(X, i))
    b = max(i**a,b)
print(b)

Submission status: Wrong Answer

Solution code:
import math
X = int(input())
b = 1
for i in range(33,1,-1):
    a = math.floor(math.log(X, i))
    b = max(i**a,b)
print(b)

Submission status: Wrong Answer

Solution code:
import numpy as np
x = int(input())
for i in range(x, -1, -1):
    if np.sqrt(i) % 1 == 0:
        print(i)
        break

Submission status: Wrong Answer

Solution code:
import math

X = int(input())

def f(n):
    if n == 1:
        return True
    for i in range(2, int(math.sqrt(n)) + 1):
        if n % i == 0:
            tmp = i
            break
    else:
        return False
    while True:
        if n == 1:
            return True
        elif n % tmp == 0:
            n //= tmp
        elif n % tmp != 0:
            return False

for i in reversed(range(1, X + 1)):
    if f(i):
        print(i)
        break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
i = int(input())
ans = 0
for ii in range(1,i):
	for p in range(2,i):
		if ii == (p*p):
			ans = ii
	
print(ans)

Submission status: Wrong Answer

Solution code:
i = int(input())
ans = 0
for ii in range(i):
	if (ii ** .5).is_integer():
		ans = ii
print(ans)

Submission status: Wrong Answer

Solution code:
i = int(input())
ans = 0
for ii in range(i+1):
	if (ii ** .5).is_integer():
		ans = ii
print(ans)

Submission status: Wrong Answer

Solution code:
x = int(input())
for _ in range(1000):
    if all(x**(1/i)!=int(x**(1/i)) for i in range(2, 100)):
        x -= 1
    else :
        print(x)
        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:
import math
X = int(input())
print((int(math.sqrt(X)))**2)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
x = int(input())
if x == 1:
    print(1)
else:
    while(math.sqrt(x)!=int(math.sqrt(x))):
        x-=1
    print(x)

Submission status: Wrong Answer

Solution code:
k=int(input())
ans=1
while ans**2<k:
    ans+=1
print(1 if k==1 else (ans-1)**2)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

import sys
input = sys.stdin.readline

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

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

M = 0
for i in range(2,N+1):
  if len(factorization(i)) == 1 and factorization(i)[0][1] != 1:
    M = i
    
print(M)

Submission status: Wrong Answer

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

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

import sys
input = sys.stdin.readline

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

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

M = 0
for i in range(2,N+1):
  if len(factorization(i)) == 1 and factorization(i)[0][1] != 1:
    M = i
    
print(M)

Submission status: Wrong Answer

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

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

import sys
input = sys.stdin.readline

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

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

M = 0
for i in range(2,N+1):
  if len(factorization(i)) == 1:
    M = i
    
print(M)

Submission status: Wrong Answer

Solution code:
x = int(input())
c = 1
while c:
    for i in range(2, 10):
        y = x ** (1 / i)
        if y % 1 == 0:
            print(x)
            c = 0
            break
    x -= 1

Submission status: Wrong Answer

Solution code:
x = int(input())
print((int(x ** 0.5)) ** 2)

Submission status: Wrong Answer

Solution code:
X = int(input())

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

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

print(ans)

Submission status: Wrong Answer

Solution code:
def resolve():
	x = int(input())
	ans = 0
	while True:
		ans += 1
		if ans**2 > x:
			print((ans-1)**2)
			return
resolve()

Submission status: Wrong Answer

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

x = int(input())

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

print(ans)

Submission status: Wrong Answer

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

x = int(input())

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

print(ans)

Submission status: Wrong Answer

Solution code:
from math import floor, log

x = int(input())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
x = int(input())
ans = 1
for i in range(2, x):
    p_max = math.floor(math.log(x, i))
    if p_max < 2:
        break
    ans = min(x, max(ans, i**p_max))
print(ans)

Submission status: Wrong Answer

Solution code:
import math
x = int(input())
ans = 1
for i in range(2, x):
    p_max = math.floor(math.log(x, i))
    if p_max < 2:
        break
    ans = max(ans, i**p_max)
print(ans)

Submission status: Wrong Answer

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

def resolve():
    
    import math
    def main():
    
    
        # cf. https://qiita.com/suecharo/items/14137fb74c26e2388f1f
        def make_prime_list_2(num):
            if num < 2:
                return []
        
            # 0のものは素数じゃないとする
            prime_list = [i for i in range(num + 1)]
            prime_list[1] = 0  # 1は素数ではない
            num_sqrt = math.sqrt(num)
        
            for prime in prime_list:
                if prime == 0:
                    continue
                if prime > num_sqrt:
                    break
        
                for non_prime in range(2 * prime, num, prime):
                    prime_list[non_prime] = 0
        
            return [prime for prime in prime_list if prime != 0]
        
        
        def prime_factorization_2(num):
            """numの素因数分解
            素因数をkeyに乗数をvalueに格納した辞書型dict_counterを返す"""
        
            if num <= 1:
                # 例えば1を食ったときの対処の仕方は問題によって違うと思うのでそのつど考える。
                # cf. https://atcoder.jp/contests/abc110/submissions/12688244
                return False
            else:
                num_sqrt = math.floor(math.sqrt(num))
                prime_list = make_prime_list_2(num_sqrt)
        
                dict_counter = {}  # 何度もこの関数を呼び出して辞書を更新したい時はこれを引数にして
                # cf. https://atcoder.jp/contests/arc034/submissions/12251452
        
                for prime in prime_list:
                    while num % prime == 0:
                        if prime in dict_counter:
                            dict_counter[prime] += 1
                        else:
                            dict_counter[prime] = 1
                        num //= prime
                if num != 1:
                    if num in dict_counter:
                        dict_counter[num] += 1
                    else:
                        dict_counter[num] = 1
        
                return dict_counter
        
        X=int(input())
        for i in reversed(range(2,X+1)):
            d=prime_factorization_2(i)
            if d:
                l=[v for v in d.values()]
                if len(l)==1 and l[0]>=2:
                    return i
        return 1
    print(main())
            



resolve()

Submission status: Wrong Answer

Solution code:
from bisect import bisect_right
a = int(input())
dp = [1]
t = 1

while t**2<=10000:
    dp.append(t**2)
    t+=1
    if dp[-1]==a:
        print(dp[-1])
        exit()
    elif dp[-1] > a:
        print(dp[-2])
        exit()
print(dp[bisect_right(dp,a)-1])

Submission status: Wrong Answer

Solution code:
from bisect import bisect_right
a = int(input())
dp = [1]
t = 1

while t**2<=10000:
    dp.append(t**2)
    t+=1
    if dp[-1]>=a:
        print(dp[-2])
        exit()
print(dp[bisect_right(dp,a)-1])

Submission status: Wrong Answer

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])

Submission status: Wrong Answer

Solution code:
X = int(input())

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from bisect import bisect_right
a = int(input())
dp = [1]
t = 1

while t**2<=1000:
    dp.append(t**2)
    t+=1

print(dp[bisect_right(dp,a)-1])

Submission status: Wrong Answer

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

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

print(mx)

Submission status: Wrong Answer

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

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

print(mx)

Submission status: Wrong Answer

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

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

print(mx)

Submission status: Wrong Answer

Solution code:
import math
a = int(input())
mx = 0

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

print(mx)

Submission status: Wrong Answer

Solution code:
x = int(input())

a = []

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

print(1 if x == 0 else max(max(a),1))

Submission status: Wrong Answer

Solution code:
x = int(input())

a = []

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

print(0 if x == 0 else max(max(a),1))

Submission status: Wrong Answer

Solution code:
x = int(input())

a = []

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

print(max(max(a),1))

Submission status: Wrong Answer

Solution code:
x = int(input())

a = []

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

print(max(a))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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:
        print(i)
        break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

X = INT()

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

print(ans)

Submission status: Wrong Answer

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.log(i, j).is_integer():
            print(i)
            exit()
    if i == 1:
        print(1)

Submission status: Wrong Answer

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.log(i, j).is_integer():
            print(i)
            exit()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

def resolve():
    x=int(input())
    for i in range(1,33):
        if i**2>x:
            print((i-1)**2)
            break
resolve()

Submission status: Wrong Answer

Solution code:
X = int(input())

num_list = []
for i in [1, 2, 3, 5, 6, 7, 10]:
    for j in range(2, 11):
        if i**j <= 1000:
            num_list.append(i**j)

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for x in reversed(range(1, X+1)):
  flag = False
  for i in range(2,12):
    t = x**(1/i)
    if t.is_integer():
      print(x)
      flag = True
      break
  if flag:
    break

Submission status: Wrong Answer

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

for x in reversed(range(1, X+1)):
  flag = False
  for i in range(2,11):
    t = x**(1/i)
    if t.is_integer():
      print(x)
      flag = True
      break
  if flag:
    break

Submission status: Wrong Answer

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

for x in reversed(range(1, X+1)):
  t = sqrt(x)
  if t.is_integer():
    print(x)
    break

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

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():
    ma = -1
    X = int(input())
    for x in range(1,X+1):
        for p in range(2,X+1):
            if x ** p <= X:
                ma = max(ma,x**p)
            else:
                break
    print(ma)
if __name__ == '__main__':
  main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x = int(input())
if x==1:
    print(1)
else:
    for i in range(x):
        if i*i>x:
            break
        else:
            ix = i*i
    print(ix)