qyliang/CodeNanoFix huggingface dataset:
Buggy code:
import numpy as np
N, M, X = map(int, input().split())
prices = []
effects = []
for i in range(N):
    c, *a = map(int, input().split())
    prices.append(c)
    effects.append(list(a))

prices = np.array(prices)
effects = np.array(effects)


ans = float("inf")

pats = []
for i in range(2 ** N):
    pat = bin(i).replace("0b", "")
    pat += "0" * (N - len(pat))
    pat = list(map(int, list(pat)))
    pats.append(pat)
    
pats = np.array(pats)
total_price = np.dot(pats, prices)
total_effects = np.dot(pats, effects)
cond = ((total_effects >= X).sum(axis=1) == M)


ans = int(total_price[cond == 1].min())
print(ans)

Fixed code:
import numpy as np
N, M, X = map(int, input().split())
prices = []
effects = []
for i in range(N):
    c, *a = map(int, input().split())
    prices.append(c)
    effects.append(list(a))
 
prices = np.array(prices)
effects = np.array(effects)
 
 
ans = float("inf")
 
pats = []
for i in range(2 ** N):
    pat = bin(i).replace("0b", "")
    pat = "0" * (N - len(pat)) + pat
    pat = list(map(int, list(pat)))
    pats.append(pat)
    
pats = np.array(pats)
total_price = np.dot(pats, prices)
total_effects = np.dot(pats, effects)
cond = ((total_effects >= X).sum(axis=1) == M)
 
final = total_price[cond == 1]
if len(final) > 0:
    ans = int(final.min())
    print(ans)
else:
    print(-1)
Buggy code:
n,m,x = map(int, input().split())

book = []

for _ in range(n):
  book.append(list(map(int, input().split())))

min_cost = 9999999
  
for i in range(1,2**n):
  b = format(i, 'b')
  b = b.zfill(n)
  cost = 0
  us = [0 for _ in range(m)]
  for j in range(len(b)):
    if int(b[j]) == 1:
      cost += book[j][0]
      for k in range(m):
        us[k] += book[j][k+1]
  
  if sum(a>=x for a in us) == m:
    if cost < min_cost:
      min_cost = cost

if min_cost == 999999:
  print(-1)
else:
  print(min_cost)

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

book = []

for _ in range(n):
  book.append(list(map(int, input().split())))

min_cost = 9999999
  
for i in range(1,2**n):
  b = format(i, 'b')
  b = b.zfill(n)
  cost = 0
  us = [0 for _ in range(m)]
  for j in range(len(b)):
    if int(b[j]) == 1:
      cost += book[j][0]
      for k in range(m):
        us[k] += book[j][k+1]
  
  if sum(a>=x for a in us) == m:
    if cost < min_cost:
      min_cost = cost

if min_cost == 9999999:
  print(-1)
else:
  print(min_cost)
Buggy code:
import numpy as np
N,M,X=map(int,input().split())
C=np.zeros(N,dtype=int)
A=np.zeros([N,M],dtype=int)
for i in range(N):
    T=list(map(int,input().split()))
    C[i]=T[0]
    for j in range(M):
        A[i,j]=T[j+1]
a=np.zeros(N,dtype=int)
ans=-1
while a.all()!=1:
  if ((a@A)>X).all():
    if ans==-1:
        ans=a@(C.T)
    elif a@(C.T)<ans:
        ans=a@(C.T)
  for i in range(N):
    if a[N-i-1]==0:
      a[N-i-1]=1
      break
    else:
      a[N-i-1]=0

a=np.array([0,1,1])
if ((a@A)>=X).all():
  if ans==-1:
      ans=a@(C.T)
  elif a@(C.T)<ans:
      ans=a@(C.T)

print(ans)

Fixed code:
import numpy as np
N,M,X=map(int,input().split())
C=np.zeros(N,dtype=int)
A=np.zeros([N,M],dtype=int)
for i in range(N):
    T=list(map(int,input().split()))
    C[i]=T[0]
    for j in range(M):
        A[i,j]=T[j+1]
a=np.zeros(N,dtype=int)
ans=-1
while a.all()!=1:
  if ((a@A)>=X).all():
    if ans==-1:
        ans=a@(C.T)
    elif a@(C.T)<ans:
        ans=a@(C.T)
  for i in range(N):
    if a[N-i-1]==0:
      a[N-i-1]=1
      break
    else:
      a[N-i-1]=0

if ((a@A)>=X).all():
  if ans==-1:
      ans=a@(C.T)
  elif a@(C.T)<ans:
      ans=a@(C.T)

print(ans)
Buggy code:
import numpy as np,sys
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
N,M,X = LI()
CA = np.array([LI() for _ in range(N)])
ans = float('INF')
for i in range(2**N):
    bit = np.array([[i>>j&1 for j in range(N)]]).T
    temp = np.sum(CA*bit,axis=0).tolist()
    temp2 = []
    temp2.append(temp)
    for money,*x in temp2:
        for y in x:
            if y<10:
                break
        else:
            ans = min(ans,money)
print(ans if ans !=float('INF') else -1)


Fixed code:
import numpy as np,sys
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
N,M,X = LI()
CA = np.array([LI() for _ in range(N)])
ans = float('INF')
for i in range(2**N):
    bit = np.array([[i>>j&1 for j in range(N)]]).T
    temp = np.sum(CA*bit,axis=0).tolist()
    temp2 = []
    temp2.append(temp)
    for money,*x in temp2:
        for y in x:
            if y<X:
                break
        else:
            ans = min(ans,money)
print(ans if ans !=float('INF') else -1)
Buggy code:
N,M,X = map(int,input().split())
list = []
skill=[0]*M
ans = 10**10
for i in range(N):
    item = input().split()
    list.append(item)
for i in range(2**N):
    skill = [0]*M
    sum = 0
    for j in range(N):
        if ((i >>j) & 1):
            for u in range(M):
                skill[u]+= int(list[j][u+1])
            sum += int(list[j][0])
    if min(skill)>=X:
        ans = min(ans,sum)
print(ans)


Fixed code:
N,M,X = map(int,input().split())
list = []
skill=[0]*M
ans = -1
for i in range(N):
    item = input().split()
    list.append(item)
for i in range(2**N):
    skill = [0]*M
    sum = 0
    for j in range(N):
        if ((i >>j) & 1):
            for u in range(M):
                skill[u]+= int(list[j][u+1])
            sum += int(list[j][0])
    if min(skill)>=X:
        if ans == -1:
            ans =sum
        else:
            ans = min(ans,sum)
print(ans)
Buggy code:
N, M, X = map(int, input().split())
C = []
A = []
result = -1

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

for n in range(1 << N-1):
    Cn = 0
    skill = [0] * M
    for i in range(N):
        if (n >> i) & 1 == 1:
            Cn += C[i]
            for j in range(M):
                skill[j] += A[i][j]

    if all(x >= X for x in skill):
        if result == -1:
            result = Cn
        else:
            result = min(result, Cn)

print(result)


Fixed code:
N, M, X = map(int, input().split())
C = []
A = []
result = -1

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

for n in range(1 << N):
    Cn = 0
    skill = [0] * M
    for i in range(N):
        if (n >> i) & 1 == 1:
            Cn += C[i]
            for j in range(M):
                skill[j] += A[i][j]

    if all(x >= X for x in skill):
        if result == -1:
            result = Cn
        else:
            result = min(result, Cn)

print(result)
Buggy code:
from itertools import combinations
 
N, M, X = list(map(int,input().split()))
A = []
for i in range(N):
  A.append(list(map(int,input().split())))
sum = []
subsets=[]
for i in range(len(A) + 1):
    for c in combinations(A, i):
        subsets.append(list(c))
 
print(subsets)
for i in subsets:
  tmp = [0]*6
  if len(i) == 1:
    sum.append(i[0])
  elif len(i) == 0:
    sum.append([0]*6)
  else:
    for j in i:
      tmp = list(map(lambda a,b: a + b, tmp,j))
    sum.append(tmp)
print(sum)
    
min_price = 1000000
 
for i in sum:
  t = 0
  for j in i:
    if X > j:
      t = 1
  if t == 0:
    min_price = min(min_price, i[0])
 
if min_price == 1000000:
  print(-1)
else:
  print(min_price) 

Fixed code:
from itertools import combinations
 
N, M, X = list(map(int,input().split()))
A = []
for i in range(N):
  A.append(list(map(int,input().split())))
sum = []
subsets=[]
for i in range(len(A) + 1):
    for c in combinations(A, i):
        subsets.append(list(c))
 
for i in subsets:
  tmp = [0]*(M+1)
  if len(i) == 1:
    sum.append(i[0])
  elif len(i) == 0:
    sum.append([0]*(M+1))
  else:
    for j in i:
      tmp = list(map(lambda a,b: a + b, tmp,j))
    sum.append(tmp)
    
min_price = 10000000000
 
for i in sum:
  t = 0
  for j in range(len(i)):
    if j==0:
      pass
    elif X > i[j]:
      t = 1
      break
  if t == 0:
    min_price = min(min_price, i[0])
 
if min_price == 10000000000:
  print(-1)
else:
  print(min_price)
Buggy code:
import sys
from math import sqrt
from collections import Counter, defaultdict, deque

input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)


def I():
    return int(input())


def MI():
    return map(int, input().split())


def LI():
    return list(MI())


def LIN(n: int):
    return [I() for _ in range(n)]


inf = float("inf")
mod = 10 ** 9 + 7


def main():
    n, m, x = MI()
    li = [LI() for _ in range(n)]

    min = float(inf)
    for i in range(2 ** n):
        flag = True
        total = [0] * (m + 1)
        for j in range(n):
            if (i >> j) & 1:
                total = [x + y for (x, y) in zip(total, li[j])]

        print(total)
        for t in total[1:]:
            if t < x:
                flag = False

        if flag:
            if total[0] < min:
                min = total[0]

    if isinstance(min, float):
        print(-1)
    else:
        print(min)


if __name__ == "__main__":
    main()


Fixed code:
import sys
from math import sqrt
from collections import Counter, defaultdict, deque

input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)


def I():
    return int(input())


def MI():
    return map(int, input().split())


def LI():
    return list(MI())


def LIN(n: int):
    return [I() for _ in range(n)]


inf = float("inf")
mod = 10 ** 9 + 7


def main():
    n, m, x = MI()
    li = [LI() for _ in range(n)]

    min = float(inf)
    for i in range(2 ** n):
        flag = True
        total = [0] * (m + 1)
        for j in range(n):
            if (i >> j) & 1:
                total = [x + y for (x, y) in zip(total, li[j])]

        for t in total[1:]:
            if t < x:
                flag = False

        if flag:
            if total[0] < min:
                min = total[0]

    if isinstance(min, float):
        print(-1)
    else:
        print(min)


if __name__ == "__main__":
    main()
Buggy code:
def main():
    N,M,X=map(int, input().split())
    A=[list(map(int, input().split())) for _ in range(N)]
    ans=10**10**10
    for i in range(2**N):
        b=i+2**N
        c=0
        l=[0]*M
        ok=True
        for j in range(N):
            if b>>j&1 == 1:
                c+=A[j][0]
                for k in range(M):
                    l[k]+=A[j][k+1]
        for x in l:
            if x < X: ok = False 
        if ok:
            ans = min(ans, c)
    if ans==10**5*N: print('-1')
    else: print(ans)

if __name__=='__main__':
    main()

Fixed code:
def main():
    N,M,X=map(int, input().split())
    A=[list(map(int, input().split())) for _ in range(N)]
    ans=10**10
    for i in range(2**N):
        b=i+2**N
        c=0
        l=[0]*M
        ok=True
        for j in range(N):
            if b>>j&1 == 1:
                c+=A[j][0]
                for k in range(M):
                    l[k]+=A[j][k+1]
        for x in l:
            if x < X: ok = False 
        if ok:
            ans = min(ans, c)
    if ans==10**10: print('-1')
    else: print(ans)

if __name__=='__main__':
    main()
Buggy code:
import itertools
n,m,x=map(int,input().split())
lis=tuple(tuple(map(int,input().split())) for _ in range(n))
ans=float("inf")

def dfs(progress,skills,nowcost):
    global ans
    if progress==n:
        if all(v>=x for v in skills):
            ans=min(ans,nowcost)
        return ans
    dfs(progress+1,skills,nowcost)
    dfs(progress+1,[a+b for a,b in zip(skills,lis[progress][1:])],nowcost+lis[progress][0])

if dfs(0,[0]*m,0)==float("inf"):
    print(-1)
else:
    print(ans)

Fixed code:
import itertools
n,m,x=map(int,input().split())
lis=tuple(tuple(map(int,input().split())) for _ in range(n))
ans=float("inf")

def dfs(progress,skills,nowcost):
    global ans
    if progress==n:
        if all(v>=x for v in skills):
            ans=min(ans,nowcost)
        return ans
    dfs(progress+1,skills,nowcost)
    dfs(progress+1,[a+b for a,b in zip(skills,lis[progress][1:])],nowcost+lis[progress][0])

dfs(0,[0]*m,0)
if ans == float("inf"):
    print(-1)
else:
    print(ans)
Buggy code:
if __name__=="__main__":
    N, M, X = map(int, input().split(' '))
    book_list = [None]*N
    min_price = -1
    for i in range(N):
        book_list[i] = list(map(int, input().split(' ')))

    for i in range(2 ** N):
        comp_list = []
        for j in range(N):
            if ((i >> j) & 1):
                if comp_list == []:
                    comp_list = book_list[j]
                else:
                    comp_list = [a+b for a, b in zip(comp_list, book_list[j])]
                print(comp_list)
                if all(comp >= X for comp in comp_list):
                    if min_price == -1:
                        min_price = comp_list[0]
                    elif comp_list[0] < min_price:
                        min_price = comp_list[0]
    print(min_price)

Fixed code:
if __name__=="__main__":
    N, M, X = map(int, input().split(' '))
    book_list = [None]*N
    min_price = -1
    for i in range(N):
        book_list[i] = list(map(int, input().split(' ')))

    for i in range(2 ** N):
        comp_list = []
        for j in range(N):
            if ((i >> j) & 1):
                if comp_list == []:
                    comp_list = book_list[j]
                else:
                    comp_list = [a + b for a, b in zip(comp_list, book_list[j])]

                if all(comp >= X for comp in comp_list[1:]):
                    if min_price == -1:
                        min_price = comp_list[0]
                    elif comp_list[0] <= min_price:
                        min_price = comp_list[0]
    print(min_price)
Buggy code:
n,k,x = (int(x) for x in input().split())
C = []
A = []
for i in range(n):
    list = [int(i) for i in input().split()]
    C.append(list[0])
    A.append(list[1:])
case = [0]*(2**n)
chk = []
for i in range(2**n):
    chk.append([0]*m)

for i in range(2 ** n):
    for j in range(n):  
        if ((i >> j) & 1):  
            case[i] += C[j]
            for l in range(m):
                chk[i][l] += A[j][l]

ans = []
flag = [True]*(2**n)
for i in range(2**n):
    for j in range(m):
        if chk[i][j]<x:
            flag[i] = False
    if flag[i]:
        ans.append(case[i])

if ans==[]:
    print(-1)
else:
    print(min(ans))


Fixed code:
n,m,x = (int(x) for x in input().split())
C = []
A = []
for i in range(n):
    list = [int(i) for i in input().split()]
    C.append(list[0])
    A.append(list[1:])
i = 0
case = [0]*(2**n)
chk = []
for i in range(2**n):
    chk.append([0]*m)
i = 0
for i in range(2 ** n):
    for j in range(n):
        if ((i >> j) & 1):
            case[i] += C[j]
            for l in range(m):
                chk[i][l] += A[j][l]
i = 0
j = 0
ans = []
flag = [True]*(2**n)
for i in range(2**n):
    for j in range(m):
        if chk[i][j]<x:
            flag[i] = False
    if flag[i]:
        ans.append(case[i])

if ans==[]:
    print(-1)
else:
    print(min(ans))
Buggy code:
n, m, x = map(int, input().split())
list_ca = [list(map(int, input().split())) for _ in range(n)]

num = pow(2, n)
min_cost = -1
for count in range(num):
    a_list = [0] * m
    cost = 0
    for i in range(n):
        bit = pow(2, i)
        if (count // bit) % 2 == 1:
            for j in range(m):
                a_list[j] = a_list[j] + list_ca[i][j + 1]
            cost += list_ca[i][0]
    if min(a_list) >= x:
        if min_cost == -1:
            min_cost = cost
        elif min_cost > cost:
            min_cost = cost
    print(a_list)

print(min_cost)

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

num = pow(2, n)
min_cost = -1
for count in range(num):
    a_list = [0] * m
    cost = 0
    for i in range(n):
        bit = pow(2, i)
        if (count // bit) % 2 == 1:
            for j in range(m):
                a_list[j] = a_list[j] + list_ca[i][j + 1]
            cost += list_ca[i][0]
    if min(a_list) >= x:
        if min_cost == -1:
            min_cost = cost
        elif min_cost > cost:
            min_cost = cost

print(min_cost)
Buggy code:
from itertools import combinations


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

mtable = [None]*N
cs = []
for n in range(N):
    aa = list(map(int,input().split()))
    c = aa.pop(0)
    cs.append(c)
    ms = aa
    mtable[n] = ms
    

# print(mtable)
idxes = list(range(N))

prices = []
for i in range(1, N+1):
    for c in combinations(idxes, i):
        sums = [0]*M
        for idx in c:
            for i, m in enumerate(mtable[idx]):
                sums[i] += m
        if all(map(lambda x:x >= X, sums)):
            price = 0
            for idx in c:
                price += cs[idx]

            prices.append(price)
print(min(prices))

Fixed code:
from itertools import combinations


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

mtable = [None]*N
cs = []
for n in range(N):
    aa = list(map(int,input().split()))
    c = aa.pop(0)
    cs.append(c)
    ms = aa
    mtable[n] = ms
    

# print(mtable)
idxes = list(range(N))

prices = []
for i in range(1, N+1):
    for c in combinations(idxes, i):
        sums = [0]*M
        for idx in c:
            for i, m in enumerate(mtable[idx]):
                sums[i] += m
        if all(map(lambda x:x >= X, sums)):
            price = 0
            for idx in c:
                price += cs[idx]

            prices.append(price)
if prices == []:
    print(-1)
else:
    print(min(prices))
Buggy code:
N,M,X=map(int,input().split())
l=[list(map(int,input().split())) for i in range(n)]


cmin=12*10**5+1
for bit in range(2**N):
    A=[0]*M
    c=0
    for j in range(N):
        if (bit>>j)&1:
            c+=l[j][0]
            A=[x+y for (x,y) in zip(A, l[j][1:])]
    if min(A) >= X:
        cmin=min(cmin,c)

if cmin!=12*10**5+1:
    print(cmin)
else:
    print(-1)

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


cmin=12*10**5+1
for bit in range(2**N):
    A=[0]*M
    c=0
    for j in range(N):
        if (bit>>j)&1:
            c+=l[j][0]
            A=[x+y for (x,y) in zip(A, l[j][1:])]
    if min(A) >= X:
        cmin=min(cmin,c)

if cmin!=12*10**5+1:
    print(cmin)
else:
    print(-1)
Buggy code:
n, m, x = map(int, input().split())
books = [0]*n
for i in range(n):
  books[i] = [int(x) for x in input().split()]

ans = 10**9
for i in range(2**n):
  cost = 0
  point = [0]*m
  for j in range(n):
    if (i>>j)&1:
      for k in range(1, m+1):
        point[k-1] += books[j][k]
  flag = True
  for j in range(m):n, m, x = map(int, input().split())
books = [0]*n
for i in range(n):
  books[i] = [int(x) for x in input().split()]

ans = 10**9
for i in range(2**n):
  cost = 0
  point = [0]*m
  for j in range(n):
    if (i>>j)&1:
      cost += books[j][0]
      for k in range(1, m+1):
        point[k-1] += books[j][k]
  flag = True
  for j in range(m):
    if point[j] < x:
      flag = False
  if flag and ans > cost:
    ans = cost

print(ans if ans != 10**9 else -1)
    if point[j] < x:
      flag = False
  if flag and ans > cost:
    ans = cost

print(ans if ans != 10**9 else -1)

Fixed code:
n, m, x = map(int, input().split())
books = [0]*n
for i in range(n):
  books[i] = [int(x) for x in input().split()]

ans = 10**9
for i in range(2**n):
  cost = 0
  point = [0]*m
  for j in range(n):
    if (i>>j)&1:
      cost += books[j][0]
      for k in range(1, m+1):
        point[k-1] += books[j][k]
  flag = True
  for j in range(m):
    if point[j] < x:
      flag = False
  if flag and ans > cost:
    ans = cost

print(ans if ans != 10**9 else -1)
Buggy code:
N,M,X = map(int,input().split())
C = []
for i in range(N):
    C.append(list(map(int,input().split())))

cost = 100000000000000000000000
l = list(range(1,N+1))
import itertools
for i in range(1,N+1):
    check_l = list(itertools.combinations(l,i))
    for a in check_l:
        sub_list = [0] * (M + 1)
        for j in range(i):
            for k in range(M+1):
                sub_list[k] += C[a[i]-1][k]
        flag = True
        for p in range(M):
            if sub_list[p+1] < X:
                flag = False
        if flag == True:
            if cost > sub_list[0]:
                cost = sub_list[0]

if cost == 100000000000000000000000:
    print(-1)
else:
    print(cost)

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

cost = 100000000000000000000000
l = list(range(1,N+1))
import itertools
for i in range(1,N+1):
    check_l = list(itertools.combinations(l,i))
    for a in check_l:
        sub_list = [0] * (M + 1)
        for j in range(i):
            for k in range(M+1):
                sub_list[k] += C[a[j]-1][k]
        flag = True
        for p in range(M):
            if sub_list[p+1] < X:
                flag = False
        if flag == True:
            if cost > sub_list[0]:
                cost = sub_list[0]

if cost == 100000000000000000000000:
    print(-1)
else:
    print(cost)
Buggy code:
n, m, x = map(int, input().split())
numlist = []
minimum = -1
for i in range(n):
    numlist.append(list(map(int, input().split())))
for i in range(1<<n):
    result = [0] * (m+1)
    for j in range(n):
        if(i>>j & 1 == 1):
            for k in range(m+1):
                result[k] += numlist[j][k]
    for k in range(m):
        if(result[k+1] < x): break
    else:
        if(min > result[0] or minimum == -1): minimum = result[0]
print(minimum)

Fixed code:
n, m, x = map(int, input().split())
numlist = []
minimum = -1
for i in range(n):
    numlist.append(list(map(int, input().split())))
for i in range(1<<n):
    result = [0] * (m+1)
    for j in range(n):
        if(i>>j & 1 == 1):
            for k in range(m+1):
                result[k] += numlist[j][k]
    for k in range(m):
        if(result[k+1] < x): break
    else:
        if(minimum > result[0] or minimum == -1): minimum = result[0]
print(minimum)
Buggy code:
import numpy as np
N, M, X = map(int, input().split())
C = []
A = np.zeros((N, M), dtype=int)
for i in range(N):
    c, *a = map(int, input().split())
    C.append(c)
    A[i] = a

S = np.sum(A, axis=0)
print(A)
print(S)
if True in (S < X):
    print(-1)
    exit(0)

mlt = [0]*12
C_ = []
for i in range(2**N):
    total = 0
    arr = np.zeros((M,),dtype=int)
    for j in range(N):
        if ((i>>j) & 1) == 1:
            total += C[j]
            arr += A[j]
    if True in (arr < X):
        continue
    C_.append(total)
print(min(C_))

Fixed code:
import numpy as np
N, M, X = map(int, input().split())
C = []
A = np.zeros((N, M), dtype=int)
for i in range(N):
    c, *a = map(int, input().split())
    C.append(c)
    A[i] = a

S = np.sum(A, axis=0)
if True in (S < X):
    print(-1)
    exit(0)

C_ = []
for i in range(2**N):
    total = 0
    arr = np.zeros((M,),dtype=int)
    for j in range(N):
        if ((i>>j) & 1) == 1:
            total += C[j]
            arr += A[j]
    if True in (arr < X):
        continue
    C_.append(total)
print(min(C_))
Buggy code:
N,M,X=list(map(int,input().split()))
AC=[]
C=[]
A=[]
for n in range(N):
  AC.append(list(map(int,input().split())))
  C.append(AC[0])
  A.append(AC[1:])
ans=0
for n in range(2**N):
  total=0
  und=[0]*M
  for j in range(N):
    if n >> j & 1:
      total+=C[j]
      for m in range(M):
        und[m]+=A[j][m]
  if X <= min(und):
    ans=total
if ans==0:
  print(-1)
else:
  print(ans)
    

Fixed code:
N,M,X=list(map(int,input().split()))

C=[]
A=[]
for n in range(N):
  AC=list(map(int,input().split()))
  C.append(AC[0])
  A.append(AC[1:])
ans=10**9

for n in range(2**N):
  total=0
  und=[0]*M
  for j in range(N):
    if n >> j & 1:
      total+=C[j]
      for m in range(M):
        und[m]+=A[j][m]
  if X <= min(und):
    ans=min(total,ans)
if ans==10**9:
  print(-1)
else:
  print(ans)