Language: C++

#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define lson o<<1
#define rson o<<1|1
#define CLR(A, X) memset(A, X, sizeof(A))
using namespace std;

typedef long long LL;
typedef pair<int, int> PII;
const double eps = 1e-10;
int dcmp(double x){if(fabs(x)<eps) return 0; return x<0?-1:1;}
const int N = 1e5+5;
const int INF = 0x3f3f3f3f;

int a[305][305], pri[305][305];
bool vis[305];
vector<int> g[305];
int n, m;

void dfs(int x) {
    vector<int> gl;
    int now = 0, y = INF;
    for(int i = g[x].size()-1; i >= 0; i--) {
        int u = g[x][i];
        for(int j = 0; j < m; j++) if(!vis[a[u][j]]) {
            g[a[u][j]].pb(u);
            now = max(now, g[a[u][j]].size());
            y = min(y, g[a[u][j]].size());
            break;
        }
        gl.pb(u);
    }
    ans = min(ans, now);
    if(y >= ans) return;
    g[x].clear();
    for(int j = 0; j < m; j++) if(!vis[j]) {
        vis[j] = 1;
        dfs(j);
        vis[j] = 0;
    }
    for(int i = 0; i < gl.size(); i++) g[x].pb(gl[i]);
}

int main() {

    scanf("%d%d", &n, &m);
    ans = 0;
    for(int i = 0; i < n; i++) {
        for(int j = 0; j < m; j++) {
            scanf("%d", &a[i][j]);
        }
        g[a[i][0]].pb(i);
        ans = max(ans, g[a[i][0]].size());
    }
    CLR(vis, 0);
    for(int i = 0; i < n; i++) {
        vis[i] = 1;
        dfs(i);
    }
    printf("%d\n", ans);
    return 0;
}


Compiler output:
a.cc: In function 'void dfs(int)':
a.cc:29:22: error: no matching function for call to 'max(int&, std::vector<int>::size_type)'
   29 |             now = max(now, g[a[u][j]].size());
      |                   ~~~^~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:29:22: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'std::vector<int>::size_type' {aka 'long unsigned int'})
   29 |             now = max(now, g[a[u][j]].size());
      |                   ~~~^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:29:22: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   29 |             now = max(now, g[a[u][j]].size());
      |                   ~~~^~~~~~~~~~~~~~~~~~~~~~~~
a.cc:30:20: error: no matching function for call to 'min(int&, std::vector<int>::size_type)'
   30 |             y = min(y, g[a[u][j]].size());
      |                 ~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:30:20: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'std::vector<int>::size_type' {aka 'long unsigned int'})
   30 |             y = min(y, g[a[u][j]].size());
      |                 ~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:30:20: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   30 |             y = min(y, g[a[u][j]].size());
      |                 ~~~^~~~~~~~~~~~~~~~~~~~~~
a.cc:35:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   35 |     ans = min(ans, now);
      |     ^~~
      |     abs
a.cc: In function 'int main()':
a.cc:49:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   49 |     ans = 0;
      |     ^~~
      |     abs