Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
w, h = map(int, input().split())
field = [list(input()) for _ in range(h)]

for y in range(h):
    for x in range(w):
        if field[y][x] == "#":
            try:
                if("#" in [field[y + 1][x], field[y - 1][x], field[y][x + 1], field[y][x - 1]]):
                    pass
                else:
                    print("No")
                    quit()
            except IndexError:
                False

print("Yes")

Fixed submission:
h, w = map(int, input().split())
field = []
field.append(list("." * (w + 2)))
for _ in range(h):
    field.append(list("." + input() + "."))
field.append(list("." * (w + 2)))

for y in range(1, h + 1):
    for x in range(1, w + 1):
        if field[y][x] == "#":
                if("#" in [field[y + 1][x], field[y - 1][x], field[y][x + 1], field[y][x - 1]]):
                    pass
                else:
                    print("No")
                    quit()

print("Yes")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
x = list(map(int, input().split()))
x_sorted = sorted(x)

for i, num in enumerate(x):
    x_copy = x.copy()
    x_copy.pop(i)
    x_copy = sorted(x_copy)
    print(x_copy[len(x_copy) // 2])

Fixed submission:
n = int(input())
x = list(map(int, input().split()))
x_sorted = sorted(x)
target = x_sorted[n // 2 - 1]

for num in x:
    if num <= target:
        print(x_sorted[n // 2])
    else:
        print(x_sorted[n // 2 - 1])
Buggy python submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
ls = list(range(a, b + 1))
lsRe = ls[::-1]
s = set()

if len(ls) > k:
    for i in range(k):
        s.add(ls[i])
        s.add(lsRe[i])
else:
    print(*ls, sep="\n")
    quit()

s = sorted(s)
print(*s, sep="\n")


Fixed submission:
a, b, k = map(int, input().split())
s = set()
if b - a == 0:
    print(a)
elif b - a + 1 <= k:
    print(*range(a, b + 1), sep="\n")
else:
    for i in range(k):
        s.add(a + i)
        s.add(b - i)
    s = sorted(s)
    print(*s, sep="\n")

Buggy python submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
ls = list(range(a, b + 1))
lsRe = ls[::-1]
s = set()

if len(ls) > k:
    for i in range(k):
        s.add(ls[i])
        s.add(lsRe[i])
else:
    print("ls", *ls, sep="\n")
    quit()

s = sorted(s)
print("set", *s, sep="\n")


Fixed submission:
a, b, k = map(int, input().split())
s = set()
if b - a == 0:
    print(a)
elif b - a + 1 <= k:
    print(*range(a, b + 1), sep="\n")
else:
    for i in range(k):
        s.add(a + i)
        s.add(b - i)
    s = sorted(s)
    print(*s, sep="\n")

Buggy python submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
ls = list(range(a, b + 1))
s = set()

if len(ls) > k:
    for i in range(k):
        s.add(ls[i])
        s.add(ls[len(ls) - (i + 1)])
else:
    print(*ls, sep="\n")
    quit()

print(*s, sep="\n")


Fixed submission:
a, b, k = map(int, input().split())
s = set()
if b - a == 0:
    print(a)
elif b - a + 1 <= k:
    print(*range(a, b + 1), sep="\n")
else:
    for i in range(k):
        s.add(a + i)
        s.add(b - i)
    s = sorted(s)
    print(*s, sep="\n")
Buggy python submission (verdict: Time Limit Exceeded):
import re
import itertools

n = int(input())
ls = [input() for _ in range(n)]
new_ls = []
ans = 0

for name in ls:
    if re.match(r"[MARCH]", name):
        new_ls.append(name[:1])

comb_ls = list(itertools.combinations(new_ls, 3))


if new_ls:
    for comb in comb_ls:
        s = set(comb)
        if len(s) == 3:
            ans += 1
    print(ans)
else:
    print(0)
    quit()


Fixed submission:
import itertools
n = int(input())
ls = [input()[:1] for _ in range(n)]
ans = 0
cmb = list(itertools.combinations(list("MARCH"), 3))

for c in cmb:
    ans += ls.count(c[0]) * ls.count(c[1]) * ls.count(c[2])

print(ans)
Buggy python submission (verdict: Runtime Error):
a,b = map(int, input())
if a * b % 2 == 0:
  print("Even")
else:
  print("Odd")

Fixed submission:
a,b = map(int, input().split())
if (a * b) % 2 == 0:
  print("Even")
else:
  print("Odd")
Buggy python submission (verdict: Time Limit Exceeded):
n, y = map(int, input().split())


def main():
    for a in range(n + 1):
        for b in range(n - a + 1):
            for c in range(n - a - b + 1):
                if (a * 1000 + b * 5000 + c * 10000 == y) & (a + b + c == n):
                    return print(c, b, a)
    return print("-1 -1 -1")


main()

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


def main():
    for a in range(n + 1):
        for b in range(n - a + 1):
            c = n - a - b
            if (a * 1000 + b * 5000 + c * 10000 == y) & (a + b + c == n):
                return print(c, b, a)
    return print("-1 -1 -1")


main()
Buggy python submission (verdict: Time Limit Exceeded):
import re

s = input()

while s:
    r = re.search(r"(dream|dreamer|erase|eraser)$", s)
    if r:
        s = s[:r.start()]
    else:
        print("NO")
        break
else:
    print("YES")


Fixed submission:
s = input()[::-1]
ls = [word[::-1] for word in ["dream", "dreamer", "erase", "eraser"]]
i = 0
while s:
    word = ls[i]
    if s.find(word) == 0:
        s = s[len(word):]
        i = 0
    else:
        i += 1
        if i > 3:
            print("NO")
            break
else:
    print("YES")
Buggy python submission (verdict: Runtime Error):
n = int(input())
l = list(n)
if l[0] == 9 or l[1] == 9:
    print("Yes")
else:
    print("No")

Fixed submission:
n = input()
l = list(n)
if l[0] == "9" or l[1] == "9":
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
l = list(map(int, input().split()))
print("ABC"+l[0])

Fixed submission:
S = input()
print("ABC"+S)
Buggy python submission (verdict: Runtime Error):
l = map(int, raw_input().split())
print(l[0])
print(l[1])
print(l[2])
if (l[2] - l[1]) <= 0:
    print("delicious")
elif (l[2] - l[1]) <= l[0]:
    print("safe")
else:
    print("dangerous")

Fixed submission:
l = list(map(int, input().split()))
border = l[1] - l[2]
if border < 0:
    if l[0] >= abs(border):
        print("safe")
    else:
        print("dangerous")
else:
    print("delicious")
Buggy python submission (verdict: Runtime Error):
n = input()
if int(n) % sum(list(map(int, n))) == 0:
	print("Yes")
else:
	print("No")

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

Buggy python submission (verdict: Runtime Error):
n, a, b = map(int, input().split())
priunt(min(a * n, b))

Fixed submission:
n, a, b = map(int, input().split())
print(min(a * n, b))
Buggy python submission (verdict: Time Limit Exceeded):
import sys

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

position_L = []
position_R = []
for s in S:
    if s == 'W':
        position_L.append(1)
        position_R.append(0)
    else:
        position_L.append(0)
        position_R.append(1)
i = 0
flips = N + 1
while i < N:
    flips_temp = 0
    j  = 0
    flips_temp = sum(position_L[:i]) + sum(position_R[i+1:])
    if flips_temp < flips:
        flips = flips_temp
    i = i + 1
print(flips)

Fixed submission:
import sys

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

position_L = []
position_R = []
for s in S:
    if s == 'W':
        position_R.append(0)
    else:
        position_R.append(1)
        
flips = sum(position_R[1:])
flips_temp = flips
#print(0,flips_temp)
i = 1
while i < N:
    #print(i,flips_temp)
    flips_temp = flips_temp - position_R[i] + ((-1) * position_R[i-1] + 1)
    if flips_temp < flips:
        flips = flips_temp
    i = i + 1
print(flips)
Buggy python submission (verdict: Runtime Error):
import sys

A , B , C, K = map(int,input().split())

a_0 = 1
a_1 = 0
a_2 = 0

i = 0
while i < K:
    a_0 = a_1 + a_2
    a_1 = a_0 + a_2
    a_2 = a_0 + a_1
    
    i = i + 1
    
res = (A - B) * (a[0] - a[1])
if res < 10**18:
    print(res)
else:
    print("unfair")


Fixed submission:
import sys

A , B , C, K = map(int,input().split())

a = K % 2
res = (A - B)
if abs(res) > 10**18:
    print("unfair")
if a == 1:
    print(B - A)
elif a == 0:
    print(A - B)

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

A , B , C, K = map(int,input().split())

a = [1,0,0]
b = [0,1,0]
c = [0,0,1]

i = 0
while i < K:
    a = [sum(x) for x in zip(b, c)]
    b = [a[1],a[0],a[2]]
    c = [b[0],b[2],b[1]]
    
    i = i + 1
res = (A - B) * (a[0] - a[1])
if res < 10**18:
    print(res)
else:
    print("unfair")

Fixed submission:
import sys

A , B , C, K = map(int,input().split())

a = K % 2
res = (A - B)
if abs(res) > 10**18:
    print("unfair")
if a == 1:
    print(B - A)
elif a == 0:
    print(A - B)
Buggy python submission (verdict: Time Limit Exceeded):
#zero_sum slow
import sys

N = int(input())
A =  list(map(int,input().split()))

res = 0
s = 0
s_list = [[0,0]]
i = 0
while i < N:
    s += A[i]
    inside = True
    j = 0
    while j < len(s_list):
        if s == s_list[j][1]:
            temp = s_list[j][0]
            s_list[j][0] += 1
            res -= temp * (temp + 1) / 2.
            res += (temp + 1) * (temp + 2) / 2.
            inside = False
            j = len(s_list) + 1
        j += 1
    if inside:
        s_list.append([0,s])
    i += 1
    
print(int(res))

Fixed submission:
#zero_sum slow
import sys

N = int(input())
A =  list(map(int,input().split()))


res = 0
s = 0
s_list = {}
s_list.update({0:0})
i = 0
while i < N:
    s += A[i]
    try:
        s_temp = s_list[s]
        s_list[s] += 1
        res -= s_temp * (s_temp + 1) / 2.
        res += (s_temp + 1) * (s_temp + 2) / 2.
    except:
        s_list.update({s:0})
    i += 1
    
print(int(res))

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

N = int(input())
A =  list(map(int,input().split()))

res = 0
s = 0
s_list = [[0,0]]
i = 0
while i < N:
    s += A[i]
    inside = True
    j = 0
    while j < len(s_list):
        if s == s_list[j][1]:
            s_list[j][0] += 1
            inside = False
            j = len(s_list) + 1
        j += 1
    if inside:
        s_list.append([0,s])
    i += 1
for s in s_list:
    res += s[0] * (s[0] + 1) / 2.
    
print(int(res))

Fixed submission:
#zero_sum slow
import sys

N = int(input())
A =  list(map(int,input().split()))


res = 0
s = 0
s_list = {}
s_list.update({0:0})
i = 0
while i < N:
    s += A[i]
    try:
        s_temp = s_list[s]
        s_list[s] += 1
        res -= s_temp * (s_temp + 1) / 2.
        res += (s_temp + 1) * (s_temp + 2) / 2.
    except:
        s_list.update({s:0})
    i += 1
    
print(int(res))
Buggy python submission (verdict: Runtime Error):
N=int(input())
A=input().split(' ')

for i in range(N):
	A[i]=int(A[i])

num=0
for i in range(N):
	plus=0
	xor=0
	for j in range(N-i):
		plus=plus+A[i+j]
		xor=xor^A[i+j]
		if plus==xor:
			num=num+1
		else:
			break

print(num)


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

arr=[]
num=0
for i in range(N-1):
	if S[i+1]=='E':
		num=num+1

arr.append(num)

for i in range(N-1):
	if S[i]=='W':
		if S[i+1]=='E':
			arr.append(arr[-1])
		else:
			arr.append(arr[-1]+1)
	elif S[i+1]=='E':
		arr.append(arr[-1]-1)
	else:
		arr.append(arr[-1])

print(min(arr))
Buggy python submission (verdict: Time Limit Exceeded):
import sys

input_nums = raw_input().split(' ')
A = int(input_nums[0])
B = int(input_nums[1])
C = int(input_nums[2])
K = int(input_nums[3])

if A == B and B == C:
    print 0
    sys.exit()

for _ in xrange(K):
    A, B, C = B + C, A + C, A + B
    # if A > 10**18 or B > 10**18 or C > 10**18:
    #     print 'Unfair'
    #     sys.exit()

print A - B


Fixed submission:
input_nums = raw_input().split(' ')
A = int(input_nums[0])
B = int(input_nums[1])
C = int(input_nums[2])
K = int(input_nums[3])

if K % 2 == 0:
    print A - B
else:
    print B - A
Buggy python submission (verdict: Time Limit Exceeded):
#coding: utf-8
import sys

# 入力
n = int(sys.stdin.readline().strip())
s = list(sys.stdin.readline().strip())


counts = []

for i in range(n):
    counts.append(0)
    for j in range(len(s)):
        if (i != j):
            if (i > j and s[j] == 'W'):
                counts[i] = counts[i] + 1
            elif(i < j and s[j] == 'E'):
                counts[i] = counts[i] + 1



# 出力
print(min(counts))

Fixed submission:
#coding: utf-8
import sys

# 入力
n = int(sys.stdin.readline().strip())
s = list(sys.stdin.readline().strip())


counts = []
counts.append([0] * n)
counts.append([0] * n)

length = len(s)

if (s[0] == 'W'):
     counts[0][0] = counts[0][0] + 1

if (s[length - 1] == 'E'):
    counts[1][length-1] = counts[1][length-1] + 1



for i in range(1, length):
    counts[0][i] = counts[0][i - 1]
    counts[1][length -1 - i] = counts[1][length - i]

    if (s[i] == 'W'):
        counts[0][i] = 1 + counts[0][i]

    if (s[length - i - 1] == 'E'):
        counts[1][length - i - 1] = 1 + counts[1][length - i - 1]

leaders = [0] * n
for i in range(length):
    if (i == 0):
        leaders[i] = counts[1][i + 1]
    elif(i == length - 1):
        leaders[i] = counts[0][i - 1]
    else:
        leaders[i] = counts[0][i - 1] + counts[1][i + 1]


# 出力
print(min(leaders))
Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
import sys
import copy


# 標準入力
n = int(sys.stdin.readline().strip())
xArray = list(map(int, sys.stdin.readline().strip().split(" ")))

result = []

# 演算処理
for i in range(n):
    tmp = copy.copy(xArray)
    del tmp[i]
    tmp = sorted(tmp)
    result.append(tmp[int((n/2) - 1)]) # (l + 1)/2 の要素を参照


# 標準出力
print('\n'.join(map(str, result)))



Fixed submission:
# coding: utf-8
import sys
import copy


# 標準入力
n = int(sys.stdin.readline().strip())
xArray = list(map(int, sys.stdin.readline().strip().split(" ")))

result = []

sortedArray = sorted(xArray)


# 中央値を算出する
for i in range(n):
    middle = sortedArray[int((n / 2) - 1)]
    if (middle >= xArray[i]):
        result.append(sortedArray[int(n / 2)])
    else:
        result.append(middle)


# 標準出力
print('\n'.join(map(str, result)))
Buggy python submission (verdict: Runtime Error):
def foo (s):
    ans = 0
    count = 0
    for i in s:
        if i == 'W':
            count += 1
    elif count :
        count -= 1
        ans += 1
    else:
        pass
    return ans
  
n = input()
s = input()
 
print(foo(s))

Fixed submission:
def foo (s):
	ans = 0
	count = 0
	for i in s:
		if   (not count) and (i == 'E'):pass
		elif not count: count += 1
		elif i == 'E': count -= 1; ans += 1
		else: count += 1
	return ans

n = input()
s = input()

print(foo(s))

Buggy python submission (verdict: Runtime Error):
def foo (s):
    ans = 0
    count = 0
    for i in s:
        if i == 'W':
            count += 1
    elif count :
        count -= 1
        ans += 1
    else:
        pass
    return ans
  
  n = input()
s = input()
 
print(foo(s))

Fixed submission:
def foo (s):
	ans = 0
	count = 0
	for i in s:
		if   (not count) and (i == 'E'):pass
		elif not count: count += 1
		elif i == 'E': count -= 1; ans += 1
		else: count += 1
	return ans

n = input()
s = input()

print(foo(s))

Buggy python submission (verdict: Runtime Error):
def foo (s):
    ans = 0
    count = 0
    for i in s:
        if i == 'W':
        count += 1
    elif count :
        count -= 1
        ans += 1
    else:
        pass
    return ans
 
n = input()
s = input()

print(foo(s))

Fixed submission:
def foo (s):
	ans = 0
	count = 0
	for i in s:
		if   (not count) and (i == 'E'):pass
		elif not count: count += 1
		elif i == 'E': count -= 1; ans += 1
		else: count += 1
	return ans

n = input()
s = input()

print(foo(s))

Buggy python submission (verdict: Runtime Error):
def foo (s):
    ans = 0
    count = 0
    for i in s:
        if i == 'W':
        count += 1
    elif count :
        count -= 1
        ans += 1
    else:
        pass
    return ans

n = input()
s = input()
 
print(foo(s))

Fixed submission:
def foo (s):
	ans = 0
	count = 0
	for i in s:
		if   (not count) and (i == 'E'):pass
		elif not count: count += 1
		elif i == 'E': count -= 1; ans += 1
		else: count += 1
	return ans

n = input()
s = input()

print(foo(s))

Buggy python submission (verdict: Runtime Error):
def foo (s):
	ans = 0
	count = 0
	for i in s:
		if   (not count) and (i == 'E'):pass
		elif not count: count += 1
		elif i == 'E': count -= 1; ans += 1
		else: count += 1
	return ans
  
  n = int(input())
  s = input()
  print(foo(s))

Fixed submission:
def foo (s):
	ans = 0
	count = 0
	for i in s:
		if   (not count) and (i == 'E'):pass
		elif not count: count += 1
		elif i == 'E': count -= 1; ans += 1
		else: count += 1
	return ans

n = input()
s = input()

print(foo(s))
Buggy python submission (verdict: Runtime Error):
# coding: utf-8

N = int(input())

F = []
P = []


table = [2**i for i in range(10)]

for i in range(N):
    lis = list(map(int, input().split()))
    F.append(lis)

for i in range(N):
    lis = list(map(int, input().split()))
    P.append(lis)

maxx = -1000000001

for i in range(1, 1025):
    total = 0
    for j in range(N):
        n = 0
        for t in range(10):
            n += (i&table[t])*F[j][t]
        total += P[j][n]
    if total > maxx:
        maxx = total

print(maxx)

Fixed submission:
# coding: utf-8
N = int(input())

F = []
P = []

table = [2**i for i in range(10)]

for i in range(N):
    lis = list(map(int, input().split(' ')))
    F.append(lis)

for i in range(N):
    lis = list(map(int, input().split(' ')))
    P.append(lis)

maxx = -1000000001

for i in range(1, 1024):
    total = 0
    for j in range(N):
        n = 0
        for t in range(10):
            n += (1 if i&table[t] != 0 else 0)*F[j][t]
        total += P[j][n]
    if total > maxx:
        maxx = total

print(maxx)
Buggy python submission (verdict: Runtime Error):
# coding: utf-8

N, rand = map(int, input().split())

print (2**rand)*1900 + (N-rand)*100

Fixed submission:
# coding: utf-8

N, rand = map(int, input().split())

print ((2**rand)*(1900*rand + 100*(N-rand)))
Buggy python submission (verdict: Runtime Error):
import copy
import numpy as np
N=int(input())
a=list(map(int,input().split()))

b=copy.deepcopy(a)
a.append(0)
b.insert(0,0)

a=np.array(a)
b=np.array(b)
ab=np.abs(a-b)
sumab=np.sum(ab)
temp=ab

np.insert(a,0,0)
for i in range(N):
    ab=temp
    ans=sumab-np.sum(ab[i:i+1])
    ans+=a[i+2]-a[i]
    print(ans)


    print(ans)




Fixed submission:
import numpy as np
N=int(input())
A=list(map(int,input().split()))

A.insert(0,0)
A.append(0)
A=np.array(A)
S=np.sum(np.abs(np.diff(A)))

for i in range(1,N+1):
    S_i=S+abs(A[i-1]-A[i+1])-(abs(A[i-1]-A[i])+abs(A[i]-A[i+1]))
    print(S_i)

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

for i in range(N):
    A=copy.deepcopy(a)
    A.pop(i)
    A.insert(0,0)
    A.append(0)
    A.append(0)
    B=copy.deepcopy(A)
    B.insert(0,0)
    A_B=[abs(x-y) for (x,y) in zip(A,B)]
    print(sum(A_B))

Fixed submission:
import numpy as np
N=int(input())
A=list(map(int,input().split()))

A.insert(0,0)
A.append(0)
A=np.array(A)
S=np.sum(np.abs(np.diff(A)))

for i in range(1,N+1):
    S_i=S+abs(A[i-1]-A[i+1])-(abs(A[i-1]-A[i])+abs(A[i]-A[i+1]))
    print(S_i)
Buggy python submission (verdict: Time Limit Exceeded):
def count(item, str1):
    counter = 0
    for c in str1:
        if c == item:
            counter += 1
    return counter

N = int(input())
S = input()
_min = -1
for i in range(N):
    left_str = S[:i]
    right_str = S[i+1:]
    left = count('W', left_str)
    right = count('E', right_str)
    total = left + right
    if _min == -1:
        _min = total
    elif total < _min:
        _min = total
print(_min)
        

Fixed submission:
N = int(input())
S = input()
w_count = 0
e_count = 0
w_counts = [0 for _ in range(N)]
e_counts = [0 for _ in range(N)]
for i in range(N):
    if S[i] == 'W':
        w_count += 1
    w_counts[i] = w_count
for i in range(N-1, -1, -1):
    if S[i] == 'E':
        e_count += 1
    e_counts[i] = e_count
_min = -1
for i in range(N):
    total = w_counts[i] + e_counts[i]
    if _min == -1:
        _min = total
    if _min > total:
        _min = total
print(_min-1)

Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()
_min = -1
for i in range(N):
    left_str = S[:i]
    right_str = S[i+1:]
    left = count('W', left_str)
    right = count('E', right_str)
    total = left + right
    if _min == -1:
        _min = total
    elif total < _min:
        _min = total
print(_min)
def count(item, str1):
    counter = 0
    for c in str1:
        if c == item:
            counter += 1
    return counter
        

Fixed submission:
N = int(input())
S = input()
w_count = 0
e_count = 0
w_counts = [0 for _ in range(N)]
e_counts = [0 for _ in range(N)]
for i in range(N):
    if S[i] == 'W':
        w_count += 1
    w_counts[i] = w_count
for i in range(N-1, -1, -1):
    if S[i] == 'E':
        e_count += 1
    e_counts[i] = e_count
_min = -1
for i in range(N):
    total = w_counts[i] + e_counts[i]
    if _min == -1:
        _min = total
    if _min > total:
        _min = total
print(_min-1)

Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()
_min = -1
for i in range(N):
    left_str = S[:i]
    right_str = S[i+1:]
    left = count('W', left_str)
    right = count('E', right_str)
    total = left + right
    if _min == -1:
        _min = total
    elif total < _min:
        _min = total
print(_min)
def count(item, str):
    counter = 0
    for c in str:
        if c == item:
            counter += 1
    return counter
        

Fixed submission:
N = int(input())
S = input()
w_count = 0
e_count = 0
w_counts = [0 for _ in range(N)]
e_counts = [0 for _ in range(N)]
for i in range(N):
    if S[i] == 'W':
        w_count += 1
    w_counts[i] = w_count
for i in range(N-1, -1, -1):
    if S[i] == 'E':
        e_count += 1
    e_counts[i] = e_count
_min = -1
for i in range(N):
    total = w_counts[i] + e_counts[i]
    if _min == -1:
        _min = total
    if _min > total:
        _min = total
print(_min-1)
Buggy python submission (verdict: Runtime Error):
n,m,x=[int(x) for x in input().split()]
a=[int(x) for x in input().split()]
goLeft = 0
goRight = 0
for i in arr:
    if i < x:
        goLeft += 1
    else:
        goRight += 1
print(min(goLeft,goRight))

Fixed submission:
n,m,x=[int(x) for x in input().split()]
arr=[int(x) for x in input().split()]
goLeft = 0
goRight = 0
for i in arr:
    if i < x:
        goLeft += 1
    else:
        goRight += 1
print(min(goLeft,goRight))
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
arr=[int(x) for x in input().split()]
for i in range(n):
    a = arr[:i] + arr[i+1:]
    a.sort()
    index = int((n-1)/2)
    print(a[index])


Fixed submission:
n=int(input())
arr=[int(x) for x in input().split()]
sorted_arr = sorted(arr)
l = sorted_arr[n//2 -1]
r = sorted_arr[n//2]
for x in arr:
    if x >= r:
        print(l)
    else:
        print(r)
Buggy python submission (verdict: Runtime Error):
n=int(input())
arr=[int(x) for x in input().split()]
pairs = []
for i in range(n):
    for j in range(i+1, n):
        if arr[i] > arr[j]:
            pairs.append([arr[i], arr[j]])
        else:
            pairs.append([arr[j], arr[i]])
m = 0
max_index = -1
for index, pair in enumerate(pairs):
    cur = comb(pair[0], pair[1])
    print(cur)
    if cur > m:
        m = cur
        max_index = index
res = pairs[max_index]
print(res[0], res[1])

Fixed submission:
input()
arr=sorted(int(x)for x in input().split())
m=arr[-1]
print(m,min(arr,key=lambda x:abs(m-x*2)))

Buggy python submission (verdict: Runtime Error):
n=int(input())
arr=[int(x) for x in input().split()]
pairs = []
for i in range(n):
    for j in range(i+1, n):
        if arr[i] > arr[j]:
            pairs.append([arr[i], arr[j]])
        else:
            pairs.append([arr[j], arr[i]])
print(pairs)
m = 0
max_index = -1
for index, pair in enumerate(pairs):
    cur = comb(pair[0], pair[1])
    print(cur)
    if cur > m:
        m = cur
        max_index = index
res = pairs[max_index]
print(res[0], res[1])

Fixed submission:
input()
arr=sorted(int(x)for x in input().split())
m=arr[-1]
print(m,min(arr,key=lambda x:abs(m-x*2)))