Language: C++

#include<algorithm>
#include<complex>
#include<ctype.h>
#include<iomanip>
#include<iostream>
#include<map>
#include<math.h>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<stdio.h>
#include<string>
#include<string>
#include<vector>

using namespace std;
typedef long long ll;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("Yes")
#define p_no() p("No")

const ll mod = 1e9 + 7;
const ll inf = 1e18;

// char to int
int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

const int FLAG_NUM = 10;
// 1023 => 1111 1111
vector<int> num_to_flags(int x){
    stringstream ss;
    ss << static_cast<std::bitset<FLAG_NUM> >(x);
    string s = ss.str();
    vector<int> V(FLAG_NUM);
    FOR(i, 0, FLAG_NUM){
        V[i] = ctoi(s[i]);
    }
    return V;
}

void pV(vector<int> v){
    for(auto a : v){
        cout << a << " ";
    }
    cout << endl;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    // input
    int N;
    cin >> N;

    vector<vector<int> > F(N);
    FOR(i, 0, N){
        FOR(j, 0, 10){
            int f;
            cin >> f;
            F[i].push_back(f);
        }
    }

    vector<vector<int> > P(N);
    FOR(i, 0, N){
        FOR(j, 0, 11){
            int p;
            cin >> p;
            P[i].push_back(p);
        }
    }

    ll max_profit = -inf;
    FOR(i, 1, 1024){
        auto flags = num_to_flags(i);

        ll profit_sum = 0;
        FOR(j, 0, N){
            auto tenpo = F[j];
            int both_work = 0;
            FOR(k, 0, 10){
                if(tenpo[k]==1 && flags[k]==1){
                    both_work++;
                }
            }
            int profit = P[j][both_work];
            profit_sum += profit;
        }
        max_profit = max(max_profit, profit_sum);
    }

    p(max_profit);
    
    return 0;
}

Compiler output:
a.cc: In function 'std::vector<int> num_to_flags(int)':
a.cc:43:28: error: 'bitset' in namespace 'std' does not name a template type
   43 |     ss << static_cast<std::bitset<FLAG_NUM> >(x);
      |                            ^~~~~~
a.cc:12:1: note: 'std::bitset' is defined in header '<bitset>'; this is probably fixable by adding '#include <bitset>'
   11 | #include<stack>
  +++ |+#include <bitset>
   12 | #include<stdio.h>
a.cc:43:34: error: expected '>' before '<' token
   43 |     ss << static_cast<std::bitset<FLAG_NUM> >(x);
      |                                  ^
a.cc:43:34: error: expected '(' before '<' token
   43 |     ss << static_cast<std::bitset<FLAG_NUM> >(x);
      |                                  ^
      |                                  (
a.cc:43:34: error: expected primary-expression before '<' token
a.cc:43:45: error: expected primary-expression before '>' token
   43 |     ss << static_cast<std::bitset<FLAG_NUM> >(x);
      |                                             ^
a.cc:43:49: error: expected ')' before ';' token
   43 |     ss << static_cast<std::bitset<FLAG_NUM> >(x);
      |                                                 ^
      |                                                 )