Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int,input().split())
li = list(int(input()) for i in range(n))

li.sort()
num = 0
li2,li3 = [],[]
for i in range(len(li)-k+1):
    li2.append(li[i:i+k])

for i in range(len(li2)):
    li3.append(max(li2[i]) - min(li2[i]))
print(min(li3))

Fixed submission:
n, k = map(int,input().split())
li = list(int(input()) for i in range(n))

li.sort()
num = 0
li2 = []
for i in range(len(li)-k+1):
    li2.append(li[i+k-1] - li[i])

print(min(li2))

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int,input().split())
li = list(int(input()) for i in range(n))

li.sort()
num = 0
li2 = []
for i in range(len(li)-k+1):
    li2.append( max(li[i:i+k]) - min(li[i:i+k]))

print(min(li2))

Fixed submission:
n, k = map(int,input().split())
li = list(int(input()) for i in range(n))

li.sort()
num = 0
li2 = []
for i in range(len(li)-k+1):
    li2.append(li[i+k-1] - li[i])

print(min(li2))

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int,input().split())
li = list(int(input()) for i in range(n))

li.sort()
num = 0
li2,li3 = [],[]
for i in range(len(li)-k+1):
    li2.append(li[i:i+k])

for i in range(len(li2)):
    li3.append(max(li2[i]) - min(li2[i]))
print(min(li3))

Fixed submission:
n, k = map(int,input().split())
li = list(int(input()) for i in range(n))

li.sort()
num = 0
li2 = []
for i in range(len(li)-k+1):
    li2.append(li[i+k-1] - li[i])

print(min(li2))
Buggy python submission (verdict: Runtime Error):
from copy import deepcopy

n,*a = map(int,open(0).read().split())
acopy = deepcopy(a)
a.sort()
acopy.sort(reverse = True)

L = deque([])
a = deque(a)
acopy = deque(acopy)
Lcopy = deepcopy(L)

max_ = a.pop()
L.append(max_)
min_ = acopy.pop()
Lcopy.append(min_)

while a:
    if a:
        b = a.popleft()
        L.append(b)
    if a:
        c = a.popleft()
        L.appendleft(c)
    if a:
        d = a.pop()
        L.append(d)
    if a:
        e = a.pop()
        L.appendleft(e)

while acopy:
    if acopy:
        b = acopy.popleft()
        Lcopy.append(b)
    if acopy:
        c = acopy.popleft()
        Lcopy.appendleft(c)
    if acopy:
        d = acopy.pop()
        Lcopy.append(d)
    if acopy:
        e = acopy.pop()
        Lcopy.appendleft(e)
ans1,ans2 = 0,0
#print(L,Lcopy)
for i in range(len(L)-1):
    ans1 +=abs(L[i+1] - L[i])
for i in range(len(Lcopy)-1):
    ans2 +=abs(Lcopy[i+1] - Lcopy[i])
print(max(ans1,ans2))

Fixed submission:
from collections import deque
from copy import deepcopy

n,*a = map(int,open(0).read().split())
acopy = deepcopy(a)
a.sort()
acopy.sort(reverse = True)

L = deque([])
a = deque(a)
acopy = deque(acopy)
Lcopy = deepcopy(L)

max_ = a.pop()
L.append(max_)
min_ = acopy.pop()
Lcopy.append(min_)

while a:
    if a:
        b = a.popleft()
        L.append(b)
    if a:
        c = a.popleft()
        L.appendleft(c)
    if a:
        d = a.pop()
        L.append(d)
    if a:
        e = a.pop()
        L.appendleft(e)

while acopy:
    if acopy:
        b = acopy.popleft()
        Lcopy.append(b)
    if acopy:
        c = acopy.popleft()
        Lcopy.appendleft(c)
    if acopy:
        d = acopy.pop()
        Lcopy.append(d)
    if acopy:
        e = acopy.pop()
        Lcopy.appendleft(e)
ans1,ans2 = 0,0
#print(L,Lcopy)
for i in range(len(L)-1):
    ans1 +=abs(L[i+1] - L[i])
for i in range(len(Lcopy)-1):
    ans2 +=abs(Lcopy[i+1] - Lcopy[i])
print(max(ans1,ans2))
Buggy python submission (verdict: Runtime Error):
s = input()
a = ""
for i in range(len(s)):
  if i == 1:
    a += 9
  elif i == 9:
    a += 1
print(a)

Fixed submission:
s = input()

a = ""
for i in range(len(s)):
  if s[i] == str(1):
    a += str(9)
  elif s[i] == str(9):
    a += str(1)
print(a)
Buggy python submission (verdict: Runtime Error):
n = int(input())

while True:
  for i in range(len(str(n))-1):
    if str(n)[i] == str(n)[i+1]:
      flag = True
    else:
      break
  if flag:
    print(n)
    break
  n +=1
    

Fixed submission:
n = input()
s = n[0]*len(n)
if int(n) <= int(s):
    print(s)
else:
    print(str(int(n[0])+1)*len(n))
Buggy python submission (verdict: Runtime Error):
h,w = map(int,input().split())
li,li2,li3 = [],[],[]
for i in range(h):
    li.append(list(input()))
li = [x for x in li if "#"  in x]

for i in range(w):
    li2.append([])
    for j in range(len(li)):
        li2[-1].append(li[j][i])
li2 = [x for x in li2 if "#"  in x]
for i in range(len(li2)):
    li3.append([])
    for j in range(len(li2[i])):
        li3[-1].append(li2[j][i])
for i in range(len(li3)):
    print("".join(li3[i]))

Fixed submission:
h,w = map(int,input().split())
li,li2 = [],[]
for i in range(h):
    a = list(input())
    if "#" in a:
        li.append(a)
for i in range(len(li)):
    for j in range(w):
        if li[i][j] == ".":
            li[i][j] = 0
        elif li[i][j] == "#":
            li[i][j] = 1

li = list(zip(*li))
for i in range(len(li)):
    if 1 in li[i]:
        li2.append(li[i])
li2 = list(zip(*li2))
for i in range(len(li2)):
    li2[i] = list(li2[i])
for i in range(len(li2)):
    for j in range(len(li2[i])):
        if li2[i][j] == 0:
            li2[i][j] = "."
        elif li2[i][j] == 1:
            li2[i][j] = "#"
for i in range(len(li2)):
    print("".join(li2[i]))
Buggy python submission (verdict: Runtime Error):
n = int(input())
num = 0
for i in range(1,n+1):
  cnt = 0
  for j in range(1,i+1) and i%2 == 1:
    if i%j == 0:
      cnt += 1
  if cnt == 8:
    num +=1
print(num)

Fixed submission:
n = int(input())
def yakusu(a):
    b = 1
    num = 0
    if a == 1:
        return 1
    while b<=a:
        if a%b == 0 and b%2 ==1:
            num += 1
        b += 1
    return num
    
li = []
for i in range(1,n+1):
    li.append(yakusu(i))

print(li.count(8))
Buggy python submission (verdict: Runtime Error):
n = input()
k = int(input())

if "1" in n:
    one = n.rfind("1")-n.find("1")+1
    #print(n.rfind("1")+1)
    if one < k:
        print(n[n.rfind("1")+1])
    elif one >= k:
        print(1)
elif "1" not in n:
    print(n[0])

Fixed submission:
from itertools import groupby
n = list(input())
k = int(input())
if n == 1:
    print(1)
    exit()
li = []
for key,v in groupby(n):
    li.append(list(v))

if li[0][0] == "1":
    if len(li[0])>= k:
        print(1)
        exit()

for i in range(len(n)):
    if n[i] != "1":
        print(n[i])
        break
Buggy python submission (verdict: Runtime Error):
from itertools import product
n,k = map(int,input().split())
L = []
for i in range(n):
    a,b = map(int,input().split())
    L.append([0,a,b])
for i in range(n):
    L[i][0] = 100*(i+1)
#print(L)
li = [0,1]
re = []

def cer(v):
    for i in range(n-1,0,-1):
        if v[i] == 0:
            return i
            
for v in product(li,repeat = n):
    score = 0
    scorenomi = 0
    num = 0
    for i in range(n):
        score += (L[i][0]*L[i][1] + L[i][2])*v[i]
        scorenomi +=L[i][0]*L[i][1]*v[i]
        num +=L[i][1]*v[i]
    if score < k:
        j = 1
        score2 = 0
        while j <= L[cer(v)][1]:
            score2 = L[cer(v)][0]*j
            if score + score2 >=k:
                break
            j +=1
        #print(num,i,j,num + j,score,score2,score + score2,v)
    if score+ score2 >=k:
        print(num +j)
        exit()
    re.append([score,scorenomi,num,v])
re.sort()
for i in range(len(re)):
    if re[i][0] >=k:
        print(re[i][2])
        exit()

Fixed submission:
n,k = map(int,input().split())
L = []
for i in range(n):
    a,b = map(int,input().split())
    L.append([(i+1)*100,a,b])
#print(L)
ans = 10**10
if k < L[-1][0]*L[-1][1]:
    if k%L[-1][0] != 0:
        ans = (k//L[-1][0]+1)
    else:
        ans = (k//L[-1][0])

for i in range(1<<n):
    li = []
    score,score_zan,cnt = 0,0,0
    for j in range(n):
        if i>>j&1:
            score +=(L[j][0]*L[j][1] + L[j][2])
            cnt +=L[j][1]
            score_zan = k-score
        else:
            li.append(L[j])
    if score > 0 and score_zan <= 0:
        ans = min(ans,cnt)
    li.sort(reverse = True)
    #print(score,li,cnt,score_zan)
    if li and score_zan > 0:
        if score_zan < li[0][0]*li[0][1]:
            ans = min(ans,cnt + score_zan//li[0][0])
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
L = list(map(int,input().split()))
for i in range(n):
    L[i] = L[i]-(i+1)
sum1 = 0
b = max(abs(max(L)),abs(min(L)))
i = -b
min1 = 10**10
while i<=b:
    sum1 =0
    for j in range(n):
        sum1 += abs(L[j]-i)
    min1 = min(min1,sum1)
    i +=1
print(min1)

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

for i in range(n):
    li[i] -= i

import statistics
import math
a = math.floor(statistics.median(li))
b = math.ceil(statistics.median(li))

num_a,num_b = 0,0
for i in range(n):
    num_a += abs(li[i]-(a))
    num_b += abs(li[i]-(b))
print(min(num_a,num_b))
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
if a<=8 and b<=8:
  print("Yay!")
  else:
    print(":(")


Fixed submission:
a,b = map(int,input().split())
if a<=8 and b<=8:
  print("Yay!")
else:
  print(":(")
Buggy python submission (verdict: Runtime Error):
d,n = map(int,input().split())
if d == o:
  print(n)
elif d == 1:
  print(100*n)
elif d == 2:
  print(10000*n)

Fixed submission:
d,n = map(int,input().split())
if d == 0 and 1<=n<=99:
  print(n)
elif d == 0 and n ==100:
  print(101)
elif d == 1 and 1<=n<=99:
  print(100*n)
elif d == 1 and n ==100:
   print(101*n)
elif d == 2 and 1<=n<=99:
  print(10000*n)
elif d == 2 and n ==100:
   print(10100*n)
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input())
print((b-a)*(b-a+1)//2-b)

Fixed submission:
a,b = map(int,input().split())
print((b-a)*(b-a+1)//2-b)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = list(input())

a,b = [],[]
for i in range(1,n):
    if s[i]=="E":
        a.append(s[:i-1].count("W")+s[i+1:].count("E"))
        #print(a)
    elif s[i]=="W":
        b.append(s[i+1:].count("E")+s[:i-1].count("W"))
print(min(min(a),min(b)))

Fixed submission:
import numpy as np
import sys
buf = sys.stdin.buffer
N = int(buf.readline())
L = list(input())

tE = L.count("E")
tW = N-tE
ce,cw = 0,0
ans = 3*(10**5)
for i in range(N):
    if L[i] == "E":
        ce +=1
    elif L[i] == "W":
        cw +=1
    if L[i] == "E":
        ans = min(ans,cw+(tE-ce))
    elif L[i] == "W":
      
        ans = min(ans,cw-1+(tE-ce))
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = list(input())

a,b = [],[]
for i in range(1,n):
    if s[i]=="E":
        a.append(s[:i-1].count("W")+s[i+1:].count("E"))
        #print(a)
    elif s[i]=="W":
        b.append(s[i+1:].count("E")+s[:i-1].count("W"))
print(min(min(a),min(b)))

Fixed submission:
import numpy as np
import sys
buf = sys.stdin.buffer
N = int(buf.readline())
L = list(input())

tE = L.count("E")
tW = N-tE
ce,cw = 0,0
ans = 3*(10**5)
for i in range(N):
    if L[i] == "E":
        ce +=1
    elif L[i] == "W":
        cw +=1
    if L[i] == "E":
        ans = min(ans,cw+(tE-ce))
    elif L[i] == "W":
      
        ans = min(ans,cw-1+(tE-ce))
print(ans)
Buggy python submission (verdict: Runtime Error):
import numpy as np
n = int(input())
L = list(input())
for i in range(n):
    if L[i] == "W":
        L[i] = 0
    else:
        L[i] = 1

ans = 3*(10**5)
for i in range(1,n-1):
    Ll = np.array(L[:i])
    Lr = np.array(L[i+1:])
    Ll = np.cumsum(Ll)
    Lr = np.cumsum(Lr)
    if L[i] == 0:
        ans = min(ans,Ll[-1]+Lr[-1])
    elif L[i] == 1:
        ans = min(ans,len(Ll)-Ll[-1]+len(Lr)-Lr[-1])
    ans = min(ans,len(Ll)-Ll[-1]+Lr[-1])
print(ans)

Fixed submission:
from itertools import accumulate
n = int(input())
L = list(input())

R = L.count("E")

for i in range(n):
    if L[i] == "W":
        L[i] = 1
    elif L[i] == "E":
        L[i] = 0
liw = list(accumulate(L))

for i in range(n):
    if L[i] == 0:
        L[i] = 1
    elif L[i] == 1:
        L[i] = 0

lie = list(accumulate(L))

for i in range(n):
    lie[i] = R-lie[i]

ans = 10**10
for i in range(n):
    west_num = liw[i]
    east_num = lie[i]
    #print(west_num,east_num,L[i])
    if L[i] == 0:
        west_num =max(west_num -1,0)

    ans = min(ans,west_num+east_num)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n = int(input())
L = list(input())
for i in range(n):
    if L[i] == "W":
        L[i] = 0
    else:
        L[i] = 1

ans = 3*(10**5)
for i in range(1,n-1):
    Ll = np.array(L[:i])
    Lr = np.array(L[i+1:])
    Ll = np.cumsum(Ll)
    Lr = np.cumsum(Lr)
    if L[i] == 0:
        ans = min(ans,Ll[-1]+Lr[-1])
    elif L[i] == 1:
        ans = min(ans,len(Ll)-Ll[-1]+len(Lr)-Lr[-1])
    ans = min(ans,len(Ll)-Ll[-1]+Lr[-1])
print(ans)

Fixed submission:
from itertools import accumulate
n = int(input())
L = list(input())

R = L.count("E")

for i in range(n):
    if L[i] == "W":
        L[i] = 1
    elif L[i] == "E":
        L[i] = 0
liw = list(accumulate(L))

for i in range(n):
    if L[i] == 0:
        L[i] = 1
    elif L[i] == 1:
        L[i] = 0

lie = list(accumulate(L))

for i in range(n):
    lie[i] = R-lie[i]

ans = 10**10
for i in range(n):
    west_num = liw[i]
    east_num = lie[i]
    #print(west_num,east_num,L[i])
    if L[i] == 0:
        west_num =max(west_num -1,0)

    ans = min(ans,west_num+east_num)
print(ans)
Buggy python submission (verdict: Runtime Error):
x = int(input())
li,p,ans = [],1,0

for b in range(2,int(x**0.5//1)+1):
    while b**p<=x:
        ans = max(ans,b**p)
        p += 1
        li.append(b**(p-1))
        if b**p>x:
            p = 1
            break
        
print(max(li))

Fixed submission:
x = int(input())
li,p,ans = [],1,0

for b in range(2,int(x**0.5//1)+1):
    while b**p<=x:
        ans = max(ans,b**p)
        p += 1
        li.append(b**(p-1))
        if b**p>x:
            p = 1
            break
if x <= 3:
    print(x)
else:
    print(max(li))
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
print(max(a,b,c)*2**k + (a+b+c-max(a,b,c)))

Fixed submission:
a,b,c = map(int,input().split())
k = int(input())
print(2**k*max(a,b,c) + (a+b+c-max(a,b,c)))
Buggy python submission (verdict: Runtime Error):
H,W = map(int,input().split())
L = []
for i in range(H):
    L.append((input()))
for i in range(H):
    for j in range(W):
        if L[i][j] == "#":
            flag = False
            if i-1 >=0 and L[i-1][j] == "#":
                flag = True
            if i+1 <H and L[i+1][j] == "#":
                flag = True
            if j-1 >=0 and L[i][j-1] == "#":
                flag = True
            if j+1 <W and L[i][j+1] == "#":
                flag = True
            if flag == False:
                print("No")
                exit()
if flag:
    print("Yes") 

Fixed submission:
H,W = map(int,input().split())
L = []
for i in range(H):
    L.append((input()))
for i in range(H):
    for j in range(W):
        if L[i][j] == "#":
            flag = False
            if i-1 >=0 and L[i-1][j] == "#":
                flag = True
            if i+1 <H and L[i+1][j] == "#":
                flag = True
            if j-1 >=0 and L[i][j-1] == "#":
                flag = True
            if j+1 <W and L[i][j+1] == "#":
                flag = True
            if flag == False:
                print("No")
                exit()
print("Yes")
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
li = []
for i in range(a):
  li.append(int(input())
sum1 = sum(li)
min1 = min(li)
b = b -sum1
print(a+ b//min1)

Fixed submission:
a,b = map(int,input().split())
li = []
for i in range(a):
  li.append(int(input()))
sum1 = sum(li)
min1 = min(li)
b = b -sum1
print(a+ b//min1)

Buggy python submission (verdict: Runtime Error):
a,b = map(int,input())
li = []
for i in range(a):
  li.append(int(input())
sum1 = sum(li)
min1 = min(li)
b = b -sum1
print(a+ b//min1)

Fixed submission:
a,b = map(int,input().split())
li = []
for i in range(a):
  li.append(int(input()))
sum1 = sum(li)
min1 = min(li)
b = b -sum1
print(a+ b//min1)
Buggy python submission (verdict: Runtime Error):
print("Yes" if set(input()) == {a,b,c} else "No")

Fixed submission:
print("Yes" if set(input()) == {"a","b","c"} else "No")
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
cnt = 0
for i in range(n,m+1):
  s = str(i)
  if s == s[::-1]
    cnt +=1
print(cnt)

Fixed submission:
a,b = map(int,input().split())
cnt = 0
for i in range(a,b+1):
  i = list(str(i))
  if i == i[::-1]:
    cnt += 1
print(cnt)
Buggy python submission (verdict: Runtime Error):
n = int(input())
li = list(map(int,input().split())) 
li.sort(reverse = True)
a,b = 0,0
while li:
    a += li.pop(0)
    b += li.pop(0)
print(a-b)

Fixed submission:
n = int(input())
li = list(map(int,input().split())) 
li.sort(reverse = True)
a,b = 0,0
while li:
    a += li.pop(0)
    if len(li) == 0:
        break
    b += li.pop(0)
print(a-b)
Buggy python submission (verdict: Runtime Error):
a,b = map(str,input().split())
if pow(int(a+b),0.5,1) == 0:
  print("Yes")
else:
  print("No")

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

if int(x+y)**0.5%1 == 0:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
a,b = map(input().split())
if int(a+b)**0.5%1 == 0:
  print("Yes")
else:
  print("No")

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

if int(x+y)**0.5%1 == 0:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
n = int(input())
li = [list(map(int,list(input().split()))) for i in range(n)]

for i in range(len(li)):
    if li[i][0] >= li[i][1] + li[i][2]:
        if (li[i][0] - (li[i][1] + li[i][2]))%2 == 0:
        flag = True
    else:
        flag = False
        break
if flag == True:
    print("Yes")
elif flag == False:
    print("No")

Fixed submission:
n = int(input())
t,x,y = 0,0,0

for i in range(n):
    T,X,Y = map(int,input().split())
    dt,dx,dy = T-t,abs(X-x),abs(Y-y)
    if dt - (dx + dy) < 0 or (dt - (dx + dy))%2 == 1:
        print("No")
        exit()
    t,x,y = T,X,Y

print("Yes")
Buggy python submission (verdict: Runtime Error):
n,a,b = map(int,input().split())
sum1 = 0
ans = 0
for i in range(1,n+1):
  for j in range(len(str(i)):
    sum1 +=str(i)[j]
  if a<= sum1 <=b:
    ans += sum1
print(ans)

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

ans = 0
n = str(n)
num = 1
while num <= int(n):
    sum1 = 0
    for s in str(num):
        sum1 += int(s)
        
    if a <= sum1 <= b:
        ans += num
        
    num += 1
    
print(ans)
Buggy python submission (verdict: Runtime Error):
import numpy as np
n,k = map(int,input().split())
L = list( map(int,input().split()))
L = np.array(L)
set1,cnt = np.unique(L,return_counts = True)
cnt1 = sorted(cnt)
print(sum(cnt1[:len(cnt1)-k]))

Fixed submission:
from collections import Counter
n,k = map(int,input().split())
L = list( map(int,input().split()))
l = len(L)
L = Counter(L)
L = sorted(list(L.most_common(k)))

ans = 0
for i in range(len(L)):
    ans += L[i][1]
if l >= ans:
    print(l - ans)
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
n = input()
n1 = list(input())
n1 = [int(x) for x in n]

num =0
for i in range(len(n1)):
  num += int(n1[i])

if int(n)%num == 0:
  print("Yes")
else:
  print("No")

Fixed submission:
n = str(input())
wa = ""
for i in n:
  wa += "+"+i

if int(n)%(eval(wa)) == 0:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
n = input()
n1 = list(input())
n1 = [int(x) for x in n]

num =0
for i in range(len(n1)):
  num += int(n1[i])

if int(n)%num == 0:
  print("Yes")
else:
  print("No")

Fixed submission:
n = str(input())
wa = ""
for i in n:
  wa += "+"+i

if int(n)%(eval(wa)) == 0:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
n = input()
for i in range(len(n)):
  num += int(n[i])
if n%num == 0:
  print("Yes")
else:
  print("No")

Fixed submission:
n = str(input())
wa = ""
for i in n:
  wa += "+"+i

if int(n)%(eval(wa)) == 0:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
import numpy as np
from scipy.sparse.csgraph import floyd_warshall

h,w = map(int,input().split())
d = np.zeros((10,10))
for i in range(10):
    a = list(map(int,input().split()))
    d[i] = a
#print(d)
def WF(b):
    for k in range(10):
        for i in range(10):
            for j in range(10):
                d[i][j] = min(d[i][j],d[i][k] + d[k][j])
    return d
WF(d)
#d = floyd_warshall(d)
L = []
for i in range(h):
    b = list(map(int,input().split()))
    L.append(b)
ans = 0
for i in range(h):
    for j in range(w):
        if L[i][j] == 1 or L[i][j] == -1:
            continue
        else:
            ans += d[L[i][j]][1]
print(int(ans))

Fixed submission:

import numpy as np
from scipy.sparse.csgraph import floyd_warshall

h,w = map(int,input().split())
d = np.zeros((10,10))
for i in range(10):
    a = list(map(int,input().split()))
    d[i] = a
#print(d)
def WF(b):
    for k in range(10):
        for i in range(10):
            for j in range(10):
                d[i][j] = min(d[i][j],d[i][k] + d[k][j])
    return d
WF(d)
#d = floyd_warshall(d)
L = []
for i in range(h):
    b = list(map(int,input().split()))
    L.append(b)
ans = 0
for i in range(h):
    for j in range(w):
        if L[i][j] == 1 or L[i][j] == -1:
            continue
        else:
            ans += d[L[i][j]][1]
print(int(ans))

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

    h,w = map(int,input().split())
    d = np.zeros((10,10))
    for i in range(10):
        a = list(map(int,input().split()))
        d[i] = a
    def WF(b):
        for k in range(10):
            for i in range(10):
                for j in range(10):
                    d[i][j] = min(d[i][j],d[i][k] + d[k][j])
        return d
    WF(d)
    L = []
    for i in range(h):
        b = list(map(int,input().split()))
        L.append(b)
    ans = 0
    for i in range(h):
        for j in range(w):
            if L[i][j] == 1 or L[i][j] == -1:
                continue
            else:
                ans += d[L[i][j]][1]
    print(int(ans))

if __name__ == '__main__':
	main()

Fixed submission:

import numpy as np
from scipy.sparse.csgraph import floyd_warshall

h,w = map(int,input().split())
d = np.zeros((10,10))
for i in range(10):
    a = list(map(int,input().split()))
    d[i] = a
#print(d)
def WF(b):
    for k in range(10):
        for i in range(10):
            for j in range(10):
                d[i][j] = min(d[i][j],d[i][k] + d[k][j])
    return d
WF(d)
#d = floyd_warshall(d)
L = []
for i in range(h):
    b = list(map(int,input().split()))
    L.append(b)
ans = 0
for i in range(h):
    for j in range(w):
        if L[i][j] == 1 or L[i][j] == -1:
            continue
        else:
            ans += d[L[i][j]][1]
print(int(ans))
Buggy python submission (verdict: Runtime Error):
a , b = map(int,input())
print((1900*b+(a-b)*100)*2**b)

Fixed submission:
a , b = map(int,input().split())
print((1900*b+(a-b)*100)*2**b)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))

num = 0
for i in range(n):
    for j in range(n):
        for k in range(n):
            if a[i] < b[j] < c[k]:
                num += 1
print(num)

Fixed submission:
import bisect
n = int(input())
a = sorted(list(map(int,input().split())))
b = sorted(list(map(int,input().split())))
c = sorted(list(map(int,input().split())))
#print(a,b,c)
cnt = 0
for i in range(n):
    d = bisect.bisect_left(a,b[i])
    e = bisect.bisect_right(c,b[i])
    cnt += d*(n-e)
print(cnt)