

from bisect import bisect
from itertools import accumulate

def 						UpperCamelCase (lowercase_:			Dict   ,				lowercase_:			Tuple   ,				lowercase_:			List[Any]   ,				lowercase_:			Union[str, Any] )					->				List[Any]:
	A__							:   List[Any]					       =		sorted(zip(lowercase_   ,				lowercase_ )   ,				key=lambda lowercase_ : x[0] / x[1]   ,				reverse=lowercase_ )
	A__							:   str					       =		[i[0] for i in r], [i[1] for i in r]
	A__							:   Tuple					       =		list(accumulate(lowercase_ ) )
	A__							:   Optional[int]					       =		bisect(lowercase_   ,				lowercase_ )
	return (
	    0
	    if k == 0
	    else sum(vl[:k] ) + (w - acc[k - 1]) * (vl[k]) / (wt[k])
	    if k != n
	    else sum(vl[:k] )
	)


if __name__ == "__main__":
	import doctest

	doctest.testmod()






import requests

A_	:			List[Any]  	=      'YOUR API KEY'

def 						UpperCamelCase (lowercase_:			str   ,				lowercase_:			str = giphy_api_key )					->				list:
	A__							:   Dict					       =		"""+""".join(query.split() )
	A__							:   Optional[int]					       =		f"""https://api.giphy.com/v1/gifs/search?q={formatted_query}&api_key={api_key}"""
	A__							:   Any					       =		requests.get(lowercase_ ).json()["""data"""]
	return [gif["url"] for gif in gifs]


if __name__ == "__main__":
	print('\n'.join(get_gifs('space ship')))



