Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
import sys, math


def solve(N: int, K: int, A: "List[int]", F: "List[int]"):
    A = sorted(A)
    F = sorted(F, reverse=True)
    B = [a*f for a, f in zip(A, F)]
    b = max(B)
    left = -1
    right = b

    def ok(mid):
        r = 0
        for i in range(N):
            a, f = A[i], F[i]
            r += max(0, a - mid//f)
        if r > K:
            return True
        else:
            return False

    while right - left > 1:
        mid = (right + left) // 2
        if ok(mid):
            left = mid
        else:
            right = mid
    print(right)
    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    F = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, K, A, F)

if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/env python3
import sys, math


def solve(N: int, K: int, A: "List[int]", F: "List[int]"):
    A = sorted(A)
    F = sorted(F, reverse=True)
    B = [a*f for a, f in zip(A, F)]
    b = max(B)
    left = -1
    right = b

    def ok(mid):
        r = 0
        for i in range(N):
            a, f = A[i], F[i]
            r += max(0, a - mid//f)
        if r > K:
            return True
        else:
            return False

    while right - left > 1:
        mid = (right + left) // 2
        if ok(mid):
            left = mid
        else:
            right = mid
    print(right)
    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    F = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, K, A, F)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
A, B = map(int, input())

print(max(0, A-2*B))

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

print(max(0, A-2*B))
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys
import numpy as np

def solve(N: int, A: "List[int]"):
    K = np.eye(N)
    for i in range(N-1):
        K[i, i+1] = 1
    K[N-1, 0] = 1
    A = [2 * a for a in A]
    B = np.dot(np.linalg.inv(K), np.array(A))
    s = ' '.join([str(int(b)) for b in B])
    print(s)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    solve(N, A)

if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/env python3
import sys

def solve(N: int, A: "List[int]"):
    X = []
    x1 = sum(A) - sum(A[1::2]) * 2
    X.append(x1)
    for i in range(1, N):
        X.append(2 * A[i-1] - X[i-1])
    s = ' '.join([str(x) for x in X])
    print(s)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    solve(N, A)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
N, K = list(map(int, input.split()))

if (K == 1):
    print("0")
else:
    print(N-K)

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

if (K == 1):
    print("0")
else:
    print(N-K)
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys

MOD = 1000000007  # type: int

def mfact():
    f = [1]
    for i in range(1, 20000):
        f.append(f[-1] * i % MOD)
    return f

def inv(x):
    res = 1
    k = MOD - 2
    y = x
    while (k):
        if(k % 2 == 1):
            res = (res * y) % MOD
        y = (y ** 2) % MOD
        k = k // 2
    return res

def comb(n, k, f):
    if n < k or n < 0 or k < 0:
        return 0
    a = f[n]
    b = f[n-k]
    c = f[k]
    bc = (b * c) % MOD
    return (a * inv(bc)) % MOD

def solve(N: int, M: int, K: int):
    ans = 0
    for i in range(N):
        for j in range(M):
            a = j * (j+1) // 2
            b = (M-1-j) * (M-1-j+1) // 2
            ans += (a+b) * i + M * (i*(i+1)//2) + a
            ans %= MOD
    f = mfact()
    ans *= comb(N*M-2, K-2, f)
    ans %= MOD
    print(ans)
    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    solve(N, M, K)

if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/env python3
import sys

MOD = 1000000007  # type: int

def mfact():
    f = [1]
    for i in range(1, 200007):
        f.append(f[-1] * i % MOD)
    return f

def inv(x):
    res = 1
    k = MOD - 2
    y = x
    while (k):
        if(k % 2 == 1):
            res = (res * y) % MOD
        y = (y ** 2) % MOD
        k = k // 2
    return res

def comb(n, k, f):
    a = f[n]
    b = f[n-k]
    c = f[k]
    bc = (b * c) % MOD
    return (a * inv(bc)) % MOD

def solve(N: int, M: int, K: int):
    ans = 0
    for i in range(N):
        for j in range(M):
            a = j * (j+1) // 2
            b = (M-1-j) * (M-1-j+1) // 2
            ans += (a+b) * i + M * (i*(i+1)//2) + a
            ans %= MOD
    f = mfact()
    ans *= comb(N*M-2, K-2, f)
    ans %= MOD
    print(ans)
    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    solve(N, M, K)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys, math, fractions, itertools

num = [2, 5, 5, 4, 5, 6, 3, 7, 6]

def solve(N: int, M: int, A: "List[int]"):
    dp = [-1e18] * (N+1)
    dp[0] = 0
    for i in range(1, N+1):
        m = 0
        for a in A:
            m = max(m, dp[i-num[a-1]]+1)
        dp[i] = m
    for i in range(1, N):
        if dp[i] == 0:
            dp[i] = -1
    dd = dp[N]
    ans = ''
    nn = N
    for i in range(dd):
        for a in reversed(sorted(A)):
            if dp[nn-num[a-1]] == dp[nn] - 1:
                ans += str(a)
                nn -= num[a-1]
                break
    print(ans)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    A = [ int(next(tokens)) for _ in range(M) ]  # type: "List[int]"
    solve(N, M, A)

if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/env python3
import sys, math, fractions, itertools

l = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]

def solve(N: int, M: int, A: "List[int]"):
    dp = [-1] * (N+10) # 初期化
    dp[0] = 0 # 初期化
    for i in range(N-1): # 各桁について考える
        for s in A: # 各使える数字をみる
            if dp[i] == -1 and i!=0: # 条件を満たすように作れない場合、continue
                continue
            if dp[i + l[s]] < dp[i]*10+s:
                dp[i + l[s]] = dp[i]*10+s
    print(dp[N])
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    A = [ int(next(tokens)) for _ in range(M) ]  # type: "List[int]"
    solve(N, M, A)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
 N, K = [int(n) for n in input().split()]
 if N // 2 + N % 2 >= K:
     print("YES")
 else:
     print("NO")




Fixed submission:
N, K = [int(n) for n in input().split()]
answer = "YES"
if N // 2 + N % 2 >= K:
    answer = "YES"
else:
    answer = "NO"

print(answer)
Buggy python submission (verdict: Runtime Error):
 A = []
 B = []
 for i in range(3):
     a, b = [int(n) for n in input().split()]
     A.append(a)
     B.append(b)

 counter = [0] * 4

 for i in range(3):
     counter[A[i] - 1] += 1
     counter[B[i] - 1] += 1

 oddscounter = 0

 for i in range(4):
     if counter[i] % 2 == 1:
         oddscounter += 1

 answer = ""
 if oddscounter >= 3:
     answer = "NO"
 else:
     answer = "YES"

 print(answer)


Fixed submission:
A = []
B = []
for i in range(3):
    a, b = [int(n) for n in input().split()]
    A.append(a)
    B.append(b)

counter = [0] * 4

for i in range(3):
    counter[A[i] - 1] += 1
    counter[B[i] - 1] += 1

oddscounter = 0

for i in range(4):
    if counter[i] % 2 == 1:
        oddscounter += 1

answer = "YES"
if oddscounter >= 3:
    answer = "NO"
else:
    answer = "YES"

print(answer)
Buggy python submission (verdict: Runtime Error):
 T, X = [int(n) for n in input().split()]

 print(T / X)

Fixed submission:
T, X = [int(n) for n in input().split()]
print('{:.5f}'.format(T / X))
Buggy python submission (verdict: Runtime Error):
 N, M = [int(n) for n in input().split()]
 X = sorted([int(n) for n in input().split()])

 if N >= M:
     print(0)
 else:
     diff = []
     for i in range(len(X) - 1):
         diff.append(X[i+1] - X[i])

     diff = list(reversed(sorted(diff)))
     s = 0

     for i in range(N - 1):
         s += diff[i]
     answer = X[-1] - X[0] - s
     print(answer)

Fixed submission:
N, M = [int(n) for n in input().split()]
X = sorted([int(n) for n in input().split()])

answer = 0

if N >= M:
    pass
else:
    diff = []
    for i in range(len(X) - 1):
        diff.append(X[i+1] - X[i])

    diff = list(reversed(sorted(diff)))
    s = 0
    for i in range(N - 1):
        s += diff[i]
    answer = X[-1] - X[0] - s

print(answer)
Buggy python submission (verdict: Runtime Error):
N = int(input())
P = []
for i in range(N):
  P.append(int(input())
print(sum(P) - max(P) // 2)

Fixed submission:
N = int(input())
P = []
for i in range(N):
  P.append(int(input()))
print(sum(P) - max(P) // 2)
Buggy python submission (verdict: Runtime Error):
import numpy as np
from operator import itemgetter

N, M = input().split()
N, M = int(N), int(M)
C = [input().split() for i in range(M)]

for i, c in enumerate(C):
  C[i] = [int(c[0]), int(c[1])]
  C[i].append(i)

C_sorted = sorted(C, key = lambda x: (x[0], x[1]))

counter = 1
current = 1

for c in C_sorted:
  if current < c[0]:
    counter = 1
  pref = str(c[0])
  num = str(counter)
  number = ''
  for i in range(6 - len(pref)):
    number += '0'
  number += pref
  for i in range(6 - len(num)):
    number += '0'
  number += num

  c.append(number)
  counter += 1
  current = c[0]

C_reversed = sorted(C_sorted, key = lambda x: x[2])

for c in C_reversed:
  print(c[3])

Fixed submission:
X, Y = input().split()
X, Y = int(X), int(Y)

print(int(X + Y/2))
Buggy python submission (verdict: Runtime Error):
N = int(input())
L = [input().split() for i in range(N)]
answer = 0
center = []

for i in range(101):
  for j in range(101):
    List = []
    for l in L:
      if int(l[2]) != 0:
        List.append(int(l[2]) + abs(int(l[0]) - i) + abs(int(l[1]) - j))
      #else:
        #List.append(0)
    if len(list(set(List))) == 1:
      answer = List[0]
      center.append(i)
      center.append(j)

print(center[0], center[1], answer)

Fixed submission:
N = int(input())

if N == 1:
  print('Hello World')
if N == 2:
  A = int(input())
  B = int(input())
  print(A+B)
Buggy python submission (verdict: Runtime Error):
N, T = input().split()
N, T = int(N), int(T)
R = [input().split() for i in range(N)]

for i, r in enumerate(R):
  R[i] = [int(r[0]), int(r[1])]

R_sorted = sorted(R, key = lambda x: x[0])

List = []
answer = 'TLE'

for r in R_sorted:
  if r[1] <= T:
    List.append(r[0])

print(min(List))

Fixed submission:
N, T = input().split()
N, T = int(N), int(T)
R = [input().split() for i in range(N)]
 
for i, r in enumerate(R):
  R[i] = [int(r[0]), int(r[1])]
 
R_sorted = sorted(R, key = lambda x: x[0])
 
List = []
answer = 'TLE'
 
for r in R_sorted:
  if r[1] <= T:
    List.append(r[0])

if List:
  answer = min(List)

print(answer)
Buggy python submission (verdict: Runtime Error):
import fraction

N, X = [int(n) for n in input().split()]
x = sorted([abs(int(n) - X) for n in input().split()])

if len(x) > 1:
  gcd = fraction.gcd(x[0], x[1])
  for i in x:
    gcd = fraction.gcd(gcd, i)
else:
  gcd = x[0]
print(gcd)

Fixed submission:
import fractions

N, X = [int(n) for n in input().split()]
x = sorted([abs(int(n) - X) for n in input().split()])

if len(x) > 1:
  gcd = fractions.gcd(x[0], x[1])
  for i in x:
    gcd = fractions.gcd(gcd, i)
else:
  gcd = x[0]
print(gcd)

Buggy python submission (verdict: Runtime Error):
import fraction

N, X = [int(n) for n in input().split()]
x = sorted([abs(int(n) - X) for n in input().split()])

if len(x) > 1:
  gcd = math.gcd(x[0], x[1])
  for i in x:
    gcd = math.gcd(gcd, i)
else:
  gcd = x[0]
print(gcd)

Fixed submission:
import fractions

N, X = [int(n) for n in input().split()]
x = sorted([abs(int(n) - X) for n in input().split()])

if len(x) > 1:
  gcd = fractions.gcd(x[0], x[1])
  for i in x:
    gcd = fractions.gcd(gcd, i)
else:
  gcd = x[0]
print(gcd)

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

N, X = [int(n) for n in input().split()]
x = sorted([abs(int(n) - X) for n in input().split()])

if len(x) > 1:
  gcd = math.gcd(x[0], x[1])

  for i in x:
    gcd = math.gcd(gcd, i)
else:
  gcd = x[0]

print(gcd)

Fixed submission:
import fractions

N, X = [int(n) for n in input().split()]
x = sorted([abs(int(n) - X) for n in input().split()])

if len(x) > 1:
  gcd = fractions.gcd(x[0], x[1])
  for i in x:
    gcd = fractions.gcd(gcd, i)
else:
  gcd = x[0]
print(gcd)
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
import sys, math, fractions, itertools


def solve(X, N: int, M: int, Q: int, L: "List[int]", R: "List[int]", p: "List[int]", q: "List[int]"):
    C = [[0 for _ in range(509)] for _ in range(509)]
    for i in range(1, N+1):
        for j in range(1, N+1):
            C[i][j] = C[i][j-1] + X[i][j]
    for i in range(Q):
        su = 0
        for j in range(p[i], q[i]+1):
            su += C[j][q[i]] - C[j][p[i]-1]
        print(su)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    Q = int(next(tokens))  # type: int
    L = [int()] * (M)  # type: "List[int]" 
    R = [int()] * (M)  # type: "List[int]" 
    X = [[0 for _ in range(509)] for _ in range(509)]
    for i in range(M):
        L[i] = int(next(tokens))
        R[i] = int(next(tokens))
        X[L[i]][R[i]] += 1
    p = [int()] * (Q)  # type: "List[int]" 
    q = [int()] * (Q)  # type: "List[int]" 
    for i in range(Q):
        p[i] = int(next(tokens))
        q[i] = int(next(tokens))
    solve(X, N, M, Q, L, R, p, q)

if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/env python3
import sys, math, fractions, itertools


def solve(X, N: int, M: int, Q: int, L: "List[int]", R: "List[int]", p: "List[int]", q: "List[int]"):
    C = [[0 for _ in range(509)] for _ in range(509)]
    for i in range(1, N+1):
        for j in range(1, N+1):
            C[i][j] = C[i][j-1] + X[i][j]
    for i in range(Q):
        su = 0
        for j in range(p[i], q[i]+1):
            su += C[j][q[i]] - C[j][p[i]-1]
        print(su)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    Q = int(next(tokens))  # type: int
    L = [int()] * (M)  # type: "List[int]" 
    R = [int()] * (M)  # type: "List[int]" 
    X = [[0 for _ in range(509)] for _ in range(509)]
    for i in range(M):
        L[i] = int(next(tokens))
        R[i] = int(next(tokens))
        X[L[i]][R[i]] += 1
    p = [int()] * (Q)  # type: "List[int]" 
    q = [int()] * (Q)  # type: "List[int]" 
    for i in range(Q):
        p[i] = int(next(tokens))
        q[i] = int(next(tokens))
    solve(X, N, M, Q, L, R, p, q)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
import fractions

N = int(input())
A = [int(n) for n in input().split()]

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

l = 1
for a in A:
  l = lcm(a, l)
B = [(l - 1) % a for a in A]
print(sum(B))

Fixed submission:
a = sorted([int(n) for n in input().split()])
print(a[2] - a[0])
Buggy python submission (verdict: Runtime Error):
import math

N = int(input())
A = [int(n) for n in input().split()]

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

l = 1
for a in A:
  l = lcm(a, l)
B = [(l - 1) % a for a in A]
print(sum(B))

Fixed submission:
import fractions

N = int(input())
A = [int(n) for n in input().split()]

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

l = 1
for a in A:
  l = lcm(a, l)
B = [(l - 1) % a for a in A]
print(sum(B))
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()
mx = 0
for i in range(N-1):
  a = [ord(aa) for aa in s[:i+1]]
  b = [ord(bb) for bb in s[i+1:]]
  counter = 0
  for c in range(ord('a'), ord('z')):
    if c in a and c in b:
      counter += 1
  if mx < counter:
    mx = counter

print(counter)
    
    

Fixed submission:
n = int(input())
s = input()
mx = 0
for i in range(n-1):
  a = [ord(aa) for aa in s[:i+1]]
  b = [ord(bb) for bb in s[i+1:]]
  counter = 0
  for c in range(ord('a'), ord('z')+1):
    if (c in a) and (c in b):
      counter += 1
  if mx < counter:
    mx = counter

print(mx)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N = int(input())
X = np.array([int(n) for n in input().split()])
iX = np.argsort(X)
sX = X[iX]

A = [0] * N

for i in range(N):
    L = np.concatenate([sX[:i], sX[i+1:]])
    A[iX[i]] = L[(N-2)//2]

for a in A:
    print(a)


Fixed submission:
import numpy as np

N = int(input())
X = np.array([int(n) for n in input().split()])
iX = np.argsort(X)
sX = X[iX]

A = [0] * N

for i in range(N):
    if i < N // 2:
        ans = sX[N//2]
    else:
        ans = sX[(N-2)//2]
    A[iX[i]] = ans

for a in A:
    print(a)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(n) for n in input().split()]
A = [0] + A + [0]
L = []
LL = []

for i, a in enumerate(A):
    if i < len(A) - 1:
        L.append(abs(A[i] - A[i+1]))
    if i < len(A) - 2:
        LL.append(abs(A[i] - A[i+2]))

for i in range(N):
    ans = sum(L) - L[i] - L[i+1] + LL[i]
    print(ans)


Fixed submission:
N = int(input())
A = [int(n) for n in input().split()]
A = [0] + A + [0]
L = []
LL = []

for i, a in enumerate(A):
    if i < len(A) - 1:
        L.append(abs(A[i] - A[i+1]))
    if i < len(A) - 2:
        LL.append(abs(A[i] - A[i+2]))

s = sum(L)

for i in range(N):
    ans = s - L[i] - L[i+1] + LL[i]
    print(ans)
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
from collections import deque

def bfs(maze, visited, sy, sx, gy, gx):
    queue = deque([[sy, sx]])
    visited[sy][sx] = 0
    while queue:
        y, x = queue.popleft()
        if [y, x] == [gy, gx]:
            return visited[y][x]
        for j, k in ([1, 0], [-1, 0], [0, 1], [0, -1]):
            new_y, new_x = y+j, x+k
            if 0 <= y+j <= gy and 0 <= x+k <= gx:
                if maze[new_y][new_x] == "." and \
                    visited[new_y][new_x] == -1:
                    visited[new_y][new_x] = visited[y][x] + 1
                    queue.append([new_y, new_x])

def main():
    h, w = map(int, input().split())
    S = []
    for i in range(h):
        S.append(input())
    
    visited = [[-1]*w for j in range(h)]
    res = bfs(S, visited, 0, 0, h-1, w-1)
    if res == -1:
        print(res)
    else:
        counter = 0
        for i in range(h):
            for j in range(w):
                if S[i][j] == '#':
                    counter += 1
        print(h*w-res-1-counter)


if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/env python3
from collections import deque

def bfs(maze, visited, sy, sx, gy, gx):
    queue = deque([[sy, sx]])
    visited[sy][sx] = 0
    while queue:
        y, x = queue.popleft()
        if [y, x] == [gy, gx]:
            return visited[y][x]
        for j, k in ([1, 0], [-1, 0], [0, 1], [0, -1]):
            new_y, new_x = y+j, x+k
            if 0 <= y+j <= gy and 0 <= x+k <= gx:
                if maze[new_y][new_x] == "." and \
                    visited[new_y][new_x] == -1:
                    visited[new_y][new_x] = visited[y][x] + 1
                    queue.append([new_y, new_x])

def main():
    h, w = map(int, input().split())
    S = []
    for i in range(h):
        S.append(input())
    
    visited = [[-1]*w for j in range(h)]
    res = bfs(S, visited, 0, 0, h-1, w-1)
    if res == - 1 or res == None:
        print(-1)
    else:
        counter = 0
        for i in range(h):
            for j in range(w):
                if S[i][j] == '#':
                    counter += 1
        print(h*w-res-1-counter)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())

print(ceil((a + b)/2))

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

print(math.ceil((a + b)/2))
Buggy python submission (verdict: Runtime Error):
s = input()
t = input()

s = sorted(s)
t = reversed(sorted(t))

if s < t:
  print('Yes')
else:
  print('No')

Fixed submission:
s = input()
t = input()

s = sorted(s)
t = list(reversed(sorted(t)))

if s < t:
  print('Yes')
else:
  print('No')