Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03612 (python)

Fixed submission:
N = int(input())
P = list(map(int, input().split()))

count = 0

for i in range(N):
  if P[i] == i + 1:
    if i + 1 == N:
      P[i - 1], P[i] = P[i], P[i - 1]      
    else:
      P[i], P[i + 1] = P[i + 1], P[i]
    count += 1

print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
P = list(map(int, input().split()))

count = 0

for i in range(N):
  if P[i] == i + 1:
    if i == N:
      P[i - 1], P[i] = P[i], P[i - 1]      
    else:
      P[i], P[i + 1] = P[i + 1], P[i]
    count += 1

print(count)
Problem p03679 (python)

Fixed submission:
X, A, B = map(int, input().split())

if B - A <= 0:
  print('delicious')
elif B - A <= X:
  print('safe')
else:
  print('dangerous')

Buggy submission (verdict: Runtime Error):
from sys import stdin
from collections import namedtuple
from heapq import heappush, heappop

input = stdin.readline


class UnionFind:
  def __init__(self, n):
    self.par = [i for i in range(n + 1)]
    self.size = [1] * (n + 1)

  def is_same(self, a, b):
    return self.find(a) == self.find(b)

  def unite(self, a, b):
    a = self.find(a)
    b = self.find(b)  
    if self.size[a] < self.size[b]:
      a, b = b, a
    self.par[b] = a
    self.size[a] += self.size[b]

  def size_of(self, a):
    return self.size[self.find(a)]

  def find(self, a):
    if a == self.par[a]:
      return a
    self.par[a] = self.find(self.par[a])
    return self.par[a]

Edge = namedtuple('Edge', 'w s t')
X = namedtuple('X', 'x i')
Y = namedtuple('Y', 'y i')

N = int(input())

edges = []
xg = []
yg = []

for i in range(N):
  x, y = map(int, input().split())
  xg.append(X(x, i))
  yg.append(Y(y, i))

xg.sort()
yg.sort()

for i in range(N - 1):
  x1, a = xg[i]
  x2, b = xg[i + 1]
  heappush(edges, Edge(abs(x1 - x2), a, b))

for i in range(N - 1):
  y1, a = yg[i]
  y2, b = yg[i + 1]
  heappush(edges, Edge(abs(y1 - y2), a, b))

u = UnionFind(N)
cost = 0

while edges:
  if u.size_of(0) >= N:
    break

  w, s, t = heappop(edges)
  if u.is_same(s, t):
    continue
  u.unite(s, t)
  cost += w

print(cost)
Problem p03716 (python)

Fixed submission:
from heapq import heapify, _heapify_max, heappushpop, _heappushpop_max

N = int(input())

numbers = [int(x) for x in input().split()]

left = numbers[:N]
left_sum = sum(left)
left_memo = [0] * N
heapify(left)

right = numbers[2 * N:]
right_sum = sum(right)
right_memo = [0] * N
_heapify_max(right)

middle = numbers[N:2 * N]

for i in range(0, N):
  left_sum += (middle[i] - heappushpop(left, middle[i]))
  left_memo[i] = left_sum

for i in range(N - 1, -1, -1):
  right_sum += (middle[i] - _heappushpop_max(right, middle[i]))
  right_memo[i] = right_sum

left_memo.insert(0, sum(numbers[:N]))
right_memo.insert(0, None)
right_memo.append(sum(numbers[2 * N:]))
    
print(
  max([left_memo[i] - right_memo[i + 1] for i in range(N + 1)])
)

Buggy submission (verdict: Runtime Error):
from heapq import heapify, _heapify_max, heappushpop, _heappushpop_max

N = int(input())

numbers = [int(x) for x in input().split()]

left = numbers[:N]
heapify(left)

right = numbers[2 * N:]
_heapify_max(right)

for x in numbers[N:2 * N]:
  if left[0] < x < right[0]:
    if abs(left[0] - x) > abs(left[0] - x):
      heappushpop(left, x)
    else:
      _heappushpop_max(right, x)
  elif x > left[0]:
    heappushpop(left, x)
  elif -x > right[0]:
    heappushpop(right, -x)
    
print(sum(left) - sum(right))
Problem p02694 (python)

Fixed submission:
x=int(input())

a=int(100)
for i in range (3800)  :
    a=int(a*1.01)
    #a=round(a) roundは四捨五入、intは切り捨て
    if a < x:
        continue
    else:
        break

print(i+1)
#range関数によるリストは1番目が0

Buggy submission (verdict: Runtime Error):
x=int(input())

a=int(100)
for i in range (3800)  :
    a=int(a*1.01)
    #a=round(a) roundは四捨五入、intは切り捨て
    if a < x:
        continue
    else:
        break

print(i+1)　
#range関数によるリストは1番目が0
Problem p02641 (python)

Fixed submission:
import itertools
X,N = map(int,input().split())

if N == 0 :
    print(X)
    exit()

P = list(map(int,input().split()))

L = sorted([abs(X-p) for p in P])
if 0 not in L :
    print(X)
    exit()

DL = list(set([x for x in L if L.count(x) > 1]))

ans_abs = 1
for i,x in enumerate(DL) :
    if x == i+1 :
        ans_abs += 1
    else :
        break

if X-ans_abs in P :
    print(X+ans_abs)
else :
    print(X-ans_abs)

Buggy submission (verdict: Runtime Error):
X,N = map(int,input().split())
P = [int(input()) for i in range(N)]

L = sorted([abs(X-p) for p in P])
if 0 not in L :
    print(X)
    exit()

DL = list(set([x for x in L if L.count(x) > 1]))

ans_abs = 1
for i,x in enumerate(DL) :
    if x == i+1 :
        ans_abs += 1
    else :
        break

if X-ans_abs in P :
    print(X+ans_abs)
else :
    print(X-ans_abs)
Problem p02719 (python)

Fixed submission:
N,K = map(int,input().split())
inc = abs(N-K)

if N <= inc :
    print(N)
elif K/2 < N%K :
    print(K-N%K)
else :
    print(N%K)

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
inc = abs(N-K)

if N <= inc :
    print(N)
else :
    print(N%inc)
Problem p02848 (python)

Fixed submission:
import string
l = string.ascii_uppercase

N = int(input())
S = input()

ans = []
for c in S :
    plusNumber = (l.index(c) + N) % 26
    ans.append(l[plusNumber])
print("".join(ans))

Buggy submission (verdict: Runtime Error):
import string
l = string.ascii_uppercase

N = int(input())
S = input()

ans = []
plusNumber = N % 26
for c in S :
    ans.append(l[l.index(c) + plusNumber])
print("".join(ans))
Problem p02909 (python)

Fixed submission:
N=input()
if N == "Sunny" :
    print("Cloudy")
elif N == "Cloudy" :
    print("Rainy")
else:
    print("Sunny")

Buggy submission (verdict: Runtime Error):
import sys
N,K,Q =map(int,input().split())
F = {}
A = []
for l in sys.stdin:
    A.append(int(l))
for i in range(N):
    cnt = A.count(i+1)
    F[str('A'+ str(i+1))] = K - (Q - cnt)
    if F[str('A'+ str(i+1))] >= 1 :
        print("Yes")
    else:
        print("No")
Problem p03076 (python)

Fixed submission:
T=[]
t=[]
for i in range(5):
    T.append(int(input()))
    t.append(T[i]%10)
if max(t) == 0 :
    ans = sum(T)
else :
    while 0 in t  :
        t.remove(0)
    ans = sum(T)+10*len(t)-sum(t)-10+min(t)
print(ans)

Buggy submission (verdict: Runtime Error):
T=[]
t=[]
for i in range(5):
    T.append(int(input()))
    t.append(T[i]%10)
while 0 in t :
    t.remove(0)
ans = sum(T)+10*len(t)-sum(t)-10+min(t)
print(ans)
Problem p03103 (python)

Fixed submission:
N,M=map(int,input().split())
Xa={}
ans=0
for i in range(N):
    V,S=map(int,input().split())
    if V in Xa :
        Xa[V] += S
    else :
        Xa[V]=S
Xb=sorted(Xa.items())
for i in range (len(Xb)) :
    M -= Xb[i][1]
    ans += Xb[i][0]*Xb[i][1]
    if M <= 0 :
        ans -= abs(M)*Xb[i][0]
        break
 
print(ans)

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
Xa={}
ans=0
for i in range(N):
    V,S=map(int,input().split())
    Xa[V]=S
Xb=sorted(Xa.items())
for i in range (N) :
    M -= Xb[i][1]
    ans += Xb[i][0]*Xb[i][1]
    if M <= 0 :
        ans -= abs(M)*Xb[i][0]
        break

print(ans)

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
Xa={}
ans=0
for i in range(N):
    V,S=map(int,input().split())
    Xa[V]=S
Xb=sorted(Xa.items())
for i in range (N) :
    M -= Xb[i][1]
    ans += Xb[i][0]*Xb[i][1]
    if M < 0 :
        ans -= abs(M)*Xb[i][0]
        break
    elif M == 0 :
        break
print(ans)

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
Xa={}
ans=0
for i in range(N):
    V,S=map(int,input().split())
    Xa[V]=S
Xb=sorted(Xa.items())
for i in range (N) :
    M -= Xb[i][1]
    ans += Xb[i][0]*Xb[i][1]
    if M < 0 :
        ans -= abs(M)*Xb[i][0]
        break
print(ans)
Problem p04019 (python)

Fixed submission:
import sys
#sys.stdin = open('a_3.txt', 'r')
chars = list(raw_input())
#N, E, S, W
directions = [0 for _ in range(4)]

for c in chars:
	if c == 'N':
		directions[0] = 1
	elif c == 'E':
		directions[1] = 1
	elif c == 'S':
		directions[2] = 1
	else:
		directions[3] = 1

if ((directions[0] == directions[2]) and (directions[1] == directions[3])):
	print 'Yes'
else:
	print 'No'

Buggy submission (verdict: Runtime Error):
import sys

#sys.stdin = open('b_2.txt', 'r')

N = int(raw_input())
rest = [0 for _ in range(N)]
ins = [0 for _ in range(N)]
pairs = 0
for x in range(N):
	n = long(raw_input())
	ins[x] = n
	pairs += n / 2
	rest[x] = n % 2

for x in range(0, N - 1, 1):
	if ((rest[x] == 1) and (rest[x + 1] == 1)):
		pairs += 1
	elif ((rest[x] == 1) and (rest[x + 1] == 0) and (ins[x + 1] > 0)):
		rest[x + 1] = 1
		ins[x + 1] -= 2
		rest[x] = 0
	else:
		pass

print str(pairs)
Problem p04020 (python)

Fixed submission:
import sys

#sys.stdin = open('b_2.txt', 'r')

N = int(raw_input())
rest = [0 for _ in range(N)]
ins = [0 for _ in range(N)]
pairs = 0
for x in range(N):
	n = long(raw_input())
	ins[x] = n
	pairs += n / 2
	rest[x] = n % 2

for x in range(0, N - 1, 1):
	if ((rest[x] == 1) and (rest[x + 1] == 1)):
		pairs += 1
		rest[x] = 0
		rest[x + 1] = 0
	elif ((rest[x] == 1) and (rest[x + 1] == 0) and (ins[x + 1] > 0)):
		rest[x + 1] = 1
		ins[x + 1] -= 2
		rest[x] = 0
	else:
		pass

print str(pairs)

Buggy submission (verdict: Runtime Error):
import sys

sys.stdin = open('b_1.txt', 'r')

N = int(raw_input())
rest = [0 for _ in range(N)]
pairs = 0
for x in range(N):
	n = long(raw_input())
	pairs += n / 2
	rest[x] = n % 2

for x in range(1, N, 1):
	if ((rest[x - 1] == 1) and (rest[x] == 1)):
		pairs += 1
		rest[x] = 0

print str(pairs)
Problem p04029 (python)

Fixed submission:
import sys

#sys.stdin = open('a_2.txt', 'r')
N = int(raw_input())

print str(((N+1) * N) / 2)

Buggy submission (verdict: Runtime Error):
import sys

sys.stdin = open('a_2.txt', 'r')
N = int(raw_input())

print str(((N+1) * N) / 2)
Problem p02786 (python)

Fixed submission:
import numpy as np
import math
H = int(input())

cnt = np.log2(H)
cnt = math.floor(cnt)
cnt = 2**(cnt + 1) - 1
print(cnt)

Buggy submission (verdict: Runtime Error):
#include <iostream>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
const int MOD = 1E9 + 9;
const int INF = 1<<29; 

long long f(long long x){
    if(x == 1) return 1;
    return f(x/2) * 2 + 1;
}

int main(){
    long long H;
    cin >> H;
    cout << f(H) << endl;
    return 0;
}
Problem p02958 (python)

Fixed submission:
N = int(input())
p = list(map(int, input().split()))
cnt = 0
l = list()

for i in range(N-1):
    if p[i] > p[i+1]:
        cnt += 1
        l.append(i)

if cnt > 2:
    print('NO')
if cnt == 1:
    print('NO')
if cnt == 0:
    print('YES')
if cnt == 2:
    p[l[0]], p[l[1]+1] = p[l[1]+1], p[l[0]]
    cnt = 0
    for i in range(N-1):
        if p[i] > p[i+1]:
            cnt += 1
            l.append(i)
    if cnt == 0:
        print('YES')
    else:
        print('NO')

Buggy submission (verdict: Runtime Error):
N = int(input())
p = list(map(int, input().split()))
cnt = 0
l = list()

for i in range(N-1):
    if p[i] > p[i+1]:
        cnt += 1
        l.append(i)

if cnt <= 1:
    print('YES')
elif (cnt==2) and (p[l[0]-1] <= p[l[1]+1] <= p[l[0]+1]) and (p[l[1]] <= p[l[0]] <= p[l[1]+2]):
    print('YES')
else: print('NO')
Problem p02642 (python)

Fixed submission:
n = int(input())
a = sorted(list(map(int, input().split())))

a_max = a[-1]
ans_list = [0] * a_max

ans = 0

for i in range(n-1):

    p = a[i]

    if ans_list[p-1] == 0:
        for q in range(1, (a_max//p)+1):
            ans_list[p*q-1] = 1
            
        if a[i] != a[i+1]:
            ans += 1

if ans_list[a_max-1] == 0:
    ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = sorted(list(map(int, input().split())))

a_max = a[-1]
ans_list = [0] * a_max

ans = 0

for i in range(n):

    p = a[i]
    
    if ans_list[p-1] == 0:
        for q in range(1, (a_max//p)+1):
            ans_list[p*q-1] = 1
        
        if a[i] != a[i+1]:
            ans += 1

print(ans)
Problem p02684 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**7)

def teleport(city, end, teleportmap, count=1):

    next_city = teleportmap[city]

    if count == end:
        return next_city

    else:
        return teleport(next_city, end, teleportmap, count+1)

n, k = map(int,input().split())
a = list(map(int, input().split()))
teleportmap = dict(zip(range(1, len(a)+1), a))

if k <= n:
    print(teleport(1, k, teleportmap))

else:
    countmap = [0]*n
    countmap[0] = 1

    next_city =1
    for _ in range(1, n+1):
        next_city = a[next_city-1]
        countmap[next_city -1] += 1
        if countmap[next_city -1] == 2:
            start = next_city
            break

    roop = {}
    for j in range(1, n+1):
        roop[start] = teleportmap[start]
        start = roop[start]
    
    num_r = len(roop)

    num_until_r= 0
    for m in teleportmap.keys():
        if m not in roop and countmap[m-1] != 0:
            num_until_r += 1
    
    k_r = k - num_until_r
    num_end = k_r%num_r

    if num_end == 0:
        print(next_city)
        
    else:
        print(teleport(next_city, num_end, roop))

Buggy submission (verdict: Runtime Error):
sys.setrecursionlimit(10**7)

def teleport(city, end, teleportmap, count=1):

    next_city = teleportmap[city]

    if count == end:
        return next_city

    else:
        return teleport(next_city, end, teleportmap, count+1)

n, k = map(int,input().split())
a = list(map(int, input().split()))
teleportmap = dict(zip(range(1, len(a)+1), a))

if k <= n:
    print(teleport(1, n, teleportmap))

else:
    countmap = [0]*n
    countmap[0] = 1

    next_city =1
    for _ in range(1, n+1):
        next_city = a[next_city-1]
        countmap[next_city -1] += 1
        if countmap[next_city -1] == 2:
            start = next_city
            break

    roop = {}
    for j in range(1, n+1):
        roop[start] = teleportmap[start]
        start = roop[start]
    
    num_r = len(roop)

    num_until_r= 0
    for m in teleportmap.keys():
        if m not in roop and countmap[m-1] != 0:
            num_until_r += 1
    
    k_r = k - num_until_r
    num_end = k_r%num_r

    if num_end == 0:
        print(next_city)
        
    else:
        print(teleport(next_city, num_end, roop))
Problem p02767 (python)

Fixed submission:
# coding: utf-8
# Your code here!

def main():
    number_of_human = int(input())
    position_list = list(map(int,input().split()))
    
    start_position = min(position_list)
    end_position = max(position_list)
    max_answear = sum([(item - start_position)**2 for item in position_list])
    while True:
        answear = sum([(item - start_position)**2 for item in position_list])
        if start_position == end_position:
            break
        start_position += 1
        if answear < max_answear:
            max_answear = answear
    
    print(max_answear)
if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!

def main():
    number_of_human = int(input())
    position_list = list(map(int,input().split()))
    
    start_position = min(position_list)
    end_position = max(position_list)
    
    answear_list = []
    
    while True:
        answear = sum([(item - start_position)**2 for item in position_list])
        if start_position == end_position:
            break
        start_position += 1
        answear_list.append(answear)
    
    print(min(answear_list))
    
if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!

import sympy

def cal_result(result_param,info_list):
    result = 0
    for num in info_list:
        num = int(num)
        result = result + (num-result_param)**2
    return result
    

def min_answear(info):
    param = sympy.Symbol('param')
    formula = sympy.Symbol('formula')
    
    formula = 0
    for num in info:
        num = int(num)
        calculate = sympy.Symbol('calculate')
        calculate = (num - param)**2
        formula = formula + calculate
        
    result_form = sympy.diff(formula , param)
    result = sympy.solve(result_form)
    result = str(result[0])
    result = result.split("/")
    result = int(result[0])/int(result[1])
    
    if result.is_integer():
        result = int(result)
        answear = cal_result(result,info)
    else:
        result1 = int(result)
        sub_answear1 = cal_result(result1,info)
        result2 = int(result) + 1
        sub_answear2 = cal_result(result2,info)
        if sub_answear1 <= sub_answear2:
            answear = sub_answear1
        else:
            answear = sub_answear2
    
    print(answear)
    
def main():
    join_num = int(input())
    
    join_info = input()
    join_info = join_info.split()
    min_answear(join_info)

if __name__ == "__main__":
    main()
Problem p03086 (python)

Fixed submission:
S = input()
N = len(S)
ans = 0
for i in range(N):
	for j in range(i, N):
		if all('ACGT'.count(c) == 1 for c in S[i : j + 1]):
			ans = max(ans, j - i + 1)
print(ans)

Buggy submission (verdict: Runtime Error):
S = input()
N = len(S)
ans = 0
for i in range(N):
for j in range(i, N):
if all('ACGT'.count(c) == 1 for c in S[i : j + 1]):
ans = max(ans, j - i + 1)
print(ans)
Problem p03109 (python)

Fixed submission:
S = input()
print('Heisei' if S <= '2019/04/30' else 'TBD')

Buggy submission (verdict: Runtime Error):
S = input()
 print('Heisei' if S <= '2019/04/30' else 'TBD')

Buggy submission (verdict: Runtime Error):
S = input()
2 print('Heisei' if S <= '2019/04/30' else 'TBD')

Buggy submission (verdict: Runtime Error):
S = input()
2 print('Heisei' if S <= '2019/04/30' else 'TBD')

Buggy submission (verdict: Runtime Error):
S = input()
2 print('Heisei' if S <= '2019/04/30' else 'TBD')
Problem p02705 (python)

Fixed submission:
import numpy as np
 
R = int(input())
print(R*2.*np.pi)

Buggy submission (verdict: Runtime Error):
import numpy as np

R = int(input())
print(R*2.*np.pi)
Problem p02640 (python)

Fixed submission:
X, Y = map(int, input().split(' '))

ans = 'No'
for x in range(X+1):
  if 2*x + 4*(X-x) == Y:
    ans = 'Yes'
    break
    
print(ans)

Buggy submission (verdict: Runtime Error):
X, Y = map(int, input().split(' '))

ans = 'No'
for x in range(X+1):
  if 2*x + 4*(X-x) == y:
    ans = 'Yes'
    break
    
print(ans)

Buggy submission (verdict: Runtime Error):
x, y = map(int, input().stlip(' '))

if y % 2 != 0:
  print('No')
elif y - 2 * x < 0:
  print('No')
else:
  print('Yes')
Problem p02660 (python)

Fixed submission:
# from math import factorial,sqrt,ceil #,gcd
# from itertools import permutations,combinations,combinations_with_replacement
from collections import deque,Counter
# from bisect import bisect_left
from heapq import heapify,heappush,heappop
# from numba import njit
# from functools import lru_cache # 簡単メモ化 @lru_cache(maxsize=1000)
# from fractions import gcd

# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np    # numpy.lcm()
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix
# from scipy.special import comb,perm #permはnPk
# import networkx as nx
# G = Graph()

# slist = "abcdefghijklmnopqrstuvwxyz"
N = 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

if N == 1:
    print(0)
    exit()

ans = 0
cnt_primes = Counter(prime_factorize(N))

for i in cnt_primes:
    j = 1
    while cnt_primes[i]>=0:
        cnt_primes[i] -= j
        if cnt_primes[i]>=0:
            ans += 1
        else:
            break
        j += 1

print(ans)

Buggy submission (verdict: Runtime Error):
# from math import factorial,sqrt,ceil #,gcd
# from itertools import permutations,combinations,combinations_with_replacement
# from collections import deque,Counter
# from bisect import bisect_left
from heapq import heapify,heappush,heappop
# from numba import njit
# from functools import lru_cache # 簡単メモ化 @lru_cache(maxsize=1000)
# from fractions import gcd

# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np    # numpy.lcm()
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix
# from scipy.special import comb,perm #permはnPk
# import networkx as nx
# G = Graph()

# slist = "abcdefghijklmnopqrstuvwxyz"
N = int(input())

def primes(n):
    ass = []
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    for i in range(len(is_prime)):
        if is_prime[i]:
            ass.append(i)
    return ass

if N == 1:
    print(0)
    exit()

ans = 0
_ , Zque = primes(N)
Zset = set(Zque)
Z = heappop(Zque)
if N in Zque:
    print(1)
    exit()

while N >= Z:
    # print(N,Z)
    if N%Z == 0:
        ans += 1
        N = N//Z
    i = Z
    num = Z
    j = 2
    while num <= N:
        # print("num=",num,"N=",N,"j=",j)
        if not num in Zset:
            heappush(Zque,num)
            Zset.add(num)
        num = i**j
        j += 1
    Z = heappop(Zque)

print(ans)
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する
# print("{:.10f}".format(ans))
# print("{:0=10d}".format(ans))