
'''simple docstring'''





a__		:   Union[str, Any]            =       float("inf")


class  UpperCamelCase__  :






 def __init__(			self  :Any	,				_A  :List[Any]			)				->			Optional[Any]:







       '''simple docstring'''



       __A       	=			[0] * n
       __A       	=			[0] * n
       __A       	=			[0] * n
       __A       	=			[[] for _ in range(_A			)]






 def 	lowercase_						(			self  :Dict	,				_A  :List[str]	,				_A  :str	,				_A  :Optional[int]	,				_A  :List[str]=0			)				->			str:







       '''simple docstring'''



       self.adj[a].append([b, len(self.adj[b]			), c, 0]			)
       self.adj[b].append([a, len(self.adj[a]			) - 1, rcap, 0]			)






 def 	lowercase_						(			self  :List[Any]	,				_A  :List[Any]	,				_A  :Optional[int]	,				_A  :str			)				->			List[Any]:







       '''simple docstring'''



       if vertex == sink or not flow:
             return flow

       for i in range(self.ptr[vertex]	,				len(self.adj[vertex]			)			):
             __A       	=			self.adj[vertex][i]
             if self.lvl[e[0]] == self.lvl[vertex] + 1:
                   __A       	=			self.depth_first_search(e[0]	,				_A	,				min(_A	,				e[2] - e[3]			)			)
                   if p:
                         self.adj[vertex][i][3] += p
                         self.adj[e[0]][e[1]][3] -= p
                         return p
             __A       	=			self.ptr[vertex] + 1
       return 0






 def 	lowercase_						(			self  :Any	,				_A  :List[Any]	,				_A  :List[Any]			)				->			List[str]:







       '''simple docstring'''



       __A	,      __A       	=			0, source
       for l in range(31			):  # noqa: E741  l = 30 maybe faster for random data
             while True:
                   __A	,      __A       	=			[0] * len(self.q			), [0] * len(self.q			)
                   __A	,      __A	,      __A       	=			0, 1, 1
                   while qi < qe and not self.lvl[sink]:
                         __A       	=			self.q[qi]
                         qi += 1
                         for e in self.adj[v]:
                               if not self.lvl[e[0]] and (e[2] - e[3]) >> (30 - l):
                                     __A       	=			e[0]
                                     qe += 1
                                     __A       	=			self.lvl[v] + 1

                   __A       	=			self.depth_first_search(_A	,				_A	,				_A			)
                   while p:
                         flow += p
                         __A       	=			self.depth_first_search(_A	,				_A	,				_A			)

                   if not self.lvl[sink]:
                         break

       return flow
a__		:   Any            =       Dinic(1_0)
a__		:   Dict            =       0
a__		:   int            =       9
for vertex in range(1, 5):
 graph.add_edge(source, vertex, 1)
for vertex in range(5, 9):
 graph.add_edge(vertex, sink, 1)
for vertex in range(1, 5):
 graph.add_edge(vertex, vertex + 4, 1)

# Now we can know that is the maximum flow(source -> sink)
print(graph.max_flow(source, sink))








'''simple docstring'''





from .hash_table import HashTable
from .number_theory.prime_numbers import is_prime, next_prime


class  UpperCamelCase__  (    SCREAMING_SNAKE_CASE):






 def __init__(			self  :Union[str, Any]	,				*_A  :int	,				**_A  :Optional[Any]			)				->			Union[str, Any]:







       '''simple docstring'''



       super().__init__(*_A	,				**_A			)






 def 	lowercase_						(			self  :Dict	,				_A  :Union[str, Any]	,				_A  :Dict			)				->			Dict:







       '''simple docstring'''



       __A       	=			(
           next_prime(value % self.size_table			)
           if not is_prime(value % self.size_table			)
           else value % self.size_table
       )  # gt = bigger than
       return next_prime_gt - (data % next_prime_gt)






 def 	lowercase_						(			self  :List[Any]	,				_A  :int	,				_A  :Tuple	,				_A  :Union[str, Any]			)				->			List[Any]:







       '''simple docstring'''



       return (increment * self.__hash_function_a(_A	,				_A			)) % self.size_table






 def 	lowercase_						(			self  :List[Any]	,				_A  :List[str]	,				_A  :str=None			)				->			List[Any]:







       '''simple docstring'''



       __A       	=			1
       __A       	=			self.hash_function(_A			)

       while self.values[new_key] is not None and self.values[new_key] != key:
             __A       	=			(
                 self.__hash_double_function(_A	,				_A	,				_A			)
                 if self.balanced_factor() >= self.lim_charge
                 else None
             )
             if new_key is None:
                   break
             else:
                   i += 1

       return new_key






