



def 	snake_case__       (					)		->		list[list[int]]:







						"""simple docstring"""

						return [list(range(1_0_0_0 - i							,     -1_0_0_0 - i							,     -1       )       ) for i in range(1_0_0_0       )]


snake_case    :						Any  =						generate_large_matrix()
snake_case    :						Optional[int]  =						(
    [[4, 3, 2, -1], [3, 2, 1, -1], [1, 1, -1, -2], [-1, -1, -2, -3]],
    [[3, 2], [1, 0]],
    [[7, 7, 6]],
    [[7, 7, 6], [-1, -2, -3]],
    grid,
)
def 	snake_case__       (					__lowercase       )		->		None:







						"""simple docstring"""

						assert all(row == sorted(_lowercase							,     reverse=_lowercase       ) for row in grid       )
						assert all(list(_lowercase       ) == sorted(_lowercase							,     reverse=_lowercase       ) for col in zip(*_lowercase       )       )
def 	snake_case__       (					__lowercase       )		->		int:







						"""simple docstring"""

						A__	:							Optional[Any]						    = 0
						A__	:							List[Any]						    = len(_lowercase       ) - 1

						# Edge cases such as no values or all numbers are negative.
						if not array or array[0] < 0:
												return 0

						while right + 1 > left:
												A__	:							int						    = (left + right) // 2
												A__	:							Dict						    = array[mid]

												# Num must be negative and the index must be greater than or equal to 0.
												if num < 0 and array[mid - 1] >= 0:
																		return mid

												if num >= 0:
																		A__	:							Union[str, Any]						    = mid + 1
												else:
																		A__	:							Dict						    = mid - 1
    # No negative numbers so return the last index of the array + 1 which is the length.
						return len(_lowercase       )
def 	snake_case__       (					__lowercase       )		->		int:







						"""simple docstring"""

						A__	:							Optional[int]						    = 0
						A__	:							Tuple						    = len(grid[0]       )

						for i in range(len(_lowercase       )       ):
												A__	:							Union[str, Any]						    = find_negative_index(grid[i][:bound]       )
												total += bound
						return (len(_lowercase       ) * len(grid[0]       )) - total
def 	snake_case__       (					__lowercase       )		->		int:







						"""simple docstring"""

						return len([number for row in grid for number in row if number < 0]       )
def 	snake_case__       (					__lowercase       )		->		int:







						"""simple docstring"""

						A__	:							str						    = 0
						for row in grid:
												for i, number in enumerate(_lowercase       ):
																		if number < 0:
																								total += len(_lowercase       ) - i
																								break
						return total
def 	snake_case__       (					)		->		None:







						"""simple docstring"""

						from timeit import timeit

						print("Running benchmarks"       )
						A__	:							Union[str, Any]						    = (
						    "from __main__ import count_negatives_binary_search, "
						    "count_negatives_brute_force, count_negatives_brute_force_with_break, grid"
						)
						for func in (
						    "count_negatives_binary_search",  # took 0.7727 seconds
						    "count_negatives_brute_force_with_break",  # took 4.6505 seconds
						    "count_negatives_brute_force",  # took 12.8160 seconds
						):
												A__	:							Optional[Any]						    = timeit(F'{func}(grid=grid)'							,     setup=_lowercase							,     number=5_0_0       )
												print(F'{func}() took {time:0.4f} seconds'       )


if __name__ == "__main__":
		import doctest

		doctest.testmod()
		benchmark()







import requests

snake_case    :						int  =						''  # <-- Put your OpenWeatherMap appid here!
snake_case    :						int  =						'https://api.openweathermap.org/data/2.5/'
def 	snake_case__       (					__lowercase = "Chicago"							,     __lowercase = APPID       )		->		dict:







						"""simple docstring"""

						return requests.get(URL_BASE + "weather"							,     params=locals()       ).json()
def 	snake_case__       (					__lowercase = "Kolkata, India"							,     __lowercase = APPID       )		->		dict:







						"""simple docstring"""

						return requests.get(URL_BASE + "forecast"							,     params=locals()       ).json()
def 	snake_case__       (					__lowercase = 55.68							,     __lowercase = 12.57							,     __lowercase = APPID       )		->		dict:







						"""simple docstring"""

						return requests.get(URL_BASE + "onecall"							,     params=locals()       ).json()


if __name__ == "__main__":
		from pprint import pprint

		while True:
				snake_case    :						int  =						input('Enter a location:').strip()
				if location:
						pprint(current_weather(location))
				else:
						break