Buggy python submission (verdict: Runtime Error):
from itertools import  product
N,M,X = map(int,input().split())
ca = [list(map(int,input().split())) for _ in range(N)]
for i in range(1,M+1):
    count=0
    for j in range(N):
        count+=ca[j][i]
    if count<X:
        print(-1)
        exit()

ans = 10**9
for z in product((0, 1), repeat=N):#bit全探索のくみあわせを勝手に作ってくれるので使うとよい
    count=0
    count2=[0]*M
    for i in range(N):
        if z[i]==1:
            count+=ca[i][0]
            for j in range(1,M+1):
                count2[j-1]+=ca[i][j]
    
    for i in range(m):
        if count2[i]<x:
            break
    else:
        ans=min(count,ans)
print(ans)


Fixed submission:
from itertools import  product
N,M,X = map(int,input().split())
ca = [list(map(int,input().split())) for _ in range(N)]
for i in range(1,M+1):
    count=0
    for j in range(N):
        count+=ca[j][i]
    if count<X:
        print(-1)
        exit()

ans = 10**9
for z in product((0, 1), repeat=N):#bit全探索のくみあわせを勝手に作ってくれるので使うとよい
    count=0
    count2=[0]*M
    for i in range(N):
        if z[i]==1:
            count+=ca[i][0]
            for j in range(1,M+1):
                count2[j-1]+=ca[i][j]
    
    for i in range(M):
        if count2[i]<X:
            break
    else:
        ans=min(count,ans)
print(ans)

Buggy python submission (verdict: Runtime Error):
N,M,X = map(int,input().split())
C = []
A = []
success = []

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

C.sort()
n = len(C)
items = []
for i in range(2 ** n):
    item = []
    for j in range(n):  # このループが一番のポイント
        if ((i >> j) & 1):  # 順に右にシフトさせ最下位bitのチェックを行う
            item.append(C[j])  # フラグが立っていたら bag に果物を詰める
    items.append(item)

for i in range(1,len(items)):
    sum = 0
    a1 = 0
    a2 = 0
    a3 = 0
    for j in range(len(items[i])):
        index = items[i][j][1]
        a1 += A[index][0]
        a2 += A[index][1]
        a3 += A[index][2]
        sum += items[i][j][0]
    if a1 >= X and a2 >= X and a3 >= X:
        success.append(sum)
if len(success) == 0:
    print(-1)
else:
    print(min(success))

Fixed submission:
from itertools import  product
N,M,X = map(int,input().split())
ca = [list(map(int,input().split())) for _ in range(N)]
for i in range(1,M+1):
    count=0
    for j in range(N):
        count+=ca[j][i]
    if count<X:
        print(-1)
        exit()

ans = 10**9
for z in product((0, 1), repeat=N):#bit全探索のくみあわせを勝手に作ってくれるので使うとよい
    count=0
    count2=[0]*M
    for i in range(N):
        if z[i]==1:
            count+=ca[i][0]
            for j in range(1,M+1):
                count2[j-1]+=ca[i][j]
    
    for i in range(M):
        if count2[i]<X:
            break
    else:
        ans=min(count,ans)
print(ans)

Buggy python submission (verdict: Runtime Error):
N,M,X = map(int,input().split())
C = []
A = []
success = []

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

C.sort()
n = len(C)
items = []
for i in range(2 ** n):
    item = []
    for j in range(n):  # このループが一番のポイント
        if ((i >> j) & 1):  # 順に右にシフトさせ最下位bitのチェックを行う
            item.append(C[j])  # フラグが立っていたら bag に果物を詰める
    items.append(item)

print(items)
for i in range(1,len(items)):
    sum = 0
    a1 = 0
    a2 = 0
    a3 = 0
    for j in range(len(items[i])):
        index = items[i][j][1]
        a1 += A[index][0]
        a2 += A[index][1]
        a3 += A[index][2]
        sum += items[i][j][0]
    if a1 >= X and a2 >= X and a3 >= X:
        success.append(sum)
if len(success) == 0:
    print(-1)
else:
    print(min(success))

Fixed submission:
from itertools import  product
N,M,X = map(int,input().split())
ca = [list(map(int,input().split())) for _ in range(N)]
for i in range(1,M+1):
    count=0
    for j in range(N):
        count+=ca[j][i]
    if count<X:
        print(-1)
        exit()

ans = 10**9
for z in product((0, 1), repeat=N):#bit全探索のくみあわせを勝手に作ってくれるので使うとよい
    count=0
    count2=[0]*M
    for i in range(N):
        if z[i]==1:
            count+=ca[i][0]
            for j in range(1,M+1):
                count2[j-1]+=ca[i][j]
    
    for i in range(M):
        if count2[i]<X:
            break
    else:
        ans=min(count,ans)
print(ans)

Buggy python submission (verdict: Runtime Error):
N,M,X = map(int,input().split())
C = []
A = []
success = []

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

C.sort()
n = len(C)
items = []
for i in range(2 ** n):
    item = []
    for j in range(n):  # このループが一番のポイント
        if ((i >> j) & 1):  # 順に右にシフトさせ最下位bitのチェックを行う
            item.append(C[j])  # フラグが立っていたら bag に果物を詰める
    items.append(item)


for i in range(1,len(items)):
    sum = 0
    a1 = 0
    a2 = 0
    a3 = 0
    for j in range(len(items[i])):
        a1 += A[items[i][j][1]][0]
        a2 += A[items[i][j][1]][1]
        a3 += A[items[i][j][1]][2]
        sum += items[i][j][0]
    if a1 >= X and a2 >= X and a3 >= X:
        success.append(sum)
if len(success) == 0:
    print(-1)
else:
    print(min(success))

Fixed submission:
from itertools import  product
N,M,X = map(int,input().split())
ca = [list(map(int,input().split())) for _ in range(N)]
for i in range(1,M+1):
    count=0
    for j in range(N):
        count+=ca[j][i]
    if count<X:
        print(-1)
        exit()

ans = 10**9
for z in product((0, 1), repeat=N):#bit全探索のくみあわせを勝手に作ってくれるので使うとよい
    count=0
    count2=[0]*M
    for i in range(N):
        if z[i]==1:
            count+=ca[i][0]
            for j in range(1,M+1):
                count2[j-1]+=ca[i][j]
    
    for i in range(M):
        if count2[i]<X:
            break
    else:
        ans=min(count,ans)
print(ans)