Council

아직 제출이 없습니다시간 제한3초메모리 제한1024 MB

문제

In the council of JOI City, there are NN assembly members, numbered from 11 to NN. The council will open a meeting, and the assembly members will take votes on MM proposed ordinances, numbered from 11 to MM. If A_i,j=1A\_{i, j} = 1, the assembly member ii (1iN1 ≤ i ≤ N) will cast an affirmative vote on the proposed ordinance jj (1jM1 ≤ j ≤ M). If A_i,j=0A\_{i, j} = 0, the assembly member ii will cast a negative vote on the proposed ordinance jj.

The council of JOI City will be performed as follows.

  1. Among the NN assembly members, they will randomly choose a chairperson by drawing lots.
  2. The chairperson will choose a deputy chairperson among the N1N - 1 assembly members except for the chairperson.
  3. The votes will be taken on MM proposed ordinances. Each of the N2N - 2 assembly members except for the chairperson and the deputy chairperson will cast an affirmative vote or a negative vote on each proposed ordinance. The council will approve a proposed ordinance if a majority of the assembly members (i.e., more than or equal to N2\left\lfloor \frac{N}{2} \right\rfloor assembly members) cast affirmative votes on it. Here, x\left\lfloor x \right\rfloor is the largest integer not exceeding xx.

Mayor K, the mayor of JOI City, wants the council to approve as many proposed ordinances as possible. Mayor K collected information on assembly members. Mayor K knows, on each proposed ordinance, who will cast an affirmative vote and who will cast a negative vote.

Write a program which, given information of the votes of the assembly members, calculates, for each assembly member, the maximum possible number of proposed ordinances approved by the council if that assembly member is chosen as the chairperson.

입력

Read the following data from the standard input.

NN MM

A_1,1A\_{1,1} A_1,2A\_{1,2} \cdots A_1,MA\_{1,M}

A_2,1A\_{2,1} A_2,2A\_{2,2} \cdots A_2,MA\_{2,M}

\vdots

A_N,1A\_{N,1} A_N,2A\_{N,2} \cdots A_N,MA\_{N,M}

출력

Write NN lines to the standard output. The ii-th line (1iN1 ≤ i ≤ N) of output should contain the maximum possible number of proposed ordinances approved by the council if the assembly member ii is chosen as the chairperson.

제한

  • 3N300,0003 ≤ N ≤ 300\\,000.
  • 1M201 ≤ M ≤ 20.
  • 0A_i,j10 ≤ A\_{i, j} ≤ 1 (1iN1 ≤ i ≤ N, 1jM1 ≤ j ≤ M).
  • Given values are all integers.