import numpy as np



N, M, X = list(map(int, input().split()))

array = np.array([list(map(int, input().split())) for _ in range(N)])



min_C = np.inf

conbi = None

m = 2**N



for i in range(m):

  tmp = []

  for _ in range(N):

    tmp.append(i%2)

    i //= 2

  

  sum_array = np.sum(array[np.where(tmp)], axis=0)

  #print(tmp)

  if np.all(sum_array[1:]>=X):

    if sum_array[0] < min_C:

      min_C = sum_array[0]

      conbi = tmp

      

if conbi is None:

  print((-1))

else:

  print(min_C)
N, M, X = list(map(int, input().split()))

c_a_list = [list(map(int, input().split())) for _ in range(N)]



min_money = 1e10

for i in range(2**N):

    buy_list = [0] * N

    skill = [0] * M

    money = 0

    

    for j in range(N):

        if i % 2 == 0:

            buy_list[j] = 1

        i //= 2

    for buy_idx, ca in enumerate(c_a_list):

        if buy_list[buy_idx] == 1:

            for a_idx, a in enumerate(ca[1:]):

                skill[a_idx] += a

            money += ca[0]

    for s_idx, s in enumerate(skill):

        if s < X:

            break

        if s_idx == M-1:

            min_money = min(min_money, money)

if min_money == 1e10:

    print((-1))

else:

    print(min_money)
import numpy as np

N, M, X = list(map(int, input().split()))
array = np.array([list(map(int, input().split())) for _ in range(N)])
min_C = np.inf
conbi = None
m = 2**N
for i in range(m):
    tmp = []
    for _ in range(N):
        tmp.append(i % 2)
        i //= 2
    sum_array = np.sum(array[np.where(tmp)], axis=0)
    # print(tmp)
    if np.all(sum_array[1:] >= X):
        if sum_array[0] < min_C:
            min_C = sum_array[0]
            conbi = tmp
if conbi is None:
    print((-1))
else:
    print(min_C)

N, M, X = list(map(int, input().split()))
c_a_list = [list(map(int, input().split())) for _ in range(N)]
min_money = 1e10
for i in range(2**N):
    buy_list = [0] * N
    skill = [0] * M
    money = 0
    for j in range(N):
        if i % 2 == 0:
            buy_list[j] = 1
        i //= 2
    for buy_idx, ca in enumerate(c_a_list):
        if buy_list[buy_idx] == 1:
            for a_idx, a in enumerate(ca[1:]):
                skill[a_idx] += a
            money += ca[0]
    for s_idx, s in enumerate(skill):
        if s < X:
            break
        if s_idx == M - 1:
            min_money = min(min_money, money)
if min_money == 1e10:
    print((-1))
else:
    print(min_money)

-import numpy as np - -array = np.array([list(map(int, input().split())) for _ in range(N)]) -min_C = np.inf -conbi = None -m = 2**N -for i in range(m): -    tmp = [] -    for _ in range(N): -        tmp.append(i % 2) +c_a_list = [list(map(int, input().split())) for _ in range(N)] +min_money = 1e10 +for i in range(2**N): +    buy_list = [0] * N +    skill = [0] * M +    money = 0 +    for j in range(N): +        if i % 2 == 0: +            buy_list[j] = 1 -    sum_array = np.sum(array[np.where(tmp)], axis=0) -    # print(tmp) -    if np.all(sum_array[1:] >= X): -        if sum_array[0] < min_C: -            min_C = sum_array[0] -            conbi = tmp -if conbi is None: +    for buy_idx, ca in enumerate(c_a_list): +        if buy_list[buy_idx] == 1: +            for a_idx, a in enumerate(ca[1:]): +                skill[a_idx] += a +            money += ca[0] +    for s_idx, s in enumerate(skill): +        if s < X: +            break +        if s_idx == M - 1: +            min_money = min(min_money, money) +if min_money == 1e10: -    print(min_C) +    print(min_money)