Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
def dfs():
    n = int(input())
    weight = list(map(int, input().split()))
    value = list(map(int, input().split()))
    
    
    def knapsack(n, weight, value):
        dp = [i for i in range(n+1)]
        for i in range(3):
            for j in range(weight[i], n+1):
                dp[j] = max(dp[j], dp[j-weight[i]] + value[i])
        return(dp[-1])
    
    
    new_n=knapsack(n=n, weight=weight, value=value)
    print(knapsack(n=new_n, weight=value, value=weight))
 
    
dfs()

Fixed submission:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from functools import reduce


sys.setrecursionlimit(2147483647)
INF = 10 ** 18
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 998244353



n, k = LI()
if k == 1:
    print(0)
else:
    print(n - k)

Buggy python submission (verdict: Runtime Error):
def dfs():
    n = int(input())
    weight = list(map(int, input().split()))
    value = list(map(int, input().split()))

    dp = [i for i in range(n+1)]

    for i in range(3):
        for j in range(weight[i], n+1):
            max(dp[j], dp[j-weight[i]] + value[i])
    return (dp[-1])
  
  
  dfs()

Fixed submission:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from functools import reduce


sys.setrecursionlimit(2147483647)
INF = 10 ** 18
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 998244353



n, k = LI()
if k == 1:
    print(0)
else:
    print(n - k)
Buggy python submission (verdict: Time Limit Exceeded):
def dfs():
    n = int(input())
    weight = list(map(int, input().split()))
    value = list(map(int, input().split()))
    
    
    def knapsack(n, weight, value):
        dp = [i for i in range(n+1)]
        for i in range(3):
            for j in range(weight[i], n+1):
                dp[j] = max(dp[j], dp[j-weight[i]] + value[i])
        return(dp[-1])
    
    
    new_n=knapsack(n=n, weight=weight, value=value)
    print(knapsack(n=new_n, weight=value, value=weight))

    
dfs()

Fixed submission:
def dfs():
    n = int(input())
    weight = list(map(int, input().split()))
    value = list(map(int, input().split()))
    
    
    def knapsack(n, weight, value):
        dp = [i for i in range(n+1)]
        for i in range(3):
            for j in range(weight[i], n+1):
                dp[j] = max(dp[j], dp[j-weight[i]] + value[i])
        return(dp[-1])
    
    
    new_n=knapsack(n=n, weight=weight, value=value)
    print(knapsack(n=new_n, weight=value, value=weight))
 
    
dfs()
Buggy python submission (verdict: Runtime Error):
# ABC129C - Typical Stairs
import sys
input = sys.stdin.readline
 
def main():
    N, M = tuple(map(int, input().split()))
    A = set(map(int, [input() for _ in range(M)]))
    MOD = 10 ** 9 + 7
    dp = [0] * (N + 1)
    dp[:2] = 1, 1 if 1 not in A else 0
    for i in range(2, N + 1):
        if i in A:
            continue
        else:
            dp[i] = (dp[i - 1] + dp[i - 2]) % MOD
    print(dp[-1])
 
 
if __name__ == "__main__":
    main()

Fixed submission:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations
import sys
import string


INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LIM(): return list(map(lambda x:int(x) - 1, sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def LIRM(n): return [LIM() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
mod = 1000000007


a, b, c = LI()
print(min([i + j for i, j in list(combinations([a, b, c], 2))]))
Buggy python submission (verdict: Time Limit Exceeded):
n, m = list(map(int, input().split()))
broken = []
for i in range(m):
    broken.append(int(input()))
MOD = 10 ** 9 + 7
dp = [0] * (n+1)
dp[0] = 1
if 1 not in broken:
    dp[1] = 1
for i in range(2, n+1):
    if i not in broken:
        dp[i] = (dp[i-1] + dp[i-2])%MOD

print(dp[-1])

Fixed submission:
# ABC129C - Typical Stairs
import sys
input = sys.stdin.readline
 
def main():
    N, M = tuple(map(int, input().split()))
    A = set(map(int, [input() for _ in range(M)]))
    MOD = 10 ** 9 + 7
    dp = [0] * (N + 1)
    dp[:2] = 1, 1 if 1 not in A else 0
    for i in range(2, N + 1):
        if i in A:
            continue
        else:
            dp[i] = (dp[i - 1] + dp[i - 2]) % MOD
    print(dp[-1])
 
 
if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
n, k = list(map(int, input().split()))
que = list(map(int, input().split()))
ans = 0
pop_push = [(i, k-i) for i in range(k, math.ceil(k/2)-1, -1)]
for pop, push in pop_push:
    left_right = [(j, pop-j) for j in range(pop+1)]
    for left, right in left_right:
        ans = max(ans, sum(sorted(que[:left] + list(reversed(que))[:right])[push:]))
print(ans)

Fixed submission:
import math


n, k = list(map(int, input().split()))
que = list(map(int, input().split()))

ans = 0
max_pop_cnt = min(n, k)
for pop_cnt in range(max_pop_cnt+1):
#  pop_cnt+1にしないと、pop_cntが0の場合は消えてしまう。
    for right in range(pop_cnt+1):
        for push_cnt in range((k - pop_cnt)+1):
            ans = max(ans, sum(sorted(que[:pop_cnt-right] + list(reversed(que))[:right])[push_cnt:]))
# reverseにした方がいい。-1で後ろからスライスをとると、0の場合に全部になってしまう。
print(ans)
Buggy python submission (verdict: Runtime Error):
n, k = list(map(int, input().split()))
min_list = []
max_list = []
for i in range(k):
    j, l = list(map(int, input().split())):
    min_list.append(j)
    max_list.append(l)


print(max(0, min(max_list) - max(min_list) + 1))

Fixed submission:
n, k = list(map(int, input().split()))
min_list = []
max_list = []
for i in range(k):
    j, l = list(map(int, input().split()))
    min_list.append(j)
    max_list.append(l)


print(max(0, min(max_list) - max(min_list) + 1))
Buggy python submission (verdict: Runtime Error):
def main():
    n, k = map(int, input().split())
    s = input()


    cnt = 0
    right = 0
    flag = 0
    j = k + 1 if s[0] == '1' else k
    if len(s) == 1:
        if k == 0 and s[0] == '0':
            return 0
        flag = 1
    for i in range(n - 1):
        if i + 1 >= n:
            flag = 1
            break
        if s[i]  == '1' and s[i + 1] == '0':
            cnt += 1
        if cnt == j:
            right = i + 1
            break


    if flag:
        return n


    left = 0
    ret = right - left
    flag = 0

    while True:
        while True:
            if right + 1 >= n:
                flag = 1
                break
            if s[right] == '1' and s[right + 1] == '0':
                right += 1
                break
            right += 1
        while True:
            if s[left] == '0' and s[left + 1] == '1':
                left += 1
                break
            left += 1
        if flag:
            right += 1
        ret = max(ret, right - left)
        if flag:
            break
    return ret


print(main())

Fixed submission:
def main():
    n, k = map(int, input().split())
    s = input()


    cnt = 0
    right = 0
    flag = 1
    j = k + 1 if s[0] == '1' else k
    for i in range(n - 1):
        if s[i]  == '1' and s[i + 1] == '0':
            cnt += 1
        if cnt == j:
            right = i + 1
            flag = 0
            break


    if flag:
        return n


    left = 0
    ret = right - left
    flag = 0

    while True:
        while True:
            if right + 1 >= n:
                flag = 1
                break
            if s[right] == '1' and s[right + 1] == '0':
                right += 1
                break
            right += 1
        while True:
            if s[left] == '0' and s[left + 1] == '1':
                left += 1
                break
            left += 1
        if flag:
            right += 1
        ret = max(ret, right - left)
        if flag:
            break
    return ret


print(main())
Buggy python submission (verdict: Runtime Error):
import heapq


x, y, z, k = map(int, input().split())
x_cake = [-float('inf')] + sorted(map(int, input().split()))
y_cake = [-float('inf')] + sorted(map(int, input().split()))
z_cake = [-float('inf')] + sorted(map(int, input().split()))


index_set = set()
x_index = y_index = z_index = -1
que = []
cnt = 0
print(x_cake[-1] + y_cake[-1] + z_cake[-1])
while True:
    heapq.heappush(que, (-(x_cake[x_index-1] + y_cake[y_index] + z_cake[z_index]), (x_index-1, y_index, z_index)))
    heapq.heappush(que, (-(x_cake[x_index] + y_cake[y_index-1] + z_cake[z_index]), (x_index, y_index-1, z_index)))
    heapq.heappush(que, (-(x_cake[x_index] + y_cake[y_index] + z_cake[z_index-1]), (x_index, y_index, z_index-1)))
    popped_tuple = heapq.heappop(que)
    x_index, y_index, z_index = popped_tuple[1]
    if (x_index, y_index, z_index) not in index_set:
        index_set.add((x_index, y_index, z_index))
        cnt += 1
        print(-popped_tuple[0])
        if cnt == k-1:
            break

Fixed submission:
import heapq


x, y, z, k = map(int, input().split())
x_cake = [-float('inf')] + sorted(map(int, input().split()))
y_cake = [-float('inf')] + sorted(map(int, input().split()))
z_cake = [-float('inf')] + sorted(map(int, input().split()))


index_set = set()
x_index = y_index = z_index = -1
que = []
heapq.heappush(que, (-(x_cake[-1] + y_cake[-1] + z_cake[-1]), (-1, -1, -1)))
index_set.add((-1, -1, -1))
for _ in range(k):
    popped_tuple = heapq.heappop(que)
    print(-popped_tuple[0])
    x_index, y_index, z_index = popped_tuple[1]
    if (x_index-1, y_index, z_index) not in index_set:
        heapq.heappush(que, (-(x_cake[x_index-1] + y_cake[y_index] + z_cake[z_index]), (x_index-1, y_index, z_index)))
        index_set.add((x_index-1, y_index, z_index))
    if (x_index, y_index-1, z_index) not in index_set:
        heapq.heappush(que, (-(x_cake[x_index] + y_cake[y_index-1] + z_cake[z_index]), (x_index, y_index-1, z_index)))
        index_set.add((x_index, y_index-1, z_index))
    if (x_index, y_index, z_index-1) not in index_set:
        heapq.heappush(que, (-(x_cake[x_index] + y_cake[y_index] + z_cake[z_index-1]), (x_index, y_index, z_index-1)))
        index_set.add((x_index, y_index, z_index-1))
Buggy python submission (verdict: Time Limit Exceeded):
mod = 10 **9 + 7



n = int(input())
match_list = []
for i in range(n):
    match_list.append(list(map(int, input().split())))
    
    
c = [0]
for i in range(n):
    c += [j+1 for j in c]


dp = [0] * (1 << n)
dp[0] = 1
for i in range((1 << n)-1):
    for j in range(n):
        if match_list[c[i]][j]:
            dp[(1<<j)^i] = (dp[(1<<j)^i] + dp[i])%mod


print(dp[-1])

Fixed submission:
mod = 10 ** 9 + 7

n = int(input())

A = []
for i in range(n):
    A.append(list(map(int, input().split())))


memo = [-1] * (1<<n)
memo[0] = 1


def dfs(state, c):
    if memo[state] != -1:
        return memo[state]
    r = 0
    for i in range(n):
        if state & (1<<i) and A[c][i]:
            r += dfs(state ^ (1<<i), c+1)
            r %= mod
    memo[state] = r
    return r


print(dfs((1<<n)-1, 0))

Buggy python submission (verdict: Time Limit Exceeded):
mod = 10 ** 9 + 7

n = int(input())

A = []
for i in range(n):
    A.append(list(map(int, input().split())))


memo = [-1] * (1<<n)
memo[0] = 1


def dfs(state, c):
    if memo[state] != -1:
        return memo[state]
    r = 0
    for i in range(n):
        if state & (1<<i) and A[c][i]:
            r += dfs(state ^ (1<<i), c+1)
            r %= mod
    memo[state] = r
    return r


print(dfs((1<<n)-1, 0))

Fixed submission:
mod = 10 ** 9 + 7

n = int(input())

A = []
for i in range(n):
    A.append(list(map(int, input().split())))


memo = [-1] * (1<<n)
memo[0] = 1


def dfs(state, c):
    if memo[state] != -1:
        return memo[state]
    r = 0
    for i in range(n):
        if state & (1<<i) and A[c][i]:
            r += dfs(state ^ (1<<i), c+1)
            r %= mod
    memo[state] = r
    return r


print(dfs((1<<n)-1, 0))
Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from bisect import bisect_right, bisect_left
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, gamma, log
from operator import mul
from functools import reduce
from copy import deepcopy

sys.setrecursionlimit(2147483647)
INF = 10 ** 20
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): pass
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 10 ** 9 + 7

n = I()
G = [[] for _ in range(n)]
for _ in range(n - 1):
    x, y = LI()
    G[x - 1] += [y - 1]
    G[y - 1] += [x - 1]


par = [-1] * n
def f(u):
    b, w = 1, 1
    for v in G[u]:
        if v == par[u]:
            continue
        par[v] = u
        cb, cw = f(v)
        b = b * cw % mod
        w = w * (cw + cb)
    return b, w

bb, ww = f(0)
print((bb + ww) % mod)

Fixed submission:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from bisect import bisect_right, bisect_left
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, gamma, log
from operator import mul
from functools import reduce
from copy import deepcopy

sys.setrecursionlimit(2147483647)
INF = 10 ** 20
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): pass
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 10 ** 9 + 7

n = I()
G = [[] for _ in range(n)]
for _ in range(n - 1):
    x, y = LI()
    G[x - 1] += [y - 1]
    G[y - 1] += [x - 1]


par = [-1] * n
def f(u):
    b, w = 1, 1
    for v in G[u]:
        if v == par[u]:
            continue
        par[v] = u
        cb, cw = f(v)
        b = b * cw % mod
        w = w * (cw + cb)
    return b, w

bb, ww = f(0)
print((bb + ww) % mod)
Buggy python submission (verdict: Runtime Error):
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial


INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LIM(): return list(map(lambda x:int(x) - 1, sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def LIRM(n): return [LIM() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
mod = 1000000007


n, m = LI()
L = LIR(m)
for i in range(m):
    L[i] = [i, f'{L[i][0]:0>6}', L[i][1]]


L.sort(key=lambda x:x[1:])
cnt = 1
L[0][2] = f'{1:0>6}'
for i in range(1, m):
    if L[i][1] != L[i-1][1]:
        cnt = 1
    else:
        cnt += 1
    L[i][2] = f'{cnt:0>6}'



L.sort(key=lambda x:x[0])
for i in L:
    print(i[1] + i[2])

Fixed submission:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial


INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LIM(): return list(map(lambda x:int(x) - 1, sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def LIRM(n): return [LIM() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
mod = 1000000007


n, m = LI()
L = LIR(m)
for i in range(m):
    L[i] = [i, str(L[i][0]).zfill(6), L[i][1]]


L.sort(key=lambda x:x[1:])
cnt = 1
L[0][2] = str(1).zfill(6)
for i in range(1, m):
    if L[i][1] != L[i-1][1]:
        cnt = 1
    else:
        cnt += 1
    L[i][2] = str(cnt).zfill(6)



L.sort(key=lambda x:x[0])
for i in L:
    print(i[1] + i[2])
Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict, deque
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate
import sys


def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LIM(): return list(map(lambda x:int(x) - 1, sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def LIRM(n): return [LIM() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
mod = 1000000007


n = I()
num = LI()
cnt = 0
for i in range(n):
    ret = 0
    for j in range(i, n):
        if ret & num[j] == 0:
            ret ^= num[j]
            cnt += 1
        else:
            break


print(cnt)

Fixed submission:
from collections import defaultdict, deque
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate
import sys


def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LIM(): return list(map(lambda x:int(x) - 1, sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def LIRM(n): return [LIM() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
mod = 1000000007


n = I()
num = LI()
ans = n
l = 0
r = 0
cnt = 0
ret = num[0]
while r < n-1:
    if ret & num[r+1] == 0:
        ret ^= num[r+1]
        cnt += 1
        r += 1
        ans += cnt
    elif l == r:
        l +=1; r += 1;
        ret = num[l]
    else:
        ret ^= num[l]
        cnt -= 1
        l += 1



print(ans)
Buggy python submission (verdict: Runtime Error):
from heapq import heappop, heappush
import numpy as np



def dijkstra(graph, n, vst=0):
    distance = [float('inf')] * n
    distance[vst] = 0
    checked_v = [0] * n
    route = [''] * 10
    route[vst] = str(vst)
    dist = [float('inf')] * n
    dist[vst] = 0
    q = []
    heappush(q, (0, vst))
    for _ in range(n):
        while True:
            min_dist, search_v = heappop(q)
            if checked_v[search_v] == 0:
                break
        checked_v[search_v] = 1
        for to_v in range(n):
            if checked_v[to_v] == 0:
                cost = graph[search_v][to_v]
                if dist[search_v] + cost < dist[to_v]:
                    dist[to_v] = dist[search_v] + cost
                    route[to_v] = route[search_v] + str(to_v)
                    heappush(q, (dist[to_v], to_v))
    return dist


h, w = map(int, input().split())
graph = np.array([np.array(list(map(int, input().split()))) for _ in range(10)])
graph = np.transpose(graph)
dist = dijkstra(graph, 10, vst=1)


wall_num = []
for i in range(h):
    wall_num += list(map(int, input().split()))



ret = 0
for num in wall_num:
    if num != -1:
        ret += dist[num]


print(ret)

Fixed submission:
from heapq import heappop, heappush
import numpy as np



def dijkstra(graph, n, vst=0):
    distance = [float('inf')] * n
    distance[vst] = 0
    checked_v = [0] * n
    route = [''] * 10
    route[vst] = str(vst)
    dist = [float('inf')] * n
    dist[vst] = 0
    q = []
    heappush(q, (0, vst))
    for _ in range(n):
        while True:
            min_dist, search_v = heappop(q)
            if checked_v[search_v] == 0:
                break
        checked_v[search_v] = 1
        for to_v in range(n):
            if checked_v[to_v] == 0:
                cost = graph[search_v][to_v]
                if dist[search_v] + cost < dist[to_v]:
                    dist[to_v] = dist[search_v] + cost
                    route[to_v] = route[search_v] + str(to_v)
                    heappush(q, (dist[to_v], to_v))
    return dist


h, w = map(int, input().split())
graph = np.array([np.array(list(map(int, input().split()))) for _ in range(10)])
graph = np.transpose(graph)
dist = dijkstra(graph, 10, vst=1)


wall_num = []
for i in range(h):
    wall_num += list(map(int, input().split()))



ret = 0
for num in wall_num:
    if num != -1:
        ret += dist[num]


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

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