#include <iostream>
#include <bits/stdc++.h>

using namespace std;

int main()
{
    long h;
    long n;

    cin>>h>>n;

    long matrica[h][n];
    long matricaPomocna[h][n];

    for(long i = 0;i<h;i++)
        for(long j = 0;j<n;j++)
        {
            cin>>matrica[i][j];
            matricaPomocna[i][j]=0;
        }

    for (long j = 0; j < n; j++)
    {
        if (matrica[0][j] == 0)
        {
            long levo = -1;
            bool tf=false;
            for (long t = j - 1; t >= 0 && !tf; t--)
            {
                if (matrica[0][t] != 0)
                {
                    tf=true;
                    levo = t;
                }
            }
            if (levo != -1)
                matricaPomocna[0][levo] += 1;
            else
            {
                bool tf=false;
                long desno = -1;
                for (long c = j + 1; c < n && !tf; c++)
                {
                    if (matrica[0][c] != 0)
                    {
                        desno = c;
                        tf=true;
                    }
                }
                matricaPomocna[0][desno] += 1;
            }
        }
        else matricaPomocna[0][j] = 1;
    }

    for (long i = 1; i < h; i++)
    {
        for (long j = 0; j < n; j++)
        {
            if(matrica[i][j]==0)
            {
                bool tf=false;
                long desno = -1;
                for (long c = j + 1; c < n && !tf; c++)
                {
                    if (matrica[i][c] != 0)
                    {
                        desno = c;
                        tf=true;
                    }
                }
                long levo = -1;
                tf=false;
                for (long t = j - 1; t >= 0 && !tf; t--)
                {
                    if (matrica[i][t] != 0)
                    {
                        tf=true;
                        levo = t;
                    }
                }
                if (levo == -1)
                    matricaPomocna[i][desno] += matricaPomocna[i - 1][j];
                else
                if (desno == -1)
                    matricaPomocna[i][levo] += matricaPomocna[i - 1][j];
                else
                if(matricaPomocna[i-1][j]%2==0)
                {
                    matricaPomocna[i][levo] += matricaPomocna[i - 1][j] / 2;
                    matricaPomocna[i][desno] += matricaPomocna[i - 1][j] / 2;
                }
                else
                if((i+1)%2!=0)
                {
                    matricaPomocna[i][levo] += (matricaPomocna[i - 1][j] - 1) / 2 + 1;
                    matricaPomocna[i][desno] += (matricaPomocna[i - 1][j] - 1) / 2;
                }
                else {
                    matricaPomocna[i][desno] += (matricaPomocna[i - 1][j] - 1) / 2 + 1;
                    matricaPomocna[i][levo] += (matricaPomocna[i - 1][j] - 1) / 2;
                }
            }
            else matricaPomocna[i][j] += matricaPomocna[i-1][j];
        }
    }

    for(long x = 0; x < n - 1; x++)
        cout<<matricaPomocna[h-1][x]<<" ";
    cout<<matricaPomocna[h-1][n-1];
    return 0;
}