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

Fixed submission:
n, *A = map(int, open(0).read().split())
c = [0]*9
for a in A:
  c[min(8, a//400)] += 1

cl = 8-c[:-1].count(0)
cmin = max(1, cl)
cmax = cl+c[8]
print(cmin, cmax)

Buggy submission (verdict: Runtime Error):
n, *A = map(int, open(0).read().split())
c = [0]*9
for a in A:
  c[min(8, a//400)] += 1

cl = 8-c[:-1].count(0)
cmin = max(1, cl)
cmax = min(cl+c[8])
print(cmin, cmax)

Buggy submission (verdict: Runtime Error):
n, *A = map(int, open(0).read().split())
c = [0]*9
for a in A:
  c[min(8, a//400)] += 1

print(8-c[:-1].count(0))
print(c[8])
cl = 8-c[:-1].count(0)
cmin = max(1, cl)
cmax = min(cl+c[8])
print(cmin, cmax)

Buggy submission (verdict: Runtime Error):
n, *A = map(int, open(0).read().split())
c = [0]*9
for a in A:
  c[min(8, a//400)] += 1

print(c)
cmin = max(1, 8-[c::-1].count(0))
cmax = min(8, cmin+c[8])
print(cmin, cmax)
Problem p03734 (python)

Fixed submission:
import sys
input = sys.stdin.readline
N, W = map(int, input().split())
A = [tuple(map(int, input().split())) for _ in [0]*N]
w0 = A[0][0]
A = [(w-w0, v) for w, v in A]

dp = [[0]*(3*N) for _ in [0]*(N+1)]
ans = 0
sumw = 0
for k, (w, v) in enumerate(A):
    for i in range(k, -1, -1):
        for j in range(sumw, -1, -1):
            if 0 <= i < N and 0 <= j+w < 3*N and (i+1)*w0+j+w <= W:
                dp[i+1][j+w] = max(dp[i][j]+v, dp[i+1][j+w])
    sumw += w

for d in dp:
    ans = max(ans, *d)
print(ans)

Buggy submission (verdict: Runtime Error):
# AtCoder Regular Contest 073
# D - Simple Knapsack
# https://atcoder.jp/contests/arc073/tasks/arc073_b
from itertools import combinations_with_replacement, accumulate
N, W, *A = map(int, open(0).read().split())
w0 = A[0]
T = [[] for _ in [0]*4]
M = [0]*4

for w, v in zip(*[iter(A)]*2):
    T[w-w0].append(v)
    M[w-w0] += 1
for t in T:
    t.sort()

acm = [tuple(accumulate(t)) for t in T]


def rec(w=0, k=0, c=()):
    if k == 4:
        C.append(c)
        return
    for i in range(M[k]+1):
        w1 = w + i*(w0+k)
        if w1 > W:
            break
        rec(w1, k+1, (*c, i))


C = []
rec()

ans = 0
for c in C:
    ans = max(ans, sum(acm[i][n-1] if n > 0 else 0 for i, n in enumerate(c)))

print(ans)
Problem p03759 (python)

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

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

Fixed submission:
n = int(input())
print(800*n - 200*(n//15))

Buggy submission (verdict: Runtime Error):
n = int(input())
print(800*n - 200(n//15))
Problem p03796 (python)

Fixed submission:
n = int(input())
 
p = 1
for i in range(2, n+1):
  p = p*i%(10**9+7)
print(p)

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

p = 1
for i in range(2, n+1):
  p = p*i%(10**9+7)
print(p)
Problem p03844 (python)

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

a = int(a)
b = int(b)

if op == "+":
  print(a+b)
else:
  print(a-b)

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

li = [0]*((N+1) >> 1)


def mod(b, x, n):
    acc = b
    for i in range(1, x):
        acc = (acc * b) % n
    return int(acc)


for a in A:
    if li[a >> 1] >= 2:
        print(0)
        break
    else:
        li[a >> 1] += 1

if N & 1:
    if li[0] != 1:
        print(0)
    elif li.count(1) > 1:
        print(0)
    else:
        c = li.count(2)
        print(mod(2, c, 10E9-7))
else:
    if li.count(1) > 0:
        print(0)
    else:
        c = li.count(2)
        print(mod(2, c, 10E9-7))
Problem p03846 (python)

Fixed submission:

def mod_(b, n, mod):
    res = 1
    while n > 0:
        if n & 1:
            res = res * b % mod
        b = b * b % mod
        n >>= 1
    return int(res)

def main():

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

    n = ((N+1) >> 1)
    li = [0]*n



    for a in A:
        li[a >> 1] += 1

    if N & 1:
        if li[0] != 1:
            print(0)
        elif li.count(2) != n-1:
            print(0)
        else:
            c = n-1
            print(2 ** c % (10**9+7))
    else:
        if li.count(2) != n:
            print(0)
        else:
            c = n
            print(2 ** c % (10**9+7))

main()

Buggy submission (verdict: Runtime Error):

def mod_(b, n, mod):
    res = 1
    while n > 0:
        if n & 1:
            res = res * b % mod
        b = b * b % mod
        n >>= 1
    return int(res)

def main():

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

    n = ((N+1) >> 1)
    li = [0]*n



    for a in A:
        if li[a >> 1] >= 2:
            print(0)
            break
        else:
            li[a >> 1] += 1

    if N & 1:
        if li[0] != 1:
            print(0)
        elif li.count(2) != n-1:
            print(0)
        else:
            c = n-1
            print(2 ** c % (1E9+7))
    else:
        if li.count(2) != n:
            print(0)
        else:
            c = n
            print(2 ** c % (1E9+7))

main()

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

li = [0]*((N+1) >> 1)

for a in A:
    if li[a >> 1] >= 2:
        print(0)
        break
    else:
        li[a >> 1] += 1

if N & 1:
    if li[0] != 1:
        print(0)
    elif li.count(1) > 1:
        print(0)
    else:
        c = li.count(2)
        print(int(2**c % (10E9 - 7)))
else:
    if li.count(1) > 0:
        print(0)
    else:
        c = li.count(2)
        print(int(2**c % (10E9 - 7)))
Problem p03854 (python)

Fixed submission:
def main():
  s = input()
  dream = False
  erase = False

  while s:
    if s.startswith('dream'):
      s = s[5:]
      dream = True
      erase = False
    elif s.startswith('erase'):
      s = s[5:]
      dream = False
      erase = True
    elif s.startswith('er') and dream:
      s = s[2:]
      dream = False
    elif s.startswith('r') and erase:
      s = s[1:]
      erase = False
    else:
      return False
  
  return True

if main():
  print('YES')
else:
  print('NO')

Buggy submission (verdict: Runtime Error):
# dfs

C = ['dream', 'dreamer', 'erase', 'eraser']
S = input()
L = len(S)


def dfs(x):
    l = len(x)
    if l >= L:
        if S == x:
            return True
        else:
            return False

    match = S[l:l+7]
    for c in C:
        if match.find(c) == 0:
            if dfs(x+c):
                return True
    return False


print('YES' if dfs('') else 'NO')
Problem p03860 (python)

Fixed submission:
a, s, c = input().split()
print('A'+s[0]+'C')

Buggy submission (verdict: Runtime Error):
A, S, C = input()
print(A+S[0]+C)
Problem p03861 (python)

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

r = b // x - (a-1) // x

print(r)

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

r = 0

for i in xrange(a, b+1):
    if i % x ==0:
        r += 1

print(r)
Problem p03944 (python)

Fixed submission:
import numpy as np

W, H, N = map(int, input().split())

ze = np.ones((W, H))

for i in range(N):
    x, y, a = map(int, input().split())

    if a == 1:
        ze[:x, :] = 0
    elif a == 2:
        ze[x:, :] = 0
    elif a == 3:
        ze[:, :y] = 0
    elif a == 4:
        ze[:, y:] = 0

print(np.sum(ze))

Buggy submission (verdict: Runtime Error):
import numpy as np

W, H, N = map(int, input().split())

ze = np.ones(W+1, H+1)
for i in range(N):
    x, y, a = map(int, input().split())
    
    if a == 1:
        ze[:x, :] = 0
    elif a == 2:
        ze[x+1:, :] = 0
    elif a == 3:
        ze[:, :y] = 0
    elif a == 4:
        ze[:, y+1:] = 0

print(np.sum(ze))

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

for Nimport numpy as np

W, H, N = map(int, input().split())

ze = np.ones(W+1, H+1)
for i in range(N):
    li = [x, y, a = map(int, input().split()) for i in range(N)]
    
    if a == 1:
        ze[:x, :] = 0
    elif a == 2:
        ze[x+1:, :] = 0
    elif a == 3:
        ze[:, :y] = 0
    elif a == 4:
        ze[:, y+1:] = 0

print(np.sum(ze))
Problem p03998 (python)

Fixed submission:
s = open(0).read().split()
x = s[0][0]
s[0] = s[0][1:]
 
while True:
  p = ord(x)-97
  if len(s[p]) == 0:
    print(x.upper())
    break
  x = s[p][0]
  s[p] = s[p][1:]

Buggy submission (verdict: Runtime Error):
s = open(0).read().split()
x = s[0][0]
s[0] = s[0][1:]
 
while True:
  p = ord(x)-97
  if len(s[p] == 0):
    print(x.upper())
    break
  x = s[p][0]
  s[p] = s[p][1:]

Buggy submission (verdict: Runtime Error):
s = open(0).read().split()
x = s[0][0]
s[0] = s[0][1:]
 
while True:
  p = ord(x)-97
  if len(s[p] == 0):
    print(ord(x).upper())
    break
  x = s[p][0]
  s[p] = s[p][1:]

Buggy submission (verdict: Runtime Error):
s = open(0).read().split()
x = s[0][0]
s[0] = s[0][1:]

while True:
  p = ord(x)-97
  if len(s[p] == 0):
    print ord(x).upper()
    break
  x = s[p][0]
  s[p] = s[p][1:]
Problem p04029 (python)

Fixed submission:
n = int(input())

print(int(0.5 * n * (n+1)))

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

res = 1
for i in range(n):
  res *= (i+1)

print(res)

Buggy submission (verdict: Runtime Error):
def kaijo(n):
  res = 1
  for i in range(n):
    res *= i+1
  return res

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

print(kaijo(N))
Problem p04030 (python)

Fixed submission:
s = input()

ans = ''
for i in s:
    if i == 'B':
        ans = ans[:-1]
    else:
        ans += i
print(ans)

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

ans = ''
for i in s:
    if i == 'B':
        ans = ans[:-1]
    else
        ans += i
print(ans)

Buggy submission (verdict: Runtime Error):
s = str(input()).split('')

text = ''

for i in s:
  if i == 'B' and len(text) > 0:
    text = text[:-1]
  else:
    text += i
    
print(text)
Problem p04043 (python)

Fixed submission:
x = 1
for a in input().split():
  x *= int(a)
if x == 175:
  print('YES')
else:
  print('NO')

Buggy submission (verdict: Runtime Error):
a = 1
a*= a for a in input().split()
Problem p03433 (python)

Fixed submission:
n=int(input())
a=int(input())
if n%500<=a:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n=int(input())
a=int(input())
if n%a<=a:
    print("Yes")
else:
    print("No")
Problem p03547 (python)

Fixed submission:
x,y=input().split()
print('<' if x<y else ('=' if x==y else '>'))

Buggy submission (verdict: Runtime Error):
x,y=input().split()
print('<' if x<y else if x==y '=' else '>')
Problem p03555 (python)

Fixed submission:
a=input()
b=input()
if(a[0]==b[2] and a[1]==b[1] and a[2]==b[0]):
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
a=input()
b=input()
if(a[0]==b[2] and a[1]==b[1] and a[2]=b[0]):
    print("YES")
else:
    print("NO")
Problem p02783 (python)

Fixed submission:
H, A = map(int, input().split())
if H%A == 0:
    ans = int(H/A)
    print(ans)
else:
    ans = int(H/A) + 1
    print(ans)

Buggy submission (verdict: Runtime Error):
H = int(input())
A = int(input())
 
if H%A == 0:
    ans = int(H/A)
    print(ans)
else:
    ans = int(H/A) + 1
    print(ans)

Buggy submission (verdict: Runtime Error):
H = input()
A = input()

if H%A == 0:
  print(H/A)
else:
  print(H/A + 1)

Buggy submission (verdict: Runtime Error):
H = input()
A = input()

if H%A == 0:
  return H/A
else:
  return H/A + 1
Problem p02536 (python)

Fixed submission:
import sys
sys.setrecursionlimit(100002)

input = lambda : sys.stdin.readline().rstrip()


def main(a_s, b_s, n, m):
    graph = {}
    for node in range(1, n+1):
        graph[node] = []

    for i in range(m):
        a, b = a_s[i], b_s[i]
        graph[a].append(b)
        graph[b].append(a)

    uses = [False] * (n+1)

    def check(node):
        uses[node] = True
        kids = graph[node]
        for kid in kids:
            if not uses[kid]:
                check(kid)

    next_graph_i = 1
    for node in range(1, n+1):
        if uses[node]:
            continue
        graph_i = next_graph_i
        check(node)
        next_graph_i = graph_i + 1

    out = graph_i - 1
    print(out)

if True:
    n, m = map(int, input().split(" "))
    a_s = []
    b_s = []
    for i in range(m):
        a, b = map(int, input().split(" "))
        a_s.append(a)
        b_s.append(b)
else:
    import random
    n = random.randint(2, 100000)
    m = random.randint(1, 100000)
    
    a_s = []
    b_s = []
    for i in range(m):    
        a = random.randint(1, n-1)
        b = random.randint(a+1, n)
        a_s.append(a)
        b_s.append(b)

main(a_s, b_s, n, m)

Buggy submission (verdict: Runtime Error):
import sys
input = lambda : sys.stdin.readline().rstrip()

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

graph = {}
for node in range(1, n+1):
    graph[node] = []

for i in range(m):
    a, b = map(int, input().split(" "))
    graph[a].append(b)
    graph[b].append(a)

uses = [False] * (n+1)

def check(node):
    uses[node] = True
    kids = graph[node]
    for kid in kids:
        if not uses[kid]:
            check(kid)

next_graph_i = 1
for node in range(1, n+1):
    graph_i = next_graph_i
    if uses[node]:
        continue
    check(node)
    next_graph_i = graph_i + 1

out = graph_i - 1
print(out)
Problem p02845 (python)

Fixed submission:
n = int(input())
vals = map(int, input().split(" "))
cur_vals = [-1, -1, -1]

M = 1000000007
out = 1
for val in vals:
    before_val = val-1
    before_val_num = sum([1 for cur_val in cur_vals if cur_val == before_val])
    if before_val_num == 0:
        out = 0
        break
    out = (out * before_val_num) % M
    tar_i = cur_vals.index(before_val)
    cur_vals[tar_i] = val

print(out)

Buggy submission (verdict: Runtime Error):
n = int(input())
vals = map(int, input().split(" "))
cur_vals = [-1, -1, -1]

M = 1000000007
out = 1
for val in vals:
    before_val = val-1
    before_val_num = sum([1 for cur_val in cur_vals if cur_val == before_val])
    out = (out * before_val_num) % M
    tar_i = cur_vals.index(before_val)
    cur_vals[tar_i] = val

print(out)
Problem p02854 (python)

Fixed submission:
#import math

#input = raw_input
n = int(input())

As = list(map(int, input().split(" ")))
sA = sum(As)
#half_sA= sA // 2 if sA % 2 == 0 else (sA // 2) + 1
half_sA = sA // 2

cur_val = 0
for i, a in enumerate(As):
    cur_val += a
    if half_sA <= cur_val:
        over_i = i # made
        break

cur_val2 = cur_val
cur_val1 = cur_val - a

#print(cur_val1, half_sA, cur_val2)
diff1 = half_sA - cur_val1
diff2 = cur_val2 - half_sA

val_a = cur_val1
val_b = sA - val_a

val_c = cur_val2
val_d = sA - val_c

out = min( abs(val_b-val_a), abs(val_c-val_d) )

#if diff1 <= diff2:
#    #half_sA = int(math.floor(half_sA))
#    out = diff1
#else:
#    out = diff2
print(out)

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

input = raw_input
n = int(input())

as = list(map(int, input().split(" ")))
sa = sum(as)
#half_sa= sa // 2 if sa % 2 == 0 else (sa // 2) + 1
half_sa = sa // 2

cur_val = 0
for i, a in enumerate(as):
    cur_val += a
    if half_sa <= cur_val:
        over_i = i # made
        break

cur_val2 = cur_val
cur_val1 = cur_val - a

#print(cur_val1, half_sa, cur_val2)
diff1 = half_sa - cur_val1
diff2 = cur_val2 - half_sa

val_a = cur_val1
val_b = sa - val_a

val_c = cur_val2
val_d = sa - val_c

out = min(val_b-val_a, val_c - val_d)

#if diff1 <= diff2:
#    #half_sa = int(math.floor(half_sa))
#    out = diff1
#else:
#    out = diff2
print(out)
Problem p02945 (python)

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

l = [x+y, x-y, x*y]
print(max(l))

Buggy submission (verdict: Runtime Error):
input = raw_input
#import numpy as np

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

values = [[] for i in range(M+1)]
for i in range(N):
    A, B = map(int, input().split())
    if M >= A:
        values[A].append(B)

#print(values)
out = 0
elms = []
for i in range(1, M+1):
    new_elms = sorted(values[i], reverse=True)[:M-i+1]
    elms += new_elms
    if len(elms) >= 1:
        max_val = max(elms)
        out += max_val
        elms.remove(max_val)

print(out)
Problem p03043 (python)

Fixed submission:
import math

N, K = [int(elm) for elm in input().split(" ")] 

K2 = math.log2(K)

out = sum([ (0.5) ** int(math.ceil(K2 - math.log2(me))) if me < K else 1 for me in range(1, N+1)]) / N

print(out)

Buggy submission (verdict: Runtime Error):
#input = raw_input

res = None
G = None

def dfs(jibun_v, p, jibun_c):
    global res
    global G

    res[jibun_v] = jibun_c
    #print(jibun_v, p, jibun_c)

    tonari_nodes = G[jibun_v]
    for tonari_v, w in tonari_nodes:
        #if tonari_v == p or res[tonari_v] != -1:
        if tonari_v == p or res[tonari_v] != -1:
            continue

        if w % 2 == 0:
            tonari_c = jibun_c
        else:
            tonari_c = 1 - jibun_c

        dfs(tonari_v, jibun_v, tonari_c)
    

def main():
    N= int(input())

    global G
    G = [[] for _ in range(N)]

    for i in range(N-1):
        u, v, w = map(int, input().split(" "))
        u -= 1
        v -= 1
        w = w % 2
        G[u].append([v, w])
        G[v].append([u, w])

    global res
    res = [-1 for _ in range(N)]
    
    jibun_v = 0
    p = -1
    jibun_c = 0
    dfs(jibun_v, p, jibun_c)

    for i in range(N):
        print(res[i])

main()

Buggy submission (verdict: Runtime Error):
#input = raw_input

res = None
G = None

def dfs(jibun_v, p, jibun_c):
    global res
    global G

    res[jibun_v] = jibun_c
    #print(jibun_v, p, jibun_c)

    tonari_nodes = G[jibun_v]
    for tonari_v, w in tonari_nodes:
        #if tonari_v == p or res[tonari_v] != -1:
        if tonari_v == p or res[tonari_v] != -1:
            continue

        if w % 2 == 0:
            tonari_c = jibun_c
        else:
            tonari_c = 1 - jibun_c

        dfs(tonari_v, jibun_v, tonari_c)
    

def main():
    N= int(input())

    global G
    G = [[] for _ in range(N)]

    for i in range(N-1):
        u, v, w = map(int, input().split(" "))
        u -= 1
        v -= 1
        w = w % 2
        G[u].append([v, w])
        G[v].append([u, w])

    global res
    res = [-1 for _ in range(N)]
    
    jibun_v = 0
    p = -1
    jibun_c = 0
    dfs(jibun_v, p, jibun_c)

    for i in range(N):
        print(res[i])

main()
Problem p03069 (python)

Fixed submission:
N = int(input())
S = input()

penals1 = []
tmp1 = 0
penals2 = []
tmp2 = 0

# 半分まで準備
N_even = (N % 2 == 0)
half_N = N // 2 if N_even else (N-1) // 2 

if N == 1:
    min_val = 0
else:
    for i in range(half_N):
        if S[i] == "#":
            tmp1 += 1
        penals1.append(tmp1)

        if S[N-1-i] == ".":
            tmp2 += 1
        penals2.append(tmp2)

    if N_even:
        min_val = penals1[half_N-1] + penals2[half_N-1] 

        j = 1
        for i in range(half_N, N):
            if S[i] == "#":
                tmp1 += 1
            #penals1.append(tmp1)
            val1 = tmp1 + penals2[half_N-1-j]

            if S[N-1-i] == ".":
                tmp2 += 1
            #penals2.append(tmp2)
            val2 = penals1[half_N-1-j] + tmp2

            min_val = min(min_val, val1, val2)
            j += 1

    else:
        first = True
        j = 0

        # N = (N-1) // 2 + (N-1) // 2 + 1
        for i in range(half_N, N):
            if S[i] == "#":
                tmp1 += 1
            val1 = tmp1 + penals2[half_N-1-j]

            if S[N-1-i] == ".":
                tmp2 += 1
            val2 = penals1[half_N-1-j] + tmp2

            if first:
                min_val = min(val1, val2)
                first = False
            else:
                min_val = min(min_val, val1, val2)
            j += 1

    if S[N-1] == "#":
        tmp1 += 1
    if S[0] == ".":
        tmp2 += 1

    min_val = min(tmp1, tmp2, min_val)
print(min_val)

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

penals1 = []
tmp1 = 0
for s in S:
    if s == "#":
        tmp1 += 1
    penals1.append(tmp1)


penals2 = []
tmp2 = 0
for s in reversed(S):
    if s == ".":
        tmp2 += 1
    penals2.insert(0, tmp2)

#print(len(penals2))
#penals = [penals2[0]] + [penals1[i] + penals2[i+1] for i in range(1, N-1)] + [penals1[N-1]]

#min_val = min(penals)

min_val1 = min(penals2[0], penals1[N-1])
min_val2 = min([penals1[i] + penals2[i+1] for i in range(1, N-1)])
    
out = min(min_val1, min_val2)
print(out)
Problem p03076 (python)

Fixed submission:

times = []
#for num in ins:
tmp = []
for _ in range(5):
    num = int(input())
    if num % 10 == 0:
        time = num
    else:
        time = num - num % 10 + 10
    times.append(time)
    tm = num % 10
    if tm >= 1:
        tmp.append(tm)
    #print(num)

if len(tmp) == 0:
    tmp = [0]

yobun = min(tmp)
if yobun == 0:
    yobun = 10

all_time = sum(times) - (10-yobun)
print(all_time)

Buggy submission (verdict: Runtime Error):
#import numpy as np
#ins = [int(input()) for _ in range(5)] 

times = []
#for num in ins:
tmp = []
for _ in range(5):
    num = int(input())
    if num % 10 == 0:
        time = num
    else:
        time = num - num % 10 + 10
    times.append(time)
    tm = num % 10
    if tm >= 1:
        tmp.append(tm)
    #print(num)
    yobun = min(tmp)

#tmp = np.asarray(ins) % 10
#tmp = tmp[tmp >= 1]
#yobun = np.min(tmp)

if yobun == 0:
    yobun = 10

all_time = sum(times) - (10-yobun)
print(all_time)

Buggy submission (verdict: Runtime Error):
import numpy as np
ins = [int(input()) for _ in range(5)] 

times = []
for num in ins:
    if num % 10 == 0:
        time = num
    else:
        time = num - num % 10 + 10
    times.append(time)
    #print(num)

tmp = np.asarray(ins) % 10
tmp = tmp[tmp >= 1]
yobun = np.min(tmp)

if yobun == 0:
    yobun = 10

all_time = np.sum(times) - (10-yobun)
print(all_time)
Problem p03105 (python)

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

n = B // A
out = min(n, C)
print(out)

Buggy submission (verdict: Runtime Error):
N, M = [int(elm) for elm in input().split(" ")]
bridges = [[int(elm) for elm in input().split(" ")] for _ in range(M)]

#graph = {}
#for node in range(1, N+1):
#    graph[node] = [node]
#    #graph_mem[node] = []

#graph_n_mem = [0] + [1 for i in range(N)]
graph_n_mem = [0] + [1] * N
n_all_pairs = N * (N-1) // 2

parent = [-1] * (N+1)

#def get_parent(child_node, tmp_nodes=[]):
def get_parent(child_node):
    parent_node = parent[child_node]

    if parent_node != -1:
        #tmp_nodes.append(child_node)
        #out = get_parent(parent_node, tmp_nodes)
        out = get_parent(parent_node)
    else:
        out = child_node
        #if len(tmp_nodes) >= 1:
        #    tmp_nodes = tmp_nodes[:-1]
        #    for tmp_node in tmp_nodes:
        #        parent[tmp_node] = out
    return out


outs = []
out = n_all_pairs
for A, B in reversed(bridges):
    #A = graph[A][0]
    #B = graph[B][0]

    A = get_parent(A)
    B = get_parent(B)

    if A != B:
        n_b = graph_n_mem[B]
        n_a = graph_n_mem[A]
        graph_n_mem[A] += graph_n_mem[B]
        graph_n_mem[B] = 0

        parent[B] = A

        #old_graph_B = graph[B]
        #graph[A] += graph[B]
        #for node in old_graph_B:
        #    graph[node] = graph[A]
        
        out -= n_a * n_b

    outs.append(out)

outs = outs[::-1]
outs = outs[1:] + [n_all_pairs]
for out in outs:
    print(out)

Buggy submission (verdict: Runtime Error):
N, M = [int(elm) for elm in input().split(" ")]
bridges = [[int(elm) for elm in input().split(" ")] for _ in range(M)]

class Graph:
    pass

graph = {}
for node in range(1, N+1):
    graph[node] = [node]
    #graph_mem[node] = []

graph_n_mem = [0] + [1 for i in range(N)]
n_all_pairs = N * (N-1) // 2

#def delete_graph(B):
#    pass

def calc_out(n_list):
    out = n_all_pairs
    for elm in n_list:
        if elm <= 1:
            continue
        tmp = elm * (elm-1) // 2
        out -= tmp
    return out

outs = []
for A, B in reversed(bridges):
    #print(graph_n_mem)
    #print("before AB", A, B)
    A = graph[A][0]
    B = graph[B][0]
    #print(graph_n_mem, "AB", A, B)
    if graph[A] != graph[B]:
        #graph_n_mem[A] += len(graph[B])
        graph_n_mem[A] += graph_n_mem[B]
        graph_n_mem[B] = 0

        graph[A] += graph[B]
        for node in graph[A]:
            graph[node] = graph[A]
            
        #graph_mem[A] += graph_mem[B]
        

    out = calc_out(graph_n_mem)
    outs.append(out)

outs = outs[::-1]
outs = outs[1:] + [n_all_pairs]
for out in outs:
    print(out)