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

Fixed submission:
def sub():
    N = int(input())
    hs = [int(e) for e in input().split()]
    optimal_values = [None for _ in range(N)]
    optimal_values[0] = 0
    for i in range(1, N):
        if i > 1:
            a = optimal_values[i - 1] + abs(hs[i] - hs[i - 1])
            b = optimal_values[i - 2] + abs(hs[i] - hs[i - 2])
            optimal_values[i] = min(a, b)
        else:
            optimal_values[i] = optimal_values[i - 1] + abs(hs[i] - hs[i - 1])
    print(optimal_values[-1])


sub()

Buggy submission (verdict: Runtime Error):
def sub():
    N = int(input())
    hs = [int(e) for e in input().split()]

    def optimal_value(a_index):
        if a_index >= N - 1:
            return 0

        if a_index < N - 2:
            a = optimal_value(a_index + 1) + abs(hs[a_index + 1] - hs[a_index])
            b = optimal_value(a_index + 2) + abs(hs[a_index + 2] - hs[a_index])
            return min(a, b)
        else:
            return optimal_value(a_index + 1) + abs(hs[a_index + 1] - hs[a_index])

    print(optimal_value(0))


sub()

Buggy submission (verdict: Runtime Error):
def sub():
    N = int(input())
    hs = [int(e) for e in input().split()]

    def optimal_value(a_index):
        if a_index >= N - 1:
            return 0

        a = optimal_value(a_index + 1) + abs(hs[a_index + 1] - hs[a_index])
        if a_index < N - 2:
            b = optimal_value(a_index + 2) + abs(hs[a_index + 2] - hs[a_index])
            return min(a, b)
        else:
            return a

    print(optimal_value(0))


sub()

Buggy submission (verdict: Runtime Error):
def sub():
    N = int(input())
    hs = [int(e) for e in input().split()]

    def optimal_value(a_index):
        if a_index >= N - 1:
            return 0

        buf = [optimal_value(a_index + 1) + abs(hs[a_index + 1] - hs[a_index])]
        if a_index < N - 2:
            buf.append(optimal_value(a_index + 2) + abs(hs[a_index + 2] - hs[a_index]))

        return min(buf)

    print(optimal_value(0))


sub()
Problem p03085 (python)

Fixed submission:
a = input()
if a == 'A':
  print('T')
elif a == 'C':
  print('G')
elif a == 'G':
  print('C')
elif a == 'T':
  print('A')

Buggy submission (verdict: Runtime Error):
a = input()
if a == 'A':
	print('A')
elif a == 'C':
	print('T')
elif a == 'G'
	print('C')
elif a == 'T':
  	print('G')

Buggy submission (verdict: Runtime Error):
a = int(input())
if a == 'A':
	print('A')
elif a == 'C':
	print('T')
elif a == 'G'
	print('C')
elif a == 'T':
  	print('G')
Problem p03086 (python)

Fixed submission:
str = input()
max = 0
count = 0
for chr in str:
    if chr == 'A' or chr == 'C' or chr == 'G' or chr == 'T':
        count += 1
        if count > max:
            max = count
    else:
        count = 0
print('{}'.format(max))

Buggy submission (verdict: Runtime Error):
str = input()
max = 0
count = 0
for chr in str:
	if chr == 'A' or chr == 'C' or chr == 'G' or chr == 'T':
		count += 1
		if count > max:
        	max = count
	else:
		count = 0
print('{}'.format(max))

Buggy submission (verdict: Runtime Error):
str = input()
max = 0
count = 0
for chr in str:
	if chr == 'A' or chr == 'C' or chr == 'G' or chr == 'T':
		count += 1
        if count > max:
        	max = count
	else:
		count = 0
print('{}'.format(max))

Buggy submission (verdict: Runtime Error):
str = input()
max = 0
count = 0
for chr in str:
	if chr == 'A' or chr == 'C' or chr == 'G' or chr == 'T':
		count += 1
   		if count > max:
        	max = count
  	else:
  		count = 0
print('{}'.format(max))

Buggy submission (verdict: Runtime Error):
str = input()
max = 0
count = 0
for chr in str:
  if chr == 'A' or chr == 'C' or chr == 'G' or chr == 'T':
    count += 1
   	if count > max:
      max = count
  else:
  	count = 0
print('{}'.format(max))

Buggy submission (verdict: Runtime Error):
str = input()
max = 0
count = 0
for chr in str:
  if chr == 'A' or chr == 'C' or chr == 'G' or chr == 'T':
    count += 1
   	if count > max:
      max = count
  else:
  	count = 0
print({}.format(max))

Buggy submission (verdict: Runtime Error):
str = input()
max = 0
for chr in str:
  if chr == 'A' or chr == 'C' or chr == 'G' or chr == 'T':
    count += 1
   	if count > max:
      max = count
  else:
  	count = 0
print({}.format(max))
Problem p03238 (python)

Fixed submission:
import numpy as np,math,itertools
n=int(input())
if n==1:print("Hello World")
else:
    a=int(input())
    b=int(input())
    print(a+b)

Buggy submission (verdict: Runtime Error):
import numpy as np,math,itertools
n=int(input())
a=int(input())
b=int(input())
if n==1:print("Hello World")
else:print(a+b)
Problem p03361 (python)

Fixed submission:
h,w=map(int,input().split())
p=[["."]*(w+2)]+[["."]+list(map(str,input()))+["."]for i in range(h)]+[["."]*(w+2)]
print(["No","Yes"][int(all([any([p[i+x[0]][I+x[1]]=="#"for x in [[0,1],[0,-1],[1,0],[-1,0]]])for I in range(1,w+1)for i in range(1,h+1)if p[i][I]=="#"]))])

Buggy submission (verdict: Runtime Error):
h,w=map(int,input().split())
p=[["."]*(w+2)]+[["."]+list(map(str,input()))+["."]for i in range(w)]+[["."]*(w+2)]
print(["No","Yes"][int(all([any([p[i+x[0]][I+x[1]]=="#"for x in [[0,1],[0,-1],[1,0],[-1,0]]])for I in range(1,w+1)for i in range(1,h+1)if p[i][I]=="#"]))])
Problem p03435 (python)

Fixed submission:
C1 = list(map(int, input().split()))
C2 = list(map(int, input().split()))
C3 = list(map(int, input().split()))

C = [C1, C2, C3]
A = [0] * 3
B = [0] * 3

B = C1
A[1] = C2[0] - B[0]
A[2] = C3[0] - B[0]
flg = True
for i, a in enumerate(A):
    for j, b in enumerate(B):
        if C[i][j] != a + b:
            flg = False

if flg is True:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
C1 = list(map(int, input().split()))
C2 = list(map(int, input().split()))
C3 = list(map(int, input().split()))

C = [C1, C2, C3]
A = [0] * 3
B = [0] * 3

B = C1
A[1] = C2[0] - B[0]
A[2] = C3[0] - B[0]

flg = True
for a in range(A[1], A[2]):
    for b in range(B[1], B[2]):
        if C[a][b] != a + b:
            flg = False

if flg is True:
    print("Yes")
else:
    print("No")
Problem p03545 (python)

Fixed submission:
N = input()
A, B, C, D = int(N[0]), int(N[1]), int(N[2]), int(N[3])
OP = ["+", "-"]

ANS = 0
flg = False


for op1 in OP:
    if flg is True:
        break
    ANS = A
    if op1 == "+":
        ANS = ANS + B
    else:
        ANS = ANS - B
    for op2 in OP:
        if flg is True:
            break
        ANS2 = ANS
        if op2 == "+":
            ANS2 = ANS + C
        else:
            ANS2 = ANS - C
        for op3 in OP:
            ANS3 = ANS2
            if op3 == "+":
                ANS3 = ANS2 + D
            else:
                ANS3 = ANS2 - D
            if ANS3 == 7:
                print("%d%s%d%s%d%s%d=7" % (A, op1, B, op2, C, op3, D))
                flg = True
                break

Buggy submission (verdict: Runtime Error):
N = input()
A, B, C, D = int(N[0]), int(N[1]), int(N[2]), int(N[3])
OP = ["+", "-"]

ANS = A
for op1 in OP:
    if ANS == 7:
        break
    ANS = A
    if op1 == "+":
        ANS = ANS + B
    else:
        ANS = ANS - B
    for op2 in OP:
        if ANS == 7:
            Break
        if op2 == "+":
            ANS = ANS + C
        else:
            ANS = ANS - C
        for op3 in OP:
            if op3 == "+":
                ANS = ANS + D
            else:
                ANS = ANS - D
            if ANS == 7:
                print("%d%s%d%s%d%s%d=7" % (A, op1, B, op2, C, op3, D))
                break
Problem p03085 (python)

Fixed submission:
b=input()

if b == 'A':
    ans='T'
elif b == 'T':
    ans='A'
elif b == 'G':
    ans='C'
elif b == 'C':
    ans='G'

print(ans)

Buggy submission (verdict: Runtime Error):
b=raw_input()

if b in {'A','T'}:
    if b == 'A':
        print('T')
    else:
        print('A')
elif b in {'G','C'}:
    if b == 'G':
        print('C')
    elif b=='C':
        print('G')

Buggy submission (verdict: Runtime Error):
b=raw_input()
#b=str(b_in)
if b=="A":
  print("T")
elif b=="G":
  print("C")
elif b=="T":
  print("A")
elif b=="C":
  print("G")

Buggy submission (verdict: Runtime Error):
b=map(str.input())
if b=="A":
  print("T")
elif b="G":
  print("C")
elif b=="T":
  print("A")
elif b=="C":
  print("G")
Problem p03086 (python)

Fixed submission:
s=input()
ans=0
ans_list=[]
n=len(s)


for i in range(0,n):
    if s[i] not in {'A','T','C','G',' '}:
        ans_list.append(ans)
        ans=0
#        print(str(ans)+'!')
    else:
        ans+=1
        if i == n-1:
           ans_list.append(ans) 
 #       print(str(ans)+'z')

#print(ans_list)
if max(ans_list)==0:
    print(0)
else:
    print(max(ans_list))

Buggy submission (verdict: Runtime Error):
s=input()
ans=0
ans_list=[]
n=len(s)


for i in range(0,n):
    if s[i] not in {'A','T','C','G',' '}:
        ans_list.append(ans)
        ans=0
    else:
        ans+=1

#print(ans_list)
if max(ans_list)==0:
    print(0)
else:
    print(max(ans_list))

Buggy submission (verdict: Runtime Error):
s=input()
ans=1
ans_list=[]
n=len(s)


for i in range(0,n):
    if s[i] in {'A','T','C','G',' '}:
        if i==n-1:
            ans+=1
        elif s[i+1] in {'A','T','C','G',' '}:
            ans+=1
    else:
        ans_list.append(ans)
        ans=1

print(ans_list)
if max(ans_list)==1:
    print(0)
else:
    print(max(ans_list))

Buggy submission (verdict: Runtime Error):
s=input()
ans=1
n=len(s)

for i in range(0,n):
    if s[i] in {'A','T','C','G',''}:
        if i==n:
            ans+=1
        elif s[i+1] in {'A','T','C','G',''}:
            ans+=1

if ans>1:
    print(ans)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
s=input()
ans=0
n=len(s)

for i in range(0,n):
    if s[i] in {'A','T','C','G',''}:
        if s[i+1] in {'A','T','C','G',''}:
            ans+=1

print(ans)
Problem p03377 (python)

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

if a<=x and x<=a+b:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
a,b,x = map(int, input().split())

elif a<=x and x<=a+b:
    print("YES")
else:
    print("NO")
Problem p03606 (python)

Fixed submission:
n = int(input())
c=0
for i in range(n):
    s,e = map(int,input().split())
    c += e-s+1
print(c)

Buggy submission (verdict: Runtime Error):
n = int(input)
s=0
for i in range(n):
  s,e = map(int,input().split())
  s += e-s+1
print(s)
Problem p03625 (python)

Fixed submission:
from collections import Counter
n = int(input())
num_l = sorted(map(int, input().split()),reverse=True)
s = sorted(set(num_l), reverse=True)
d = Counter(num_l) # {i:num_l.count(i) for i in s}
res = []
it = 0
lim=len(s)
# c = max()
for i in range(n):
    if d[s[it]] >= 2:
        d[s[it]]-=2
        res.append(s[it])
    else:
        it+=1#pass
        
    if len(res) == 2:
        print(res[0] * res[1])
        break
    if lim==it:
        print(0)

Buggy submission (verdict: Runtime Error):
n = int(input())
num_l=sorted(map(int,input().split()),reverse=True)
s=sorted(set(num_l),reverse=True)
res=[]
for i in num_l:
    if len(res) == 2:
        print(res[0]*res[1])
        break
    if d[i] >= 2:
        d[i]-=2
        res.append(i)
    else:
        pass
else:print(0)
Problem p03633 (python)

Fixed submission:
def gcd(a, b):
    while b > 0:
        a, b = b, a%b
    return a
def lcm(a, b):
    return a*b//gcd(a, b)
n=int(input())
t=[int(input()) for i in range(n)]
for i in range(n-1):
    t[i+1] = lcm(t[i],t[i+1])
print(t[n-1])

Buggy submission (verdict: Runtime Error):
s=set()
n=int(input())
for i in range(n):
    s.add(int(input()))
while len(s) != 1:
    l=list(cb(s,2))
    s = set([lcm(x,y) for x,y in l])
print(list(s)[0])
Problem p03085 (python)

Fixed submission:
base = ['A', 'T', 'A', 'C', 'G', 'C']
str = input()
print(base[base.index(str) + 1])

Buggy submission (verdict: Runtime Error):
N,Q=map(int,input().split())
S=input()
l=list(S)
n=[0]*(N-1)
for i in range(N-1):
    if l[i]=='A':
        if l[i+1]=='C':
            n[i]=1
for i in range(Q):
    l,r=map(int,input().split())
    print(sum(n[l-1:r-1]))

Buggy submission (verdict: Runtime Error):
N,Q=map(int,input().split())
S=input()
out=''
for i in range(Q):
    l,r=map(int,input().split())
    out+=str(S[l-1:r].count('AC'))+'\n'
print(out[:-1])
Problem p03455 (python)

Fixed submission:
a,b = map(int, input().split())
if a*b % 2 == 0:
    print("Even")
else:
    print("Odd")

Buggy submission (verdict: Runtime Error):
a,b = map(int, input().split())
if a*b % 2 == 0
    print("Even")
else
    print("Odd")

Buggy submission (verdict: Runtime Error):
a,b = map(int, input().split())
if a*b % 2 == 0
    print("Even")
else
    print("Odd")

Buggy submission (verdict: Runtime Error):
a,b = map(int, input().split())
if a*b % 2 == 0
    print("Even")
else
    print("Odd")
Problem p03493 (python)

Fixed submission:
a = list(input())
for i in range(3):
    a[i] = int(a[i])
print(a[0]+a[1]+a[2])

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
print(a+b+c)

Buggy submission (verdict: Runtime Error):
a,b,c = (int(i) for i in input().split())
print(a+b+c)

Buggy submission (verdict: Runtime Error):
a,b,c = map(int(i) for i in input().split())
print(a+b+c)

Buggy submission (verdict: Runtime Error):
a,b,c = map(int, input().split())
print(a+b+c)

Buggy submission (verdict: Runtime Error):
a,b,c = (int, input().split())
print(a+b+c)
Problem p03493 (python)

Fixed submission:
def main():
    ans_list = list(str(input().split()))
    print(ans_list.count("1"))


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def num_2n(i):
    count = 0
    while(i % 2 == 0):
        i = i / 2
        count += 1
    return count



def main():
    num_ans = int(input())
    ans_list = list(map(int, input().split()))
    num_2n_list =[]
    for i in ans_list:
        num_2n_list.append(num_2n(i))
    num_2n_list.sort()
    num_2n_list.reverse()
    print(num_2n_list[0])


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def num_2n(i):
    count = 0
    while(i % 2 == 0):
        i = i / 2
        count += 1
    return count



def main():
    num_ans = int(input())
    ans_list = list(map(int, input().split()))
    num_2n_list =[]
    for i in ans_list:
        num_2n_list.append(num_2n(i))
    num_2n_list.sort()
    num_2n_list.reverse()
    print(num_2n_list)


if __name__ == '__main__':
    main()
Problem p03147 (python)

Fixed submission:
N = int(input())
H = input()
H = H.split()
for i, val in enumerate(H):
    H[i] = int(val)
maxNum = max(H)
counter = 0
for i in range(maxNum):
    for j, val in enumerate(H):
        if H[j] != 0:
            H[j] -= 1
            if j < (N-1):
                if H[j + 1] == 0:
                    counter += 1
            if j == (N - 1):
                counter += 1
    # print(H)
    # print(counter)
print(counter)

Buggy submission (verdict: Runtime Error):
N = int(raw_input())
H = raw_input()
H = H.split()
for i, val in enumerate(H):
    H[i] = int(val)
Top = 0
Bottom = len(H)-1
T_PList = [0, Bottom]
count = max(H)
total = 0
Top_L = []
Bot_L = []
current_top = H[0]
current_bot = H[0]
if N <= 2:
    print(count)
else:
    if H[0] > H[1]:
        Top_L.append(H[0])
        current_bot = H[1]
        current_top = [-1]
    elif H[0] < H[1]:
        current_top = H[1]
        current_bot = -1

    for i in range(2,len(H),1):
        if (current_top == H[i-1]) & (H[i]>H[i-1]):
            current_top = H[i]
        elif (current_top == H[i-1]) & (H[i]<H[i-1]):
            Top_L.append(current_top)
            current_bot = H[i]
            current_top = -1
        elif (current_bot == H[i-1]) & (H[i]<H[i-1]):
            current_bot = H[i+1]
        elif (current_bot == H[i-1]) & (H[i]>H[i-1]):
            Bot_L.append(current_bot)
            current_bot = -1
            current_top = H[i]
        # print(current_top)
        # print(current_bot)
    last = len(H)
    if H[last-1] > H[last-2]:
        Top_L.append(H[last-1])
    print(sum(Top_L)-sum(Bot_L))

Buggy submission (verdict: Runtime Error):
N = int(raw_input())
H = raw_input()
H = H.split()
for i, val in enumerate(H):
    H[i] = int(val)
Top = 0
Bottom = len(H)-1
T_PList = [0, Bottom]
count = max(H)
total = 0
Top_L = []
Bot_L = []
current_top = H[0]
current_bot = H[0]
if H[0] > H[1]:
    Top_L.append(H[0])
    current_bot = H[1]
    current_top = [-1]
elif H[0] < H[1]:
    current_top = H[1]
    current_bot = -1

for i in range(2,len(H),1):
    if (current_top == H[i-1]) & (H[i]>H[i-1]):
        current_top = H[i]
    elif (current_top == H[i-1]) & (H[i]<H[i-1]):
        Top_L.append(current_top)
        current_bot = H[i]
        current_top = -1
    elif (current_bot == H[i-1]) & (H[i]<H[i-1]):
        current_bot = H[i+1]
    elif (current_bot == H[i-1]) & (H[i]>H[i-1]):
        Bot_L.append(current_bot)
        current_bot = -1
        current_top = H[i]
    # print(current_top)
    # print(current_bot)
last = len(H)
if H[last-1] > H[last-2]:
    Top_L.append(H[last-1])
print(sum(Top_L)-sum(Bot_L))
Problem p03085 (python)

Fixed submission:
str = input()
 
if str == 'A':
  print('T')
elif str == 'T':
  print('A')
elif str == 'C':
  print('G')
else:
  print('C')

Buggy submission (verdict: Runtime Error):
str = input()

if (str == 'A'):
  print('T')
else if (str == 'T'):
  print('A')
else if (str == 'C'):
  print('G')
else:
  print('C')
Problem p03469 (python)

Fixed submission:
_,b,c=map(str,input().split("/"))
print("2018/"+b+"/"+c)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
for x in range(n+1):
    for y in range(n+1-x):
        if 10000*x+5000*y+1000*(n-x-y)==m and x+y+(n-x-y)==n:
            print(x,y,(n-x-y))
            exit()
print('-1 -1 -1')
Problem p03493 (python)

Fixed submission:
S=input()
num_list=list(S)
sum=0
for s in num_list:
    if s=='1':
        sum+=1
print(sum)

Buggy submission (verdict: Runtime Error):
import collections
N,K=map(int,input().split())
c=sorted(collections.Counter(list(map(str,input().split()))).values())
print(sum(c[:-K]))
Problem p03385 (python)

Fixed submission:
inp = input()
if 'a' in [inp[0],inp[1],inp[2]] and 'b' in [inp[0],inp[1],inp[2]] and 'c' in [inp[0],inp[1],inp[2]]: print('Yes')
else: print('No')

Buggy submission (verdict: Runtime Error):
inp = input()
if 'a' and 'b' and 'c' in [inp[0],inp[1],inp[2]]: print('Yes')
else print('No')
Problem p03387 (python)

Fixed submission:
import numpy as np
A, B, C = map(int,input().split(' '))

Srt = np.sort([A,B,C])

if np.sum(Srt % 2) == 0: a = 0; ad = 0;
elif np.sum(Srt % 2) == 1: a = 1; ad = 1;
elif np.sum(Srt % 2) == 2: a = 1; ad = 0;
elif np.sum(Srt % 2) == 3: a = 0; ad = 1;

#num = a + np.sum(Srt[2] // 2 - (Srt // 2))
Add = (Srt + ad) % 2
newSrt = Srt + Add

#print(a)
#print(newSrt)

print(int(a + np.sum((newSrt[2]- newSrt)/2)))

Buggy submission (verdict: Runtime Error):
import numpy as np
A, B, C = map(int,input().split(' '))

Srt = np.sort([A,B,C])

if np.sum(Srt % 2) == (0 or 3): a = 0
elif np.sum(Srt % 2) == (1 or 2): a = 1

num = a + np.sum(Srt[2] // 2 - (Srt // 2))

print(num)
Problem p03150 (python)

Fixed submission:
S = raw_input()
if S.startswith('k') and S.endswith('eyence'):
    print('YES')
elif S.startswith('ke') and S.endswith('yence'):
    print('YES')
elif S.startswith('key') and S.endswith('ence'):
    print('YES')
elif S.startswith('keye') and S.endswith('nce'):
    print('YES')
elif S.startswith('keyen') and S.endswith('ce'):
    print('YES')
elif S.startswith('keyenc') and S.endswith('e'):
    print('YES')
elif S == 'keyence':
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
if S.startswith('k') and S.endswith('eyence'):
    print('YES')
elif S.startswith('ke') and S.endswith('yence'):
    print('YES')
elif S.startswith('key') and S.endswith('ence'):
    print('YES')
elif S.startswith('keye') and S.endswith('nce'):
    print('YES')
elif S.startswith('keyen') and S.endswith('ce'):
    print('YES')
elif S.startswith('keyenc') and S.endswith('e'):
    print('YES')
elif S == 'keyence':
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
if S.startswith('k') and S.endswith('eyence'):
    print('YES')
elif S.startswith('ke') and S.endswith('yence'):
    print('YES')
elif S.startswith('key') and S.endswith('ence'):
    print('YES')
elif S.startswith('keye') and S.endswith('nce'):
    print('YES')
elif S.startswith('keyen') and S.endswith('ce'):
    print('YES')
elif S.startswith('keyenc') and S.endswith('e'):
    print('YES')
elif S == 'keyence':
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
import re
if S.startswith('k') and S.endswith('eyence'):
    print('YES')
elif S.startswith('ke') and S.endswith('yence'):
    print('YES')
elif S.startswith('key') and S.endswith('ence'):
    print('YES')
elif S.startswith('keye') and S.endswith('nce'):
    print('YES')
elif S.startswith('keyen') and S.endswith('ce'):
    print('YES')
elif S.startswith('keyenc') and S.endswith('e'):
    print('YES')
elif S == 'keyence':
    print('YES')
else:
    print('NO')
Problem p03151 (python)

Fixed submission:
N = raw_input()
A_list = map(int, raw_input().split())
B_list = map(int, raw_input().split())
if sum(A_list) < sum(B_list):
    print(-1)
else:
    import numpy as np
    diff = [x - y for (x, y) in zip(A_list, B_list)]
    neg_list = [i for i in diff if i < 0]
    neg_sum = sum(neg_list)
    pos_list = [i for i in diff if i > 0]
    pos_list.sort(reverse=True)
    pos_list = np.cumsum(pos_list).tolist()
    for j,k in enumerate(pos_list):
        if len(neg_list) == 0:
            print(0)
            break
        elif neg_sum + k >= 0:
            print(j+1+len(neg_list))
            break 
        else:
            continue

Buggy submission (verdict: Runtime Error):
#N = raw_input()
#A_list = map(int, raw_input().split())
#B_list = map(int, raw_input().split())
if sum(A_list) < sum(B_list):
    print(-1)
else:
    import numpy as np
    diff = [x - y for (x, y) in zip(A_list, B_list)]
    neg_list = [i for i in diff if i < 0]
    neg_sum = sum(neg_list)
    pos_list = [i for i in diff if i > 0]
    pos_list.sort(reverse=True)
    pos_list = np.cumsum(pos_list).tolist()
    for j,k in enumerate(pos_list):
        if len(neg_list) == 0:
            print(0)
            break
        elif neg_sum + k >= 0:
            print(j+1+len(neg_list))
            break 
        else:
            continue
Problem p03455 (python)

Fixed submission:
a, b = input().split(' ')
if int(a) * int(b) % 2 == 0:
    print('Even')
else:
    print('Odd')

Buggy submission (verdict: Runtime Error):
a, b = input().split(' ')
if int(a) * int(b) % 2 == 0:
    print('Even')
    continue
print('Odd')
Problem p03087 (python)

Fixed submission:
import numpy as np
N, Q = map(int, raw_input().split())
S = raw_input()
L = np.zeros(Q)
R = np.zeros(Q)
for i in range(Q):
    L[i], R[i] = map(int, raw_input().split())
num = np.zeros(N)
num_tmp = 0
for i in range(1,N):
    if S[i-1:i+1] == "AC":
        num_tmp += 1
    num[i] = num_tmp
for i in range(Q):
    print int(num[int(R[i]-1)] - num[int(L[i]-1)])

Buggy submission (verdict: Runtime Error):
import numpy as np
N, Q = map(int, raw_input().split())
S = raw_input()
L = np.zeros(Q)
R = np.zeros(Q)
for i in range(Q):
    L[i], R[i] = map(int, raw_input().split())
num = np.zeros(Q)
for i in range(N):
    if S[i] == "A":
        if S[i+1] == "C":
            for j in range(Q):
                if int(L[j]-1) <= i and i < int(R[j]-1):                                                            
                   num[j] += 1
for i in num:
    print int(i)
Problem p03101 (python)

Fixed submission:
import numpy as np
H, W = map(int, raw_input().split())
h, w = map(int, raw_input().split())

print int((H-h)*(W-w))

Buggy submission (verdict: Runtime Error):
import numpy as np
H, W = map(int, raw_input().split())
h, w = map(int, raw_input().split())

print int((H-h)*(W-w)