code: def bin_exact_kb_dense(M, positions, length=10):
      
  
      unit = 10**3
      ul = unit * length
      units = positions / ul
      n = len(positions)
      idx = [i for i in range(
          n - 1) if np.ceil(units[i]) < np.ceil(units[i + 1])]
      m = len(idx) - 1
      N = np.zeros((m, m))
      remainders = [0] + [np.abs(units[i] - units[i + 1]) for i in range(m)]
      for i in range(m):
          N[i] = np.array([(M[idx[j]:idx[j + 1], idx[i]:idx[i + 1]].sum() -
                           remainders[j] * M[i][j] +
                           remainders[j + 1] * M[i + 1][j])
                           for j in range(m)])
      return N
docs: Perform the kb-binning procedure with total bin lengths being exactly
      set to that of the specified input. Fragments overlapping two potential
      bins will be split and related contact counts will be divided according
      to overlap proportions in each bin.