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

Fixed submission:
import sys
A,B=map(int,input().split())
for i in range (1,4):
    if (A*B*i)%2==1:
        print("Yes")
        sys.exit()
print("No")

Buggy submission (verdict: Runtime Error):
A,B=map(int,input().split())
for i in range (1,4):
    if A*B*i==3:
        print("Yes")
        sys.exit()
print("No")
Problem p03262 (python)

Fixed submission:
import numpy as np
import fractions

N, X =map(int,input().split())
x = list(map(int,input().split()))
result = abs(abs(np.array(x))-X)

D= result[0]
for i in range (1,len(result)):
    D=fractions.gcd(D,result[i])
print(D)

Buggy submission (verdict: Runtime Error):
N, X =map(int,input().split())
x = list(map(int,input().split()))
result = abs(abs(np.array(x))-X)
import fractions
D= result[0]
for i in range (1,len(result)):
    D=fractions.gcd(D,result[i])
print(D)
Problem p03274 (python)

Fixed submission:
import numpy as np
N, K = map(int,input().split())
x = list(map(int,input().split()))

ans = 10**9
for i in range (N-K+1):
    front = np.array(x[i])
    end   = np.array(x[i+K-1])
    
    if np.sign(front)!= np.sign(end):
        ans_temp = min (abs(front)*2+abs(end),abs(front)+abs(end)*2)
    else:
        ans_temp = max(abs(front),abs(end))
    
    if ans_temp <= ans:
        ans = ans_temp
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
N,K=map(int,input().split())
a=list(map(int,input().split()))

minus=[]
for i in range (N):
    if a[i]<0:
        minus.append(a[i])
plus=a[len(minus):]

if len(minus)==0:
    print(plus[K-1])
    sys.exit()
if len(plus)==0:
    minus=minus[::-1]
    print(minus[K-1])
    sys.exit()

if K==1:
    minus=minus[::-1]
    if len(plus)==0:
        plus.append(10**18)
    if len(minus)==0:
        minus.append(10**18)
    print(min(plus[0],abs(minus[0])))
    sys.exit()
     
data=[i * 2 for i in minus]+plus
data2=minus+[i * 2 for i in plus]
data_min=10**18
for i in range (N-K+1):
    if data_min >((abs(min(data[i],0)))+((abs(min(data[i+K-1],0))):
        data_min=((abs(min(data[i],0)))+((abs(min(data[i+K-1],0)))
for i in range (N-K+1):
    if data_min >((abs(min(data2[i],0)))+((abs(min(data2[i+K-1],0))):
        data_min=((abs(min(data2[i],0)))+((abs(min(data2[i+K-1],0)))
print(data_min)
Problem p03369 (python)

Fixed submission:
a = (input())
count=0
for i in range (3):
    if a[i]=='o':
        count+=1

output=700+100*count
print(output)

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

total_price=0
C2=C*2

if C2<=A and C2<=B:
    total_price=C2*max(X,Y)

elif C2<=(A+B):
    if X>=Y:
        total_price=C2*Y
        X=X-Y
        Y=0
        total_price=total_price+A*X
    else:
        total_price=C2*X
        X=0
        Y=Y-X
        total_price=total_price+B*Y
        
else:
    total_price=A*X+B*Y
print(total_price)
Problem p03371 (python)

Fixed submission:
A, B, C, X, Y = map(int,input().split())
pattern1 = X*A + Y *B
pattern2 = X*(C*2) + B*(max(0,Y-X))
pattern3 = A*(max(0,X-Y)) + Y*(C*2)
print(min(pattern1,pattern2,pattern3))

Buggy submission (verdict: Runtime Error):
total_price=0
C2=C*2

if C2<=A and C2<=B:
    total_price=C2*max(X,Y)
        
elif (C2>=A and C2<=B):
    total_price=C2*min(X,Y)
    total_price=total_price+B*(Y-X)      
    print(total_price)
    
elif (C2<=A and C2>=B) :
    total_price=C2*min(X,Y)
    total_price=total_price+A*(X-Y)      
    print(total_price)

elif C2<=(A+B):  #C2<=(A+B): 
    if X>=Y:
        total_price=C2*Y
        X=X-Y
        Y=0
        total_price=total_price+A*X
    else:
        total_price=C2*X
        X=0
        Y=Y-X
        total_price=total_price+B*Y
        
else:
    total_price=A*X+B*Y
print(total_price)

Buggy submission (verdict: Runtime Error):
total_price=0
C2=C*2

if C2<=A and C2<=B:
    total_price=C2*max(X,Y)

elif C2<=(A+B):
    if X>=Y:
        total_price=C2*Y
        X=X-Y
        Y=0
        total_price=total_price+A*X
    else:
        total_price=C2*X
        X=0
        Y=Y-X
        total_price=total_price+B*Y
        
else:
    total_price=A*X+B*Y
print(total_price)
Problem p03377 (python)

Fixed submission:
A, B, X = map(int, input().split())
if X>=A and X<= A+B:
    print ("YES")
else:
    print ("NO")

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

import copy
X_sort=copy.deepcopy(X)
X_sort.sort()
X_sort

median_control=(X_sort[N//2-1]+X_sort[N//2])/2
for i in range (N):
    if X[i]>median_control:
        print (X_sort[N//2-1])
    if X[i]<=median_control:
        print (X_sort[N//2])
Problem p03379 (python)

Fixed submission:
N=int(input())
X=list(map(int, input().split()))
 
import copy
X_sort=copy.deepcopy(X)
X_sort.sort()
X_sort
 
median_control=(X_sort[N//2-1]+X_sort[N//2])/2
for i in range (N):
    if X[i]>median_control:
        print (X_sort[N//2-1])
    if X[i]<=median_control:
        print (X_sort[N//2])

Buggy submission (verdict: Runtime Error):
import copy
X_sort=copy.deepcopy(X)
X_sort.sort()
X_sort
median_control=(X_sort[N//2-1]+X_sort[N//2])/2
for i in range (N):
    if X[i]>median_control:
        print (X_sort[N//2-1])
    if X[i]<=median_control:
        print (X_sort[N//2])

Buggy submission (verdict: Runtime Error):
N=int(input())
X=list(map(int, input().split()))
x=[]
for i in range (N):
    x.append(X[:i] +X[i+1:])
for i in range (N):
    x[i].sort()
    print(x[i][median])

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

median=(N//2)-1
for i in range (N):
    X_instant=copy.deepcopy(X)
    X_instant.pop(i)
    X_instant.sort()
    output=X_instant[median]
    print(output)
Problem p03385 (python)

Fixed submission:
S = input()

S1='abc'
S2='acb'
S3='bac'
S4='bca'
S5='cab'
S6='cba'
if S==S1:
    print ('Yes')
elif S==S2:
    print ('Yes')
elif S==S3:
    print ('Yes')
elif S==S4:
    print ('Yes')
elif S==S5:
    print ('Yes')
elif S==S6:
    print ('Yes')
else:
    print ('No')

Buggy submission (verdict: Runtime Error):
S=input().replace("abc","").replace("acb","").replace("bac","").replace("bca","").replace("cab","").replace("cba","")
if s:
    print("No")
else:
    print("Yes")

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

Number=0
count =0

for i in range (51):
    MAX=max(A,B,C)
    Number=0
    if MAX==A:
        Number=Number+1
    if MAX==B:
        Number=Number+1
    if MAX==C:
        Number=Number+1

    if Number ==1:
        MAX=max(A,B,C)
        if MAX!=A:
            A=A+1
        if MAX!=B:
            B=B+1
        if MAX!=C:
            C=C+1
        count=count +1
        Number=0

    if Number ==2:
        MAX=max(A,B,C)
        if MAX!=A:
            A=A+2
        if MAX!=B:
            B=B+2
        if MAX!=C:
            C=C+2
        count=count +1
        Number=0
    
    if Number ==3:
        print('%d'%(count))
        break

Buggy submission (verdict: Runtime Error):
A, B, K = map(int, input().split())
K2=B-A
K3=K2-K*2
if K3 > 0:
    for i in range (K):
        print ('%d'%(A+i))
    for i in range (K):
        print ('%d'%(B-K+i+1))
if K3 <= 0:
    for i in range (B-A+1):
        print ('%d'%(A+i))

Buggy submission (verdict: Runtime Error):
S=input().replace("abc","").replace("acb","").replace("bac","").replace("bca","").replace("cab","").replace("cba","")
if s:
	print("NO")
else:
    print("YES")

Buggy submission (verdict: Runtime Error):
S=input().replace("abc","").replace("acb","").replace("bac","").replace("bca","").replace("cab","").replace("cba","")
if s:
    print("NO")
else:
    print("YES")

Buggy submission (verdict: Runtime Error):
S=input().replace("abc","").replace("acb","").replace("bac","").replace("bca","").replace("cab","").replace("cba","")
if s:
    print("NO")
else:
    print("YES")

Buggy submission (verdict: Runtime Error):
S=input().replace("abc","").replace("acb","").replace("bac","").replace("bca","").replace("cab","").replace("cba","")
if s:
    print("NO")
else:
    print("YES")

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

Number=0
count =0

for i in range (1000):
    MAX=max(A,B,C)
    Number=0
    if MAX==A:
        Number=Number+1
    if MAX==B:
        Number=Number+1
    if MAX==C:
        Number=Number+1

    if Number ==1:
        MAX=max(A,B,C)
        if MAX!=A:
            A=A+1
        if MAX!=B:
            B=B+1
        if MAX!=C:
            C=C+1
        count=count +1
        Number=0

    if Number ==2:
        MAX=max(A,B,C)
        if MAX!=A:
            A=A+2
        if MAX!=B:
            B=B+2
        if MAX!=C:
            C=C+2
        count=count +1
        Number=0
    
    if Number ==3:
        print('%d'%(count))
        break
Problem p03401 (python)

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

A_before=0
full_price=0
for i in range (N):
    full_price=full_price+abs(A[i]-A_before)
    A_before=A[i]
full_price=full_price+abs(A[N-1])

total_price=0
#No.1
negative=abs(A[0]-0)+ abs(A[1]-A[0])-abs(A[1]-(0))
total_price=full_price-negative
print(total_price)

for j in range (1,N-1):
    negative=abs(A[j]-A[j-1])+ abs(A[j+1]-A[j])-abs(A[j+1]-(A[j-1]))
    total_price=full_price-negative
    print(total_price)
    
#No.Last
negative=abs(0-A[N-1])+ abs(A[N-1]-A[N-2])-abs(0-A[N-2]) 
total_price=full_price-negative
print(total_price)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
for i in N:
	abs=abs(A-)

D,X =  map(int, input().split())
N_chocolate=0
for i in range (N):
	A= int(input())
	if A == 1:
		N_chocolate=N_chocolate+D-1
	else:
		N_chocolate=N_chocolate+int(D/A)
output=N_chocolate+X+N
print (output)
Problem p03407 (python)

Fixed submission:
A, B, C = map(int, input().split())
if A+B>=C:
    print ("Yes")
else:
    print ("No")

Buggy submission (verdict: Runtime Error):
if A+B>=C:
    print ("Yes")
else:
    print ("No")
Problem p03415 (python)

Fixed submission:
one = str(input())
two = str(input())
three = str(input())
print(one[0]+two[1]+three[2])

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

small=min(N,M)
big  =max(N,M)
if small==1:
    if big==1:
        print (1)
    elif big==2:
        print (0)
    else:
        print (big-2)

elif small==2:
    print (0)
    
else:
    print ((small-2)*(big-2))

Buggy submission (verdict: Runtime Error):
c11,c12,c13= map(str, input().split())
c21,c22,c23= map(str, input().split())
c31,c32,c33= map(str, input().split())
print(c11+c22+c33)
Problem p03423 (python)

Fixed submission:
N = int(input())
print(N//3)

Buggy submission (verdict: Runtime Error):
N = (int, input())
print(N//3)

Buggy submission (verdict: Runtime Error):
N = (int, input())
N//3
Problem p03424 (python)

Fixed submission:
N=(int,input())
s = input().split()
for i in  s:
    if i =="Y":
        print ("Four")
        break
 
else:
    print ("Three")

Buggy submission (verdict: Runtime Error):
for i in  s:
    if i =="Y":
        print ("Four")
        break

else:
    print ("Three")
Problem p03469 (python)

Fixed submission:
S=input()
S=list(S)
S[3]='8'
S_change=''.join(S)
print(S_change)

Buggy submission (verdict: Runtime Error):
import sys
N, Y = map(int,input().split())

for i in range (N+1):
    for j in range (N+1):
        if  1000*i + 5000*j + 10000*(N-i-j) == Y:
            print('%d %d %d'%(i,j,(N-i-j)))
            sys.exit()
print('-1 -1 -1')
Problem p03485 (python)

Fixed submission:
a,b=map(int,input().split())
import math
print(math.ceil((a+b)/2))

Buggy submission (verdict: Runtime Error):
s=list(str(input()))
t=list(str(input()))
alphabet=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
for i in range (len(s)):
    for j in range (len(alphabet)):
        if s[i]==alphabet[j]:
            s[i]=j
for k in range (len(t)):
    for l in range (len(alphabet)):
        if t[k]==alphabet[l]:
            t[k]=l
if len(s)>len(t):
    lst=[-1]*(len(s)-len(t))
    t=t+lst

if len(t)>len(s):
    lst=[-1]*(len(t)-len(s))
    s=s+lst
import sys
for i in range (len(s)):
    if min(s)<max(t):
        print ('Yes')
        sys.exit()
    elif min(s)>max(t):
        print ('No')
        sys.exit()
    else:
        if min(s)==max(t):
            s.remove(min(s))
            t.remove(max(t))
print ('No')
Problem p03487 (python)

Fixed submission:
N=int(input())
list=list(map(int,input().split()))
while len(list) != 0and max(list) > len(list):
    list = [i for i in list if i < len(list)]
#list2 = [i for i in list if i < N]
set = set(list)
cnt=0
for i in set:
    c=list.count(i)
    if c > i:
        cnt +=c-i
    elif c < i:
        cnt +=c
print(N-len(list)+cnt)

##できなかった．

Buggy submission (verdict: Runtime Error):
N = int(input())
a = list(map(int,input().split()))
while len(a) != 0and max(a) > len(a):
    a = [i for i in list if i < len(a)]
set = set(a)
 
cnt = 0
for i in set:
    c = a.count(i)
    if c >i:
        cnt += c-i
    elif c <i:
        cnt += c
print(N - len(a)+cnt)

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
a = np.array(list(map(int,input().split())))
set = set(list)

for i in set:
    c = list.count(i)
    if c >i:
        cnt += c-i
    elif c <i:
        cnt += c
print(N - len(list)+cnt)
Problem p03495 (python)

Fixed submission:
import collections
import numpy as np
N, K =map(int,input().split())
a=list(map(int,input().split()))
c = collections.Counter(a)
c_=c.most_common()
c__=np.array(c_)
ans=0
for i in range (K,c__.shape[0]):
    ans+=c__[i][1]
print(ans)

Buggy submission (verdict: Runtime Error):
import collections
N, K =map(int,input().split())
a=list(map(int,input().split()))
c = collections.Counter(a)
c_=c.most_common()
c__=np.array(c_)
ans=0
for i in range (K,c__.shape[0]):
    ans+=c__[i][1]
print(ans)
Problem p03633 (python)

Fixed submission:
import fractions
N = int(input())
T_before =int(input())

for i in range(1,N):
    T =int(input())
    f=fractions.gcd(T,T_before)
    T_before=T*T_before//f
    
print(T_before)

Buggy submission (verdict: Runtime Error):
N = int(input())
T_before =int(input())

for i in range(1,N):
    T =int(input())
    f=fractions.gcd(T,T_before)
    T_before=T*T_before//f
    
print(T_before)
Problem p03672 (python)

Fixed submission:
import sys
s=input()
s=list(s)
if len(s)%2==0:
    s.pop(len(s)-1)
    s.pop(len(s)-1)
else:
    s.pop(len(s)-1)

while len(s)>0:
    if s[:int(len(s)/2)]==s[int(len(s)/2):]:
        print(len(s))
        sys.exit()
    s.pop(len(s)-1)
    s.pop(len(s)-1)

Buggy submission (verdict: Runtime Error):
s=input()
s=list(s)
if len(s)%2==0:
    s.pop(len(s)-1)
    s.pop(len(s)-1)
else:
    s.pop(len(s)-1)

while len(s)>0:
    if s[:int(len(s)/2)]==s[int(len(s)/2):]:
        print(len(s))
        sys.exit()
    s.pop(len(s)-1)
    s.pop(len(s)-1)
Problem p03694 (python)

Fixed submission:
n = int(input())
a = list(map(int, 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 p03695 (python)

Fixed submission:
N=int(input())
a=list(map(int,input().split()))
count_color=[0]*8
wild_color=0
for i in range (N):
    if a[i]<400:
        count_color[0]=1
    elif a[i]<800:
        count_color[1]=1
    elif a[i]<1200:
        count_color[2]=1
    elif a[i]<1600:
        count_color[3]=1
    elif a[i]<2000:
        count_color[4]=1
    elif a[i]<2400:
        count_color[5]=1
    elif a[i]<2800:
        count_color[6]=1
    elif a[i]<3200:
        count_color[7]=1
    else:
        wild_color+=1
color=count_color.count(1)
if color!=0:
    print (color, color+wild_color)
else:
    print(1, color+wild_color)

Buggy submission (verdict: Runtime Error):
N=int(input())
a=list(map(int,input().split()))
count_color=[0]*8
wild_color=0
for i in range (N):
    if a[i]<400:
        count_color[0]=1
    elif a[i]<800:
        count_color[1]=1
    elif a[i]<1200:
        count_color[2]=1
    elif a[i]<1600:
        count_color[3]=1
    elif a[i]<2000:
        count_color[4]=1
    elif a[i]<2400:
        count_color[5]=1
    elif a[i]<2800:
        count_color[6]=1
    elif a[i]<3200:
        count_color[7]=1
    else:
        wild_color+=1
color=count_color.count(1)
print (color, min(color+wild_color))
Problem p03697 (python)

Fixed submission:
A,B=map(int,input().split())
if (A+B)>=10:
    print ('error')
else:
    print (A+B)

Buggy submission (verdict: Runtime Error):
N=int(input())
data=[]
no10=[]
for i in range (N):
    a=int(input())
    data.append(a)
    if a%10!=0:
        no10.append(a)
        
ans=sum(data)
if ans%10!=0:
    print (ans)
elif len(no10)!=0:
    print(ans-no10[0])
else:
    print (0)
Problem p03761 (python)

Fixed submission:
import collections
n = int(input())
l = list(input())
l = collections.Counter(list(l))
for i in range (n-1):
    l_temp = list(input())
    l_temp = collections.Counter(list(l_temp))
    l = l & l_temp
alphabet = [chr(ord('a') + i) for i in range(26)]
ans = []
for i in range (len(alphabet)):
    if l[alphabet[i]]>0:
        ans.extend([alphabet[i]]*l[alphabet[i]])
print(''.join(ans))

Buggy submission (verdict: Runtime Error):
n = int(input())
l = list(input())
l = collections.Counter(list(l))
for i in range (n-1):
    l_temp = list(input())
    l_temp = collections.Counter(list(l_temp))
    l = l & l_temp
print(l)
Problem p03773 (python)

Fixed submission:
A,B=map(int,input().split())
time=A+B
if time>=24:
    print (time-24)
else:
    print (time)

Buggy submission (verdict: Runtime Error):
N = int(input())
ans = 10**10 #適当に初期化
ans_ = 10**10

divisors = []
for i in range(1, int(N**0.5)+1):
    if N % i == 0:
        divisors.append(i)
        if i != N // i:
            divisors.append(N//i)
            if len(str(N//i))<=ans:
                ans =N//i
                ans_=i
            
if N ==1:
    ans =1
            
print(max(len(str(ans)),len(str(ans_))))
Problem p04044 (python)

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

alphabet = []
for i in range (N):
    word = input()
    alphabet.append(word)
    
alphabet.sort()
print(''.join(alphabet))

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

alphabet = []
for i in range (L):
    word = input()
    alphabet.append(word)
    
alphabet.sort()
print(''.join(alphabet))

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

alphabet = []
for i in range (L):
    word = input()
    alphabet.append(word)
    
alphabet.sort()
print(''.join(alphabet))
Problem p03694 (python)

Fixed submission:
n = int(input())
a = sorted(list(map(int,input().split())))
print(a[n-1]-a[0])

Buggy submission (verdict: Runtime Error):
n = int(input())
a = sorted(set(list(map(int, input().split()))))[::-1]
Length = 0
for i in range(n-2):
    Length += a[i]-a[i+1]
print(Length)
Problem p03308 (python)

Fixed submission:
input()
a = list(map(int,input().split()))
print(max(a) - min(a))

Buggy submission (verdict: Runtime Error):
input()
a = list(map(int,input().split())
print(max(a) - min(a))
Problem p03238 (python)

Fixed submission:
n=int(input())
print("Hello World" if n != 2 else int(input())+int(input()))

Buggy submission (verdict: Runtime Error):
n=int(input())
print("Hello World" if n == 2 else int(input())+int(input()))
Problem p03408 (python)

Fixed submission:
n = int(input())
s = [input() for _ in range(n)]
m = int(input())
t = [input() for _ in range(m)]

ans = 0
for i in range(n):
  ans = max(ans, max(0, s.count(s[i]) - t.count(s[i])))
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import Counter

n = int(input())
s = [input() for _ in range(n)]
m = int(input())
t = [input() for _ in range(m)]

s_c = Counter(s)
t_c = Counter(t)

keys,values = zip(*(s_c-t_c).most_common())

print(values[0])
Problem p03644 (python)

Fixed submission:
n = int(input())
 
a = [2**i for i in range(7)]

print(max([x for x in a if x <= n]))

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

a = [2**i for i in range(1, 7)]

print(max([x for x in a if x <= n]))
Problem p03862 (python)

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

A=list(map(int,input().split()))+[0]
ans=0
for i in range(N):
    eated=max(0,A[i]+A[i-1]-x)
    ans+=eated
    A[i]-=eated
print(ans)

Buggy submission (verdict: Runtime Error):
A=list(map(int,input().split()))+[0]
ans=0
for i in range(N):
    eated=max(0,A[i]+A[i-1]-x)
    ans+=eated
    A[i]-=eated
print(ans)
Problem p03860 (python)

Fixed submission:
print("A%sC"%input()[8])

Buggy submission (verdict: Runtime Error):
input("A%sC"%input()[0])

Buggy submission (verdict: Runtime Error):
input("A%sC"%input()[8])
Problem p03423 (python)

Fixed submission:
N = int(input())
print(int(N / 3))

Buggy submission (verdict: Runtime Error):
H, W, D = map(int, input().split())

A = [list(map(int, input().split())) for i in range(H)]
rA = [[0 for j in range(2)] for i in range(H * W + 1)]
S = [0 for i in range(H * W + 1)]
for i in range(H):
	for j in range(W):
		rA[A[i][j]][0] = i
		rA[A[i][j]][1] = j

Q = int(input())
for i in range(Q):
	L, R = map(int, input().split())
	ans = 0
	for j in range(H * W + 1) [L::D]:
		if j == R:
			break
		if S[j]:
			ans += S[j]
			break
		S[j] -= ans
		ans += abs(rA[j + D][1] - rA[j][1]) + abs(rA[j + D][0] - rA[j][0])
	for j in range(H * W + 1)[L::D]:
		if S[j] > 0:
			break
		S[j] += ans
	print (ans)
Problem p02690 (python)

Fixed submission:
# -*- coding: utf-8 -*-

import math

def main():
     x = int(input())
     # x は 正の整数
     # ans = a^5 - b^5 = x となる a, b

     num_list = []
     len_num_list = 0

     a = 0
     end = False
     while(not end):
          num_list.append(pow(a, 5))
          len_num_list += 1

          # print(a)
          # print(num_list)

          for i in range(len_num_list):
               for j in range(i, len_num_list):
                    i_5div = num_list[i]
                    j_5div = num_list[j]

                    if i_5div - j_5div == x:
                         print('{} {}'.format(i, j))
                         end = True
                         break
                    if j_5div - i_5div == x:
                         print('{} {}'.format(j, i))
                         end = True
                         break
                    if i_5div + j_5div == x:
                         print('{} {}'.format(i, j * (-1)))
                         end = True
                         break
                    if j_5div + i_5div == x:
                         print('{} {}'.format(j, i * (-1)))
                         end = True
                         break

          a += 1


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

import math

def main():
     x = int(input())
     # x は 正の整数
     # ans = a^5 - b^5 = x となる a, b

     b = 0
     while(True):
          b_x = pow(b, 5)
          a_x = x + b_x
          a = pow(a_x, 1 / 5)

          # print('a:{}, b:{}'.format(a, b))

          if a.is_integer():
               print(int(a), b)
               break

          else:
               if b <= 0:
                    b -= 1
                    b = b * (-1)
               else:
                    b = b * (-1)

if __name__ == "__main__":
    main()