Language: C++

#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
typedef __int64 int64; 

int nstr;
char strings[40][17];
void init_id(){
	nstr=0;
}
int get_id(char str[]){
	for(int i=0;i<nstr;i++)
		if(strcmp(str,strings[i])==0)return i;
	strcpy(strings[nstr],str);
	return nstr++;
}

inline int64 get_bit(int id){
	return (int64)1<<id;
}

struct A{
	int id;
	int power;
	int64 neighbor;
	int count()const{
		int res=0;
		for(int i=0;i<64;i++)res+= neighbor>>i&1;
		return res;
	}
	bool operator <(const A&a)const{
		return count() > a.count();
	}
}kuni[40];

int search(int i,int n,int power,int64 neighbor){
	int tmp,max;	
	int64 a=neighbor;
	
	for(int j=i;j<n;j++)
		a |= kuni[j].neighbor;
	for(int j=i;j<n;j++){
		if( (get_bit(kuni[j].id) & a)==0){
			power += kuni[j].power;
			neighbor |= get_bit(kuni[j].id);
		}
	}
	max = power;
	for(;i<n;i++){
		if( (get_bit(kuni[i].id) & neighbor)==0 ){
			tmp = search(i+1,n,power+kuni[i].power,neighbor|kuni[i].neighbor);
			if(max < tmp){
				max = tmp;
			}
		}
	}
	return max;
}
int main(){
	int n;
	bool nei;
	while(cin>>n,n){
		init_id();
		for(int i=0;i<n;i++){
			char a[17],d[17];
			int b,c;
			cin>>a>>b>>c;
			kuni[i].id = get_id(a);
			kuni[i].power = b;
			kuni[i].neighbor = 0;
			nei=false;
			while(c--){
				cin>>d;
				kuni[i].neighbor |= get_bit(get_id(d));
				if(d==0)nei=true;
			}
			if(nei){
				n--;
				i--;
			}
		}
		sort(kuni+1,kuni+n);
		cout<<search(1,n,kuni[0].power,kuni[0].neighbor)<<endl;
	}
	return 0;
}

Compiler output:
a.cc:5:9: error: '__int64' does not name a type; did you mean '__int64_t'?
    5 | typedef __int64 int64;
      |         ^~~~~~~
      |         __int64_t
a.cc:19:8: error: 'int64' does not name a type; did you mean 'int64_t'?
   19 | inline int64 get_bit(int id){
      |        ^~~~~
      |        int64_t
a.cc:26:9: error: 'int64' does not name a type; did you mean 'int64_t'?
   26 |         int64 neighbor;
      |         ^~~~~
      |         int64_t
a.cc: In member function 'int A::count() const':
a.cc:29:44: error: 'neighbor' was not declared in this scope
   29 |                 for(int i=0;i<64;i++)res+= neighbor>>i&1;
      |                                            ^~~~~~~~
a.cc: At global scope:
a.cc:37:34: error: 'int64' has not been declared
   37 | int search(int i,int n,int power,int64 neighbor){
      |                                  ^~~~~
a.cc: In function 'int search(int, int, int, int)':
a.cc:39:9: error: 'int64' was not declared in this scope; did you mean 'int64_t'?
   39 |         int64 a=neighbor;
      |         ^~~~~
      |         int64_t
a.cc:42:17: error: 'a' was not declared in this scope
   42 |                 a |= kuni[j].neighbor;
      |                 ^
a.cc:42:30: error: 'struct A' has no member named 'neighbor'
   42 |                 a |= kuni[j].neighbor;
      |                              ^~~~~~~~
a.cc:44:22: error: 'get_bit' was not declared in this scope; did you mean 'get_id'?
   44 |                 if( (get_bit(kuni[j].id) & a)==0){
      |                      ^~~~~~~
      |                      get_id
a.cc:44:44: error: 'a' was not declared in this scope
   44 |                 if( (get_bit(kuni[j].id) & a)==0){
      |                                            ^
a.cc:51:22: error: 'get_bit' was not declared in this scope; did you mean 'get_id'?
   51 |                 if( (get_bit(kuni[i].id) & neighbor)==0 ){
      |                      ^~~~~~~
      |                      get_id
a.cc:52:81: error: 'struct A' has no member named 'neighbor'
   52 |                         tmp = search(i+1,n,power+kuni[i].power,neighbor|kuni[i].neighbor);
      |                                                                                 ^~~~~~~~
a.cc: In function 'int main()':
a.cc:71:33: error: 'struct A' has no member named 'neighbor'
   71 |                         kuni[i].neighbor = 0;
      |                                 ^~~~~~~~
a.cc:75:41: error: 'struct A' has no member named 'neighbor'
   75 |                                 kuni[i].neighbor |= get_bit(get_id(d));
      |                                         ^~~~~~~~
a.cc:75:53: error: 'get_bit' was not declared in this scope; did you mean 'get_id'?
   75 |                                 kuni[i].neighbor |= get_bit(get_id(d));
      |                                                     ^~~~~~~
      |                                                     get_id
a.cc:84:56: error: 'struct A' has no member named 'neighbor'
   84 |                 cout<<search(1,n,kuni[0].power,kuni[0].neighbor)<<endl;
      |                                                        ^~~~~~~~