Language: C++

#include "bits/stdc++.h"
#define ALL(x) x.begin(), x.end()
#define iostreamBooster() do{ cin.tie(nullptr); ios_base::sync_with_stdio(false); }while(0)
using namespace std;
typedef int64_t i64;
typedef pair<int,int> pii;
template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;}
constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

signed main()
{
  int N;
  int f[105][10];
  int p[105][10];

  cin >> N;
  for (int i = 0; i < N; ++i) {
    for (int j = 0; j < 10; ++j) cin >> f[i][j];
  }

  for (int i = 0; i < N; ++i) {
    for (int j = 0; j <= 10; ++j) cin >> p[i][j];
  }

  auto slv = [&](bitset<10> bit) {
    i64 ans = 0;
    for (int i = 0; i < N; ++i) {

      int cnt = 0;
      for (int j = 0; j < 10; ++j) {
        if (f[i][j] && bit[j]) ++cnt;
      }

      ans += p[i][cnt];
    }
    return ans;
  };

  i64 ans = -LINF;
  for (int i = 1; i < (1 << 10); ++i) {
    chmax(ans, slv(i));
  }

  cout << ans << endl;

  return 0;
}

#include "bits/stdc++.h"
#define ALL(x) x.begin(), x.end()
#define iostreamBooster() do{ cin.tie(nullptr); ios_base::sync_with_stdio(false); }while(0)
using namespace std;
typedef int64_t i64;
typedef pair<int,int> pii;
template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;}
constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

signed main()
{
  int N;
  int f[105][10];
  int p[105][10];

  cin >> N;
  for (int i = 0; i < N; ++i) {
    for (int j = 0; j < 10; ++j) cin >> f[i][j];
  }

  for (int i = 0; i < N; ++i) {
    for (int j = 0; j <= 10; ++j) cin >> p[i][j];
  }

  auto slv = [&](bitset<10> bit) {
    i64 ans = 0;
    for (int i = 0; i < N; ++i) {

      int cnt = 0;
      for (int j = 0; j < 10; ++j) {
        if (f[i][j] && bit[j]) ++cnt;
      }

      ans += p[i][cnt];
    }
    return ans;
  };

  i64 ans = -LINF;
  for (int i = 1; i < (1 << 10); ++i) {
    chmax(ans, slv(i));
  }

  cout << ans << endl;

  return 0;
}



Compiler output:
a.cc:57:39: error: redefinition of 'template<class A, class B> bool chmax(A&, const B&)'
   57 | template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;}
      |                                       ^~~~~
a.cc:7:39: note: 'template<class A, class B> bool chmax(A&, const B&)' previously declared here
    7 | template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;}
      |                                       ^~~~~
a.cc:58:39: error: redefinition of 'template<class A, class B> bool chmin(A&, const B&)'
   58 | template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;}
      |                                       ^~~~~
a.cc:8:39: note: 'template<class A, class B> bool chmin(A&, const B&)' previously declared here
    8 | template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;}
      |                                       ^~~~~
a.cc:59:15: error: redefinition of 'constexpr const int INF'
   59 | constexpr int INF = 0x3f3f3f3f;
      |               ^~~
a.cc:9:15: note: 'constexpr const int INF' previously defined here
    9 | constexpr int INF = 0x3f3f3f3f;
      |               ^~~
a.cc:60:15: error: redefinition of 'constexpr const i64 LINF'
   60 | constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
      |               ^~~~
a.cc:10:15: note: 'constexpr const i64 LINF' previously defined here
   10 | constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
      |               ^~~~
a.cc:62:8: error: redefinition of 'int main()'
   62 | signed main()
      |        ^~~~
a.cc:12:8: note: 'int main()' previously defined here
   12 | signed main()
      |        ^~~~