#include <bits/stdc++.h>
#define lli long long int
using namespace std;
multimap< int , int > score;
map< int , int > num;
void increase( int x)
{
map< int , int > :: iterator num_it = num.find ( x) ;
if ( num_it == num.end ( ) )
{
num[ x] = 1 ;
score.insert ( make_pair( 1 , x ) ) ;
}
else
{
score_it = ( num_it- > second) ;
int cnt = score_it- > first + 1 ;
score.erase ( score_it ) ;
num_it- > second = score.insert ( make_pair( cnt , x ) ) ;
}
}
int getMin( )
{
return score.begin ( ) - > second;
}
int main( )
{
ios_base:: sync_with_stdio ( false ) ;
int n , m;
cin >> n>> m;
for ( int i= 0 ; i< n ; i++ )
{
for ( int j= 0 ; j< m ; j++ )
{
int x; cin >> x;
increase( x) ;
}
cout << getMin( ) << "\n " ;
}
return 0 ;
}
CiNpbmNsdWRlIDxiaXRzL3N0ZGMrKy5oPgojZGVmaW5lIGxsaSBsb25nIGxvbmcgaW50CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgptdWx0aW1hcDxpbnQgLCBpbnQ+IHNjb3JlOwptYXA8aW50ICwgaW50PiBudW07Cgp2b2lkIGluY3JlYXNlKGludCB4KQp7CgltYXA8aW50ICwgaW50Pjo6aXRlcmF0b3IgbnVtX2l0ID0gbnVtLmZpbmQoeCk7CglpZiAoIG51bV9pdCA9PSBudW0uZW5kKCkgKQoJewoJCW51bVt4XSA9IDE7CgkJc2NvcmUuaW5zZXJ0KCBtYWtlX3BhaXIoIDEgLCB4ICkgKTsKCX0KCWVsc2UKCXsKCQlzY29yZV9pdCA9IChudW1faXQtPnNlY29uZCk7CgkJaW50IGNudCA9IHNjb3JlX2l0LT5maXJzdCArIDE7CgkJc2NvcmUuZXJhc2UoIHNjb3JlX2l0ICk7CgkJbnVtX2l0LT5zZWNvbmQgPSBzY29yZS5pbnNlcnQoIG1ha2VfcGFpciggY250ICwgeCApICk7Cgl9Cn0KCmludCBnZXRNaW4oKQp7CglyZXR1cm4gc2NvcmUuYmVnaW4oKS0+c2Vjb25kOwp9CgppbnQgbWFpbigpCnsJCglpb3NfYmFzZTo6c3luY193aXRoX3N0ZGlvKGZhbHNlKTsKCWludCBuICwgbTsKCQoJY2luPj5uPj5tOwoJZm9yIChpbnQgaT0wIDsgaTxuIDsgaSsrKQoJewoJCWZvciAoaW50IGo9MCA7IGo8bSA7IGorKykKCQl7CgkJCWludCB4OyBjaW4+Png7CgkJCWluY3JlYXNlKHgpOyAKCQl9CgkJCgkJY291dDw8Z2V0TWluKCk8PCJcbiI7Cgl9CgkKCXJldHVybiAwOwp9
compilation info
prog.cpp: In function 'void increase(int)':
prog.cpp:19:3: error: 'score_it' was not declared in this scope
score_it = (num_it->second);
^
prog.cpp:22:18: error: cannot convert 'std::multimap<int, int>::iterator {aka std::_Rb_tree_iterator<std::pair<const int, int> >}' to 'int' in assignment
num_it->second = score.insert( make_pair( cnt , x ) );
^
stdout