Language: C++

#include<bits/stdc++.h>
using namespace std;

int n;
int x[24],y[24],r[24],c[24];
bool memo[1<<25];

//dist(i,j)<r[i]+r[j]->ok
bool ok(int a,int bit){#include<bits/stdc++.h>
using namespace std;

int n;
int x[24],y[24],r[24],c[24];
bool memo[1<<25];

//dist(i,j)<r[i]+r[j]->ok
bool ok(int a,int bit){
    for(int i=0;i<a;i++){
        if(((bit>>i)&1)==0)continue;
        int dist=(x[i]-x[a])*(x[i]-x[a])+(y[i]-y[a])*(y[i]-y[a]);
        int sum=(r[i]+r[a])*(r[i]+r[a]);
        if(dist<sum)return false;
    }
    return true;
}

int dfs(int bit){
    memo[bit]=true;

    int ret=n;
    for(int i=0;i<n;i++)if((bit>>i)&1)ret--;

    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            if(((bit>>i)&1)==0)continue;
            if(((bit>>j)&1)==0)continue;
            int to_bit=(bit^(1<<i))^(1<<j);
            if(c[i]==c[j]&&ok(i,bit)&&ok(j,bit)&&!memo[to_bit]){
                ret=max(ret,dfs(to_bit));
            }
        }
    }

    return ret;
}

void solve(){
    fill_n(memo,1<<n,false);

    cout<<dfs((1<<n)-1)<<endl;
}

bool input(){
    cin>>n;
    if(!n)return false;
    for(int i=0;i<n;i++)cin>>x[i]>>y[i]>>r[i]>>c[i];
    return true;
}
int main(){

    int a=(1<<5)-1;
    while(input())solve();
    return 0;
}

    for(int i=0;i<a;i++){
        if(((bit>>i)&1)==0)continue;
        int dist=(x[i]-x[a])*(x[i]-x[a])+(y[i]-y[a])*(y[i]-y[a]);
        int sum=(r[i]+r[a])*(r[i]+r[a]);
        if(dist<sum)return false;
    }
    return true;
}

int dfs(int bit){
    if(memo[bit]==true)return 0;
    memo[bit]=true;

    int ret=n;
    for(int i=0;i<n;i++)if((bit>>i)&1)ret--;

    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            if(((bit>>i)&1)==0)continue;
            if(((bit>>j)&1)==0)continue;
            if(c[i]==c[j]&&ok(i,bit)&&ok(j,bit)){
                ret=max(ret,dfs((bit^(1<<i))^(1<<j)));
            }
        }
    }

    return ret;
}

void solve(){
    fill_n(memo,1<<n,false);

    cout<<dfs((1<<n)-1)<<endl;
}

bool input(){
    cin>>n;
    if(!n)return false;
    for(int i=0;i<n;i++)cin>>x[i]>>y[i]>>r[i]>>c[i];
    return true;
}
int main(){

    int a=(1<<5)-1;
    while(input())solve();
    return 0;
}

Compiler output:
a.cc:9:24: error: stray '#' in program
    9 | bool ok(int a,int bit){#include<bits/stdc++.h>
      |                        ^
a.cc: In function 'bool ok(int, int)':
a.cc:9:25: error: 'include' was not declared in this scope
    9 | bool ok(int a,int bit){#include<bits/stdc++.h>
      |                         ^~~~~~~
a.cc:9:33: error: 'bits' was not declared in this scope; did you mean 'bit'?
    9 | bool ok(int a,int bit){#include<bits/stdc++.h>
      |                                 ^~~~
      |                                 bit
a.cc:9:38: error: 'stdc' was not declared in this scope; did you mean 'std'?
    9 | bool ok(int a,int bit){#include<bits/stdc++.h>
      |                                      ^~~~
      |                                      std
a.cc:10:1: error: expected primary-expression before 'using'
   10 | using namespace std;
      | ^~~~~
a.cc:17:23: error: a function-definition is not allowed here before '{' token
   17 | bool ok(int a,int bit){
      |                       ^
a.cc:27:17: error: a function-definition is not allowed here before '{' token
   27 | int dfs(int bit){
      |                 ^
a.cc:47:13: error: a function-definition is not allowed here before '{' token
   47 | void solve(){
      |             ^
a.cc:53:11: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   53 | bool input(){
      |           ^~
a.cc:53:11: note: remove parentheses to default-initialize a variable
   53 | bool input(){
      |           ^~
      |           --
a.cc:53:11: note: or replace parentheses with braces to value-initialize a variable
a.cc:53:13: error: a function-definition is not allowed here before '{' token
   53 | bool input(){
      |             ^
a.cc:59:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   59 | int main(){
      |         ^~
a.cc:59:9: note: remove parentheses to default-initialize a variable
   59 | int main(){
      |         ^~
      |         --
a.cc:59:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:59:11: error: a function-definition is not allowed here before '{' token
   59 | int main(){
      |           ^