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())
s = []
for i in range(x):
    for j in range(2,4):
        if i**j <= x:
            s.append(i**j)

print(max(s))

Submission status: Wrong Answer

Solution code:
import math
a=int(input())
b=[]
for i in range(2,11):
    if math.floor(a**(1/i))>=2:
        b.append(math.floor(a**(1/i))**i)
    else:
        break
print(max(b)if a>3else 1)

Submission status: Wrong Answer

Solution code:
import math
a=int(input())
b=[]
for i in range(2,11):
    if int(a**(1/i))>=2:
        b.append(math.floor(a**(1/i))**i)
    else:
        break
print(max(b)if a>3else 1)

Submission status: Wrong Answer

Solution code:
a=int(input())
b=[]
for i in range(2,a):
    if int(a**(1/i))>=2:
        b.append(int(a**(1/i))**i)
    else:
        break
print(max(b)if a>3else 1)

Submission status: Wrong Answer

Solution code:
a=int(input())
b=[]
for i in range(2,a):
    if int(a**(1/i))>=2:
        b.append(int(a**(1/i))**i)
print(max(b)if a!=1else 1)

Submission status: Wrong Answer

Solution code:
import math
N=int(input())
ans=1
for i in range(2,N):
  if math.log(N,i)-int(math.log(N,i))==0 and int(math.log(N,i))>=2:
    ans=i**math.log(N,i)
print(int(ans))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N=int(input())
T = []
if N==1:
  print(1)
else:
  for i in range(N):
    if i*i <= N:
      T.append(i*i)
    else:
      pass
  print(T[-1])

Submission status: Wrong Answer

Solution code:
N=int(input())
T = []
if N==1:
  print(1)
else:
  for i in range(N):
    if i*i <= N:
      T.append(i*i)
    else:
      quit
  print(T[-1])

Submission status: Wrong Answer

Solution code:
N=int(input())
T = []
for i in range(N):
  if N==1:
    T.append(1)
  elif i*i <= N:
    T.append(i*i)
  else:
    quit
print(max(T))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def piyo():
    n = int(input())
    for i in range(1000):
        if i*i>n:
            print((i-1)*(i-1))
            break
        
if __name__ == '__main__':
    piyo()

Submission status: Wrong Answer

Solution code:
def piyo():
    n = int(input())
    for i in range(1000):
        if i*i>n:
            print((i-1)*(i-1))
            break
        elif i*i==n:
            print(i*i)
            break
        
if __name__ == '__main__':
    piyo()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
X = int(input())
max_num = 1
for i in range(X):
  for p in [2,3,5,7]:
    calc = int(i**(1/p))**p
    max_num = max(max_num, calc)
print(max_num)

Submission status: Wrong Answer

Solution code:
X = int(input())
max_num = 1
for i in range(X)[::-1]:
  for p in [2,3,5,7]:
    calc = int(i**(1/p))**p
    if(calc != X):
      max_num = max(max_num, calc)
print(max_num)

Submission status: Wrong Answer

Solution code:
X = int(input())
max_num = 1
for p in [2,3,5,7]:
  calc = int(X**(1/p))**p
  max_num = max(max_num, calc)
print(max_num)

Submission status: Wrong Answer

Solution code:
n=int(input())
print(max((int(n**(1/i))**i) for i in range(2,100)))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
print(int(int(input())**.5)**2)

Submission status: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

Solution code:
X = int(input())
m = 0
for b in range(40):
    for p in range(15):
        t = b ** p
        if t <= X:
            m = max(m, t)

print(m)

Submission status: Wrong Answer

Solution code:
X=int(input())

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

n=2
p=2
max=0
b_flag=True
while True:

    #print(n)
    while b_flag:
        if n**p>X:
            b_flag=False
        else:
            max=n**p
        p+=1
    n+=1
    p = 2
    b_flag=True
    if n**p>X:
        break
print(max)

Submission status: Wrong Answer

Solution code:
X=int(input())

n=1
while True:
    if n**2>X:
        print((n-1)**2)
        exit(0)
    n+=1

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
X = int(input())
p = 1
while p < 32:
    if p*p > X:
        break
    else:
        p+=1
print((p-1)*(p-1))

Submission status: Wrong Answer

Solution code:
X = int(input())
p = 1
while p < 32:
    p2 = p*p
    if p2 > X:
        p2 = (p-1)*(p-1)
        break
    else:
        p+=1
print(p2)

Submission status: Wrong Answer

Solution code:
X = int(input())
p = 1
while p < 32:
    p2 = p*p
    if p2 > X:
        break
    else:
        p+=1
print(p2)

Submission status: Wrong Answer

Solution code:
X = int(input())
count = 1
while X >= 1:
    X = X%2
    count+=1
print(2**count)

Submission status: Wrong Answer

Solution code:
X = int(input())
l = [2,3,5,7,11,13,17,19,23,29,31]
ans = []

for i in l:
  for j in range(50):
    if pow(i,j) <= X: 
      ans.append(pow(i,j))
    else:
      break

ans.sort(reverse= True)

for i in ans:
  if i <= X:
    print(i)
    break

Submission status: Wrong Answer

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

n=int(math.sqrt(X))
ans=0

if(X==1 or X==2 or X==3):
    print(1)
else:
    for i in range(2,n+1):
        j=2
        while(i**j<=X):
            if(i**j>ans):
                ans=i**j
            j+=1
print(ans)

Submission status: Wrong Answer

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

n=int(math.sqrt(X))
ans=0

if(X==1):
    print(1)
else:
    for i in range(2,n+1):
        j=2
        while(i**j<=X):
            if(i**j>ans):
                ans=i**j
            j+=1
print(ans)

Submission status: Wrong Answer

Solution code:
x=int(input())
while int(x**0.5)**2!=x and int(x**(1/3))**3!=x and int(x**(1/5))**5!=x and int(x**(1/7))**7!=x:
  x-=1
print(x)

Submission status: Wrong Answer

Solution code:
import math
x=int(input())
while math.sqrt(x)%1>0 and math.pow(x,1/3)%1>0 and math.pow(x,1/5)%1>0 and math.pow(x,1/7)%1>0:
  x-=1
print(x)

Submission status: Wrong Answer

Solution code:
import math
x=int(input())
while math.sqrt(x)%1>0:
  x-=1
print(x)

Submission status: Wrong Answer

Solution code:
X = int(input())

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

Submission status: Wrong Answer

Solution code:
X = int(input())

for i in range(X+1):
    if(i**2==X):
        print(X)
        break
    else:
        if((i+1)**2>X):
            print(i**2)
            break

Submission status: Wrong Answer

Solution code:
X =int(input())
max = 0
sub_max = 0
for k in range(X):
    for j in range(X):
        if k**2 > X:
            break
        elif k**j > X:
            sub_max = k**(j-1)
            if sub_max >= max:
              max = sub_max
            break
            
print(max)

Submission status: Wrong Answer

Solution code:
a = int(input())
m = 1
for i in range(a//2+1):
    for j in range(1,10):
        if a> i**j and m <i**j:
            m = i**j
        if a < i**j:
            break
print(m)

Submission status: Wrong Answer

Solution code:

a = int(input())
m = 1
for i in range(a//2+1):
    for j in range(1,9):
        if a> i**j and m <i**j:
            m = i**j
        if a < i**j:
            break
print(m)

Submission status: Wrong Answer

Solution code:
N = int(input())
import math
a = []
for i in range(2,10):
  for j in range(1,31):
    a.append(N - math.pow(i,j))
b = []
for k in a:
  if a[i]>0:
    b.append(a[i])
print(min(a))

Submission status: Wrong Answer

Solution code:
n=int(input())

a=[1]
for i in range(2,32):
	for j in range(2,10):
		x=i**j
		if x<=1000:
			a.append(x)

a=list(set(a))
a.sort()
	
def binarySearch(value, xList):
    low=0
    high=len(xList)-1
    while low!=high:
        mid=(low+high)//2
        if xList[mid]<=value:
            low=mid+1
        else:
            high=mid
    return xList[low-1]
		
print(binarySearch(n,a))

Submission status: Wrong Answer

Solution code:
n=int(input())

a=[1]
for i in range(2,32):
	for j in range(2,10):
		x=i**j
		if x<=1000:
			a.append(x)

a=list(set(a))
a.sort()
print (a)
	
def binarySearch(value, xList):
    low=0
    high=len(xList)-1
    while low!=high:
        mid=(low+high)//2
        if xList[mid]<=value:
            low=mid+1
        else:
            high=mid
    return xList[low-1]
		
print(binarySearch(n,a))

Submission status: Wrong Answer

Solution code:
from math import sqrt
X=int(input())
alist=[]
for i in range(X,0,-1):
    if sqrt(i)==int(sqrt(i)):
        print(i)
        break
    else:
        continue

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a = int(input())
frag = True
c = 0
i = 0
while(frag):
        i += 1
        if c <= a:
                c = i*i
        else:
                frag = False
c = (i-2)*(i-2)
print(c)

Submission status: Wrong Answer

Solution code:
x = int(input())
ans = 1
for i in range(1,x):
    j = 2
    fin = 0
    while(fin == 0):
        if i ** j <= x and ans < i ** j:
            ans = i ** j
            j += 1
        else:
            fin = 1
        if j > x:
            fin = 1
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x = int(input())
ans = 1
for i in range(1,round(x/10)):
    j = 2
    fin = 0
    while(fin == 0):
        if i ** j <= x:
            ans = i ** j
            j += 1
        else:
            fin = 1
        if j > x:
            fin = 1
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
ans = 1
list_a = []
for i in range(2, n):
    for b in range(1, 100):
        for p in range(2, 10):
            if i == b**p and i<=n:
                ans = i
                list_a.append([i, b, p])
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x = int(input())
m = 0
for p in range(2, 10):
  b = int(x**(1/p))
  if m < b**p:
    m = b**p
print(m)

Submission status: Wrong Answer

Solution code:
from math import log
n=int(input())
a=int(log(n,2))
b=int(log(n,3))
c=int(n**(1/2))
d=int(n**(1/3))
v=max(2**a,3**b)
v=max(v,c**2)
v=max(v,d**3)
#print(a)
#print(b)
#print(c)
#print(d)
if n==1000:
    v=n
print(v)
#print(1000**(1/3))

Submission status: Wrong Answer

Solution code:
n = int(input())
b =1
p=2
maxi=0
i=1
p=2
while(True):
    if (i**2>n or i**p>n):
        break
    else :
        if(i**p>maxi):
            maxi=i**p
    i+=1
print(maxi)

Submission status: Wrong Answer

Solution code:
from math import log
n=int(input())
a=int(log(n,2))
b=int(log(n,3))
c=int(n**(1/2))
d=int(n**(1/3))
v=max(2**a,3**b)
v=max(v,c**2)
v=max(v,d**3)
print(v)

Submission status: Wrong Answer

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

import math


def make_explist():
    return {i: max([pow(math.floor(pow(i, 1/j)), j) for j in range(2, 20)]) for i in range(1, 1001)}


def solve():
    d = make_explist()
    print(d[int(input())])


if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

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

import math


def make_explist():
    return {i: max([pow(math.floor(pow(i, 1/j)), j) for j in range(2, 13)]) for i in range(1, 1001)}


def solve():
    d = make_explist()
    print(d[int(input())])


if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

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

import math


def make_explist():
    return {i: max([pow(math.floor(pow(i, 1/j)), j) for j in range(2, 10)]) for i in range(1, 1001)}


def solve():
    d = make_explist()
    print(d[int(input())])


if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

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

import math


def solve():
    print(math.floor(math.sqrt(int(input()))) ** 2)


if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

Solution code:
a=int(input())

b=[]
for i in range(33):
	b.append(i**2)
c=[]
for i in range(33):
	if a>=b[i]:
		c.append(b[i])
print(max(c))

Submission status: Wrong Answer

Solution code:
a=int(input())

b=[]
for i in range(33):
	b.append(i**2)
c=[]
for i in range(33):
	if a>b[i]:
		c.append(b[i])
print(max(c))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x = int(input())
a =[]
c = 1
n = 2
while c <= 33:
    n = 2
    c += 1
    while c**n<=1000:
        a.append(c*n)
        n +=1
a.sort()
for i in range(len(a)):
    if a[i] > x:
        a[i] = -1000
    else:
        a[i] -= x
print(a[a.index(max(a))])

Submission status: Wrong Answer

Solution code:
a = int(input())

i = 2
max_num = 1
while i < a:
    j = 2
    temp = 0
    while i**j <= a:
        temp = i**j
        j+=1

    if temp > max_num and temp < a:
        max_num = temp
    i+=1
print(max_num)

Submission status: Wrong Answer

Solution code:
a = int(input())

i = 2
max_num = 1
while i <= a:
    j = 2
    temp = 0
    while i**j < a:
        temp = i**j
        j+=1

    if temp > max_num and temp <= a:
        max_num = temp
    i+=1
print(max_num)

Submission status: Wrong Answer

Solution code:
a = int(input())

i = 2
max_num = 1
while i < a:
    j = 2
    temp = 0
    while i**j < a:
        temp = i**j
        j+=1

    if temp > max_num and temp < a:
        max_num = temp
    i+=1
print(max_num)

Submission status: Wrong Answer

Solution code:
a = int(input())

i = 2
max_num = 1
while i**2 < a:
    j = 1
    temp = 0
    while i**j < a:
        temp = i**j
        j+=1

    if temp > max_num:
        max_num = temp
    i+=1
print(max_num)

Submission status: Wrong Answer

Solution code:
n=int(input())
max=0
if(n==1):
  print(1)
else:
  for i in range(n):
    for j in range(2,10):
      if(max<=i**j and i**j<=n):
        max=i**j
print(max)

Submission status: Wrong Answer

Solution code:
n=int(input())
max=0
if(n==1):
  print(1)
else:
  for i in range(n):
    for j in range(2,10):
      if(max<i**j and i**j<n):
        max=i**j
  print(max)

Submission status: Wrong Answer

Solution code:
n=int(input())
max=0
if(n==1):
  print(1)
else:
  for i in range(n):
    for j in range(2,10):
      if(max<i**j and i**j<n):
        max=i**j
print(max)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
z=int(input())
x=[]
for i in range(31):
  for j in range(10):
    if (i+1)**(j+1)<=z:
      x.append((i+1)**(j+1))
print(max(x))

Submission status: Wrong Answer

Solution code:
import math

x = int(input())

pow_list = [1]
i = 2
while i**2 < 1000:
    j = 2
    while i**j < 1000:
        pow_list.append(i**j)
        j += 1
    i += 1

pow_list = set(pow_list)

for i in range(x, 0, -1):
    if i in pow_list:
        res = i
        break

print(res)

Submission status: Wrong Answer

Solution code:
import math

x = int(input())

pow_list = [1]
for i in range(2,32):
    j = 2
    while i**j < 1000:
        pow_list.append(i**j)
        j += 1

for i in range(x, 0, -1):
    if i in pow_list:
        res = i
        break

print(res)

Submission status: Wrong Answer

Solution code:
import math
x = int(input())
pow_list = [1,2,3]
for i in range(2,32):
    j = 2
    while i**j < 1000:
        pow_list.append(i**j)
        j += 1
for i in range(x, 0, -1):
    if i in pow_list:
        res = i
        break
print(res)

Submission status: Wrong Answer

Solution code:
# math libary
import math

# x is greater than or equal to 1
# x is less than or equal to 1000
x = int(input())

# full list
pow_list = [1,2,3]
for i in range(2,32):
    j = 2
    while i**j < 1000:
        pow_list.append(i**j)
        j += 1

res = x

for i in range(x, 0, -1):
    if i in pow_list:
        res = i
        break
    else:
        continue

print(res)

Submission status: Wrong Answer

Solution code:
# math libary
import math

# x is greater than or equal to 1
# x is less than or equal to 1000
x = int(input())

# full list
pow_list = [1]
for i in range(2,32):
    j = 2
    while i**j < 1000:
        pow_list.append(i**j)
        j += 1

res = x

for i in range(x, 0, -1):
    if i in pow_list:
        res = i
        break
    else:
        continue

print(res)

Submission status: Wrong Answer

Solution code:
# math libary
import math

# x is greater than or equal to 1
# x is less than or equal to 1000
x = int(input())

# full list
pow_list = [1]
for i in range(2,32):
    j = 2
    while i**j < 1000:
        pow_list.append(i**j)
        j += 1

res = x
print(pow_list)

for i in range(x, 0, -1):
    if i in pow_list:
        res = i
        break
    else:
        continue

print(res)

Submission status: Wrong Answer

Solution code:
# math libary
import math

# x is greater than or equal to 1
# x is less than or equal to 1000
x = int(input())

if x == 1:
    res = 1
else:
    # full research
    flag = False
    for i in range(x,1,-1):
        for j in range(int(math.sqrt(i)), 1, -1):
            if math.log(i,j) - math.floor(math.log(i,j)) == 0:
                res = i
                flag = True
            else:
                continue
        if flag:
            break
        else:
            continue

    if not flag:
        res= x

print(res)

Submission status: Wrong Answer

Solution code:
# math libary
import math

# x is greater than or equal to 1
# x is less than or equal to 1000
x = int(input())

if x == 1:
    res = 1
else:
    # full research
    flag = False
    for i in range(x,1,-1):
        for j in range(int(math.sqrt(i)), 2, -1):
            if math.log(i,j) < 2:
                break
            elif math.log(i,j) - math.floor(math.log(i,j)) == 0:
                res = i
                flag = True
            else:
                continue
        if flag:
            break
        else:
            continue

    if not flag:
        res= x

print(res)

Submission status: Wrong Answer

Solution code:
n=int(input())

mx=1
for i in range(2,11):
    mx=max(mx,int(n**(1/i))**i)

print( mx)

Submission status: Wrong Answer

Solution code:
n=int(input())

mx=1
for i in range(2,10):
    mx=max(mx,int(n**(1/i))**i)

print( mx)

Submission status: Wrong Answer

Solution code:
X = int(input())
print(max([int(X ** (1 / p)) ** p for p in range(2, 10)]))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
X = int(input())
ans = 1
for i in range(2, int(math.log2(X)) + 1):
    ans = max(ans, int(X ** (1/i)) ** i)
print(ans)

Submission status: Wrong Answer

Solution code:
import math
X = int(input())
ans = 0
for i in range(2, int(math.log2(X)) + 1):
    ans = max(ans, int(X ** (1/i)) ** i)
print(ans)

Submission status: Wrong Answer

Solution code:
X = int(input())
for i in range(X,0,-1):
    if round(pow(i,1/2),10).is_integer():
            print(i)
            break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x = int(input())
l = [1, 4, 8, 16, 32, 64, 128, 256, 512, 9, 27, 81, 243, 729, 25, 125, 625, 36, 216, 49, 343, 100, 1000, 121, 144, 169, 196, 225, 289, 324, 361, 400, 441, 484, 529, 576, 26**2, 28**2, 29**2, 900, 31**2]
l = list(set(l))
l.sort()
for i in range(len(l)):
  if x < l[i]:
    print(l[i-1])
    break
  elif x == 1:
    print('1')
    break
  elif x == 1000:
    print('1000')

Submission status: Wrong Answer

Solution code:
x = int(input())
l = [1, 4, 8, 16, 32, 64, 128, 256, 512, 9, 27, 81, 243, 729, 25, 125, 625, 36, 216, 49, 343, 100, 1000, 121, 144, 169, 196, 225, 289, 324, 361, 400, 441, 484, 529, 576, 26**2, 28**2, 29**2, 900, 31**2]
l = list(set(l))
l.sort()
for i in range(len(l)):
  if x < l[i]:
    print(l[i-1])
    break
  elif x == 1:
    print('1')
    break

Submission status: Wrong Answer

Solution code:
x = int(input())
l = [1, 4, 8, 16, 32, 64, 128, 256, 512, 9, 27, 81, 243, 729, 25, 125, 625, 36, 216, 49, 343, 100, 1000, 121, 144, 169, 196, 225, 289, 324, 361, 400, 441, 484, 529, 576, 26**2, 28**2, 29**2, 900, 31**2]
l.sort()
for i in range(len(l)):
  if x < l[i]:
    print(l[i-1])
    break
  elif x == 1:
    print('1')
    break

Submission status: Wrong Answer

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


def main():
    x = int(input())
    ans = 0

    for p in range(2, 5):
        for b in range(1, 50):
            if b ** p <= x:
                ans = max(ans, b ** p)

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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


def main():
    x = int(input())
    ans = 0

    for p in range(2, 10):
        tmp = int(x ** (1 / p)) ** p

        if tmp <= x:
            ans = max(ans, tmp)

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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


def main():
    x = int(input())
    ans = 0

    for p in range(2, 10):
        ans = max(ans, int(x ** (1 / p)) ** p)

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
s=input()
X=int(s)

if(X==1):
    print(1)
else:
    data=[]
    for b in range(1,35):
        for p in range(2,10):
            xt=b**p
            if(xt>1000):
                break
            data.append(xt)

    dist=abs(data[0]-X)
    ans=data[0]
    for i in range(1,len(data)):
        if(data[i]<X and abs(data[i]-X)<dist):
            dist=abs(data[i]-X)
            ans=data[i]

    print(ans)

Submission status: Wrong Answer

Solution code:
s=input()
X=int(s)

if(X==1):
    print(1)
else:
    data=[]
    for b in range(1,35):
        for p in range(2,10):
            xt=b**p
            if(xt>1000):
                break
            data.append(xt)
    print(data)
    dist=abs(data[0]-X)
    ans=data[0]
    for i in range(1,len(data)):
        if(data[i]<X and abs(data[i]-X)<dist):
            dist=abs(data[i]-X)
            ans=data[i]

    print(ans)

Submission status: Wrong Answer

Solution code:
s=input()
X=int(s)

if(X==1):
    print(1)
else:
    data=[]
    for b in range(1,35):
        for p in range(2,10):
            xt=b**p
            if(xt>1000):
                break
            data.append(xt)
    print(data)
    dist=2000
    ans=-1
    for i in range(len(data)):
        if(data[i]<X and abs(data[i]-X)<dist):
            dist=abs(data[i]-X)
            ans=data[i]

    print(ans)

Submission status: Wrong Answer

Solution code:
X = int(input())

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

Submission status: Wrong Answer

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

if N<4:
  print(1)
else:
  for i, j in itertools.product(range(N), range(2, N+1)):
    a = math.sqrt(N-i)
    a = math.modf(a)
    b = math.log(N-i, j)
    b = math.modf(b)
    if a[0]==0.0:
      print(N-i)
      break
    elif b[0]==0.0:
      print(int(j**math.log(N-i, j)))
      break

Submission status: Wrong Answer

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

if N<=3:
  print(N)
else:
  for i, j in itertools.product(range(N), range(2, int(math.sqrt(N))+1)):
    a = math.sqrt(N-i)
    a = math.modf(a)
    b = math.log(N-i, j)
    b = math.modf(b)
    if a[0]==0.0:
      print(N-i)
      break
    elif b[0]==0.0:
      print(int(j**math.log(N-i, j)))
      break

Submission status: Wrong Answer

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

if N==1:
  print(N)
else:
  for i, j in itertools.product(range(N), range(2, int(math.sqrt(N))+1)):
    a = math.sqrt(N-i)
    a = math.modf(a)
    b = math.log(N-i, j)
    b = math.modf(b)
    if a[0]==0.0:
      print(N-i)
      break
    elif b[0]==0.0:
      print(int(j**math.log(N-i, j)))
      break

Submission status: Wrong Answer

Solution code:
x=int(input())
for i in range(0, 32)[::-1]:
	if i*i<=x:
		print(i*i)
		exit()

Submission status: Wrong Answer

Solution code:
def factorize(m):
  factors=[]
  i=2
  if m==1:
    return [1]
  while m>1:
    if m%i==0:
      factors.append(i)
      m/=i
    else:
      i+=1
  return factors

n=int(input())
for i in range(1, n+1)[::-1]:
  factors=factorize(i)
  if factors.count(factors[0])==len(factors) and len(factors)>1:
    print(i)
    exit()
print(1)

Submission status: Wrong Answer

Solution code:
def factorize(m):
  factors=[]
  i=2
  if m==1:
    return [1]
  while m>1:
    if m%i==0:
      factors.append(i)
      m/=i
    else:
      i+=1
  return factors

n=int(input())
for i in range(1, n+1)[::-1]:
  factors=factorize(i)
  if factors.count(factors[0])==len(factors) and len(factors)>1:
    print(i)
    exit()

Submission status: Wrong Answer

Solution code:
def factorize(m):
  factors=[]
  i=2
  if m==1:
    return [1]
  while m>1:
    if m%i==0:
      factors.append(i)
      m/=i
    else:
      i+=1
  return factors

n=int(input())
for i in range(1, n+1)[::-1]:
  factors=factorize(i)
  if factors.count(factors[0])==len(factors):
    print(i)
    exit()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
X = int(input())
Xr = int(math.sqrt(X))
ans = 1
for i in range(2, X + 1):
    for j in range(2, X + 1):
        t = i ** j
    if ans < t <= X:
        ans = t
print(ans)

Submission status: Wrong Answer

Solution code:
import math
X = int(input())
Xr = int(math.sqrt(X))
ans = 1
for i in range(2, X + 1):
    for j in range(2, int(math.log(X, i)) + 1):
        t = i ** j
    if ans < t <= X:
        ans = t
print(ans)

Submission status: Wrong Answer

Solution code:
import math
X = int(input())
Xr = int(math.sqrt(X))
ans = 1
for i in range(2, Xr + 1):
    for j in range(2, int(math.log(X, i)) + 1):
        t = i ** j
    if ans < t <= X:
        ans = t
print(ans)

Submission status: Wrong Answer

Solution code:
import math
X = int(input())
Xr = int(math.sqrt(X)) + 1
ans = 1
for i in range(2, Xr + 1):
    y = int(math.log(X, i))
    t = i ** y
    if t > ans and y > 1:
        ans = t
print(ans)

Submission status: Wrong Answer

Solution code:
import math
X = int(input())
Xr = int(math.sqrt(X)) + 1
ans = 1
for i in range(2, Xr + 1):
    t = i ** int(math.log(X, i))
    if t > ans:
        ans = t
print(ans)

Submission status: Wrong Answer

Solution code:
import math
X = int(input())
Xr = int(math.sqrt(X))
ans = 1
for i in range(2, Xr + 1):
    y = int(math.log(X, i))
    if y > 1:
        t = i ** y
        if t > ans:
            ans = t
print(ans)

Submission status: Wrong Answer

Solution code:
import math
X = int(input())
Xr = int(math.sqrt(X))
ans = 1
for i in range(2, Xr + 1):
    t = i ** int(math.log(X, i))
    if t > ans:
        ans = t
print(ans)

Submission status: Wrong Answer

Solution code:
import math
X = int(input())
Xr = int(X ** 0.5)
ans = 1
for i in range(2, Xr + 1):
    t = int(i ** int(math.log(X, i)))
    if t > ans:
        ans = t
print(ans)

Submission status: Wrong Answer

Solution code:
import math
X = int(input())
Xr = int(X ** 0.5)
ans = 1
for i in range(2, Xr + 1):
    t = i ** int(math.log(X, i))
    if t > ans:
        ans = t
print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
c=[0]*10
for i in range(2,10):
    c[i]=(int(n**(1/i)))**i
    if c[i]>n:
        c[i]=0
print(max(c))

Submission status: Wrong Answer

Solution code:
n=int(input())
c=[0]*10
for i in range(1,10):
    c[i]=(int(n**(1/i)))**i
    if c[i]>n:
        c[i]=0
print(max(c))

Submission status: Wrong Answer

Solution code:
for i in range(int(input()), 0, -1):
    x = str(pow(i, 1/2)).split('.')
    if x[1] == '0':
        print(i)
        break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math 

x = int(input())
a = [1]
for i in range(1,x+1):
  for j in range(2,32):
    if math.log(i,j).is_integer() == True and i <= x:
      a.append(i)
print(max(a))

Submission status: Wrong Answer

Solution code:
import math 

x = int(input())
a = [1]
for i in range(1,x+1):
  for j in range(2,32):
    if math.log(i,j).is_integer() == True:
      a.append(i)
print(max(a))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x = int(input())

maxnum = 0

for i in range(1, x+1):
    if i**2 <= x:
        maxnum = i**2 if i**2 >= maxnum else maxnum
    elif i**3 <= x:
        maxnum = i**3 if i**3 >= maxnum else maxnum
 
print(maxnum)

Submission status: Wrong Answer

Solution code:
x = int(input())

ans = []

j = 1

for i in range(2, x + 1):
    j = i

    while(j * j <= x):
        j = j * i
        ans.append(j)

ans.append(1)


print(max(ans))

Submission status: Wrong Answer

Solution code:
x = int(input())
m = 1
b = 2
while b*b <= x:
  p = 2
  while b**p <= x:
    m = max(m, b**p)
    p += 1
  b += 1