Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
inputs = [float(i) for i in input().split()]

dp = [[0.0 for _ in range(N+1)] for _ in range(N+1)]
dp[1][0] = 1 - inputs[0]
dp[1][1] = inputs[0]
for i in range(2, N+1):
    tmp_dp = [0.0 for _ in range(N+1)]
    for j in range(i+1):
        if j == 0:
            dp[i][j] = dp[i-1][j] * (1 - inputs[i-1])
        else:
            dp[i][j] = dp[i-1][j] * (1 - inputs[i-1]) + dp[i-1][j-1] * inputs[i-1]

print(sum(dp[-1][(N+1)//2:]))


Fixed submission:
import numpy as np

N = int(input())
inputs = np.array([float(i) for i in input().split()])

dp = np.array([np.array([0.0 for _ in range(N+1)]) for _ in range(N+1)])
dp[1][0] = 1 - inputs[0]
dp[1][1] = inputs[0]
for i in range(2, N+1):
    dp[i][1:] = dp[i-1][1:] * (1.0 - inputs[i-1]) + dp[i-1][:N] * inputs[i-1]
    dp[i][0] = dp[i-1][0] * (1.0 - inputs[i-1])

print(sum(dp[-1][(N+1)//2:]))

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

dp = [[0.0 for _ in range(N+1)] for _ in range(N+1)]
dp[1][0] = 1 - inputs[0]
dp[1][1] = inputs[0]
for i in range(2, N+1):
    for j in range(N+1):
        if j == 0:
            dp[i][j] = dp[i-1][j] * (1 - inputs[i-1])
        else:
            dp[i][j] = dp[i-1][j] * (1 - inputs[i-1]) + dp[i-1][j-1] * inputs[i-1]

print(sum(dp[-1][(N+1)//2:]))


Fixed submission:
import numpy as np

N = int(input())
inputs = np.array([float(i) for i in input().split()])

dp = np.array([np.array([0.0 for _ in range(N+1)]) for _ in range(N+1)])
dp[1][0] = 1 - inputs[0]
dp[1][1] = inputs[0]
for i in range(2, N+1):
    dp[i][1:] = dp[i-1][1:] * (1.0 - inputs[i-1]) + dp[i-1][:N] * inputs[i-1]
    dp[i][0] = dp[i-1][0] * (1.0 - inputs[i-1])

print(sum(dp[-1][(N+1)//2:]))
Buggy python submission (verdict: Time Limit Exceeded):
import math

N, P = map(int, input().split())
max_value = math.floor(pow(P, 1/N)+1)
ans = 1

if N == 1:
    ans = P
else:
    for i in range(1, max_value+1):
        mod = i ** N
        if P % mod == 0:
            ans = i

print(ans)


Fixed submission:
import math

N, P = map(int, input().split())
max_value = round(pow(P, 1/N)) + 1 
ans = 1

if N == 1:
    ans = P
else:
    for i in range(1, max_value):
        mod = i ** N
        if P % mod == 0:
            ans = i

print(ans)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import collections
    
N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
c=collections.Counter(A)
    
pairCounter=0
    
beki=29
nibeki=2**beki
    
for i in range(N):
    target = A[i]
    if c[target] < 1:
    continue
    c[target]-= 1
    
    while (nibeki > target):
    beki-=1
    nibeki=2**beki
    
    pair = nibeki * 2 - target
    if pair in c.keys() and c[pair] > 0:
        c[pair]-= 1
        pairCounter+=1
     
print(pairCounter)

Fixed submission:
from collections import Counter

N = int(input())
inputs = [int(i) for i in input().split()]

inputs.sort(reverse=True)
counter_inputs = Counter(inputs)
powers_of_two = [2**i for i in range(1, 31)]
ans = 0

for item in inputs:
    if counter_inputs[item] > 0:
        counter_inputs[item] -= 1
    
        while powers_of_two[-1] > 2 * item:
            powers_of_two.pop(-1)
        
        pair = powers_of_two[-1] - item
        if counter_inputs[pair] > 0:
            ans += 1
            counter_inputs[pair] -= 1
    
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = [int(i) for i in rnage(N)]

print(sum(A) - max(A) // 2)

Fixed submission:
N = int(input())

A = [int(input()) for _ in range(N)]

print(sum(A) - max(A) // 2)
Buggy python submission (verdict: Runtime Error):
N, X = map(int, input().split())

result = 'P'

for i in range(1, N+1):
    result = 'B' + result + 'P' + result + 'B'
    if len(result) >= X:
        break
    
print(result[:X].count('P'))

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

a, p = [1], [1]
for i in range(N):
    a.append(a[i] * 2 + 3)
    p.append(p[i] * 2 + 1)

def f(N, X): # X <= 0 や X > a_N を許容し解説本文から簡略化
    if N == 0:
        return 0 if X <= 0 else 1
    elif X <= 1 + a[N-1]:
        return f(N-1, X-1)
    else:
        return p[N-1] + 1 + f(N-1, X-2-a[N-1])

print(f(N, X))

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

result = 'P'

for i in range(1, N+1):
    result = 'B' + result + 'P' + result + 'B'
    
print(result[:X].count('P'))

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

a, p = [1], [1]
for i in range(N):
    a.append(a[i] * 2 + 3)
    p.append(p[i] * 2 + 1)

def f(N, X): # X <= 0 や X > a_N を許容し解説本文から簡略化
    if N == 0:
        return 0 if X <= 0 else 1
    elif X <= 1 + a[N-1]:
        return f(N-1, X-1)
    else:
        return p[N-1] + 1 + f(N-1, X-2-a[N-1])

print(f(N, X))

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

result = ['P']

for i in range(1, N+1):
    result.append('B' + result[i-1] + 'P' + result[i-1] + 'B')
    
print(result[-1][:X].count('P'))

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

a, p = [1], [1]
for i in range(N):
    a.append(a[i] * 2 + 3)
    p.append(p[i] * 2 + 1)

def f(N, X): # X <= 0 や X > a_N を許容し解説本文から簡略化
    if N == 0:
        return 0 if X <= 0 else 1
    elif X <= 1 + a[N-1]:
        return f(N-1, X-1)
    else:
        return p[N-1] + 1 + f(N-1, X-2-a[N-1])

print(f(N, X))
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())

inputs = []
sorted_inputs = {}

for _ in range(M):
    P, Y = map(int, input().split())
    inputs.append((P, Y))
    if sorted_inputs.get(P) is None:
        sorted_inputs[P] = [Y]
    else:
        sorted_inputs[P].append(Y)

for input in sorted_inputs:
    sorted_inputs[input].sort()

for input in inputs:
    first = str(input[0]).rjust(6, '0')
    latter = str(sorted_inputs[input[0]].index(input[1])+1).rjust(6, '0')
    print(first + latter)


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

sorted_inputs = {}
ans = [None]*M

for i in range(M):
    P, Y = map(int, input().split())
    if sorted_inputs.get(P) is None:
        sorted_inputs[P] = [(Y, i)]
    else:
        sorted_inputs[P].append((Y, i))

for pref, l in sorted_inputs.items():
    l.sort() # Yでソートされる
    for j, (Y, i) in enumerate(l):
        first = str(pref).rjust(6, '0')
        latter = str(j+1).rjust(6, '0')
        ans[i] = first + latter

for item in ans:
    print(item)
Buggy python submission (verdict: Runtime Error):
N, T = map(int, input().split())

ans = 10 ** 9

for _ in rnage(N):
    a, b = map(int, input().split())
    if b <= T:
        ans = min(ans, b)

if ans == 10 ** 9:
    print('TLE')
else:
    print(ans)

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

ans = 10 ** 9

for _ in range(N):
    a, b = map(int, input().split())
    if b <= T:
        ans = min(ans, a)

if ans == 10 ** 9:
    print('TLE')
else:
    print(ans)
Buggy python submission (verdict: Runtime Error):
from collections import Counter

N = int(input())

index = 0
even_numbers = []
odd_numbers = []

for i in input().split():
    if index % 2 == 0:
        even_numbers.append(int(i))
    else:
        odd_numbers.append(int(i))
    index += 1

even = Counter(even_numbers).most_common(2)
odd = Counter(odd_numbers).most_common(2)

if even[0][1] == odd[0][1]:
    print(min(N - even[0][1] - odd[1][1], N - even[1][1] - odd[0][1]))
else:
    print(N - even[0][1] - odd[0][1])


Fixed submission:
from collections import Counter

N = int(input())

index = 0
even_numbers = []
odd_numbers = []

for i in input().split():
    if index % 2 == 0:
        even_numbers.append(int(i))
    else:
        odd_numbers.append(int(i))
    index += 1

even = Counter(even_numbers).most_common(2)
odd = Counter(odd_numbers).most_common(2)

if even[0][0] == odd[0][0]:
    if len(even) == 1:
        print(N//2)
    else:
        print(N - even[0][1] - max(even[1][1], odd[1][1]))
else:
    print(N - even[0][1] - odd[0][1])

Buggy python submission (verdict: Runtime Error):
from collections import Counter
N = int(input())
n = N // 2

index = 0
g_inputs = []
k_inputs = []

for i in input().split():
    if index % 2 == 0:
        g_inputs.append(int(i))
        index += 1
    else:
        k_inputs.append(int(i))
        index += 1

g = Counter(g_inputs)
k = Counter(k_inputs)

g_max = max([(v,k) for k,v in g.items()])[1] 
k_max = max([(v,k) for k,v in k.items()])[1]

if g_max == k_max:
    del g[g_max]
    del k[k_max]
    g_max_2 = max([(v,k) for k,v in g.items()])[1] 
    k_max_2 = max([(v,k) for k,v in k.items()])[1]
    print(min(N - g_max - k_max_2, N - g_max_2 - k_max))
else:
    print(N - g[g_max] - k[k_max])

Fixed submission:
from collections import Counter

N = int(input())

index = 0
even_numbers = []
odd_numbers = []

for i in input().split():
    if index % 2 == 0:
        even_numbers.append(int(i))
    else:
        odd_numbers.append(int(i))
    index += 1

even = Counter(even_numbers).most_common(2)
odd = Counter(odd_numbers).most_common(2)

if even[0][0] == odd[0][0]:
    if len(even) == 1:
        print(N//2)
    else:
        print(N - even[0][1] - max(even[1][1], odd[1][1]))
else:
    print(N - even[0][1] - odd[0][1])
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())

mod = [i for i in range(K, N+1, K)]
ans += len(mod) ** 3

if K % 2 == 0:
    items = [i for i in range(K//2, N+1, K)]
    ans += len(items)

print(ans)


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

mod = [i for i in range(K, N+1, K)]
ans = len(mod) ** 3

if K % 2 == 0:
    items = [i for i in range(K//2, N+1, K)]
    ans += len(items) ** 3

print(ans)
Buggy python submission (verdict: Runtime Error):
import sympy

N = int(input())

ans = 0

for i in range(1, N+1):
    if i % 2 == 1 and sympy.divisor_count(i) == 8:
        ans += 1

print(ans)

Fixed submission:
import math

N = int(input())

ans = 0

def cal(n):
    limit = math.floor(math.sqrt(n))
    count = 0
    for i in range(1, limit+1):
        if n % i == 0:
            if n % i == i:
                count += 1
            else:
                count += 2
    return count

for i in range(1, N+1, 2):
    if cal(i) == 8:
        ans += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
S = input()
K = input()

if S[0] != "1":
    print(S[0])
else:
    if S[1] != "1":
        print(S[1])
    else:
        if S[2] != "1":
            print(S[2])
        else:
            if S[3] != "1":
                print(S[3])
            else:
                print(1)




Fixed submission:
S = input()
K = input()

for i in range(int(K)):
    if S[i] != "1":
        print(S[i])
        break
else:
    print(1)

Buggy python submission (verdict: Runtime Error):
S = input()
K = input()

print(S[1])

if S[0] != "1":
    print(S[0])
else:
    if S[1] != "1":
        print(S[1])
    else:
        if S[2] != "1":
            print(S[2])
        else:
            if S[3] != "1":
                print(S[3])
            else:
                print(1)




Fixed submission:
S = input()
K = input()

for i in range(int(K)):
    if S[i] != "1":
        print(S[i])
        break
else:
    print(1)
Buggy python submission (verdict: Runtime Error):
S = input()
T = input()

if (len(S)%2==0)
    if T == S[::-1]:
        print("Yes")
    else:
        print("No")
else:
    if T == S[::-1]:
        print("No")
    else:
        print("Yes")
        

Fixed submission:
S = input()
T = input()
a = ""
for i in range(len(S)+1):
    if i == 0:
        a = (S[-1] + S[:-1])
    else:
        a = a[-1] + a[:-1]
    if a == T:
        print("Yes")
        break
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
input_list = []
index = 1
for i in input().split():
    item = int(i) - index
    input_list.append(item)
    index += 1

input_list.sort()
b = input_list[N//2]
print(sum(map(lambda x: abs(x-b), input_list)))

Fixed submission:
N = int(input())

input_list = []
index = 1
for i in input().split():
    item = int(i) - index
    input_list.append(item)
    index += 1

input_list.sort()
b = input_list[N//2]

print(sum(map(lambda x: abs(x-b), input_list)))

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter

N = int(input())
input_list = []
input_counter = Counter()
ans = 10**10
index = 1
for i in input().split():
    item = int(i) - index
    input_list.append(item)
    input_counter[item] += 1
    index += 1


for i in input_counter.keys():
    ans = min(ans, sum(map(lambda x: abs(x-i)*input_counter[x], input_counter.keys())))

print(ans)

Fixed submission:
N = int(input())

input_list = []
index = 1
for i in input().split():
    item = int(i) - index
    input_list.append(item)
    index += 1

input_list.sort()
b = input_list[N//2]

print(sum(map(lambda x: abs(x-b), input_list)))

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter

N = int(input())
input_list = []
input_counter = Counter()
ans = 10**10
index = 1
for i in input().split():
    item = int(i) - index
    input_list.append(item)
    input_counter[item] += 1
    index += 1


for i in input_counter.keys():
    ans = min(ans, sum(map(lambda x: abs(x-i), input_list)))

print(ans)

Fixed submission:
N = int(input())

input_list = []
index = 1
for i in input().split():
    item = int(i) - index
    input_list.append(item)
    index += 1

input_list.sort()
b = input_list[N//2]

print(sum(map(lambda x: abs(x-b), input_list)))

Buggy python submission (verdict: Runtime Error):
N = int(input())
input_list = [int(i) for i in input().split()]

ans1 = 0
ans2 = 0

for i in range(N):
    input_list[i] -= i+1

point1 = sum(input_list) // N
point2 = point + 1

for i in range(N):
    ans1 += abs(input_list[i] - point1)

for i in range(N):
    ans2 += abs(input_list[i] - point2)

print(min(ans1, ans2))

Fixed submission:
N = int(input())

input_list = []
index = 1
for i in input().split():
    item = int(i) - index
    input_list.append(item)
    index += 1

input_list.sort()
b = input_list[N//2]

print(sum(map(lambda x: abs(x-b), input_list)))
Buggy python submission (verdict: Runtime Error):
N = input()
mod = int(N[0] + N[1] + N[2])

print("Yes" if int(N) % mod == 0 else "No")

Fixed submission:
N = input()
sum = 0

for i in range(len(N)):
    sum += int(N[i])
print("Yes" if int(N) % sum == 0 else "No")

Buggy python submission (verdict: Runtime Error):
N = input()
mod = int(N[0] + N[1] + N[2])

print("Yes" if int(N) % mod == 0 else "No")

Fixed submission:
N = input()
sum = 0

for i in range(len(N)):
    sum += int(N[i])
print("Yes" if int(N) % sum == 0 else "No")
Buggy python submission (verdict: Runtime Error):
N = int(input())

count = 0

numbers = sorted([9**5, 9**4, 9**3, 9**2, 9, 6**6, 6**5, 6**4, 6**3, 6**2, 6], reverse=True)

def search(n):
    for i in numbers:
        if i <= n:
            return i

for i in range(1000):
    N -= search(N)
    count += 1
    if 1 <= N <= 5:
        count += N
        break
    elif N == 0:
        break

print(count)

Fixed submission:
n = int(input())
v = []
i = 6
while i<=n:
    v.append(i)
    i *= 6
i=9
while i <= n:
    v.append(i)
    i *= 9
v.sort(reverse=True)
dic = dict()
def dp(i, N):
    if i == len(v):
        return N
    if (i, N) not in dic:
        dic[(i, N)] = min(dp(i, N-v[i])+1, dp(i+1, N)) if N-v[i] >= 0 else dp(i+1, N)
    return dic[(i, N)]
print(dp(0, n))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
list = [str(S[i]) for i in range(N)]

result = 300000

def cal(n):
    count = 0
    count = list[:n].count("W") + list[n:].count("E")
    return count

for i in range(N):
    if result > cal(i):
        result = cal(i)
    
print(result)

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

if S[0] == "E":
    count = S.count("E") -1
    result = count
    for i in range(1,N):
        if S[i-1] == "W" and S[i] == "W":
            count += 1
        elif S[i-1] == "E" and S[i] == "E":
            count -= 1
            if result > count:
                result = count
else:
    count = S.count("E")
    result = count
    for i in range(1,N):
        if S[i-1] == "W" and S[i] == "W":
            count += 1
        elif S[i-1] == "E" and S[i] == "E":
            count -= 1
            if result > count:
                result = count

print(result)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
list = [str(S[i]) for i in range(N)]

result = []

def cal(n):
    count = 0
    count = list[:n].count("W") + list[n:].count("E")
    return count

for i in range(N):
    result.append(cal(i))
    
# print(result)
print(min(result))

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

if S[0] == "E":
    count = S.count("E") -1
    result = count
    for i in range(1,N):
        if S[i-1] == "W" and S[i] == "W":
            count += 1
        elif S[i-1] == "E" and S[i] == "E":
            count -= 1
            if result > count:
                result = count
else:
    count = S.count("E")
    result = count
    for i in range(1,N):
        if S[i-1] == "W" and S[i] == "W":
            count += 1
        elif S[i-1] == "E" and S[i] == "E":
            count -= 1
            if result > count:
                result = count

print(result)

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

result = []

def cal(n):
    count = 0
    for i in range(N):
        if i < n:
            if S[i] == "W":
                count += 1
        elif i > n:
            if S[i] == "E":
                count += 1
    return count

for i in range(N):
    result.append(cal(i))
    
# print(result)
print(min(result))

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

if S[0] == "E":
    count = S.count("E") -1
    result = count
    for i in range(1,N):
        if S[i-1] == "W" and S[i] == "W":
            count += 1
        elif S[i-1] == "E" and S[i] == "E":
            count -= 1
            if result > count:
                result = count
else:
    count = S.count("E")
    result = count
    for i in range(1,N):
        if S[i-1] == "W" and S[i] == "W":
            count += 1
        elif S[i-1] == "E" and S[i] == "E":
            count -= 1
            if result > count:
                result = count

print(result)
Buggy python submission (verdict: Time Limit Exceeded):
inputs = list(map(int, input().split()))
K = inputs.pop()

if inputs[0] == inputs[1] == inputs[2]:
    print(0)
else:
    for k in range(K):
        total = sum(inputs)
        inputs = [total-inputs[i] for i in range(3)]

        if abs(inputs[0] - inputs[1]) > 10 ** 18:
            print(-1)
            break
    else:
        print(inputs[0] - inputs[1])


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

def judge(n):
    if abs(n) > 10**18:
        print('Unfair')
    else:
        print(n)

if K % 2 == 0:
    judge(A-B)
else:
     judge(B-A)

Buggy python submission (verdict: Time Limit Exceeded):
A, B, C, K = map(int, input().split())

def judge(n):
    if abs(n) > 10**18:
        print('Unfair')
    else:
        print(n)

if K == 0:
    judge(A-B)
else:
    if A == B and B == C and C == A :
        print(0)
    else:
        sum = A + B + C
        for i in range(1, K+1):
            sum *= K
            A = sum - A
            B = sum - B
        judge(A-B)

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

def judge(n):
    if abs(n) > 10**18:
        print('Unfair')
    else:
        print(n)

if K % 2 == 0:
    judge(A-B)
else:
     judge(B-A)

Buggy python submission (verdict: Time Limit Exceeded):
A, B, C, K = map(int, input().split())

def judge(n):
    if abs(n) > 10**18:
        print('Unfair')
    else:
        print(n)

if K == 0:
    judge(A-B)
else:
    sum = A + B + C
    for i in range(1, K+1):
        sum *= K
        A = sum - A
        B = sum - B
    judge(A-B)

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

def judge(n):
    if abs(n) > 10**18:
        print('Unfair')
    else:
        print(n)

if K % 2 == 0:
    judge(A-B)
else:
     judge(B-A)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
inputs = [int(i) for i in input().split()]

ans = 0

for i in range(N):
    total = 0
    for item in inputs[i:]:
        total += item
        if total == 0:
            ans += 1

print(ans)


Fixed submission:
from collections import Counter

N = int(input())
inputs = [int(i) for i in input().split()]

ans = 0
ruisekiwa = [0] * (N+1)

for i in range(N):
    ruisekiwa[i+1] = ruisekiwa[i] + inputs[i]

ruisekiwa = ruisekiwa[1:]
ruisekiwa.sort()
counter_ruiseki = Counter(ruisekiwa)

for key, value in counter_ruiseki.items():
    if key == 0 and value == 1:
        ans += value
        continue
    elif key == 0 and value > 1:
        ans += value
    if value > 1:
        ans += sum(list(range(value)))

print(ans)
Buggy python submission (verdict: Runtime Error):
A, B, C, X, Y = (int(i) for i in input().split())  

min = min(X, Y)
max = max(X, Y)

if A + B > 2 * C :
    if A > 2 * C :
        print(min * 2 * C + (max-min) * C * 2)
    else:
        print(min * 2 * C + (max-min) * A)
else:
    print(A * X + B * Y)


Fixed submission:
S = input()
count = 0

for i in range(0,3):
    if S[i] == 'o':
        count += 1 
print(700 + 100 * count)
Buggy python submission (verdict: Runtime Error):
A, B, X = map(int, input().split())

print('NO' if X - A < 0 or X - A > B 'YES')


Fixed submission:
# Aは猫, Bはどっちかわからん
A, B, X = map(int, input().split())

if X - A < 0:
    print('NO')
elif X - A > B:
    print('NO')
else:
    print('YES')

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

if list[2] < list[0] :
    print('NO')
elif list[2] == list[0] :
    print('YES')
else:
    if (list[2] - list[0]) <= list[1] :
        print('YES')
    else:
        print('NO')


Fixed submission:
# Aは猫, Bはどっちかわからん
A, B, X = map(int, input().split())

if X - A < 0:
    print('NO')
elif X - A > B:
    print('NO')
else:
    print('YES')
Buggy python submission (verdict: Runtime Error):
list = map(int, raw_input().split())
List = map(int, raw_input().split())

countLatter = 0
countFormer = 0

for i in range(list[2] + 1, list[0]):
    if i in List :
        countLatter += 1
for i in range(0, list[2] - 1):
    if i in List :
        countFormer += 1

print(min(countLatter, countFormer))

Fixed submission:
N, M, X = map(int, input().split())

count = 0
for i in input().split():
    if int(i) > X:
        break
    count += 1

print(min(count , M-count))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
inputs = [int(i) for i in input().split()]

sorted_inputs = inputs[:]
sorted_inputs.sort()
left = sorted_inputs[N//2-1]
right = sorted_inputs[N//2]

for item in inputs:
    index = sorted_inputs.index(item)
    if index <= N // 2 - 1:
        print(right)
    else:
        print(left)


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

sorted_inputs = inputs[:]
sorted_inputs.sort()
left = sorted_inputs[N//2-1]
right = sorted_inputs[N//2]

for item in inputs:
    if item <= left:
        print(right)
    else:
        print(left)

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

sorted_inputs = inputs[:]
sorted_inputs.sort()

for item in inputs:
    index = sorted_inputs.index(item)
    if index <= N // 2 - 1:
        print(sorted_inputs[N//2])
    else:
        print(sorted_inputs[N//2-1])


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

sorted_inputs = inputs[:]
sorted_inputs.sort()
left = sorted_inputs[N//2-1]
right = sorted_inputs[N//2]

for item in inputs:
    if item <= left:
        print(right)
    else:
        print(left)