input: Write a Python function that identifies indices in a string `s` where the substring `a` starts, given certain conditions involving another substring `b` and a distance `k`. The function should ensure the found indices are in ascending order.
  
  from bisect import bisect_left
  from typing import List
  
  def find_beautiful_indices(s: str, a: str, b: str, k: int) -> List[int]:
      """
      Given a 0-indexed string `s`, a substring `a`, a substring `b`, and an integer `k`.
  
      An index `i` is considered beautiful if:
  
      0 <= i <= s.length - a.length
      s[i..(i + a.length - 1)] equals a
      There exists an index `j` such that:
      0 <= j <= s.length - b.length
      s[j..(j + b.length - 1)] equals b
      |j - i| <= distance `k`
      The function returns a sorted list of such indices.
  
      Examples:
      >>> s = "isawsquirrelnearmysquirrelhouseohmy", a = "my", b = "squirrel", k = 15
      [16,33]
      >>> s = "abcd", a = "a", b = "a", k = 4
      [0]
  
      Constraints:
      1 <= k <= s.length <= 10^5
      1 <= a.length, b.length <= 10
      s, a, and b will only contain lowercase English letters.
      """
output: def find_beautiful_indices(s: str, a: str, b: str, k: int) -> List[int]:
      len_s, len_a, len_b = len(s), len(a), len(b)
      
      a_indices = [i for i in range(len_s - len_a + 1) if s[i:i + len_a] == a]
      b_indices = [i for i in range(len_s - len_b + 1) if s[i:i + len_b] == b]
      
      beautiful_indices = []
      for i in a_indices:
          pos = bisect_left(b_indices, i - k)
          if pos < len(b_indices) and abs(b_indices[pos] - i) <= k:
              beautiful_indices.append(i)
      
      return beautiful_indices