Buggy python submission (verdict: Runtime Error):
def list_add(li1, li2):
    return list(map(sum,zip(li1,li2)))
N, M, X = map(int, input().split(" "))
list = []
for i in range(N):
    list.append([int(i) for i in input().split(" ")])
list.sort()
price = 0
knowledge = []
priceList = []
for i in range(N):
    price = price + list[i][0]
    if i == 0:
        knowledge = list[0][1: M + 1]
    else:
        tmp2 = [x + y for (x, y) in zip(knowledge, list[i][1:M+1])]
        knowledge = tmp2
    # 全部足しても足りないとき
    if i == N - 1 and min(knowledge) < X:
        print(-1)
        exit()
    # 目標を超えたとき
    if min(knowledge) >= X:
        for j in range(i, -1, -1):
            searchList = [x - y for (x, y) in zip(knowledge, list[j][1: M + 1])]
            if min(searchList) >= X:
                knowledge = searchList
                price = price - list[j][0]
        break
for i in range(N):
    if min(list[i][1: M + 1]) >= X and min(priceList) > list[i][0]:
        print(list[i][0])
        exit()
print(price)


Fixed submission:
def list_add(li1, li2):
    return list(map(sum, zip(li1, li2)))


def dfs(price, knowledge, depth):
    if (min(knowledge) >= X):
        ansList.append(price)
    if depth == N:
        return
    dfs(price, knowledge, depth + 1)
    dfs(price+priceList[depth], list_add(KnowList[depth], knowledge), depth+1)


N, M, X = map(int, input().split(" "))
KnowList = [[] for i in range(N)]
priceList = [0] * N
for i in range(N):
    tmp = [int(i) for i in input().split(" ")]
    priceList[i] = tmp[0]
    KnowList[i] = tmp[1:]
price = 0
ansList = []
knowledge = [0] * M
dfs(price, knowledge, 0)
if (len(ansList) == 0):
    ansList.append(-1)
print(min(ansList))

Buggy python submission (verdict: Runtime Error):
def list_add(li1, li2):
    return list(map(sum,zip(li1,li2)))
N, M, X = map(int, input().split(" "))
list = []
for i in range(N):
    list.append([int(i) for i in input().split(" ")])
list.sort()
price = 0
knowledge = []
priceList = []
flag = True
for i in range(N):
    if flag:
        price = price + list[i][0]
        if i == 0:
            knowledge = list[0][1: M + 1]
        else:
            tmp2 = [x + y for (x, y) in zip(knowledge, list[i][1:M+1])]
            knowledge = tmp2
        # 全部足しても足りないとき
        if i == N - 1 and min(knowledge) < X:
            print(-1)
            exit()
        # 目標を超えたとき
        if min(knowledge) >= X and flag:
            for j in range(i, -1, -1):
                searchList = [x - y for (x, y) in zip(knowledge, list[j][1: M + 1])]
                if min(searchList) >= X:
                    knowledge = searchList
                    price = price - list[j][0]
            flag = False
for i in range(N):
    if min(list[i][1: M + 1]) >= X and min(priceList) > list[i][0]:
        print(list[i][0])
        exit()
print(price)


Fixed submission:
def list_add(li1, li2):
    return list(map(sum, zip(li1, li2)))


def dfs(price, knowledge, depth):
    if (min(knowledge) >= X):
        ansList.append(price)
    if depth == N:
        return
    dfs(price, knowledge, depth + 1)
    dfs(price+priceList[depth], list_add(KnowList[depth], knowledge), depth+1)


N, M, X = map(int, input().split(" "))
KnowList = [[] for i in range(N)]
priceList = [0] * N
for i in range(N):
    tmp = [int(i) for i in input().split(" ")]
    priceList[i] = tmp[0]
    KnowList[i] = tmp[1:]
price = 0
ansList = []
knowledge = [0] * M
dfs(price, knowledge, 0)
if (len(ansList) == 0):
    ansList.append(-1)
print(min(ansList))