Language: C++

package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
)

var (
	readString func() string
	stdout     *bufio.Writer
)

func init() {
	readString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = readInt()
	}
	return b
}

func readLengthAndSlice() []int {
	n := readInt()
	return readIntSlice(n)
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

// readString() string
// readInt() int
// readIntSlice(n int) []int
// readLengthAndSlice() []int
func main() {
	defer stdout.Flush()

	N := readInt()
	F := make([][]bool, N)
	for i := range F {
		F[i] = make([]bool, 10)
		for j := range F[i] {
			x := readInt()
			if x == 1 {
				F[i][j] = true
			}
		}
	}

	P := make([][]int, N)
	for i := range P {
		P[i] = make([]int, 11)
		for j := range P[i] {
			P[i][j] = readInt()
		}
	}

	ans := math.MinInt32
	DoWithExhaustiveBits(10, func(b []bool) {
		c := make([]int, N)
		var tmp int
		for i := range c {
			for j := range b {
				if b[j] && F[i][j] {
					c[i]++
				}
			}
			tmp += P[i][c[i]]
		}
		if ans < tmp {
			ans = tmp
		}
	})
	println(ans)
}

func DoWithExhaustiveBits(n int, fn func([]bool)) {
	N := 1 << uint(n)
	a := make([]bool, n)
	for i := 0; i < N; i++ {
		if i == 0 {
			continue
		}
		for j := 0; j < n; j++ {
			k := n - j - 1
			if i&(1<<uint(j)) == 0 {
				a[k] = false
			} else {
				a[k] = true
			}
		}
		fn(a)
	}
}

func DoWithExhaustive01(n int, fn func([]int)) {
	N := 1 << uint(n)
	a := make([]int, n)
	for i := 0; i < N; i++ {
		for j := 0; j < n; j++ {
			k := n - j - 1
			if i&(1<<uint(j)) == 0 {
				a[k] = 0
			} else {
				a[k] = 1
			}
		}
		fn(a)
	}
}


Compiler output:
a.cc:1:1: error: 'package' does not name a type
    1 | package main
      | ^~~~~~~
a.cc:22:1: error: 'func' does not name a type
   22 | func newReadString(ior io.Reader) func() string {
      | ^~~~
a.cc:35:1: error: 'func' does not name a type
   35 | func readInt() int {
      | ^~~~
a.cc:39:1: error: 'func' does not name a type
   39 | func readInt64() int64 {
      | ^~~~
a.cc:47:1: error: 'func' does not name a type
   47 | func readIntSlice(n int) []int {
      | ^~~~
a.cc:55:1: error: 'func' does not name a type
   55 | func readLengthAndSlice() []int {
      | ^~~~
a.cc:60:1: error: 'func' does not name a type
   60 | func printf(f string, args ...interface{}) (int, error) {
      | ^~~~
a.cc:60:42: error: expected unqualified-id before ')' token
   60 | func printf(f string, args ...interface{}) (int, error) {
      |                                          ^
a.cc:64:1: error: 'func' does not name a type
   64 | func println(args ...interface{}) (int, error) {
      | ^~~~
a.cc:64:33: error: expected unqualified-id before ')' token
   64 | func println(args ...interface{}) (int, error) {
      |                                 ^
a.cc:68:1: error: 'func' does not name a type
   68 | func eprintln(args ...interface{}) (int, error) {
      | ^~~~
a.cc:68:34: error: expected unqualified-id before ')' token
   68 | func eprintln(args ...interface{}) (int, error) {
      |                                  ^
a.cc:76:1: error: 'func' does not name a type
   76 | func main() {
      | ^~~~
a.cc:118:1: error: 'func' does not name a type
  118 | func DoWithExhaustiveBits(n int, fn func([]bool)) {
      | ^~~~
a.cc:137:1: error: 'func' does not name a type
  137 | func DoWithExhaustive01(n int, fn func([]int)) {
      | ^~~~