Buggy python submission (verdict: Runtime Error):
n,m,x =map(int,input().split())

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

#print(a,c)

ans = 10 ** 8

for i in range(1 << n):
    cost = 0
    check = True
    d = [0 for i in range(n)]
    for j in range(n):
        if i >> j & 1:
            cost += c[j]
            for i2 in range(n):
                d[i2] += a[j][i2]
            #print(i >> j,d)
    for k in range(n):
        if d[k] < x:
            check = False
    if check:
        ans = min(ans, cost)
    #print(d,cost,check)
    
if ans == 10 ** 8:
    print(-1)
else:
    print(ans)

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

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

#print(a,c)

ans = 10 ** 8

for i in range(1 << n):
    cost = 0
    check = True
    d = [0 for i in range(m)]
    for j in range(n):
        if i >> j & 1:
            cost += c[j]
            for i2 in range(m):
                d[i2] += a[j][i2]
            #print(i >> j,d)
    for k in range(m):
        if d[k] < x:
            check = False
    if check:
        ans = min(ans, cost)
    #print(d,cost,check)
    
if ans == 10 ** 8:
    print(-1)
else:
    print(ans)

Buggy python submission (verdict: Runtime Error):
n,m,x =map(int,input().split())

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

#print(a,c)

ans = 10 ** 8

for i in range(1 << n):
    cost = 0
    check = True
    d = [0 for i in range(n)]
    for j in range(n):
        if i >> j & 1:
            cost += c[j]
            for i2 in range(n):
                d[i2] += a[j][i2]
            #print(i >> j,d)
    for k in range(n):
        if d[k] < x:
            check = False
    if check:
        ans = min(ans, cost)
    #print(d,cost,check)
    
if ans == 10 ** 8:
    print(-1)
else:
    print(ans)

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

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

#print(a,c)

ans = 10 ** 8

for i in range(1 << n):
    cost = 0
    check = True
    d = [0 for i in range(m)]
    for j in range(n):
        if i >> j & 1:
            cost += c[j]
            for i2 in range(m):
                d[i2] += a[j][i2]
            #print(i >> j,d)
    for k in range(m):
        if d[k] < x:
            check = False
    if check:
        ans = min(ans, cost)
    #print(d,cost,check)
    
if ans == 10 ** 8:
    print(-1)
else:
    print(ans)

Buggy python submission (verdict: Runtime Error):
n,m,x =map(int,input().split())

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

#print(a,c)

ans = 10 ** 8

for i in range(1 << n):
    cost = 0
    check = True
    d = [0 for i in range(n)]
    for j in range(n):
        if i >> j & 1:
            cost += c[j]
            for i2 in range(n):
                d[i2] += a[j][i2]
            #print(i >> j,d)
    for k in range(n):
        if d[k] < x:
            check = False
    if check:
        ans = min(ans, cost)
    #print(d,cost,check)
    
if ans == 10 ** 8:
    print(-1)
else:
    print(ans)

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

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

#print(a,c)

ans = 10 ** 8

for i in range(1 << n):
    cost = 0
    check = True
    d = [0 for i in range(m)]
    for j in range(n):
        if i >> j & 1:
            cost += c[j]
            for i2 in range(m):
                d[i2] += a[j][i2]
            #print(i >> j,d)
    for k in range(m):
        if d[k] < x:
            check = False
    if check:
        ans = min(ans, cost)
    #print(d,cost,check)
    
if ans == 10 ** 8:
    print(-1)
else:
    print(ans)