"""simple docstring"""







def     __UpperCAmelCase							(       UpperCAmelCase_       :							list[int]    )				->     tuple[int, int]:

	'''simple docstring'''





	if len(UpperCAmelCase__    ) == 1:
		return a[0], a[0]
	else:
		# split A into half.
		__snake_case     :				Tuple 						=					a[: len(UpperCAmelCase__    ) // 2]
		__snake_case     :				Any 						=					a[len(UpperCAmelCase__    ) // 2 :]

		# 2 sub problems, 1/2 of original size.
		__snake_case						,							__snake_case     :				Optional[int] 						=					max_difference(UpperCAmelCase__    )
		__snake_case						,							__snake_case     :				int 						=					max_difference(UpperCAmelCase__    )

		# get min of first and max of second
		# linear time
		__snake_case     :				Optional[int] 						=					min(UpperCAmelCase__    )
		__snake_case     :				int 						=					max(UpperCAmelCase__    )

		# 3 cases, either (small1, big1),
		# (min_first, max_second), (small2, big2)
		# constant comparisons
		if biga - smalla > max_second - min_first and biga - smalla > biga - smalla:
			return smalla, biga
		elif biga - smalla > max_second - min_first:
			return smalla, biga
		else:
			return min_first, max_second


if __name__ == "__main__":
	import doctest

	doctest.testmod()






"""simple docstring"""







import shutil

import requests


def 	a__   (		UpperCAmelCase__							:      str		,      UpperCAmelCase__							:      bool = False		,      UpperCAmelCase__							:      str = "."      )->						dict:
						UpperCAmelCase__       						=		"""https://api.nasa.gov/planetary/apod"""
						return requests.get(UpperCAmelCase__		,      params={"""api_key""": api_key}      ).json()


def 	a__   (		UpperCAmelCase__							:      str		,      UpperCAmelCase__							:      str = "."      )->						dict:
						UpperCAmelCase__       						=		get_apod_data(UpperCAmelCase__      )
						UpperCAmelCase__       						=		apod_data["""url"""]
						UpperCAmelCase__       						=		img_url.split("""/"""      )[-1]
						UpperCAmelCase__       						=		requests.get(UpperCAmelCase__		,      stream=UpperCAmelCase__      )

						with open(f'{path}/{img_name}'		,      """wb+"""      ) as img_file:
												shutil.copyfileobj(response.raw		,      UpperCAmelCase__      )
						del response
						return apod_data


def 	a__   (		UpperCAmelCase__							:      str      )->						dict:
						UpperCAmelCase__       						=		"""https://images-api.nasa.gov/search"""
						return requests.get(UpperCAmelCase__		,      params={"""q""": query}      ).json()


if __name__ == "__main__":
						print(save_apod("""YOUR API KEY"""))
						UpperCamelCase_							:							Optional[Any]				 =		get_archive_data("""apollo 2011""")["""collection"""]["""items"""]
						print(apollo_aaaa_items[0]["""data"""][0]["""description"""])

