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

Fixed submission:
from operator import itemgetter
from scipy.sparse import csr_matrix
import numpy as np

N = int(input())

XY = [[i] + [int(x) for x in input().split()] for i in range(N)]

edge = set()
for key in [itemgetter(1),itemgetter(2)]:
  XY.sort(key = key)
  for i in range(N-1):
    i1,x1,y1 = XY[i]
    i2,x2,y2 = XY[i+1]
    d = min(abs(x1-x2),abs(y1-y2))
    edge.add((i1,i2,d))
    
# csr形式に直す
row,col,value = zip(*edge)
value = np.array(value,dtype=int)
graph = csr_matrix((value,(row,col)),shape=(N,N))

# 最小全域木
from scipy.sparse.csgraph import minimum_spanning_tree
tree = minimum_spanning_tree(graph, overwrite = True).astype(int)
answer = tree.sum()
print(answer)

Buggy submission (verdict: Runtime Error):
from scipy.sparse.csgraph import minimum_spanning_tree
from scipy.sparse import csr_matrix

n = int(input()) 
ixy = [[i] + [int(x) for x in input().split()] for i in range(n)]
f = []
t = []
d = []

ixy = sorted(ixy, key=lambda x:(x[1], x[2]))
for i in range(n-1):
    j, k = ixy[i][0], ixy[i+1][0]
    d.append(ixy[i+1][1] - ixy[i][1])
    f.append(j)
    f.append(k)

ixy = sorted(ixy, key=lambda x:(x[2], x[1]))
for i in range(n-1):
    j, k = ixy[i][0], ixy[i+1][0]
    d.append(ixy[i+1][2] - ixy[i][2])
    t.append(k)
    f.append(j)

csr_ = csr_matrix((d, (f, t)), shape=(n, n))
mst = minimum_spanning_tree(csr_).astype(int)
print(mst.sum())
Problem p03740 (python)

Fixed submission:
x, y = map(int,input().split())
if abs(x-y) <= 1:
    print('Brown')
else:
    print('Alice')

Buggy submission (verdict: Runtime Error):
x, y =  = map(int,input().split())
if abs(x-y) < 1:
    print('Brown')
else:
    print('Alice')
Problem p03759 (python)

Fixed submission:
a, b, c = map(int,input().split())
print('YES') if b - a == c - b else print('NO')

Buggy submission (verdict: Runtime Error):
a, b, c =  = map(int,input().split())
print('YES') if a == b == c else print('NO')
Problem p03844 (python)

Fixed submission:
a, o, b = input().split()
if o == '+':
    print(int(a) + int(b))
else:
    print(int(a) - int(b))

Buggy submission (verdict: Runtime Error):
a, o, b = input().split()
if o = '+':
    print(int(a) + int(b))
else:
    print(int(a) - int(b))
Problem p04032 (python)

Fixed submission:
def check(l, r):
    th = 1 + (r - l + 1) // 2 
    for i in range(26):
        if cnt[i] >= th:
            return True
    return False

s = input()
n = len(s)
si = [0] * n
for i in range(n):
    si[i] = ord(s[i]) - 97

l, r = 0, 1
cnt = [0]*26
for i in range(2):
    cnt[si[i]] += 1
while l < n-1 and r < n:
    if check(l, r):
        print(l+1, r+1)
        exit()
    elif max(cnt) == 1 + (r - l + 1) // 2 or r-l == 1:
        r += 1
        if r < n:
            cnt[si[r]] += 1
    else:
        cnt[si[l]] -= 1
        l += 1     
print(-1, -1)

Buggy submission (verdict: Runtime Error):
def check(l, r):
    th = 1 + (r - l + 1) // 2 
    for i in range(26):
        if cnt[i] >= th:
            return True
    return False

s = input()
n = len(s)
si = [0] * n
for i in range(n):
    si[i] = ord(s[i]) - 97

l, r = 0, 2
cnt = [0]*26
for i in range(3):
    cnt[si[i]] += 1
while l < n-2 and r < n:
    # print(l, r, cnt)
    if check(l, r):
        print(l+1, r+1)
        exit()
    elif max(cnt) == (r-l) // 2:
        r += 1
        if r < n:
            cnt[si[r]] += 1
    else:
        cnt[si[l]] -= 1
        l += 1     
print(-1, -1)

Buggy submission (verdict: Runtime Error):
def check(l, r):
    th = 1 + (r - l + 1) // 2 
    for i in range(26):
        if cnt[i] >= th:
            return True
    return False

s = input()
n = len(s)
si = [0] * n
for i in range(n):
    si[i] = ord(s[i]) - 97

l, r = 0, 2
cnt = [0]*26
for i in range(3):
    cnt[si[i]] += 1
while l < n-2 and r < n:
    # print(l, r, cnt)
    if check(l, r):
        print(l, r)
        exit()
    elif max(cnt) == (r-l) // 2:
        r += 1
        if r < n:
            cnt[si[r]] += 1
    else:
        cnt[si[l]] -= 1
        l += 1     
print(-1, -1)
Problem p02621 (python)

Fixed submission:
def A(x):
  return x + x**2 + x**3


def B(n, k, p_list):
  pass


def C(N):
  pass


def main():
  print(A(int(input())))
  # letter = input()
  # A(letter)
  # for x in ['A', 'Z', 'a', 'z']:
  #   A(x)


if __name__ == '__main__':
  main()

Buggy submission (verdict: Runtime Error):
def A(x):
  return x + x**2 + x**3



def main():
  print(A(input()))


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

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

c = a*b
if a == c:
  print(1)
elif b == c:
  print(1)
elif c % 2 == 0:
  print(int(c/2))
else:
  print(int(c/2)+1)

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

c = a*b
if a = c:
  print(1)
elif b = c:
  print(1)
elif c % 2 == 0:
  print(int(c/2))
else:
  print(int(c/2)+1)
Problem p02783 (python)

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

if h%a == 0:
  print(int(h/a))
else:
  print(int(h/a+1))

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

if h%a == 0:
  input(h/a)
else:
  input(h/a+1)
Problem p02999 (python)

Fixed submission:
x,a = map(int, input().split())
 
if x < a:
  print(0)
else:
  print(10)

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

if x > a:
  print(0)
else:
  print(10)
Problem p03035 (python)

Fixed submission:
a, b = map(int, input().split())
 
if a >= 13:
  print(b)
elif a <= 5:
    print(0)
else:
  print(int(b/2))

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

if a >= 13:
  print(b)
elif: a =< 5:
    print(0)
else:
  print(int(b/2))
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:
  return 'Even'
else:
  return 'Odd'
Problem p03493 (python)

Fixed submission:
s = str(input())

count = 0
for i in range(3):
    if s[i] == '1':
        count += 1

print(count)

Buggy submission (verdict: Runtime Error):
S = int(input())
i = 0
C = 0

while i < 3:
  if S[i] == 1:
    C += 1
  i += 1
  
print(str(C))
Problem p02830 (python)

Fixed submission:
n = int(input())
a, b = input().split(' ')
res = ''
for i in range(n):
    res += a[i]
    res += b[i]
print(res)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = input()
b = input()
res = ''
for i in range(len(a)):
    res += a[i]
    res += b[i]
print(res)
Problem p02945 (python)

Fixed submission:
a,b=map(int,input().split())
print(max(a+b,a-b,a*b))

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
print(max([a+b,a-b,a*b]))

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
print(max(a+b,max(a-b,a*b)))
Problem p03563 (python)

Fixed submission:
a=int(input())
b=int(input())
print(b*2-a)

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
prinp(b*2-a)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
prinp(b*2-a)
Problem p02630 (python)

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 23 21:04:33 2020

@author: naoki
"""

N = int(input()) # input the row A length "N" 
A = list(map(int,input().split())) # input the row of A 
Q = int(input()) # input the number of trying operation 
BC = [list(map(int,input().split())) for i in range(Q)]
S = 0
num = [0 for i in range(100001)] 
for i in A:
    S += i # Sum of all conponents of the row "A"
    num[i]+=1 

for B,C in BC:
    S = S + (C - B) * num[B]
    num[C] += num[B]
    num[B] = 0 
    print(S)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 23 21:04:33 2020

@author: naoki
"""

N = int(input()) # input the row A length "N" 
A = list(map(int,input().split())) # input the row of A 
Q = int(input()) # input the number of trying operation 
BC = [list(map(int,input().split())) for i in range(Q)]
S = 0
num = [0 for i in range(100001)] 
for i in A:
    S += i # Sum of all conponents of the row "A"
    num[i]+=1 

for B,C in BC:
    S = S + (C - B) * num[B+1]
    num[C+1] += num[B+1]
    num[B+1] = 0 
    print(S)
Problem p03633 (python)

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Fri May 29 21:29:28 2020

@author: naoki
"""
import fractions

N = int(input()) # 時計の個数
T = [int(input()) for i in range(N)] # 時計の針が一周する時間
T.sort() # 小さい順番にソートする
lcm = T[0] 

for i in range(1,N):
    lcm = lcm*T[i]// fractions.gcd(lcm,T[i])
print(lcm)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Fri May 29 21:29:28 2020

@author: naoki
"""
import math

N = int(input()) # 時計の個数
T = [int(input()) for i in range(N)] # 時計の針が一周する時間
T.sort() # 小さい順番にソートする
lcm = T[0] 

for i in range(1,N):
    lcm = lcm*T[i]// math.gcd(lcm,T[i])
print(lcm)
Problem p03485 (python)

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

Buggy submission (verdict: Runtime Error):
a, b = (int(x) for x in input().split())
s = (a + b) % 2
t = (a + b) / 2
if s == 0:
	print(t)
	else:
	print(t + 0.5)
Problem p02717 (python)

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

Buggy submission (verdict: Runtime Error):
X=input("")
Y=input("")
Z=input("")
if 1<=X<=100and 1<=Y<=100 and 1<=Z<=100 :
  print(Y, X, Z)
  print(Z, Y, x)
Problem p02981 (python)

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

Buggy submission (verdict: Runtime Error):
N,A,B = map(int,input().slit())
if N*A<B:
  print(N*A)
elif N*A>B:
  print(B)
else:
  print()

Buggy submission (verdict: Runtime Error):
N,A,B = map(int,input().slit())
if N*A<=B:
  print(N*A)
else N*A>=B:
  print(B)
Problem p03210 (python)

Fixed submission:
X=int(input())
if X==3:
  print("YES")
elif X==5:
  print("YES")
elif X==7:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
X=int(input())
if X==3:
  print("YES")
elif X==5:
  print("YES")
elif X==7:
  print("YES”)
else :
  print("NO")

Buggy submission (verdict: Runtime Error):
X=input()
if X==3:
  print("YES")
elif X==5:
  print("YES")
elif X==7:
  print("YES”)
else :
  print("NO")
Problem p02554 (python)

Fixed submission:
import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush,heapify
from math import ceil, floor, sqrt, factorial
from copy import deepcopy
 
def main():
    n = int(input()) 
    ans = (10**n) - 2*(9**n) + (8**n) 
    print(ans%(10**9+7))
    

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush,heapify
from math import ceil, floor, sqrt, factorial
from copy import deepcopy
 
def main():
    n = int(input()) % (10**9+7)
    num = 0
    ans = (10**n) - 2(9**n) + (8**n) 
    print(ans%810**9+7)
    

if __name__ == "__main__":
    main()
Problem p02608 (python)

Fixed submission:
import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush,heapify
from math import ceil, floor, sqrt
from copy import deepcopy


def main():
    n = int(input())
    ans = [0]*(10**4+1)
    h = 0

    for i in range(1,99):
        for j in range(1,99):
            for m in range(1,99):
                h = i**2 + j**2 + m**2 + i*j + j*m + m*i
                if h >= (10**4)+1:
                    break
                ans[h] += 1

    for i in range(1,n+1):
        print(ans[i])

if __name__ == '__main__':
	main()

Buggy submission (verdict: Runtime Error):
import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush,heapify
from math import ceil, floor, sqrt
from copy import deepcopy


def main():
    n = int(input())
    ans = [0]*(10**4)
    h = 0

    for i in range(1,51):
        for j in range(1,51):
            for m in range(1,51):
                h = i*(i+j) + j*(j+m) + m*(m+i)
                if h >= len(ans):
                    break
                ans[h] += 1

    for i in range(1,n+1):
        print(ans[i])

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

Fixed submission:
import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush,heapify
from math import ceil, floor, sqrt, gcd
from copy import deepcopy
from functools import reduce

def main():
    n = int(input())
    lists = []
    ans = [0]*4
    for i in range(n):
        s = input()
        if not s in lists:
            lists.append(s)


        if s == "AC":
            ans[0] += 1
        elif s == "WA" :
            ans[1] += 1
        elif s == "TLE":
            ans[2] += 1
        else:
            ans[3] += 1
    

    for i in range(len(ans)):
        if i == 0:
            print("AC x", ans[i])
        elif i == 1 :
            print("WA x", ans[i])
        elif i == 2:
            print("TLE x", ans[i])
        else:
            print("RE x", ans[i])


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush,heapify
from math import ceil, floor, sqrt, gcd
from copy import deepcopy
from functools import reduce

def main():
    n = int(input())
    lists = []
    ans = [0]*4
    for i in range(n):
        s = input()
        if not s in lists:
            lists.append(s)


        if s == "AC":
            ans[0] += 1
        elif s == "WA" :
            ans[1] += 1
        elif s == "TLE":
            ans[2] += 1
        else:
            ans[3] += 1
    

    for i in range(ans):
        if i == 0:
            print("AC x", ans[i])
        elif i == 1 :
            print("WA x", ans[i])
        elif i == 2:
            print("TLE x", ans[i])
        else:
            print("RE x", ans[i])


if __name__ == "__main__":
    main()
Problem p02630 (python)

Fixed submission:
import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush,heapify
from math import ceil, floor, sqrt
from copy import deepcopy

def main():
    max_num = 10**5
    n = int(input())
    a_list = list(map(int, input().split()))
    q = int(input())
    
    query = [map(int, input().split()) for _ in range(q)]
    num = [0 for _ in range(max_num+1)]
    for i in a_list:
        num[i] += 1

    ans = sum(a_list)

    for b,c in query:
        n = num[b]
        num[b] = 0
        num[c] += n
        ans += (c-b)*n
        print(ans)

    
if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush,heapify
from math import ceil, floor, sqrt
from copy import deepcopy

def main():
    #max_num = 10**5
    max_num = 10
    n = int(input())
    a_list = list(map(int, input().split()))
    q = int(input())
    
    query = [map(int, input().split()) for _ in range(q)]
    num = [0 for _ in range(max_num+1)]
    for i in a_list:
        num[i] += 1

    ans = sum(a_list)

    for b,c in query:
        n = num[b]
        num[b] = 0
        num[c] += n
        ans += (c-b)*n
        print(ans)

    
if __name__ == "__main__":
    main()
Problem p02657 (python)

Fixed submission:
import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush
from math import ceil, floor, sqrt, gcd
from copy import deepcopy

def main():
    a,b = map(int, input().split())
    print(a*b)
if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush,heapify
from math import ceil, floor, sqrt, gcd
from copy import deepcopy


def main():
    n = int(input())
    a_list = tuple(map(int, input().split()))
    num = 1000000000000000000
    ans = 1
    for i in range(n):
        ans *= a_list[i]
    
    if ans <= num:
        print(ans)
    else:
        print(-1)

if __name__ == "__main__":
    main()
Problem p02731 (python)

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

Buggy submission (verdict: Runtime Error):
import os
import math

def main():
    l = int(input())
    if l%3 == 0:
        s = l/3
        print(s*s*s)
    else:
        s = math.floorl(l/3)
        s1 = s + 0.5
        print(s*s1*s1)

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import os
import math

def main():
    l = int(input())
    if l%3 == 0:
        s = l/3
        print(math.pow(s,3))
    else:
        s = math.floorl(l/3)
        s1 = s + 0.5
        print(s*s1*s1)

if __name__ == "__main__":
    main()
Problem p02765 (python)

Fixed submission:
import os

def main():
    a=[int(x) for x in input().split()]
    if a[0] >= 10:
        print(a[1])
    else:
        num = 100*(10-a[0])
        print(num + a[1])

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import os

def main():

    N,K = (int(x) for x in input().split())
    count = 0

    while(N > 0):
        N = N // K
 
        count += 1

    print(count)

if __name__ == "__main__":
    main()
Problem p02767 (python)

Fixed submission:
import os
import math

def main():
    num = int(input())
    x_list = list(map(int, input().split()))
    min_num = 10**10    
    for i in range(100):
        result = 0  
        for j in x_list:
            result += pow((i - j), 2)
        
        if result < min_num:
            min_num = result
    print(min_num)

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import os

def main():
        num = int(input())
        dict_list = {}
        for i in range(num):
                strings = input()
                if strings in dict_list.keys():
                        dict_list[strings] += 1
                else:
                        dict_list[strings] = 1 

        max_num = max(dict_list.values())
        result = []
        
        for k,v in dict_list.items():
                if v == max_num:
                        result.append(k)
        result.sort()
        for i in result:
                print(i)

if __name__ == "__main__":
        main()
Problem p02900 (python)

Fixed submission:
from fractions import gcd
import math
a,b = map(int,input().split())
n = gcd(a,b)
if n == 1:
    print(1)
    exit()
count = 1
for i in range(2,math.ceil(math.sqrt(n))+1):
    if n % i == 0:
        count += 1
        while n % i == 0:
            n //= i
if n > 1:
    count += 1
print(count)

Buggy submission (verdict: Runtime Error):
import math

def factorize(n):
    b = 2
    fct = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        b = b + 1
    if n > 1:
        fct.append(n)
    return fct


def main():
	a,b = map(int, input().split())
	num = math.gcd(a,b)
	if num == 1:
		print(1)
		exit()
	result_list = factorize(num)
	print(len(set(result_list)) + 1)			
	


if __name__ == "__main__":
	main()

Buggy submission (verdict: Runtime Error):
import math

def main():
	a,b = map(int, input().split())
	num = math.gcd(a,b)
	if num == 1:
		print(1)
		exit()
	count = 1
	for i in range(2, math.ceil(math.sqrt(num))+ 1):
		if num % i == 0:
			count += 1
			while num%i == 0:
				num //= i
	if num > 1:
		count += 1
	print(count)	


if __name__ == "__main__":
	main()

Buggy submission (verdict: Runtime Error):
import math


def factorize(n):
    b = 2
    fct = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        b = b + 1
    if n > 1:
        fct.append(n)
    return fct


def main():
	a,b = map(int, input().split())
	num = math.gcd(a,b)
	if num == 1:
		print(1)
		exit()
	result_list = factorize(num)
	print(len(set(result_list)) + 1)			
	


if __name__ == "__main__":
	main()

Buggy submission (verdict: Runtime Error):
import math

def main():
	a,b = map(int, input().split())
	num = math.gcd(a,b)
	if num == 1:
		print(1)
		exit()
	result_list = factorize(num)
	print(len(set(result_list)) + 1)			
	

def factorize(n):
    b = 2
    fct = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        b = b + 1
    if n > 1:
        fct.append(n)
    return fct


if __name__ == "__main__":
	main()
Problem p02995 (python)

Fixed submission:
import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush
from math import ceil, floor, sqrt
from copy import deepcopy
from fractions import gcd

def main():
    a,b,c,d = map(int, input().split())
    a -= 1
    num = int(c*d / gcd(c,d))
    num_a = a - int(a // c + a // d - a // num)
    num_b = b - int(b // c + b // d - b // num)
    print(num_b - num_a)

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush
from math import ceil, floor, sqrt, gcd
from copy import deepcopy

def main():
    a,b,c,d = map(int, input().split())
    a -= 1
    num = int(c*d / gcd(c,d))
    num_a = a - int(a // c + a // d - a // num)
    num_b = b - int(b // c + b // d - b // num)
    print(num_b - num_a)

if __name__ == "__main__":
    main()
Problem p03000 (python)

Fixed submission:
import os

def main():
    n,x = map(int, input().split())
    list_a = list(map(int, input().split()))
    ans = 0
    count = 1

    for i in range(n):
        ans += list_a[i]
        if (ans <= x):
            count += 1
        else:
            break

    print(count)

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import os

def main():
    n,x = map(int, input().split())
    list_a = list(map(int, input().split()))
    ans = 0
    count = 1
    i = 0

    while(ans <= x):
        ans += list_a[i]
        if ans <= x:
            count += 1
            i += 1
        else:
            break

    print(count)

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import os

def main():
    n,x = map(int, input().split())
    list_a = list(map(int, input().split()))
    ans = 0
    count = 1
    i = 0

    while(ans < x):
        ans += list_a[i]
        if ans <= x:
            count += 1
            i += 1
        else:
            break

    print(count)

if __name__ == "__main__":
    main()