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())
flag = [0 for i in range(X+1)]
flag[1] = 1

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

Submission status: Wrong Answer

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

for i in range(1, X):
  for j in range(2, X):
    if pow(i, j) > X:
      break
    max = pow(i, j)
    
      
print(max)

Submission status: Wrong Answer

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

def main():
    x=int(input())
    for i in range(x,0,-1):
        if i==1:
            print(1)
            return
        j=2
        while True:
            k=i**(1/j)
            if int(k)<=1:
                break
            if int(k)==k:
                print(i)
                return
            j+=1

main()

Submission status: Wrong Answer

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

def main():
    x=int(input())
    for i in range(x,0,-1):
        if i==1:
            print(1)
            return
        j = 2
        while True:
            k = int(i**(1/j))
            if k <= 1:
                break
            if k**j==i:
                print(i)
                return
            j+=1

main()

Submission status: Wrong Answer

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

def main():
    x=int(input())
    for i in range(x,0,-1):
        j = 2
        while True:
            k = int(i**(1/j))
            if k <= 1:
                break
            if k**j==i:
                print(i)
                return
            j+=1

main()

Submission status: Wrong Answer

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

def main():
    x=int(input())
    for i in range(x,0,-1):
        for j in range(2,10):
            if int(i**(1/j))**j==i:
                print(i)
                return

main()

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)
        quit()

Submission status: Wrong Answer

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

def main():
    x=int(input())
    for i in range(x,0,-1):
        if int(sqrt(i))**2==i:
            print(i)
            return

main()

Submission status: Wrong Answer

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

    if temp!=1:
        arr.append([temp, 1])

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

    return arr
  
n = int(input())
if n < 4:
  print(1)
else:
  for i in range(n, 0, -1):
    a = factorization(i)
    if len(a)==1 and a[0][1]>=2:
      print(i)
      break

Submission status: Wrong Answer

Solution code:
#                         author:  kagemeka 
#                         created: 2019-11-07 13:42:36(JST)
import sys
# import collections
import math
# import string
# import bisect
# import re
# import itertools
# import statistics
# import functools
# import operator


def main():
    x = int(sys.stdin.readline().rstrip())

    if x <= 3:
        print(1)
        exit()

    
    cand = []
    for b in range(math.floor(x ** 0.5), 1, -1):
        bp = b ** math.floor(math.log(x, b))
        cand.append(bp)
    ans = max(cand)
    print(ans)


if __name__ == "__main__":
    # execute only if run as a script
    main()

# アルゴリズムは正しいのでやっぱりlogにバグがありそう
# 前もlog使った時に答えが間違ってたことあったきがする
# 近似系の関数を使う時は必ずしも正しい答えにならないみたい

Submission status: Wrong Answer

Solution code:
#                         author:  kagemeka 
#                         created: 2019-11-07 13:42:36(JST)
import sys
# import collections
import math
# import string
# import bisect
# import re
# import itertools
# import statistics
# import functools
# import operator


def main():
    x = int(sys.stdin.readline().rstrip())

    if x <= 3:
        print(1)
        exit()

    
    cand = []
    for b in range(math.floor(x ** 0.5), 1, -1):
        bp = b ** math.floor(math.log(x, b))
        cand.append(bp)
    ans = max(cand)
    print(ans)


if __name__ == "__main__":
    # execute only if run as a script
    main()

Submission status: Wrong Answer

Solution code:
#                         author:  kagemeka 
#                         created: 2019-11-07 13:42:36(JST)
import sys
# import collections
import math
# import string
# import bisect
# import re
# import itertools
# import statistics
# import functools
# import operator

def main():
    x = int(sys.stdin.readline().rstrip())
    ans = math.floor(x ** 0.5) ** 2
    print(ans)



if __name__ == "__main__":
    # execute only if run as a script
    main()

Submission status: Wrong Answer

Solution code:
X = int(input())
ma = 1
for i in range(11):
    for j in range(40):
        if j ** i <= X:
            ma = max(ma, j ** i)
print(ma)

Submission status: Wrong Answer

Solution code:
X=int(input())
c=[]
for i in range(0,X):
  if (i+1)**2<=X:
    c.append((i+1)**2)
print(max(c))

Submission status: Wrong Answer

Solution code:
X=int(input())
c=[]
if X==1:
  print("1")
else:
  for i in range(1,X):
    if i**2<=X:
      c.append(i**2)
  print(max(c))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x = int(input())

for i in range(34):
    if(i**2 > x):
        print((i - 1)**2)
        exit()

Submission status: Wrong Answer

Solution code:
X = int(input())

n = 1
for b in range(1,X):
    for p in range(2,X):
        if b**p <= X:
            if n < b**p:
                n = b**p
            break
    if b**2 > X:
        break

print(n)

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())
N = int(math.sqrt(X))+1
ans = 1
for n in range(2,N):
    b = n
    while b*n < X:
        b = b*n
    if ans < b:
        ans = b
print(ans)

Submission status: Wrong Answer

Solution code:
from math import floor
X = int(input())
if X != 1000:
    tmp = []
    for i in range(2,100):
        tmp.append(floor(X**(1/i))**i)
    print(tmp)
else:
    print(X)

Submission status: Wrong Answer

Solution code:
from math import floor
X = int(input())
tmp = []
for i in range(2,100):
    tmp.append(floor(X**(1/i))**i)
print(max(tmp))

Submission status: Wrong Answer

Solution code:
from math import floor
X = int(input())
tmp = []
for i in range(2,12):
    tmp.append(floor(X**(1/i))**i)
print(max(tmp))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
candidates = [ 1 ]

for b in range(2, int(1000**1/2)+1):
  p = 0
  while b**p <= 1000:
    candidates.append(b**p)
    p += 1

candidates.sort(reverse=True)
    
X = int(input())

for c in candidates:
  if c <= X:
    print(c)
    exit()

Submission status: Wrong Answer

Solution code:
X = int(input())
tmp = []
for i in range(1,33):
    tmp.append(i**2)
for j in range(len(tmp)):
    if tmp[j] > X:
        print(tmp[j-1])
        break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
x = int(input())
for i in range(x, 0, -1):
  if round(math.sqrt(i))**2 == i:
    print(i)
    quit()

Submission status: Wrong Answer

Solution code:
x=int(input())
a=[]
for i in range(40):
    for j in range(10):
        if i**j <= x:
            a.append(i**j)
b=list(set(a))
b.sort()

print(max(b))

Submission status: Wrong Answer

Solution code:
x=int(input())
a=[]
for i in range(10):
    for j in range(10):
        if i**j <= x:
            a.append(i**j)
b=list(set(a))
b.sort()
print(max(b))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

for i in range(x):
    ad = i**2
    if ad>x:
        break
    ans.append(ad)
print(max(ans))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
n = int(input())

x = []
for i in range(2,33):
    x = x + [i**j for j in range(2,10)]
x.sort()

import bisect

b = bisect.bisect_right(x,n)
print(x[b-1])

Submission status: Wrong Answer

Solution code:
x = int(input())
l = []
for i in range(2, 1000):
    l += [a**i for a in range(int(1000**(1/i)+1)) if a**i <= x]
print(max(l))

Submission status: Wrong Answer

Solution code:
x = int(input())
l = []
for i in range(2, 1000):
    l += [a**i for a in range(int(1000**(1/i)+1)) if a**i <= x]
l = sorted(list(set(l)))
print(max(l))

Submission status: Wrong Answer

Solution code:
import bisect as bi

X=int(input())

l=[]

for p in range(2,11):
    l.extend([x**p for x in range(1,int(1000**(1/p))+1)])

l.sort()

ind=bi.bisect_right(l,X)-1
print(l[ind])

Submission status: Wrong Answer

Solution code:
x = int(input())
l = [i**j for i in range(1,33) for j in range(2,10) if i**j <= x]
print(l[-1])

Submission status: Wrong Answer

Solution code:
def solve():
    x = int(input())
    l = [i**j for i in range(1,x+1) for j in range(1,x+1) if i**j<=x]
    return max(l)
        
if __name__ == '__main__':
    print(solve())

Submission status: Wrong Answer

Solution code:
def solve():
    x = int(input())
    if x**0.5 == int(x**0.5):
        return x
    
    for i in range(x):
        if i**2 > x:
            return (i-1)**2
            
        
if __name__ == '__main__':
    print(solve())

Submission status: Wrong Answer

Solution code:
N = int(input())
l = {1}
for i in range(2,32):
  j = 1
  while(i ** j <= N):
    l.add(i ** j)
    j += 1

for i in range(N, 0, -1):
  if(i in l):
    print(i)
    break

Submission status: Wrong Answer

Solution code:
N=int(input())
ans=1
S=[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]
    
i=0
while S[i] <= N:
    i+=1
    if len(S)<=i:
        break
    
print(S[i-1])

Submission status: Wrong Answer

Solution code:
N=int(input())
ans=1

for i in range(N,0,-1):
#    print(i)
    if (i**0.5).is_integer():
        ans=(i)
        break
    
print(ans)

Submission status: Wrong Answer

Solution code:
x = int(input())

beki = []

for i in range(2, 10) :
    beki.append(int(x ** (1 / i)) ** i)

print(max(beki))

Submission status: Wrong Answer

Solution code:
x = int(input())

print(int(x ** 0.5) ** 2)

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

Solution code:
x = int(input())
ans = 1
a = -1
if x < 4:
    print(1)
else:
    for i in range(int(x**(1/2)),0,-1):
        j = 2
        while a <= x:
            ans = max(ans,a)
            a = i**j
            j += 1
    print(ans)

Submission status: Wrong Answer

Solution code:
x = int(input())
ans = 1
a = 1
for i in range(int(x**(1/2)),-1,-1):
    j = 2
    while a < x:
        ans = max(ans,a)
        a = i**j
        j += 1
print(ans)

Submission status: Wrong Answer

Solution code:
X = int(input())
beki = [i**2 for i in range(1, X+1) if i**2 <= X]
print(max(beki))

Submission status: Wrong Answer

Solution code:
x = int(input())

ans = 1
for i in range(1, x+1):
    for j in range(2, 10):
        if i % i**(1/j) == 0 and i > ans:
            ans = i

print(ans)

Submission status: Wrong Answer

Solution code:
import bisect

X = int(input())

ex = [1]
for i in range(2,33):
    x = i*i
    while x <= 1000:
        ex.append(x)
        x = x*x

ex = list(set(ex))
ex.sort()
        
print(ex[bisect.bisect_right(ex, X)-1])

Submission status: Wrong Answer

Solution code:
X = int(input())

for i in reversed(range(1,X+1)):
    if (i**0.5).is_integer() :
        print(i)
        exit()

Submission status: Wrong Answer

Solution code:
x=int(input())
ans2=1
ans3=1
ans5=1
for i in range(32):
	if x >= i**2:
		ans2 = i**2
for i in range(10):
	if x >= i**3:
		ans3 = i**3
for i in range(3):
	if x >= i**5:
		ans5 = i**5
if max(ans2,ans3,ans5) < 128 < x:
	print(128)
elif max(ans2,ans3,ans5) < 512 < x:
	print(512)
else:
	print(max(ans2,ans3,ans5))

Submission status: Wrong Answer

Solution code:
x=int(input())
ans2=1
ans3=1
ans5=1
for i in range(32):
	if x >= i**2:
		ans2 = i**2
for i in range(10):
	if x >= i**3:
		ans3 = i**3
for i in range(3):
	if x >= i**5:
		ans5 = i**5
if max(ans2,ans3,ans5) < 128 < x:
	print(128)
if max(ans2,ans3,ans5) < 512 < x:
	print(512)
print(max(ans2,ans3,ans5))

Submission status: Wrong Answer

Solution code:
x = int(input())

ans = 1
for i in range(1,x):
    for j in range(1,11):
        if i**j <= x and ans <= i**j:
            ans = i**j
print(ans)

Submission status: Wrong Answer

Solution code:
x = int(input())

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

Submission status: Wrong Answer

Solution code:
x = int(input())

ans = 0
for i in range(1,x):
    if i*i <= x:
        ans = i*i

print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
b=[]
for i in range(30):
    i+=2
    s=i*i
    while s <=1000:
        b.append(s)
        s=s*i
ans=1
for i in range(len(b)):
    if b[i] < n and ans < b[i] :
        ans=b[i]
print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
b=[]
for i in range(30):
    i+=2
    s=i
    while s <=1000:
        b.append(s)
        s=s*i
ans=1
for i in range(len(b)):
    if b[i] < n and ans < b[i] :
        ans=b[i]
        
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys

input = sys.stdin.readline


def main():
    x = int(input())
    for i in range(x, 1, -1):
        # print(i, i ** 0.5)
        if (i & (i - 1)) == 0:
            print(i)
            break


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
X=int(input())
ans=0
for i in range(2,10):
  tmp=int(X**(1/i))**i
  ans=max(ans,tmp)
print(ans)

Submission status: Wrong Answer

Solution code:
X=int(input())
ans=0
for i in range(2,10):
  tmp=(X**(1/i)//1)**i
  ans=max(ans,tmp)
print(int(ans))

Submission status: Wrong Answer

Solution code:
X=int(input())
ans=0
for i in range(2,10):
  tmp=(X**(1/i)//1)**i
  ans=max(ans,tmp)
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#2019/10/03
X = int(open(0).read())
print(X)
max_exp=1
exp=0
for i in range(1,X+1):
#     print("i", i)
    for j in range(2,X+1):
#         print("j", j)
        exp = i**j
        if exp > X:
            break
        if max_exp < exp:
            max_exp = exp
print(max_exp)

Submission status: Wrong Answer

Solution code:
X = int(input())
import math
ans = 0
for b in range(1, int(math.sqrt(X))+1):
  for p in range(2, int(math.sqrt(X))+1):
    if b**p <= X and b**p > ans:
      ans = b**p
print(ans)

Submission status: Wrong Answer

Solution code:
N=int(input())
l=[]
import math
for n in range(1,N+1):
    if math.sqrt(n)==int(math.sqrt(n)):
        l.append(n)
print(max(l))

Submission status: Wrong Answer

Solution code:
x=int(input())

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l=[]
for i in range(1000):
  a = i*i
  if a<=1000:
    l.append(a)
n=int(input())
for j in l:
  if j<=n:
    ans =j
print(ans)

Submission status: Wrong Answer

Solution code:
x = int(input())

exps = sorted([i for i in [k ** i for i in range(10) for k in [2,3,5,7,11,13,17,19,23,29,31,37]] if i <= 1000])
print(max([i for i in exps if i <= x]))

Submission status: Wrong Answer

Solution code:
x=int(input())
max=0
for i in range(1,x):
    for j in range(3,x):
        if i**j>x:
            if i**(j-1)>max and x>i**(j-1)>max:
                max=i**(j-1)
            break
print(max)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys

def bb097():
    x = int(input())

    if x <= 3:
        print(1)
        sys.exit()

    # 事前にべき乗数DBを作っておく・・
    s = set()
    for i in range(2,31+1): # sqrt(1000) = 31.6...
        r = i*i
        while r < 1000:
            s.add(r)
            r *= i
    t = list(s)
    t.sort()
    t.reverse()

    for i in t:
        if i <= x:
            print(i)
            sys.exit()

bb097()

Submission status: Wrong Answer

Solution code:
import sys

def bb097():
    x = int(input())

    if x <= 3:
        print(1)
        sys.exit()

    # 事前にべき乗数DBを作っておく・・
    s = set()
    for i in range(2,31+1): # sqrt(1000) = 31.6...
        r = i*i
        while r < 1000:
            s.add(r)
            r *= i
    t = list(s)
    t.sort()
    t.reverse()

    for i in t:
        if i < x:
            print(i)
            sys.exit()

bb097()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math

X = int(input())
print(math.floor(math.sqrt(X)) ** 2)

Submission status: Wrong Answer

Solution code:
X = int(input())

num_list = []
for x in range(0, X):
    for i in range(2, 11):
        if x ** i <= X:
            num_list.append(x ** i)
        else:
            break


print(max(num_list))

Submission status: Wrong Answer

Solution code:
from math import sqrt
from sys import exit
n = int(input())
for i in range(n, 0, -1):
    if sqrt(n).is_integer():
        print(i)
        exit()

Submission status: Wrong Answer

Solution code:
from math import sqrt
from sys import exit
n = int(input())
for i in range(n,0,-1):
    if sqrt(n).is_integer():
        print(i)
        exit()

Submission status: Wrong Answer

Solution code:
from math import sqrt
from sys import exit
n = int(input())
for i in range(n,0):
    if sqrt(n).is_integer():
        print(i)
        exit()

Submission status: Wrong Answer

Solution code:
r=range(0,32)
x=int(input())
arr=[]
for i in r:
    for j in r:
        if i**j<=x:
            arr.append(i**j)
print(max(arr))

Submission status: Wrong Answer

Solution code:
r=range(0,32)
x=int(input())
arr=[]
for i in r:
    if i**2<=x:
        arr.append(i**2)
print(max(arr))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=int(input())
def gauss_2(n):
    g=0
    while g<=n**(1/2):
        g+=1
    return g-1

def gauss_3(n):
    g=0
    while g<=n**(1/3):
        g+=1
    return g-1
def gauss_4(n):
    g=0
    while g<=n**(1/4):
        g+=1
    return g-1
def gauss_5(n):
    g=0
    while g<=n**(1/5):
        g+=1
    return g-1
def gauss_6(n):
    g=0
    while g<=n**(1/6):
        g+=1
    return g-1
def gauss_7(n):
    g=0
    while g<=n**(1/7):
        g+=1
    return g-1

if n<=3:
    print(1)
elif n not in (125,216,343,512,729):
    print(max(gauss_2(n)**2,gauss_3(n)**3,gauss_4(n)**4,gauss_5(n)**5,gauss_6(n)**6,gauss_7(n)**7))
else:
    print(n)

Submission status: Wrong Answer

Solution code:
n=int(input())
def gauss_2(n):
    g=0
    while g<=n**(1/2):
        g+=1
    return g-1

def gauss_3(n):
    g=0
    while g<=n**(1/3):
        g+=1
    return g-1
def gauss_4(n):
    g=0
    while g<=n**(1/4):
        g+=1
    return g-1
def gauss_5(n):
    g=0
    while g<=n**(1/5):
        g+=1
    return g-1
def gauss_6(n):
    g=0
    while g<=n**(1/6):
        g+=1
    return g-1
def gauss_7(n):
    g=0
    while g<=n**(1/7):
        g+=1
    return g-1

if n<=3:
    print(1)
elif n not in (125,216,242,512,729):
    print(max(gauss_2(n)**2,gauss_3(n)**3,gauss_4(n)**4,gauss_5(n)**5,gauss_6(n)**6,gauss_7(n)**7))
else:
    print(n)

Submission status: Wrong Answer

Solution code:
n=int(input())
def gauss_2(n):
    g=0
    while g<=n**(1/2):
        g+=1
    return g-1

def gauss_3(n):
    g=0
    while g<=n**(1/3):
        g+=1
    return g-1
def gauss_4(n):
    g=0
    while g<=n**(1/4):
        g+=1
    return g-1
def gauss_5(n):
    g=0
    while g<=n**(1/5):
        g+=1
    return g-1
def gauss_6(n):
    g=0
    while g<=n**(1/6):
        g+=1
    return g-1
def gauss_7(n):
    g=0
    while g<=n**(1/7):
        g+=1
    return g-1

if n<=3:
    print(1)
elif n!=512:
    print(max(gauss_2(n)**2,gauss_3(n)**3,gauss_4(n)**4,gauss_5(n)**5,gauss_6(n)**6,gauss_7(n)**7))
else:
    print(512)

Submission status: Wrong Answer

Solution code:
n=int(input())
def gauss_2(n):
    g=0
    while g<=n**(1/2):
        g+=1
    return g-1

def gauss_3(n):
    g=0
    while g<=n**(1/3):
        g+=1
    return g-1
def gauss_4(n):
    g=0
    while g<=n**(1/4):
        g+=1
    return g-1
def gauss_5(n):
    g=0
    while g<=n**(1/5):
        g+=1
    return g-1
def gauss_6(n):
    g=0
    while g<=n**(1/6):
        g+=1
    return g-1
def gauss_7(n):
    g=0
    while g<=n**(1/7):
        g+=1
    return g-1

if n<=3:
    print(1)
else:
    print(max(gauss_2(n)**2,gauss_3(n)**3,gauss_4(n)**4,gauss_5(n)**5,gauss_6(n)**6,gauss_7(n)**7))

Submission status: Wrong Answer

Solution code:
n=int(input())
def gauss(n):
    g=0
    while g<=n**0.5:
        g+=1
    return g-1
if n<=3:
    print(1)
else:
    print(gauss(n)**2)

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

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

while True:  
  if (n+1)**2 <= x:
    n += 1
  else:    
    break
    
print(n**2)

Submission status: Wrong Answer

Solution code:
x=int(input())
a=[]
for i in range(1,33):
    k=i**2
    if k <=x:a.append(k)    
    else:break
print(a[-1])

Submission status: Wrong Answer

Solution code:
x = int(input())
if x == 1:
    print(1)
    exit()
max = 0
for b in range(2, x):
    for p in range(2, 11):
        b_p = b**p
       # print("b^p = {}".format(b_p))
        if b_p <= x:
            if b_p > max:
                max = b_p
                #print("b = {}, p = {}, b^p = {}".format(b, p, max))
                break
print(max)

Submission status: Wrong Answer

Solution code:
x = int(input())
p = 1
b = 1
while b ** 2 <= x:
    p = b ** 2
    b += 1
# for i in range(1, x + 1):
#     if i ** 2 <= x:
#         p = i ** 2
print(p)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math

n = int(input())
target_n = int(math.sqrt(n))

cand_list = [i*i for i in range(1, target_n+1)]

print(list(filter(lambda x:x<=n, cand_list))[-1])

Submission status: Wrong Answer

Solution code:
import math

n = int(input())
# target_n = int(math.sqrt(n))
target_n = 31

cand_list = [i*i for i in range(1, target_n+1)]

ans = 0

for cand_i in range(len(cand_list)):
  if cand_list[cand_i] > n:
    ans = cand_list[cand_i-1]
    
print(ans if ans != 0 else cand_list[-1])

Submission status: Wrong Answer

Solution code:
import math

n = int(input())
target_n = int(math.sqrt(n))

cand_list = [i*i for i in range(1, target_n+1)]

ans = 0

for cand_i in range(len(cand_list)):
  if cand_list[cand_i] > n:
    ans = cand_list[cand_i-1]
    
print(ans if ans != 0 else cand_list[-1])

Submission status: Wrong Answer

Solution code:
import math

n = int(input())
target_n = int(math.sqrt(n))

cand_list = [i*i for i in range(1, target_n+1)]

cand_list.append(n)
sorted(cand_list)

print(cand_list[cand_list.index(n)-1])

Submission status: Wrong Answer

Solution code:
n = int(input())
m = 1
 
while True:
  if m**2 <= n:
    m += 1
  else:
    m -= 1
    break
  
print(m**2)

Submission status: Wrong Answer

Solution code:
n = int(input())
m = 1
 
while True:
  if m**2 <= n:
    m += 1
  else:
    m-=1
    break
  
print(m**2)

Submission status: Wrong Answer

Solution code:
n = int(input())
m = 1
 
while True:
  if m**2 < n:
    m += 1
  else:
    m-=1
    break
  
print(m**2)

Submission status: Wrong Answer

Solution code:
n = int(input())
m = 1
 
while True:
  if m**2 < n:
    m += 1
  else:
    break
  
print(m)

Submission status: Wrong Answer

Solution code:
n = int(input())
m = 1

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

Submission status: Wrong Answer

Solution code:
print(2**(len(bin(int(input())))-3))

Submission status: Wrong Answer

Solution code:
import math
from bisect import  bisect_right

X = int(input())

s = list([1])

for i in range(2,math.ceil(1000**0.5)):
    for j in range(0,9):
        if i**j > 1000:
            break
        else:
            s.append(i**j)

s.sort()
print(s[bisect_right(s,X) -1])

Submission status: Wrong Answer

Solution code:
x = int(input())
ans = 0
while True:
    i = 2
    while i < 11:
#       print(x**(1/i),int(x**(1/i)))
        if x**(1/i)==int(x**(1/i)):
            ans = x
            break
        i += 1
    if ans != 0:
        break
    x -= 1
#   print(x)
print(ans)

Submission status: Wrong Answer

Solution code:
x = int(input())
ans = 0
while True:
    i = 2
    while i < 10:
#       print(x**(1/i),int(x**(1/i)))
        if x**(1/i)==int(x**(1/i)):
            ans = x
            break
        i += 1
    if ans != 0:
        break
    x -= 1
#   print(x)
print(ans)

Submission status: Wrong Answer

Solution code:
x = int(input())
if x < 4:
  print(1)
  exit()
import math
result = 1
for i in range(2,x+1):
  if math.floor(math.log(x,i))>1:
    result = max(result, i ** math.floor(math.log(x,i)))
  
print(result)

Submission status: Wrong Answer

Solution code:
x = int(input())
if x < 4:
  print(1)
  exit()
import math
result = 1
for i in range(2,x):
  if math.floor(math.log(x,i))>1:
    result = max(result, i ** math.floor(math.log(x,i)))
  
print(result)

Submission status: Wrong Answer

Solution code:
import math

x = int(input())
for i in range(x, 1, -1):
    a = math.sqrt(i)
    if a.is_integer():
        print(i)
        exit()

Submission status: Wrong Answer

Solution code:
n = int(input())
a = 1
for i in range(n):
  for j in range(n):
    if i**j<=n:
      a = max(a, i**j)
print(a)

Submission status: Wrong Answer

Solution code:
x=int(input())
ans=1
for b in range(2,11):
  ans=max(int((((x+1)**(1/b))//1)**b),ans)
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
from collections import defaultdict
sys.setrecursionlimit(200000)
input = sys.stdin.readline

N, = map(int, input().split())

c = 1
while c ** 2 <= N:
    c += 1

print((c - 1) ** 2)

Submission status: Wrong Answer

Solution code:
import math
X = int(input())
print(int(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:
from math import sqrt
X = int(input())
ans = 1
for i in range(2, int(sqrt(X))+1):
    j = 2
    while i**j <= X:
        print(i**j)
        ans = max(ans, i**j)
        j += 1
print(ans)

Submission status: Wrong Answer

Solution code:
from math import sqrt
X = int(input())
ans = 0
for i in range(int(sqrt(X))):
    if i**2 <= X:
        ans = max(i**2, ans)
print(ans)

Submission status: Wrong Answer

Solution code:
from math import sqrt
X = int(input())
ans = 0
for i in range(int(sqrt(X)) + 1):
    if i**2 <= X:
        ans = max(i**2, ans)
print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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