Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

def getInts():
    return [ int(x) for x in input().split() ]

def f(B):
    base = (X + B**5 )
    if base < 0:
        return 0.1
    return (X + B**5 ) ** (1/float(5))

[X] = getInts()
Q = deque([(0,0)])
V = set()
BP, BN = 0,0
while not f(BP).is_integer() and not f(BN).is_integer() and not f(-BP).is_integer() and not f(-BN).is_integer():
    (BP,BN) = Q.pop()
    l = [(BP+1,BN),(BP,BN+1),(BP+1,BN+1)]
    l = filter(lambda x: x not in V, l)
    for each in l:
        V.add(each)
        Q.appendleft(each)

if f(BP).is_integer():
    print(int(f(BP)), BP)
elif f(-BP).is_integer():
    print(int(f(-BP)), -BP)
elif f(BN).is_integer():
    print(int(f(BN)), BN)
else:
    print(int(f(-BN)), -BN)

Fixed submission:
from collections import deque

def getInts():
    return [ int(x) for x in input().split() ]

def f(A,B):
    return A**5 - B**5

[X] = getInts()
Q = deque([(0,0)])
V = set()
A, B = 0,0
r = []
while not r:
    (A,B) = Q.pop()
    l = [(A+1,B),(A,B+1),(A+1,B+1)]
    l = filter(lambda x: x not in V, l)
    for each in l:
        V.add(each)
        Q.appendleft(each)
    
    r = list(filter(lambda x: f(*x)==X, [(A,B), (A,-B), (-A,B), (-A, -B)]))

print(r[0][0], r[0][1])

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

def getInts():
    return [ int(x) for x in input().split() ]

def f(B):
    base = (X + B**5 )
    if base < 0:
        return 0.1
    return (X + B**5 ) ** (1/float(5))

[X] = getInts()
Q = deque([(0,0)])
V = set()
BP, BN = 0,0
while not f(BP).is_integer() and not f(BN).is_integer():
    (BP,BN) = Q.pop()
    l = [(BP+1,BN),(BP,BN-1),(BP+1,BN-1)]
    l = filter(lambda x: x not in V, l)
    for each in l:
        V.add(each)
        Q.appendleft(each)

if f(BP).is_integer():
    print(int(f(BP)), BP)
else:
    print(int(f(BN)), BN)

Fixed submission:
from collections import deque

def getInts():
    return [ int(x) for x in input().split() ]

def f(A,B):
    return A**5 - B**5

[X] = getInts()
Q = deque([(0,0)])
V = set()
A, B = 0,0
r = []
while not r:
    (A,B) = Q.pop()
    l = [(A+1,B),(A,B+1),(A+1,B+1)]
    l = filter(lambda x: x not in V, l)
    for each in l:
        V.add(each)
        Q.appendleft(each)
    
    r = list(filter(lambda x: f(*x)==X, [(A,B), (A,-B), (-A,B), (-A, -B)]))

print(r[0][0], r[0][1])

Buggy python submission (verdict: Runtime Error):
def getInts():
    return [ int(x) for x in input().split() ]

def f(B):
    return (X + B**5 ) ** (1/float(5))

[X] = getInts()

BP = 0
BN = 0
while not f(BP).is_integer() and not f(BN).is_integer():
    BP += 1
    BN -= 1

if f(BP).is_integer():
    print(str(int(f(BP))) + " " + str(BP))
else:
    print(str(int(f(BN))) + " " + str(BN))


Fixed submission:
from collections import deque

def getInts():
    return [ int(x) for x in input().split() ]

def f(A,B):
    return A**5 - B**5

[X] = getInts()
Q = deque([(0,0)])
V = set()
A, B = 0,0
r = []
while not r:
    (A,B) = Q.pop()
    l = [(A+1,B),(A,B+1),(A+1,B+1)]
    l = filter(lambda x: x not in V, l)
    for each in l:
        V.add(each)
        Q.appendleft(each)
    
    r = list(filter(lambda x: f(*x)==X, [(A,B), (A,-B), (-A,B), (-A, -B)]))

print(r[0][0], r[0][1])