Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import math
import numpy as np
import sys
import os
from operator import mul
from operator import itemgetter
from collections import defaultdict as D


sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(_S())
def LS(): return list(_S().split())
def LI(): return list(map(int,LS()))

if os.getenv("LOCAL"):
    inputFile = basename_without_ext = os.path.splitext(os.path.basename(__file__))[0]+'.txt'
    sys.stdin = open(inputFile, "r")
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353    

N,M = LI()
H = LI()
AB = [LI() for _ in range(M)]

obs = [(i-1,h) for i,h in enumerate(H)]
obs.sort(key=itemgetter(1),reverse=True)

seenFromHigher = set()

roads = D(set)

for i in range(M):
    f = AB[i][0]-1
    t = AB[i][1]-1
    roads[f].add(t)
    roads[t].add(f)

ans = 0
for ob in obs:
    if not (ob[0] in seenFromHigher):
        isHighest = True
        for i in roads[ob[0]]:
            seenFromHigher.add(i)
            if ob[1] < H[i]:
                isHighest = False 
        if isHighest:
            ans += 1

print(ans)

# p = []
# d = {}
# for i in range(N):
#     d[i]=H[i]

# # g = np.zeros(shape=(N,N),dtype='int')
# g = [set()] * N
# a = [True] * N

# for i in range(M):
#     f = AB[i][0]-1
#     t = AB[i][1]-1
#     if d[t]>d[f]:
#         a[f]=False
#     elif d[f]>d[t]:
#         a[t]=False
#     else:
#         a[f]=False
#         a[t]=False
# print(sum(a))  


Fixed submission:
import math
import numpy as np
import sys
import os
from operator import mul
from operator import itemgetter

sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(_S())
def LS(): return list(_S().split())
def LI(): return list(map(int,LS()))

if os.getenv("LOCAL"):
    inputFile = basename_without_ext = os.path.splitext(os.path.basename(__file__))[0]+'.txt'
    sys.stdin = open(inputFile, "r")
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353    

N,M = LI()
H = LI()
AB = [LI() for _ in range(M)]

p = []
d = {}
for i in range(N):
    # p.append((i,H[i]))
    d[i]=H[i]
# p.sort(key=itemgetter(1),reverse=True)
# print(p)
# print(d)

# g = np.zeros(shape=(N,N),dtype='int')
g = [set()] * N
a = [True] * N

for i in range(M):
    f = AB[i][0]-1
    t = AB[i][1]-1
    if d[t]>d[f]:
        a[f]=False
    elif d[f]>d[t]:
        a[t]=False
    else:
        a[f]=False
        a[t]=False
# print(a)
print(sum(a))  
    # print(g[f])
    # g[f] = np.append(g[f],t)
    # g[t] = np.append(g[t],f)
   
    # g[f][t]=1
    # g[t][f]=1

# print(g)
# list.sort(key=itemgetter(0))

# for i in range(N):


# a = np.where(g[0]==1)
# print(a)
Buggy python submission (verdict: Runtime Error):
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, M = map(int, readline().split())
if M == 0:
    print([0, 10, 100][N - 1])
    exit()
m = map(int, read().split())
S, C = zip(*zip(m, m))

def test(n):
    st = str(n)
    if len(st) != N:
        return False
    for i, c in zip(S, C):
        i -= 1
        if st[i] != str(c):
            return False
    return True

def main():
    for n in range(1000):
        if test(n):
            return n
    return -1

print(main())


Fixed submission:
n = int(input())

p = n % 2 + n // 2

print(p)
Buggy python submission (verdict: Runtime Error):
import collections

N = int(input())

S = []
for _ in range(N):
    S.append(input())

c = collections.Counter(S)
c1 = c.most_common()

# print(c1[0][0])

tmp = []
for i in range(len(c1)):
    tmp.append(c1[i][0])
    print(sorted(tmp))
    if (c1[0][1] > c1[i][1]):
        break

ans = sorted(tmp)
for i in range(len(ans)):
    print(ans[i])

Fixed submission:
import sys 
from collections import Counter

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(readline())
l = read().decode().split()
c = Counter(l)

max = c.most_common()[0][1]
ans = [i[0] for i in c.items() if i[1] >= max]

print('\n'.join(sorted(ans)))
Buggy python submission (verdict: Runtime Error):
import bisect,collections,copy,heapq,itertools,math,string,sympy
import numpy as np
import sys
sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

# 最短距離
# 素因数分解
N = I()
c = sympy.divisors(N)
lenc = len(c)
if (lenc % 2)==0:
    a = c[lenc // 2 - 1]
    b = c[lenc // 2]
else:
    a = c[lenc // 2]
    b = a

print(a + b -2)

#H,N = LI()
#AB = [LI() for _ in range(N)]
#A,B = zip(*AB)
#Ap = np.array(A)
#C = np.zeros(N + 1)

# if ans:
#     print('Yes')
# else:
#     print('No')

Fixed submission:
import bisect,collections,copy,heapq,itertools,math,string
import numpy as np
import sys
sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

# 最短距離
# 素因数分解
N = I()

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

# c = sympy.divisors(N)
c = make_divisors(N)
lenc = len(c)
if (lenc % 2)==0:
    a = c[lenc // 2 - 1]
    b = c[lenc // 2]
else:
    a = c[lenc // 2]
    b = a

print(a + b -2)

#H,N = LI()
#AB = [LI() for _ in range(N)]
#A,B = zip(*AB)
#Ap = np.array(A)
#C = np.zeros(N + 1)

# if ans:
#     print('Yes')
# else:
#     print('No')
Buggy python submission (verdict: Time Limit Exceeded):
import bisect,collections,copy,heapq,itertools,math,string
import numpy as np
from numba import njit
import sys
sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

N = I()
A = LI()
#AB = [LI() for _ in range(N)]
#A,B = zip(*AB)
#Ap = np.array(A)
#C = np.zeros(N + 1)
# index 順 要素のindex

ans = []
for i in range(N):
    ans.append(A.index(i+1)+1)
print(*ans)

Fixed submission:
import bisect,collections,copy,heapq,itertools,math,string
import numpy as np
from numba import njit
import sys
sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

N = I()
A = LI()

B = range(1,N+1)
AB = zip(A,B)
# print(*AB)
sAB = sorted(AB)
# print(*sAB)
_,ans=zip(*sAB)
print(*ans)


#AB = [LI() for _ in range(N)]
#A,B = zip(*AB)
#Ap = np.array(A)
#C = np.zeros(N + 1)
# index 順 要素のindex

# ans = []
# for i in range(N):
#     ans.append(A.index(i+1)+1)
# print(*ans)
Buggy python submission (verdict: Runtime Error):
import bisect,collections,copy,heapq,itertools,math,string
from collections import defaultdict as D
from functools import reduce
import numpy as np
import sys
import os
from operator import mul

sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(_S())
def LS(): return list(_S().split())
def LI(): return list(map(int,LS()))

if os.getenv("LOCAL"):
    inputFile = basename_without_ext = os.path.splitext(os.path.basename(__file__))[0]+'.txt'
    sys.stdin = open(inputFile, "r")
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353    

N = I()
H = LI()

# 短調非減少 H[i] <= H[i+1]

if N ==1:
    print('Yes')
    break
ans = True
for i in range(N-1):
    if H[i] <= H[i+1]:
        # print(i,'1')
        continue
    elif (not i==0) and H[i]-1 == H[i+1]:
        if not H[i-1] == H[i]:
            H[i] -= 1
            # print(i,'2')
            continue
    # print(i,'3')
    ans = False
    break

if ans:
    print('Yes')
else:
    print('No')

Fixed submission:
import bisect,collections,copy,heapq,itertools,math,string
from collections import defaultdict as D
from functools import reduce
import numpy as np
import sys
import os
from operator import mul

sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(_S())
def LS(): return list(_S().split())
def LI(): return list(map(int,LS()))

if os.getenv("LOCAL"):
    inputFile = basename_without_ext = os.path.splitext(os.path.basename(__file__))[0]+'.txt'
    sys.stdin = open(inputFile, "r")
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353    

N = I()
H = LI()

# 短調非減少 H[i] <= H[i+1]
# 隣接要素を比較して大きかったら、必ず-1しておく
H[0]-=1
for i in range(N-1):
  if H[i] < H[i+1]:
    H[i+1] -= 1
  elif H[i] > H[i+1]:
    print("No")
    exit()
print("Yes")



# if N ==1:
#     print('Yes')
#     exit()
# ans = True
# for i in range(N-1):
#     if H[i] <= H[i+1]:
#         # print(i,'1')
#         continue
#     elif (not i==0) and H[i]-1 == H[i+1]:
#         if not H[i-1] == H[i]:
#             H[i] -= 1
#             # print(i,'2')
#             continue
#     # print(i,'3')
#     ans = False
#     break

# if ans:
#     print('Yes')
# else:
#     print('No')
Buggy python submission (verdict: Time Limit Exceeded):
import bisect,collections,copy,heapq,itertools,math,string
from collections import defaultdict as D
from functools import reduce
import numpy as np
import sys
import os
from operator import mul

sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(_S())
def LS(): return list(_S().split())
def LI(): return list(map(int,LS()))

if os.getenv("LOCAL"):
    inputFile = basename_without_ext = os.path.splitext(os.path.basename(__file__))[0]+'.txt'
    sys.stdin = open(inputFile, "r")
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353    

S = _S()

ans = np.zeros(len(S),dtype='int')
for i in range(len(S)):
    p = i
    # 前コマンドの初期値は、被らない値(現在のコマンド)としておく
    bc = S[i]
    # print('position',i)
    for j in range(10**5):
        cc = S[p]
        # print(p,cc)

        # 前のコマンドと異なる場合
        if not(cc == bc):
            # 10**100は偶数、残り回数10**100-(j+1)が偶数なら移動後の位置
            # 偶数
            if (j+1) % 2 == 0:
                if cc=='R':
                    p += 1
                else:
                    p -= 1
            ans[p] += 1
            # print(p)
            break   
        elif cc == 'R':
            p += 1
            bc = 'R'
        else:
            p -= 1
            bc = 'L'

print(*ans)

Fixed submission:
import bisect,collections,copy,heapq,itertools,math,string
from collections import defaultdict as D
from functools import reduce
import numpy as np
import sys
import os
from operator import mul

sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(_S())
def LS(): return list(_S().split())
def LI(): return list(map(int,LS()))

if os.getenv("LOCAL"):
    inputFile = basename_without_ext = os.path.splitext(os.path.basename(__file__))[0]+'.txt'
    sys.stdin = open(inputFile, "r")
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353    

S = _S()
S += 'E'
# print(S)

ans = np.zeros(len(S)+1,dtype='int')
bc = S[0]
count = 1

for i in range(1,len(S)):
    cc = S[i]
    if cc == bc:
        count += 1
        continue
    else:
        # RRRL
        if cc == 'L':
            # 切り上げ
            ans[i-1] += math.ceil(count/2)
            # 切り捨て
            ans[i] += math.floor(count/2)
            count = 1
            bc = 'L'
        # LLLR
        else:
            ans[i-count] += math.ceil(count/2)
            ans[i-count-1] += math.floor(count/2)
            count = 1
            bc = 'R'

print(*ans[:-2])
Buggy python submission (verdict: Time Limit Exceeded):
import bisect,collections,copy,heapq,itertools,math,string
from collections import defaultdict as D
from functools import reduce
import numpy as np
import sys
import os
from operator import mul

sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(_S())
def LS(): return list(_S().split())
def LI(): return list(map(int,LS()))

if os.getenv("LOCAL"):
    inputFile = basename_without_ext = os.path.splitext(os.path.basename(__file__))[0]+'.txt'
    sys.stdin = open(inputFile, "r")
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353    

l,r = LI()
m = 2019

ar = []
for i in range(l,r):
    for j in range(i+1,r+1):
        ar.append((i*j)%m)
print(min(ar))

# ans = (l * r) % m
# print(ans)

# N = I()
#A,B = LI()
#AB = [LI() for _ in range(N)]
#A,B = zip(*AB)
#Ap = np.array(A)
#C = np.zeros(N + 1)

# if ans:
#     print('Yes')
# else:
#     print('No')

Fixed submission:
import bisect,collections,copy,heapq,itertools,math,string
from collections import defaultdict as D
from functools import reduce
import numpy as np
import sys
import os
from operator import mul

sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(_S())
def LS(): return list(_S().split())
def LI(): return list(map(int,LS()))

if os.getenv("LOCAL"):
    inputFile = basename_without_ext = os.path.splitext(os.path.basename(__file__))[0]+'.txt'
    sys.stdin = open(inputFile, "r")
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353    

l,r = LI()
m = 2019

end = min(l+2019,r)

ar = []
for i in range(l,end):
    for j in range(i+1,end+1):
        ar.append((i*j)%m)
print(min(ar))

# ans = (l * r) % m
# print(ans)

# N = I()
#A,B = LI()
#AB = [LI() for _ in range(N)]
#A,B = zip(*AB)
#Ap = np.array(A)
#C = np.zeros(N + 1)

# if ans:
#     print('Yes')
# else:
#     print('No')
Buggy python submission (verdict: Runtime Error):
import math
import numpy as np
import sys
import os
from operator import mul

sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(_S())
def LS(): return list(_S().split())
def LI(): return list(map(int,LS()))

if os.getenv("LOCAL"):
    inputFile = basename_without_ext = os.path.splitext(os.path.basename(__file__))[0]+'.txt'
    sys.stdin = open(inputFile, "r")
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353    

# grid
# N = I()
# 黒く塗りつぶす#が独立していたら不可
H,W = LI()
S = [list(_S()) for _ in range (H)]

def check(x, y):
    # 移動する4方向をループ
    res = False
    # for dx,dy in itertools.product([-1,0,1],repeat=2):
    dxs = [-1,1]
    dys = [-1,1]
    for dx in dxs:
        nx = x + dx
        ny = y
        if 0 <= nx and nx < H and S[nx][ny] == "#":
            res = True
    for dy in dys:
        nx = x
        ny = y + dy
        if 0 <= ny and ny < H and S[nx][ny] == "#":
            res = True
    return res

for i in range(H):
    for j in range(W):
        if S[i][j] == "#":
            if not check(i,j):
                print('No')
                exit()

print('Yes')

Fixed submission:
import math
import numpy as np
import sys
import os
from operator import mul

sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(_S())
def LS(): return list(_S().split())
def LI(): return list(map(int,LS()))

if os.getenv("LOCAL"):
    inputFile = basename_without_ext = os.path.splitext(os.path.basename(__file__))[0]+'.txt'
    sys.stdin = open(inputFile, "r")
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353    

# grid
# N = I()
# 黒く塗りつぶす#が独立していたら不可
H,W = LI()
S = [list(_S()) for _ in range (H)]

def check(x, y):
    # 移動する4方向をループ
    res = False
    # for dx,dy in itertools.product([-1,0,1],repeat=2):
    dxs = [-1,1]
    dys = [-1,1]
    for dx in dxs:
        nx = x + dx
        ny = y
        if 0 <= nx and nx < H and S[nx][ny] == "#":
            res = True
    for dy in dys:
        nx = x
        ny = y + dy
        if 0 <= ny and ny < W and S[nx][ny] == "#":
            res = True
    return res

for i in range(H):
    for j in range(W):
        if S[i][j] == "#":
            if not check(i,j):
                print('No')
                exit()

print('Yes')
Buggy python submission (verdict: Runtime Error):
import math
import sys
import os
from operator import mul
import numpy as np

sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(_S())
def LS(): return list(_S().split())
def LI(): return list(map(int,LS()))

if os.getenv("LOCAL"):
    inputFile = basename_without_ext = os.path.splitext(os.path.basename(__file__))[0]+'.txt'
    sys.stdin = open(inputFile, "r")
INF = float("inf")


N = I()
A1 = LI()
A2 = LI()

A1n = np.zeros(N,dtype='int')
A1n = np.array(A1)
A2n = np.zeros(N,dtype='int')
A2n = np.array(A2)

A1_cum = np.zeros(N,dtype='int')
A2_cum = np.zeros(N,dtype='int')
A1_cum = A1n[1:].cumsum()
A2_cum = A2n[:-1].cumsum()
# print(A1_cum)
# print(A2_cum)

# 下に降りる最初の位置
start = N - 2
for i in range(N-1):
    if A1_cum[N-2] - A1_cum[i] < A2_cum[N-2] - A2_cum[i]:
        start = i
        break

ans = A1n[0] + A2n[-1] + A1_cum[start] + (A2_cum[N-2] - A2_cum[start])

print(ans)

Fixed submission:
import math
import sys
import os
from operator import mul
import numpy as np

sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(_S())
def LS(): return list(_S().split())
def LI(): return list(map(int,LS()))

if os.getenv("LOCAL"):
    inputFile = basename_without_ext = os.path.splitext(os.path.basename(__file__))[0]+'.txt'
    sys.stdin = open(inputFile, "r")
INF = float("inf")


N = I()
A1 = LI()
A2 = LI()

if N == 1:
    print(A1[0]+A2[0])
    exit()

ans = 0
for i in range(N):
    ans = max(ans, sum(A1[:i])+sum(A2[i-1:]))


# A1n = np.zeros(N,dtype='int')
# A1n = np.array(A1)
# A2n = np.zeros(N,dtype='int')
# A2n = np.array(A2)

# A1_cum = np.zeros(N,dtype='int')
# A2_cum = np.zeros(N,dtype='int')
# A1_cum[1:] = A1n[1:].cumsum()
# A2_cum[1:] = A2n[:-1].cumsum()
# # print(A1_cum)
# # print(A2_cum)

# # 下に降りる最初の位置
# start = N - 2
# for i in range(N-1):
#     if A1_cum[N-1] - A1_cum[i] < A2_cum[N-1] - A2_cum[i]:
#         start = i
#         break

# ans = A1n[0] + A2n[-1] + A1_cum[start] + (A2_cum[-1] - A2_cum[start])

# # ans = sum(A1) + sum(A2) - min(A1[-1],A2[0]+A2[1])

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import math
import numpy as np
import sys
import os
from operator import mul

sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(_S())
def LS(): return list(_S().split())
def LI(): return list(map(int,LS()))

if os.getenv("LOCAL"):
    inputFile = basename_without_ext = os.path.splitext(os.path.basename(__file__))[0]+'.txt'
    sys.stdin = open(inputFile, "r")
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353    

N = I()

ans = 1
for i in range(N):
    ans *= (i+1)

ans %= MOD
print(ans)

Fixed submission:
import math
import numpy as np
import sys
import os
from operator import mul

sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(_S())
def LS(): return list(_S().split())
def LI(): return list(map(int,LS()))

if os.getenv("LOCAL"):
    inputFile = basename_without_ext = os.path.splitext(os.path.basename(__file__))[0]+'.txt'
    sys.stdin = open(inputFile, "r")
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353    

N = I()

ans = 1
for i in range(N):
    ans *= (i+1)
    ans %= MOD

print(ans)
Buggy python submission (verdict: Runtime Error):
import math
import numpy as np
import sys
import os
from operator import mul

sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(_S())
def LS(): return list(_S().split())
def LI(): return list(map(int,LS()))

if os.getenv("LOCAL"):
    inputFile = basename_without_ext = os.path.splitext(os.path.basename(__file__))[0]+'.txt'
    sys.stdin = open(inputFile, "r")
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353    

N,K = LI()

ans = K*(K-1)**(N-1)
print(ans)

Fixed submission:
import math
import numpy as np
import sys
import os
from operator import mul

sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(_S())
def LS(): return list(_S().split())
def LI(): return list(map(int,LS()))

if os.getenv("LOCAL"):
    inputFile = basename_without_ext = os.path.splitext(os.path.basename(__file__))[0]+'.txt'
    sys.stdin = open(inputFile, "r")
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353    

N,K = LI()

ans = K*(K-1)**(N-1)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

H,W = list(map(int,input().split()))
Ch,Cw = list(map(int,input().split()))
Dh,Dw = list(map(int,input().split()))

maze = [["#"]*(W+4)]
maze.append(["#"]*(W+4))
for i in range(H):
    row = ["#","#"]
    row.extend(list(input()))
    row.append("#")
    row.append("#")
    maze.append(row)
maze.append(["#"]*(W+4))
maze.append(["#"]*(W+4))
warp = [[114514]*(W+4) for i in range(H+4)]

queue = deque()
queue.append((Ch+1,Cw+1))
warp[Ch+1][Cw+1] = 0
move_one = set(((1,0),(0,1),(-1,0),(0,-1)))
while queue:
    y,x = queue.popleft()
    for i in range(-2,3):
        for j in range(-2,3):
            if i == 0 and j == 0:
                continue
            ny,nx = y+i,x+j
            if maze[ny][nx] == "#":
                continue
            if (i,j) in move_one:
                warp[ny][nx] = warp[y][x]
                queue.appendleft((ny,nx))
                maze[ny][nx] = "#"
            else:
                if warp[ny][nx] == 114514:
                    warp[ny][nx] = min(warp[ny][nx],warp[y][x]+1)
                    queue.append((ny,nx))

if warp[Dh+1][Dw+1] == 114514:
    print(-1)
else:
    print(warp[Dh+1][Dw+1])

Fixed submission:
from collections import deque

H,W = list(map(int,input().split()))
Ch,Cw = list(map(int,input().split()))
Dh,Dw = list(map(int,input().split()))

maze = [["#"]*(W+4)]
maze.append(["#"]*(W+4))
for i in range(H):
    row = ["#","#"]
    row.extend(list(input()))
    row.append("#")
    row.append("#")
    maze.append(row)
maze.append(["#"]*(W+4))
maze.append(["#"]*(W+4))
warp = [[114514]*(W+4) for i in range(H+4)]

queue = deque()
queue.append((Ch+1,Cw+1))
warp[Ch+1][Cw+1] = 0
move_one = set(((1,0),(0,1),(-1,0),(0,-1)))
while queue:
    y,x = queue.popleft()
    for i in range(-2,3):
        for j in range(-2,3):
            if i == 0 and j == 0:
                maze[ny][nx] = "#"
                continue
            ny,nx = y+i,x+j
            if maze[ny][nx] == "#":
                continue
            if (i,j) in move_one:
                warp[ny][nx] = warp[y][x]
                queue.appendleft((ny,nx))
                maze[ny][nx] = "#"
            else:
                if warp[ny][nx] == 114514:
                    warp[ny][nx] = warp[y][x]+1
                    queue.append((ny,nx))

if warp[Dh+1][Dw+1] == 114514:
    print(-1)
else:
    print(warp[Dh+1][Dw+1])
Buggy python submission (verdict: Time Limit Exceeded):
N,K = list(map(int,input().split()))
A = list(map(int,input().split()))

score = 1
for i in range(K):
    score *= A[i]

for i in range(K,N):
    tmp = score*A[i]/A[i-K]
    if score < tmp:
        print("Yes")
    else:
        print("No")
    scpre = tmp


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

for i in range(K,N):
    if A[i-K] < A[i]:
        print("Yes")
    else:
        print("No")