qyliang/CodeNanoFix huggingface dataset:
Buggy code:
n,m,x=map(int,input().split())
a=[list(map(int,input().split()))]
ans=[]
for bit in range(1<<n):
  total=0
  skill=[0]*m
  for i in range(n):
    if bit & (1<<i):
      total+=a[i][0]
      for j in range(m):
        skill[j]+=a[i][j]
  if all([k>K for k in skill]):
    ans.append(total)
print(min(total) if len(ans)>=1 else -1)
    
      
      

Fixed code:
n,m,x=map(int,input().split())
a=[list(map(int,input().split()))for i in range(n)]
ans=[]
for bit in range(1<<n):
  total=0
  skill=[0]*m
  for i in range(n):
    if bit & (1<<i):
      total+=a[i][0]
      for j in range(m):
        skill[j]+=a[i][j+1]
  if all([k>=x for k in skill]):
    ans.append(total)
print(min(ans) if len(ans)!=0 else -1)
Buggy code:
import sys
from itertools import combinations

N,M,X = map(int,input().split())
CA = [list(map(int,input().split())) for _ in range(N)]
A=[0]*(M+1)

for i in range(N):
    for j in range(1,M+1):
        A[j]+=CA[i][j]

for i in A:
    if i <X:
        print(-1)
        sys.exit()

ans=sum(A)

for i in range(1,N+1):
    for e in combinations(range(N),i):
        c = 0
        A = [0]*(M+1)
        for f in e:
            c += CA[f][0]
            for j in range(M):
                A[i] += CA[f][j+1]
        if min(A) >= X:
            ans = min(ans,c)
else:
    print(ans)

Fixed code:

import sys
from itertools import combinations

N,M,X = map(int,input().split())
CA = [list(map(int,input().split())) for _ in range(N)]
A=[0]*(M+1)

ans=0

for i in range(N):
    ans+=CA[i][0]
    for j in range(1,M+1):
        A[j]+=CA[i][j]


for i in range(1,M+1):
    if A[i] <X:
        print(-1)
        sys.exit()


for i in range(1,N+1):
    for e in combinations(range(N),i):
        c = 0
        A = [0]*M
        for f in e:
            c += CA[f][0]
            for j in range(M):
                A[j] += CA[f][j+1]
        if min(A) >= X:
            ans = min(ans,c)
        
else:
    print(ans)
Buggy code:
def dfs(i, count, res):
    global ans
    if i == n:
        for j in range(m):
            if count[j] < x:
                return 0
        ans = min(ans, res)
        return ans
    else:
        dfs(i+1, count, res)
        dfs(i+1, [count[k-1] + l[i][k] for k in range(1, m+1)], res + l[i][0])


n, m, x = map(int, input().split())
l = [list(map(int, input().split())) for _ in range(n)]

ans = 10 ** 9

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

if ans:
    print(ans)
else:
    print(-1)

Fixed code:
def dfs(i, count, res):
    global ans
    if i == n:
        if min(count) < x:
            return
        ans = min(ans, res)
        return ans
    else:
        dfs(i+1, count, res)
        dfs(i+1, [count[k-1] + l[i][k] for k in range(1, m+1)], res + l[i][0])


n, m, x = map(int, input().split())
l = [list(map(int, input().split())) for _ in range(n)]

ans = 10 ** 9
dfs(0, [0] * m, 0)

if ans == 10 ** 9:
    print(-1)
else:
    print(ans)
Buggy code:
import numpy as np

n,m,x=list(map(int,input().split()))
lis=[]
for i in range(n):
    l=list(map(int,input().split()))
    lis.append(l)


min=-1
for nnn in range(2**n):
    index=[]
    a=nnn
    for i in range(n):
        index.append(a%2)
        a//=2

    money=0
    xs=np.zeros(n)
    for i in range(n):
        if index[i]==1:
            money+=lis[i][0]
            xs+=np.array(lis[i][1:])
    if np.amin(xs)>=x:
        if min==-1:
            min=money
        elif min>money:
            min=money
print(min)

Fixed code:
import numpy as np

n,m,x=list(map(int,input().split()))
lis=[]
for i in range(n):
    l=list(map(int,input().split()))
    lis.append(l)


min=-1
for nnn in range(2**n):
    index=[]
    a=nnn
    for i in range(n):
        index.append(a%2)
        a//=2

    money=0
    xs=np.zeros(m)
    for i in range(n):
        if index[i]==1:
            money+=lis[i][0]
            xs+=np.array(lis[i][1:])
    if np.amin(xs)>=x:
        if min==-1:
            min=money
        elif min>money:
            min=money

print(min)
Buggy code:
n, m, x = map(int, input().split())
C = [list(map(int, input().split())) for _ in range(n)]
 
import itertools as it
import math
 
cost = math.inf
for comb in it.chain(*(it.combinations(C, r) for r in range(1, n+1))):
    print(comb)
    print(*comb)
    c, *a = map(sum, zip(*comb))
    print(c,a)
    if c < cost and min(a) >= x:
        cost = c
 
print(-1 if cost is math.inf else cost)

Fixed code:
n, m, x = map(int, input().split())
C = [list(map(int, input().split())) for _ in range(n)]
 
import itertools as it
import math
 
cost = math.inf
for comb in it.chain(*(it.combinations(C, r) for r in range(1, n+1))):
    c, *a = map(sum, zip(*comb))
    if c < cost and min(a) >= x:
        cost = c
 
print(-1 if cost is math.inf else cost)
Buggy code:
from itertools import combinations
import numpy as np
#S= str(input())
#T= str(input())
N,M,X = map(int,input().split())
#N = int(input())
#A = list(map(int,input().split()))
a=[]
c=[]
ans=[]
for j in range(N):

    A = list(map(int,input().split()))
    c.append(A)
    a.append(A)

for i in range(1,N+1):
    for l in list(combinations(a,i)):
        s=np.zeros(M+1)
        for k in l:
            k=np.array(k)
            s=s+k
        #print(s)
        
        if min(s)>=X:
            ans.append(s[0])
print(int(min(ans)))


Fixed code:
from itertools import combinations
import numpy as np
#S= str(input())
#T= str(input())
N,M,X = map(int,input().split())
#N = int(input())
#A = list(map(int,input().split()))
a=[]
ans=[]
for j in range(N):

    A = list(map(int,input().split()))
    a.append(A)

for i in range(1,N+1):
    for l in list(combinations(a,i)):
        s=np.zeros(M+1)
        for k in l:
            k=np.array(k)
            s=s+k
        #print(s)

        if min(s[1:])>=X:
            ans.append(s[0])
if len(ans)==0:
    print(-1)
else:
    print(int(min(ans)))
Buggy code:
n,m,x = map(input().split())

min_money = 999999999999
for i in range(2**n):
	bag = []
	a = list(map(int,input().split()))
	for j in range(n):
		if ((i >> j) & 1):
			bag.append(a)

	money = 0
	skill = [0] * m
	enogh = [0] * m
	for sub in bag:
		money += sub[0]
		for k in range(1,m+1):
			skill[k-1] += sub[k]
			if skill[k-1] >= x:
				enough[k-1] = 1

	if 0 not in enough and min_money > money:
		min_money = money

if min_money != 999999999999:
	print(min_money)
else:
	print(-1)


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

min_money = 999999999

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

for i in range(2**n):
	bag = []
	for j in range(n):
		if ((i >> j) & 1):
			bag.append(l[j])

	money = 0
	skill = [0] * m
	enough = [0] * m
	for sub in bag:
		money += sub[0]
		for k in range(1,m+1):
			skill[k-1] += sub[k]
			if skill[k-1] >= x:
				enough[k-1] = 1

	if 0 not in enough and min_money > money:
		min_money = money

if min_money != 999999999:
	print(min_money)
else:
	print(-1)
Buggy code:
import numpy as np
N, M, X = map(int,input().split())
l = []
li = np.array([])
for i in range(N):
  l.append(list(map(int,input().split())))

li = np.array(l)

skill_sum = []
for j in range(2**N):
  sum = np.zeros([M+1])
  for k in range(N):
    if ((j >> k) & 1):
        sum += li[k] 
  skill_sum.append(list(sum))      
pricelist = []
for l in range(2**N):
  cnt = 0
  for m in range(M):
    if skill_sum[l][m+1] >= X:
      cnt += 1
  if cnt ==  M:
    pricelist.append(int(skill_sum[l][0]))
    
print(min(pricelist))

Fixed code:
import numpy as np
N, M, X = map(int,input().split())
l = []
li = np.array([])
for i in range(N):
  l.append(list(map(int,input().split())))

li = np.array(l)

skill_sum = []
for j in range(2**N):
  sum = np.zeros([M+1])
  for k in range(N):
    if ((j >> k) & 1):
        sum += li[k] 
  skill_sum.append(list(sum))      
pricelist = []
for l in range(2**N):
  cnt = 0
  for m in range(M):
    if skill_sum[l][m+1] >= X:
      cnt += 1
  if cnt ==  M:
    pricelist.append(int(skill_sum[l][0]))

if pricelist == []:
  print('-1')
else:
  print(min(pricelist))
Buggy code:
import sys, heapq, bisect, math, fractions
from collections import deque
from collections import Counter
from collections import OrderedDict
from itertools import combinations as cmb

def check(s: list):
    if min(s) < X:
        return False
    return True

N, M, X = map(int, input().split())
G = [tuple(map(int, input().split())) for _ in range(N)]
s = [0 for i in range(M)]

res = 10 ** 15
for i in range(1, N + 1):
    for cm in cmb(range(0, N), i):
        cnt = 0
        s = [0 for i in range(M)]
        for c in cm:
            cnt += G[c][0]
            for j in range(M):
                s[j] += G[c][j + 1]
        if check(s):
            res = min(cnt, res)

print(res)


Fixed code:
import sys, heapq, bisect, math, fractions
from collections import deque
from collections import Counter
from collections import OrderedDict
from itertools import combinations as cmb

def check(s: list):
    if min(s) < X:
        return False
    return True

N, M, X = map(int, input().split())
G = [tuple(map(int, input().split())) for _ in range(N)]
s = [0 for i in range(M)]

res = 10 ** 15
ok = False
for i in range(1, N + 1):
    for cm in cmb(range(0, N), i):
        cnt = 0
        s = [0 for i in range(M)]
        for c in cm:
            cnt += G[c][0]
            for j in range(M):
                s[j] += G[c][j + 1]
        if check(s):
            res = min(cnt, res)
            ok = True

if ok:
    print(res)
else:
    print(-1)
Buggy code:
import copy
n, m, x = map(int, input().split())
c, a = [], []

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

# print(c, a)
ans = 10**10

def isClear(arr):
    return all(val >= x for val in arr)

def solve(idx, price, arr):
    global ans
    if idx == n:
        if isClear(arr):
            # print('clear:', arr)
            ans = min(ans, price)
        return

    # Read
    temp = copy.deepcopy(arr)
    for i in range(m):
        temp[i] += a[idx][i]

    solve(idx + 1, price + c[idx], temp)

    # Not read
    solve(idx + 1, price, arr)

score = [0]*m
solve(0, 0, score)

print(ans)



Fixed code:
import copy
n, m, x = map(int, input().split())
c, a = [], []

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

# print(c, a)
ans = 10**10

def isClear(arr):
    return all(val >= x for val in arr)

def solve(idx, price, arr):
    global ans
    if idx == n:
        if isClear(arr):
            # print('clear:', arr)
            ans = min(ans, price)
        return

    # Read
    temp = copy.deepcopy(arr)
    for i in range(m):
        temp[i] += a[idx][i]

    solve(idx + 1, price + c[idx], temp)

    # Not read
    solve(idx + 1, price, arr)

score = [0]*m
solve(0, 0, score)

if ans == 10**10:
    print(-1)
else:
    print(ans)
Buggy code:
N, M, X = map(int, input().split())
CA = [list(map(int, input().split())) for _ in range(N)]
CA = np.array(CA)

ans = 10 ** 7
for i in itertools.product([0, 1], repeat=N):
    tCA = copy.copy(CA)
    for j in range(N):
        if i[j] == 0:
            tCA[j] = np.zeros(CA.shape[1])
    s = np.sum(tCA, axis=0)
    l = sum(k >= X for k in s[1:])
    if s[0] < ans and l == M:
        ans = s[0]

if ans == 10 ** 7:
    print(-1)
else:
    print(ans)


Fixed code:
import itertools
import numpy as np
import copy

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

ans = 10 ** 7
for i in itertools.product([0, 1], repeat=N):
    tCA = copy.copy(CA)
    for j in range(N):
        if i[j] == 0:
            tCA[j] = np.zeros(CA.shape[1])
    s = np.sum(tCA, axis=0)
    l = sum(k >= X for k in s[1:])
    if s[0] < ans and l == M:
        ans = s[0]

if ans == 10 ** 7:
    print(-1)
else:
    print(ans)
Buggy code:
N,M,X=map(int,input().split())
CA=[list(map(int,input().split())) for _ in range(N)]
print(CA)
max_=10**16
ans=max_
for bit in range(2**N):
  check=[0]*M
  ans_=0
  for i in range(N):
    if bit>>i&1:
      ans_+=CA[i][0]
      for j in range(M):
        check[j]+=CA[i][j+1]
  if all([k>=X for k in check]):
    ans=min(ans,ans_)
print(ans if ans!=max_ else -1)


Fixed code:
N,M,X=map(int,input().split())
CA=[list(map(int,input().split())) for _ in range(N)]
max_=10**16
ans=max_
for bit in range(2**N):
  check=[0]*M
  ans_=0
  for i in range(N):
    if bit>>i&1:
      ans_+=CA[i][0]
      for j in range(M):
        check[j]+=CA[i][j+1]
  if all([k>=X for k in check]):
    ans=min(ans,ans_)
print(ans if ans!=max_ else -1)
Buggy code:
n,m,x=map(int, input().split())
c =[list(map(int, input().split())) for i in range(n)]
ch = [0 for i in range(m+1)]
ans = 10000000000
for j in range(0,n):
    ch = [x+y for (x,y) in zip(ch,c[j])]
for j in range(1,m+1):
    if ch[j] < x:
        print(-1)
        break
a,all = [],[]
for i in range(1,n+1):
    a.append(i)
for i in range(1,2**len(a)):
    b = []
    for j in range(len(a)):
        if (i >> j) &1 == 1:
            b.append(a[j])
    all.append(b)
for i in range(len(all)):
    ch = [0 for i in range(m+1)]
    for j in range(len(all[i])):
        k = all[i][j]-1
        ch = [x+y for (x,y) in zip(ch,c[k])]
    t = 0
    for j in range(1,m+1):
        if ch[j] < x:
            t = 1
    if t == 0 and ans > ch[0]:
        ans = ch[0]
print(ans)

Fixed code:
n,m,x=map(int, input().split())
c =[list(map(int, input().split())) for i in range(n)]
ch = [0 for i in range(m+1)]
ans = 10000000000
a,all = [],[]
for i in range(1,n+1):
    a.append(i)
for i in range(1,2**len(a)):
    b = []
    for j in range(len(a)):
        if (i >> j) &1 == 1:
            b.append(a[j])
    all.append(b)
for i in range(len(all)):
    ch = [0 for i in range(m+1)]
    for j in range(len(all[i])):
        k = all[i][j]-1
        ch = [x+y for (x,y) in zip(ch,c[k])]
    t = 0
    for j in range(1,m+1):
        if ch[j] < x:
            t = 1
    if t == 0 and ans > ch[0]:
        ans = ch[0]
if ans == 10000000000:
  print(-1)
else:
  print(ans)
Buggy code:
# -*- coding: utf-8 -*-

def input_one_number():
    return int(input())

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

def input_multiple_number_as_list():
    return list(map(int, input().split()))


N,M,X =  input_multiple_number()

listC = [0]*N
tableA = [[0]*M for i in range(N)]

for i in range(N):
	iii = input_multiple_number_as_list()
	listC[i] = iii[0]
	for j in range(M):
		tableA[i][j] = iii[j+1]

ans = 10000000000

import itertools as it
for i in it.product(range(2), repeat=N):
	isOK = True
	price = 0
	listM = [0]*M
	for j in range(N):
		if i[j] == 1:
			for qqq in range(M):
				listM[qqq] += tableA[j][qqq]
			price += listC[j]
	for skils in range(M):
		isOK = (listM[skils] >= X) and isOK

	if isOK:
		ans = min(price,ans)

print(ans)


Fixed code:
# -*- coding: utf-8 -*-

def input_one_number():
    return int(input())

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

def input_multiple_number_as_list():
    return list(map(int, input().split()))


N,M,X =  input_multiple_number()

listC = [0]*N
tableA = [[0]*M for i in range(N)]

for i in range(N):
	iii = input_multiple_number_as_list()
	listC[i] = iii[0]
	for j in range(M):
		tableA[i][j] = iii[j+1]
INF = 10000000000
ans = INF

import itertools as it
for i in it.product(range(2), repeat=N):
	isOK = True
	price = 0
	listM = [0]*M
	for j in range(N):
		if i[j] == 1:
			for qqq in range(M):
				listM[qqq] += tableA[j][qqq]
			price += listC[j]
	for skils in range(M):
		isOK = (listM[skils] >= X) and isOK

	if isOK:
		ans = min(price,ans)

if ans == INF:
	print(-1)
else:
	print(ans)
Buggy code:
N, M, X = map(int, input().split(' '))
price, exp, rst = [], [ [] for i in range(N) ], -1
for i in range(N):
    ls = list(map(int, input().split(' ')))
    price.append(ls[0])
    exp[i] = ls[1:]
for i in range(1 << M):
    price_combi, exp_combi, exp_sum, cnt_ls = [], [], [0] * M, []
    for j in range(M):
        if i >> j & 1:
            price_combi.append(price[j])
            exp_combi.append(exp[j])
    for s in exp_combi:
        for t in range(M):
            exp_sum[t] += s[t]
    [ cnt_ls.append(x) for x in exp_sum if x >= X ]
    if len(cnt_ls) == M:
        if rst == -1:
            rst = sum(price_combi)
        else:
            rst = min(rst, sum(price_combi))
print(rst)

Fixed code:
N, M, X = map(int, input().split(' '))
price, exp = [], [0] * N
for i in range(N):
    ls = list(map(int, input().split(' ')))
    price.append(ls[0])
    exp[i] = ls[1:]
rst = -1
for i in range(1 << N):
    price_combi, exp_combi, exp_sum, cnt = [], [], [0] * M, []
    for j in range(N):
        if i >> j & 1:
            price_combi.append(price[j])
            exp_combi.append(exp[j])
    for s in range(len(exp_combi)):
        for t in range(M):
            exp_sum[t] += exp_combi[s][t]
    [ cnt.append(i) for i in exp_sum if i >= X ]
    if len(cnt) == M:
        if rst == -1:
            rst = sum(price_combi)
        else:
            rst = min(rst, sum(price_combi))
print(rst)
Buggy code:
n,m,x = map(int, input().split())
a = [list(map(int, input().split())) for i in range(n)]
ans = 10**9 + 1
for i in range(2 ** n):
  skill = [0] * m
  overTen = False
  money = 0
  for j in range(n):
    if ((int(bin(i)[2:]) >> j) & 1):
      money += a[j][0]
      for h in range(m):
        skill[h] += a[j][h+1]
  for k in skill:
    if k >= x:
      overTen = True
    else:
      overTen = False
      break
  if overTen == True:
    if money < ans:
      ans = money
print(ans)

Fixed code:
n,m,x = map(int, input().split())
a = [list(map(int, input().split())) for i in range(n)]
ans = 10**9 
for i in range(2 ** n):
  skill = [0] * m
  overTen = False
  money = 0
  for j in range(n):
    if ((int(bin(i)[2:]) >> j) & 1):
      money += a[j][0]
      for h in range(m):
        skill[h] += a[j][h+1]
  for k in skill:
    if k >= x:
      overTen = True
    else:
      overTen = False
      break
  if overTen == True:
    if money < ans:
      ans = money

if ans == 10**9:
  ans = -1
print(ans)
Buggy code:
import numpy as np

n, m, x = map(int, input().split(' '))
a = np.zeros([n, m])
c = np.zeros(n)

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

INF = 10000000000000000
ans = INF

for i in range(1<<n):
  skill = np.zeros(m)
  cost = 0
  for j in range(n):
    if i & (1<<j):
      cost += c[j]
      skill += a[j]
  if all(skill >= x):
    ans = min(ans, cost)

print(ans if ans != INF else -1)
  

Fixed code:
import numpy as np

n, m, x = map(int, input().split(' '))
a = np.zeros([n, m])
c = np.zeros(n)

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

INF = 10000000000000000
ans = INF

for i in range(1<<n):
  skill = np.zeros(m)
  cost = 0
  for j in range(n):
    if i & (1<<j):
      cost += c[j]
      skill += a[j]
  if all(skill >= x):
    ans = min(ans, cost)

print(int(ans) if ans != INF else -1)
Buggy code:
import itertools
 
N, M, X = map(int, input().split())
l = []
for _ in range(N):
  l.append(list(map(int, input().split())))

b = [i for i in range(N)]
n = len(b)

b_pairs = []
for i in range(1, n+1):
    b_pairs += list(itertools.combinations(b, i))

cnt = 0
A = [0] * M
B = []
C = []
for i in range(2 ** N - 1):
  w = len(b_pairs[i])
  for j in range(M):
    for k in range(w):
      A[j] += l[b_pairs[i][k]][j + 1]
  B.append(A)
  A = [0] * M
  
for i in range(2 ** N - 1):
  w = len(b_pairs[i])
  for k in range(w):
    cnt += l[b_pairs[i][k]][0]
  C.append(cnt)
  cnt = 0

for i in range(len(B)):
  for j in range(M):
    if B[i][j] >= X:
      pass
    else:
      B[i] = 0
      break
    
for i in range(len(B)):
  if B[i] != 0:
    B[i] = C[i]
  else:
    B[i] = 100000000

print(min(B))

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

b = [i for i in range(N)]
n = len(b)

b_pairs = []
for i in range(1, n+1):
    b_pairs += list(itertools.combinations(b, i))

cnt = 0
A = [0] * M
B = []
C = []
for i in range(2 ** N - 1):
  w = len(b_pairs[i])
  for j in range(M):
    for k in range(w):
      A[j] += l[b_pairs[i][k]][j + 1]
  B.append(A)
  A = [0] * M
  
for i in range(2 ** N - 1):
  w = len(b_pairs[i])
  for k in range(w):
    cnt += l[b_pairs[i][k]][0]
  C.append(cnt)
  cnt = 0

for i in range(len(B)):
  for j in range(M):
    if B[i][j] >= X:
      pass
    else:
      B[i] = 0
      break
if B == [0] * len(B):
  print(-1)
  exit()

for i in range(len(B)):
  if B[i] != 0:
    B[i] = C[i]
  else:
    B[i] = 1000000000000

print(min(B))
Buggy code:
n,m,x = map(int, input().split())

N=[]
NI=[]
for i in range(n) :
    N = list(map(str, input().split()))
    NI.append(N)

ans=-1

for i in range(1<<n) :
    A=[0]*(m+1)
    for j in range(n) :
        # print(NI[j])
        if (1<<j)&i :
            A=[x+int(y) for(x,y)in zip(A,NI[j])]
    print(A)
    a = A[0]
    del A[0]
    if min(A)<x :
        a=-1
    elif ans==-1:
        ans = a
    elif ans>a :
        ans = a
print(ans)


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

N=[]
NI=[]
for i in range(n) :
    N = list(map(str, input().split()))
    NI.append(N)

ans=-1

for i in range(1<<n) :
    A=[0]*(m+1)
    for j in range(n) :
        # print(NI[j])
        if (1<<j)&i :
            A=[x+int(y) for(x,y)in zip(A,NI[j])]
    # print(A)
    a = A[0]
    del A[0]
    if min(A)<x :
        a=-1
    elif ans==-1:
        ans = a
    elif ans>a :
        ans = a
print(ans)
Buggy code:
N, M, X = list(map(int, input().split()))
A = [list(map(int, input().split())) for _ in range(N)]
kouho = []
for i in range(2**N):
  skill = [0]*M
  price = 0
  for j in range(N):
    if ((i>>j) & 1):
      skill = [x+y for (x, y) in zip(skill, A[j][1:])]
      price += A[j][0]
  flag = 1
  for k in skill:
    if k < X:
      flag = 0
  if flag:
    kouho.append(price)
print(min(kouho))
    


Fixed code:
N, M, X = list(map(int, input().split()))
A = [list(map(int, input().split())) for _ in range(N)]
kouho = []
for i in range(2**N):
  skill = [0]*M
  price = 0
  for j in range(N):
    if ((i>>j) & 1):
      skill = [x+y for (x, y) in zip(skill, A[j][1:])]
      price += A[j][0]
  flag = 1
  for k in skill:
    if k < X:
      flag = 0
  if flag:
    kouho.append(price)
if len(kouho):
  print(min(kouho))
else:
  print(-1)
Buggy code:
DEBUG = False

N, M, X = map(int, input().split())
A = []
C = []
for _ in range(N):
    CA = list(map(int, input().split()))
    C.append(CA[0])
    A.append(CA[1::])

if DEBUG:
    print(A)
    print(C)

max_money = 10**5 * N
ans_money = float('inf')
# ans_algorythm = None
for i in range(2**N):
    bit = bin(i)[2::]
    bit = bit.zfill(M)
    if DEBUG:
        print("i: {}, bit: {}".format(i, bit))
    tmp_money = 0
    tmp_algorythm = [0] * M
    for j, b in enumerate(bit):
        if b == '1':
            tmp_money += C[j]
            for k, c in enumerate(A[j]):
                tmp_algorythm[k] += c
    if DEBUG:
        print("tmp_money: {}, tmp_algorythm: {}".format(tmp_money, tmp_algorythm))
    if len(list(filter(lambda x: x < X, tmp_algorythm))) == 0:
        ans_money = min(tmp_money, ans_money)
        if DEBUG:
            print("ans_money: {}".format(ans_money))
        # break

if ans_money == max_money:
    print(-1)
else:
    print(ans_money)


Fixed code:
DEBUG = False

N, M, X = map(int, input().split())
A = []
C = []
for _ in range(N):
    CA = list(map(int, input().split()))
    C.append(CA[0])
    A.append(CA[1::])

if DEBUG:
    print(A)
    print(C)

max_money = 10**5 * N + 1
ans_money = max_money
# ans_algorythm = None
for i in range(2**N):
    bit = bin(i)[2::]
    bit = bit.zfill(N)
    if DEBUG:
        print("i: {}, bit: {}".format(i, bit))
    tmp_money = 0
    tmp_algorythm = [0] * M
    for j, b in enumerate(bit):
        if b == '1':
            tmp_money += C[j]
            for k, c in enumerate(A[j]):
                tmp_algorythm[k] += c
    if DEBUG:
        print("tmp_money: {}, tmp_algorythm: {}".format(tmp_money, tmp_algorythm))
    if len(list(filter(lambda x: x < X, tmp_algorythm))) == 0:
        ans_money = min(tmp_money, ans_money)
        if DEBUG:
            print("ans_money: {}".format(ans_money))
        # break

if ans_money == max_money:
    print(-1)
else:
    print(ans_money)