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())
res=0
for b in range(x):
    for p in range(2,x):
        if res<(b**p)<=x:
            res=b**p
        elif b**p>x:
            break
print(res)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 6)
mod = 10**9+7
cnt = 0
ans = 0
num = []
inf = float("inf")
al = "abcdefghijklmnopqrstuvwxyz"
AL = al.upper()

x = k()

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

print(ans**2)

Submission status: Wrong Answer

Solution code:
from math import *

x = int(input())

lst1 = list(range(2, int(sqrt(1000)) + 1))
lst2 = [1]

for n in lst1:
   i = 2
   while n ** i < 1000:
      lst2.append(n ** i)
      i += 1

lst2 = list(set(lst2))
lst2.sort()

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

print(lst2[-1])

Submission status: Wrong Answer

Solution code:

N = int(input())

max_n = 1
for i in range(2,N+1):
    for j in range(2,N+1):
        if i ** j <= N:
            max_n = i ** j
        if i ** j > N:
            break
print(int(max_n))

Submission status: Wrong Answer

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

    max_n = 1
    for i in range(2,N+1):
        for j in range(2,N+1):
            if i ** j <= N:
                max_n = i ** j
            if i ** j > N:
                break
    print(int(max_n))


if __name__ == "__main__":
    expone()

Submission status: Wrong Answer

Solution code:

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

    max_n = 1
    for i in range(2,N+1):
        for j in range(2,N+1):
            if i ** j <= N:
                max_n = i ** j
            if i ** j > N:
                break
    print(max_n)


if __name__ == "__main__":
    expone()

Submission status: Wrong Answer

Solution code:

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

    while N > 0:
        i = 1
        while i <= N:
            if i ** 2 == N:
                print(N)
                return 0
            i += 1
        N -= 1

if __name__ == "__main__":
    expone()

Submission status: Wrong Answer

Solution code:
N = int(input())
ans = 0
for i in range(1, N + 1):
    for j in range(1, 20):
        if i ** j > N:
            continue
        ans = max(i ** j, ans)
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
ans = 0
for i in range(1, N):
    for j in range(1, 20):
        if i ** j > N:
            break
        ans = max(i ** j, ans)
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline
import numpy as np

def factorization(n):
    arr = []
    temp = n
    if n<=3:
        return [n,1]
    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

def main():
    n = int(input())
    if n==1:
        print(1)
        exit()
    while True:
        if n >0:
            dp=np.array(factorization(n),dtype=np.int)
            if len(dp)==1 and dp[0][1]!=1:
                print(n)
                exit()
            n-=1
        else:
            break

if __name__=="__main__":
    main()

Submission status: Wrong Answer

Solution code:
#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline
import numpy as np

def factorization(n):
    arr = []
    temp = n
    if n<=3:
        return [n,1]
    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

def main():
    n = int(input())
    if n==1:
        print(1)
        exit()
    while True:
        dp=np.array(factorization(n),dtype=np.int)
        if np.all(dp[:,1:]!=1) and len(dp)==1:
            print(n)
            exit()
        else:
            n-=1

if __name__=="__main__":
    main()

Submission status: Wrong Answer

Solution code:
#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline
import numpy as np

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

def main():
    n = int(input())
    if n==1:
        print(1)
        exit()
    while True:
        dp=np.array(factorization(n),dtype=np.int)
        if np.all(dp[:,1:]!=1) and len(dp)==1:
            print(n)
            exit()
        else:
            n-=1

if __name__=="__main__":
    main()

Submission status: Wrong Answer

Solution code:
X = int(input())
ans = 1
for i in range(X):
    N, n = X - i, X - i
    b = 0
    for j in range(2, n):
        if b == 0:
            while N % j == 0:
                N //= j
                b = 1
        else:
            break
    if b == 1 and N == 1:
        ans = n
        break
print(ans)

Submission status: Wrong Answer

Solution code:
X = int(input())
a = 0
while a == 0:
    b = 0
    N, n = X, X
    for i in range(2, int(X ** 0.5) + 2):
        if b == 0:
            while N % i == 0:
                N //= i
                b = 1
        else:
            break
    if N == 1:
        ans = n
        a = 1
        print(ans)
    X -= 1

Submission status: Wrong Answer

Solution code:
n = int(input())

def check(p):
  c = 0
  for i in range(2,p):
    while p % i == 0:
      p //= i
      if p != 1 and p % i != 0:
        return False
      if p == 1:
        return True
  return False

for i in range(n):
  if check(n-i):
    print(n-i)
    break

Submission status: Wrong Answer

Solution code:
a=int(input())
d=0
e=0
for i in range(40):
  b=i+2
  while b<a:
    b=b*(i+2)
    e=e+1
  c=b/(i+2)
  if e>1:
    if d<=c:
      d=c
      e=0
  else:
    e=0
print(int(d))

Submission status: Wrong Answer

Solution code:
a=int(input())
d=0
for i in range(40):
  b=i+2
  while b<a:
    b=b*(i+2)
  c=b/(i+2)
  if d<=c:
    d=c
print(int(d))

Submission status: Wrong Answer

Solution code:
a=int(input())
d=0
for i in range(30):
  b=i+2
  while b<a:
    b=b*(i+2)
  c=b/(i+2)
  if d<=c:
    d=c
print(int(d))

Submission status: Wrong Answer

Solution code:
a=int(input())
d=0
for i in range(1000):
  b=i+2
  while b<a:
    b=b*(i+2)
  c=b/(i+2)
  if d<=c:
    d=c
print(int(d))

Submission status: Wrong Answer

Solution code:
a=int(input())
d=0
for i in range(33):
  b=i+2
  while b<a:
    b=b*(i+2)
  c=b/(i+2)
  if d<=c:
    d=c
print(int(d))

Submission status: Wrong Answer

Solution code:
a=int(input())
d=0
for i in range(33):
  b=i+2
  while b<a:
    b=b*(i+2)
  c=b/(i+2)
  if d<c:
    d=c
print(int(d))

Submission status: Wrong Answer

Solution code:
a=int(input())
d=0
for i in range(2,33):
  b=i
  while b<a:
    b=b*i
  c=b/i
  if d>c:
    d=c
print(d)

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 = 0
for i in range(1,x):
    for j in range(2,50):
        if i**j<=x:
            ans = max(ans,i**j)
        else:
            break
    if i**2>x:
        break
print(ans)

Submission status: Wrong Answer

Solution code:
a=1
kazu=[]
while 1:
  if a*a>1000:
    break
  kazu.append(a*a)
  a+=1
x=int(input())
for i in range(len(kazu)):
  if kazu[len(kazu)-1-i]<=x:
    print(kazu[len(kazu)-1-i])
    exit()

Submission status: Wrong Answer

Solution code:
x=int(input())
for i in range(x+1):
  ima=x-i
  for j in range(ima+1):
    if j*j==ima:
      print(ima)
      exit()

Submission status: Wrong Answer

Solution code:
x=int(input())
for i in range(x):
  ima=x-i
  for j in range(ima+1):
    if j*j==ima:
      print(ima)
      exit()

Submission status: Wrong Answer

Solution code:
import sys
 
X = int(sys.stdin.readline())
ans = 0
for i in range(X+1):
	for j in range(11):
		tmp = pow(i, j)
		if tmp <= X:
			ans = max(ans, tmp)
print(ans)

Submission status: Wrong Answer

Solution code:
import math

X = int(input())

a = math.floor(X**0.5)
b = math.ceil(X**0.5)

if b**2 <= X:
    print(b**2)
else:
    print(a**2)

Submission status: Wrong Answer

Solution code:
import math

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

Submission status: Wrong Answer

Solution code:
n=int(input())
ans=1
for b in range(2,100):
    tmp=1
    for p in range(2,10):
        tmp*=b
        if tmp<=n :
            ans=max(ans,tmp)
print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
ans=1
for b in range(2,100):
    tmp=1
    for p in range(2,10):
        tmp*=b
        if tmp<n :
            ans=max(ans,tmp)
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 = max(ans, i**j)
        elif i**j > x:
            break

print(ans)

Submission status: Wrong Answer

Solution code:
x = int(input())

ans = 0
for i in range(1, x):
    for j in range(1, x):
        if i**j <= x:
            ans = max(ans, i**j)
        elif i**j > x:
            break

print(ans)

Submission status: Wrong Answer

Solution code:
x = int(input())
bekis = [1]
for i in range(2,35):
    for j in range(2,15):
        v = i**j
        if v > x: break
        bekis.append(v)

print(bekis[-1])

Submission status: Wrong Answer

Solution code:
import sys, math
lines = [s.rstrip("\n") for s in sys.stdin.readlines()]
x, = [int(num) for num in lines.pop(0).split(" ")]
max_base = int(math.sqrt(x))
max = 1
for base in range(2, max_base + 1):
    i = 2
    while True:
        tmp_max = base ** i
        if tmp_max <= x:
            max = tmp_max
            i += 1
        else:
            break
print(max)

Submission status: Wrong Answer

Solution code:
import math

X = int(input())

x = math.sqrt(X)
print(int(x) ** 2)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

x = int(input())

def prime_factorize(n):
    prime_factors = []
    i = 2
    while i ** 2 <= n:
        exp = 0
        while n % i == 0:
            exp += 1
            n //= i
        if exp:
            prime_factors.append((i, exp))
        i += 1

    if n != 1:
        prime_factors.append((n, 1))
    return prime_factors

ans = 1
for i in range(2, x + 1):
    prime_factors = prime_factorize(i)
    if len(prime_factors) == 1 and prime_factors[0][1] != 1:
        ans = i
print(ans)

Submission status: Wrong Answer

Solution code:
X = int(input())
ans = 0
for i in range(2, 33):
  a = 1
  while a * i <= X:
    a *= i
  ans = max(ans, a)
print(ans)

Submission status: Wrong Answer

Solution code:
X = int(input())

maxi = 0

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

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

print(maxi)

Submission status: Wrong Answer

Solution code:
X = int(input())

maxi = 0

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

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

print(maxi)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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())
nums = set()
for b in range(1, 40):
    p = 2
    if b**p <= 1000:
        nums.add(b**p)
        p += 1
    else:
        continue
ans = -1
for num in nums:
    if num <= X:
        ans = max(ans, num)
print(ans)

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

def solve():
    X = int(input())
    for i in range(X, 2, -1):
        F = factorization(i)
        mi = min(f[1] for f in F)
        if mi > 1 and all([f[1] % mi == 0 for f in F]):
            print(i)
            exit()
        print(1)

if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

Solution code:
def make_divisors(n):
    lower_divisors, upper_divisors = [], []
    i = 1
    while i * i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n // i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

def solve():
    X = int(input())
    for i in range(X, 0, -1):
        d = make_divisors(i)
        if len(d) == 1 or len(d) == 3:
            print(i)
            exit()

if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

Solution code:
def make_divisors(n):
    lower_divisors, upper_divisors = [], []
    i = 1
    while i * i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n // i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

def solve():
    X = int(input())
    for i in range(X, 0, -1):
        d = make_divisors(i)
        if len(d) % 2 == 1:
            print(i)
            exit()

if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

Solution code:
X=int(input())

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

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

while True:
    a=prime_factorize(X)
    sw=True
    if len(a)==1:
        sw=False
    for i in range(len(a)-1):
        if a[i]!=a[i+1]:
            sw=False
    if sw==True:
        print(X)
        exit()
    X-=1

Submission status: Wrong Answer

Solution code:
X=int(input())

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

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

while True:
    a=prime_factorize(X)
    temp=1
    sw=True
    for i in range(len(a)-1):
        if a[i]!=a[i+1]:
            if temp%2==1:
                temp=0
                sw=False
        temp+=1
    if temp%2==1:
        sw=False
    if sw==True:
        print(X)
        exit()
    X-=1

Submission status: Wrong Answer

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

for i in range(1,int(math.sqrt(x))+2):
    if i**2 > x:
        print((i-1)**2)
        exit()

Submission status: Wrong Answer

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

for i in range(1,int(math.sqrt(x))+2):
    if i**2 > x:
        print((i-1)**2)

Submission status: Wrong Answer

Solution code:
X = int(input())
cands = [i * i for i in range(1, 32)]
for i in range(1, 31):
    if cands[i] > X:
        print(cands[i - 1])
        break
else:
    print(cands[-1])

Submission status: Wrong Answer

Solution code:
X = int(input())
cands = [i * i for i in range(1, 32)]
for i in range(31):
    if cands[i] > X:
        print(cands[i - 1])
        break
else:
    print(cands[-1])

Submission status: Wrong Answer

Solution code:
X=int(input())
ans=0
for i in range(X+1):
    if i*i<=X:
        sum=i*i
        for j in range(X):
            if i*(i*j)>X:
                break
            sum=max(sum,i*(i*j))
    else:
        break
    ans=max(ans,sum)

print(sum)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x = int(input())
X = int(x**0.5)
print((X+1)**2 if (X+1)**2 <= x else X**2)

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())
bp = 0
if x == 1:
    print(1)
else:
    for b in range(2,int(math.sqrt(x))):
        num = int(x**(1/b))**b
        if bp < num:
            bp = num
    print(bp)

Submission status: Wrong Answer

Solution code:
n = int(input())
import math as m
if n < 4:
  print(1)
  exit(0)
  
perfect = 1
for i in range(2,int(n**0.5)+1):
  x = i**(int(m.log(n,i)))
  perfect = max(perfect,x)
  if perfect == n:
    break

print(int(perfect))

Submission status: Wrong Answer

Solution code:
n = int(input())
import math as m
if n < 4:
  print(1)
  exit(0)
  
perfect = 1
for i in range(2,int(n**0.5)+1):
  x = i**(int(m.log(n,i)))
  perfect = max(perfect,x)
  if perfect == n:
    break

print(perfect)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x=int(input())
data=[1,2,3,5,7,11,13,17,19,23,29,31]
ans=0
for i in data:
  for j in range(2,10):
    if i**j<=x:
      ans=max(ans,i**j)
print(ans)

Submission status: Wrong Answer

Solution code:
x=int(input())
data=[2,3,5,7,11,13,17,19,23,29,31]
if x==1:
  print(1)
  exit()
ans=0
for i in data:
  for j in range(2,10):
    if i**j<=x:
      ans=max(ans,i**j)
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x = int(input())
pr = [1]
for i in range(2,32):
    for j in range(2,10):
        if (i**j < 1000)&(i**j not in pr):
            pr.append(i**j)
print(max([k for k in pr if k <= x]))
print(pr)

Submission status: Wrong Answer

Solution code:
a = int(input())
print(max(j ** i for j in range(32) for i in range(2, 10) if j ** i >= a))

Submission status: Wrong Answer

Solution code:
import math
a = int(input())
for i in range(a, 0, -1):
  for j in range(2, 10):
    if i == int(math.pow(i, 1/j)) ** j:
      print(i)
      break
  else:
    continue
  break

Submission status: Wrong Answer

Solution code:
import math
a = int(input())
print(int(math.pow(a,1/3)) ** 3)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x = int(input())
pr = [1]
for i in range(2,32):
    for j in range(2,11):
        if (i**j < 1000)&(i**j not in pr):
            pr.append(i**j)
print(max([k for k in pr if k <= x]))

Submission status: Wrong Answer

Solution code:
from bisect import *
A = {1}
for p in range(2,11):
    for b in range(2,33):
        A.add(p**b)
A = list(A)
A.sort()
X = int(input())
print(A[bisect_right(A,X)-1])

Submission status: Wrong Answer

Solution code:
from bisect import *
A = {1}
for p in range(2,11):
    for b in range(1,33):
        A.add(p**b)
A = list(A)
A.sort()
X = int(input())
print(A[bisect_right(A,X)-1])

Submission status: Wrong Answer

Solution code:
from bisect import *
A = [x**2 for x in range(33)]
X = int(input())
print(A[bisect_right(A,X)-1])

Submission status: Wrong Answer

Solution code:
from bisect import *
A = [x**2 for x in range(33)]
X = int(input())
print(A[bisect_left(A,X)-1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
import math

#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入g
#
# インデックス系
# int min_y = max(0, i - 2), max_y = min(h - 1, i + 2);
# int min_x = max(0, j - 2), max_x = min(w - 1, j + 2);
#
#
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
#mod = 998244353
from sys import stdin
readline = stdin.readline
def readInts():
  return list(map(int,readline().split()))
def readTuples():
    return tuple(map(int,readline().split()))
def I():
  return int(readline())
x = I()
import math
a = int(math.sqrt(x))
print(a**2)

Submission status: Wrong Answer

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

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
ans = 1
for i in range(X):
  Y = X - i
  f = collections.Counter(prime_factorize(Y))
  if len(list(f.keys())) == 1 and (list(f.keys())[0] == 1 or list(f.values())[0] > 1):
    ans = Y
    break
print(ans)

Submission status: Wrong Answer

Solution code:
X = int(input())

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
for i in range(X):
  Y = X - i
  f = factorization(Y)
  if len(f) == 1 and (f[0][0] == 1 or f[0][1] > 1):
    print(Y)
    break

Submission status: Wrong Answer

Solution code:
x = int(input())
y = int(x**0.5)
if (y+1)**2 <= x:
    y += 1
print(y**2)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x=int(input())
a=[]
for i in range(1,110):
  for j in range(2,100):
    if i**j<=x:
      a.append(i**j)
print(a[-1])

Submission status: Wrong Answer

Solution code:
x = int(input())

y = 1

while y * y <= x:
    y += 1

print((y-1) ** 2)

Submission status: Wrong Answer

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

ans = 1
for Y in range(X,1,-1):
    for b in range(Y,1,-1):
        p = math.log(Y,b)
        if p % 1 ==0 and p > 1:
            ans = max(ans, b ** p)
print(int(ans))

Submission status: Wrong Answer

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

ans = 1
for Y in range(X,1,-1):
    for b in range(Y,2,-1):
        p = math.log(Y,b)
        if p % 1 ==0 and p > 1:
            ans = max(ans, b ** p)
print(int(ans))

Submission status: Wrong Answer

Solution code:
x = int(input())

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

import sys
for i in range(x,0,-1):
    if len(set(prime_factorize(i)))==1 and len(prime_factorize(i))>1:
        print(i)
        sys.exit()
print(1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

for i in range(x, 0, -1):
    for j in range(1, i+1):
        if i == j*j:
            print(i)
            exit()

Submission status: Wrong Answer

Solution code:
x=int(input())

for i in range(x, 0, -1):
    for j in range(1, i):
        if i == j*j:
            print(i)
            exit()

Submission status: Wrong Answer

Solution code:
x=int(input())

for i in range(x, 0, -1):
    for j in range(1, int(i**(1/2))+1):
        if i/j == j:
            print(i)
            exit()

Submission status: Wrong Answer

Solution code:
import math
x = int(input())
for i in range(x,0,-1):
    if math.sqrt(i).is_integer() == True:
        print(i)
        break

Submission status: Wrong Answer

Solution code:
import sys
from math import floor

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def main():
    x = I()
    ans = 1
    for i in range(2, x+1):
        temp = floor(x**(1/i))
        ans = max(ans, temp**i)
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
from math import floor

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def main():
    x = I()
    ans = 1
    for i in range(2, x):
        temp = floor(x**(1/i))
        ans = max(ans, temp**i)
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
from math import floor

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def main():
    x = I()
    ans = 1
    for i in range(2, x):
        temp = floor(x**(1/i))
        if temp == 1:
            break
        ans = max(ans, temp**i)
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import math
X = int(input())
def expo(x):
    ans = 1
    for i in range(1,x+1):
        if math.sqrt(i).is_integer() == True:
            ans = i
    return ans
print(expo(X))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

x = int(input())

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

Submission status: Wrong Answer

Solution code:
X=int(input())
res=0
for b in range(1,X+1):
  for p in range(2,X+1):
    if b**p<=X :
      res=max(res,b**p)
    else:
      break
print(res)

Submission status: Wrong Answer

Solution code:
X=int(input())
res=[]
for b in range(1,X+1):
  for p in range(2,X+1):
    if b**p<=X :
      res.append(b**p)
if X==1 or X==2 :
  print(1)
else :
  print(res[-1])

Submission status: Wrong Answer

Solution code:
X=int(input())
res=[]
for b in range(1,X):
  for p in range(2,X):
    if b**p<=X :
      res.append(b**p)
if X==1 or X==2 :
  print(1)
else :
  print(res[-1])

Submission status: Wrong Answer

Solution code:
n=int(input())
res=1
k=1
for b in range(1,int(n**0.5)+1):
    for p in range(2,n):
        if b**p>n:
            break
        else:
            res=b**p
print(res)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x = int(input())
min = 10000
for i in range(1,1000):
	for j in range(2,40):
		if x-i**j < min and 0 < x-i**j:
			min = x-i**j
if min > 1000:
	print(x)
else:
	print(x-min)

Submission status: Wrong Answer

Solution code:
x = int(input())
min = 1000
for i in range(1,1000):
	for j in range(2,40):
		if x-i**j < min and 0 < x-i**j:
			min = x-i**j
print(x-min)

Submission status: Wrong Answer

Solution code:
x = int(input())
min = 1000
for i in range(1,1000):
	for j in range(2,40):
		if 1000-i**j < min and 0 < 1000-i**j:
			min = 1000-i**j
print(1000-min)

Submission status: Wrong Answer

Solution code:
n = int(input())
while n > 0:
    for i in range(n):
        for j in range(2, 10):
            if n == i**j:
                print(n)
                exit()
    n -= 1
print(n)

Submission status: Wrong Answer

Solution code:
X = int(input())
check =[]
check2=[]
for i in range(1,33):
    for s in range(2,11):
        check.append(pow(i,s))

#print(check)
for i in check:
    if i<=X:
        check2.append(i)
print(check2)
print(max(check2))