




'''simple docstring'''



from random import randint, random







def       _UpperCamelCase			(_lowerCamelCase				:  int ,						_lowerCamelCase				:  int ,						_lowerCamelCase				:  int ,						_lowerCamelCase				:  bool = False ,						_lowerCamelCase				:  bool = False ,						_lowerCamelCase				:  int = 5 ,						)-> list:




     '''simple docstring'''





     __snake_case            =	[[-1] * number_of_cells]  # Create a highway without any car
     __snake_case            =	0
     __snake_case            =	max(_lowerCamelCase ,						0						)
     while i < number_of_cells:
          __snake_case            =	(
              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       _UpperCamelCase			(_lowerCamelCase				:  list ,						_lowerCamelCase				:  int						)-> int:




     '''simple docstring'''





     __snake_case            =	0
     __snake_case            =	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       _UpperCamelCase			(_lowerCamelCase				:  list ,						_lowerCamelCase				:  float ,						_lowerCamelCase				:  int						)-> list:




     '''simple docstring'''





     __snake_case            =	len(_lowerCamelCase						)
     # Beforce calculations, the highway is empty
     __snake_case            =	[-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
               __snake_case            =	min(highway_now[car_index] + 1 ,						_lowerCamelCase						)
               # Number of empty cell before the next car
               __snake_case            =	get_distance(_lowerCamelCase ,						_lowerCamelCase						) - 1
               # We can't have the car causing an accident
               __snake_case            =	min(next_highway[car_index] ,						_lowerCamelCase						)
               if random() < probability:
                    # Randomly, a driver will slow down
                    __snake_case            =	max(next_highway[car_index] - 1 ,						0						)
     return next_highway







def       _UpperCamelCase			(_lowerCamelCase				:  list ,						_lowerCamelCase				:  int ,						_lowerCamelCase				:  float ,						_lowerCamelCase				:  int						)-> list:




     '''simple docstring'''





     __snake_case            =	len(highway[0]						)

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

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

     return highway


if __name__ == "__main__":
     import doctest

     doctest.testmod()












'''simple docstring'''



def       _UpperCamelCase			(_lowerCamelCase				:  int						)-> int:




     '''simple docstring'''





     if divisor % 5 == 0 or divisor % 2 == 0:
          return 0
     __snake_case            =	1
     __snake_case            =	1
     while repunit:
          __snake_case            =	(10 * repunit + 1) % divisor
          repunit_index += 1
     return repunit_index







def       _UpperCamelCase			(_lowerCamelCase				:  int = 1_00_00_00						)-> int:




     '''simple docstring'''





     __snake_case            =	limit - 1
     if divisor % 2 == 0:
          divisor += 1
     while least_divisible_repunit(_lowerCamelCase						) <= limit:
          divisor += 2
     return divisor


if __name__ == "__main__":
     print(F"""{solution() = }""")






