code: def merge_int_intervals(
      intervals_in: List[List[int]],
  ) -> List[List[int]]:
      """
      Interval merging algorithm which has `O(N*logN)` time complexity. (N is number of intervals)
      Merge the range pairs if there is overlap exists between the given ranges.
      This algorithm needs a sorted range list in terms of the start time.
      Note that neighboring numbers lead to a merged range.
  
      Example:
          input: [(1, 10), (11, 20)]
          output: [(1, 20)]
  
      Refer to the original code at https://stackoverflow.com/a/59378428
  
      Args:
          intervals_in (list):
              List containing ranges.
              Example:
                  >>> intervals_in
                  [(102, 103), (104, 109), (107, 120)]
  
      Returns:
          merged_list (list):
              List containing the combined ranges.
              Example:
                  >>> merged_list
                  [(102, 120)]
      """
      num_intervals = len(intervals_in)
      if num_intervals == 0:
          return []
      elif num_intervals == 1:
          return intervals_in
      else:
          merged_list: List[List[int]] = []
          stt2: int = 0
          end2: int = 0
  
          intervals_in = [[int(x[0]), int(x[1])] for x in intervals_in]
          interval_tensor: torch.Tensor = torch.tensor(intervals_in)
          _sorted, _ = torch.sort(interval_tensor, dim=0)
          _sorted_int: List[List[int]] = [
              [int(x[0]), int(x[1])] for x in _sorted.cpu()
          ]
          intervals: List[List[int]] = _sorted_int
  
          start, end = intervals[0][0], intervals[0][1]
          for i in range(1, num_intervals):
              stt2, end2 = intervals[i][0], intervals[i][1]
              if end >= stt2:
                  end = max(end2, end)
              else:
                  start, end = int(start), int(end)
                  merged_list.append([start, end])
                  start = stt2
                  end = max(end2, end)
  
          start, end = int(start), int(end)
          merged_list.append([start, end])
          return merged_list
  
imports: import gc
  import json
  import math
  import os
  import shutil
  from copy import deepcopy
  from typing import Dict, List, Tuple, Union
  import numpy
  import omegaconf
  import soundfile
  import torch
  from pyannote.core import Annotation, Segment
  from tqdm import tqdm
  from nemo.collections.asr.data.audio_to_label import repeat_signal
  from nemo.collections.asr.parts.utils.longform_clustering import LongFormSpeakerClustering
  from nemo.collections.asr.parts.utils.offline_clustering import SpeakerClustering, get_argmin_mat, split_input_data
  from nemo.utils import logging
label_desc: Use image node_id 25 for calling a global function with example usage: merge_int_intervals(intervals_in) and returns: list, intervals_in, merged_list