

from random import randint, random




def 			lowerCAmelCase(      SCREAMING_SNAKE_CASE_			,						SCREAMING_SNAKE_CASE_			,						SCREAMING_SNAKE_CASE_			,						SCREAMING_SNAKE_CASE_ = False			,						SCREAMING_SNAKE_CASE_ = False			,						SCREAMING_SNAKE_CASE_ = 5			,						)->						list:



    """simple docstring"""






    UpperCamelCase_			  =						[[-1] * number_of_cells]  # Create a highway without any car
    UpperCamelCase_			  =						0
    UpperCamelCase_			  =						max(SCREAMING_SNAKE_CASE_			,						0			)
    while i < number_of_cells:
        UpperCamelCase_			  =						(
            randint(0			,						SCREAMING_SNAKE_CASE_			) 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 			lowerCAmelCase(      SCREAMING_SNAKE_CASE_			,						SCREAMING_SNAKE_CASE_			)->						int:



    """simple docstring"""






    UpperCamelCase_			  =						0
    UpperCamelCase_			  =						highway_now[car_index + 1 :]
    for cell in range(len(SCREAMING_SNAKE_CASE_			)			):  # 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(SCREAMING_SNAKE_CASE_			,						-1			)




def 			lowerCAmelCase(      SCREAMING_SNAKE_CASE_			,						SCREAMING_SNAKE_CASE_			,						SCREAMING_SNAKE_CASE_			)->						list:



    """simple docstring"""






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

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




def 			lowerCAmelCase(      SCREAMING_SNAKE_CASE_			,						SCREAMING_SNAKE_CASE_			,						SCREAMING_SNAKE_CASE_			,						SCREAMING_SNAKE_CASE_			)->						list:



    """simple docstring"""






    UpperCamelCase_			  =						len(highway[0]			)

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

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

    return highway


if __name__ == "__main__":
 import doctest

 doctest.testmod()



def 			lowerCAmelCase(      SCREAMING_SNAKE_CASE_			,						SCREAMING_SNAKE_CASE_			,						SCREAMING_SNAKE_CASE_			)->						int:



    """simple docstring"""






    if exponent == 1:
        return base
    if exponent % 2 == 0:
        UpperCamelCase_			  =						_modexpt(SCREAMING_SNAKE_CASE_			,						exponent // 2			,						SCREAMING_SNAKE_CASE_			) % modulo_value
        return (x * x) % modulo_value
    else:
        return (base * _modexpt(SCREAMING_SNAKE_CASE_			,						exponent - 1			,						SCREAMING_SNAKE_CASE_			)) % modulo_value




def 			lowerCAmelCase(      SCREAMING_SNAKE_CASE_ = 1_7_7_7			,						SCREAMING_SNAKE_CASE_ = 1_8_5_5			,						SCREAMING_SNAKE_CASE_ = 8			)->						int:



    """simple docstring"""






    UpperCamelCase_			  =						base
    for _ in range(1			,						SCREAMING_SNAKE_CASE_			):
        UpperCamelCase_			  =						_modexpt(SCREAMING_SNAKE_CASE_			,						SCREAMING_SNAKE_CASE_			,						1_0**digits			)

    return result


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