


"""simple docstring"""






from random import randint, random
def       A_   (   _lowerCAmelCase     :					int,     _lowerCAmelCase     :					int,     _lowerCAmelCase     :					int,     _lowerCAmelCase     :					bool = False,     _lowerCAmelCase     :					bool = False,     _lowerCAmelCase     :					int = 5,     ):






     """simple docstring"""

     _a    	=				[[-1] * number_of_cells]  # Create a highway without any car
     _a    	=				0
     _a    	=				max(_lowerCAmelCase,     0       )
     while i < number_of_cells:
          _a    	=				(
              randint(0,     _lowerCAmelCase       ) if random_speed else initial_speed
          )  # Place the cars
          i += (
              randint(1,     max_speed * 2       ) if random_frequency else frequency
          )  # Arbitrary number, may need tuning
     return highway
def       A_   (   _lowerCAmelCase     :					list,     _lowerCAmelCase     :					int       ):






     """simple docstring"""

     _a    	=				0
     _a    	=				highway_now[car_index + 1 :]
     for cell in range(len(_lowerCAmelCase       )       ):  # May need a better name for this
          if cells[cell] != -1:  # If the cell is not empty then
               return distance  # we have the distance we wanted
          distance += 1
     # Here if the car is near the end of the highway
     return distance + get_distance(_lowerCAmelCase,     -1       )
def       A_   (   _lowerCAmelCase     :					list,     _lowerCAmelCase     :					float,     _lowerCAmelCase     :					int       ):






     """simple docstring"""

     _a    	=				len(_lowerCAmelCase       )
     # Beforce calculations, the highway is empty
     _a    	=				[-1] * number_of_cells

     for car_index in range(_lowerCAmelCase       ):
          if highway_now[car_index] != -1:
               # Add 1 to the current speed of the car and cap the speed
               _a    	=				min(highway_now[car_index] + 1,     _lowerCAmelCase       )
               # Number of empty cell before the next car
               _a    	=				get_distance(_lowerCAmelCase,     _lowerCAmelCase       ) - 1
               # We can't have the car causing an accident
               _a    	=				min(next_highway[car_index],     _lowerCAmelCase       )
               if random() < probability:
                    # Randomly, a driver will slow down
                    _a    	=				max(next_highway[car_index] - 1,     0       )
     return next_highway
def       A_   (   _lowerCAmelCase     :					list,     _lowerCAmelCase     :					int,     _lowerCAmelCase     :					float,     _lowerCAmelCase     :					int       ):






     """simple docstring"""

     _a    	=				len(highway[0]       )

     for i in range(_lowerCAmelCase       ):
          _a    	=				update(highway[i],     _lowerCAmelCase,     _lowerCAmelCase       )
          _a    	=				[-1] * number_of_cells

          for car_index in range(_lowerCAmelCase       ):
               _a    	=				next_speeds_calculated[car_index]
               if speed != -1:
                    # Change the position based on the speed (with % to create the loop)
                    _a    	=				(car_index + speed) % number_of_cells
                    # Commit the change of position
                    _a    	=				speed
          highway.append(_lowerCAmelCase       )

     return highway


if __name__ == "__main__":
   import doctest

   doctest.testmod()



"""simple docstring"""






from typing import Any
def       A_   (   _lowerCAmelCase     :					list       ):






     """simple docstring"""

     if not input_list:
          return []
     _a    	=				[input_list.count(_lowerCAmelCase       ) for value in input_list]
     _a    	=				max(_lowerCAmelCase       )  # Gets the maximum count in the input list.
     # Gets values of modes
     return sorted({input_list[i] for i, value in enumerate(_lowerCAmelCase       ) if value == y}       )


if __name__ == "__main__":
   import doctest

   doctest.testmod()