#include #define rep(i,n) for(int i=0;i ; const int INF = 1e9; const int MOD = 1000000007; int main(){ int n,m; cin >> n >> m; vector> R(n,vector(m,0)); rep(i,n)rep(j,m) cin >> R[i][j]; vector dp(n); vector>> mx(m); dp[0] = 1; rep(i,m) mx[i] = make_pair(R[0][i],set{0}); for(int i=1;i 0){ ok = true; break; } } if(!ok) --dp[i]; } i_in = true; mx[j] = make_pair(R[i][j],set{i}); }else if(mx[j].first == R[i][j]){ i_in = true; mx[j].second.insert(i); } } if(i_in) ++dp[i]; } rep(i,n) cout << dp[i] << '\n'; return 0; }