Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
print("Yes" if "A" in input() and "B" in input() else "No"

Fixed submission:
s=input()
print("Yes" if "A" in s and "B" in s else "No")

Buggy python submission (verdict: Runtime Error):
print("YES" if "A" in input() and "B" in input() else "NO")


Fixed submission:
s=input()
print("Yes" if "A" in s and "B" in s else "No")
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
import sys

YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(H: int, N: int, A: "List[int]"):
    for i in range(N):
        H-=max(A)
        A.remove(max(A))
        if H<=0:
            print(YES)
            break
    else:
        print(NO)
    return


# Generated by 1.1.6 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()
    H = int(next(tokens))  # type: int
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(H, N, A)

if __name__ == '__main__':
    main()


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

YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(H: int, N: int, A: "List[int]"):
    A.sort()
    for i in range(N):
        H-=A[-1]
        del A[-1]
        if H<=0:
            print(YES)
            break
    else:
        print(NO)
    return


# Generated by 1.1.6 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()
    H = int(next(tokens))  # type: int
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(H, N, A)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
x=int(input())
p=x**0.5
while any(x%i==0 for i in range(2,x//1+1)):
  x+=1
else:
  print(x)

Fixed submission:
x=int(input())
p=x**0.5
while any(x%i==0 for i in range(2,int(p)+1)):
  x+=1
else:
  print(x)

Buggy python submission (verdict: Runtime Error):
x=int(input())
p=x**0.5
while any(X%i==0 for i in range(2,x//1+1)):
  x+=1
else:
  print(x)

Fixed submission:
x=int(input())
p=x**0.5
while any(x%i==0 for i in range(2,int(p)+1)):
  x+=1
else:
  print(x)

Buggy python submission (verdict: Runtime Error):
from sympy import nextprime
import math
x=int(input())
for k in range(2, int(math.sqrt(x)) + 1):
    if x % k == 0:
        print(nextprime(x))
        exit()
print(x)

Fixed submission:
x=int(input())
p=x**0.5
while any(x%i==0 for i in range(2,int(p)+1)):
  x+=1
else:
  print(x)

Buggy python submission (verdict: Runtime Error):
from sympy import nextprime
x=int(input())
import math
if x < 2:
    print(nextprime(x))
else:
    if x == 2:
        print(x)
    else:
        if x % 2 == 0:
            print(nextprime(x))
        else:
            m = math.floor(x / 2) + 1
            for p in range(3, m, 2):
                if x % p == 0:
                    print(nextprime(x))
            print(x)

Fixed submission:
x=int(input())
p=x**0.5
while any(x%i==0 for i in range(2,int(p)+1)):
  x+=1
else:
  print(x)
Buggy python submission (verdict: Runtime Error):
a=input()
b=a[0]
c=a[1]
d=a[2]
e=a[3]
print("SAME" if b==c==d==e else "DIFFERENT" )

Fixed submission:
n=int(input())
print(pow(n,3))
Buggy python submission (verdict: Runtime Error):
n=int(input())
h=list(map(int,input().split()))
h[0]=h[0]-1
for i in range(1,n):
    try:
        if h[i]-1>=h[i+1]:
            h[i]=h[i]-1
    except IndexError:
        pass
for i in range(n):
    try:
        if h[i]>h[i+1]:
                print("No")
                exit()
    except IndexError:
        pass
print("Yes")

Fixed submission:
a,b,c=map(int,input().split())
print(max(c-(a-b),0))
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input());sa=[0]*n
h=list(map(int,input().split()))
for i in range(n):
    for j in range(n):
        try:
            if h[j]>h[j+1] and sa[j]!=1:
                h[j]=h[j]-1
                sa[j]=1
        except IndexError:
            pass
for i in range(n):
    try:
        if h[i]>h[i+1]:
                print("No")
                exit()
    except IndexError:
        pass
print("Yes")

Fixed submission:
n=int(input())
h=list(map(int,input().split()))
h[0]=h[0]-1
for i in range(1,n):
    try:
        if h[i-1]<=h[i]-1:
            h[i]=h[i]-1
    except IndexError:
        pass
for i in range(n):
    try:
        if h[i]>h[i+1]:
                print("No")
                exit()
    except IndexError:
        pass
print("Yes")
Buggy python submission (verdict: Runtime Error):
s=str(input())
if s[0]==s[1] or s[1]==s[2] or s[2]==s[3]:
	print('Bad')
    else:
    	print('Good')

Fixed submission:
def main():
    s = str(input())
    if s[0] == s[1] or s[1] == s[2] or s[2] == s[3]:
        print('Bad')
    else:
        print('Good')
            
main()
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
L=[list(map(int,input().split()) for _ in range(m)]
  
a=max(L)
b=min(M)
if a<=b:
  print(b-a+1)
else:
  print(0)

Fixed submission:
n,m=map(int,input().split())
L=[]
M=[]
for i in range(m):
  l,m=map(int,input().split())
  L.append(l)
  M.append(m)
  
a=max(L)
b=min(M)
if a<=b:
  print(b-a+1)
else:
  print(0)

Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
l=[]
m=[]
for i in range(m):
  ll,mm=map(int,input().split())
  l.append(ll)
  m.append(mm)
a=max(l)
b=min(m)
if a<=b:
  print(b-a+1)
else:
  print(0)

Fixed submission:
n,m=map(int,input().split())
L=[]
M=[]
for i in range(m):
  l,m=map(int,input().split())
  L.append(l)
  M.append(m)
  
a=max(L)
b=min(M)
if a<=b:
  print(b-a+1)
else:
  print(0)
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
for i in range(1,4):
  if (a*b*i)%2!=0:
    print("Yes")
	exit()
print("No")

Fixed submission:
a,b=map(int,input().split())
for i in range(1,4):
  if (a*b*i)%2!=0:
    print("Yes")
    exit()
print("No")
Buggy python submission (verdict: Runtime Error):
s=int(input())
ans=0
for i in range(4):
  if s[i]=="+":
    ans+=1
  else:
    ans-=1
print(ans)

Fixed submission:
s=input()
ans=0
for i in range(4):
  if s[i]=="+":
    ans+=1
  else:
    ans-=1
print(ans)
Buggy python submission (verdict: Runtime Error):
s=str(input());a=["A","K","I","H","A","B","A","R"]
if s=="AKIHABARA":
    print("YES")
elif len(s)<5:
    print("NO")
else:
    s=list(s)
    for i in range(len(a)):
        if s[i]!=a[i]:
           s.insert(i,"A")
        #print(s,a,i)
        if s==a or s==["A","K","I","H","A","B","A","R","A"]:
            print("YES")
            break
        else:
            pass
    else:
         print("NO")

Fixed submission:
s=str(input());a=["A","K","I","H","A","B","A","R"]
if s=="AKIHABARA":
    print("YES")
elif "K" not in s or "I" not in s or "H" not in s or "B" not in s or "R" not in s:
    print("NO")
else:
    s=list(s)
    for i in range(len(a)):
        if s[i]!=a[i]:
           s.insert(i,"A")
        #print(s,a,i)
        if s==a or s==["A","K","I","H","A","B","A","R","A"]:
            print("YES")
            break
        else:
            pass
    else:
         print("NO")
Buggy python submission (verdict: Runtime Error):
s=list(input())
if len(s)==26:
    print("None")
    exit()
a=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
s=set(s)
s=list(s)
s.sort()
for i in range(26):
    if a[i]!=s[i]:
        print(a[i])
        break
else:
    print("None")

Fixed submission:
s=input()
a=list("abcdefghijklmnopqrstuvwxyz")
for x in a:
    if x not in s:
        print(x)
        exit()
print("None")
Buggy python submission (verdict: Runtime Error):
w,a,b=map(int,input().split())
if a+w<b:
    print(b-a-w)
else:
  if a<=b+w and a+w>=b:
    print(0)
else:
    print(a-b-w)

Fixed submission:
w,a,b=map(int,input().split())
if a+w<b:
    print(b-a-w)
else:
  if a<=b+w and a+w>=b:
    print(0)
  else:
    print(a-b-w)
Buggy python submission (verdict: Runtime Error):
k,s=map(int,input().split())
ans=0
for x in range(k+1):
    for y in range(k+1):
        if 0<=s-x-y<=k:
            ans+=1
print(ans)

Fixed submission:
a,b,c=input().split(",")
print(a,b,c)
Buggy python submission (verdict: Runtime Error):
a,b,c=map(list,input().split())
print("".join("A",b[0],"C"))

Fixed submission:
print("A"+input()[8]+"C")

Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
print("A",b[0],"C")

Fixed submission:
print("A"+input()[8]+"C")
Buggy python submission (verdict: Runtime Error):
num = input()
if num % 9 == 0:
  print("yes")
else:
  print("no")

Fixed submission:
from sys import stdin, stdout
t = int(stdin.readline())
if t % 9 == 0:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
n = 1000
while N > n:
  n =+ 1000
print(N - n)

Fixed submission:
N = int(input())
n = 1000
while N > n:
    n += 1000
print(n - N)
Buggy python submission (verdict: Runtime Error):
N = int(input())
judge_list = []
judge = ['AC', 'WA', 'TLE', 'RE']
for i in range(N):
    judge_list.append(str(input()))
for k in judge:
    judge_dict[k] = judge_list.count(k)
print(f"AC x {judge_dict['AC']}")
print(f"WA x {judge_dict['WA']}")
print(f"TLE x {judge_dict['TLE']}")
print(f"RE x {judge_dict['RE']}")

Fixed submission:
N = int(input())
judge_list = []
judge = ['AC', 'WA', 'TLE', 'RE']
judge_dict = {'AC':0, 'WA':0, 'TLE':0, 'RE':0}
for i in range(N):
    judge_list.append(str(input()))
for k in judge:
    judge_dict[k] = judge_list.count(k)
print(f"AC x {judge_dict['AC']}")
print(f"WA x {judge_dict['WA']}")
print(f"TLE x {judge_dict['TLE']}")
print(f"RE x {judge_dict['RE']}")
Buggy python submission (verdict: Runtime Error):
x_list = [input()]
for i in range(5):
  if x_list[i] == 0:
    print(i)

Fixed submission:
x_list = list(map(int, input().split()))
for i in range(5):
    if x_list[i] == 0:
        print(i + 1)
Buggy python submission (verdict: Time Limit Exceeded):
import math

N = int(input())

for i in range(1, N + 1):
    cnt = 0
    for x in range(1, i + 1):
        for y in range(1, i + 1):
            if x * x + y * y + x * y >= i:
                continue
            a = i - (x * x + y * y + x * y)
            # z^2+z(x+y) - a = 0
            z = (-(x + y) + math.sqrt((x + y) ** 2 + 4 * a)) / 2
            if 1 <= z and z <= N and z.is_integer():
                cnt += 1
    print(cnt)



Fixed submission:
N = int(input())

N_MAX = 10 ** 4
cnt = [0] * (N_MAX + 1)

for x in range(1, N + 1):
    if x ** 2 > N:
        break
    for y in range(1, N + 1):
        if x ** 2 + y ** 2 + x * y > N:
            break
        for z in range(1, N + 1):
            a = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + x * z
            if a > N:
                break
            cnt[a] += 1

for i in range(1, N + 1):
    print(cnt[i])

Buggy python submission (verdict: Time Limit Exceeded):
import math

N = int(input())

for i in range(1, N + 1):
    cnt = 0
    for x in range(1, N + 1):
        for y in range(1, N + 1):
            if x * x + y * y + x * y >= i:
                continue
            a = i - (x * x + y * y + x * y)
            # z^2+z(x+y) - a = 0
            z = (-(x + y) + math.sqrt((x + y) ** 2 + 4 * a)) / 2
            if 1 <= z and z <= N and z.is_integer():
                cnt += 1
    print(cnt)



Fixed submission:
N = int(input())

N_MAX = 10 ** 4
cnt = [0] * (N_MAX + 1)

for x in range(1, N + 1):
    if x ** 2 > N:
        break
    for y in range(1, N + 1):
        if x ** 2 + y ** 2 + x * y > N:
            break
        for z in range(1, N + 1):
            a = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + x * z
            if a > N:
                break
            cnt[a] += 1

for i in range(1, N + 1):
    print(cnt[i])
Buggy python submission (verdict: Time Limit Exceeded):
S = input()

ans = 0
for i in range(len(S)):
    m = int(S[i])
    for j in range(i + 1, len(S)):
        m = (10 * m + int(S[j])) % 2019
        if m == 0:
            ans += 1

print(ans)


Fixed submission:
from collections import Counter

S = input()

ans = 0
mod_list = [0] * len(S)
mod_list[-1] = int(S[-1])
m = 1
for i in range(2, len(S) + 1):
    m = (10 * m) % 2019
    mod_list[-i] = (mod_list[-i + 1] + (int(S[-i]) * m)) % 2019

mod_counter = Counter(mod_list)
mod_counter[0] += 1

ans = 0
for _, v in mod_counter.items():
    ans += v * (v - 1) // 2

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
S = input()

ans = 0
for i in range(len(S)):
    m = int(S[i:i + 4]) % 2019
    if m == 0:
        ans += 1
    for j in range(i + 4, len(S)):
        m = (10 * m + int(S[j])) % 2019
        if m == 0:
            ans += 1

print(ans)


Fixed submission:
from collections import Counter

S = input()

ans = 0
mod_list = [0] * len(S)
mod_list[-1] = int(S[-1])
m = 1
for i in range(2, len(S) + 1):
    m = (10 * m) % 2019
    mod_list[-i] = (mod_list[-i + 1] + (int(S[-i]) * m)) % 2019

mod_counter = Counter(mod_list)
mod_counter[0] += 1

ans = 0
for _, v in mod_counter.items():
    ans += v * (v - 1) // 2

print(ans)
Buggy python submission (verdict: Runtime Error):
import math
import numpy as np

K = int(input())

dp = [[0] * 201 for _ in range(201)]
ans = 0
for a in range(1, K + 1):
    for b in range(1, K + 1):
        for c in range(1, K + 1):
            if dp[a][b] == 0:
                dp[a][b] = math.gcd(a, b)
            if dp[dp[a][b]][c] == 0:
                dp[dp[a][b]][c] = math.gcd(dp[a][b], c)
            ans += dp[dp[a][b]][c]

print(ans)


Fixed submission:
import math

K = int(input())

ans = 0
for a in range(1, K + 1):
    for b in range(1, K + 1):
        for c in range(1, K + 1):
            ans += math.gcd(math.gcd(a, b), c)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()

R = [0] * N
G = [0] * N
B = [0] * N

for i in range(1, N):
    if S[-i] == "R":
        R[-i] += R[-i + 1] + 1 if i != 1 else 1
        G[-i] += G[-i + 1]
        B[-i] += B[-i + 1]
    if S[-i] == "G":
        R[-i] += R[-i + 1]
        G[-i] += G[-i + 1] + 1 if i != 1 else 1
        B[-i] += B[-i + 1]
    if S[-i] == "B":
        R[-i] += R[-i + 1]
        G[-i] += G[-i + 1]
        B[-i] += B[-i + 1] + 1 if i != 1 else 1

ans = 0
for i in range(N):
    for j in range(i + 1, N):
        k = j + 1
        if k >= N:
            break
        if S[i] == S[j]:
            continue
        if not ("R" in S[i] + S[j]):
            ans += R[k]
            if R[k] > 0 and (2 * j - i) < N and S[2 * j - i] == "R":
                ans -= 1
        elif not ("G" in S[i] + S[j]):
            ans += G[k]
            if G[k] > 0 and (2 * j - i) < N and S[2 * j - i] == "G":
                ans -= 1
        else:
            ans += B[k]
            if B[k] > 0 and (2 * j - i) < N and S[2 * j - i] == "B":
                ans -= 1
print(ans)


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

R = [0] * N
G = [0] * N
B = [0] * N

for i in range(1, N):
    if S[-i] == "R":
        R[-i] += R[-i + 1] + 1 if i != 1 else 1
        G[-i] += G[-i + 1]
        B[-i] += B[-i + 1]
    if S[-i] == "G":
        R[-i] += R[-i + 1]
        G[-i] += G[-i + 1] + 1 if i != 1 else 1
        B[-i] += B[-i + 1]
    if S[-i] == "B":
        R[-i] += R[-i + 1]
        G[-i] += G[-i + 1]
        B[-i] += B[-i + 1] + 1 if i != 1 else 1

ans = 0
for i in range(N):
    for j in range(i + 1, N):
        k = j + 1
        if k >= N:
            break
        if S[i] == S[j]:
            continue
        if not ("R" in S[i] + S[j]):
            ans += R[k]
            if R[k] > 0 and (2 * j - i) < N and S[2 * j - i] == "R":
                ans -= 1
        elif not ("G" in S[i] + S[j]):
            ans += G[k]
            if G[k] > 0 and (2 * j - i) < N and S[2 * j - i] == "G":
                ans -= 1
        else:
            ans += B[k]
            if B[k] > 0 and (2 * j - i) < N and S[2 * j - i] == "B":
                ans -= 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
p = [int(s) for s in input().split()]

for i in range(n):
    p[i] = (1 + p[i]) / 2

ans = 0.0
for i in range(k, n + 1):
    ans = max(ans, sum(p[i - k:i]))

print(ans)


Fixed submission:
n, k = map(int, input().split())
p = [int(s) for s in input().split()]

for i in range(n):
    p[i] = (1 + p[i]) / 2

value = sum(p[0:k])
ans = value
for i in range(k, n):
    value = value + p[i] - p[i - k]
    ans = max(ans, value)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
H, W = map(int, input().split())

field = []
dist = [[float('inf')] * (W * H) for h in range(W * H)]

for _ in range(H):
    field.append(input())

weight = 1
for i in range(H):
    for j in range(W):
        if j + 1 < W and field[i][j] == '.' and field[i][j + 1] == '.':
            dist[W * i + j][W * i + j + 1] = weight
            dist[W * i + j + 1][W * i + j] = weight
        if i + 1 < H and field[i][j] == '.' and field[i + 1][j] == '.':
            dist[W * i + j][W * (i + 1) + j] = weight
            dist[W * (i + 1) + j][W * i + j] = weight


def warshall_floyd(d):
    for k in range(len(d)):
        for i in range(len(d)):
            for j in range(len(d)):
                d[i][j] = min(d[i][j], d[i][k] + d[k][j])


warshall_floyd(dist)

ans = 0
for i in range(H * W):
    for j in range(i + 1, H * W):
        if dist[i][j] != float('inf'):
            ans = max(ans, dist[i][j])

print(ans)


Fixed submission:
from collections import defaultdict
import heapq
import math

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

edges = defaultdict(list)
field = []

for _ in range(H):
    field.append(input())

weight = 1
for i in range(H):
    for j in range(W):
        if j + 1 < W and field[i][j] == '.' and field[i][j + 1] == '.':
            edges[W * i + j].append((W * i + j + 1, weight))
            edges[W * i + j + 1].append((W * i + j, weight))
        if i + 1 < H and field[i][j] == '.' and field[i + 1][j] == '.':
            edges[W * i + j].append((W * (i + 1) + j, weight))
            edges[W * (i + 1) + j].append((W * i + j, weight))


def dijkstra(s):
    que = []
    dist = [float('inf')] * (H * W)
    dist[s] = 0
    heapq.heappush(que, (0, s))

    while que:
        p = heapq.heappop(que)
        v = p[1]
        if dist[v] < p[0]:
            continue
        for i in range(len(edges[v])):
            e = edges[v][i]
            if dist[e[0]] > dist[v] + e[1]:
                dist[e[0]] = dist[v] + e[1]
                heapq.heappush(que, (dist[e[0]], e[0]))

    dist = [0 if d == float('inf') else d for d in dist]
    return dist


ans = 0
for i in range(H*W):
    ans = max(ans, max(dijkstra(i)))

print(ans)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())


a = [True] * (N)
for _ in range(M):
    a[int(input())-1] = False


mod = 10**9 + 7
dp = [0] * (N)
dp[0] = (1 if a[0] else 0)
dp[1] = (1 if a[1] else 0) + dp[0]
for i in range(2, N):
    if a[i]:
        dp[i] = (dp[i-1] + dp[i-2]) % mod

print(dp[N-1])


Fixed submission:
mod = 10**9 + 7
N, M = map(int, input().split())


a = [True] * (N+1)
for _ in range(M):
    a[int(input())] = False


dp = [0] * (N+1)
dp[0] = 1
for i in range(N+1):
    for j in range(1, 3):
        if (i+j) > N or a[i+j] == False:
            continue
        dp[i+j] += dp[i]
        dp[i+j] %= mod

print(dp[N])
Buggy python submission (verdict: Time Limit Exceeded):
H, W = map(int, input().split())

F = [input() for _ in range(H)]

L = [[0] * W for _ in range(H)]
R = [[0] * W for _ in range(H)]
U = [[0] * W for _ in range(H)]
D = [[0] * W for _ in range(H)]

for i in range(H):
    for j in range(W):
        if F[i][j] == "#":
            L[i][j] = 0
            U[i][j] = 0
        else:
            L[i][j] = L[i][j - 1] + 1 if j - 1 >= 0 else 1
            U[i][j] = U[i - 1][j] + 1 if i - 1 >= 0 else 1

        if F[i][-1 - j] == "#":
            R[i][-1 - j] = 0
        else:
            R[i][-1 - j] = R[i][-j] + 1 if j > 0 else 1

        if F[- 1 - i][j] == "#":
            D[- 1 - i][j] = 0
        else:
            D[- 1 - i][j] = D[-i][j] + 1 if i > 0 else 1

ans = 0
for i in range(H):
    for j in range(W):
        ans = max(ans, L[i][j] + R[i][j] + U[i][j] + D[i][j] - 3)

print(ans)


Fixed submission:
H, W = map(int, input().split())

F = [input() for _ in range(H)]

L = [[0] * W for _ in range(H)]
R = [[0] * W for _ in range(H)]
U = [[0] * W for _ in range(H)]
D = [[0] * W for _ in range(H)]

for i in range(H):
    for j in range(W):
        if F[i][j] == "#":
            L[i][j] = 0
            U[i][j] = 0
        else:
            L[i][j] = L[i][j - 1] + 1 if j - 1 >= 0 else 1
            U[i][j] = U[i - 1][j] + 1 if i - 1 >= 0 else 1

        if F[i][-1 - j] == "#":
            R[i][-1 - j] = 0
        else:
            R[i][-1 - j] = R[i][-j] + 1 if j > 0 else 1

        if F[- 1 - i][j] == "#":
            D[- 1 - i][j] = 0
        else:
            D[- 1 - i][j] = D[-i][j] + 1 if i > 0 else 1

ans = 0
for i in range(H):
    for j in range(W):
        ans = max(ans, L[i][j] + R[i][j] + U[i][j] + D[i][j] - 3)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input());A = list(map(int,input().split()));ans = 1

for i in range(N):ans *= A[i]
 
if ans>10**18:print(-1);
else:print(ans)

Fixed submission:
import sys
N = int(input())
x = list(map(int,input().split()))
 
z = 1
if 0 in x:
  print(0)
  sys.exit()
  
for a in x:
  z = a*z
  if z > 10**18:
    print(-1)
    sys.exit()
  
print(z)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))

ans = 1
for i in range(N):
  ans *= A[i]

if ans>10**18:
  print(-1)
else:
  print(ans)

Fixed submission:
import sys
N = int(input())
x = list(map(int,input().split()))
 
z = 1
if 0 in x:
  print(0)
  sys.exit()
  
for a in x:
  z = a*z
  if z > 10**18:
    print(-1)
    sys.exit()
  
print(z)

Buggy python submission (verdict: Runtime Error):
N = input()
x = list(map(int,input().split()))
 
z = 1
if 0 in x:
  print(0)

for a in x:
  z *= a
  if z > 1000000000000000:
    print(-1)
    return
  
print(z)

Fixed submission:
import sys
N = int(input())
x = list(map(int,input().split()))
 
z = 1
if 0 in x:
  print(0)
  sys.exit()
  
for a in x:
  z = a*z
  if z > 10**18:
    print(-1)
    sys.exit()
  
print(z)

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

z = 1	
for a in x:
  z *= a
  if z >= 10**18:
    break
    print(-1)
  
if z<10**18
  print(z)

Fixed submission:
import sys
N = int(input())
x = list(map(int,input().split()))
 
z = 1
if 0 in x:
  print(0)
  sys.exit()
  
for a in x:
  z = a*z
  if z > 10**18:
    print(-1)
    sys.exit()
  
print(z)
Buggy python submission (verdict: Runtime Error):
N = input()

a = int(N[len(N)-1])

if a == 3:
  print(bon)
else if a==0 or a==1 or a==6 or a==8:
  print(pon)
else:
  print(hon)

Fixed submission:
N = input()
 
a = int(N[len(N)-1])
 
if a == 3:
  print('bon')
elif a==0 or a==1 or a==6 or a==8:
  print('pon')
else:
  print('hon')