


"""simple docstring"""
def   _a			( )      ->			list[list[int]]:
							return [list(range(1_000 - i			,	-1_000 - i			,	-1			)			) for i in range(1_000			)]


__SCREAMING_SNAKE_CASE							:      Optional[Any]						=      generate_large_matrix()
__SCREAMING_SNAKE_CASE							:      Optional[Any]						=      (
    [[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   _a			( _SCREAMING_SNAKE_CASE			)      ->			None:
							assert all(row == sorted(_SCREAMING_SNAKE_CASE			,	reverse=_SCREAMING_SNAKE_CASE			) for row in grid			)
							assert all(list(_SCREAMING_SNAKE_CASE			) == sorted(_SCREAMING_SNAKE_CASE			,	reverse=_SCREAMING_SNAKE_CASE			) for col in zip(*_SCREAMING_SNAKE_CASE			)			)







def   _a			( _SCREAMING_SNAKE_CASE			)      ->			int:
							snake_case_          =						0
							snake_case_          =						len(_SCREAMING_SNAKE_CASE			) - 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:
														snake_case_          =						(left + right) // 2
														snake_case_          =						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:
																					snake_case_          =						mid + 1
														else:
																					snake_case_          =						mid - 1
    # No negative numbers so return the last index of the array + 1 which is the length.
							return len(_SCREAMING_SNAKE_CASE			)







def   _a			( _SCREAMING_SNAKE_CASE			)      ->			int:
							snake_case_          =						0
							snake_case_          =						len(grid[0]			)

							for i in range(len(_SCREAMING_SNAKE_CASE			)			):
														snake_case_          =						find_negative_index(grid[i][:bound]			)
														total += bound
							return (len(_SCREAMING_SNAKE_CASE			) * len(grid[0]			)) - total







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







def   _a			( _SCREAMING_SNAKE_CASE			)      ->			int:
							snake_case_          =						0
							for row in grid:
														for i, number in enumerate(_SCREAMING_SNAKE_CASE			):
																					if number < 0:
																												total += len(_SCREAMING_SNAKE_CASE			) - i
																												break
							return total







def   _a			( )      ->			None:
							from timeit import timeit

							print("""Running benchmarks"""			)
							snake_case_          =						(
							    """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
							):
														snake_case_          =						timeit(f"""{func}(grid=grid)"""			,	setup=_SCREAMING_SNAKE_CASE			,	number=500			)
														print(f"""{func}() took {time:0.4f} seconds"""			)


if __name__ == "__main__":
			import doctest

			doctest.testmod()
			benchmark()







"""simple docstring"""
from collections import namedtuple

import requests
from lxml import html  # type: ignore

__SCREAMING_SNAKE_CASE							:      List[str]						=      namedtuple('covid_data', 'cases deaths recovered')







def   _a			( _SCREAMING_SNAKE_CASE = "https://www.worldometers.info/coronavirus/"			)      ->			covid_data:
							snake_case_          =						"""//div[@class = \"maincounter-number\"]/span/text()"""
							return covid_data(*html.fromstring(requests.get(_SCREAMING_SNAKE_CASE			).content			).xpath(_SCREAMING_SNAKE_CASE			)			)


__SCREAMING_SNAKE_CASE							:      List[str]						=      'Total COVID-19 cases in the world: {}\nTotal deaths due to COVID-19 in the world: {}\nTotal COVID-19 patients recovered in the world: {}'





print(fmt.format(*covid_stats()))



