code: def ffd_with_result(a: np.ndarray, c: int, start_index: int):
      # First-fit-decreasing bin packing (with result return)
  
      indices = np.argsort(a)[::-1]
      a = a[indices]
  
      bins: List[Any] = []
      bins_result: List[Any] = []
      for a_id, size in enumerate(a):
          add_new = True
          for idx in range(len(bins)):
              if bins[idx] >= size:
                  bins[idx] -= size
                  bins_result[idx].append(indices[a_id] + start_index)
                  add_new = False
                  break
  
          if add_new:
              bins.append(c - size)
              bins_result.append([indices[a_id] + start_index])
  
      return bins_result
  
file_path: axolotl/src/axolotl/utils/samplers/multipack.py
imports: import logging
  import math
  import os
  from typing import Any, Iterable, List, Union
  import numba
  import numpy
  from torch.utils.data import BatchSampler, Sampler
label_desc: Use image node_id 2 for calling a global function with example usage: ffd_with_result(a, c, start_index) and returns: bins_result