





import webbrowser
from sys import argv
from urllib.parse import parse_qs, quote

import requests
from bsa import BeautifulSoup
from fake_useragent import UserAgent

if __name__ == "__main__":
     __A             =       "%20".join(argv[1:]) if len(argv) > 1 else quote(str(input("Search: ")))

     print("Googling.....")

     __A             =       f'https://www.google.com/search?q={query}&num=100'

     __A             =       requests.get(
         url,
         headers={"User-Agent": str(UserAgent().random)},
     )

     try:
          __A             =       (
              BeautifulSoup(res.text, "html.parser")
              .find("div", attrs={"class": "yuRUbf"})
              .find("a")
              .get("href")
          )

     except AttributeError:
          __A             =       parse_qs(
              BeautifulSoup(res.text, "html.parser")
              .find("div", attrs={"class": "kCrYT"})
              .find("a")
              .get("href")
          )["url"][0]

     webbrowser.open(link)








from bisect import bisect
from itertools import accumulate





def   lowerCAmelCase_				( __a			,					__a			,					__a			,					__a	)  ->	List[Any]:







  """simple docstring"""





  lowerCamelCase__:   str    						=sorted(zip(__a			,					__a	)			,					key=lambda __a	: x[0] / x[1]			,					reverse=__a	)
  lowerCamelCase__						,      lowerCamelCase__:   str    						=[i[0] for i in r], [i[1] for i in r]
  lowerCamelCase__:   Tuple    						=list(accumulate(__a	)	)
  lowerCamelCase__:   Any    						=bisect(__a			,					__a	)
  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()

