Buggy python submission (verdict: Runtime Error):
n = int(input())
f = []
for _ in range(n):
    f.append(list(map(int, input().split())))
p = []
for _ in range(n):
    p.append(list(map(int, input().split())))
ans = - (10 ** 9)
for i in range(1, 2 ** 10):
    store = {lll : 0 for lll in range(10)}
    k = "0" * (10 - len(bin(i)) + 2) + bin(i)[2:]
    for j, kk in enumerate(k):
        if kk == "1":
            for nn in range(n):
                if f[nn][j] == 1:
                    store[nn] += 1
    calc = 0
    for x, y in enumerate(p):
        calc += y[store[x]]
    ans = max(ans, calc)
print(ans)

Fixed submission:
n = int(input())
f = []
for _ in range(n):
    f.append(list(map(int, input().split())))
p = []
for _ in range(n):
    p.append(list(map(int, input().split())))
ans = - (10 ** 9)
for i in range(1, 1<<10):
    store = {lll : 0 for lll in range(10)}
    k = "0" * (10 - len(bin(i)) + 2) + bin(i)[2:]
    calc = 0
    for nn in range(n):
        count = 0
        for j, kk in enumerate(k):
            if kk == "1":
                if f[nn][j] == 1:
                    count += 1
        calc += p[nn][count]
    ans = max(ans, calc)
print(ans)

Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(100000000000)

n = int(input())
f = []
for _ in range(n):
    f.append(list(map(int, input().split())))
p = []
for _ in range(n):
    p.append(list(map(int, input().split())))
ans = - (10 ** 9)
for i in range(1, 2 ** 10):
    store = {i : 0 for i in range(10)}
    k = "0" * (10 - len(bin(i)) + 2) + bin(i)[2:]
    for j, kk in enumerate(k):
        if kk == "1":
            for nn in range(n):
                if f[nn][j] == 1:
                    store[nn] += 1
    calc = 0
    for x, y in enumerate(p):
        calc += y[store[x]]
    ans = max(ans, calc)
print(ans)


Fixed submission:
n = int(input())
f = []
for _ in range(n):
    f.append(list(map(int, input().split())))
p = []
for _ in range(n):
    p.append(list(map(int, input().split())))
ans = - (10 ** 9)
for i in range(1, 1<<10):
    store = {lll : 0 for lll in range(10)}
    k = "0" * (10 - len(bin(i)) + 2) + bin(i)[2:]
    calc = 0
    for nn in range(n):
        count = 0
        for j, kk in enumerate(k):
            if kk == "1":
                if f[nn][j] == 1:
                    count += 1
        calc += p[nn][count]
    ans = max(ans, calc)
print(ans)

Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(1000000)

n = int(input())
f = []
for _ in range(n):
    f.append(list(map(int, input().split())))
p = []
for _ in range(n):
    p.append(list(map(int, input().split())))
ans = - (10 ** 9)
for i in range(1, 2 ** 10):
    store = {i : 0 for i in range(10)}
    k = "0" * (10 - len(bin(i)) + 2) + bin(i)[2:]
    for j, kk in enumerate(k):
        if kk == "1":
            for nn in range(n):
                if f[nn][j] == 1:
                    store[nn] += 1
    calc = 0
    for x, y in enumerate(p):
        calc += y[store[x]]
    ans = max(ans, calc)
print(ans)

Fixed submission:
n = int(input())
f = []
for _ in range(n):
    f.append(list(map(int, input().split())))
p = []
for _ in range(n):
    p.append(list(map(int, input().split())))
ans = - (10 ** 9)
for i in range(1, 1<<10):
    store = {lll : 0 for lll in range(10)}
    k = "0" * (10 - len(bin(i)) + 2) + bin(i)[2:]
    calc = 0
    for nn in range(n):
        count = 0
        for j, kk in enumerate(k):
            if kk == "1":
                if f[nn][j] == 1:
                    count += 1
        calc += p[nn][count]
    ans = max(ans, calc)
print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
f = []
for _ in range(n):
    f.append(list(map(int, input().split())))
p = []
for _ in range(n):
    p.append(list(map(int, input().split())))
ans = - (10 ** 9)
for i in range(1, 2 ** 10):
    store = {i : 0 for i in range(10)}
    k = "0" * (10 - len(bin(i)) + 2) + bin(i)[2:]
    for j, kk in enumerate(k):
        if kk == "1":
            for nn in range(n):
                if f[nn][j] == 1:
                    store[nn] += 1
    calc = 0
    for x, y in enumerate(p):
        calc += y[store[x]]
    ans = max(ans, calc)
print(ans)

Fixed submission:
n = int(input())
f = []
for _ in range(n):
    f.append(list(map(int, input().split())))
p = []
for _ in range(n):
    p.append(list(map(int, input().split())))
ans = - (10 ** 9)
for i in range(1, 1<<10):
    store = {lll : 0 for lll in range(10)}
    k = "0" * (10 - len(bin(i)) + 2) + bin(i)[2:]
    calc = 0
    for nn in range(n):
        count = 0
        for j, kk in enumerate(k):
            if kk == "1":
                if f[nn][j] == 1:
                    count += 1
        calc += p[nn][count]
    ans = max(ans, calc)
print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
f = []
for _ in range(n):
    f.append(list(map(int, input().split())))
p = []
for _ in range(n):
    p.append(list(map(int, input().split())))
ans = []
for i in range(1, 2 ** 10):
    store = [0 for _ in range(10)]
    k = "0" * (10 - len(bin(i)) + 2) + bin(i)[2:]
    for j, kk in enumerate(k):
        if kk == "1":
            for nn in range(n):
                if f[nn][j] == 1:
                    store[nn] += 1
    calc = 0
    for x, y in enumerate(p):
        calc += y[store[x]]
    ans.append(calc)
print(max(ans))

Fixed submission:
n = int(input())
f = []
for _ in range(n):
    f.append(list(map(int, input().split())))
p = []
for _ in range(n):
    p.append(list(map(int, input().split())))
ans = - (10 ** 9)
for i in range(1, 1<<10):
    store = {lll : 0 for lll in range(10)}
    k = "0" * (10 - len(bin(i)) + 2) + bin(i)[2:]
    calc = 0
    for nn in range(n):
        count = 0
        for j, kk in enumerate(k):
            if kk == "1":
                if f[nn][j] == 1:
                    count += 1
        calc += p[nn][count]
    ans = max(ans, calc)
print(ans)