Problem p02683 (python)

Fixed submission:
import numpy as np
n,m,x = map(int, input().split())

acq2 = 0
cost = []
skill = []
for i in range(n):
    ca = list(map(int, input().split()))
    cost.append(ca[0])
    skill.append(np.array(ca[1:]))

costmin = 0
for a in range(n):
    costmin += cost[a]

def tworaw(num):
    if (num % 2 == 0):
        return 0
    else:
        return 1

for j in range(2**n):
    buy = []
    cost_temp = 0
    skill_temp = np.zeros(m)
    acq = 1
    nn = j
    for k in range(n):
        buy.append(tworaw(nn))
        nn = nn // 2

    for l in range(n):
        if (buy[l] == 1):
            cost_temp += cost[l]
            skill_temp += skill[l]
    
    for b in range(m):
        if (skill_temp[b] < x):
            acq = 0
            break
    

    if (acq == 1):
        acq2 = 1
        if (cost_temp < costmin):
            costmin = cost_temp


if (acq2 == 1):
    print(int(costmin))
else:
    print('-1')

Buggy submission (verdict: Runtime Error):
import numpy as np
x,m,n = map(int, input().split())

acq2 = 0
cost = []
skill = []
for i in range(n):
    ca = list(map(int, input().split()))
    cost.append(ca[0])
    skill.append(np.array(ca[1:]))

costmin = 0
for a in range(n):
    costmin += cost[a]

def tworaw(num):
    if (num % 2 == 0):
        return 0
    else:
        return 1

for j in range(2**n):
    buy = []
    cost_temp = 0
    skill_temp = np.zeros(m)
    acq = 1
    nn = j
    for k in range(n):
        buy.append(tworaw(nn))
        nn = nn // 2

    for l in range(n):
        if (buy[l] == 1):
            cost_temp += cost[l]
            skill_temp += skill[l]
    
    for b in range(m):
        if (skill_temp[b] < x):
            acq = 0
            break
    

    if (acq == 1):
        acq2 = 1
        if (cost_temp < costmin):
            costmin = cost_temp


if (acq2 == 1):
    print(int(costmin))
else:
    print('-1')

Buggy submission (verdict: Runtime Error):
import numpy as np
x,m,n = map(int, input().split())

acq2 = 0
cost = []
skill = []
for i in range(n):
    ca = list(map(int, input().split()))
    cost.append(ca[0])
    skill.append(np.array(ca[1:]))

costmin = 0
for a in range(n):
    costmin += cost[a]

def tworaw(num):
    if (num % 2 == 0):
        return 0
    else:
        return 1

for j in range(2**n):
    buy = []
    cost_temp = 0
    skill_temp = np.zeros(m)
    acq = 1
    nn = j
    for k in range(n):
        buy.append(tworaw(nn))
        nn = nn // 2
    print(buy)


    for l in range(n):
        if (buy[l] == 1):
            cost_temp += cost[l]
            skill_temp += skill[l]
    
    for b in range(m):
        if (skill_temp[b] < x):
            acq = 0
            break
    

    if (acq == 1):
        acq2 = 1
        if (cost_temp < costmin):
            costmin = cost_temp


if (acq2 == 1):
    print(int(costmin))
else:
    print('-1')

Buggy submission (verdict: Runtime Error):
import numpy as np
x,m,n = map(int, input().split())

acq2 = 0
cost = []
skill = []
for i in range(n):
    ca = list(map(int, input().split()))
    cost.append(ca[0])
    skill.append(np.array(ca[1:]))

costmin = 0
for a in range(n):
    costmin += cost[b]

def tworaw(num):
    if (num % 2 == 0):
        return 0
    else:
        return 1

for j in range(2**n):
    buy = []
    cost_temp = 0
    skill_temp = np.zeros(m)
    acq = 1
    nn = n
    for k in range(n):
        buy.append(tworaw(nn))
        nn = nn // 2
    for l in range(n):
        if (buy[l] = 1):
            cost_temp += cost[l]
            skill_temp += skill[l]
    
    for b in range(m):
        if (skill[a] < x):
            acq = 0
            break
    
    if (acq == 1):
        acq2 = 1
        if (cost_temp < costmin):
            costmin = cost_temp


if (acq2 == 1):
    print(int(costmin))
else:
    print('-1')