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


class   __lowerCAmelCase		:



      """simple docstring"""







      def __init__( self						:    List[Any]			,    _snake_case						:    Optional[Any]			):
          __lowercase						:     Optional[Any]		      =    [0] * n
          __lowercase						:     Union[str, Any]		      =    [0] * n
          __lowercase						:     Dict		      =    [0] * n
          __lowercase						:     Any		      =    [[] for _ in range(_snake_case			)]




      def 						snake_case_     ( self						:    str			,    _snake_case						:    Tuple			,    _snake_case						:    Optional[int]			,    _snake_case						:    List[str]			,    _snake_case						:    Tuple=0			):
          self.adj[a].append([b, len(self.adj[b]			), c, 0]			)
          self.adj[b].append([a, len(self.adj[a]			) - 1, rcap, 0]			)




      def 						snake_case_     ( self						:    Any			,    _snake_case						:    List[Any]			,    _snake_case						:    str			,    _snake_case						:    Tuple			):
          if vertex == sink or not flow:
              return flow

          for i in range(self.ptr[vertex]			,    len(self.adj[vertex]			)			):
              __lowercase						:     Union[str, Any]		      =    self.adj[vertex][i]
              if self.lvl[e[0]] == self.lvl[vertex] + 1:
                  __lowercase						:     Optional[int]		      =    self.depth_first_search(e[0]			,    _snake_case			,    min(_snake_case			,    e[2] - e[3]			)			)
                  if p:
                      self.adj[vertex][i][3] += p
                      self.adj[e[0]][e[1]][3] -= p
                      return p
              __lowercase						:     List[str]		      =    self.ptr[vertex] + 1
          return 0




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

                  __lowercase						:     Union[str, Any]		      =    self.depth_first_search(_snake_case			,    _snake_case			,    _snake_case			)
                  while p:
                      flow += p
                      __lowercase						:     List[str]		      =    self.depth_first_search(_snake_case			,    _snake_case			,    _snake_case			)

                  if not self.lvl[sink]:
                      break

          return flow
__lowerCAmelCase   :     List[Any]      =						Dinic(10)
__lowerCAmelCase   :     Any      =						0
__lowerCAmelCase   :     List[str]      =						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))




import importlib.metadata
import sys

from transformers.testing_utils import TestCasePlus
from transformers.utils.versions import require_version, require_version_core


__lowerCAmelCase   :     Optional[Any]      =						importlib.metadata.version("numpy")
__lowerCAmelCase   :     Any      =						".".join([str(x) for x in sys.version_info[:3]])


class   __lowerCAmelCase		(		lowerCAmelCase_ ):



      """simple docstring"""







      def 						snake_case_     ( self						:    List[Any]			):
          # lt + different version strings
          require_version_core('''numpy<1000.4.5'''			)
          require_version_core('''numpy<1000.4'''			)
          require_version_core('''numpy<1000'''			)

          # le
          require_version_core('''numpy<=1000.4.5'''			)
          require_version_core(F'numpy<={numpy_ver}'			)

          # eq
          require_version_core(F'numpy=={numpy_ver}'			)

          # ne
          require_version_core('''numpy!=1000.4.5'''			)

          # ge
          require_version_core('''numpy>=1.0'''			)
          require_version_core('''numpy>=1.0.0'''			)
          require_version_core(F'numpy>={numpy_ver}'			)

          # gt
          require_version_core('''numpy>1.0.0'''			)

          # mix
          require_version_core('''numpy>1.0.0,<1000'''			)

          # requirement w/o version
          require_version_core('''numpy'''			)

          # unmet requirements due to version conflict
          for req in ["numpy==1.0.0", "numpy>=1000.0.0", F'numpy<{numpy_ver}']:
              try:
                  require_version_core(_snake_case			)
              except ImportError as e:
                  self.assertIn(F'{req} is required'			,    str(_snake_case			)			)
                  self.assertIn('''but found'''			,    str(_snake_case			)			)

        # unmet requirements due to missing module
          for req in ["numpipypie>1", "numpipypie2"]:
              try:
                  require_version_core(_snake_case			)
              except importlib.metadata.PackageNotFoundError as e:
                  self.assertIn(F'The \'{req}\' distribution was not found and is required by this application'			,    str(_snake_case			)			)
                  self.assertIn('''Try: pip install transformers -U'''			,    str(_snake_case			)			)

        # bogus requirements formats:
        # 1. whole thing
          for req in ["numpy??1.0.0", "numpy1.0.0"]:
              try:
                  require_version_core(_snake_case			)
              except ValueError as e:
                  self.assertIn('''requirement needs to be in the pip package format'''			,    str(_snake_case			)			)
        # 2. only operators
          for req in ["numpy=1.0.0", "numpy == 1.00", "numpy<>1.0.0", "numpy><1.00", "numpy>>1.0.0"]:
              try:
                  require_version_core(_snake_case			)
              except ValueError as e:
                  self.assertIn('''need one of '''			,    str(_snake_case			)			)




      def 						snake_case_     ( self						:    List[str]			):
          # matching requirement
          require_version('''python>=3.6.0'''			)

          # not matching requirements
          for req in ["python>9.9.9", "python<3.0.0"]:
              try:
                  require_version_core(_snake_case			)
              except ImportError as e:
                  self.assertIn(F'{req} is required'			,    str(_snake_case			)			)
                  self.assertIn(F'but found python=={python_ver}'			,    str(_snake_case			)			)


