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

Fixed submission:
X,N=map(int,input().split())
P=list(map(int,input().split()))
hako=set(P)
#print(hako)
ans=[]
P.sort()
kari=[]
for i in range(102):
    if i not in hako:
        kari.append(i)
for i in range(len(kari)):
    ans.append([abs(X-kari[i]),kari[i]])
ans.sort()
print(ans[0][1])

Buggy submission (verdict: Runtime Error):
import bisect
X,N=map(int,input().split())
P=list(map(int,input().split()))
hako=set(P)
kari=[]
if X<P[0]:
    print(X)
    exit()
if X>P[-1]:
    print(X)
    exit()
for i in range(102):
    if i not in hako:
        kari.append(i)
#print(kari)
kari.sort()
tekitpu=kari[bisect.bisect_left(kari,X)]
aho=kari[bisect.bisect_left(kari,X)-1]
#print(tekitpu,aho)
if abs(tekitpu-X)<abs(X-aho):
    print(tekitpu)
else:
    print(aho)

Buggy submission (verdict: Runtime Error):
import bisect
X,N=map(int,input().split())
P=list(map(int,input().split()))
P=set(P)
A=[]
for i in range(101):
    if i not in P:
        A.append(i)
zahyo=bisect.bisect_left(A,X)
ans=[]
ans.append([abs(X-A[zahyo]),A[zahyo]])
ans.append([abs(X-A[zahyo-1]),A[zahyo-1]])
ans.sort()
print(ans[0][1])

Buggy submission (verdict: Runtime Error):
import bisect
X,N=map(int,input().split())
P=list(map(int,input().split()))
hako=set(P)
P.sort()
kari=[]
if len(P)==0:
    print(100)
    exit()
if X<P[0]:
    print(X)
    exit()
if X>P[-1]:
    print(X)
    exit()
for i in range(-200,101):
    if i not in hako:
        kari.append(i)
#print(kari)
tekitpu=kari[bisect.bisect_left(kari,X)]
aho=kari[bisect.bisect_left(kari,X)-1]
#print(tekitpu,aho)
if abs(tekitpu-X)<abs(X-aho):
    print(tekitpu)
else:
    print(aho)

Buggy submission (verdict: Runtime Error):
import bisect
X,N=map(int,input().split())
P=list(map(int,input().split()))
hako=set(P)
P.sort()
kari=[]
if len(P)==0:
    print(100)
    exit()
if X<P[0]:
    print(X)
    exit()
if X>P[-1]:
    print(X)
    exit()
for i in range(101):
    if i not in hako:
        kari.append(i)
#print(kari)
tekitpu=kari[bisect.bisect_left(kari,X)]
aho=kari[bisect.bisect_left(kari,X)-1]
#print(tekitpu,aho)
if abs(tekitpu-X)<abs(X-aho):
    print(tekitpu)
else:
    print(aho)
Problem p02657 (python)

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

Buggy submission (verdict: Runtime Error):
kari

Buggy submission (verdict: Runtime Error):
test
Problem p02681 (python)

Fixed submission:
S=input()
T=input()
if S[0:len(T)-1] ==T[0:len(T)-1]:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
うんち
Problem p02731 (python)

Fixed submission:
L=int(input())
print((L/3)**3)

Buggy submission (verdict: Runtime Error):
L=int(input())
ans=[]
for i in range(1,L+1):
    for j in range(1,L-i+1):
        ans.append(i*j*(L-i-j))
print(max(ans))
Problem p02743 (python)

Fixed submission:
import math 
from decimal import Decimal 
a,b,c=map(int,input().split()) 
A=Decimal(a)**Decimal(0.5) 
B=Decimal(b)**Decimal(0.5)
C=Decimal(c)**Decimal(0.5)
if A+B<C: 
    print("Yes") 
else: 
    print("No")

Buggy submission (verdict: Runtime Error):
import math 
from decimal import Decimal a,b,c=map(int,input().split()) 
A=Decimal(a) 
B=Decimal(b)
C=Decimal(c) 
if math.sqrt(A)+math.sqrt(B)<math.sqrt(C): 
    print("Yes") 
else: 
    print("No")
Problem p02767 (python)

Fixed submission:
N=int(input())
X=list(map(int,input().split()))
ans=[]
for i in range(max(X)+1):
    goukei = 0
    for j in range(N):
        if i%1==0:
            goukei+=(X[j]-i)**2
    ans.append(goukei)
kotae=set(ans)
print(min(kotae))

Buggy submission (verdict: Runtime Error):
N=int(input())
X=list(map(int,input().split()))
ans=[]
for i in range(min(X),max(X)):
    goukei = 0
    for j in range(N):
        if i%1==0:
            goukei+=(X[j]-i)**2
    ans.append(goukei)
kotae=set(ans)
print(min(kotae))

Buggy submission (verdict: Runtime Error):
N=int(input())
X=list(map(int,input().split()))
ans=[]
for i in range(min(X),max(X)):
    goukei = 0
    for j in range(len(X)):
        if i%1==0:
            goukei+=(X[j]-i)**2
    ans.append(goukei)
kotae=set(ans)
print(min(kotae))

Buggy submission (verdict: Runtime Error):
N=int(input())
X=list(map(int,input().split()))
ans=[]
for i in range(min(X),max(X)):
    goukei = 0
    for j in range(len(X)):
        goukei+=(X[j]-i)**2
    ans.append(goukei)
kotae=set(ans)
print(min(kotae))

Buggy submission (verdict: Runtime Error):
N=int(input())
X=list(map(int,input().split()))
ans=[]
for i in range(min(X),max(X)):
    goukei = 0
    for j in range(len(X)):
        goukei+=(X[j]-i)**2
    ans.append(goukei)
print(min(ans))
Problem p02780 (python)

Fixed submission:
import sys
input = sys.stdin.readline
N,K=map(int,input().split())
P=list(map(int,input().split()))
kouho=0
def saikorokitaiti(A):
    return ((P[A]*(1+P[A])/2)/P[A])
kari=[]
hako=[]
kitaiti=0
if K==1:
    print(saikorokitaiti(P.index(max(P))))
    exit()
for i in range(K):
    hako.append(saikorokitaiti(i))
    kitaiti+=saikorokitaiti(i)
    kouho=kitaiti
b=0
for j in range(N-K+1):
    if j==0:
        continue
    elif j+K-1<N:
        hako.append(saikorokitaiti(j+K-1))
        kitaiti+=saikorokitaiti(j+K-1)
        kitaiti-=hako[b]
        b+=1
        kouho=max(kouho,kitaiti)
#print(kouho)
print(kouho)

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
P=list(map(int,input().split()))
kouho=[]
def saikorokitaiti(A):
    return ((P[A]*(1+P[A])/2)/P[A])
kari=[]
hako=[]
for i in range(N-K+1):
    if i == 0:
        for j in range(K):
            hako.append(saikorokitaiti(i+j))
        if K==1:
            print(sum(hako))
            exit()
    else:
        hako.append(saikorokitaiti(i+K-1))
        hako.pop(0)
        kouho.append(sum(hako))

print(max(kouho))

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
P=list(map(int,input().split()))
kouho=[]
def saikorokitaiti(A):
    return ((P[A]*(1+P[A])/2)/P[A])
kari=[]
hako=[]
for i in range(N-K+1):
    if i == 0:
        for j in range(K):
            hako.append(saikorokitaiti(i+j))
            if K==1:
                print(sum(hako))
                exit()
    else:
        hako.pop(0)
        hako.append(saikorokitaiti(i+K-1))
        kouho.append(sum(hako))

print(max(kouho))
Problem p02802 (python)

Fixed submission:
N,M=map(int,input().split())
PS=[input().split() for i in range(M)]
ACzumi=set()
WA_count=[]
for i in range(M):
    if not PS[i][0] in ACzumi:
        if PS[i][1]=="AC":
            ACzumi.add(PS[i][0])
        else:
            WA_count.append(PS[i][0])
yokei=0            
for i in range(len(WA_count)):
    if not WA_count[i] in ACzumi:
        yokei+=1
        
#print(ACzumi)
print(len(ACzumi),len(WA_count)-yokei)

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
ans = list(input().split() for i in range(M))
count = 0
hantei = []
cnt = 0
for i in range(len(ans)):
    if ans[i][1]=="AC":
        count += 1
        hantei.append(ans[i][0])

    else:
        cnt += 1
kotae = set(hantei)
kari=[ans[i][1] for i in range(len(ans))]
kari.reverse()

print(count-(count-len(kotae)),cnt-kari.index("AC"))
Problem p02837 (python)

Fixed submission:
N=int(input())
shogen=[]
count_ans=[]
for i in range(N):
    A=int(input())
    shogen.append([list(map(int,input().split())) for i in range(A)])
#print(shogen)
def saiki(A):
    if len(A)==N:
        honest=set()
        honest_kari=set()
        unkind=set()
        count=0
        unkind_kari=set()
        for i in range(N):
            if A[i]==1:
                honest.add(i)
            else:
                unkind.add(i)
        for i in range(N):
            if i in honest:
                for j in range(len(shogen[i])):
                    if shogen[i][j][1]==0:
                        unkind_kari.add(shogen[i][j][0]-1)
                    else:
                        honest_kari.add(shogen[i][j][0]-1)
        #print(honest,honest_kari)
        for i in unkind_kari:
            if i in unkind:
                count+=1
        for i in honest_kari:
            if i in honest:
                count+=1
        if count==len(unkind_kari)+len(honest_kari):
            kari=set(list(honest)+list(honest_kari))
            #print(honest,honest_kari,count)
            count_ans.append(len(kari))

        
        return
    for i in range(2):
        A.append(i)
        saiki(A)
        A.pop()
saiki([])
print(max(count_ans))

Buggy submission (verdict: Runtime Error):
N=int(input())
shogen=[]
count_ans=[]
for i in range(N):
    A=int(input())
    shogen.append([list(map(int,input().split())) for i in range(A)])
def saiki(A):
    if len(A)==N:
        honest=set()
        honest_kari=set()
        unkind=set()
        count=0
        unkind_kari=set()
        for i in range(N):
            if A[i]==1:
                honest.add(i)
            else:
                unkind.add(i)
        for i in range(N):
            if i in honest:
                for j in range(len(shogen[i])):
                    if shogen[i][j][1]==0:
                        unkind_kari.add(shogen[i][j][0])
                    else:
                        honest_kari.add(shogen[i][j][0])
        for i in honest:
            if i not in unkind_kari:
                if i not in unkind:
                    count+=1
        for i in unkind:
            if i not in honest_kari:
                if i not in honest:
                    count+=1
        if count==len(unkind_kari)+len(honest_kari):
            count_ans.append(len(honest))

        
        return
    for i in range(2):
        A.append(i)
        saiki(A)
        A.pop()
saiki([])
print(max(count_ans))
Problem p02885 (python)

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

if A > 2*B :
    print(A - 2*B)
else :
    print(0)

Buggy submission (verdict: Runtime Error):
A, B = map(int,input().split())

if A > 2B :
    print(A - 2B)
else :
    print(0)

Buggy submission (verdict: Runtime Error):
A,B = map(int,input().split())
if A > 2B :
  print(A - 2B)
else :
  print(0)

Buggy submission (verdict: Runtime Error):
A,B = map(int,input().split())
if A >> 2B :
  print(A - 2B)
else :
  print(0)
Problem p02886 (python)

Fixed submission:
N = int(input())
D = list(map(int,input().split()))
TotalList = 0

for A in range(N-1):
  for B in range(A+1,N):
    TotalList += D[A]*D[B]
    

print(TotalList)

Buggy submission (verdict: Runtime Error):
N = int(input())
D = list(map(int,input().split()))
TotalList = []

for A in range(N-1):
  for B in range(A+1):
    D[A]*D[B] = K
    TotalList.append(K)

print(sum(TotalList))

Buggy submission (verdict: Runtime Error):
N = int(input())
D = list(map(int,input().split()))
TotalList = []

for A in range(N-1):
  for B in range(A+1):
    D(A)*D(B) = K
    TotalList.append(K)

print(sum(TotalList))
Problem p02899 (python)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
ans=[]
kari=[]
for i in range(N):
    ans.append([A[i],i+1])
ans.sort()
#print(ans)
for j in range(N):
    kari.append(ans[j][1])
print(*kari)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
S = []
for i in range(1,N+1):
    S.append(A.index(i)+1)
print(*S)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
S = []
for i in range(1,N+1):
    S.append(A.index(i)+1)
print(*S)
Problem p02909 (python)

Fixed submission:
S=input()
if S == "Sunny":
    print("Cloudy")
if S == "Cloudy":
    print("Rainy")
if S == "Rainy":
    print("Sunny")

Buggy submission (verdict: Runtime Error):
s=input()
if s=="Sunny":
    print("Cloudy ")　
if s=="Cloudy":
    print("Rainy")
if s=="Rainy":
    print("Sunny")
Problem p03214 (python)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
heikin=sum(A)/N
kouho = []

if heikin in A:
    print(A.index(heikin))
else:
    for i in A:
        kouho.append(abs(heikin-i))
    ans = kouho.copy()
    ans.sort()
    print(kouho.index(ans[0]))

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
heikin=sum(A)/N
kouho = []

if heikin in A:
    print(A.index(heikin))
else:
    for i in A:
        kouho.append(abs(heikin-i))
    ans = kouho.copy()
    ans.sort()
print(kouho.index(ans[0]))
Problem p03633 (python)

Fixed submission:
def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a
N=int(input())
T=[int(input()) for i in range(N)]
def lcm(a,b):
    return a*b//gcd(a,b)
ans=1
for i in T:
    ans=lcm(ans,i)
print(ans)

Buggy submission (verdict: Runtime Error):
from math import gcd
N=int(input())
T=[int(input()) for i in range(N)]
def lcm(a,b):
    return a*b//gcd(a,b)
ans=1
for i in T:
    ans=lcm(ans,i)
print(ans)
Problem p03852 (python)

Fixed submission:
N=input()
ans=["a","i","u","e","o"]
if N in ans:
  print("vowel")
else:
  print("consonant")

Buggy submission (verdict: Runtime Error):
N=input()
ans=[a,i,u,e,o]
if N in ans:
  print("vowel")
else:
  print("consonant")
Problem p04030 (python)

Fixed submission:
s=input()
ans = []
for i in range(len(s)):
    ans.append(s[i])
j=1
while True:
    if ans[0]=="B":
        ans.pop(0)
    elif j>=len(ans):
        break
    elif ans[j]=="B":
        ans.pop(j-1)
        ans.pop(j-1)
        j-=1
    else:
        j+=1
print(*ans,sep="")

Buggy submission (verdict: Runtime Error):
s=input()
kouho = []
ans = [s[i] for i in range(len(s))]
for i in range(len(s)):
    if s[i] == "B" and i>=1:
        kouho.append(i-1)
kouho.sort()
kouho.reverse()
for j in kouho:
    ans.pop(j)
    ans.pop(j)
kesu = []
for k in range(len(ans)):
    if ans[k]=="B":
        kesu.append(k)
kesu.sort()
kesu.reverse()
for m in kesu:
    ans.pop(m)
print(*ans,sep="")
Problem p02732 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
cnt = [0 for _ in range(N)]
for i in range(N):
    cnt[A[i]-1] += 1
S = 0
for i in range(N):
    S += cnt[i]*(cnt[i]-1)/2
for i in range(N):
    if cnt[A[i]-1] == 1:
        print(int(S))
    else:
        print(int(S+(3-2*cnt[A[i]-1])/2))

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
cnt = [0 for _ in range(N)]
for i in range(N):
    cnt[A[i]-1] += 1
S = 0
for i in range(N):
    S += cnt[i]*(cnt[i]-1)/2
for i in range(N):
    if cnt[A[i]] == 1:
        print(S)
    else:
        print(int(S+(3-2*cnt[A[i]-1])/2))
Problem p02898 (python)

Fixed submission:
n, k = map(int, input().split())
h = list(map(int, input().split()))
ans = 0
for i in range(n):
    if h[i] >= k:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
h = map(input().split())
ans = 0
for i in range(n):
    if h[i] >= k:
        ans += 1
print(ans)
Problem p03030 (python)

Fixed submission:
N = int(input())
X = []
for i in range(N):
	s, p = input().split()
	X.append([s, -int(p),  i+1])
X.sort()
for i in range(N):
	print(X[i][2])

Buggy submission (verdict: Runtime Error):
N = int(input())
X = []
for i in range(N):
	s, p = input()
	X.append([s, -int(p),  i+1])
X.sort()
for i in range(N):
	print(-X[i][1])

Buggy submission (verdict: Runtime Error):
N = int(input())
X = []
for i in range(N):
	s, p = input()
	X.append([s, p,  i+1])
X.sort()
s = X[0][0]
for i in range(N):
	j = i
	while True:
		if j == len(X) - 1:
			break
		if X[j][0] != s:
			j -= 1
			break
		else j += 1
	for k in range(j-i+1):
		print(X[j][2])
		j -= 1

Buggy submission (verdict: Runtime Error):
N = int(input())
X = []
for i in range(N):
	s, p = input()
	X.append([s, p,  i+1])
X.sort()
s = X[0][0]
for i in range(N):
	j = i
	while True:
		if j == len(X) - 1:
			break
		if X[j][0] != s:
			j -= 1
			break
	for k in range(j-i+1):
		print(X[j][2])
		j -= 1
Problem p03078 (python)

Fixed submission:
x, y, z, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

a_plus_b = []
for i in a:
    for j in b:
        a_plus_b.append(i + j)
a_plus_b.sort(reverse=True)

a_plus_b_plus_c = []
for i in a_plus_b[:k]:
    for j in c:
        a_plus_b_plus_c.append(i + j)
a_plus_b_plus_c.sort(reverse=True)

for i in range(k):
    print(a_plus_b_plus_c[i])

Buggy submission (verdict: Runtime Error):
x, y, z, k = map(int, input().split())
a = []
a.append(list(map(int, input().split())))
a.append(list(map(int, input().split())))
a.append(list(map(int, input().split())))

a[0].sort()
a[1].sort()
a[2].sort()

# da = [a[i] - a[i+1] for i in range(len(a)-1)]
# db = [b[i] - b[i+1] for i in range(len(b)-1)]
# dc = [c[i] - c[i+1] for i in range(len(c)-1)]

ia = [len(a[0])-1, len(a[1])-1, len(a[2])-1]
deli = a[0][ia[0]] + a[1][ia[1]] + a[2][ia[2]]
for i in range(k):
    how_modi = None
    min_delta = 0
    if i != 0:
        for j in range(3):
            if ia[j] == 0:
                continue
            delta = a[j][ia[j]] - a[j][ia[j-1]]
            min_delta = delta
            for l in range(3):
                if l == j:
                    continue
                idx = ia[l]
                while True:
                    if a[l][idx] > delta or idx == len(a[l])-1:
                        break
                    idx += 1
                if min_delta > delta - a[l][idx] + a[l][ia[l]]:
                    if idx == ia[l]:
                        min_delta = delta - a[l][idx] + a[l][ia[l]]
                        how_modi = [j, l, idx]
                    else:
                        min_delta = delta - a[l][idx] + a[l][ia[l]]
                        how_modi = [j]
                else:
                    how_modi = [j]
    deli -= min_delta
    if len(how_modi) == 1:
        ia[how_modi[0]] -= 1
    else:
        ia[how_modi[0]] -= 1
        ia[how_modi[1]] = how_modi[2]
    print(deli)
Problem p03085 (python)

Fixed submission:
b = input()
if b == "A":
	print("T")
elif b == "T":
	print("A")
elif b == "G":
	print("C")
elif b == "C":
	print("G")

Buggy submission (verdict: Runtime Error):
inverse = ['A': 'T', 'T': 'A', 'G': 'C', 'C': 'G']
print(inverse[input()])
Problem p03103 (python)

Fixed submission:
n, m  = map(int, input().split())
arr = []
for i in range(n):
    a, b = map(int, input().split())
    arr.append([a, b])
arr.sort()
ans = 0
idx = 0
while True:
    if m <= 0:
        break
    ans += arr[idx][0] * min(arr[idx][1], m)
    m -= min(arr[idx][1], m)
    idx += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n, m  = map(int, input().split())
arr = []
for i in range(n):
    a, b = map(int, input().split())
    arr.append([a, b])
a.sort()
ans = 0
idx = 0
while True:
    if m <= 0:
        break
    ans += arr[idx][0] * min(arr[idx][1], m)
    m -= min(arr[idx][1], m)
    idx += 1
print(ans)
Problem p03292 (python)

Fixed submission:
a = [int(i) for i in input().split()]
print(max(a)-min(a))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(i) for i in input().split()]
print(max(a)-min(a))
Problem p02647 (python)

Fixed submission:
### ----------------
### ここから
### ----------------

import sys
from io import StringIO
import unittest

def yn(b):
    print("Yes" if b==1 else "No")
    return

def resolve():
    readline=sys.stdin.readline

    n,k=map(int, readline().rstrip().split())
    arr=list(map(int, readline().rstrip().split()))
    for _ in range(k):
        tmp=[0]*n
        for i in range(n):
            x = i - arr[i]
            y = i + arr[i] + 1
            if x<0:
                x=0
            if y<n:
                tmp[y]-=1
            tmp[x]+=1
        sm=tmp[0]
        arr[0]=tmp[0]
        for i in range(1,n):
            arr[i]=arr[i-1]+tmp[i]
            sm+=abs(tmp[i])
        if tmp[0]==n and sm==n:
            break
    print(" ".join(map(str,arr)))
    return

if 'doTest' not in globals():
    resolve()
    sys.exit()

### ----------------
### ここまで 
### ----------------

Buggy submission (verdict: Runtime Error):
### ----------------
### ここから
### ----------------

import sys
from io import StringIO
import unittest
import numpy as np

def yn(b):
    print("Yes" if b==1 else "No")
    return

def resolve():
    readline=sys.stdin.readline

    n,k=map(int, readline().rstrip().split())
    arr=list(map(int, readline().rstrip().split()))
    for _ in range(k):
        tmp=[0]*n
        for i in range(n):
            x = i - arr[i]
            y = i + arr[i] + 1
            if x<0:
                x=0
            if y<n:
                tmp[y]-=1
            tmp[x]+=1
        sm=tmp[0]
        arr[0]=tmp[0]
        for i in range(1,n):
            arr[i]=arr[i-1]+tmp[i]
            sm+=abs(tmp[i])
        if tmp[0]==n and sm==n:
            break
    print(" ".join(map(str,arr)))
    return

if 'doTest' not in globals():
    resolve()
    sys.exit()

### ----------------
### ここまで 
### ----------------
Problem p02690 (python)

Fixed submission:
### ----------------
### ここから
### ----------------

import sys
from io import StringIO
import unittest

def yn(b):
    print("Yes" if b==1 else "No")
    return

def resolve():
    readline=sys.stdin.readline
    x=int(readline())
    to=1001
    memo=[0]*to
    #memo={}
    for i in range(to):
        memo[i]=i**5

    a=0
    b=0
    if x==0:
        print(a,b)
        return

    for i in range(to):
        z1=x-memo[i]
        z2=memo[i]-x
        if z1 in memo:
            a=i
            for j in range(to):
                if memo[j]==z1:
                    b=j*-1
            break
        if z2 in memo:
            a=i
            for j in range(to):
                if memo[j]==z2:
                    b=j
            break
    #if a!=0 or b!=0:
    #    print(a,b)
    #    return
    print(a,b)
    return
    
    b=1000**5
    for i in range(1001,100000000):
        a=b
        b=i**5
        if (b-a)==x:
            print(i,(i-1))
            return

    return

if 'doTest' not in globals():
    resolve()
    sys.exit()

### ----------------
### ここまで 
### ----------------

Buggy submission (verdict: Runtime Error):
### ----------------
### ここから
### ----------------

import sys
from io import StringIO
import unittest

def yn(b):
    print("Yes" if b==1 else "No")
    return

def resolve():
    readline=sys.stdin.readline
    x=int(readline())
    to=6000
    memo=[0]*to
    #memo={}
    for i in range(to):
        memo[i]=i**5

    for i in range(to):
        z1=x-memo[i]
        z2=memo[i]-x
        if z1 in memo:
            a=i
            for j in range(to):
                if memo[j]==z1:
                    b=j*-1
            break
        if z2 in memo:
            a=i
            for j in range(to):
                if memo[j]==z1:
                    b=j
            break

    print(a,b)

    return

if 'doTest' not in globals():
    resolve()
    sys.exit()

### ----------------
### ここまで 
### ----------------