Buggy python submission (verdict: Runtime Error):
N,M,X=map(int,input().split())
li=[]
Ans=100001

for i in range(N):
    array=list(map(int,input().split()))
    li.append(array)

for j in range(2**N):
    b=bin(j)
    b=b[2:]
    b="0"*(N-len(b))+b
    
    
    c=0
    x=0
    y=0
    z=0

    for k in range(len(b)):
        if b[k]==str(1):
            c+=li[k][0]
            x+=li[k][1]
            y+=li[k][2]
            z+=li[k][3]
    if x>=X and y>=X and z>=X and Ans>c:
        Ans=c
    else:
        pass

if Ans==100001:
    print("-1")
else:
    print(Ans)


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

li=[]
ans=100000000000000000000000000000000

for j in range(N):
    a=list(map(int,input().split()))
    li.append(a)

for k in range(2**N):
    temp=0
    skill=[0]*M
    k=str(bin(k))
    k=k[2:]
    while len(k)!=N:
        k="0"+k
    for l in range(N):
        if k[l]=="1":
            temp+=li[l][0]
            for m in range(1,M+1):
                skill[m-1]+=li[l][m]
    if min(skill)>=X:
        if ans>temp:
            ans=temp
if ans==100000000000000000000000000000000:
    print(-1)
else:
    print(ans)

Buggy python submission (verdict: Runtime Error):
N,M,X=map(int,input().split())
li=[]
Ans=100001

for i in range(N):
    array=list(map(int,input().split()))
    li.append(array)

for j in range(2**N):
    b=bin(j)
    b=b[2:]
    b="0"*(N-len(b))+b
    
    
    c=0
    x=0
    y=0
    z=0

    for k in range(len(b)):
        if b[k]==str(1):
            c+=li[k][0]
            x+=li[k][1]
            y+=li[k][2]
            z+=li[k][3]
    if x>=X and y>=X and z>=X and Ans>c:
        Ans=c

if Ans==100001:
    print("-1")
else:
    print(Ans)


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

li=[]
ans=100000000000000000000000000000000

for j in range(N):
    a=list(map(int,input().split()))
    li.append(a)

for k in range(2**N):
    temp=0
    skill=[0]*M
    k=str(bin(k))
    k=k[2:]
    while len(k)!=N:
        k="0"+k
    for l in range(N):
        if k[l]=="1":
            temp+=li[l][0]
            for m in range(1,M+1):
                skill[m-1]+=li[l][m]
    if min(skill)>=X:
        if ans>temp:
            ans=temp
if ans==100000000000000000000000000000000:
    print(-1)
else:
    print(ans)

Buggy python submission (verdict: Runtime Error):
N,M,X=map(int,input().split())
li=[]
Ans=100001

for i in range(N):
    array=list(map(int,input().strip().split()))
    li.append(array)

for j in range(2**N):
    b=bin(j)
    b=b[2:]
    b="0"*(N-len(b))+b
    
    
    c=0
    x=0
    y=0
    z=0

    for k in range(len(b)):
        if b[k]==str(1):
            c+=li[k][0]
            x+=li[k][1]
            y+=li[k][2]
            z+=li[k][3]
    if x>=X and y>=X and z>=X and Ans>c:
        Ans=c

if Ans==100001:
    print(-1)
else:
    print(Ans)


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

li=[]
ans=100000000000000000000000000000000

for j in range(N):
    a=list(map(int,input().split()))
    li.append(a)

for k in range(2**N):
    temp=0
    skill=[0]*M
    k=str(bin(k))
    k=k[2:]
    while len(k)!=N:
        k="0"+k
    for l in range(N):
        if k[l]=="1":
            temp+=li[l][0]
            for m in range(1,M+1):
                skill[m-1]+=li[l][m]
    if min(skill)>=X:
        if ans>temp:
            ans=temp
if ans==100000000000000000000000000000000:
    print(-1)
else:
    print(ans)