Buggy python submission (verdict: Runtime Error):
def task(n, m, x, c, a):
    mx = [0] * n
    for i in range(0, n):
        for j in range(0, m):
            mx[j] += a[i][j]

    for j in range(0, m):
        if mx[j] < x:
            print(-1)
            return

    states = [0] * m

    best = 1000000
    for i in range(1, (2**n) + 1):
        price = 0
        for k in range(0, m):
            states[k] = 0
        for j in range(0, n):
            if ((i >> j) & 1):
                price += c[j]
                for k in range(0, m):
                    states[k] += a[j][k]

        if price < best:
            found = True
            for k in range(0, m):
                if states[k] < x:
                    found = False
                    break

            if found:
                best = price

    print(best)


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

task(n, m, x, c, a)


Fixed submission:
def task(n, m, x, c, a):
    mx = [0] * m
    for i in range(0, n):
        for j in range(0, m):
            mx[j] += a[i][j]

    for j in range(0, m):
        if mx[j] < x:
            print(-1)
            return

    states = [0] * m

    best = 100000000
    for i in range(1, 2**n):
        price = 0

        for k in range(0, m):
            states[k] = 0

        for j in range(0, n):
            if ((i >> j) & 1):
                price += c[j]
                for k in range(0, m):
                    states[k] += a[j][k]

        if price < best:
            found = True
            for k in range(0, m):
                if states[k] < x:
                    found = False
                    break

            if found:
                best = price

    print(best)


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

task(n, m, x, c, a)

Buggy python submission (verdict: Runtime Error):
def rec(c, a, x, n, m, start, states, best, price):

    for i in range(start, n):
        price += c[i]

        found = True
        for j in range(0, m):
            states[j] += a[i][j]

            if states[j] < x:
                found = False

        if found and price < best:
            best = price

        if i < n - 1:
            best = rec(c, a, x, n, m, i + 1, states, best, price)

        for j in range(0, m):
            states[j] -= a[i][j]

        price -= c[i]

    return best


def task(n, m, x, c, a):
    mx = [0] * n
    for i in range(0, n):
        for j in range(0, m):
            mx[j] += a[i][j]

    for j in range(0, m):
        if mx[j] < x:
            print(-1)
            return

    states = [0] * m

    # best = 0
    # for i in range(1, 2 ^ n + 1):
    #     price = 0
    #     states = [0] * m
    #     for j in range(0, n):
    #         if ((i >> j) & 1):
    #             price += c[j]
    #             for k in range(0, m):
    #                 states[m] += a[k]
    #                 states[m] += a[k]
    #                 states[m] += a[k]

    best = rec(c, a, x, n, m, 0, states, 1000000, 0)

    print(best)


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

task(n, m, x, c, a)


Fixed submission:
def task(n, m, x, c, a):
    mx = [0] * m
    for i in range(0, n):
        for j in range(0, m):
            mx[j] += a[i][j]

    for j in range(0, m):
        if mx[j] < x:
            print(-1)
            return

    states = [0] * m

    best = 100000000
    for i in range(1, 2**n):
        price = 0

        for k in range(0, m):
            states[k] = 0

        for j in range(0, n):
            if ((i >> j) & 1):
                price += c[j]
                for k in range(0, m):
                    states[k] += a[j][k]

        if price < best:
            found = True
            for k in range(0, m):
                if states[k] < x:
                    found = False
                    break

            if found:
                best = price

    print(best)


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

task(n, m, x, c, a)

Buggy python submission (verdict: Runtime Error):
def rec(c, a, x, n, m, start, states, best, price):

    for i in range(start, n):
        price += c[i]
        states[0] += a[i][0]
        states[1] += a[i][1]
        states[2] += a[i][2]

        if states[0] >= x and states[1] >= x and states[2] >= x and price < best:
            best = price

        if i != n - 1:
            best = rec(c, a, x, n, m, i + 1, states, best, price)

        states[0] -= a[i][0]
        states[1] -= a[i][1]
        states[2] -= a[i][2]
        price -= c[i]

    return best


def task(n, m, x, c, a):
    mx = [0] * n
    for i in range(0, n):
        for j in range(0, m):
            mx[j] += a[i][j]

    for j in range(0, m):
        if mx[j] < x:
            print(-1)
            return

    best = rec(c, a, x, n, m, 0, [0, 0, 0], 1000000, 0)

    print(best)


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

task(n, m, x, c, a)


Fixed submission:
def task(n, m, x, c, a):
    mx = [0] * m
    for i in range(0, n):
        for j in range(0, m):
            mx[j] += a[i][j]

    for j in range(0, m):
        if mx[j] < x:
            print(-1)
            return

    states = [0] * m

    best = 100000000
    for i in range(1, 2**n):
        price = 0

        for k in range(0, m):
            states[k] = 0

        for j in range(0, n):
            if ((i >> j) & 1):
                price += c[j]
                for k in range(0, m):
                    states[k] += a[j][k]

        if price < best:
            found = True
            for k in range(0, m):
                if states[k] < x:
                    found = False
                    break

            if found:
                best = price

    print(best)


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

task(n, m, x, c, a)

Buggy python submission (verdict: Runtime Error):
def rec(c, a, x, n, m, start, states, best, price):

    for i in range(start, n):
        price += c[i]
        states[0] += a[i][0]
        states[1] += a[i][1]
        states[2] += a[i][2]

        if states[0] >= x and states[1] >= x and states[2] >= x and price < best:
            best = price

        if i != n - 1:
            best = rec(c, a, x, n, m, i + 1, states, best, price)

        states[0] -= a[i][0]
        states[1] -= a[i][1]
        states[2] -= a[i][2]
        price -= c[i]

    return best


def task(n, m, x, c, a):
    suma = [0] * n
    for i in range(0, n):
        for j in range(0, m):
            suma[j] += a[i][j]

    for j in range(0, m):
        if suma[j] < x:
            print(-1)
            return

    best = rec(c, a, x, n, m, 0, [0, 0, 0], 1000000, 0)

    print(best)


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

task(n, m, x, c, a)


Fixed submission:
def task(n, m, x, c, a):
    mx = [0] * m
    for i in range(0, n):
        for j in range(0, m):
            mx[j] += a[i][j]

    for j in range(0, m):
        if mx[j] < x:
            print(-1)
            return

    states = [0] * m

    best = 100000000
    for i in range(1, 2**n):
        price = 0

        for k in range(0, m):
            states[k] = 0

        for j in range(0, n):
            if ((i >> j) & 1):
                price += c[j]
                for k in range(0, m):
                    states[k] += a[j][k]

        if price < best:
            found = True
            for k in range(0, m):
                if states[k] < x:
                    found = False
                    break

            if found:
                best = price

    print(best)


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

task(n, m, x, c, a)