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:
from functools import reduce
from operator import mul

def main():
    N = int(input())

    ans = 1
    for i in range(N, 0, -1):
        n = prime_factors(i)
        if len(n) > 1 and len(set(n)) == 1:
            ans = reduce(mul, n)
            break
    print(ans)

def prime_factors(n):
    i = 2
    factors = []
    while i * i <= n:
        if n % i:
            i += 1
        else:
            n //= i
            factors.append(i)
    if n > 1:
        factors.append(n)
    return factors

main()

Submission status: Wrong Answer

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


def beki(n):
    max = 0
    if n == 1:
        return 1
    elif n == 2 or n == 3:
        return 1
    elif n == pow(math.sqrt(n),2):
        return n
    else:
        for i in range(2,math.ceil(math.sqrt(n))):
            j = int(math.log(n,i))
            if pow(i,j) > max:
                max = pow(i,j)
        return max


print(beki(N))

Submission status: Wrong Answer

Solution code:
x=int(input())
if x==1:
    print(1)
    import sys
    sys.exit()
ans=0
for b in range(2,x):
    bp=b**2
    while(True):
        if bp*b < x:
            bp=bp*b
            continue
        elif bp <= x <bp*b:
            ans=max(ans,bp)
            break
        else:
            break
print(ans)

Submission status: Wrong Answer

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

def beki(x):
    M = 1
    for p in range(2,int(math.sqrt(x))):
        for b in range(x):
            tmp =  pow(b,p)
            if tmp > M and tmp < x:
                M = tmp
    return (M)

result = beki(x)

print(result)

Submission status: Wrong Answer

Solution code:
listA = list(map(lambda i: i ** 2 ,range(33)))
X = int(input())
for j in range(len(listA)):
    if listA[j] > X:
        print(listA[j - 1])
        break

Submission status: Wrong Answer

Solution code:
n = int(input())

ans = 0

for i in range(2,n):
    flag = 0
    num = n
    num2 = i
    while True:
        num = num/i
        if(num > i):
            num2 = num2*i
            flag = 1
        else:
            break

    if(ans<num2 and flag == 1):
        ans=num2

print(ans)

Submission status: Wrong Answer

Solution code:
X = int(input())
s_list = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]
a_list = []
for s in s_list:
    for i in range(10):
        a = s ** i
        if a > 1000:
            break
        a_list.append(a)
a2 = sorted(list(set(a_list)), reverse=True)
for n in a2:
    if n <= X:
        print(n)
        break

Submission status: Wrong Answer

Solution code:
listA = list(map(lambda i: i ** 2 ,range(33)))
print(listA)
X = int(input())
for j in range(len(listA)):
    if listA[j] > X:
        print(listA[j - 1])
        break

Submission status: Wrong Answer

Solution code:
x = int(input())
ma = 0
for i in range(32):
    if x  < i ** 2:
        ma = (i-1) ** 2
        break
for i in range(12):
    if x <  i ** 3:
        max([ma,(i-1) ** 3])
        mb = max([ma,(i-1) ** 3])
        break
for i in range(5):
    if x < i ** 5:
        ma = max([ma, (i-1) ** 5])
        break
for i in range(3):
    if x  < i ** 7:
        ma = max([ma,(i-1) ** 5])
        break
print(ma)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math as ma

X=int(input())
tmpMax=0
for i in [2,3,5,7]:
    new=int(X**(1/i))**i
    tmpMax=max(tmpMax,new)
print(tmpMax)

Submission status: Wrong Answer

Solution code:
import math
x=int(input())
M=1
for i in range(2,x):
    log_x=int(math.log(x,i))
    #print(i**log_x)
    if log_x>=2:
        if i**log_x>M:
            M=i**log_x
print(M)

Submission status: Wrong Answer

Solution code:
from math import sqrt
x = int(input())
ans = 0
i = 2
while i <= sqrt(x):
    t = 2
    while i ** t < x:
        t += 1
    else:
        if i ** (t -1) > ans:
            ans = i ** (t -1)
    i += 1
if x < 4:
    print(1)
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
X= int(input().strip())
tmp = 1
endflag = 10000
for j in range(2,X):
    for i in range(1,X):
        if i**j>X and tmp<(i-1)**j and (i-1)**j<X:
            tmp = (i-1)**j
            endflag = i
            break
        elif i >= endflag:
            break
print(tmp)

Submission status: Wrong Answer

Solution code:
X=int(input())
max=0
for j in range(X):
    for i in range(X):
        if i**j<=X and i*j>max:
            max=i**j
print(max)

Submission status: Wrong Answer

Solution code:
X = int(input())
max = 0
if X < 100:
    for i in range(10):
        if i*i<=X:
            max = i*i
    print (max)
elif X < 400:
    for i in range(10,20):
        if i*i<=X:
            max = i*i
    print (max)
else:
    for i in range(20,32):
        if i*i<=X:
            max = i*i
    print (max)

Submission status: Wrong Answer

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


def beki(n):
    max = math.ceil(math.sqrt(n))
    if n == 1:
        return 1
    elif n == pow(math.sqrt(n),2):
        return n
    else:
        for i in range(2,max):
            j = int(math.log(n,i))
            if pow(i,j) > max:
                max = pow(i,j)
        return max


print(beki(N))

Submission status: Wrong Answer

Solution code:
import math

X = int(input())
sqrtX = math.floor(math.sqrt(X))
ans1 = sqrtX * sqrtX

# 解候補
anslist = [2**3, 2**5, 2**7, 2**9, 3**3, 3**5, 5**3, 7**3]
ans2 = 0
for num in anslist:
    if num <= X and num > ans1: ans2 = num

print(max(ans1,ans2))

Submission status: Wrong Answer

Solution code:
import math

X = int(input())

n = int(math.sqrt(X))
max_numbers = [1]
for i in range(1, n):
    index = int(math.log(X, i+1))
    max_numbers.append(math.pow((i+1), index))

print(int(max(max_numbers)))

Submission status: Wrong Answer

Solution code:
x = int(input())

i = 1
ans = 1
if x <= 4:
    ans = 1
else:
    i = 2
    while i < x:
        j = 2
        while i**j < x:
            if ans < i**j:
                ans = i**j
            j = j+1
        i = i+1

print(ans)

Submission status: Wrong Answer

Solution code:
import math
x=int(input())
p_able=[0 for i in range(1001)]
M=1
for i in range(2,x):
    log_x=int(math.log(x,i))
    if i**log_x>M:
        M=i**log_x
print(M)

Submission status: Wrong Answer

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

def beki(x):
    M = 0
    for p in range(int(math.sqrt(x))+1):
        for b in range(x):
            tmp =  pow(b,p)
            if tmp > M and tmp < x:
                M = tmp
    return M

result = beki(x)

print(result)

Submission status: Wrong Answer

Solution code:
x = int(input())
c = 1
max_ = 0
for i in range(100):
    for j in range(100):
        if(i ** j > x):
            continue
        if(i ** j > max_):
            max_ = i ** j
print(max_)

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:
import collections


def prime_decomp(j):
    if j == 1:
        return [1]

    num = j
    s = 0
    R = int(num)
    L = []
    while s == 0:
        for i in range(2, R+1):
            if num % i == 0:
                num = num/i
                if num == 1:
                    s = 1
                L.append(i)
                break

    return L


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

    for t in range(x):
        y = x - t
        nums = prime_decomp(y)
        counter = collections.Counter(nums)

        if len(counter) == 1:
            for key, val in counter.items():
                if val == 1:
                    continue

                else:
                    print(y)
                    exit()

        ans = True
        for key, val in counter.items():
            if val % 2 != 0:
                ans = False

        if ans:
            print(y)
            exit()

    print(1)

Submission status: Wrong Answer

Solution code:
lis=[1,2,4,8,16,32,64,128,256,512,9,27,81,243,729,25,125,625,216,36,343,49,100,1000]
for i in range(11,32):
    t=i*i
    lis.append(t)
listt=list(set(lis))
listt=sorted(listt)
a=int(input())
for i in range(300):
    if a <= listt[i]:
        print (listt[i-1])
        break

Submission status: Wrong Answer

Solution code:
lis=[1,2,4,8,16,32,64,128,256,512,9,27,81,243,729,25,125,625,216,36,343,49,100,1000]
for i in range(11,32):
    t=i*i
    lis.append(t)
listt=list(set(lis))
listt=sorted(listt)
print(listt)
a=int(input())
for i in range(300):
    if a <= listt[i]:
        print (listt[i-1])
        break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
num = int(input())
i, cur, pre = 0, 0, 0
for i in range(1000):
    cur = i**2
    if num < cur:
        print(pre)
        break
    pre = cur

Submission status: Wrong Answer

Solution code:
def main():
    
    inp = input()
    x = int(inp.strip())

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

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
#Exponential

#入力
X = int(input())

#計算
for i in range(1,X+1,1):
	if pow(i,2) > X:
		print("{}".format(pow(i-1,2)))
		exit()
	if pow(i,2) == X:
		print("{}".format(pow(i,2)))
		exit()

Submission status: Wrong Answer

Solution code:
x = int(input())

i = 1
p = 1
while i ** 2 < x:
    p = i ** 2
    i += 1
print(p)

Submission status: Wrong Answer

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

for i in range(X):
    i = int(i)
    num = i*i 
    if num > X:
        if ans < i:
            ans = i
print(ans)

Submission status: Wrong Answer

Solution code:
import math

x = int(input())
maxans = 1
for i in range(1, int(math.sqrt(x))):
    tmp = 0
    while (i+1)**tmp < x:
        b = (i+1)**tmp
        if maxans < (i+1)**tmp: maxans = (i+1)**tmp
        tmp += 1

print(maxans)

Submission status: Wrong Answer

Solution code:
import collections


def prime_decomp(j):
    if j == 1:
        return [1]

    num = j
    s = 0
    R = int(num)
    L = []
    while s == 0:
        for i in range(2, R+1):
            if num % i == 0:
                num = num/i
                if num == 1:
                    s = 1
                L.append(i)
                break

    return L


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

    for t in range(x):
        y = x - t
        nums = prime_decomp(y)
        counter = collections.Counter(nums)

        if len(counter) == 1:
            print(y)
            exit()

        ans = True
        for key, val in counter.items():
            if val % 2 != 0:
                ans = False

        if ans:
            print(y)
            exit()

    print(1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
listA = list(map(lambda i: i ** 2 ,range(80)))
X = int(input())
for j in range(len(listA)):
    if listA[j] > X:
        print(listA[j - 1])
        break

Submission status: Wrong Answer

Solution code:
X = int(input())

l = [0 for i in range(1001)]
k = 0
for i in range(32):
    for j in range(2,10):
        tmp = i ** j
        if tmp < 1000:
            l[k] = tmp
            k += 1
        else :
            break

l.sort()
for i in range(1001):
    if X < l[i]:
        print(l[i-1])
        break
else :
    print(l[-1])

Submission status: Wrong Answer

Solution code:
from math import log

def largest(x):
    l = 1
    b = 2
    p = int(log(x, b))
    while p >= 2:
        l = max(l, b ** p)
        b += 1
        p = int(log(x, b))
    return l

    
if __name__ == '__main__':
    print(largest(int(input())))

Submission status: Wrong Answer

Solution code:
listA = list(map(lambda i: i ** 2 ,range(80)))
X = int(input())
for j in range(len(listA)):
    if listA[j] >= X:
        print(listA[j - 1])
        break

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 or x == 2 or x == 3:
    print(1)
    quit()
for i in range(x+1):
    if check(x-i):
        print(x-i)
        quit()

Submission status: Wrong Answer

Solution code:
Num = [ 1, 4, 8, 9, 16, 25, 27, 32, 36, 49, 64, 81, 100, 121, 125, 
       128, 144, 169, 196, 216, 225, 243, 256, 289, 324, 343, 361, 
       400, 441, 484, 512, 529, 576, 625, 676, 729, 784, 841, 900, 961 ]

N = int(input())

out = 1

for i in Num:
    if i<=N:
        out = i
    else:
        break

print(out)

Submission status: Wrong Answer

Solution code:
import collections


def prime_decomp(j):
    if j == 1:
        return [1]

    num = j
    s = 0
    R = int(num)
    L = []
    while s == 0:
        for i in range(2, R+1):
            if num % i == 0:
                num = num/i
                if num == 1:
                    s = 1
                L.append(i)
                break

    return L


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

    for t in range(x):
        y = x - t
        nums = prime_decomp(y)
        counter = collections.Counter(nums)
        ans = True
        for key, val in counter.items():
            if val % 2 != 0:
                ans = False

        if ans:
            print(y)
            exit()

    print(1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
candidate = []
# べき乗リストを更新する
for i in range(32):
    if i >= 1:
        for j in range(32):
            if i**j <= 1000:
                if j > 1:
                    if i**j not in candidate:
                        candidate.append(i**j)
            else:
                break

candidate = sorted(candidate)
print(candidate)
x = int(input())
result = 1
for c in candidate[1:]:
    if x >= c:
        result = c
    else:
        break
print(result)

Submission status: Wrong Answer

Solution code:
N=int(input())
q=1
for i in range(0,N):
    for j in range(2,10):
        s=(N-i)**(1/j)
        if s==s//1:
            q=max(N-i,q)
print(q)

Submission status: Wrong Answer

Solution code:
from math import log
from math import floor
x = int(input())

y = []
for i in range(2,x):
    j = floor(log(x,i))
    if j>1 and i**j <= x:
        y.append(i**j)
if y == []:
    print(1)
else:
    print(max(y))

Submission status: Wrong Answer

Solution code:
import math
import collections

X = int(input())

def prime_factorization(n):
    factors = []
    while n > 1:
        old_n = n
        for i in range(2, 3 + int(math.sqrt(n))):
            if n % i == 0:
                factors.append(i)
                n = int(n / i)
                break
        if n == old_n:
            factors.append(n)
            break
    return factors

def is_power(n):
    factors = prime_factorization(n)
    c = collections.Counter(factors)
    
    if len(set(c.values())) == 1 and list(c.values())[0] > 1:
        return True
    else:
        return False
    
if X == 1:
    print(1)
for i in range(X-1, 1, -1):
    if is_power(i):
        print(i)
        break

Submission status: Wrong Answer

Solution code:
Num = [ 1, 4, 8, 9, 16, 25, 27, 32, 36, 49, 64, 81, 100, 121, 125, 
       128, 144, 169, 196, 216, 225, 243, 256, 289, 324, 343, 361, 
       400, 441, 484, 512, 529, 576, 625, 676, 729, 784, 841, 900, 961 ]

N = int(input())

out = 1

for i in Num:
    if i<N:
        out = i
    else:
        break

print(out)

Submission status: Wrong Answer

Solution code:
import math
X = int(input())
ans = []
for i in range(33):
    for j in range(10):
        if X >= pow(i,j):
            ans.append(pow(i,j))
print(max(ans))

Submission status: Wrong Answer

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

i = 1
for v in range(x):
    if i**2 > x:
        print((i-1)**2)
        exit()
    elif i**2 == x:
        print(i**2)
        exit()
    else:
        i += 1

Submission status: Wrong Answer

Solution code:
import numpy as np

X = int(input())
#print(X)


def MaxPow(X):
    Max = 1

    if int(np.sqrt(X)) ==1:
        return 1
    
    for b in range(2,int(np.sqrt(X))+1):
#        print(np.log(X)/np.log(b))
        for p in range(2,int(np.log(X)/np.log(b))+1):
#            print(p)
            Max = max(Max,b**p)
    return Max

print(MaxPow(X))

Submission status: Wrong Answer

Solution code:
import math
x=int(input())
cand=[1 for i in range(1001)]
for i in range(2,1001):
    cand[i]=int(pow(x,1.0/i))**i
print(max(cand))

Submission status: Wrong Answer

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

X = int(input())
sq = int(math.sqrt(X))

ans = 1
for i in range(2, sq+1):
    for j in range(2, sq+1):
        if i ** j < X and ans < i ** j:
            ans = i ** j
            continue
print(ans)

Submission status: Wrong Answer

Solution code:
import math
X = int(input())
ans = []
for i in range(32):
    for j in range(9):
        if X >= pow(i,j):
            ans.append(pow(i,j))
print(max(ans))

Submission status: Wrong Answer

Solution code:
x = int(input())

i = 1
ans = 1
if x <= 4:
    ans = 1
else:
    i = 2
    while i*i < x:
        j = 2
        while i**j < x:
            if ans < i**j:
                ans = i**j
            j = j+1
        i = i+1

print(ans)

Submission status: Wrong Answer

Solution code:
x = int(input())
m =0
for i in range(2,11):
    m=max(m,int(((x**(1/i))//1)**i))
print(m)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a = int(input())

for i in range(1,10001):
    if a < i**2:
        print((i-1)**2)
        break

Submission status: Wrong Answer

Solution code:
N=int(input())
q=1
for i in range(1,N):
    for j in range(2,10):
        s=(N-i)**(1/j)
        if s==s//1:
            q=max(N-i,q)
print(q)

Submission status: Wrong Answer

Solution code:
#Exponential

#入力
X = int(input())

#計算
for i in range(1,X+1,1):
	if i*i >= X:
		if i == 1:
			print("1")
			exit()
		print("{}".format((i-1)*(i-1)))
		exit()

Submission status: Wrong Answer

Solution code:
X = int(input())
maximumList = []

#32^2=1024なので、2～31までで試せばいい

if X <= 3:
    print(1)
else:    
    for b in range(2,32):
        p = 2
        while b**p <= 1000:
            p += 1
        else:
            maximumList.append(b**(p-1))
    print(max(maximumList))

Submission status: Wrong Answer

Solution code:
import math

X = int(input())

n = int(math.sqrt(X))
print(n*n)

Submission status: Wrong Answer

Solution code:
import math

N = int(input())

M = math.floor(math.sqrt(N))

print(M**2)

Submission status: Wrong Answer

Solution code:
import math
X = int(input())
ans = 0
for i in range(32):
    for j in range(9):
        if X >= pow(i,j):
            ans = max(ans, pow(i,j))
print(ans)

Submission status: Wrong Answer

Solution code:
x = int(input())
max = 0
if x == 1:
    print(1)
    exit()
for b in range(2, 1000):
    for p in range(10):
        if b**p <= x:
            if b**p >= max:
                max = b**p
print(max)

Submission status: Wrong Answer

Solution code:
import math
x=int(input())
log_x=int(math.log(x,2))
cand=[1 for i in range(x)]
for i in range(2,log_x+1):
    cand[i]=int(pow(x,1.0/i))**i
print(max(cand))

Submission status: Wrong Answer

Solution code:
def main8():
    str = input('');
    buf = str.split();
    num = int(buf[0]);
    i = 0;
    while(True):
        i = i + 1;
        if i * i <= num and num < (i+1)*(i+1):
            print(i*i);
            break;



if __name__ == '__main__':
    main8()

Submission status: Wrong Answer

Solution code:
from math import log, floor
x = int(input())
ans = 1
for b in range(2, x):
    p = floor(log(x,b))
    if p <= 1: continue
    tmp = b**p
    ans = max(ans, tmp)

print(ans)

Submission status: Wrong Answer

Solution code:
import math

X=int(input())

y=math.floor(math.sqrt(X))

L=[0 for i in range(y+1)]

for i in range(2,y+1):
    count=1
    while True:
        n=i**count
        if n<=X:
            count+=1
        else:
            break
    L[i]=i**(count-1)

print(max(L))

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

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

sqrt = math.sqrt(x)
floor = math.floor(sqrt)
print(floor ** 2)

Submission status: Wrong Answer

Solution code:
#coding: utf-8
import math

x = int(input())

maxcount = int(math.sqrt(x))

result = 0
for i in range(1,maxcount+ 1):
    j = 0
    while True:
        tmp = i ** (maxcount - j)
        j += 1
        if tmp > x:
            continue
        else:
            break
    print(tmp)
    if tmp > result and tmp <= x:
        result = tmp

print(result)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

i = 1
for v in range(x):
    if i**2 > x:
        print((i-1)**2)
        exit()
    else:
        i += 1

Submission status: Wrong Answer

Solution code:
x = int(input())

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

Submission status: Wrong Answer

Solution code:

def prime_decomp(j):
    if j == 1:
        return [1, 1]

    num = j
    s = 0
    R = int(num)
    L = []
    while s == 0:
        for i in range(2, R+1):
            if num % i == 0:
                num = num/i
                if num == 1:
                    s = 1
                L.append(i)
                break

    return L


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

    for t in range(x):
        y = x - t
        nums = prime_decomp(y)
        # print(y, nums)
        if len(set(nums)) == 1 and len(nums) > 1:
            print(y)
            break

Submission status: Wrong Answer

Solution code:
#coding: utf-8
import math

x = int(input())

maxcount = int(math.sqrt(x))

result = 0
for i in range(1,maxcount):
    j = 0
    while True:
        tmp = i ** (maxcount - j)
        j += 1
        if tmp > x:
            continue
        else:
            break
    print(tmp)
    if tmp > result and tmp <= x:
        result = tmp

print(result)

Submission status: Wrong Answer

Solution code:
import math as ma

X=int(input())
print(int(ma.sqrt(X))**2)

Submission status: Wrong Answer

Solution code:
x = int(input())
max = 0
for b in range(100):
    for p in range(100):
        if b**p <= x and b**p >= max:
            max = b**p
print(max)

Submission status: Wrong Answer

Solution code:
n = int(input())
result = 0
for b in range(n):
  for p in range(n):
    if b**p >= n and result < b**p:
      result = b**p
      break

print(int(result))

Submission status: Wrong Answer

Solution code:
import math as m

N = int(input())

M = m.floor(m.sqrt(N))

print(M**2)

Submission status: Wrong Answer

Solution code:
import math
x=int(input())
log_x=int(math.log(x,2))
cand=[0 for i in range(x)]
cand[0]=1
for i in range(2,log_x):
    cand[i]=int(pow(x,1.0/i))**i
print(max(cand))

Submission status: Wrong Answer

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

if X == 1:
  print(1)
  exit()
  
for b in range(2, 32):
    p = 0
    while b ** (p+1) <= X:
        p += 1
    ans = max(ans, b**p)

print(ans)

Submission status: Wrong Answer

Solution code:
x = int(input())
maximum = 1
for i in range(1,32):
  if i*i <= x and i*i > maximum:
    maximum = i*i

for i in range(1, 11):
  if i*i*i <= x and i*i*i > maximum:
    maximum = i*i*i

print(maximum)

Submission status: Wrong Answer

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


def beki(n):
    max = math.ceil(math.sqrt(n))
    if n == 1:
        return 1
    else:
        for i in range(2,max):
            j = int(math.log(n,i))
            if pow(i,j) > max:
                max = pow(i,j)
        return max


print(beki(N))

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)
    for i in range(2, 11):
        tmp = pow(i, 3)
        if tmp < X and tmp > buf:
            buf = tmp
    for i in range(2, 6):
        tmp = pow(i, 4)
        if tmp < X and tmp > buf:
            buf = tmp
    for i in range(2, 4):
        tmp = pow(i, 5)
        if tmp < X and tmp > buf:
            buf = tmp
    for i in range(2, 4):
        tmp = pow(i, 6)
        if tmp < X and tmp > buf:
            buf = tmp
    for i in range(7, 11):
        tmp = pow(2, i)
        if tmp < X and tmp > buf:
            buf = tmp
    print(buf)

Submission status: Wrong Answer

Solution code:
import math
a, = list(map(int, input().split()))
print(int(math.sqrt(a))**2)

Submission status: Wrong Answer

Solution code:
import math

X=int(raw_input())

r=1
for i in range(2,X+1):
  m = int(math.log(X, i))
  if m > 1 and r < i**m:
    r = i**m

print r

Submission status: Wrong Answer

Solution code:
import math
x=int(input())
log_x=int(math.log(x,2))
cand=[0 for i in range(x)]
cand[0]=1
for i in range(2,log_x):
    print(int(pow(x,1.0/i)))
    cand[i]=int(pow(x,1.0/i))**i
print(max(cand))

Submission status: Wrong Answer

Solution code:
X = int(input())

prime_num = range(2, 32)
num_list = [1]

for p in prime_num:
    i = 2
    while p ** i <= X:
        i += 1
    num_list += [p ** (i - 1)]

print(max(filter(lambda x: x <= X, num_list)))

Submission status: Wrong Answer

Solution code:
candidate = []
for i in range(32):
    if i >= 0:
        candidate.append(i*i)
# print(candidate)
x = int(input())
result = 1
for c in candidate[1:]:
    if x >= c:
        result = c
    else:
        break
print(result)

Submission status: Wrong Answer

Solution code:
from math import  sqrt,log
X=int(input())
a=int(sqrt(X))
lists=[1]
for i in range(2,a+1):
    c=int(log(X,i))
    lists.append(i**c)
print(max(lists))

Submission status: Wrong Answer

Solution code:
import math

x = int(input())
for i in range(x, 0, -1):
    if math.sqrt(i).is_integer():
        print(i)
        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=1
for i in range(math.floor(k)+2):
	for j in range(2,n+1):
		if(pow(i,j)<=n):
			ans=pow(i,j)
print(ans)

Submission status: Wrong Answer

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

ans = int(math.sqrt(x))

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
candidate = []
for i in range(32):
    if i >= 0:
        candidate.append(i*i)
# print(candidate)
x = int(input())
result = 1
for c in candidate[1:]:
    if x > c:
        result = c
    else:
        break
print(result)

Submission status: Wrong Answer

Solution code:
if __name__ == '__main__':
    X = int(input())

    candidates = [1]
    for b in range(2, 31 + 1):
        p = 1
        while True:
            p += 1
            value = b ** p
            if value <= 1000:
                candidates.append(value)
            else:
                break

    candidates = sorted(set(candidates))
    for i in range(len(candidates) - 1):
        if candidates[i] <= X and X < candidates[i + 1]:
            print(candidates[i])
            exit(0)

Submission status: Wrong Answer

Solution code:
from math import sqrt, floor

X = int(input())

for i in range(X, 0, -1):
    if sqrt(i) == floor(sqrt(i)):
        print(i)
        break

Submission status: Wrong Answer

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

print(max(ans_2, ans_3))

Submission status: Wrong Answer

Solution code:
X = int(input())
ans = []
for m in range(2, 10):
    for n in range(1, int(X**(1/m)) + 1):
        if n**m <= X:
            ans.append(n**m)
print(max(ans))

Submission status: Wrong Answer

Solution code:
import math

x = input()
x = float(x)

tempA = math.floor(math.sqrt(x))
tempB = tempA ** 2
print(tempB)

Submission status: Wrong Answer

Solution code:
X = int(input())

prime_num = range(2, 32)
num_list = [1]

for p in prime_num:
    i = 1
    while p ** i <= X:
        i += 1
    num_list += [p ** (i - 1)]

print(max(num_list))

Submission status: Wrong Answer

Solution code:
# coding: utf-8
x = int(input())
max = 1
for i in range(1,x):
    if i*i >= max and i*i <= x:
        max = i*i

print(max)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math

X=int(raw_input())

r=1
for i in range(2,X):
  m = int(math.log(X, i))
  if m > 1 and r < i**m:
    r = i**m

print r

Submission status: Wrong Answer

Solution code:
x = int(input())

n = 1
while((n+1)**2 <= x):
    n += 1
print(n**2)

Submission status: Wrong Answer

Solution code:
import math

X = int(input())
sqrtX = math.sqrt(X)

floorX = math.floor(sqrtX)
print(floorX * floorX)

Submission status: Wrong Answer

Solution code:
def main():
    X = int(input())
    if X == 1000:
        return 1000

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

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