Language: C++

#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
    struct newdata
    {
        int label,cnt;
    };
    int n,m;
    int a[301][301];
    newdata rank[301];
    bool used[301];
bool cmp(newdata i,newdata j)
{
    return (i.cnt>j.cnt);
}
int main()
{
    scanf("%d%d",&n,&m);
    for (int i=1;i<=n;i++)
        for (int j=1;j<=m;j++)
        {
            scanf("%d",&a[i][j]);
            if (j==1) rank[a[i][j]].cnt++;
        }
    int now=0;
    for (int i=1;i<=m;i++)
        rank[i].label=i;
    int ans=2147483647;
    while (now<m)
    {
        sort(rank+1,rank+m+1,cmp);
        ans=min(ans,rank[1].cnt);
        used[rank[1].label]=true;
        memset(rank,0,sizeof(rank));
        for (int i=1;i<=m;i++)
            rank[i].label=i;
        for (int i=1;i<=n;i++)
            for (int j=1;j<=m;j++)
            	if (!used[a[i][j]])
            	{
					rank[a[i][j]].cnt++;
					break;
				}
        now++;
    }
    printf("%d",ans);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:23: error: reference to 'rank' is ambiguous
   24 |             if (j==1) rank[a[i][j]].cnt++;
      |                       ^~~~
In file included from /usr/include/c++/14/bits/stl_pair.h:60,
                 from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/algorithm:60,
                 from a.cc:2:
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
 1437 |     struct rank
      |            ^~~~
a.cc:11:13: note:                 'newdata rank [301]'
   11 |     newdata rank[301];
      |             ^~~~
a.cc:28:9: error: reference to 'rank' is ambiguous
   28 |         rank[i].label=i;
      |         ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
 1437 |     struct rank
      |            ^~~~
a.cc:11:13: note:                 'newdata rank [301]'
   11 |     newdata rank[301];
      |             ^~~~
a.cc:32:14: error: reference to 'rank' is ambiguous
   32 |         sort(rank+1,rank+m+1,cmp);
      |              ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
 1437 |     struct rank
      |            ^~~~
a.cc:11:13: note:                 'newdata rank [301]'
   11 |     newdata rank[301];
      |             ^~~~
a.cc:32:21: error: reference to 'rank' is ambiguous
   32 |         sort(rank+1,rank+m+1,cmp);
      |                     ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
 1437 |     struct rank
      |            ^~~~
a.cc:11:13: note:                 'newdata rank [301]'
   11 |     newdata rank[301];
      |             ^~~~
a.cc:33:21: error: reference to 'rank' is ambiguous
   33 |         ans=min(ans,rank[1].cnt);
      |                     ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
 1437 |     struct rank
      |            ^~~~
a.cc:11:13: note:                 'newdata rank [301]'
   11 |     newdata rank[301];
      |             ^~~~
a.cc:34:14: error: reference to 'rank' is ambiguous
   34 |         used[rank[1].label]=true;
      |              ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
 1437 |     struct rank
      |            ^~~~
a.cc:11:13: note:                 'newdata rank [301]'
   11 |     newdata rank[301];
      |             ^~~~
a.cc:35:16: error: reference to 'rank' is ambiguous
   35 |         memset(rank,0,sizeof(rank));
      |                ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
 1437 |     struct rank
      |            ^~~~
a.cc:11:13: note:                 'newdata rank [301]'
   11 |     newdata rank[301];
      |             ^~~~
a.cc:35:30: error: reference to 'rank' is ambiguous
   35 |         memset(rank,0,sizeof(rank));
      |                              ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
 1437 |     struct rank
      |            ^~~~
a.cc:11:13: note:                 'newdata rank [301]'
   11 |     newdata rank[301];
      |             ^~~~
a.cc:37:13: error: reference to 'rank' is ambiguous
   37 |             rank[i].label=i;
      |             ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
 1437 |     struct rank
      |            ^~~~
a.cc:11:13: note:                 'newdata rank [301]'
   11 |     newdata rank[301];
      |             ^~~~
a.cc:42:41: error: reference to 'rank' is ambiguous
   42 |                                         rank[a[i][j]].cnt++;
      |                                         ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
 1437 |     struct rank
      |            ^~~~
a.cc:11:13: note:                 'newdata rank [301]'
   11 |     newdata rank[301];
      |             ^~~~