Language: C++

#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <functional>
#include <limits.h>
#include <set>
#include <map>
#include <tuple>
using namespace std;



#define ll long long
#define ull unsigned long long
#define rep(i,N) for (ll i=0;i<N;i++)
#define loop(i,N,M) for(ll i=N;i<M;i++)
#define MAX(v) *max_element(v.begin(),v.end())
#define MIN(v) *min_element(v.begin(),v.end())
#define SORTL2S(type,v) sort(v.begin(),v.end(),greater<type>())
#define SORTS2L(type,v) sort(v.begin(),v.end())
#define SORTMF(v,func) sort(v.begin(),v.end(),func)

ll debugFlag = false;
template<typename T> void debug(T&);
template<typename T> void debug(T&, bool);
template<typename T> void debug(vector<T>&);
template<typename T> void debug(vector<T>&, bool);
template<typename T, typename U> void debug(pair<T, U>&);
template<typename T, typename U> void debug(pair<T, U>&, bool);

template<typename T>
void debug(T& obj) {
	debug(obj, true);
}

template<typename T>
void debug(T& obj, bool lnFlag) {
	if (!debugFlag) return;
	cout << obj;
	if (lnFlag) cout << endl;
}

template<typename T>
void debug(vector<T>& obj) {
	debug(obj, true);
}

template<typename T>
void debug(vector<T>& obj, bool lnFlag) {
	if (!debugFlag) return;
	cout << "[";
	rep(i, obj.size()) {
		if (i != 0) cout << ",";
		debug(obj[i], false);
	}
	cout << "]";
	if (lnFlag) cout << endl;
}

template<typename T, typename U>
void debug(pair<T, U>& obj) {
	debug(obj, true);
}

template<typename T, typename U>
void debug(pair<T, U>& obj, bool lnFlag) {
	if (!debugFlag) return;
	cout << "(";
	debug(obj.first, false);
	cout << ",";
	debug(obj.second, false);
	cout << ")";
	if (lnFlag) cout << endl;
}

bool isPrime(ll num) {

	bool flag = true;
	for (int i = 2; i <= sqrt(num); i++) {
		if (num%i == 0) {
			flag = false;
			break;
		}
	}

	return flag;
}

vector<vector<vector<bool>>> others;
vector<vector<ll>> profit;

vector<vector<bool>> open(5, vector<bool>(2));
vector<vector<bool>> best(5, vector<bool>(2));
ll N;

vector<ll> ans(0);

void sale(int day, int time) {

	if (day == 5) {
		//評価

		bool flag = false;
		rep(i, 5) rep(j,2) {
			if (open[i][j] == true) flag = true;
		}
		if (flag == false) return;

		ll sum = 0;

		rep(i, N) {

			ll cnt = 0;
			rep(j, 5) rep(k, 2) {
				if (open[j][k] && others[i][j][k]) cnt++;
			}

			sum += profit[i][cnt];

		}

		if (ans.size() == 0) {
			ans.emplace_back(sum);
			debug(sum);
			debug(open);
		}
		else if (ans[0] < sum){
			ans[0] = sum;
			debug(sum);
			debug(open);
		}

		return;
	}

	open[day][time] = false;

	if (time == 0) sale(day, 1);
	else sale(day + 1, 0);

	open[day][time] = true;

	if (time == 0) sale(day, 1);
	else sale(day + 1, 0);

}

void solve() {

	cin >> N;
	others.resize(N, vector<vector<bool>>(5, vector<bool>(2)));

	rep(i, N) rep(j, 5) rep(k, 2) {
		int tmp;
		cin >> tmp;
		others[i][j][k] = (tmp == 1);
	}

	profit.resize(N, vector<ll>(11));

	rep(i, N) rep(j, 11) cin >> profit[i][j];

	//open = vector<vector<bool>>(5,vector<bool>(2,true));

	sale(0, 0);

	cout << ans[0] << endl;
	debug(others);
	debug(profit);

}


int main(int argc, char* argv[]) {
	if (argc == 2 && string(argv[1]) == "debug") debugFlag = true;
	solve();
	return 0;
}


Compiler output:
a.cc: In instantiation of 'void debug(std::vector<_Tp>&, bool) [with T = bool]':
a.cc:59:8:   required from 'void debug(std::vector<_Tp>&, bool) [with T = std::vector<bool>]'
   59 |                 debug(obj[i], false);
      |                 ~~~~~^~~~~~~~~~~~~~~
a.cc:50:7:   required from 'void debug(std::vector<_Tp>&) [with T = std::vector<bool>]'
   50 |         debug(obj, true);
      |         ~~~~~^~~~~~~~~~~
a.cc:130:9:   required from here
  130 |                         debug(open);
      |                         ~~~~~^~~~~~
a.cc:59:22: error: no matching function for call to 'debug(std::vector<bool>::reference, bool)'
   59 |                 debug(obj[i], false);
      |                 ~~~~~^~~~~~~~~~~~~~~
a.cc:42:6: note: candidate: 'void debug(T&, bool) [with T = std::_Bit_reference]' (near match)
   42 | void debug(T& obj, bool lnFlag) {
      |      ^~~~~
a.cc:42:6: note:   conversion of argument 1 would be ill-formed:
a.cc:59:26: error: cannot bind non-const lvalue reference of type 'std::_Bit_reference&' to an rvalue of type 'std::vector<bool>::reference'
   59 |                 debug(obj[i], false);
      |                       ~~~^
a.cc:37:6: note: candidate: 'template<class T> void debug(T&)'
   37 | void debug(T& obj) {
      |      ^~~~~
a.cc:37:6: note:   candidate expects 1 argument, 2 provided
a.cc:49:6: note: candidate: 'template<class T> void debug(std::vector<_Tp>&)'
   49 | void debug(vector<T>& obj) {
      |      ^~~~~
a.cc:49:6: note:   candidate expects 1 argument, 2 provided
a.cc:54:6: note: candidate: 'template<class T> void debug(std::vector<_Tp>&, bool)'
   54 | void debug(vector<T>& obj, bool lnFlag) {
      |      ^~~~~
a.cc:54:6: note:   template argument deduction/substitution failed:
a.cc:59:22: note:   'std::vector<bool>::reference' is not derived from 'std::vector<_Tp>'
   59 |                 debug(obj[i], false);
      |                 ~~~~~^~~~~~~~~~~~~~~
a.cc:66:6: note: candidate: 'template<class T, class U> void debug(std::pair<_T1, _T2>&)'
   66 | void debug(pair<T, U>& obj) {
      |      ^~~~~
a.cc:66:6: note:   candidate expects 1 argument, 2 provided
a.cc:71:6: note: candidate: 'template<class T, class U> void debug(std::pair<_T1, _T2>&, bool)'
   71 | void debug(pair<T, U>& obj, bool lnFlag) {
      |      ^~~~~
a.cc:71:6: note:   template argument deduction/substitution failed:
a.cc:59:22: note:   'std::vector<bool>::reference' is not derived from 'std::pair<_T1, _T2>'
   59 |                 debug(obj[i], false);
      |                 ~~~~~^~~~~~~~~~~~~~~