Language: C++

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
//#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
//#include<list>
#include<queue>
#include<deque>
#include<algorithm>
//#include<numeric>
#include<utility>
#include<complex>
//#include<memory>
#include<functional>
#include<cassert>
#include<set>
#include<stack>
#include<random>

const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;

const int MAXN = 30;
int x[MAXN], y[MAXN], r[MAXN], c[MAXN];
bool ok[MAXN];
char dp[1<<24];

int square(int x) {return x*x;}

// i, j ???????????£?????????????????????
// ????????£????????? true
bool check(int i, int j) {
    int d2 = square(x[i]-x[j]) + square(y[i]-y[j]);
    return d2 < square(r[i]+r[j]);
}

char dfs(int state, int n) {
    char& ret = dp[state];
    if (ret >= 0) return ret;
    ret = 0;
    // ???????????¨??????????????§??????????????????????????????
    vector<int> already;
    memset(ok, true, sizeof(ok));
    for (int i = 0; i < n; i++) {
        if ((state>>i)&1) continue;
        if (ok[i]) {
            already.push_back(i);
        }
        for (int j = i+1; j < n; j++) {
            if (check(i, j)) ok[j] = false;
        }
    }
    int sz = already.size();
    for (int i = 0; i < sz; i++) {
        for (int j = i+1; j < sz; j++) {
            int ai = already[i], aj = already[j];
            if (c[ai] == c[aj]) {
                int nstate = state;
                nstate |= 1<<ai;
                nstate |= 1<<aj;
                ret = max(2+dfs(nstate, n), ret);
            }
        }
    }
    return ret;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    while (cin >> n) {
        if (n==0) break;
        for (int i = 0; i < n; i++) cin >> x[i] >> y[i] >> r[i] >> c[i];
memset(dp, -1, sizeof(dp));
        cout << (int)dfs(0, n) << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'char dfs(int, int)':
a.cc:72:26: error: no matching function for call to 'max(int, char&)'
   72 |                 ret = max(2+dfs(nstate, n), ret);
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/specfun.h:43,
                 from /usr/include/c++/14/cmath:3906,
                 from a.cc:4:
/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:72:26: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'char')
   72 |                 ret = max(2+dfs(nstate, n), ret);
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~~
/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,
                 from a.cc:14:
/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:72:26: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   72 |                 ret = max(2+dfs(nstate, n), ret);
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~~