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

Fixed submission:
s=input()
print(s.replace(","," "))

Buggy submission (verdict: Runtime Error):
k,s=map(int,input().split())
cnt=0
for i in range(k+1):
    for j in range(k+1):
        z=s-i-j
        if z>=0 and z<=k:
            cnt+=1
print(cnt)
Problem p02689 (python)

Fixed submission:

N, M = map(int, input().split())
H = list(map(int, input().split()))

AB = [list(map(int, input().split())) for _ in range(M)]

check = [True] * N

for ab in AB:
    # 左みる
    if H[ab[0]-1] < H[ab[1] - 1]:
        check[ab[0]-1] = False
        
    elif H[ab[1]-1] < H[ab[0] - 1]:
        check[ab[1]-1] = False
    else:
        check[ab[0]-1] = False
        check[ab[1]-1] = False
    
print(sum(check))

Buggy submission (verdict: Runtime Error):

N, M = map(int, input().split())
H = list(map(int, input().split()))

AB = [list(map(int, input().split())) for _ in range(M)]

check = [True] * N

for ab in AB:
    # 左みる
    print(ab, "left: ", H[ab[0]-1], "right: ", H[ab[1]-1]) 
    if H[ab[0]-1] < H[ab[1] - 1]:
        check[ab[0]-1] = False
    elif H[ab[0]-1] > H[ab[1] - 1]:
        check[ab[1]-1] = False
    #else:
    #    check[ab[0]-1] = not check[ab[0]-1]
    print(check)
print(sum(check))
Problem p03011 (python)

Fixed submission:
time = list(map(int, input().split()))
time.remove(max(time))
print(sum(time))

Buggy submission (verdict: Runtime Error):
time = list(int(input()) for i in range(3))
time.remove(max(time))
print(sum(time))
Problem p02835 (python)

Fixed submission:
a,b,c = map(int,input().split())
print('bust' if a+b+c>=22 else 'win')

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

num = 0

for i in range(N-1):
    for j in range(i+1,N):
        b3 = A[i]^A[j]
        num += b3

print(num%(10**9+7))
Problem p02847 (python)

Fixed submission:
s = input()

if s == 'SUN':
    print('7')
if s == 'SAT':
    print('1')
if s == 'FRI':
    print('2')
if s == 'THU':
    print('3')
if s == 'WED':
    print('4')
if s == 'TUE':
    print('5')
if s == 'MON':
    print('6')

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

list_S = list(S)

for i in range(len(list_S)):
    list_S[i] = chr( ord(list_S[i]) + N )

    if ord(list_S[i]) > ord('Z'):
        list_S[i] = chr( ord('A') + ( ord(list_S[i])- ord('Z') ) -1 )

print("".join(list_S))

Buggy submission (verdict: Runtime Error):
s = input('S')

if s == 'SUN':
    print('7')
if s == 'SAT':
    print('1')
if s == 'FRI':
    print('2')
if s == 'THU':
    print('3')
if s == 'WED':
    print('4')
if s == 'TUE':
    print('5')
if s == 'MON':
    print('6')
Problem p02916 (python)

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

count = 0

for i in range(n):

    if i == 0:
        count += b[a[i]-1]

    else:
        count += b[a[i]-1]

        if a[i] - a[i-1] == 1:
            count += c[a[i-1]-1]

print(count)

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

count = 0

for i in range(n):

    if i == 0:
        count += b[a[i]-1]

    else:
        count += b[a[i]-1]

        if a[i] - a[i-1] == 1:
            count += c[a[i-1]-1]

print(count)
Problem p02688 (python)

Fixed submission:
# -*- coding: utf-8 -*-
n, k = map(int, input().split())

sunuke_list = [False for i in range(n)]

for i in range(k):
    d = int(input())
    has_sunuke_list = input().split()
    for k in has_sunuke_list:
        sunuke_list[int(k)-1] = True

print(sunuke_list.count(False))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
n, k = map(int, input().split())

sunuke_list = [False for i in range(n)]

for i in range(k):
    d = int(input())
    has_sunuke_list = input().split()
    for k in has_sunuke_list:
        sunuke_list[int(k)-1] = True

print(sunuke_list.coutn(False))
Problem p02699 (python)

Fixed submission:
S, W = [int(i) for i in input().split()]

if S <= W:
  print('unsafe')
else:
  print('safe')

Buggy submission (verdict: Runtime Error):
S = input()
l = len(S)

count = 0
for i in range(l):
  for j in range(l):
    if i < j:
      new_s = int(S[i:j+1])
      if new_s % 2019 == 0:
        count += 1
      else:
        continue
    else:
      continue
print(count)
Problem p02771 (python)

Fixed submission:
import collections
A = [i for i in input().split()]
A = collections.Counter(A)

if A.most_common()[0][1] == 2:
    print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [int(i) for i in input().split()]

count = 0
for i in A:
  if i % 2 == 0:
    if i % 3 != 0 and i % 5 != 0:
      count += 1

if count == 0:
  print('APPROVED')
else:
  print('DENIED')
Problem p02754 (python)

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

N, A, B = map(int, input().split())

q, mod = divmod(N, A + B)

print((A * q) + min(mod, A))

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

N, A, B = map(int, input().split())

q, mod = divmod(N, A + B)

print((A * q) + min(mod, A)))
Problem p02699 (python)

Fixed submission:
S, W = map(int, input().split())
if S <= W:
    print('unsafe')
else:
    print('safe')

Buggy submission (verdict: Runtime Error):
S = input()
N = len(S)
cnt = 0
for i in range(N):
    for j in range(i+1, N+1):
        #print(i, j)
        num = int(S[i: j])
        if num % 2019 == 0:
            #print(i, j)
            cnt += 1
print(cnt)
Problem p02759 (python)

Fixed submission:
N = int(input())
if N % 2 != 0:
    ans = (N//2)+1
if N % 2 == 0:
    ans = (N//2)
print(round(ans,N))

Buggy submission (verdict: Runtime Error):
A11,A12,A13,A21,A22,A23,A31,A32,A33 = map(int,input().split(" "))
bingo = [A11,A12,A13,A21,A22,A23,A31,A32,A33]
bingo = ",".join(map(str,bingo))
N = int(input())
for i in range(N):
    b = input()
    if b in bingo:
        bingo.replace(b,True)
    else:
        pass
Bingo = bingo.split(",")
Flag = False
if Bingo[0] == Bingo[1] == Bingo[2]==True:
    Flag = True
if Bingo[3] == Bingo[4] == Bingo[6]==True:
    Flag = True
if Bingo[6] == Bingo[7] == Bingo[8]==True:
    Flag = True
if Bingo[0] == Bingo[3] == Bingo[6]==True:
    Flag = True
if Bingo[1] == Bingo[4] == Bingo[7]==True:
    Flag = True
if Bingo[2] == Bingo[5] == Bingo[8]==True:
    Flag = True
if Bingo[0] == Bingo[4] == Bingo[8]==True:
    Flag = True
if Bingo[2] == Bingo[4] == Bingo[6]==True:
    Flag = True
else:
    pass
if flag == True:
    print("Yes")
else:
    print("No")
Problem p02785 (python)

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

A.sort(reverse=True)
print(sum(A[K:]))

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split(" "))
H = list(map(int,input().split(" ")))
H = sorted(H,reverse = True)
Flag = False
if len(H)<=(K):
        H.clear()
        Flag = True
        print("0")
        
if Flag == False:
    for i in range(K):
        H.remove(H[i])
    print(sum(H))

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split(" "))
H = list(map(int,input().split(" ")))
H = sorted(H,reverse = True)
for i in range(K):
    H.remove(H[i])
sum_ = sum(H)
pint(sum)
Problem p02759 (python)

Fixed submission:
N = int(input())
if N % 2 == 0:
    print(int(N/2))
else:
    print(int(N//2) + 1 )

Buggy submission (verdict: Runtime Error):
S = input()
if S[0]==S[1] or S[1]==S[2] or S[2]==S[3]:
    print('Bad')
else:
    print('Good')
Problem p03315 (python)

Fixed submission:
n = 0
a,b,c,d = input()
for i in [a,b,c,d]:
    if i == "+":
        n += 1
    else:
        n -= 1
print(n)

Buggy submission (verdict: Runtime Error):
n = 0
list = input().split()
for i in list:
    if list[i] == +:
        n += 1
    else:
        n -= 1
print(n)
Problem p02688 (python)

Fixed submission:
N,K = [int(i) for i in input().split()]
d = []
A = []
person = []
for i in range(K):
    a = int(input())
    d.append(a)
    b = [int(i) for i in input().split()]
    A.append(b)

for i in range(N):
    person.append(i+1)

for i in range(K):
    for j in range(d[i]):
            if A[i][j] in person:
                person.remove(A[i][j])

print(len(person))

Buggy submission (verdict: Runtime Error):
N,K = [int(i) for i in input().split()]
d = []
A = []
person = []
for i in range(K):
    a = int(input())
    d.append(a)
    b = [int(i) for i in input().split()]
    A.append(b)

for i in range(N):
    person.append(i)

for i in d:
    for j in range(i):
        for k in A[j]:
            if k in person:
                person.remove(k)

print(len(person)-1)

Buggy submission (verdict: Runtime Error):
N,K = [int(i) for i in input().split()]
d = []
A = []
person = []
for i in range(K):
    a = int(input())
    d.append(a)
    b = [int(i) for i in input().split()]
    A.append(b)

for i in range(N):
    person.append(i+1)

for i in d:
    for j in range(i):
        for k in A[j]:
            if k in person:
                person.remove(k)

print(len(person))
Problem p02881 (python)

Fixed submission:
import math

N = int(input())
ans = []
for i in range(1,int(math.sqrt(N))+1):
    if N % i == 0:
        ans.append(i + N // i - 2)

print(min(ans))

Buggy submission (verdict: Runtime Error):
N = int(input())
A = []

for i in range(N):
    for j in range(N):
        if i * j == N:
            A.append((i+j))

print(min(A)-2)
Problem p03776 (python)

Fixed submission:
def comb(n, k):
    return factorial(n) // (factorial(k) * factorial(n-k))
  
if __name__ == '__main__':
    from collections import Counter
    from math import factorial

    N,A,B = [int(i) for i in input().split()]
    V = [int(i) for i in input().split()]

    V.sort(reverse = True)
    max_list = [V[0:A]]
    max = sum(V[0:A]) / A

    for i in range(A+1,B+1):
        a = sum(V[0:i]) / i
        if max <= a:
            max_list.append(V[0:i])
            max = a
    print("{:.6f}".format(max))

    ans = 0
    for x in max_list:
        ans_sub = 1
        try:
            x = Counter(x).most_common()
        except TypeError:
            ans += ans_sub
            continue
        for i in range(len(x)):
            ans_sub *= comb(V.count(x[i][0]),x[i][1])
        ans += ans_sub
    print(int(ans))

Buggy submission (verdict: Runtime Error):
if __name__ == '__main__':
    from collections import Counter
    from scipy.mist import comb

    N,A,B = [int(i) for i in input().split()]
    V = [int(i) for i in input().split()]

    V.sort(reverse = True)
    max_list = [V[0:A]]
    max = sum(V[0:A]) / A

    for i in range(A+1,B+1):
        a = sum(V[0:i]) / i
        if max <= a:
            max_list.append(V[0:i])
            max = a
    print("{:.6f}".format(max))
    
    ans = 0
    for x in max_list:
        ans_sub = 1
        try:
            x = Counter(x).most_common()
        except TypeError:
            ans += ans_sub
            continue
        for i in range(len(x)):
            ans_sub *= comb(V.count(x[i][0]),x[i][1])
        ans += ans_sub
    print(int(ans))

Buggy submission (verdict: Runtime Error):
if __name__ == '__main__':
    from collections import Counter
    from mist.special import comb

    N,A,B = [int(i) for i in input().split()]
    V = [int(i) for i in input().split()]

    V.sort(reverse = True)
    max_list = [V[0:A]]
    max = sum(V[0:A]) / A

    for i in range(A+1,B+1):
        a = sum(V[0:i]) / i
        if max <= a:
            max_list.append(V[0:i])
            max = a
    print("{:.6f}".format(max))
    
    ans = 0
    for x in max_list:
        ans_sub = 1
        try:
            x = Counter(x).most_common()
        except TypeError:
            ans += ans_sub
            continue
        for i in range(len(x)):
            ans_sub *= comb(V.count(x[i][0]),x[i][1])
        ans += ans_sub
    print(int(ans))

Buggy submission (verdict: Runtime Error):
if __name__ == '__main__':
    from collections import Counter
    from scipy.special import comb

    N,A,B = [int(i) for i in input().split()]
    V = [int(i) for i in input().split()]

    V.sort(reverse = True)
    max_list = V[0:A]
    max = sum(V[0:A]) / A

    for i in range(A+1,B+1):
        a = sum(V[0:i]) / i
        if max < a:
            max_list = V[0:i]
            max = a
    print("{:.6f}".format(max))

    ans = 1
    max_list = Counter(max_list).most_common()
    for i in range(len(max_list)):
        ans *= comb(V.count(max_list[i][0]),max_list[i][1])
    print(int(ans))
Problem p03834 (python)

Fixed submission:
A = input()
A = A.replace(',',' ')

print(A)

Buggy submission (verdict: Runtime Error):
A = input()
for i in range(len(A)):
  if A[i] == ',':
    A[i] = ''

print(A)
Problem p02880 (python)

Fixed submission:
a = int(input())

key = True
for i in range(1, 10):
  for j in range(1, 10):
    if(a == i * j and key):
      print('Yes')
      key = False
if(key):
  print('No')

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

key = True
for i in range(1, 10):
  for j in range(1, 10):
    if(a == i * j):
      print('YES')
      key = False
  if(!key):
    break
if(key):
  print('NO')
Problem p02723 (python)

Fixed submission:


############ ---- USER DEFINED INPUT FUNCTIONS ---- ############
def inp():
    return(int(input().rstrip()))
def inlt():
    return(list(map(int,input().rstrip().split())))
def insr():
    s = input().rstrip()
    return(s[:len(s) - 1])
def invr():
    return(map(int,input().rstrip().split()))
################################################################
s = input().strip()
if s[2] == s[3] and s[4] == s[5]:
    print('Yes')
else:
    print('No')
#print()

Buggy submission (verdict: Runtime Error):
import sys,bisect
from math import gcd
input = sys.stdin.readline
 
############ ---- USER DEFINED INPUT FUNCTIONS ---- ############
def inp():
    return(int(input().rstrip()))
def inlt():
    return(list(map(int,input().rstrip().split())))
def insr():
    s = input().rstrip()
    return(s[:len(s) - 1])
def invr():
    return(map(int,input().rstrip().split()))
################################################################
s = input().strip()
if s[2] == s[3] and s[4] == s[5]:
    print('Yes')
else:
    print('No')
#print()

Buggy submission (verdict: Runtime Error):
import sys,bisect
from math import gcd
input = sys.stdin.readline

############ ---- USER DEFINED INPUT FUNCTIONS ---- ############
def inp():
    return(int(input().rstrip()))
def inlt():
    return(list(map(int,input().rstrip().split())))
def insr():
    s = input().rstrip()
    return(s[:len(s) - 1])
def invr():
    return(map(int,input().rstrip().split()))
################################################################
s = input().strip()
if s[2] == s[3] and s[4] == s[5]:
    print('Yes')
else:
    print('No')
#print()
Problem p02990 (python)

Fixed submission:
import math

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

n = nk[0]
k = nk[1]

countSplit = 1
countPut = n - k + 1

for i in range(k):
    if i == 0:
        print(n - k + 1)
    elif i <= n - k:

        countSplit = math.factorial(k - 1) // math.factorial(k - 1 - i) // math.factorial(i)
        countPut = math.factorial(n - k + 1) // math.factorial(n - k - i) // math.factorial(i + 1)
        """
        countSplit = int(countSplit * (k - i) / i)
        countPut = int(countPut * (n - k + 1 - i) / (i + 1))
        """
        print((countPut * countSplit) % (10 ** 9 + 7))

    else:
        print(0)

Buggy submission (verdict: Runtime Error):
import math

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

n = nk[0]
k = nk[1]

countSplit = 1
countPut = n - k + 1

for i in range(k):
    if i == 0:
        print(n - k + 1)
    elif i <= n - k:

        countSplit = int(countSplit * (k - i) / i)
        countPut = int(countPut * (n - k + 1 - i) / (i + 1))
        
        print((countPut * countSplit) % (10 ** 9 + 7))

    else:
        print(0)

Buggy submission (verdict: Runtime Error):
import math

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

n = nk[0]
k = nk[1]

countSplit = 1
countPut = n - k + 1

for i in range(k):
    if i == 0:
        print(n - k + 1)
    elif i <= n - k:
        """
        countSplit = math.factorial(k - 1) // math.factorial(k - 1 - i)
        countPut = math.factorial(n - k + 1) // math.factorial(n - k - i)
        """
        countSplit = int(countSplit * (k - i) / i)
        countPut = int(countPut * (n - k + 1 - i) / (i + 1))

        print((countPut * countSplit) % (10 ** 9 + 7))

    else:
        print(0)

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

n = nk[0]
k = nk[1]

countSplit = 1
countPut = n - k + 1

for i in range(k):
    if i == 0:
        print(n - k + 1)
    elif i <= n - k:
        countSplit = int(countSplit * (k - i) / i)
        countPut = int(countPut * (n - k + 1 - i) / (i + 1))
        print((countPut * countSplit) % (10 ** 9 + 7))
    else:
        print(0)

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

n = nk[0]
k = nk[1]

countSplit = 1
countPut = n - k + 1

for i in range(k):
    if i == 0:
        print(n - k + 1)
    elif i <= n - k:
        countSplit = int(countSplit * (k - i) / i)
        countPut = int(countPut * (n - k + 1 - i) / (i + 1))
        print(i,(countPut * countSplit) % (10 ** 9 + 7))
    else:
        print(0)
Problem p03286 (python)

Fixed submission:
n = int(input())
k = 1
kotae = []
kotae2 = []

if n != 0:
    while n != 0:
        if n % ((-2) ** k) == 0:
            kotae.append(0)
        else:
            kotae.append(1)
            n = n - ((-2) ** (k - 1))
        k = k + 1

    for i in kotae[::-1]:
        kotae2.append(str(i))

    print("".join(kotae2))
else:
    print(0)

Buggy submission (verdict: Runtime Error):
n = int(input())
k = 1
kotae = []
kotae2 = []

if n != 0:
    while n != 0:
        if n % ((-2) ** k) == 0:
            kotae.append(0)
        else:
            kotae.append(1)
            n = n - ((-2) ** (k - 1))
        k = k + 1

    for i in kotae[::-1]:
        kotae2.append(i)

    print("".join(kotae2))
else:
    print(0)
Problem p02771 (python)

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

if a == b != c or b == c != a or c == a != b:
    print('Yes')
else:
    print('No')

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

if a == b != c or b == c != a or c == a != b:
    print('Yes')
else:
    print('No')

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

if a = b != c or b = c != a or c = a != b:
    print('Yes')
else:
    print('No')
Problem p02773 (python)

Fixed submission:
import collections
n = int(input())
s_ = [input() for i in range(n)]

cnt = collections.Counter(s_)
cntList = list(cnt.most_common())
cnt_f = cnt.most_common()[0][1]

resList = []
for i in range(len(cntList)):
    if cntList[i][1] == cnt_f:
        resList.append(cntList[i][0])
    else:
        break

resList.sort()
for i in resList:
    print(i)

Buggy submission (verdict: Runtime Error):
import collections
n = int(input())
s_ = [input() for i in range(n)]

cnt = collections.Counter(s_)
cntList = list(cnt.most_common())
cnt_f = cnt.most_common()[0][1]

resList = []
for i in range(n):
    if cntList[i][1] == cnt_f:
        resList.append(cntList[i][0])
    else:
        break

resList.sort()
for i in resList:
    print(i)
Problem p02777 (python)

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

if u == s:
    print(a-1,b)
else:
    print(a,b-1)

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

if u = s:
    print(a-1,b)
else:
    print(a,b-1)
Problem p02785 (python)

Fixed submission:
n,k = map(int,input().split())
h_ = list(map(int,input().split()))

if len(h_) <= k:
    print(0)
else:
    h_.sort(reverse = True)
    for i in range(k):
        h_[i] = 0
    print(sum(h_))

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

a_.sort()
for i in range(n):
    a_[i] = 0
print(sum(a_))
Problem p02831 (python)

Fixed submission:
def gcd(x, y):
    if x == 0:
        return y
    else:
        return gcd(y % x, x)

def lcm(x, y):
    return (x * y) // gcd(x, y)
a,b = map(int,input().split())

print(lcm(a,b))

Buggy submission (verdict: Runtime Error):
import math

def lcm(x, y):
    return (x * y) // math.gcd(x, y)
a,b = map(int,input().split())

print(lcm(a,b))

Buggy submission (verdict: Runtime Error):
import math

a,b=list(map(int,input().split()))

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

print(int(lcm(a, b)))

Buggy submission (verdict: Runtime Error):
import math

a,b=list(map(int,input().split()))

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

print(lcm(a, b))

Buggy submission (verdict: Runtime Error):
import math

a,b=list(map(int,input().split()))

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

print(lcm(a, b))
Problem p02682 (python)

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

# ans = []

# ans += [1] * a
# ans += [0] * b
# ans += [-1] * c

if k <= a:
    print(k)
elif k <= a + b:
    print(a)
elif k <= a + b + c:
    print(a - (k - a - b))

#print(sum(ans[:k]))

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

ans = []

ans += [1] * a
ans += [0] * b
ans += [-1] * c

print(sum(ans[:min(k, a+b+c)]))

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

ans = []

ans += [1] * a
ans += [0] * a
ans += [-1] * a

print(sum(ans[:min(k, a+b+c)]))
Problem p02831 (python)

Fixed submission:
import math

A,B = map(int, input().split())

def computeGCD(x, y): 
    if x > y: 
        small = y 
    else: 
        small = x 
    for i in range(1, small+1): 
        if((x % i == 0) and (y % i == 0)): 
            gcd = i 
              
    return gcd

def lcm(x, y):
    return (x * y) // computeGCD(x, y)

print(lcm(A, B))

Buggy submission (verdict: Runtime Error):
import math

A,B = map(int, input().split())

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

print(lcm(A, B))
Problem p03012 (python)

Fixed submission:
import numpy as np
 
n=int(input())
w=list(map(int, input().split()))
s=[0]*n
 
for i in range(n):
  a = np.sum(w[:i])
  b = np.sum(w)
  c = b - a
  s[i] = abs(a-c)
  
print(int(np.min(s)))

Buggy submission (verdict: Runtime Error):
import numpy as np
 
n=int(input())
w=list(map(int, input().split()))
s=[0]*n
 
for i in range(n):
  a = np.sum(w[:i])
  b = np.sum(w)
  c = b - a
  s[i] = abs(a-c)
  
print(int(np.min(s)))
Problem p02729 (python)

Fixed submission:
n, m = map(int, input().split())

n_cmb = n * (n - 1) / 2
m_cmb = m * (m - 1) / 2
print(int(n_cmb + m_cmb))

Buggy submission (verdict: Runtime Error):
from math import factorial

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


def combinations_count(n, r):
    ''' 組み合わせ '''
    return factorial(n) // (factorial(n - r) * factorial(r))


n_cmb = combinations_count(n, 2)
m_cmb = combinations_count(m, 2)

print(n_cmb + m_cmb)

Buggy submission (verdict: Runtime Error):
from operator import mul
from functools import reduce

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


def cmb(n, r):
    r = min(n-r, r)
    if r == 0:
        return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1, r + 1))
    return over // under


a = cmb(n, 2)
b = cmb(m, 2)

print(a + b)

Buggy submission (verdict: Runtime Error):
from scipy.special import comb

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

a = comb(n, 2, exact=True)
b = comb(m, 2, exact=True)
print(a + b)
Problem p02754 (python)

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

ans = n // (a + b) * a
rem = n % (a + b)
ans += min(a, rem)  # ansとremを比較することでnの位置よって処理を変えられる

print(ans)

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

for i in range((n // (a + b)) + 1):
    ans += a * 'b' + b * 'r'

print(ans[:n].count('b'))