Buggy python submission (verdict: Runtime Error):
n,m,x = map(int, input().split())
ca = [list(map(int, input().split())) for _ in range(n)]
anytassei = False

# bit = [0 for _ in range(n)]
mincost = 0
cost = 0
learn = [0 for _ in range(n)]
for i in range(n):
	mincost += ca[i][0]

for cnt in range(2**n):
	cost = 0
	learn = [0 for _ in range(n)]

	# bit膳探索
	for i in range(n):
		# bit[i] = (cnt//2**i)%2
		if (cnt//2**i)%2 == 1:
			cost += ca[i][0]
			for j in range(m):
				learn[j] += ca[i][1+j]
	# print(bit)

	# 理解度達成しているか判定
	tassei = True
	for j in range(m):
		if learn[j] < x: tassei = False

	# 達成している and 最小コスト更新している
	if tassei and cost <= mincost:
		mincost = cost
		anytassei = True

if anytassei: print(mincost)
else: print(-1)


Fixed submission:
n,m,x = map(int, input().split())
ca = [list(map(int, input().split())) for _ in range(n)]
anytassei = False

# bit = [0 for _ in range(n)]
mincost = 0
cost = 0
learn = [0 for _ in range(n)]
for i in range(n):
	mincost += ca[i][0]

for cnt in range(2**n):
	cost = 0
	learn = [0 for _ in range(m)]

	# bit膳探索
	for i in range(n):
		# bit[i] = (cnt//2**i)%2
		if (cnt//2**i)%2 == 1:
			cost += ca[i][0]
			for j in range(m):
				learn[j] += ca[i][1+j]
	# print(bit)

	# 理解度達成しているか判定
	tassei = True
	for j in range(m):
		if learn[j] < x: tassei = False

	# 達成している and 最小コスト更新している
	if tassei and cost <= mincost:
		mincost = cost
		anytassei = True

if anytassei: print(mincost)
else: print(-1)

Buggy python submission (verdict: Runtime Error):
n,m,x = map(int, input().split())
ca = [list(map(int, input().split())) for _ in range(n)]
anytassei = False

# bit = [0 for _ in range(n)]
mincost = 0
cost = 0
learn = [0 for _ in range(n)]
for i in range(n):
	mincost += ca[i][0]

for cnt in range(2**n):
	cost = 0
	learn = [0 for _ in range(n)]

	for i in range(n):
		# bit[i] = (cnt//2**i)%2
		if (cnt//2**i)%2 == 1:
			cost += ca[i][0]
			for j in range(m):
				learn[j] += ca[i][1+j]
	# print(bit)

	tassei = True
	for j in range(m):
		if learn[j] < x: tassei = False
	if tassei and cost <= mincost:
		mincost = cost
		anytassei = True

if anytassei: print(mincost)
else: print(-1)


Fixed submission:
n,m,x = map(int, input().split())
ca = [list(map(int, input().split())) for _ in range(n)]
anytassei = False

# bit = [0 for _ in range(n)]
mincost = 0
cost = 0
learn = [0 for _ in range(n)]
for i in range(n):
	mincost += ca[i][0]

for cnt in range(2**n):
	cost = 0
	learn = [0 for _ in range(m)]

	# bit膳探索
	for i in range(n):
		# bit[i] = (cnt//2**i)%2
		if (cnt//2**i)%2 == 1:
			cost += ca[i][0]
			for j in range(m):
				learn[j] += ca[i][1+j]
	# print(bit)

	# 理解度達成しているか判定
	tassei = True
	for j in range(m):
		if learn[j] < x: tassei = False

	# 達成している and 最小コスト更新している
	if tassei and cost <= mincost:
		mincost = cost
		anytassei = True

if anytassei: print(mincost)
else: print(-1)

Buggy python submission (verdict: Runtime Error):
n,m,x = map(int, input().split())
ca = [list(map(int, input().split())) for _ in range(n)]
anytassei = False

# bit = [0 for _ in range(n)]
mincost = 0
for i in range(n):
	mincost += ca[i][0]

for cnt in range(2**n):
	cost = 0
	learn = [0 for _ in range(n)]

	for i in range(n):
		# bit[i] = (cnt//2**i)%2
		if (cnt//2**i)%2 == 1:
			cost += ca[i][0]
			for j in range(m):
				learn[j] += ca[i][1+j]
	# print(bit)

	tassei = True
	for j in range(m):
		if learn[j] < x: tassei = False
	if tassei and cost <= mincost:
		mincost = cost
		anytassei = True

if anytassei: print(mincost)
else: print(-1)


Fixed submission:
n,m,x = map(int, input().split())
ca = [list(map(int, input().split())) for _ in range(n)]
anytassei = False

# bit = [0 for _ in range(n)]
mincost = 0
cost = 0
learn = [0 for _ in range(n)]
for i in range(n):
	mincost += ca[i][0]

for cnt in range(2**n):
	cost = 0
	learn = [0 for _ in range(m)]

	# bit膳探索
	for i in range(n):
		# bit[i] = (cnt//2**i)%2
		if (cnt//2**i)%2 == 1:
			cost += ca[i][0]
			for j in range(m):
				learn[j] += ca[i][1+j]
	# print(bit)

	# 理解度達成しているか判定
	tassei = True
	for j in range(m):
		if learn[j] < x: tassei = False

	# 達成している and 最小コスト更新している
	if tassei and cost <= mincost:
		mincost = cost
		anytassei = True

if anytassei: print(mincost)
else: print(-1)