Buggy python submission (verdict: Time Limit Exceeded):
import itertools

def main():
    n,m,x = map(int,input().split())
    ans = 0
    tmp = 10 ** 7
    ca = [[0]*m for i in range(n)]
    nn = [i for i in range(n)]

    for _ in range(n):
        ca[_] = list(map(int, input().split()))

    xx = list(itertools.permutations(nn))

    for ii in xx:
        ans = 0
        a = [0 for i in range(m)]

        for _ in ii:
            cost = ca[_][0]
            chk = 0
            for i in range(m):
                a[i] += ca[_][i+1]
                if a[i] < x:
                    chk = 1

            ans += cost
            if chk == 0:
                if tmp > ans:
                    tmp = ans
                break
            
        if tmp == 10 ** 7:
            print(-1)
            exit()

    print(tmp)

 
if __name__ == "__main__":
    main()

Fixed submission:
def main():
    n,m,x = map(int,input().split())
    a = [[] for _ in range(n)]
    c = [0] * n

    INF = 10 ** 9
    ans = INF

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

    for s in range(0,1<<n):
        smart = [0] * m
        cost = 0
        for i in range(n):
            if(s>>i) % 2 == 0:continue
            cost += c[i]
            for j in range(m):
                smart[j] += a[i][j]
        ok = True
        for i in range(m):
            if smart[i] < x:
                ok = False
        if ok:
            ans = min(ans,cost)
    if ans == INF:
        ans = -1
    
    print(ans)

if __name__ == "__main__":
    main()

Buggy python submission (verdict: Runtime Error):

import itertools

def main():
    n,m,x = map(int,input().split())
    ans = 0
    tmp = 10 ** 7
    ca = [[0]*m for i in range(n)]
    nn = [i for i in range(n)]

    for _ in range(n):
        ca[_] = list(map(int, input().split()))

    xx = list(itertools.combinations(nn))

    for ii in xx:
        ans = 0
        a = [0 for i in range(m)]

        for _ in ii:
            cost = ca[_][0]
            chk = 0
            for i in range(m):
                a[i] += ca[_][i+1]
                if a[i] < x:
                    chk = 1

            ans += cost
            if chk == 0:
                if tmp > ans:
                    tmp = ans
                break
            
        if tmp == 10 ** 7:
            print(-1)
            exit()

    print(tmp)

 
if __name__ == "__main__":
    main()

Fixed submission:
def main():
    n,m,x = map(int,input().split())
    a = [[] for _ in range(n)]
    c = [0] * n

    INF = 10 ** 9
    ans = INF

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

    for s in range(0,1<<n):
        smart = [0] * m
        cost = 0
        for i in range(n):
            if(s>>i) % 2 == 0:continue
            cost += c[i]
            for j in range(m):
                smart[j] += a[i][j]
        ok = True
        for i in range(m):
            if smart[i] < x:
                ok = False
        if ok:
            ans = min(ans,cost)
    if ans == INF:
        ans = -1
    
    print(ans)

if __name__ == "__main__":
    main()

Buggy python submission (verdict: Runtime Error):
import itertools

n,m,x = map(int,input().split())
ans = 0
tmp = 10 ** 7
ca = [[0]*m for i in range(n)]
nn = [i for i in range(n)]

for _ in range(n):
    ca[_] = list(map(int, input().split()))

xx = list(itertools.combinations(nn))

for ii in xx:
    ans = 0
    a = [0 for i in range(m)]

    for _ in ii:
        cost = ca[_][0]
        chk = 0
        for i in range(m):
            a[i] += ca[_][i+1]
            if a[i] < x:
                chk = 1

        ans += cost
        if chk == 0:
            if tmp > ans:
                tmp = ans
            break
    
    if tmp == 10 ** 7:
        print(-1)
        exit()

print(tmp)

Fixed submission:
def main():
    n,m,x = map(int,input().split())
    a = [[] for _ in range(n)]
    c = [0] * n

    INF = 10 ** 9
    ans = INF

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

    for s in range(0,1<<n):
        smart = [0] * m
        cost = 0
        for i in range(n):
            if(s>>i) % 2 == 0:continue
            cost += c[i]
            for j in range(m):
                smart[j] += a[i][j]
        ok = True
        for i in range(m):
            if smart[i] < x:
                ok = False
        if ok:
            ans = min(ans,cost)
    if ans == INF:
        ans = -1
    
    print(ans)

if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):

import itertools

n,m,x = map(int,input().split())
ans = 0
tmp = 10 ** 7
ca = [[0]*m for i in range(n)]
nn = [i for i in range(n)]

for _ in range(n):
    ca[_] = list(map(int, input().split()))

xx = list(itertools.permutations(nn))


for ii in xx:
    ans = 0
    a = [0 for i in range(m)]

    for _ in ii:
        cost = ca[_][0]
        chk = 0
        for i in range(m):
            a[i] += ca[_][i+1]
            if a[i] < x:
                chk = 1

        ans += cost
        if chk == 0:
            if tmp > ans:
                tmp = ans
            break
    
    if tmp == 10 ** 7:
        print(-1)
        exit()

print(tmp)

Fixed submission:
def main():
    n,m,x = map(int,input().split())
    a = [[] for _ in range(n)]
    c = [0] * n

    INF = 10 ** 9
    ans = INF

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

    for s in range(0,1<<n):
        smart = [0] * m
        cost = 0
        for i in range(n):
            if(s>>i) % 2 == 0:continue
            cost += c[i]
            for j in range(m):
                smart[j] += a[i][j]
        ok = True
        for i in range(m):
            if smart[i] < x:
                ok = False
        if ok:
            ans = min(ans,cost)
    if ans == INF:
        ans = -1
    
    print(ans)

if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import itertools

n,m,x = map(int,input().split())
ans = 0
tmp = 10 ** 7
ca = [[0]*m for i in range(n)]

for _ in range(n):
    ca[_] = list(map(int, input().split()))

xx = list(itertools.permutations(ca))


for cax in xx:
    ans = 0
    a = [0 for i in range(m)]

    for _ in range(n):
        cost = cax[_][0]
        chk = 0
        for i in range(m):
            a[i] += cax[_][i+1]
            if a[i] < x:
                chk = 1

        ans += cost
        if chk == 0:
            if tmp > ans:
                tmp = ans
            break
if tmp == 10 ** 7:
    print(-1)
    exit()
print(tmp)

Fixed submission:
def main():
    n,m,x = map(int,input().split())
    a = [[] for _ in range(n)]
    c = [0] * n

    INF = 10 ** 9
    ans = INF

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

    for s in range(0,1<<n):
        smart = [0] * m
        cost = 0
        for i in range(n):
            if(s>>i) % 2 == 0:continue
            cost += c[i]
            for j in range(m):
                smart[j] += a[i][j]
        ok = True
        for i in range(m):
            if smart[i] < x:
                ok = False
        if ok:
            ans = min(ans,cost)
    if ans == INF:
        ans = -1
    
    print(ans)

if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import itertools

n,m,x = map(int,input().split())
ans = 0
tmp = 10 ** 7
ca = [[0]*m for i in range(n)]

for _ in range(n):
    ca[_] = list(map(int, input().split()))

xx = list(itertools.permutations(ca))


for cax in xx:
    ans = 0
    a = [0 for i in range(m)]

    for _ in range(n):
        cost = cax[_][0]
        chk = 0
        for i in range(m):
            a[i] += cax[_][i+1]
            if a[i] < x:
                chk = 1

        ans += cost
        if chk == 0:
            if tmp > ans:
                tmp = ans
            break
if tmp == 10 ** 7:
    print(-1)
    exit()
print(tmp)

Fixed submission:
def main():
    n,m,x = map(int,input().split())
    a = [[] for _ in range(n)]
    c = [0] * n

    INF = 10 ** 9
    ans = INF

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

    for s in range(0,1<<n):
        smart = [0] * m
        cost = 0
        for i in range(n):
            if(s>>i) % 2 == 0:continue
            cost += c[i]
            for j in range(m):
                smart[j] += a[i][j]
        ok = True
        for i in range(m):
            if smart[i] < x:
                ok = False
        if ok:
            ans = min(ans,cost)
    if ans == INF:
        ans = -1
    
    print(ans)

if __name__ == "__main__":
    main()