Problem:


Score : 200 points

Problem Statement

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

Constraints

1 ≤ X ≤ 1000

X is an integer.

Input

Input is given from Standard Input in the following format:

X

Output

Print the largest perfect power that is at most X.

Sample Input 1

10

Sample Output 1

9

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

Sample Input 2

1

Sample Output 2

1

Sample Input 3

999

Sample Output 3

961



Sample input:
10


Sample output:
9

Submission status: Wrong Answer

Solution code:
import sys
x = int(raw_input())
# a = [int(raw_input()) for i in xrange(n)]
# a,b,c,d = map(int, raw_input().split())

p = [3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997]

def isPowerOfTwo(n):
    return (n > 0) and (n & (n - 1) == 0)

# s = raw_input()
# k = int(raw_input())


# print "".join(["a","b"])

# print "Yes" if 3 > 0 else "No"
if x < 4:
    print 1
    sys.exit()

while x > 1:
    n = x

    if isPowerOfTwo(x) == True:
        print x
        sys.exit()
    if x == 2 or x in p:
        x-=1
        continue
    for i in p:
        n = x
        while True:
            if n % i != 0:
                break
            n /= i

            if n == 1:
                print x
                sys.exit()
    x-=1
print 1

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x=int(raw_input())
a=x**(1.0/2)
a=a-a%1
if(a**2==x): 
    a=(x-1)**(1.0/2)
    print("%d"%(a-a%1)**2)
else: print("%d"%a**2)

Submission status: Wrong Answer

Solution code:
X = int(input())

l = [1 for i in range(1001)]
k = 0

for i in range(2,32):
    for j in range(2,i):
        if i % j == 0 and i != j :
            break
    else :
        for j in range(2,11):
            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:
import sys
import math

X = int(sys.stdin.readline().strip())

mx = 1
for b in range(2, X):
    for p in range(2, int(math.log(X, b))+1):
        a = b ** p
        if a >= mx:
            mx = a

print(mx)

Submission status: Wrong Answer

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

sq = math.floor(math.pow(x,(1.0/2)))
cb = math.floor(math.pow(x,(1.0/3)))

tmp = 0

if sq*sq < cb*cb*cb:
    print(cb*cb*cb)
else:
    print(sq*sq)

Submission status: Wrong Answer

Solution code:
import math

x = int(input())

l = [1]

for i in range(x, 0, -1):
    if math.sqrt(i).is_integer():
        l.append(i)

    for j in range(2, 5):
        if pow(i, j) <= x:
            l.append(pow(i, j))

print(max(l))

Submission status: Wrong Answer

Solution code:
import math

X = int(input())
while True:
    a = math.sqrt(X)
    if a.is_integer() == True:
        break
    else:
        X = X - 1
print(X)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:

X = int(input())

maxVal1 = 0
maxVal2 = 0
maxVal3 = 0
val = 0


for i in range(33):
	if i**2 > X:
		maxVal1 = i-1
		break

for j in range(12):
	if j**3 > X:
		maxVal2 = j-1
		break

for k in range(7):
	if k**4 > X:
		maxVal3 = k-1
		break


maxVal = max(maxVal1**2, maxVal2**3, maxVal3**4)
print(maxVal)

Submission status: Wrong Answer

Solution code:
x=int(raw_input())-1
a=x**(1.0/2)
a=a-a%1
print("%d"%a**2)

Submission status: Wrong Answer

Solution code:
import math

X = int(input())
while True:
    a = math.sqrt(X)
    if a.is_integer() == True:
        break
    else: X = X - 1

print(int(X))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
x = int(raw_input())
# a = [int(raw_input()) for i in xrange(n)]
# a,b,c,d = map(int, raw_input().split())

p = [3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997]

def isPowerOfTwo(n):
    return (n > 0) and (n & (n - 1) == 0)

# s = raw_input()
# k = int(raw_input())


# print "".join(["a","b"])

# print "Yes" if 3 > 0 else "No"
if x < 4:
    print 1
    sys.exit()

while True:
    n = x

    if isPowerOfTwo(x) == True:
        print x
        sys.exit()
    if x == 2 or x in p:
        x-=1
        continue
    for i in p:
        n = x
        while True:
            if n % i != 0:
                break
            n /= i

            if n == 1:
                print x
                sys.exit()
    x-=1

Submission status: Wrong Answer

Solution code:
import math

X = int(input())
while True:
    a = math.sqrt(X)
    if a.is_integer() == True:
        break
    else: X -= 1

print(X)

Submission status: Wrong Answer

Solution code:

X = int(input())

maxVal = 0
val = 0


for i in range(33):
	if i**2 > X:
		val = i-1
		maxVal = max(maxVal, val)

for i in range(12):
	if i**2 > X:
		val = i-1
		maxVal = max(maxVal, val)

for i in range(7):
	if i**2 > X:
		val = i-1
		maxVal = max(maxVal, val)

print(maxVal)

Submission status: Wrong Answer

Solution code:
import math
import numpy as np

x = int(input())
x_sqrt = math.sqrt(x)
maxlist = []

def hoge(x, x_sqrt):
    for b in range(2, x_sqrt+1):
        i = 1
        while b ** i <= x:
            i += 1
        maxlist.append(b **(i-1))
    print(maxlist)
    return np.max(np.array(maxlist))

if x - x_sqrt == 0:
    print(x)
else:
    print(hoge(x, int(x_sqrt)))

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:
x = int(input())

ans = 1
for i in range(15):
    for j in range(35):
        tes = (j+1)**(i+1)
        if tes <= x and tes >= ans:
            ans = tes

print(ans)

Submission status: Wrong Answer

Solution code:
x = int(input())
max1 = 1
for s in range(x):
  for t in range(10):
    if pow(s,t) > max1 and pow(s,t) <= x:
      max1 = pow(s,t)
print(max1)

Submission status: Wrong Answer

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

l = [1]
for i in range(1, x):
    if math.sqrt(i).is_integer():
        l.append(i)
        continue
    
    if pow(2, i) <= x:
        l.append(pow(2, i))
        continue
    
    if pow(3, i) <= x:
        l.append(pow(3, i))
        continue
    
    if pow(4, i) <= x:
        l.append(pow(4, i))
        
print(max(l))

Submission status: Wrong Answer

Solution code:
a = int(input())
l = []
for i in range(1,100):
    for j in range(1,10):
        l.append(i**j)
l.sort()
for n in range(len(l)):
    if l[n] > a:
        print(l[n-1])
        break

Submission status: Wrong Answer

Solution code:
x = int(input())

ans = 1
for i in range(32):
    for j in range(10):
        tes = (i+1)**(j+1)
        if tes <= x and tes >= ans:
            ans = tes

print(ans)

Submission status: Wrong Answer

Solution code:
X = int(input())

def soin(x):
    li = []
    a = 2
    while x >= a * a:
        if x % a == 0:
            li.append(a)
            x //= a
        else:
            a += 1

    li.append(x)
    return(li)


for i in range(X + 1)[::-1]:
    li = soin(i)
    if len(li) == 1:
        continue
    if len(list(set(li))) == 1:
        print(i)
        break

else:
    print(1)

Submission status: Wrong Answer

Solution code:
X = int(input())
a_list = []
for s in range(1, 31):
    for i in range(2, 10):
        a = s ** i
        if a > 1000:
            break
        a_list.append(a)
a2 = sorted(list(set(a_list)), reverse=True)
a2.append(1)
for n in a2:
    if n <= X:
        print(n)
        break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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


beki = [1]
for i in range(2,32):
    j = int(math.log(1000,i))
    beki = beki + [pow(i,j_prime) for j_prime in range(2,j+1)]
beki + [1000]
beki_uniq = list(set(beki))
beki_small = max([i for i in beki_uniq if i <= N])


print(beki_small)

Submission status: Wrong Answer

Solution code:
a = (1,4,8,9,16,25,27,32,36,49,64,81,100,121,125,128,144,169,196,216,225,256,289,243,324,343,361,400,441,476,484,512,529,576,625,676,729,784,841,900,961,1000)
k = int(input())
for i in range(len(a)):
  if k == 1:
    print(1)
    break
  elif k == 1000:
    print(1000)
    break
  
  elif a[i] > k:
    print(a[i-1])
    break

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 Max
    
    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):
            tmp = b**p
            if tmp<=X:
                Max = max(Max,tmp)
    return Max

print(MaxPow(X))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
x = int(input())
a = []
for i in range(3):
    a.append(math.floor(math.pow(x,(1.0/(i+2)))))


tmp = 0
for i in range(3):

    if tmp < a[i]*a[i]:
        tmp = a[i]*a[i]

print(tmp)

Submission status: Wrong Answer

Solution code:
N = int(input())
max = 0
 
x = [1,2,4,8,16,32,64,128,256,512,3,9,27,81,243,729,5,25,125,625,6,36,216,7,49,343,10,100,1000,11**2,
12**2,
13**2,
14**2,
15**2,
16**2,
17**2,
18**2,
19**2,
20**2,
21**2,
22**2,
23**2,
24**2,
25**2,
26**2,
27**2,
28**2,
29**2,
30**2,
31**2,
]
 
for i in range(len(x)):
    if N > int(x[i]) :
        if max < int(x[i]) :
            max = int(x[i])
print(max)

Submission status: Wrong Answer

Solution code:
x = int(input())

sosu = [2,3,5,7,11,13,17,19,23,29,31]

ans = 1
for i in range(len(sosu)):
  now = sosu[i]
  for j in range(1,11):
    now = now*sosu[i]
    if(now <= x and ans <= now):
      ans = now
    if(now > x):
      break
print(ans)

Submission status: Wrong Answer

Solution code:
import math
import numpy as np
def main():
    x = int(input())
    l=np.arange(int(math.sqrt(x)+1))
    i_max = 0
    for i in l:
        i_max_test = 0
        n = 2
        if i != 0 and i != 1:
            while i**n <= x:
                n += 1
            if i**(n-1) > i_max :
                i_max = i**(n-1)
    print(i**(n-1))
                

main()

Submission status: Wrong Answer

Solution code:
import math
x = int(input())
a = []
for i in range(3):
    a.append(math.floor(math.pow(x,(1.0/(i+2)))))

print(a)
tmp = 0
for i in range(3):

    if tmp < a[i]*a[i]:
        tmp = a[i]*a[i]

print(tmp)

Submission status: Wrong Answer

Solution code:
import math

X = int(input())
p = 2
while p > 1:
    a = math.sqrt(X)
    if a.is_integer() == True:
        p = 0
    else: X -= 1

print(X)

Submission status: Wrong Answer

Solution code:
x = int(input())
import math
flag = False
for i in range(x):
    ans = x - i
    for j in range(2,10):
        b = math.pow(ans, 1/j)
        if b % 1 == 0:
            flag = True
            break
    if flag:
        break
print(ans)

Submission status: Wrong Answer

Solution code:
x = int(input())
max1 = 1
for s in range(x):
  for t in range(12):
    if pow(s,t) > max1 and pow(s,t) <= x:
      max1 = pow(s,t)
print(max1)

Submission status: Wrong Answer

Solution code:
#Exponential

#入力
X = int(input())
ans = []
#計算
for j in range(2,11,1):
	for i in range(1,X+1,1):
		if pow(i,j) > X:
			ans.append(pow(i-1,2))
			break
		if pow(i,j) == X:
			ans.append(pow(i,2))
			break

print("{}".format(max(ans)))

Submission status: Wrong Answer

Solution code:
a = (1,4,8,9,16,25,27,32,36,49,64,81,100,121,125,128,144,169,196,216,225,256,289,243,324,343,381,400,441,476,484,512,529,576,625,676,729,784,841,900,961,1000)
k = int(input())
for i in range(len(a)):
  if k == 1:
    print(1)
    break
  elif k == 1000:
    print(1000)
    break
  
  elif a[i] > k:
    print(a[i-1])
    break

Submission status: Wrong Answer

Solution code:
X = int(input())
s_list = [2, 3, 5, 7, 10, 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(2, 10):
        a = s ** i
        if a > 1000:
            break
        a_list.append(a)
a2 = sorted(list(set(a_list)), reverse=True)
a2.append(1)
for n in a2:
    if n <= X:
        print(n)
        break

Submission status: Wrong Answer

Solution code:
N = int(input())
max = 0
 
x = [1,2,4,8,16,32,64,128,256,512,3,9,27,81,243,729,5,25,125,625,6,36,216,7,49,343,10,100,1000,11**2,
12**2,
13**2,
14**2,
15**2,
16**2,
17**2,
18**2,
19**2,
20**2,
21**2,
22**2,
23**2,
24**2,
25**2,
26**2,
27**2,
28**2,
29**2,
30**2,
31**2,
]
 
for i in range(len(x)):
    if N >= int(x[i]) :
        if max < int(x[i]) :
            max = int(x[i])
print(max)

Submission status: Wrong Answer

Solution code:
a, = list(map(int, input().split()))
max_num = 0
for base in range(2, a):
    for index in range(2, a):
        ret = base ** index
        if ret <= a:
            if ret >= max_num:
                max_num = ret
        else:
            break
print(max_num)

Submission status: Wrong Answer

Solution code:
x = int(input())
max1 = 1
for s in range(x):
  for t in range(11):
    if pow(s,t) > max1 and pow(s,t) < x:
      max1 = pow(s,t)
print(max1)

Submission status: Wrong Answer

Solution code:
x = int(input())

# l[base][shoulder]
l = [[0 for i in range(10)] for i in range(32)]

ans = 1
for i in range(10):
    for j in range(32):
        tes = (j+1)**(i+1)
        if tes <= x and tes >= ans:
            ans = tes

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
max = 0
 
x = [1,2,4,8,16,32,64,128,256,512,3,9,27,81,243,729,5,25,125,625,6,36,216,7,49,343,10,100,11**2,
12**2,
13**2,
14**2,
15**2,
16**2,
17**2,
18**2,
19**2,
20**2,
21**2,
22**2,
23**2,
24**2,
25**2,
26**2,
27**2,
28**2,
29**2,
30**2,
31**2,
]
 
for i in range(len(x)):
    if N >= int(x[i]) :
        if max < int(x[i]) :
            max = int(x[i])
print(max)

Submission status: Wrong Answer

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

max = 0;

for i in range(x):
    for j in range(x):
        num = i**j;
        if num > max and x >= num:
            max = num

print(max)

Submission status: Wrong Answer

Solution code:
x = int(input())
max1 = 1
for s in range(x):
  for t in range(11):
    if pow(s,t) > max1 and pow(s,t) <= x:
      max1 = pow(s,t)
print(max1)

Submission status: Wrong Answer

Solution code:
a, = list(map(int, input().split()))
max_num = 0
for index in range(2, a):
    for base in range(2, a):
        ret = base ** index
        if ret < a:
            if ret > max_num:
                max_num = ret
        else:
            break
print(max_num)

Submission status: Wrong Answer

Solution code:

X = int(input())
maxnum = 0
beki = 0
for b in range(X,1,-1):
    for p in range(X,1,-1):
        beki = b ** p
        if X > beki > maxnum:
            maxnum = beki
            break
    if maxnum != 0:
        break
print(maxnum)

Submission status: Wrong Answer

Solution code:
X = int(input())

def soin(x):
    li = []
    a = 2
    while x >= a * a:
        if x % a == 0:
            li.append(a)
            x //= a
        else:
            a += 1

    li.append(x)
    return(li)


for i in range(X + 1)[::-1]:
    li = soin(i)
    if len(li) == 1:
        print(1)
        break
    if len(list(set(li))) == 1:
        print(i)
        break

Submission status: Wrong Answer

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


beki = [1]
for i in range(2,32):
    j = int(math.log(1000,i))
    beki = beki + [pow(i,j_prime) for j_prime in range(2,j+1)]
beki_uniq = list(set(beki))
beki_small = max([i for i in beki_uniq if i <= N])


print(beki_small)

Submission status: Wrong Answer

Solution code:
a = (1,4,8,9,16,25,27,32,36,49,64,81,100,121,125,128,144,169,196,216,225,256,289,243,324,343,381,400,441,464,476,512,529,576,625,676,729,784,841,900,961,1000)
k = int(input())
for i in range(len(a)):
  if k == 1:
    print(1)
    break
  elif k == 1000:
    print(1000)
    break
  
  elif a[i] > k:
    print(a[i-1])
    break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
max = 0

x = [
    1,
    2,
    4,
    8,
    16,
    32,
    64,
    128,
    256,
    512,
    3,
    6,
    9,
    27,
    81,
    243,
    729,
    5,
    25,
    125,
    625,
    36,
    216,
    7,
    49,
    343,
    10,
    100,
    11**2,
    12**2,
    13**2,
    14**2,
    15**2,
    16**2,
    17**2,
    18**2,
    19**2,
    20**2,
    21**2,
    22**2,
    23**2,
    24**2,
    25**2,
    26**2,
    27**2,
    28**2,
    29**2,
    30**2,
    31**2,
    ]

for i in range(len(x)):
    if N >= int(x[i]) :
        if max < int(x[i]) :
            max = int(x[i])
print(max)

Submission status: Wrong Answer

Solution code:
x = int(input())

value = 1

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
num=int(input())
n=r=0
for i in range(int(math.sqrt(num))+1):
  if num>=n:
    for j in range(num):
      if num>=i^j and num>=r:
        r=i^j
print(r)

Submission status: Wrong Answer

Solution code:
ansList = []
for i in range(1,33):
    for j in range(1,33):
        judge = i ** j
        if(judge <=1000 and judge not in ansList):
            ansList.append(judge)
ansList = sorted(ansList)
#print(ansList)
X = int(input())
temp = 0
for l in ansList:
    if(X >= l):
        temp = l

print(temp)

Submission status: Wrong Answer

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

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

print(y*y)

Submission status: Wrong Answer

Solution code:
X = int(input())
maxnum = 0
beki = 0
for b in range(1,X):
    for p in range(2,X):
        beki = b ** p
        if X > beki:
            maxnum = beki
        
print(maxnum)

Submission status: Wrong Answer

Solution code:
x = int(input())
a = 1
for i in range(1, 10) :
    for b in range(1, 32) :
        if( b**i<=x and a<=b**i ) :
            a = b**i
print("{}".format(a))

Submission status: Wrong Answer

Solution code:
a = (1,4,8,9,16,25,27,32,36,49,64,81,100,121,125,128,144,169,196,216,225,256,289,243,324,343,381,400,441,464,512,529,476,625,676,729,784,841,900,961,1001)
k = int(input())
for i in range(len(a)):
  if k == 1:
    print(1)
    break
  
  elif a[i] > k:
    print(a[i-1])
    break

Submission status: Wrong Answer

Solution code:
x = int(input())
a = 1
for i in range(1, 10) :
    for b in range(1, 32) :
        if( b**i<=x and a<b**i ) :
            a = b**i
print("{}".format(a))

Submission status: Wrong Answer

Solution code:
# 整数の入力
X = int(input())

# Xのn乗根が整数かどうかで判定を行う
l = list(range(1, 1 + X))
l.reverse()
found = False

for n in l:
    i = 2
    while True:
        root_n = n ** (1 / i)
        if root_n < 2:
            break

        if int(root_n) ** i == n:
            found = True
            break

        i += 1

    if found:
        break

print(n)

Submission status: Wrong Answer

Solution code:
num = int(input())

cur, pre = 1, 1
for i in range(1, 1001):
    cur = i**2
    if num < cur:
        print(pre)
        break
    pre = cur

Submission status: Wrong Answer

Solution code:
import sys
x = int(raw_input())
# a = [int(raw_input()) for i in xrange(n)]
# a,b,c,d = map(int, raw_input().split())

p = [3, 5, 7, 11, 13, 17, 19, 23, 29, 31]

def isPowerOfTwo(n):
    return (n > 0) and (n & (n - 1) == 0)

# s = raw_input()
# k = int(raw_input())


# print "".join(["a","b"])

# print "Yes" if 3 > 0 else "No"

while True:
    n = x
    if isPowerOfTwo(x) == True:
        print x
        sys.exit()
    for i in p:
        n = x
        while True:
            if n % i != 0:
                break
            n /= i
            if n == 1:
                print x
                sys.exit()
    x-=1

Submission status: Wrong Answer

Solution code:
x = int(input())

value = 1

while True:
    if value ** 2 > x:
        print((value-1) ** 2)
        break
    else:
        value += 1

Submission status: Wrong Answer

Solution code:
import math
xx = input()

print max([ x ** int(math.log(xx,x)) for x in range(2,32)])

Submission status: Wrong Answer

Solution code:
X = int(input())

def soin(x):
    li = []
    a = 2
    while x >= a * a:
        if x % a == 0:
            li.append(a)
            x //= a
        else:
            a += 1

    li.append(x)
    return(li)

if X == 1:
    print(1)
elif X == 2:
    print(2)
elif X == 3:
    print(3)
else:
    for i in range(X + 1)[::-1]:
        li = soin(i)
        if len(li) > 1 and len(list(set(li))) == 1:
            print(i)
            break

Submission status: Wrong Answer

Solution code:
import math

X = int(input())
p = 2
while p > 1:
    a = math.sqrt(X)
    if a % 1 ==0:
        p = 0
    else: X -= 1

print(X)

Submission status: Wrong Answer

Solution code:
x = int(input())

sosu = [2,3,5,7,11,13,17,19,23,29,31]

ans = 1
for i in range(len(sosu)):
  now = sosu[i]
  for j in range(1,11):
    now = now*sosu[i]
    if(now <= x and ans <= now):
      ans = now

print(ans)

Submission status: Wrong Answer

Solution code:
X = int(input())

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

Submission status: Wrong Answer

Solution code:
ansList = []
for i in range(1,33):
    for j in range(1,33):
        judge = i ** j
        if(judge <=1000 and judge not in ansList):
            ansList.append(judge)
ansList = sorted(ansList)
print(ansList)
X = int(input())
temp = 0
for l in ansList:
    if(X >= l):
        temp = l

print(temp)

Submission status: Wrong Answer

Solution code:
X = int(input())

flag = False
for x in range(X):
    n = X - x
    m = 0
    for i in range(2, n+1):
        while True:
            if n % i == 0:
                if m == 0:
                    m = i
                elif m != i:
                    break
                n = n // i
                if n == 1 and m != X - x:
                    flag = True
                if flag:
                    break
            else:
                break
        if flag:
            break
    if flag:
        break
if flag:
    print(X - x)
else:
    print(1)

Submission status: Wrong Answer

Solution code:
num=[1,4,8,16,32,64,128,256,512,9,27,81,243,729,25,125,625,49,343,121,144,169,196,225,256,289,324,361,400,441,484,529,576,625,676,729,784,841,900,961]
num.sort()
x=int(input())
ans=1
for i in range(len(num)):
    if num[i]<=x:
        ans=num[i]
print(ans)

Submission status: Wrong Answer

Solution code:
x = int(input())

sosu = [2,3,5,7,11,13,17,19,23,29,31]

ans = 1
for i in range(len(sosu)):
  now = sosu[i]
  for j in range(1,11):
    now = now*sosu[i]
    if(now <= x and ans <= now):
      ans = now
    if(now > x):
      break

print(ans)

Submission status: Wrong Answer

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

    ans = 0
    for b in range(1, N):
        for p in range(2, N):
            n = b ** p
            if n <= N:
                ans = max(ans, n)
            else:
                break
    print(ans)

main()

Submission status: Wrong Answer

Solution code:
import math as m

N = int(input())
max = 0

x = [1,2,4,8,16,32,64,128,256,512,3,9,27,81,243,729,5,25,125,625,6,36,216,7,49,343,11**2,
12**2,
13**2,
14**2,
15**2,
16**2,
17**2,
18**2,
19**2,
20**2,
21**2,
22**2,
23**2,
24**2,
25**2,
26**2,
27**2,
28**2,
29**2,
30**2,
31**2,
]

for i in range(len(x)):
    if N >= int(x[i]) :
        if max < int(x[i]) :
            max = int(x[i])
print(max)

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(2, 10):
        a = s ** i
        if a > 1000:
            break
        a_list.append(a)
a2 = sorted(list(set(a_list)), reverse=True)
a2.append(1)
for n in a2:
    if n <= X:
        print(n)
        break

Submission status: Wrong Answer

Solution code:
X = int(input())

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

Submission status: Wrong Answer

Solution code:
x = int(input())
import math
flag = False
for i in range(x):
    ans = x - i
    for j in range(2,x):
        b = math.pow(ans, 1/j)
        if b % 1 == 0:
            flag = True
            break
        elif b < 1:
            break
    if flag:
        break
print(ans)

Submission status: Wrong Answer

Solution code:
X = int(input())

max = 1
for i in range(1,X):
    for j in range(1,i):
        for k in range(1,j):
            if j ** k == i:
                max = i
            if j ** k > i:
                break

print(max)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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


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


print(beki(N))

Submission status: Wrong Answer

Solution code:
a = (1,4,8,9,16,25,27,32,49,64,81,121,125,128,169,256,289,243,343,381,512,529,625,729,841,961,1001)
k = int(input())
for i in range(len(a)):
  if k == 1:
    print(1)
    break
  
  elif a[i] > k:
    print(a[i-1])
    break

Submission status: Wrong Answer

Solution code:
import math as ma

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

Submission status: Wrong Answer

Solution code:
num = int(input())

i, cur, pre = 0, 0, 0
for i in range(1, 1001):
    cur = i*i
    if num < cur:
        print(pre)
        break
    pre = cur

Submission status: Wrong Answer

Solution code:
x = input()
n = 0
for i in range(11):
    if i == 0 or i == 1:
        continue
    for j in range(32):
        if j**i <= x and j**i > n:
            n = j**i
    print n
print n

Submission status: Wrong Answer

Solution code:
a = int(input())

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

Submission status: Wrong Answer

Solution code:
# 整数の入力
X = int(input())

# Xのn乗根が整数かどうかで判定を行う
l = list(range(1, 1 + X))
l.reverse()
found = False

for n in l:
    #    print(n)
    i = 2
    while True:
        #        print("i: {}".format(i))
        root_n = n ** (1 / i)
        #        print("root_n: {}".format(root_n))
        if root_n < 2:
            break

        if root_n.is_integer():
            #            print("{}は自然数".format(n))
            found = True
            break

        i += 1

    if found:
        break

print(n)

Submission status: Wrong Answer

Solution code:
x = int(input())
max1 = 1
for s in range(x):
  for t in range(x):
    if pow(s,t) > max1 and pow(s,t) <= x:
      max1 = pow(s,t)
print(max1)

Submission status: Wrong Answer

Solution code:
a = (1,4,8,9,16,25,27,32,49,64,81,121,125,128,169,225,256,289,243,343,381,512,529,625,729,841,961,1001)
k = int(input())
for i in range(len(a)):
  if k == 1:
    print(1)
    break
  
  elif a[i] > k:
    print(a[i-1])
    break

Submission status: Wrong Answer

Solution code:
x = int(input())
ans_list = []
i = 1
while i**2 <= x:
    
    k = i**2
    ans_list.append(k)
    i +=1

print(ans_list[-1])

Submission status: Wrong Answer

Solution code:
X=int(input())
C=1
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:
import math
num=int(input())
for i in range(int(math.sqrt(num))+1):
  r=i*i
print(r)

Submission status: Wrong Answer

Solution code:
X=int(input())
answer=0
b=2
q=2
if X==1:
    print("1")
else :
    while b<X:
        while b**q<X:
            if b**q>answer and b*q<=X:
                answer=b**q
            q+=1
        q=2
        b+=1
    print(answer)

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 j != 1 and pow(i,j) > max:
                max = pow(i,j)
        return max


print(beki(N))

Submission status: Wrong Answer

Solution code:
n = int(input())

ans = 1

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)