"""simple docstring"""


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__":
 UpperCAmelCase__  		=						"""%20""".join(argv[1:]) if len(argv) > 1 else quote(str(input("""Search: """)))

 print("""Googling.....""")

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

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

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

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

 webbrowser.open(link)

"""simple docstring"""


import unittest

from knapsack import knapsack as k


class        a				(		unittest.TestCase   ):


    def      lowerCAmelCase_  (					self	:  List[Any]					):
      _UpperCAmelCase						 =      0
      _UpperCAmelCase						 =      [0]
      _UpperCAmelCase						 =      [0]
      _UpperCAmelCase						 =      len(__lowerCAmelCase					)
      self.assertEqual(k.knapsack(__lowerCAmelCase   ,				__lowerCAmelCase   ,				__lowerCAmelCase   ,				__lowerCAmelCase					)   ,				0					)

      _UpperCAmelCase						 =      [60]
      _UpperCAmelCase						 =      [10]
      _UpperCAmelCase						 =      len(__lowerCAmelCase					)
      self.assertEqual(k.knapsack(__lowerCAmelCase   ,				__lowerCAmelCase   ,				__lowerCAmelCase   ,				__lowerCAmelCase					)   ,				0					)


    def      lowerCAmelCase_  (					self	:  Optional[int]					):
      _UpperCAmelCase						 =      3
      _UpperCAmelCase						 =      [1, 2, 3]
      _UpperCAmelCase						 =      [3, 2, 1]
      _UpperCAmelCase						 =      len(__lowerCAmelCase					)
      self.assertEqual(k.knapsack(__lowerCAmelCase   ,				__lowerCAmelCase   ,				__lowerCAmelCase   ,				__lowerCAmelCase					)   ,				5					)


    def      lowerCAmelCase_  (					self	:  Optional[Any]					):
      _UpperCAmelCase						 =      50
      _UpperCAmelCase						 =      [60, 100, 120]
      _UpperCAmelCase						 =      [10, 20, 30]
      _UpperCAmelCase						 =      len(__lowerCAmelCase					)
      self.assertEqual(k.knapsack(__lowerCAmelCase   ,				__lowerCAmelCase   ,				__lowerCAmelCase   ,				__lowerCAmelCase					)   ,				220					)


if __name__ == "__main__":
    unittest.main()
