




from __future__ import annotations

__magic_name__  :  Optional[Any]					=       """Muhammad Umer Farooq"""
__magic_name__  :  Dict					=       """MIT"""
__magic_name__  :  Tuple					=       """1.0.0"""
__magic_name__  :  Optional[Any]					=       """Muhammad Umer Farooq"""
__magic_name__  :  Dict					=       """contact@muhammadumerfarooq.me"""
__magic_name__  :  Optional[int]					=       """Alpha"""

import re
from html.parser import HTMLParser
from urllib import parse

import requests





class     SCREAMING_SNAKE_CASE__		(UpperCAmelCase__			):
     def __init__(						self	:		Tuple       ,						__lowerCamelCase	:		List[Any]						):



       """simple docstring"""
       super().__init__()
       lowerCAmelCase__										=      []
       lowerCAmelCase__										=      domain



     def        A__      (						self	:		Tuple       ,						__lowerCamelCase	:		Optional[Any]       ,						__lowerCamelCase	:		Any						):



       """simple docstring"""
       # Only parse the 'anchor' tag.
       if tag == "a":
         # Check the list of defined attributes.
         for name, value in attrs:
           # If href is defined, and not empty nor # print it.
           if name == "href" and value != "#" and value != "":
             # If not already in urls.
             if value not in self.urls:
               lowerCAmelCase__										=      parse.urljoin(self.domain       ,						lowerCamelCase__						)
               self.urls.append(lowerCamelCase__						)



def 		a_							( __lowerCAmelCase				):
  return ".".join(get_sub_domain_name(__lowerCAmelCase				).split('''.'''				)[-2:]				)
def 		a_							( __lowerCAmelCase				):
  return parse.urlparse(__lowerCAmelCase				).netloc
def 		a_							( __lowerCAmelCase = "https://github.com"				):
  lowerCAmelCase__										=      get_domain_name(__lowerCAmelCase				)

  # Initialize the parser
  lowerCAmelCase__										=      Parser(__lowerCAmelCase				)

  try:
    # Open URL
    lowerCAmelCase__										=      requests.get(__lowerCAmelCase				)

    # pass the raw HTML to the parser to get links
    parser.feed(r.text				)

    # Get links and loop through
    lowerCAmelCase__										=      set()
    for link in parser.urls:
      # open URL.
      # read = requests.get(link)
      try:
        lowerCAmelCase__										=      requests.get(__lowerCAmelCase				)
        # Get the valid email.
        lowerCAmelCase__										=      re.findall('''[a-zA-Z0-9]+@''' + domain   , read.text				)
        # If not in list then append it.
        for email in emails:
          valid_emails.add(__lowerCAmelCase				)
      except ValueError:
        pass
  except ValueError:
    raise SystemExit(1				)

  # Finally return a sorted list of email addresses with no duplicates.
  return sorted(__lowerCAmelCase				)


if __name__ == "__main__":
      __magic_name__  :  int					=       emails_from_url("""https://github.com""")
      print(F"{len(emails)} emails found:")
      print("""\n""".join(sorted(emails)))


from __future__ import annotations
def 		snake_case__	(		lowercase							,				lowercase					):
   print(F'''Vertex\tShortest Distance from vertex {src}'''					)
   for i, d in enumerate(lowercase					):
      print(F'''{i}\t\t{d}'''					)
def 		snake_case__	(		lowercase							,				lowercase							,				lowercase					):
   for j in range(lowercase					):
      lowerCAmelCase_  ,	lowerCAmelCase_  ,	lowerCAmelCase_:							List[str]       =	(graph[j][k] for k in ["src", "dst", "weight"])
      if distance[u] != float("inf"					) and distance[u] + w < distance[v]:
         return True
   return False
def 		snake_case__	(		lowercase							,				lowercase							,				lowercase							,				lowercase					):
   lowerCAmelCase_:							int       =	[float("inf"					)] * vertex_count
   lowerCAmelCase_:							Dict       =	0.0

   for _ in range(vertex_count - 1					):
      for j in range(lowercase					):
         lowerCAmelCase_  ,	lowerCAmelCase_  ,	lowerCAmelCase_:							Any       =	(graph[j][k] for k in ["src", "dst", "weight"])

         if distance[u] != float("inf"					) and distance[u] + w < distance[v]:
            lowerCAmelCase_:							List[str]       =	distance[u] + w

   lowerCAmelCase_:							str       =	check_negative_cycle(lowercase							,				lowercase							,				lowercase					)
   if negative_cycle_exists:
      raise Exception("Negative cycle found"					)

   return distance


if __name__ == "__main__":
 import doctest

 doctest.testmod()

 a  :      List[str]            =    int(input("""Enter number of vertices: """).strip())
 a  :      Any            =    int(input("""Enter number of edges: """).strip())

 a  :      list[dict[str, int]]            =    [{} for _ in range(E)]

 for i in range(E):
  print("""Edge """, i + 1)
  a     , a     , a  :      Optional[int]            =    (
      int(x)
      for x in input("""Enter source, destination, weight: """).strip().split(""" """)
  )
  a  :      Optional[int]            =    {"""src""": src, """dst""": dest, """weight""": weight}

 a  :      List[Any]            =    int(input("""\nEnter shortest path source:""").strip())
 a  :      Tuple            =    bellman_ford(graph, V, E, source)
 print_distance(shortest_distance, 0)