def METHOD_NAME(A: dace.int32[10, 10, 10], B: dace.int32[10], W: dace.bool_[10, 10, 10], ind: dace.int32[10]):
    count = 0
    B[:] = 0
    for i, j, k in dace.map[0:10, 0:10, 0:10]:
        if W[i, j, k]:
            count += 1
            B[ind[i]] += A[i, j, k]
    return count