I found an interesting problem on https://codeforces.com/problemset/problem/1075/B:
Palo Alto is an unusual city because it is an endless coordinate line. It is also known for the office of Lyft Level 5.

Lyft has become so popular so that it is now used by all $m$ taxi drivers in the city, who every day transport the rest of the city residents — $n$ riders.

Each resident (including taxi drivers) of Palo-Alto lives in its unique location (there is no such pair of residents that their coordinates are the same).

The Lyft system is very clever: when a rider calls a taxi, his call does not go to all taxi drivers, but only to the one that is the closest to that person. If there are multiple ones with the same distance, then to taxi driver with a smaller coordinate is selected.

But one morning the taxi drivers wondered: how many riders are there that would call the given taxi driver if they were the first to order a taxi on that day? In other words, you need to find for each taxi driver $i$ the number $a_{i}$ — the number of riders that would call the $i$-th taxi driver when all drivers and riders are at their home?

The taxi driver can neither transport himself nor other taxi drivers.


-----Input-----

The first line contains two integers $n$ and $m$ ($1 \le n,m \le 10^5$) — number of riders and taxi drivers.

The second line contains $n + m$ integers $x_1, x_2, \ldots, x_{n+m}$ ($1 \le x_1 < x_2 < \ldots < x_{n+m} \le 10^9$), where $x_i$ is the coordinate where the $i$-th resident lives. 

The third line contains $n + m$ integers $t_1, t_2, \ldots, t_{n+m}$ ($0 \le t_i \le 1$). If $t_i = 1$, then the $i$-th resident is a taxi driver, otherwise $t_i = 0$.

It is guaranteed that the number of $i$ such that $t_i = 1$ is equal to $m$.


-----Output-----

Print $m$ integers $a_1, a_2, \ldots, a_{m}$, where $a_i$ is the answer for the $i$-th taxi driver. The taxi driver has the number $i$ if among all the taxi drivers he lives in the $i$-th smallest coordinate (see examples for better understanding).


-----Examples-----
Input
3 1
1 2 3 10
0 0 1 0

Output
3 
Input
3 2
2 3 4 5 6
1 0 0 0 1

Output
2...

I tried it in Python, but could not do it. Can you solve it?
n, m = map(int, input().split())
dist = list(map(int, input().split()))
taxists = list(map(int, input().split()))
left = [0] * (n + m)
right = [0] * (n + m)
MAX = 10000000000000000000
value = -MAX
cnt = 0
for i in range(n + m):
    if taxists[i] == 1:
        cnt += 1
        value = i
    left[i] = value

value = MAX
for i in range(n + m - 1, -1, -1):
    if taxists[i] == 1:
        value = i
    right[i] = value


answer = [0] * (n + m)
for i in range(n + m):
    if left[i] == -MAX:
        answer[right[i]] += 1
        continue
    if right[i] == MAX:
        answer[left[i]] += 1
        continue
    if abs(dist[left[i]] - dist[i]) <= abs(dist[i] - dist[right[i]]):
        answer[left[i]] += 1
    else:
        answer[right[i]] += 1
for i in answer:
    if i:
        print(i - 1, end = " ")