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())
if x==1:
    print(1)
else:
    for i in range(x):
        if i*i>=x:
            break
        else:
            ix = i*i
    print(ix)

Submission status: Wrong Answer

Solution code:
X = int(input())
ma = 1
for b in range(1, int(X ** 0.5) + 1):
    n = 1
    if b == 1:
        continue
    while n < X:
        ma = max(ma, n)
        n *= b
print(ma)

Submission status: Wrong Answer

Solution code:
X=int(input())
a=2
ans=1
if X==1:
    print(1)
    exit()
else:
    while a<1001:
        for i in range(2,1001):
            if a**i<=X:
                ans=a**i
            else:
                break
        a+=1
print(ans)

Submission status: Wrong Answer

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

k = int(math.sqrt(a))
print(k**2)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np
X = int(input())
n = np.sqrt(X)
ans = int(n) * int(n)
print(ans)

Submission status: Wrong Answer

Solution code:
X = int(input())
fact = [1]
for i in range(2, 40):
  cnt = 1
  p = i
  while(p <= 1000):
    if(cnt >= 2):
      fact.append(p)
    p = p*i
    cnt += 1
fact.sort()
print(fact)
ans = 0
for n in fact:
  if(n <= X):
    ans = n
  else:
    break
print(ans)

Submission status: Wrong Answer

Solution code:
X = int(input())
fact = [1]
for i in range(2, 40):
  p = i
  while(p <= 1000):
    fact.append(p)
    p = p*i
fact.sort()
ans = 0
for n in fact:
  if(n <= X):
    ans = n
  else:
    break
print(ans)

Submission status: Wrong Answer

Solution code:
X = int(input())
fact = [1]
for i in range(2, 40):
  p = i
  while(p <= 1000):
    fact.append(p)
    p = p*i
fact.sort()
ans = 0
for n in fact:
  if(n <= X):
    ans = n
  else:
    print(ans)
    break

Submission status: Wrong Answer

Solution code:
X = int(input())
ans = 0
for b in range(1, X):
    for p in range(2, X):
        tmp = b ** p
        if ans < tmp and tmp <= X:
            ans = tmp
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x = int(input())

ans = 1
for i in range(2, x+1):
  n = 2
  while i ** n < x:
    ans = i ** n
    n += 1
print(ans)

Submission status: Wrong Answer

Solution code:
x = int(input())
ans = 1
for b in range(1, int(1000**.5)+1):
    for p in range(2, 10):
        if b**p <= x:
            ans = b**p
print(ans)

Submission status: Wrong Answer

Solution code:
x = int(input())

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

Submission status: Wrong Answer

Solution code:
x = int(input())
b = []
for i in [2,3,5,7,11,13,17,19,23,29,31]:
    for j in range(2, 10):
        b.append(i**j)
b.sort()
ans = 1
for i in b:
    if i <= x:
        ans = i
    else:
        break
print(ans)

Submission status: Wrong Answer

Solution code:
X = int(input())
num = [1]
for i in range(1, 33):
    b = i+1
    p = 2
    while b ** p <= 1000 and b ** p not in num:
        num.append(b ** p)
        
ans = [num[i] for i in range(len(num)) if num[i] <= X]
print(ans[-1])

Submission status: Wrong Answer

Solution code:
from collections import Counter
import sys

X = int(input())
num = []

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

for j in range(1, X):
    tmp = j + 1
    lis = []
    while tmp != 1:
        for i in range(2, tmp+1):
            if tmp % i == 0:
                lis.append(i)
                tmp = tmp // i
                break
    if len(Counter(lis)) == 1 and len(lis) > 1:
        num.append(j+1)

print(max(num))

Submission status: Wrong Answer

Solution code:
from collections import Counter
import sys

X = int(input())
num = []

if X == 1:
    print(1)
    sys.exit()

for j in range(1, X):
    tmp = j + 1
    lis = []
    while tmp != 1:
        for i in range(2, tmp+1):
            if tmp % i == 0:
                lis.append(i)
                tmp = tmp // i
                break
    if len(Counter(lis)) == 1 and len(lis) > 1:
        num.append(j+1)

print(max(num))

Submission status: Wrong Answer

Solution code:
from collections import Counter
import sys

X = int(input())
num = []

if X == 1:
    print(1)
    sys.exit()

for j in range(1, X):
    tmp = j + 1
    lis = []
    while tmp != 1:
        for i in range(2, tmp+1):
            if tmp % i == 0:
                lis.append(i)
                tmp = tmp // i
                break
    if len(Counter(lis)) == 1 and len(lis) != 1:
        num.append(j+1)

print(max(num))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x = int(input())
ans = 1
for i in range(x, 0, -1):
  m = i
  for j in range(2,int(m**0.5)+2):
    if m%j==0:
      while m%j ==0:
        m //= j
      if m== 1 and j != i:
        print(i)
        exit()
print(ans)

Submission status: Wrong Answer

Solution code:
x = int(input())
ans = 1
for i in range(x, 0, -1):
  m = i
  for j in range(2,int(m**0.5)+2):
    if m%j==0:
      while m%j ==0:
        m //= j
      if m== 1:
        print(i)
        exit()
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
import math

input = sys.stdin.readline
MOD = 1000000007

X = int(input())

sa = 100000
res = 0

if X == 1:
    print(1)
else:
    for i in range(2,X):
        a = int(math.log(X,i))
        if (sa > (X - (i**a))) & ( a != 1):
            sa = X - (i**a)
            res = i**a

    print(res)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil
from operator import itemgetter
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
inf = 10**17
mod = 10**9 + 7

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

n=I()

for i in range(n):
    j=n-i
    u=prime_factorize(j)
    if len(list(set(u)))==1 and len(u)>1:
        print(j)
        sys.exit()
print(1)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil
from operator import itemgetter
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
inf = 10**17
mod = 10**9 + 7

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

n=I()
for i in range(n):
    j=n-i
    u=prime_factorize(j)
    if len(list(set(u)))==1 and len(u)>1:
        print(j)
        sys.exit()

Submission status: Wrong Answer

Solution code:
x = int(input())

ans = 0
for i in range(100):
    for j in range(100):
        if i ** j <= x:
            ans = max(ans, i ** j)

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x = int(input())
  
for i in range(x, 0, -1):
  ans = i
  div = []
  for j in range(2,int(x**0.5)+2):
    count = 0
    if i%j ==0:
      while i%j==0:
        i //= j
        count += 1
      div.append(count)
  if i != 1:
    div.append(1)
  if len(div) == 1 and div[0] > 1:
    print(ans)
    break
else:
  print(1)

Submission status: Wrong Answer

Solution code:
x = int(input())
for i in range(x, 0, -1):
  ans = i
  div = []
  for j in range(2,int(x**0.5)+2):
    count = 0
    if i%j ==0:
      while i%j==0:
        i //= j
        count += 1
      div.append(count)
  if len(div) == 1 and div[0] > 1:
    print(ans)
    break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for i in reversed(range(x+1)):
    if int(round(math.sqrt(i))**2) == i:
        print(i)
        break

Submission status: Wrong Answer

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

for i in reversed(range(x)):
    if round(math.sqrt(i))**2 == i:
        print(i)
        break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from math import log, floor, sqrt
# ABC097B

x = int(input())
Max = 0
for y in range(1, floor(sqrt(x))+1):
    p = 2 if y == 1 else floor(log(x) / log(y))
    z = y ** p
    if z > Max:
        Max = z
print(Max)

Submission status: Wrong Answer

Solution code:
x = int(input())
for i in reversed(range(x + 1)):
    if (i ** 0.5).is_integer():
        print(i)
        break

Submission status: Wrong Answer

Solution code:
X = int(input())

ans = 0
for i in range(1, 34, 1):
    if i*i<=X:
        ans = i
print(ans*ans)

Submission status: Wrong Answer

Solution code:
X = int(input())

ans = 0
for i in range(1, 32, 1):
    if i*i<=X:
        ans = i
print(ans*ans)

Submission status: Wrong Answer

Solution code:
for i in range(1,int(input())+1)[::-1]:
  for j in range(2,int(i**(1/2))+1):
    if i%j==0:
      temp=i
      while temp%j==0:
        temp//=j
      if temp==1:print(i);exit()

Submission status: Wrong Answer

Solution code:
import math
x=int(input())
a=0
if x==1:
    print(1)
    exit()
for i in range(1,math.ceil(math.sqrt(x))):
    a=max(a,i**2)
print(a)

Submission status: Wrong Answer

Solution code:
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop

import collections

x = int(input())
li = [1]
b = 2
if x == 0:
    print(0)
    sys.exit()
while True:
    if b == 100:
        break
    p = 2
    while True:
        d = b**p
        if d>=x:
            break
        li.append(d)
        p += 1
    b+=1
li.sort()
print(li[-1])

Submission status: Wrong Answer

Solution code:
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop

import collections

x = int(input())
li = [1]
b = 2
while True:
    if b == 100:
        break
    p = 2
    while True:
        d = b**p
        if d>=x:
            break
        li.append(d)
        p += 1
    b+=1
li.sort()
print(li[-1])

Submission status: Wrong Answer

Solution code:
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop

import collections

x = int(input())
i = 0
while True:
    a = i**2
    if x<a:
        break
    i+=1
if x == 0:
    print(0)
    sys.exit()
print((i-1)**2)

Submission status: Wrong Answer

Solution code:
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop

import collections

x = int(input())
i = 1
while True:
    a = i**2
    if x<a:
        break
    i+=1
print((i-1)**2)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
import re
import math
from collections import defaultdict
import itertools
from copy import deepcopy
import random
from heapq import heappop,heappush
import time
import os
import queue
import sys
import datetime
from functools import lru_cache
readline=sys.stdin.readline
sys.setrecursionlimit(2000)
#import numpy as np
alphabet="abcdefghijklmnopqrstuvwxyz"
mod=int(10**9+7)
inf=int(10**20)
def yn(b):
    if b:
        print("yes")
    else:
        print("no")
def Yn(b):
    if b:
        print("Yes")
    else:
        print("No")
def YN(b):
    if b:
        print("YES")
    else:
        print("NO")
class union_find():
    def __init__(self,n):
        self.n=n
        self.P=[a for a in range(N)]
        self.rank=[0]*n
 
    def find(self,x):
        if(x!=self.P[x]):self.P[x]=self.find(self.P[x])
        return self.P[x]
 
    def same(self,x,y):
        return self.find(x)==self.find(y)
 
    def link(self,x,y):
        if self.rank[x]<self.rank[y]:
            self.P[x]=y
        elif self.rank[y]<self.rank[x]:
            self.P[y]=x
        else:
            self.P[x]=y
            self.rank[y]+=1
 
    def unite(self,x,y):
        self.link(self.find(x),self.find(y))
 
    def size(self):
        S=set()
        for a in range(self.n):
            S.add(self.find(a))
        return len(S)
def is_power(a,b):#aはbの累乗数か
    now=b
    while now<a:
        now*=b
    if now==a:return True
    else:return False
def bin_(num,size):
    A=[0]*size
    for a in range(size):
        if (num>>(size-a-1))&1==1:
            A[a]=1
        else:
            A[a]=0
    return A
def get_facs(n,mod_=0):
    A=[1]*(n+1)
    for a in range(2,len(A)):
        A[a]=A[a-1]*a
        if(mod>0):A[a]%=mod_
    return A
def comb(n,r,mod,fac):
    if(n-r<0):return 0
    return (fac[n]*pow(fac[n-r],mod-2,mod)*pow(fac[r],mod-2,mod))%mod
def next_comb(num,size):
    x=num&(-num)
    y=num+x
    z=num&(~y)
    z//=x
    z=z>>1
    num=(y|z)
    if(num>=(1<<size)):return False
    else:
        return num
def get_primes(n,type="int"):
    A=[True]*(n+1)
    A[0]=False
    A[1]=False
    for a in range(2,n+1):
        if A[a]:
            for b in range(a*2,n+1,a):
                A[b]=False
    if(type=="bool"):return A
    B=[]
    for a in range(n+1):
        if(A[a]):B.append(a)
    return B
def is_prime(num):
    if(num<=2):return False
    i=2
    while i*i<=num:
       if(num%i==0):return False
       i+=1
    return True
def ifelse(a,b,c):
    if a:return b
    else:return  c
def join(A,c=" "):
    n=len(A)
    A=list(map(str,A))
    s=""
    for a in range(n):
        s+=A[a]
        if(a<n-1):s+=c
    return s
def factorize(n,type_="dict"):
    b = 2
    list_ = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            list_.append(b)
        b+=1
    if n > 1:list_.append(n)
    if type_=="dict":
        dic={}
        for a in list_:
            if a in dic:
                dic[a]+=1
            else:
                dic[a]=1
        return dic
    elif type_=="list":
        return list_
    else:
        return None
def floor_(n,x=1):
    return x*(n//x)
def ceil_(n,x=1):
    return x*((n+x-1)//x)
def hani(x,min_,max_):
    ret=x
    if x<min_:ret=min_
    if x>max_:ret=max_
    return ret
def seifu(x):
    return x//abs(x)

###################################################
def main():
    x=int(input())
    F=factorize(x)
    ans=0
    for a,b in F.items():
        ans=max(ans,a**b)
    print(ans)
main()

Submission status: Wrong Answer

Solution code:
from math import sqrt, log
x = int(input())
ans = 1
for i in range(2, x):
    n = int(pow(i, max(2, int(log(x, i)))))
    if n <= x:
        ans = max(ans, n)
print(ans)

Submission status: Wrong Answer

Solution code:
from math import sqrt, log
x = int(input())
ans = 1
for i in range(2, int(sqrt(x)) + 1):
    n = int(pow(i, max(2, int(log(x, i)))))
    if n <= x:
        ans = max(ans, n)
print(ans)

Submission status: Wrong Answer

Solution code:
from math import sqrt, log
x = int(input())
ans = 1
for i in range(2, int(sqrt(x)) + 1):
    n = int(pow(i, int(log(x, i))))
    if n <= x:
        ans = max(ans, n)
print(ans)

Submission status: Wrong Answer

Solution code:
from math import sqrt, log
x = int(input())
ans = 1
for i in range(2, int(sqrt(x)) + 1):
    ans = max(ans, int(pow(i, int(log(x, i)))))
print(ans)

Submission status: Wrong Answer

Solution code:
from math import sqrt, log
x = int(input())
ans = 1
for i in range(2, int(sqrt(x)) + 1):
    ans = int(pow(i, int(log(x, i))))
print(ans)

Submission status: Wrong Answer

Solution code:
X=int(input())
ans=0
for b in range(1,33):
	for p in range(2,11):
		if b**p<=X:
			ans=b**p
print(ans)

Submission status: Wrong Answer

Solution code:
X=int(input())
ans=0
for b in range(1,33):
	for p in range(2,11):
		if b**p<X:
			ans=b**p
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x = int(input())
for i in range(1, x+1):
    v = i ** (1/2)
    if v.is_integer():
        ans = int(i)

print(ans)

Submission status: Wrong Answer

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

if X == 1:
  list.append(1)

elif X == 2:
  list.append(2)
  
else:
  for b in range(2, X):
    p = 2
    while b ** p < X:
      list.append(b ** p)
      p += 1
      
print(max(list))

Submission status: Wrong Answer

Solution code:
import math 
X=int(input())
max_num=0
for i in range(2,10):
  tei=math.ceil(X**(1/i))
  if max_num<tei**i:
    max_num=tei**i
print(max_num)

Submission status: Wrong Answer

Solution code:
import math 
X=int(input())
max_num=0
for i in range(1,10):
  tei=math.floor(X**(1/i))
  if max_num<tei**i:
    max_num=tei**i
print(max_num)

Submission status: Wrong Answer

Solution code:
X=int(input())
ans=1
for i in range(1,X):
    for j in range(40):
        for k in range(40):
            if i==j**k:
                ans=j**k
print(ans)

Submission status: Wrong Answer

Solution code:
X=int(input())
if X==1:
    print(1)
    exit()
N=[1]
i=2
while True:
    N.append(i**2)
    i+=1
    if N[-1]>1000:
        break
N.append(X)
N.sort()
if N.count(X)==2:
    print(N[N.index(X)])
else:
    print(N[N.index(X)-1])

Submission status: Wrong Answer

Solution code:
import math 
X=int(input())
max_num=0
c=[]
for i in range(2,11):
  tei=math.floor(X**(1/i))
  c.append(tei**i)
print(max(c))

Submission status: Wrong Answer

Solution code:
import math 
X=int(input())
max_num=0
for i in range(2,11):
  tei=math.floor(int(X**(1/i)))
  if max_num<tei**i:
    max_num=tei**i
print(max_num)

Submission status: Wrong Answer

Solution code:
import math 
X=int(input())
max_num=0
for i in range(2,11):
  tei=math.floor(X**(1/i))
  if max_num<tei**i:
    max_num=tei**i
print(max_num)

Submission status: Wrong Answer

Solution code:
import math 
X=int(input())
max_num=0
for i in range(1,10):
  tei=math.floor(X**(1/i))
  if max_num<tei**i:
    max_num=tei**i
print(max_num)

Submission status: Wrong Answer

Solution code:
import math 
X=int(input())
max_num=0
for i in range(2,11):
  tei=math.floor(X**(1/i))
  if max_num<=tei**i:
    max_num=tei**i
print(max_num)

Submission status: Wrong Answer

Solution code:
import math 
X=int(input())
max_num=0
for i in range(2,10):
  tei=math.floor(X**(1/i))
  if max_num<=tei**i:
    max_num=tei**i
print(max_num)

Submission status: Wrong Answer

Solution code:
import math
X=int(input())
max_num = 0
for i in range(2,10):
  tei = math.floor(X**(1/i))
  if max_num < tei**i:
    max_num = tei**i
print(max_num)

Submission status: Wrong Answer

Solution code:
x = int(input())
# n, k = list(map(int, input().split()))
# a = list(map(int, input().split()))
_max = 0
for i in range(2, x+1):
    for j in range(2, x+1):
        if pow(i, j) > _max and pow(i, j) <= x:
            _max = pow(i, j)
        if pow(i, j) > x:
            break

print(_max)

Submission status: Wrong Answer

Solution code:
# coding:utf-8
import math
x = int(input())
num = math.floor(x ** 0.5)
# print(num)

print(num ** 2)

Submission status: Wrong Answer

Solution code:
x = int(input())

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

Submission status: Wrong Answer

Solution code:
x = int(input())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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


if __name__ == '__main__':
    main()

# import sys
# input = sys.stdin.readline
# 
# sys.setrecursionlimit(10 ** 7)
# 
# (int(x)-1 for x in input().split())
# rstrip()
#
# def binary_search(*, ok, ng, func):
#     while abs(ok - ng) > 1:
#         mid = (ok + ng) // 2
#         if func(mid):
#             ok = mid
#         else:
#             ng = mid
#     return ok

Submission status: Wrong Answer

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

for i in range(1, X):
  for j in range(2, X):
    num = i ** j
    if num > X:
      break
    ans = num

print(ans)

Submission status: Wrong Answer

Solution code:
def main():
    X = int(input())
    for i in range(X, 0, -1):
        p = 2
        while True:
            a = pow(i, 1 / p)
            if a % 1 == 0:
                print(i)
                exit()
            if a < 2:
                break
            p += 1


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

for i in range(1, X):
  for j in range(2, X):
    num = i ** j
    if num >= X:
      break
    ans = num

print(ans)

Submission status: Wrong Answer

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

for i in range(1, 1001):
  for j in range(2, 1001):
    num = i ** j
    if num > X:
      break
    ans = num

print(ans)

Submission status: Wrong Answer

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

for i in range(1, X+1):
  for j in range(1, X+1):
    num = i ** j
    if num >= ans and num <= X:
      ans = num

print(ans)

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    X=int(input())
    print(int(X**0.5)**2)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x = int(input())
li = []
for i in range(100):
    n = i+1
    while x >= n**2:
        li.append(n**2)
        n += 1
print(max(li))

Submission status: Wrong Answer

Solution code:
import math
X=int(input())
max_num = 0
for i in range(2,9):
  tei = math.floor(X**(1/i))
#  print(tei,i,tei**i)
  if max_num < tei**i:
    max_num = tei**i
print(max_num)

Submission status: Wrong Answer

Solution code:
import math
X=int(input())
max_num = 0
for i in range(1,9):
  tei = math.floor(X**(1/i))
  if max_num < tei**i:
    max_num = tei**i
print(max_num)

Submission status: Wrong Answer

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

print((N-1)**2)

Submission status: Wrong Answer

Solution code:
X = int(input())

num_list = [1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196, 225, 256, 289, 324, 361, 400, 441, 484, 529, 576,
            625, 676, 729, 784, 841, 900, 961, 1024]

for i in range(len(num_list)):
    if X < num_list[i]:
        print(num_list[i - 1])
        exit()

Submission status: Wrong Answer

Solution code:
X = int(input())

num_list = [1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196, 225, 256, 289, 324, 361, 400, 441, 484, 529, 576,
            625, 676, 729, 784, 841, 900, 961, 1024]

i = 0
while num_list[i] <= X:
    i += 1

print(num_list[i - 1])

Submission status: Wrong Answer

Solution code:
x = int(input())

def prime_factorize(n:int):
    l = []
    if n == 1:
        l.append(1)
        return l

    while n % 2 == 0:
        l.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            l.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        l.append(n)
    return l

def judge (p:int):
    if p == 1:
        return True

    l = prime_factorize(p)
    if len(set(l)) == 1 and len(l) > 1:
        return True
    else:
        return False

for i in range(x,0,-1):
    if judge(i):
        print (i)
        exit ()

Submission status: Wrong Answer

Solution code:
x=int(input())

def func(x):
    for i in range(x):
        if (x-i)**0.5%1==0:
            return x-i

print(func(x))

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

Submission status: Wrong Answer

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

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

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

x = int(input())
#print(factorization(8))

if x < 4:
    print(1)
else:
    for i in range(x,3,-1):
        if len(factorization(i)) == 1:
            if factorization(i)[0][1] != 1:
                print(i)
                #print(factorization(i))
                break
        else:
            for k in range(1,len(factorization(i))):
                if factorization(i)[k-1] != factorization(i)[k] or factorization(i)[k-1] == 1:
                    break
            else:
                print(i)
                break

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

x = int(input())
#print(factorization(8))

if x < 4:
    print(1)
else:
    for i in range(x,0,-1):
        if len(factorization(i)) == 1:
            if factorization(i)[0][1] != 1:
                print(i)
                #print(factorization(i))
                break

Submission status: Wrong Answer

Solution code:
x = int(input())
def prime_factorize(n):
    a = set()
    while n % 2 == 0:
        a.add(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.add(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.add(n)
    return len(a) == 1
for i in range(x,0,-1):
    if prime_factorize(i):
        print(i)
        break

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

x = int(input())
#print(factorization(997))

for i in range(x,0,-1):
    if len(factorization(i)) == 1:
        if factorization(i)[0][1] != 1:
            print(i)
            break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def solve():
    X = int(input())
    ans = 0
    for i in range(2,32):
        for j in range(2,11):
            x = pow(i,j)
            if X < x:
                break
            if ans < x:
                ans = x

    print(ans)
if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

Solution code:
x=int(input())
if x==1000:
  print(1000)
l=[1]
for i in range(2,32):
  k=2
  while i**k<=1000:
    l.append(i**k)
    k+=1
l=sorted(l)
for i in range(len(l)-1):
  if l[i]<=x<l[i+1]:
    print(l[i])
    exit()
print(961)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x=int(input())
l=[1]
for i in range(2,32):
  k=2
  while i**k<=1000:
    l.append(i**k)
    k+=1
l=sorted(l)
for i in range(len(l)-1):
  if l[i]<=x<l[i+1]:
    print(l[i])
    exit()
print(961)