docs: def reduce(args):
      """
      >>> reduce([(2, 4), (4, 9)])
      [(2, 4), (4, 9)]
  
      >>> reduce([(2, 6), (4, 10)])
      [(2, 10)]
      """
      if len(args) < 2: return args
      args.sort()
      ret = [args[0]]
      for next_i, (s, e) in enumerate(args, start=1):
          if next_i == len(args):
              ret[-1] = ret[-1][0], max(ret[-1][1], e)
              break
  
          ns, ne = args[next_i]
          if e > ns or ret[-1][1] > ns:
              ret[-1] = ret[-1][0], max(e, ne, ret[-1][1])
          else:
              ret.append((ns, ne))
      return ret