Problem p02683 (python)

Fixed submission:
n, m, X = map(int, input().split())

A = [[] for _ in range(n)]
c = [0] * n

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

INF = 10**9
ans = INF
    
for s in range(0, 1 << n):
    smart = [0] * m
    cost_sum = 0
    for i in range(n):
        if (s >> i) % 2 == 0:continue
        cost_sum += c[i]
        for j in range(m):
            smart[j] += A[i][j]
    ok = True
    for j in range(m):
        if smart[j] < X:
            ok = False
    if ok:
        ans = min(ans, cost_sum)

if ans == INF:
    ans = -1

print(ans)

Buggy submission (verdict: Runtime Error):
n,m,x=map(int,input().split())
l=[0]*n
for i in range(n):
    long=list(map(int,input().split()))
    l[i]=long

ans=10**7
for i in range(1<<n):
    money=0
    a=[0]*n
    for j in range(n):
        if (i>>j)%2==1:
            money+=l[j][0]
            for k in range(m):
                a[k]+=l[j][k+1]
    cnt=0
    for p in a:
        if p>=x:
            cnt+=1
    if cnt==m:
        ans=min(ans,money)
if ans==10**7:
    print(-1)
else:
    print(ans)

Buggy submission (verdict: Runtime Error):
n,m,x=map(int,input().split())
l=[0]*n
for i in range(n):
    long=list(map(int,input().split()))
    l[i]=long

ans=10**7
for i in range(1<<n):
    money=0
    a=[0]*n
    for j in range(n):
        if (i>>j)%2==1:
            money+=l[j][0]
            for k in range(m):
                a[k]+=l[j][k+1]
    cnt=0
    for p in a:
        if p>=x:
            cnt+=1
            if cnt==m:
                ans=min(ans,money)
if ans==10**9:
    print(-1)
else:
    print(ans)

Buggy submission (verdict: Runtime Error):
n,m,x=map(int,input().split())
l=[0]*n
for i in range(n):
    long=list(map(int,input().split()))
    l[i]=long

ans=10**9
for i in range(1<<n):
    money=0
    a=[0]*n
    for j in range(n):
        if (i>>j)%2==1:
            money+=l[j][0]
            for k in range(m):
                a[k]+=l[j][k+1]
    cnt=0
    for p in a:
        if p>=x:
            cnt+=1
            if cnt==m:
                ans=min(ans,money)
print(ans)

Buggy submission (verdict: Runtime Error):
n,m,x=map(int,input().split())
l=[0]*n
for i in range(n):
    long=list(map(int,input().split()))
    l[i]=long

ans=10**9
for i in range(1<<n):
    money=0
    a=[0]*n
    for j in range(n):
        if (i>>j)%2==1:
            money+=l[j][0]
            for k in range(m):
                a[k]+=l[j][k+1]
    cnt=0
    for p in a:
        if p>=x:
            cnt+=1
            if cnt==m:
                ans=min(ans,money)
if ans==10**9:
    print(-1)
else:
    print(ans)

Buggy submission (verdict: Runtime Error):
n,m,x=map(int,input().split())
l=[0]*n
for i in range(n):
    long=list(map(int,input().split()))
    l[i]=long

ans=10**9
for i in range(1,1<<n):
    money=0
    a=[0]*n
    for j in range(n):
        if (i>>j)%2==1:
            money+=l[j][0]
            for k in range(m):
                a[k]+=l[j][k+1]
    cnt=0
    for p in a:
        if p>=x:
            cnt+=1
            if cnt==m:
                ans=min(ans,money)
if ans==10**9:
    print(-1)
else:
    print(ans)

Buggy submission (verdict: Runtime Error):
n,m,x=map(int,input().split())
l=[0]*n
for i in range(n):
    long=list(map(int,input().split()))
    l[i]=long

ans=10**9
for i in range(1,1<<n):
    money=0
    a=[0]*n
    for j in range(n):
        if (i>>j)%2==1:
            money+=l[j][0]
            for k in range(m):
                a[k]+=l[j][k+1]
    cnt=0
    for p in a:
        if p>=x:
            cnt+=1
            if cnt==m:
                ans=min(ans,money)
if ans==10**9:
    print(-1)
else:
    print(ans)

Buggy submission (verdict: Runtime Error):
n,m,x=map(int,input().split())
l=[0]*n
for i in range(n):
    long=list(map(int,input().split()))
    l[i]=long

ans=10**9
for i in range(1,1<<n):
    money=0
    a=[0]*n
    for j in range(n):
        if (i>>j)%2==1:
            money+=l[j][0]
            for k in range(m):
                a[k]+=l[j][k+1]
    cnt=0
    for p in a:
        if p>=x:
            cnt+=1
            if cnt==m:
                ans=min(ans,money)
print(ans)