Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
"""
python3 a.py < input.txt
"""
import math
import itertools as it
import heapq

N=int(input())
S=input()

T=[S[0]]
U=[1]
for si in S[1:]:
    if T[-1] == si:
        U[-1] = U[-1]+1
    else:
        T.append(si)
        U.append(1)
M=len(T)
B=[U[i] if T[i] == "#" else 0 for i in range(M)]
W=[U[i] if T[i] == "." else 0 for i in range(M)]
l=[sum(B), sum(W)]
for i in range(M):
    if T[i] == "#":
        l.append(sum(B[:i]) + sum(W[min(i+1, M-1):]))

#print(S)
#print(T)
#print(U)
#print(B)
#print(W)
#print(l)
print(min(l))

Fixed submission:
"""
python3 a.py < input.txt
"""
import math
import itertools as it
import heapq

N=int(input())
S=input()

T=[S[0]]
U=[1]
for si in S[1:]:
    if T[-1] == si:
        U[-1] = U[-1]+1
    else:
        T.append(si)
        U.append(1)
M=len(T)

B=[U[i] if T[i] == "#" else 0 for i in range(M)]
sumB=[B[0]]
for b in B[1:]:
    sumB.append(sumB[-1]+b)

W=[U[i] if T[i] == "." else 0 for i in range(M)]
sumW=[W[-1]]
for w in reversed(W[:-1]):
    sumW.append(sumW[-1]+w)
sumW=list(reversed(sumW))

l=[sum(B), sum(W)]
for i in range(M):
    if T[i] == "#":
        l.append(sumB[max(0, i-1)] + sumW[min(i+1, M-1)])

#print(S)
#print(T)
#print("U   ",U)
#print("B   ",B)
#print("sumB",sumB)
#print("W   ",W)
#print("sumW",sumW)
#print("l   ",l)
print(min(l))

Buggy python submission (verdict: Runtime Error):
"""
python3 a.py < input.txt
"""
import math
import itertools as it
import heapq

N=int(input())
S=input()

T=[S[0]]
U=[1]
for si in S[1:]:
    if T[-1] == si:
        U[-1] = U[-1]+1
    else:
        T.append(si)
        U.append(1)

lb=None
for i in reversed(range(len(T))):
    if T[i] == "#":
        lb=i
rb=None
for i in range(len(T)):
    if T[i] == "#":
        rb=i
rw=None
for i in range(len(T)):
    if T[i] == ".":
        rw=i

if lb == None or rw == None:
    print(0)
    exit()

nb=0
for i in range(lb, len(T)):
    if T[i] == ".":
        nb = nb+U[i]
nw=0
for i in range(rw):
    if T[i] == "#":
        nw = nw+U[i]
nx=0
for i in range(lb, rb):
    if T[i] == "#":
        nx = nx+U[i]
for i in range(rw, len(T)):
    if T[i] ==x".":
        nx = nw+U[i]
print(S)
print(min([nb, nw, nx]))


Fixed submission:
"""
python3 a.py < input.txt
"""
import math
import itertools as it
import heapq

N=int(input())
S=input()

T=[S[0]]
U=[1]
for si in S[1:]:
    if T[-1] == si:
        U[-1] = U[-1]+1
    else:
        T.append(si)
        U.append(1)
M=len(T)

B=[U[i] if T[i] == "#" else 0 for i in range(M)]
sumB=[B[0]]
for b in B[1:]:
    sumB.append(sumB[-1]+b)

W=[U[i] if T[i] == "." else 0 for i in range(M)]
sumW=[W[-1]]
for w in reversed(W[:-1]):
    sumW.append(sumW[-1]+w)
sumW=list(reversed(sumW))

l=[sum(B), sum(W)]
for i in range(M):
    if T[i] == "#":
        l.append(sumB[max(0, i-1)] + sumW[min(i+1, M-1)])

#print(S)
#print(T)
#print("U   ",U)
#print("B   ",B)
#print("sumB",sumB)
#print("W   ",W)
#print("sumW",sumW)
#print("l   ",l)
print(min(l))
Buggy python submission (verdict: Time Limit Exceeded):
"""
python3 c.py < input.txt
"""
import math
import itertools as it
import heapq

N,K=map(int, input().split())
S=input()
T=[S[0]]
U=[1]
for c in S[1:]:
    if c==T[-1]:
        U[-1]=U[-1]+1
    else:
        T.append(c)
        U.append(1) 
M=len(U)
V=[U[0]]
for i in range(1,M):
    V.append(V[-1]+U[i])

X=[]
for l in range(M):
    if T[l]=="0":
        ll=max(0, l-1)
        r=max(l, min(M-1, l+2*(K-1)+1))
        X.append((ll, r))
    else:
        X.append((0,0))
#print(T)
#print(U)
#print(V)
#print(X)
#print([([0]+V)[r+1]-([0]+V)[l] for (l,r) in X])
print(max([([0]+V)[r+1]-([0]+V)[l] for (l,r) in X]))

Fixed submission:
"""
python3 c.py < input.txt
"""
import math
import itertools as it
import heapq

N,K=map(int, input().split())
S=input()
T=[S[0]]
U=[1]
for c in S[1:]:
    if c==T[-1]:
        U[-1]=U[-1]+1
    else:
        T.append(c)
        U.append(1) 
M=len(U)
V=[U[0]]
for i in range(1,M):
    V.append(V[-1]+U[i])

X=[]
for l in range(M):
    if T[l]=="0":
        ll=max(0, l-1)
        r=max(l, min(M-1, l+2*(K-1)+1))
        X.append((ll, r))
    else:
        X.append((0,0))
V=[0]+V
#print(T)
#print(U)
#print(V)
#print(X)
#print([([0]+V)[r+1]-([0]+V)[l] for (l,r) in X])
print(max([V[r+1]-V[l] for (l,r) in X]))
Buggy python submission (verdict: Time Limit Exceeded):
import re
N,Q=[int(s) for s in input().split()]
S=input()
for i in range(Q):
    (li, ri)=[int(s) for s in input().split()]
    s=S[li-1:ri]
    print(len(re.findall("AC", s)))

Fixed submission:
import re
N,Q=[int(s) for s in input().split()]
S=input()
table=[1 if S[0:2] == "AC" else 0]
for i in range(1, N-1):
    table.append(table[i-1]+(1 if S[i:i+2] == "AC" else 0))
table.append(table[-1])
for i in range(Q):
    (li, ri)=[int(s) for s in input().split()]
    print(table[ri-2]-(table[li-2] if li > 1 else 0))
Buggy python submission (verdict: Time Limit Exceeded):
s=input()

stack=[]
for si in s:
    stack = stack + [si]
    if len(stack) >= 2 and stack[-1] != stack[-2]:
        del stack[-1]
        del stack[-1]
print(len(s)-len(stack))

Fixed submission:
s=input()

stack=[]
for si in s:
    stack.append(si)
    if len(stack) >= 2 and stack[-1] != stack[-2]:
        del stack[-1]
        del stack[-1]
print(len(s)-len(stack))

Buggy python submission (verdict: Time Limit Exceeded):
import re
s=input()
N=len(s)
while True:
    n = len(s)
    s = s.replace("10", "")
    s = s.replace("01", "")
    if n == len(s):
        print(N-n)
        break

Fixed submission:
s=input()

stack=[]
for si in s:
    stack.append(si)
    if len(stack) >= 2 and stack[-1] != stack[-2]:
        del stack[-1]
        del stack[-1]
print(len(s)-len(stack))

Buggy python submission (verdict: Time Limit Exceeded):
s=[int(i) for i in input()]
n=len(s)
updated=True
while updated:
    updated=False
    for i in range(len(s)-1):
        if i not in range(len(s)-1):
            break
        while i in range(len(s)-1) and s[i] != s[i+1]:
            del s[i]
            del s[i]
            updated=True

print(n-len(s))


Fixed submission:
s=input()

stack=[]
for si in s:
    stack.append(si)
    if len(stack) >= 2 and stack[-1] != stack[-2]:
        del stack[-1]
        del stack[-1]
print(len(s)-len(stack))

Buggy python submission (verdict: Time Limit Exceeded):
s=[int(i) for i in input()]
n=len(s)
updated=True
while updated:
    updated=False
    for i in range(len(s)-1):
        while i in range(len(s)-1) and s[i] != s[i+1]:
            del s[i]
            del s[i]
            updated=True

print(n-len(s))


Fixed submission:
s=input()

stack=[]
for si in s:
    stack.append(si)
    if len(stack) >= 2 and stack[-1] != stack[-2]:
        del stack[-1]
        del stack[-1]
print(len(s)-len(stack))

Buggy python submission (verdict: Time Limit Exceeded):
s=[int(i) for i in input()]
n=len(s)
updated=True
while updated:
    updated=False
    for i in range(len(s)-1):
        if s[i] != s[i+1]:
            del s[i]
            del s[i]
            updated=True
            break

print(n-len(s))


Fixed submission:
s=input()

stack=[]
for si in s:
    stack.append(si)
    if len(stack) >= 2 and stack[-1] != stack[-2]:
        del stack[-1]
        del stack[-1]
print(len(s)-len(stack))
Buggy python submission (verdict: Runtime Error):

n, m = map(int, input().split(' '))
ai = list(sorted(map(int, input().split(' '))))
required_maches = {1: 2, 2: 5, 3: 5, 4: 4, 5: 5, 6: 6, 7: 3, 8: 7, 9: 6}

used_numbers = dict()

def evaluate(l):
    if l == None:
        return -9999999999999999999999999999999
    if l == []:
        return 0
    return int(''.join(reversed([str(i) for i in sorted(l)])))

min_maches = min([required_maches[x] for x in ai])
def find(matches_count_to_use):
    if matches_count_to_use not in used_numbers:
        if matches_count_to_use < 0:
            used_numbers[matches_count_to_use] = None
        elif matches_count_to_use == 0:
            used_numbers[matches_count_to_use] = []
        else:
            candidates = list(filter(
                lambda x: find(matches_count_to_use - required_maches[x]) != None, ai))
            if len(candidates) == 0:
                used_numbers[matches_count_to_use] = None
            else:
                number_to_use = max(candidates,
                    key=lambda x: evaluate(find(matches_count_to_use - required_maches[x]) + [x]))
                prev = find(matches_count_to_use - required_maches[number_to_use])
                used_numbers[matches_count_to_use] = prev + [number_to_use]
                
    return used_numbers[matches_count_to_use]
    
print(evaluate(find(n)))

Fixed submission:
a, b = map(int, input().split(' '))
if b%a == 0 :
    print(a+b)
else:
    print(b-a)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
calc = 0
for i in range(n):
    calc += ((sum(a[i+1:]) % 1000000007) * a[i]) % 1000000007
calc %= 1000000007
print(calc)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
sum_a = sum(a)
calc = 0
for i in range(n):
    sum_a -= a[i]
    calc += ((sum_a % 1000000007) * a[i]) % 1000000007
calc %= 1000000007
print(calc)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
calc = 0
for i in range(n):
    for j in range(i+1, n):
        calc += (a[i] * a[j]) % 1000000007
calc %= 1000000007
print(calc)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
sum_a = sum(a)
calc = 0
for i in range(n):
    sum_a -= a[i]
    calc += ((sum_a % 1000000007) * a[i]) % 1000000007
calc %= 1000000007
print(calc)
Buggy python submission (verdict: Time Limit Exceeded):
import copy
n, k = map(int, input().split())
a = list(map(int, input().split()))
memo = copy.copy(a)
for i in range(k, n+1, 1):
    for j in range(i-k, i-1, 1):
        memo[i-1] *= a[j]
for i in range(k, n, 1):
    if memo[i-1] < memo[i]:
        print("Yes")
    else:
        print("No")

Fixed submission:
n, k = 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")

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
memo = [1 for i in range(n)]
a = list(map(int, input().split()))
for i in range(k, n+1, 1):
    for j in range(i-k, i, 1):
        memo[i-1] *= a[j]
for i in range(k, n, 1):
    if memo[i-1] < memo[i]:
        print("Yes")
    else:
        print("No")

Fixed submission:
n, k = 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")
Buggy python submission (verdict: Time Limit Exceeded):
n = []
for z in range(1, 59, 1):
    for y in range(1, 59, 1):
        for x in range(1, 59, 1):
            tmp = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
            if x ** 2 + y ** 2 + z ** 2 > 10 ** 4:
                break
            else:
                n.append(tmp)
N = int(input())
for i in range(1, N+1, 1):
    print(n.count(i))

Fixed submission:
n = [0 for i in range(10001)]
for z in range(1, 100, 1):
    for y in range(1, 100, 1):
        for x in range(1, 100, 1):
            tmp = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
            if tmp > 10 ** 4:
                break
            else:
                n[tmp] += 1
N = int(input())
for i in range(1, N+1, 1):
    print(n[i])

Buggy python submission (verdict: Time Limit Exceeded):
n = []
for z in range(1, 100, 1):
    for y in range(1, 100, 1):
        for x in range(1, 100, 1):
            tmp = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
            if x ** 2 + y ** 2 + z ** 2 > 10 ** 4:
                break
            else:
                n.append(tmp)
N = int(input())
for i in range(1, N+1, 1):
    print(n.count(i))

Fixed submission:
n = [0 for i in range(10001)]
for z in range(1, 100, 1):
    for y in range(1, 100, 1):
        for x in range(1, 100, 1):
            tmp = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
            if tmp > 10 ** 4:
                break
            else:
                n[tmp] += 1
N = int(input())
for i in range(1, N+1, 1):
    print(n[i])
Buggy python submission (verdict: Runtime Error):
x, n = map(int, input().split())
if n <= 0:
    print(x)
else:
    tbl = [0 for i in range(101)]
    data_in = input().split()
    for num in data_in:
        tbl[int(num)] = 1
    for i in range(1, 101, 1):
        if (x-i >= 0) and (tbl[x-i] == 0):
            print(x-i)
            break
        if (x+i <= 101) and (tbl[x+i] == 0):
            print(x+i)
            break

Fixed submission:
x, n = map(int, input().split())
p = list(map(int, input().split()))
for base in range(x+1):
    if p.count(x+base*-1) == 0:
        print(x+base*-1)
        break
    if p.count(x+base) == 0:
        print(x+base)
        break
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
h = list(map(int, input().split()))
for i in range(k):
	h.remove(max(h))
	if len(h) == 0:
		break
print(sum(h))

Fixed submission:
n, k = map(int, input().split())
h = list(map(int, input().split()))
h.sort(reverse=True)
h = h[k:]
print(sum(h))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
power = 1
for i in range(1, n + 1):
	power *= i
print(power % (10 ** 9 + 7))


Fixed submission:
import math

n = int(input())
print(math.factorial(n) % (10 ** 9 + 7))
Buggy python submission (verdict: Time Limit Exceeded):
a, b = map(int, input().split(' '))
result = 1
for i in range(a, b+1):
	result *= i
print('Positive' if result > 0 else 'Zero' if result == 0 else 'Negative')

Fixed submission:
a, b = map(int, input().split(' '))
result = 'Positive'
if a <= 0 <= b:
	result = 'Zero'
elif b < 0 and (b - a) % 2 == 0:
	result = 'Negative'
print(result)
Buggy python submission (verdict: Runtime Error):
import numpy as np
X = int(input())

t = np.arange(-1000000, 1000001, 1)
t = t**5
S = set(t)

for B in range(-100000,100001,1):
    if X+B**5 in S:
        print("%d %d"%((X+B**5)**0.2, B))
        break


Fixed submission:
import numpy as np
X = int(input())

t = np.arange(0, 2000001, 1)
t = t**5
S = set(t)

for B in range(0,200001,1):
    if X+B**5 in S:
        print("%d %d"%((X+B**5)**0.2, B))
        break
    if X-B**5 in S:
        print("%d %d"%((X-B**5)**0.2, -B))
        break

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
X = int(input())

t = np.arange(-1000000, 1000001, 1)
t = t**5
S = set(t)

for B in t**5:
    if X+B**5 in S:
        print("%d %d"%((X+B**5)**0.2, B))
        break


Fixed submission:
import numpy as np
X = int(input())

t = np.arange(0, 2000001, 1)
t = t**5
S = set(t)

for B in range(0,200001,1):
    if X+B**5 in S:
        print("%d %d"%((X+B**5)**0.2, B))
        break
    if X-B**5 in S:
        print("%d %d"%((X-B**5)**0.2, -B))
        break

Buggy python submission (verdict: Runtime Error):
import numpy as np
X = int(input())

t = np.arange(-1000000, 1000000, 1)
t = t**5
S = set(t)

for B in range(-1000000, 1000001, 1):
    if X+B**5 in S:
        print("%d %d"%((X+B**5)**0.2, B))
        break


Fixed submission:
import numpy as np
X = int(input())

t = np.arange(0, 2000001, 1)
t = t**5
S = set(t)

for B in range(0,200001,1):
    if X+B**5 in S:
        print("%d %d"%((X+B**5)**0.2, B))
        break
    if X-B**5 in S:
        print("%d %d"%((X-B**5)**0.2, -B))
        break

Buggy python submission (verdict: Runtime Error):
import numpy as np
X = int(input())

t = np.arange(-600000, 600000, 1)
t = t**5
S = set(t)

for B in range(-600000, 600001, 1):
    if X+B**5 in S:
        print("%d %d"%((X+B**5)**0.2, B))
        break


Fixed submission:
import numpy as np
X = int(input())

t = np.arange(0, 2000001, 1)
t = t**5
S = set(t)

for B in range(0,200001,1):
    if X+B**5 in S:
        print("%d %d"%((X+B**5)**0.2, B))
        break
    if X-B**5 in S:
        print("%d %d"%((X-B**5)**0.2, -B))
        break

Buggy python submission (verdict: Runtime Error):
import numpy as np
X = int(input())

t = np.arange(-100000, 100000, 1)
t = t**5
S = set(t)

for B in range(-100000, 100001, 1):
    if X+B**5 in S:
        print("%d %d"%((X+B**5)**0.2, B))
        break


Fixed submission:
import numpy as np
X = int(input())

t = np.arange(0, 2000001, 1)
t = t**5
S = set(t)

for B in range(0,200001,1):
    if X+B**5 in S:
        print("%d %d"%((X+B**5)**0.2, B))
        break
    if X-B**5 in S:
        print("%d %d"%((X-B**5)**0.2, -B))
        break
Buggy python submission (verdict: Runtime Error):
import math

def main():
    A, B = [int(i) for i in input().split()]

    print(int(A*B/math.gcd(A,B)))

if __name__=="__main__":
    main()


Fixed submission:

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def main():
    A, B = [int(i) for i in input().split()]

    print(int(A*B/gcd(A,B)))


    
if __name__=="__main__":
    main()
Buggy python submission (verdict: Runtime Error):
    S=input()
    T=input()
    cnt=0
    for i in range(3):
      if S[i]==T[i]:
        cnt+=1
    print(cnt)

Fixed submission:
S=input()
T=input()
cnt=0
for i in range(3):
  if S[i]==T[i]:
    cnt+=1
print(cnt)

Buggy python submission (verdict: Runtime Error):
S=input()
T=input()
cnt=0
for i in range(3):
  if S[i]==T[i]:
    cnt++
print(cnt)

Fixed submission:
S=input()
T=input()
cnt=0
for i in range(3):
  if S[i]==T[i]:
    cnt+=1
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N, K = [int(i) for i in input().split()]
    h = [int(i)for i in  input().split()]

    d=[1e16]*N
    d[0]=0
    for i in range(1,N):
        from_num=max(0, i-K)
        for j in range(from_num, i):
            d[i]=min([d[i], abs(h[i]-h[j])+d[j]])
            
    print(d[-1])

if __name__=="__main__":
    main()


Fixed submission:
N, K = [int(i) for i in input().split()]
h = [int(i)for i in  input().split()]

d=[1e16]*N
d[0]=0
for i in range(1,N):
    from_num=max(0, i-K)
    for j in range(from_num, i):
        d[i]=min([d[i], abs(h[i]-h[j])+d[j]])

print(d[-1])

Buggy python submission (verdict: Time Limit Exceeded):
N, K = [int(i) for i in input().split()]
h = [int(i)for i in  input().split()]

d=[1e16]*N
d[0]=0
for i in range(1,N):
    from_num=max(0, i-K)
    for j in range(from_num, i):
        d[i]=min([d[i], abs(h[i]-h[j])+d[j]])

print(d[-1])


Fixed submission:
N, K = [int(i) for i in input().split()]
h = [int(i)for i in  input().split()]

d=[1e16]*N
d[0]=0
for i in range(1,N):
    from_num=max(0, i-K)
    for j in range(from_num, i):
        d[i]=min([d[i], abs(h[i]-h[j])+d[j]])

print(d[-1])

Buggy python submission (verdict: Time Limit Exceeded):
N, K = [int(i) for i in input().split()]
h = [int(i)for i in  input().split()]

d=[0]*N
for i in range(1,N):
    from_num=max(0, i-K)
    d[i]=min([abs(h[i]-h[j])+d[j] for j in range(from_num, i)])

print(d[-1])


Fixed submission:
N, K = [int(i) for i in input().split()]
h = [int(i)for i in  input().split()]

d=[1e16]*N
d[0]=0
for i in range(1,N):
    from_num=max(0, i-K)
    for j in range(from_num, i):
        d[i]=min([d[i], abs(h[i]-h[j])+d[j]])

print(d[-1])
Buggy python submission (verdict: Runtime Error):
N = int(input())
A=[]
for i in range(N):
    A += [int(input())]

sort(A)
print(sum(A) - A[N-1]//2)

Fixed submission:
N = int(input())
A=[]
for i in range(N):
    A += [int(input())]

A.sort()
print(sum(A) - A[N-1]//2)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A=[]
for i in range(N):
    A += [int(input())]

sort(A)
print(sum(A) - A[-1]/2)

Fixed submission:
N = int(input())
A=[]
for i in range(N):
    A += [int(input())]

A.sort()
print(sum(A) - A[N-1]//2)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = [int(i) for i in input().split()]
sort(A)
print(sum(A) - A[-1]/2)

Fixed submission:
N = int(input())
A=[]
for i in range(N):
    A += [int(input())]

A.sort()
print(sum(A) - A[N-1]//2)
Buggy python submission (verdict: Runtime Error):
H,W =[int(i) for i in input().split()]
if H*W=1:
    print(1)
elif H==1 and W!=1:
    print(max(0, W-2))
elif W==1 and H!=1:
    print(max(0, H-2))
else:
    print(max(H-2, 0)*max(W-2, 0))


Fixed submission:
H,W =[int(i) for i in input().split()]
if H*W==1:
    print(1)
elif H==1 and W!=1:
    print(max(0, W-2))
elif W==1 and H!=1:
    print(max(0, H-2))
else:
    print(max(H-2, 0)*max(W-2, 0))

Buggy python submission (verdict: Runtime Error):
H, W =[int(i) for i in input().split()]
if H*W=1:
     print(1)
elif H==1 and W!=1:
     print(max(0, W-2))
elif W==1 and H!=1:
     print(max(0, H-2))
else:
     print(max(H-2, 0)*max(W-2, 0))

Fixed submission:
H,W =[int(i) for i in input().split()]
if H*W==1:
    print(1)
elif H==1 and W!=1:
    print(max(0, W-2))
elif W==1 and H!=1:
    print(max(0, H-2))
else:
    print(max(H-2, 0)*max(W-2, 0))

Buggy python submission (verdict: Runtime Error):
    H, W =[int(i) for i in input().split()]
    if H==1 and W!=1:
      print(max(0, W-2))
    elif W==1 and H!=1:
      print(max(0, H-2))
    else:
      print(max(H-2, 0)*max(W-2, 0))

Fixed submission:
H,W =[int(i) for i in input().split()]
if H*W==1:
    print(1)
elif H==1 and W!=1:
    print(max(0, W-2))
elif W==1 and H!=1:
    print(max(0, H-2))
else:
    print(max(H-2, 0)*max(W-2, 0))
Buggy python submission (verdict: Runtime Error):
import sys

argvs = sys.argv

def main(_old, _fee):
  if int(_old) >= 13:
    return int(_fee)
  elif 6 <= int(_old) <= 12:
    return int(_fee) / 2
  else:
    return 0
  
if __name__ == '__main__':
  print(main(argvs[1], argvs[2]))

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

def main(_old, _fee):
    if int(_old) >= 13:
        return int(_fee)
    elif 6 <= int(_old) <= 12:
        return int(_fee) // 2
    else:
        return 0

if __name__ == '__main__':
    print(main(a, b))
Buggy python submission (verdict: Runtime Error):
import math

X,A=map(int,input().split())

if X<A:
	print(0)
else:
	print(10)

Fixed submission:
S=input()

tmp=""
for i in range(len(S)):
	if tmp==S[i]:
		print("Bad")
		break
	else:
		tmp=S[i]
	if i==len(S)-1:
		print("Good")
Buggy python submission (verdict: Runtime Error):
W,H,x,y=map(int,input().split())

print(H*W/2,end=" ")
if x==W/2 and y==H/w:
	print(1)
else:
	print(0)

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

print(H*W/2,end=" ")
if x==W/2 and y==H/2:
	print(1)
else:
	print(0)
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
def func(a, i):
    return {a[0]:i, a[1]:i+1, a[2]:i+2}
A = {}
for i in range(3):
    A.update(func(input().split(), 3*i))
N = int(input())
b = [A.get(input(), -1) for _ in range(N)]
bingo = [[0, 1, 2], [3, 4, 5], [6, 7, 8],
         [0, 3, 6], [1, 4, 7], [2, 5, 8],
         [0, 4, 8], [2, 4, 6]]
for i in bingo:
    if set(i) <= set(b):
        print("Yes")
        break
else:
    print("No")

Fixed submission:
#!/usr/bin/env python3
N = int(input())
print((N + 1) // 2)
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
a, b = input().split(" ")
for i in range(a):
    a += a
for i in range(b):
    b += b
print(sorted([a, b])[0])

Fixed submission:
#!/usr/bin/env python3
a, b = input().split(" ")
A = a * int(b)
B = b * int(a)
print(sorted([A, B])[0])
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
N = input()
P = list(map(int, input().split(" ")))
count = 0
for i in range(len(P)):
    for j in range(i):
        if P[j] < P[i]:
            break
    else:
        count += 1
print(count)

Fixed submission:
#!/usr/bin/env python3
N = input()
P = list(map(int, input().split(" ")))
count = 0
minimum = P[0]
for i in range(len(P)):
    if P[i] <= minimum:
        count += 1
        minimum = P[i]
print(count)
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
from fractions import gcd
N = input()
A = list(map(int, input().split(" ")))
def lcm(x, y):
    return (x * y) // gcd(x, y)
tmp = 1
for i in A:
    tmp = lcm(tmp, i)
print(int(sum([tmp / i for i in A]) % (10**9 + 7)))

Fixed submission:
#!/usr/bin/env python3
from fractions import gcd
N = input()
A = list(map(int, input().split(" ")))
def lcm(x, y):
    return (x * y) // gcd(x, y)
tmp = 1
for i in A:
    tmp = lcm(tmp, i)
print(sum([tmp // i for i in A]) % (10**9 + 7))