qyliang/CodeNanoFix huggingface dataset:
Buggy code:
import sys
import os
import math
import bisect
import collections
import itertools
import heapq

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: x * y / math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N, M, X = il()
    CA = [il() for _ in range(N)]

    ret = MAX
    for n in range(1 << N):
        k = 0
        A = [0] * M
        for m in range(M):
            c, *a = CA[m]

            if n >> m & 1:
                k += c
                for i in range(len(a)):
                    A[i] += a[i]

                if all([aa >= X for aa in A]):
                    break
        else:
            continue

        ret = min(ret, k)

    print(ret)


if __name__ == '__main__':
    main()


Fixed code:
import sys
import os
import math
import bisect
import collections
import itertools
import heapq

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: x * y / math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N, M, X = il()
    CA = [il() for _ in range(N)]

    ret = MAX
    for n in range(1 << N):
        k = 0
        A = [0] * M
        for j in range(N):
            c, *alist = CA[j]
            if n >> j & 1:
                k += c
                for i in range(len(alist)):
                    A[i] += alist[i]
            if all([a >= X for a in A]):
                ret = min(ret, k)
                break
        else:
            continue

    print(-1 if ret == MAX else ret)


if __name__ == '__main__':
    main()
Buggy code:
from itertools import product as pr
n,m,x=[int(i) for i in input().split()]
l=[[int(i) for i in input().split()]for j in range(n)]
p=list(pr([0,1],repeat=n))
suml=[[sum([l[j][k]*i[j] for j in range(n)])for k in range(m+1)]for i in p]
ans=[i[0] for i in suml if all([i[j] >=x for j in range(1,n+1)])]
if len(ans)==0:
  print(-1)
else:
  print(min(ans))

Fixed code:
from itertools import product as pr
n,m,x=[int(i) for i in input().split()]
l=[[int(i) for i in input().split()]for j in range(n)]
p=list(pr([0,1],repeat=n))
suml=[[sum([l[j][k]*i[j] for j in range(n)])for k in range(m+1)]for i in p]
ans=[i[0] for i in suml if all([i[j] >=x for j in range(1,m+1)])]
if len(ans)==0:
  print(-1)
else:
  print(min(ans))
Buggy code:
n, m, x = list(map(int, input().split()))

cas = []
for i in range(n):
    ca = list(map(int, input().split()))
    cas.append(ca)

kingakumin = 10000000000

for i in range(2 ** n):
    now = []
    inow = i
    for j in range(n):
        now.append(i % 2)
        i = i // 2

    syuutoku = []
    for j in range(m):
        syuutoku.append(0)

    kingaku = 0
    for j in range(n):
        if now[j] == 1:
            kingaku = kingaku + cas[j][0]
            for k in range(m):
                syuutoku[k] = syuutoku[k] + cas[j][k + 1]

    flag = True
    for j in range(m):
        if syuutoku[j] < x:
            flag = False

    if flag and kingakumin > kingaku:
        kingakumin = kingaku

print(kingakumin)

Fixed code:
n, m, x = list(map(int, input().split()))

cas = []
for i in range(n):
    ca = list(map(int, input().split()))
    cas.append(ca)

kingakumin = 10000000000

for i in range(2 ** n):
    now = []
    inow = i
    for j in range(n):
        now.append(i % 2)
        i = i // 2

    syuutoku = []
    for j in range(m):
        syuutoku.append(0)

    kingaku = 0
    for j in range(n):
        if now[j] == 1:
            kingaku = kingaku + cas[j][0]
            for k in range(m):
                syuutoku[k] = syuutoku[k] + cas[j][k + 1]

    flag = True
    for j in range(m):
        if syuutoku[j] < x:
            flag = False

    if flag and kingakumin > kingaku:
        kingakumin = kingaku

if kingakumin == 10000000000:
    kingakumin = -1

print(kingakumin)
Buggy code:
import numpy as np

N, M, X = map(int, input().split())
C = [list(map(int, input().split())) for _ in range(N)]

cost = float("inf")
for i in range(2**N):
  tmp = np.array([0 for _ in range(M+1)])
  for j in range(N):
    if (i>>j) & 1:
      tmp += np.array(C[j])
  if min(tmp[1:]) >= 10:
    cost = min(cost, tmp[0])

print(-1 if cost == float("inf") else cost)

Fixed code:
import numpy as np

N, M, X = map(int, input().split())
C = [list(map(int, input().split())) for _ in range(N)]

cost = float("inf")
for i in range(2**N):
  tmp = np.array([0 for _ in range(M+1)])
  for j in range(N):
    if (i>>j) & 1:
      tmp += np.array(C[j])
  if min(tmp[1:]) >= X:
    cost = min(cost, tmp[0])

print(-1 if cost == float("inf") else cost)
Buggy code:
import numpy as np

data = input().split()
n = int(data[0])
m = int(data[1])
x = int(data[2])
data = []
for _ in range(n):
    data.append(np.array(list(map(int,input().split()))))

ans = 10000000
for b in range(2**n):
    value = np.array([0 for _ in range(m+1)])
    b = bin(b)[2:]
    for zero in range(n-len(b)):
        b = "0" + b
    for i in range(n):
        if b[i] == 1:
            value += data[i]
    ok = True
    for i in range(1,m+1):
        if value[i] < x:
            ok = False
    if ok == True and value[0] <= ans:
        ans = value[0]

print(ans)
            

Fixed code:
import numpy as np

data = input().split()
n = int(data[0])
m = int(data[1])
x = int(data[2])
data = []
for _ in range(n):
    data.append(np.array(list(map(int,input().split()))))

INF = 10000000
ans = INF
for b in range(2**n):
    value = np.array([0 for _ in range(m+1)])
    b = bin(b)[2:]
    for zero in range(n-len(b)):
        b = "0" + b
    for i in range(n):
        if b[i] == "1":
            value += data[i]
    ok = True
    for i in range(1,m+1):
        if value[i] < x:
            ok = False
    if ok == True and value[0] <= ans:
        ans = value[0]
if ans == INF:
    print(-1)
else:
    print(ans)
Buggy code:
import itertools

N, M, X = map(int, input().split())

A = []
for i in range(N):
    A.append(list(map(int, input().split())))

saisyo = float("inf")
for i in intertools.product(range(2), N):
    a = [0]*M
    gokei = 0
    for j in range(N):
        if i[j] == 1:
            gokei += A[j][0]
            for k in range(1, M+1):
                a[k-1] += A[j][k]
    if min(a) >= X:
        saisyo = min(saisyo, gokei)

print(saisyo if saisyo != float("inf") else -1)

Fixed code:
import itertools

N, M, X = map(int, input().split())

A = []
for i in range(N):
    A.append(list(map(int, input().split())))

saisyo = float("inf")
for i in itertools.product(range(2), repeat=N):
    a = [0]*M
    gokei = 0
    for j in range(N):
        if i[j] == 1:
            gokei += A[j][0]
            for k in range(1, M+1):
                a[k-1] += A[j][k]
    if min(a) >= X:
        saisyo = min(saisyo, gokei)

print(saisyo if saisyo != float("inf") else -1)
Buggy code:
import itertools

N,M,X = map(int, input().split())
C_A = []
for _ in range(N):
    C_A.append(list(map(int, input().split())))
# print(C_A)

min_price = 10**5 * 12 
rikaido = [0 for _ in range(M)]

for i in itertools.product([0,1], repeat=N):
    price_rikaido = [sum(C_A[j][k]*i[j] for j in range(N)) for k in range(M+1)]
    print(i)
    print(price_rikaido)
    flag = 1
    for l in range(M):
        if price_rikaido[l+1] <X:
            flag = 0
            break
    if flag and (min_price > price_rikaido[0]):
        min_price = price_rikaido[0]
        
if min_price == 10**5 * 12 :
    print(-1)
else:
    print(min_price)


Fixed code:
import itertools
 
N,M,X = map(int, input().split())
C_A = []
for _ in range(N):
    C_A.append(list(map(int, input().split())))
# print(C_A)
 
min_price = 10**5 * 12 
rikaido = [0 for _ in range(M)]
possible = 0
for i in itertools.product([0,1], repeat=N):
    price_rikaido = [sum(C_A[j][k]*i[j] for j in range(N)) for k in range(M+1)]
    # print(i)
    # print(price_rikaido)
    flag = 1
    for l in range(M):
        if price_rikaido[l+1] <X:
            flag = 0
            break
    if flag and (min_price >= price_rikaido[0]):
        min_price = price_rikaido[0]
        possible = 1
        
if possible:
    print(min_price)
else:
    print(-1)
Buggy code:
N,M,X = map(int,input().split())
li = []
import numpy as np
C = []

for _ in range(M):
    c,*a = map(int,input().split())
    li.append(np.array(a))
    C.append(c)

counter = []

for i in range(1<<N):
    skill_li = np.zeros(M)
    sum_price = 0
    for k in range(N):
        if (i>>k) & 1:
            skill_li += li[k]
            sum_price += C[k]
    if all(skill_li>=X):
        counter.append(sum_price)
if len(counter)==0:
    print(-1)
else:
    print(min(counter))

Fixed code:
N,M,X = map(int,input().split())
li = []
import numpy as np
C = []

for _ in range(N):
    c,*a = map(int,input().split())
    li.append(np.array(a))
    C.append(c)

counter = []

for i in range(1<<N):
    skill_li = np.zeros(M).astype(int)
    sum_price = 0
    for k in range(N):
        if (i>>k) & 1:
            skill_li += li[k]
            sum_price += C[k]
    if all(skill_li>=X):
        counter.append(sum_price)

if len(counter)==0:
    print(-1)
else:
    print(min(counter))
Buggy code:
import numpy as np

#%%
N, M, X = [int(i) for i in input().split()]
CA = [[] for i in range(N)]
for i in range(M):
    k = list(map(int, input().split()))
    CA[i] = k[:]
CA = np.array(CA)
#%%
cnt = (10 ** 5) * N + 1

for i in range(2 ** N):
    score = np.zeros(N + 1)
    for j in range(N):
        if (i >> j) & 1:
            score += CA[j]
    for k in range(1, N + 1):
        if score[k] < X:
            break
    else:
        if score[0] < cnt:
            cnt = score[0]
            
if cnt != (10 ** 5) * N + 1:
    print(int(cnt))
else:
    print(-1)


Fixed code:
import numpy as np

#%%
N, M, X = [int(i) for i in input().split()]
CA = [[] for i in range(N)]
for i in range(N):
    k = list(map(int, input().split()))
    CA[i] = k[:]
CA = np.array(CA)
#%%
cnt = (10 ** 5) * N + 1

for i in range(2 ** N):
    score = np.zeros(M + 1)
    for j in range(N):
        if (i >> j) & 1:
            score += CA[j]
    for k in range(1, M + 1):
        if score[k] < X:
            break
    else:
        if score[0] < cnt:
            cnt = score[0]
            
if cnt != (10 ** 5) * N + 1:
    print(int(cnt))
else:
    print(-1)
Buggy code:
n,m,x=map(int,input().split())
a=[list(map(int,input().split())) for _ in range(n)]

ans = float('inf')
def dfs(step, m_list, cost):
    global ans
    if all(elem>=x for elem in m_list):
        ans = min(cost, ans)
    elif step != n:
        dfs(step+1, m_list, cost)
        m_list = [x+y for x, y in zip(m_list, a[step][0:])]
        cost += a[step][0]
        dfs(step+1, m_list, cost)

dfs(0, [0]*m, 0)
print(ans)


Fixed code:
n,m,x=map(int,input().split())
a=[list(map(int,input().split())) for _ in range(n)]

ans = float('inf')
def dfs(step, m_list, cost):
    global ans
    if all(elem>=x for elem in m_list):
        ans = min(cost, ans)
    elif step != n:
        dfs(step+1, m_list, cost)
        m_list = [x+y for x, y in zip(m_list, a[step][1:])]
        cost += a[step][0]
        dfs(step+1, m_list, cost)

dfs(0, [0]*m, 0)
print(-1 if ans==float('inf') else ans)
Buggy code:
n, m, x = list(map(int, input().split()))
c = [0] * n
a = [[]  for _ in range(n)]
INF = float('inf')
ans = INF

for i in range(n):
    line = list(map(int, input().split()))
    c[i] = line[0]
    a[i] = line[1:]

for s in range(1<<n):
    smart = [0] * m
    cost = 0
    for i in range(n):
        if not(s>>i & 1):continue
        cost += c[i]
        for j in range(m):
            smart[j] += a[i][j]

    flg = True
    for i in range(m):
        if smart[i] < 10:
            flg = False
    if flg:
        ans = min(ans, cost)
print(ans)


Fixed code:
n, m, x = list(map(int, input().split()))
c = [0] * n
a = [[]  for _ in range(n)]
INF = float('inf')
ans = INF

for i in range(n):
    line = list(map(int, input().split()))
    c[i] = line[0]
    a[i] = line[1:]

for s in range(1<<n):
    smart = [0] * m
    cost = 0
    for i in range(n):
        if not(s>>i & 1):continue
        cost += c[i]
        for j in range(m):
            smart[j] += a[i][j]

    flg = True
    for i in range(m):
        if smart[i] < x:
            flg = False
    if flg:
        ans = min(ans, cost)
if ans == INF:
    print(-1)
else: print(ans)
Buggy code:
CA = [list(map(int, input().split())) for i in range(N)]

A = [0]*M
for i in range(N):
    for k in range(M):
        A[k] += CA[i][k+1]
for i in range(M):
    if A[i] < X:
        print('-1')
        exit() 

price = 0
ans = 10**10
A = [0]*M
for i in range(2**N):
    list = [1]*N
    for j in range(len(list)):
        if (i>>j) & 1:
            list[j] = 0
        for k in range(N):
            if list[k] == 1:
                for s in range(M):
                    A[s] += CA[k][s+1]
                price += CA[k][0]
        if all(A[m] >= X for m in range(M)):
            ans = min(ans,price)
    price = 0
print(ans)

Fixed code:
N, M, X = map(int, input().split())
CA = [list(map(int, input().split())) for i in range(N)]

A = [0]*M
for i in range(N):
    for k in range(M):
        A[k] += CA[i][k+1]
for i in range(M):
    if A[i] < X:
        print('-1')
        exit() 

price = 0
ans = 10**10
A = [0]*M
for i in range(2**N):
    list = [1]*N
    for j in range(len(list)):
        if (i>>j) & 1:
            list[j] = 0
        price = 0
        A = [0]*M
        for k in range(N):
            if list[k] == 1:
                for s in range(M):
                    A[s] += CA[k][s+1]
                price += CA[k][0]
    if all(A[m] >= X for m in range(M)):
        ans = min(ans,price)
print(ans)
Buggy code:
n,m,x=map(int,input().split())
ca=[list(map(int,input().split())) for i in range(n)]
ans=0
for i in range(2**n):
    check=[0]*m
    ans_=0
    for j in range(n):
        if ((i>>j)&1):
            ans_+=ca[j][0]#(✳︎)
            for k in range(m):
                check[k]+=ca[j][k+1]
    if all([l>=x for l in check]):
        ans=min(ans,ans_)
if ans==0:
    print(-1)
else:
    print(ans)

Fixed code:
n,m,x=map(int,input().split())
ca=[list(map(int,input().split())) for i in range(n)]
ans=100000000000000000
for i in range(2**n):
    check=[0]*m
    ans_=0
    for j in range(n):
        if ((i>>j)&1):
            ans_+=ca[j][0]#(✳︎)
            for k in range(m):
                check[k]+=ca[j][k+1]
    if all([l>=x for l in check]):
        ans=min(ans,ans_)
if ans==100000000000000000:
    print(-1)
else:
    print(ans)
Buggy code:
N,M,X = map(int,input().split())
C=[0 for i in range(N)]
A=[[] for i in range(N)]
min_cost=10000000000
for i in range(N):
    C[i],*A[i]=map(int,input().split())
for i in range(1<<N):
    L=[0 for i in range(M)]
    cost=0
    for j in range(N):
        if 1&(i>>j):
            for k in range(M):
                L[k]+=A[j][k]
            cost+=C[j]
    if min(L)>=X:
      min_cost=min(min_cost,cost)
print(min_cost)

Fixed code:
N,M,X = map(int,input().split())
C=[0 for i in range(N)]
A=[[] for i in range(N)]
min_cost=10000000000
for i in range(N):
    C[i],*A[i]=map(int,input().split())
for i in range(1<<N):
    L=[0 for i in range(M)]
    cost=0
    for j in range(N):
        if 1&(i>>j):
            for k in range(M):
                L[k]+=A[j][k]
            cost+=C[j]
    if min(L)>=X:
      min_cost=min(min_cost,cost)
if min_cost==10000000000:
  print(-1)
else:
  print(min_cost)
Buggy code:
from itertools import product
n, m, x = list(map(int, input().split()))
cl = [0] * n
al = [[]*m for _ in range(n)]
for i in range(n):
    tmp = list(map(int, input().split()))
    cl[i] = tmp[0]
    al[i] = tmp[1:]


def dfs(status, book):
    for i in range(m):
        status[i] += book[i]
    return status


ans = 10**10
for bit in product([0, 1], repeat=n):
    # print(bit)
    status = [0]*m
    money = 0
    for i, b in enumerate(list(bit)):
        if b == 1:
            status = dfs(status, al[i]):
            money += cl[i]
    flag = True
    for i in range(m):
        if status[i] >= x:
            continue
        else:
            flag = False
    if flag:
        ans = min(ans, money)
if ans == 10**10:
    print(-1)
else:
    print(ans)


Fixed code:
from itertools import product
n, m, x = list(map(int, input().split()))
cl = [0] * n
al = [[]*m for _ in range(n)]
for i in range(n):
    tmp = list(map(int, input().split()))
    cl[i] = tmp[0]
    al[i] = tmp[1:]


def dfs(status, book):
    for i in range(m):
        status[i] += book[i]
    return status


ans = 10**10
for bit in product([0, 1], repeat=n):
    # print(bit)
    status = [0]*m
    money = 0
    for i, b in enumerate(list(bit)):
        if b == 1:
            for k in range(m):
                status[k] += al[i][k]
            money += cl[i]
    flag = True
    for i in range(m):
        if status[i] >= x:
            continue
        else:
            flag = False
    if flag:
        ans = min(ans, money)
if ans == 10**10:
    print(-1)
else:
    print(ans)
Buggy code:
import numpy as np
N,M,X=map(int,input().split())
allList=[]
for _ in range(N):
    allList.append(np.array(list(map(int,input().split()))))
minnum=10**7
for i in range(2**N):
    skill=[0]*(M+1)
    flag=True
    for row in range(N):
        if i&(2**row)>0:
            skill+=allList[row]
    for i in range(M):
        if skill[j+1]<X:
            flag=False
    if flag:
        minnum=min(minnum,skill[0])
if minnum==10**7:
    minnum=-1
print(minnum)

Fixed code:
import numpy as np
N,M,X=map(int,input().split())
allList=[]
for _ in range(N):
    allList.append(np.array(list(map(int,input().split()))))
minnum=10**7
for i in range(2**N):
    skill=[0]*(M+1)
    flag=True
    for row in range(N):
        if i&(2**row)>0:
            skill+=allList[row]
    for j in range(M):
        if skill[j+1]<X:
            flag=False
    if flag:
        minnum=min(minnum,skill[0])
if minnum==10**7:
    minnum=-1
print(minnum)
Buggy code:
import numpy as np
import itertools
N, M, X = map(int, input().split())
kumi = []
pat = list(range(N))
for _ in range(N):
    kumi.append(list(map(int, input().split())))
ans0 = 10 ** 5 * 12 + 1
ans = 10 ** 5 * 12 + 1
#print(kumi)
test = []
for i in range(N):
    for i2 in itertools.combinations(kumi,i+1):
        arr_i2 = np.array(i2)
        arr_i2_sum = arr_i2.sum(axis = 0)
        if np.all(arr_i2_sum[1:] >= X):
            if ans > arr_i2_sum[0]:
                ans = arr_i2_sum[0]
if ans == ans0:
    print(-1)
else:
    print(ans)import numpy as np
import itertools
N, M, X = map(int, input().split())
kumi = []
pat = list(range(N))
for _ in range(N):
    kumi.append(list(map(int, input().split())))
ans0 = 10 ** 5 * 12 + 1
ans = 10 ** 5 * 12 + 1
#print(kumi)
test = []
for i in range(N):
    for i2 in itertools.combinations(kumi,i+1):
        arr_i2 = np.array(i2)
        arr_i2_sum = arr_i2.sum(axis = 0)
        if np.all(arr_i2_sum[1:] >= X):
            if ans > arr_i2_sum[0]:
                ans = arr_i2_sum[0]
if ans == ans0:
    print(-1)
else:
    print(ans)

Fixed code:
import numpy as np
import itertools
N, M, X = map(int, input().split())
kumi = []
pat = list(range(N))
for _ in range(N):
    kumi.append(list(map(int, input().split())))
ans = 10 ** 5 * 12
kai = False
test = []
for i in range(N):
    for i2 in itertools.combinations(kumi,i+1):
        arr_i2 = np.array(i2)
        arr_i2_sum = arr_i2.sum(axis = 0)
        if np.all(arr_i2_sum[1:] >= X):
            if ans >= arr_i2_sum[0]:
                ans = arr_i2_sum[0]
                kai = True
if kai:
    print(ans)
else:
    print(-1)
Buggy code:
nmx=list(map(int, input().split()))
N=nmx[0]
M=nmx[1]
X=nmx[2]
mylist=[]
for i in range(N):
    mylist.append(list(map(int, input().split())))
Ans=10000*12+1
for i in range(2**N):
    A=[[0]*M]
    C=0
    for j in range(N):
        if (i>>j) & 1:
            C+=mylist[j][0]
            for k in range(M):
                A[k]=A[k]+mylist[j][k+1]
    if min(A)>=X:
        #Ans=min(Ans, C)
if Ans==10000*12+1:
    print(-1)
else:
    print(Ans)



Fixed code:
nmx=list(map(int, input().split()))
N=nmx[0]
M=nmx[1]
X=nmx[2]
mylist=[]
for i in range(N):
    mylist.append(list(map(int, input().split())))
Ans=100000*12+1
for i in range(2**N):
    A=[0]*M
    C=0
    for j in range(N):
        if (i>>j) & 1:
            C=C+mylist[j][0]
            for k in range(M):
                A[k]=A[k]+mylist[j][k+1]
    if min(A)>=X:
        Ans=min(Ans, C)
if Ans==100000*12+1:
    print(-1)
else:
    print(Ans)
Buggy code:
import numpy as np

N, M, X = map(int, input().split())
C = []
A = [[] for i in range(M)]
resC = []
resA = list(A)

NEW = 0

def update(base):
  #print(NEW,base)
  if base==None:
    return NEW
  return base + NEW

def check(num):
  return num>=X

def check2(*args):
  res = True
  for val in args:
    buf = (val >= X)
    res = res and buf
  return res

for i in range(N):
  buf = list(map(int, input().split()))
  C.append(buf[0])
  for j in range(M):
    A[j].append(buf[j+1])

for i in range(N):
  if i == 0:
    NEW = C[i]
    resC = [0, NEW]
    resA = [[0, A[j][i]] for i in range(M)]
  else:
    NEW = C[i]
    resC = resC + list(map(update, resC))
    for j in range(M):
      NEW = A[j][i]
      resA[j] = resA[j] + list(map(update, resA[j]))

res = list(map(check2, *resA))
#print(np.asarray(resC)[res]) 
if sum(res)==0:
  print(-1)
else:
  print(min(np.asarray(resC)[res]))

Fixed code:
import numpy as np

N, M, X = map(int, input().split())
C = []
A = [[] for i in range(M)]
resC = []
resA = list(A)

NEW = 0

def update(base):
  #print(NEW,base)
  if base==None:
    return NEW
  return base + NEW

def check(num):
  return num>=X

def check2(*args):
  res = True
  for val in args:
    buf = (val >= X)
    res = res and buf
  return res

for i in range(N):
  buf = list(map(int, input().split()))
  C.append(buf[0])
  for j in range(M):
    A[j].append(buf[j+1])

for i in range(N):
  if i == 0:
    NEW = C[i]
    resC = [0, NEW]
    resA = [[0, A[j][i]] for j in range(M)]
  else:
    NEW = C[i]
    resC = resC + list(map(update, resC))
    for j in range(M):
      NEW = A[j][i]
      resA[j] = resA[j] + list(map(update, resA[j]))

res = list(map(check2, *resA))
#print(np.asarray(resC)[res]) 
if sum(res)==0:
  print(-1)
else:
  print(min(np.asarray(resC)[res]))
Buggy code:
n, m, x = map(int, input().split())
bag = {}
for i in range(n):
    bag[i]=list(map(int, input().split()))

min_ = 10**10
for bit in range(1<<n):
    understanding = [0]*m
    c = 0
    for i in range(n):
        if bit & (1<<i):
            for k in range(m):
                understanding[k] += bag[i][k+1]
            c += bag[i][0]
            
    if all([a >= x for a in understanding] ):
        min_ = min(min_, c)
if min_ == 10*10:
    min_ = -1
print(min_)              

Fixed code:
n, m, x = map(int, input().split())
bag = {}
for i in range(n):
    bag[i]=list(map(int, input().split()))

min_ = 10**10
for bit in range(1<<n):
    understanding = [0 for j in range(m)]
    c = 0
    for i in range(n):
        if bit & (1<<i):
            for k in range(m):
                understanding[k] += bag[i][k+1]
            c += bag[i][0]
            
    if all([a >= x for a in understanding] ):
        min_ = min(min_, c)
if min_ == 10**10:
    min_ = -1
print(min_)