





"""simple docstring"""

from __future__ import annotations

import os
from collections.abc import Mapping

UpperCamelCase     :    Dict       =			tuple[int, int]

class __lowerCAmelCase		:





     def __init__(     self     ,					__UpperCAmelCase     ,					__UpperCAmelCase				):

      '''simple docstring'''




      __UpperCamelCase      =	vertices
      __UpperCamelCase      =	{
          (min(__UpperCAmelCase				), max(__UpperCAmelCase				)): weight for edge, weight in edges.items()
      }





     def 						UpperCAmelCase (     self     ,					__UpperCAmelCase     ,					__UpperCAmelCase				):

      '''simple docstring'''




      self.vertices.add(edge[0]				)
      self.vertices.add(edge[1]				)
      __UpperCamelCase      =	weight







     def 						UpperCAmelCase (     self				):

      '''simple docstring'''




      __UpperCamelCase      =	Graph({min(self.vertices				)}     ,					{}				)
      __UpperCamelCase      =	42
      __UpperCamelCase      =	42
      __UpperCamelCase      =	42
      __UpperCamelCase      =	42

      while len(subgraph.vertices				) < len(self.vertices				):
       __UpperCamelCase      =	max(self.edges.values()				) + 1
       for edge, weight in self.edges.items():
        if (edge[0] in subgraph.vertices) ^ (edge[1] in subgraph.vertices):
         if weight < min_weight:
          __UpperCamelCase      =	edge
          __UpperCamelCase      =	weight

       subgraph.add_edge(__UpperCAmelCase     ,					__UpperCAmelCase				)

      return subgraph






def 							A						(    snake_case				:str = "p107_network.txt"		)				->     int:
 __UpperCamelCase      =	os.path.abspath(os.path.dirname(snake_case		)		)
 __UpperCamelCase      =	os.path.join(snake_case    , snake_case		)
 __UpperCamelCase      =	{}
 __UpperCamelCase      =	4_2
 __UpperCamelCase      =	4_2
 __UpperCamelCase      =	4_2

 with open(snake_case		) as f:
  __UpperCamelCase      =	f.read().strip().split('\n'		)

 __UpperCamelCase      =	[line.split(','		) for line in data]

 for edgea in range(1    , len(snake_case		)		):
  for edgea in range(snake_case		):
   if adjaceny_matrix[edgea][edgea] != "-":
    __UpperCamelCase      =	int(adjaceny_matrix[edgea][edgea]		)

 __UpperCamelCase      =	Graph(set(range(len(snake_case		)		)		)    , snake_case		)

 __UpperCamelCase      =	graph.prims_algorithm()

 __UpperCamelCase      =	sum(graph.edges.values()		)
 __UpperCamelCase      =	sum(subgraph.edges.values()		)

 return initial_total - optimal_total


if __name__ == "__main__":
      print(f'''{solution() = }''')





"""simple docstring"""

def 							A						(    snake_case				:int		)				->     int:
 __UpperCamelCase      =	abs(snake_case		)
 __UpperCamelCase      =	0
 while n > 0:
  res += n % 1_0
  n //= 1_0
 return res






def 							A						(    snake_case				:int		)				->     int:
 __UpperCamelCase      =	abs(snake_case		)
 return n if n < 1_0 else n % 1_0 + sum_of_digits(n // 1_0		)






def 							A						(    snake_case				:int		)				->     int:
 return sum(int(snake_case		) for c in str(abs(snake_case		)		)		)






def 							A						(    )				->     None:
 from collections.abc import Callable
 from timeit import timeit

 def benchmark_a_function(snake_case				:Callable    , snake_case				:int		) -> None:
  __UpperCamelCase      =	f'{func.__name__}({value})'
  __UpperCamelCase      =	timeit(f'__main__.{call}'    , setup='import __main__'		)
  print(f'{call:56} = {func(snake_case		)} -- {timing:.4f} seconds'		)

 for value in (2_6_2_1_4_4, 1_1_2_5_8_9_9_9_0_6_8_4_2_6_2_4, 1_2_6_7_6_5_0_6_0_0_2_2_8_2_2_9_4_0_1_4_9_6_7_0_3_2_0_5_3_7_6):
  for func in (sum_of_digits, sum_of_digits_recursion, sum_of_digits_compact):
   benchmark_a_function(snake_case    , snake_case		)
  print()


if __name__ == "__main__":
      import doctest

      doctest.testmod()
      benchmark()



