Language: C++

#include <cstdio>
#include <cstring>
#include <vector>

const int MAXN = 30;
int x[MAXN], y[MAXN], r[MAXN], c[MAXN];
bool ok[MAXN];
map<int, int> dp;

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

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]);
}

int dfs(int state, int n) {
    int ret = 0;
    if (dp.find(state) != dp.end()) return dp[state];
    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 dp[state] = ret;
}

int main() {
    // cin.tie(0);
    // ios::sync_with_stdio(false);
    int n;
    while(scanf("%d", &n) && n){
      for (int i = 0; i < n; i++) scanf("%d %d %d %d", &x[i],&y[i],&r[i],&c[i]);
      dp.clear();
      cout << dfs(0, n) << endl;
    }
    return 0;
}



Compiler output:
a.cc:8:1: error: 'map' does not name a type
    8 | map<int, int> dp;
      | ^~~
a.cc: In function 'int dfs(int, int)':
a.cc:19:9: error: 'dp' was not declared in this scope
   19 |     if (dp.find(state) != dp.end()) return dp[state];
      |         ^~
a.cc:20:5: error: 'vector' was not declared in this scope
   20 |     vector<int> already;
      |     ^~~~~~
a.cc:20:5: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_vector.h:428:11: note:   'std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
/usr/include/c++/14/vector:93:13: note:   'std::pmr::vector'
   93 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
a.cc:20:12: error: expected primary-expression before 'int'
   20 |     vector<int> already;
      |            ^~~
a.cc:25:13: error: 'already' was not declared in this scope; did you mean 'fread'?
   25 |             already.push_back(i);
      |             ^~~~~~~
      |             fread
a.cc:31:14: error: 'already' was not declared in this scope; did you mean 'fread'?
   31 |     int sz = already.size();
      |              ^~~~~~~
      |              fread
a.cc:35:28: error: 'aj' was not declared in this scope; did you mean 'ai'?
   35 |             if (c[ai] == c[aj]) {
      |                            ^~
      |                            ai
a.cc:39:23: error: 'max' was not declared in this scope; did you mean 'std::max'?
   39 |                 ret = max(2+dfs(nstate, n), ret);
      |                       ^~~
      |                       std::max
In file included from /usr/include/c++/14/vector:62:
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: 'std::max' declared here
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
a.cc:43:12: error: 'dp' was not declared in this scope
   43 |     return dp[state] = ret;
      |            ^~
a.cc: In function 'int main()':
a.cc:52:7: error: 'dp' was not declared in this scope
   52 |       dp.clear();
      |       ^~
a.cc:53:7: error: 'cout' was not declared in this scope
   53 |       cout << dfs(0, n) << endl;
      |       ^~~~
a.cc:53:28: error: 'endl' was not declared in this scope
   53 |       cout << dfs(0, n) << endl;
      |                            ^~~~