Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
h, w = map(int, input().split())
s = [list(input()) for i in range(h)]
for x in range(h):
    for y in range(w):
        if(s[x][y] == '#'):
            up = s[max(0, x-1)][y]
            down = s[min(h-1, x+1)][y]
            right = s[x][max(0, y-1)]
            left = s[x][max(w-1,  y+1)]
            if(up == '.' and down == '.' and right == '.' and left == '.'):
                print("No")
                exit()
print("Yes")


Fixed submission:
h, w = map(int, input().split())
s = [input() for i in range(h)]
up = down = right = left = '.'
for x in range(h):
    for y in range(w):
        if(list(s[x])[y] == '#'):
            if(y != w-1):
                right = list(s[x])[y+1]
            if(x != h-1):
                down = list(s[x+1])[y]
            if(x != 0):
                up = list(s[x-1])[y]
            if(y != 0):
                left = list(s[x])[y-1]
            if(up != '#' and down != '#' and right != '#' and left != '#'):
                print("No")
                exit()
            up = down = right = left = '.'
print("Yes")

Buggy python submission (verdict: Runtime Error):
h, w = map(int, input().split())
s = [list(input()) for i in range(h)]
for x in range(h):
    for y in range(w):
        if(s[x][y] == '#'):
            up = s[max(0, x-1)][y]
            down = s[min(x+1, h-1)][y]
            right = s[x][max(0, y-1)]
            left = s[x][max(y+1, w-1)]
            if(up == '.' and down == '.' and right == '.' and left == '.'):
                print("No")
                exit()
print("Yes")


Fixed submission:
h, w = map(int, input().split())
s = [input() for i in range(h)]
up = down = right = left = '.'
for x in range(h):
    for y in range(w):
        if(list(s[x])[y] == '#'):
            if(y != w-1):
                right = list(s[x])[y+1]
            if(x != h-1):
                down = list(s[x+1])[y]
            if(x != 0):
                up = list(s[x-1])[y]
            if(y != 0):
                left = list(s[x])[y-1]
            if(up != '#' and down != '#' and right != '#' and left != '#'):
                print("No")
                exit()
            up = down = right = left = '.'
print("Yes")
Buggy python submission (verdict: Runtime Error):
input_line = input().split()
a = int(input_line[0])
b = int(input_line[1])
c = int(input_line[2])
k = int(input_line[3])

def return_answer(a,b,c,k):
    answer = 0
    if a < k:
        answer += a
        count = k - a

        if b < k:
            count -= b
            answer -= count

    elif a >= k:
        answer = k

    return answer

print(return_answer(a,b,c,k))


Fixed submission:
s = input()
t = input()
if s == t[:-1] :
    print("Yes")

else:
    print("No")
Buggy python submission (verdict: Runtime Error):
import math
a,b,n=map(int,input().split())
ma=-1
ans=a*n
print(math.floor(ans/b))
        
    

Fixed submission:
k=int(input())
a,b=map(int,input().split())
for i in range(a,b+1):
    if i%k==0:
        print("OK")
        break
else:
    print("NG")
Buggy python submission (verdict: Time Limit Exceeded):
K=int(input())
def gcd(a,b):
    res=0
    while b!=0:
        res=a%b
        a=b
        b=res
    return a

ans=0
for i in range(1,K+1):
    for j in range(1,K+1):
        for k in range(1,K+1):
            t=gcd(i,gcd(j,k))
            ans+=t
print(ans)

Fixed submission:
K=int(input())
def gcd(a,b):
    res=0
    while b!=0:
        res=a%b
        a=b
        b=res
    return a

ans=0
for i in range(1,K+1):
    for j in range(1,K+1):
        for k in range(1,K+1):
            t=gcd(i,gcd(j,k))
            ans+=t
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
K=int(input())
def gcd(a,b):
    if b==0:
        return a
    else:
        return gcd(b,a%b)
ans=0
for i in range(1,K+1):
    for j in range(1,K+1):
        for k in range(1,K+1):
            t=gcd(i,gcd(j,k))
            ans+=t
print(ans)


Fixed submission:
K=int(input())
def gcd(a,b):
    res=0
    while b!=0:
        res=a%b
        a=b
        b=res
    return a

ans=0
for i in range(1,K+1):
    for j in range(1,K+1):
        for k in range(1,K+1):
            t=gcd(i,gcd(j,k))
            ans+=t
print(ans)

Buggy python submission (verdict: Runtime Error):
n=int(input())
def gcd(a,b):
  if b==0:
    return a
  else:
    return gcd(b,a%b)
ans=0
for i in range(1,K+1):
  for j in range(1,K+1):
    for k in range(1,K+1):
      t=gcd(i,gcd(j,k))
      ans+=t
print(ans)

Fixed submission:
K=int(input())
def gcd(a,b):
    res=0
    while b!=0:
        res=a%b
        a=b
        b=res
    return a

ans=0
for i in range(1,K+1):
    for j in range(1,K+1):
        for k in range(1,K+1):
            t=gcd(i,gcd(j,k))
            ans+=t
print(ans)

Buggy python submission (verdict: Runtime Error):
n=int(input())
def gcd(a,b):
  if b==0:
    return a
  return gcd(b,a%b)
ans=0
for i in range(1,K+1):
  for j in range(1,K+1):
    for k in range(1,K+1):
      ans+=gcd(i,gcd(j,k))
print(ans)



Fixed submission:
K=int(input())
def gcd(a,b):
    res=0
    while b!=0:
        res=a%b
        a=b
        b=res
    return a

ans=0
for i in range(1,K+1):
    for j in range(1,K+1):
        for k in range(1,K+1):
            t=gcd(i,gcd(j,k))
            ans+=t
print(ans)

Buggy python submission (verdict: Runtime Error):
n=int(input())
def gcd(a,b):
  if b==0:
    return a
  return gcd(b,a%b)
ans=0
for i in range(1,K+1):
  for j in range(1,K+1):
    for k in range(1,K+1):
      ans+=gcd(i,gdc(j,k))
print(ans)



Fixed submission:
K=int(input())
def gcd(a,b):
    res=0
    while b!=0:
        res=a%b
        a=b
        b=res
    return a

ans=0
for i in range(1,K+1):
    for j in range(1,K+1):
        for k in range(1,K+1):
            t=gcd(i,gcd(j,k))
            ans+=t
print(ans)
Buggy python submission (verdict: Runtime Error):
s,t=input().split(' ')
a,b=map(int,input().split())
u=input()
if u==s:
  a=a-1
if u==t:
  b=b-1
print(a+' '+b)

Fixed submission:
s,t=input().split(' ')
a,b=map(int,input().split())
u=input()
if u==s:
    a=a-1
if u==t:
    b=b-1
print(str(a)+' '+str(b))

Buggy python submission (verdict: Runtime Error):
s,t=input().split()
a,b=map(int,iinput().split())
u=input()
if u==s:
  a=a-1
if u==t:
  b=b-1
print(a+' '+b)

Fixed submission:
s,t=input().split(' ')
a,b=map(int,input().split())
u=input()
if u==s:
    a=a-1
if u==t:
    b=b-1
print(str(a)+' '+str(b))

Buggy python submission (verdict: Runtime Error):

s,t=input().split()
a,b=map(int,iinput().split())
u=input()
if u==s:
  a=a-1
if u==t:
  b=b-1
print(a,b)

Fixed submission:
s,t=input().split(' ')
a,b=map(int,input().split())
u=input()
if u==s:
    a=a-1
if u==t:
    b=b-1
print(str(a)+' '+str(b))
Buggy python submission (verdict: Runtime Error):
from collections import Counter

n=int(input())

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

cc=Counter(arr)
for k,v in cc.items():
  if v>1:
    print("NO")
    break
else:
print("NO")


Fixed submission:
#from collections import Counter
n=int(input())
arr=list(map(int,input().split()))
di={}
for i in arr:
  if i in di:
    print("NO")
    break
  else:
    di[i]=1
else:
  print("YES")
Buggy python submission (verdict: Time Limit Exceeded):
N,K=map(int,input().split())
H=list(map(int,input().split()))
t=list()
for i in range(N-K):
    t.append(sorted(H)[i])
print(sum(t))

Fixed submission:
N,K=map(int,input().split())
H=list(map(int,input().split()))
t=sorted(H)
n=list()
for i in range(N-K):
    n.append(t[i])
print(sum(n))
Buggy python submission (verdict: Runtime Error):
N=int(input())
A,B=map(str,input().split())
S=[]
for i in range(N)
    S.append(A[i])
    S.append(B[i])
print(S)

Fixed submission:
A=int(input())
B=int(input())
if A+B==3:
  print(3)
elif A+B==4:
  print(2)
else:
  print(1)
Buggy python submission (verdict: Runtime Error):
A=[chr(i) for i in range(65, 65+26)]
N=int(input())
S=str(input())

for i in range(len(S)):
  k=(A.index(S[i])+N)%26
  S[i]=S[k]
  
print(S)

Fixed submission:
A=[chr(i) for i in range(65, 65+26)]
N=int(input())
S=str(input())
T=[]
U=str()

for i in range(len(S)):
  k=(A.index(S[i])+N)%26
  T.append(A[k])
  U=U+str(T[i])
  
print(U)
Buggy python submission (verdict: Runtime Error):
A,B=map(int,input().split())

if ( A < 10 and B < 10 ):
  print ( A * B )
else:
  print ( -1 ):

Fixed submission:
A,B=map(int,input().split())
 
if ( A < 10 and B < 10 ):
  print ( A * B )
else:
  print ( -1 )
Buggy python submission (verdict: Runtime Error):
N=input()
if N%2=0:
  print(1/2)
else:
  print(((N-1)/2+1)/N)

Fixed submission:
N=int(input())
if N%2==0:
  print(1/2)
else:
  print(((N-1)/2+1)/N)
Buggy python submission (verdict: Runtime Error):
S = input()
if S = 'Sunny':
  print ('Cloudy')
elif S = 'Cloudy':
  print ('Rainy')
else:
  print ('Sunny')

Fixed submission:
S = input()
if S == 'Sunny':
  print ('Cloudy')
elif S == 'Cloudy':
  print ('Rainy')
else:
  print ('Sunny')
Buggy python submission (verdict: Runtime Error):
a = input(int())
s = input()
 
if a >= 3200 :
  print( s )
else:
  print( 'red' )

Fixed submission:
a = int ( input() )
s = input()
 
if a >= 3200 :
  print( s )
else:
  print( 'red' )

Buggy python submission (verdict: Runtime Error):
a = input(int())
s = input()

if a >= 3200 :
  print( 'red' )
else:
  print( s )

Fixed submission:
a = int ( input() )
s = input()
 
if a >= 3200 :
  print( s )
else:
  print( 'red' )
Buggy python submission (verdict: Runtime Error):
A,B = =map(int,input().split())
x = A+B
y = A-B
z = A*B
print( max(x,y,z) )


Fixed submission:
A,B = map(int,input().split())
x = A+B
y = A-B
z = A*B
print( max(x,y,z) )
Buggy python submission (verdict: Runtime Error):
A,B,C=(int,input().split())
D=C-(A-B)
if D<=0:
   print(0)
else:
   print(D)


Fixed submission:
A,B,C=map(int,input().split())
D=C-(A-B)
if D<=0:
   print(0)
else:
   print(D)

Buggy python submission (verdict: Runtime Error):
A,B,C=(int,input().split())
D=C-(A-B)
if D<=0
   print(0)
else:
   print(D)

Fixed submission:
A,B,C=map(int,input().split())
D=C-(A-B)
if D<=0:
   print(0)
else:
   print(D)
Buggy python submission (verdict: Runtime Error):
A,B=map(int, input().split())
if A+B%2 = 0:
  K=(A+B)/2
  print(K)
else:
  print('impossible')

Fixed submission:
A,B=map(int, input().split())
if (A+B)%2 == 0:
  print((A+B)//2)
else:
  print('IMPOSSIBLE')

Buggy python submission (verdict: Runtime Error):
A,B=map(int, input().split())
if A+B%2 = 0:
  K=(A+B)/2
  print(K)
else:
  print('impossible')

Fixed submission:
A,B=map(int, input().split())
if (A+B)%2 == 0:
  print((A+B)//2)
else:
  print('IMPOSSIBLE')
Buggy python submission (verdict: Runtime Error):
s=sorted(list(map(int,input().input())))[::-1]
print(s[0]*10+s[1]+s[2])


Fixed submission:
s=sorted(list(map(int,input().split())))[::-1]
print(s[0]*10+s[1]+s[2])
Buggy python submission (verdict: Runtime Error):
x = int(input())
for a in range(-200,201):
	for b in range(-200,201):
    	if a**5 - b**5 == x:
        	print(a,b,sep= ' ')
          	exit()

Fixed submission:
S = input()
if S == 'ABC':
  print('ARC')
else:
  print('ABC')
Buggy python submission (verdict: Runtime Error):
A, B, C, K = map(int, input().split())

if A > K:
    print(K)
elif A+B >= K:
    print(A)
else:
    print(A - (K-(A+B)))


Fixed submission:
S = input()
T = input()[:-1]

if S == T:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N = int(input())
    A = []
    for n in range(N):
        A.append(int(input()))

    max1_A = max(A)
    A_cp = sorted(A)
    A_cp.pop(-1)
    max2_A = max(A_cp)
    argmax_A = [i for i, x in enumerate(A) if x == max(A)]

    for a in A:
        if a == max1_A:
            print(max2_A)
        else:
            print(max1_A)
            
        
if __name__ == '__main__':
    main()


Fixed submission:
def main():
    N = int(input())
    A = []
    for n in range(N):
        A.append(int(input()))

    A_cp = sorted(A)
    max1_A = A_cp.pop(-1)
    max2_A = max(A_cp)
    for a in A:
        if a == max1_A:
            print(max2_A)
        else:
            print(max1_A)
            
        
if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N = int(input())
    A = []
    for n in range(N):
        A.append(int(input()))

    max_A = max(A)
    argmax_A = [i for i, x in enumerate(A) if x == max(A)]
    if len(argmax_A) == 1:
        for n in range(N):
            if n in argmax_A:
                tmp = A.pop(n)
                print(max(A))
                A.insert(n, tmp)
            else:
                print(max_A)
    else:
        for n in range(N):
            print(max_A)
        
if __name__ == '__main__':
    main()


Fixed submission:
def main():
    N = int(input())
    A = []
    for n in range(N):
        A.append(int(input()))

    A_cp = sorted(A)
    max1_A = A_cp.pop(-1)
    max2_A = max(A_cp)
    for a in A:
        if a == max1_A:
            print(max2_A)
        else:
            print(max1_A)
            
        
if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N = int(input())
    A = []
    for n in range(N):
        A.append(int(input()))
        
    for n in range(N):
        tmp = A.pop(n)
        print(max(A))
        A.insert(n, tmp)
        
if __name__ == '__main__':
    main()


Fixed submission:
def main():
    N = int(input())
    A = []
    for n in range(N):
        A.append(int(input()))

    A_cp = sorted(A)
    max1_A = A_cp.pop(-1)
    max2_A = max(A_cp)
    for a in A:
        if a == max1_A:
            print(max2_A)
        else:
            print(max1_A)
            
        
if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
S = input()
T = input()
if(len(S)+1==len(T)):
  print("Yes")
else():
  print("No")

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

Buggy python submission (verdict: Runtime Error):
S = input()
T = input()
if(len(S)+1==len(T)):
	print("Yes")
else():
	print("No")

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

Buggy python submission (verdict: Runtime Error):
LenS = len(input())
LenT = len(input())
if(LenS+1==LenT):
	print("Yes")
else():
	print("No")

Fixed submission:
S = input()
T = input()
if(S==T[:-1]):
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
def main():

    n = int(input())
    db = []
    kinds = 0

    for i in range(10):
        tmp = []
        db.append(tmp)

    for i in range(n):
        str = input()
        num = len(str)

        if(not(str in db[num-1])):
            db[num-1].append(str)
            kinds = kinds + 1

    print(kinds)

main()


Fixed submission:
def main():
    s,w = map(int,input().strip().split())
    if(w>=s):
        print('unsafe')
    else:
        print('safe')

main()
Buggy python submission (verdict: Time Limit Exceeded):
def main():

    n = int(input())
    db = []
    kinds = 0

    for i in range(10):
        tmp = []
        db.append(tmp)

    for i in range(n):
        str = input()
        num = len(str)

        if(not(str in db[num-1])):
            db[num-1].append(str)
            kinds = kinds + 1

    print(kinds)

main()


Fixed submission:
def main():

    n = int(input())
    db = set()

    for i in range(n):
        db.add(input())

    print(len(db))

main()
Buggy python submission (verdict: Time Limit Exceeded):
import sys


n = int(input())

cost = sys.maxsize
tmp = 0

for i in range(1,n):
    if((n%i)==0):
        tmp = i + int(n/i) - 2
        cost = min(tmp,cost)
        tmp = 0

print(cost)


Fixed submission:
import sys
import math

n = int(input())

cost = sys.maxsize
tmp = 0
k = math.sqrt(n)
for i in range(1,int(k)+1):
    q, mod = divmod(n,i)
    if(mod==0):
        tmp = i + int(q) - 2
        cost = min(tmp,cost)
        tmp = 0

print(cost)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = []
for _ in range(N):
    S.append(input())

char_list = []
for s in S:
    if s not in char_list:
        char_list.append(s)

print(len(char_list))

Fixed submission:
N = int(input())
S = []
for _ in range(N):
    S.append(input())

import collections
print(len(collections.Counter(S)))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

for i in range(1, N+1):
    tmp = 0
    for a in A:
        if a == i:
            tmp+=1
    print(tmp)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
score = [0 for _ in range(N)]

for a in A:
    score[a-1] += 1

for s in score:
    print(s)
Buggy python submission (verdict: Runtime Error):
from collections import deque

H, W = list(map(int, input().split()))
S = []
for _ in range(H):
    S.append(input())

ret = 0
for i in range(H):
    for j in range(W):
        s = S[i][j]
        queue = deque([(i,j,0)])
        footprint = [(i,j)]
        if s == '#':
            continue
        while True:
            x, y, d = queue.popleft()
            for p in [(x-1, y), (x, y-1), (x, y+1), (x+1, y)]:
                if p[0] >= 0 and p[0] < H and p[1] >=0 and p[1] < W and p not in footprint and S[p[0]][p[1]] != '#':
                        queue.append((p[0], p[1], d+1))
                        footprint.append(p)

            if len(queue) == 0:
                break
        if d > ret:
            ret = d

print(ret)

Fixed submission:
print(chr(ord(input())+1))
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

H, W = list(map(int, input().split()))
S = []
for _ in range(H):
    S.append(input())

ret = 0
for i in range(H):
    for j in range(W):
        s = S[i][j]
        queue = deque([(i,j,0)])
        footprint = [(i,j)]
        if s == '#':
            continue
        while True:
            x, y, d = queue.popleft()
            for p in [(x-1, y), (x, y-1), (x, y+1), (x+1, y)]:
                if p[0] >= 0 and p[0] < H and p[1] >=0 and p[1] < W and p not in footprint and S[p[0]][p[1]] != '#':
                        queue.append((p[0], p[1], d+1))
                        footprint.append(p)

            if len(queue) == 0:
                break
        if d > ret:
            ret = d

print(ret)

Fixed submission:
from collections import deque

H, W = list(map(int, input().split()))
S = []
for _ in range(H):
    S.append(input())

ret = 0
for i in range(H):
    for j in range(W):
        s = S[i][j]
        queue = deque([(i,j,0)])
        footprint = [(i,j)]
        if s == '#':
            continue
        while True:
            x, y, d = queue.popleft()
            for p in [(x-1, y), (x, y-1), (x, y+1), (x+1, y)]:
                if p[0] >= 0 and p[0] < H and p[1] >=0 and p[1] < W and p not in footprint and S[p[0]][p[1]] != '#':
                        queue.append((p[0], p[1], d+1))
                        footprint.append(p)

            if len(queue) == 0:
                break
        if d > ret:
            ret = d

print(ret)
Buggy python submission (verdict: Time Limit Exceeded):
from math import factorial

# def comb(n,r):
#     return(factorial(n) // (factorial(n-r) * factorial(r)))

def comb(n,k,p):
    if n<0 or k<0 or n<k: return 0
    if n==0 or k==0: return 1
    a=factorial(n) %p
    b=factorial(k) %p
    c=factorial(n-k) %p
    return (a*power_func(b,p-2,p)*power_func(c,p-2,p))%p
def power_func(a,b,p):
    if b==0: return 1
    if b%2==0:
        d=power_func(a,b//2,p)
        return d*d %p
    if b%2==1:
        return (a*power_func(a,b-1,p ))%p


def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 998244353 #出力の制限
N = 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

n,m,k = map(int,input().split())

s = 0

for x in range(k+1):
    s += m * (power_func(m-1,n-1-x,998244353)% 998244353) * (cmb(n-1,x,998244353) % 998244353)
    s %= 998244353
print(s)

Fixed submission:

def power_func(a,b,p):
    if b==0: return 1
    if b%2==0:
        d=power_func(a,b//2,p)
        return d*d %p
    if b%2==1:
        return (a*power_func(a,b-1,p ))%p


def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 998244353
g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]

n,m,k = map(int,input().split())

for i in range( 2, n + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

s = 0

for x in range(k+1):
    s += (m * power_func(m-1,n-1-x,998244353) * cmb(n-1,x,998244353)) % 998244353
    s %= 998244353
print(s)
Buggy python submission (verdict: Runtime Error):
x = int(input())

t = int(x**0.2)

for i in range(x):
    t2 = t + i
    d = x - t2 ** 5
    if(d.imag == 0):
        b = int(d**0.2)
        if(b**5 == d):
            print(t2,-d)
            exit()
    t2 = t - i
    d = x - t2 ** 5
    if(d.imag == 0):
        b = int(d**0.2)
        if(b**5 == d):
            print(t2,-d)
            exit()
    


Fixed submission:
x = int(input())


for i in range(-1000,1000):
    s = x + pow(i,5)
    t = pow(s,0.2)
    if(t.imag == 0):
        t = int(t)
        if(pow(t,5) == s):
            print(t,i)
            exit()

Buggy python submission (verdict: Time Limit Exceeded):
x = int(input())

for i in range(x):
    s = x - i**5
    if(s < 0):continue
    t = int(s ** 0.2)
    if(s == t**5):
        print(i,-t)
        exit()

Fixed submission:
x = int(input())


for i in range(-1000,1000):
    s = x + pow(i,5)
    t = pow(s,0.2)
    if(t.imag == 0):
        t = int(t)
        if(pow(t,5) == s):
            print(t,i)
            exit()

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

for i in range(x):
    s = x - i**5
    t = int(s ** 0.2)
    if(s == t**5):
        print(i,-t)
        exit()

Fixed submission:
x = int(input())


for i in range(-1000,1000):
    s = x + pow(i,5)
    t = pow(s,0.2)
    if(t.imag == 0):
        t = int(t)
        if(pow(t,5) == s):
            print(t,i)
            exit()
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n = int(input())
a = np.array(list(map(int,input().split())))
b = np.array(a)
a += np.arange(n)+1
b -= np.arange(n)+1
b *= -1
c = 0
for i in a:
    c += len(b[b==i])

print(c)

Fixed submission:
import numpy as np
n = int(input())
a = np.array(list(map(int,input().split())))
b = np.array(a)
a += np.arange(n)+1
b -= np.arange(n)+1
b *= -1
a = np.sort(a)
b = np.sort(b)
c = 0
for i in a:
    l = np.searchsorted(b,i,side="left")
    r = np.searchsorted(b,i,side="right")
    c += r-l

print(c)
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
if(n % 2 == 0):
    d = n // 2 - 1
    c = 0
    i = 1
    while(d >= 0):
        print(i,i+d)
        d -= 2
        i += 1
        c += 1
        if(c == m):exit()
    d = n // 2 - 2
    i = n // 2 + 1
    while(d >= 0):
        print(i,i+d)
        d -= 2
        i += 1
        c += 1
        if(c == m):exit()


else:
    raise ValueError("error!")
    for i in range(m):
        print(i+1,n-i)


Fixed submission:
n,m = map(int,input().split())
if(n % 2 == 0):
    d = n // 2 - 1
    c = 0
    i = 1
    while(d > 0):
        print(i,i+d)
        d -= 2
        i += 1
        c += 1
        if(c == m):exit()
    d = n // 2 - 2
    i = n // 2 + 1
    while(d > 0):
        print(i,i+d)
        d -= 2
        i += 1
        c += 1
        if(c == m):exit()


else:
    for i in range(m):
        print(i+1,n-i)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
s = [0 for _ in range(n)]
for i in range(n):
    s[a[i]-1] += 1
for t in s:print(t)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
s = [0 for _ in range(n)]
for i in range(n-1):
    s[a[i]-1] += 1
for t in s:print(t)