Language: C++

#include <cstdlib>
#include <vector>
#include <set>
#include <map>
#include <iostream>

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:10:1: error: 'map' does not name a type
   10 | map<int, int> dp;
      | ^~~
a.cc: In function 'int dfs(int, int)':
a.cc:21:9: error: 'dp' was not declared in this scope
   21 |     if (dp.find(state) != dp.end()) return dp[state];
      |         ^~
a.cc:22:5: error: 'vector' was not declared in this scope
   22 |     vector<int> already;
      |     ^~~~~~
a.cc:22:5: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:2:
/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:22:12: error: expected primary-expression before 'int'
   22 |     vector<int> already;
      |            ^~~
a.cc:23:5: error: 'memset' was not declared in this scope
   23 |     memset(ok, true, sizeof(ok));
      |     ^~~~~~
a.cc:6:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    5 | #include <iostream>
  +++ |+#include <cstring>
    6 | 
a.cc:27:13: error: 'already' was not declared in this scope; did you mean 'fread'?
   27 |             already.push_back(i);
      |             ^~~~~~~
      |             fread
a.cc:33:14: error: 'already' was not declared in this scope; did you mean 'fread'?
   33 |     int sz = already.size();
      |              ^~~~~~~
      |              fread
a.cc:37:28: error: 'aj' was not declared in this scope; did you mean 'ai'?
   37 |             if (c[ai] == c[aj]) {
      |                            ^~
      |                            ai
a.cc:41:23: error: 'max' was not declared in this scope; did you mean 'std::max'?
   41 |                 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:45:12: error: 'dp' was not declared in this scope
   45 |     return dp[state] = ret;
      |            ^~
a.cc: In function 'int main()':
a.cc:49:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   49 |     cin.tie(0);
      |     ^~~
      |     std::cin
In file included from a.cc:5:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:50:5: error: 'ios' has not been declared
   50 |     ios::sync_with_stdio(false);
      |     ^~~
a.cc:54:7: error: 'dp' was not declared in this scope
   54 |       dp.clear();
      |       ^~
a.cc:55:7: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   55 |       cout << dfs(0, n) << endl;
      |       ^~~~
      |       std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:55:28: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   55 |       cout << dfs(0, n) << endl;
      |                            ^~~~
      |                            std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~