


'''simple docstring'''


lowerCamelCase__     						=  float('inf')






class 						lowerCAmelCase__      :




			def __init__(		self	:  Optional[int]						,	lowerCamelCase__	:  Any			) ->int:



					'''simple docstring'''







					_UpperCAmelCase		:							str             =   [0] * n
					_UpperCAmelCase		:							Optional[Any]             =   [0] * n
					_UpperCAmelCase		:							Optional[int]             =   [0] * n
					_UpperCAmelCase		:							Optional[int]             =   [[] for _ in range(lowerCamelCase__			)]




			def 				lowerCAmelCase__     (		self	:  List[Any]						,	lowerCamelCase__	:  Optional[Any]						,	lowerCamelCase__	:  Any						,	lowerCamelCase__	:  List[Any]						,	lowerCamelCase__	:  Optional[Any]=0			) ->int:



					'''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 				lowerCAmelCase__     (		self	:  List[str]						,	lowerCamelCase__	:  Any						,	lowerCamelCase__	:  Tuple						,	lowerCamelCase__	:  List[Any]			) ->str:



					'''simple docstring'''







					if vertex == sink or not flow:
							return flow

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






			def 				lowerCAmelCase__     (		self	:  Optional[Any]						,	lowerCamelCase__	:  Dict						,	lowerCamelCase__	:  Any			) ->Tuple:



					'''simple docstring'''







					_UpperCAmelCase       ,     _UpperCAmelCase		:							int             =   0, source
					for l in range(31			):  # noqa: E741  l = 30 maybe faster for random data
							while True:
									_UpperCAmelCase       ,     _UpperCAmelCase		:							Tuple             =   [0] * len(self.q			), [0] * len(self.q			)
									_UpperCAmelCase       ,     _UpperCAmelCase       ,     _UpperCAmelCase		:							List[str]             =   0, 1, 1
									while qi < qe and not self.lvl[sink]:
											_UpperCAmelCase		:							Union[str, 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):
															_UpperCAmelCase		:							Optional[int]             =   e[0]
															qe += 1
															_UpperCAmelCase		:							Tuple             =   self.lvl[v] + 1

									_UpperCAmelCase		:							List[str]             =   self.depth_first_search(lowerCamelCase__						,	lowerCamelCase__						,	lowerCamelCase__			)
									while p:
											flow += p
											_UpperCAmelCase		:							Dict             =   self.depth_first_search(lowerCamelCase__						,	lowerCamelCase__						,	lowerCamelCase__			)

									if not self.lvl[sink]:
											break

					return flow
lowerCamelCase__     						=  Dinic(10)
lowerCamelCase__     						=  0
lowerCamelCase__     						=  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 ..utils import deprecate
from .attention_processor import (  # noqa: F401
    Attention,
    AttentionProcessor,
    AttnAddedKVProcessor,
    AttnProcessor2_0,
    LoRAAttnProcessor,
    LoRALinearLayer,
    LoRAXFormersAttnProcessor,
    SlicedAttnAddedKVProcessor,
    SlicedAttnProcessor,
    XFormersAttnProcessor,
)
from .attention_processor import AttnProcessor as AttnProcessorRename  # noqa: F401


deprecate(
    'cross_attention',
    '0.20.0',
    'Importing from cross_attention is deprecated. Please import from diffusers.models.attention_processor instead.',
    standard_warn=False,
)


lowerCamelCase__     						=  AttentionProcessor






class 						lowerCAmelCase__      (      UpperCAmelCase__						):




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



					'''simple docstring'''







					_UpperCAmelCase		:							Dict             =   F"""{self.__class__.__name__} is deprecated and will be removed in `0.20.0`. Please use `from diffusers.models.attention_processor import {''.join(self.__class__.__name__.split('Cross'			)			)} instead."""
					deprecate("cross_attention"						,	"0.20.0"						,	lowerCamelCase__						,	standard_warn=lowerCamelCase__			)
					super().__init__(*lowerCamelCase__						,	**lowerCamelCase__			)






class 						lowerCAmelCase__      (      UpperCAmelCase__						):




			def __init__(		self	:  Optional[Any]						,	*lowerCamelCase__	:  Any						,	**lowerCamelCase__	:  Tuple			) ->List[Any]:



					'''simple docstring'''







					_UpperCAmelCase		:							int             =   F"""{self.__class__.__name__} is deprecated and will be removed in `0.20.0`. Please use `from diffusers.models.attention_processor import {''.join(self.__class__.__name__.split('Cross'			)			)} instead."""
					deprecate("cross_attention"						,	"0.20.0"						,	lowerCamelCase__						,	standard_warn=lowerCamelCase__			)
					super().__init__(*lowerCamelCase__						,	**lowerCamelCase__			)






class 						lowerCAmelCase__      (      UpperCAmelCase__						):




			def __init__(		self	:  List[Any]						,	*lowerCamelCase__	:  List[Any]						,	**lowerCamelCase__	:  List[str]			) ->List[Any]:



					'''simple docstring'''







					_UpperCAmelCase		:							List[str]             =   F"""{self.__class__.__name__} is deprecated and will be removed in `0.20.0`. Please use `from diffusers.models.attention_processor import {''.join(self.__class__.__name__.split('Cross'			)			)} instead."""
					deprecate("cross_attention"						,	"0.20.0"						,	lowerCamelCase__						,	standard_warn=lowerCamelCase__			)
					super().__init__(*lowerCamelCase__						,	**lowerCamelCase__			)






class 						lowerCAmelCase__      (      UpperCAmelCase__						):




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



					'''simple docstring'''







					_UpperCAmelCase		:							Dict             =   F"""{self.__class__.__name__} is deprecated and will be removed in `0.20.0`. Please use `from diffusers.models.attention_processor import {''.join(self.__class__.__name__.split('Cross'			)			)} instead."""
					deprecate("cross_attention"						,	"0.20.0"						,	lowerCamelCase__						,	standard_warn=lowerCamelCase__			)
					super().__init__(*lowerCamelCase__						,	**lowerCamelCase__			)






class 						lowerCAmelCase__      (      UpperCAmelCase__						):




			def __init__(		self	:  int						,	*lowerCamelCase__	:  List[str]						,	**lowerCamelCase__	:  Tuple			) ->Union[str, Any]:



					'''simple docstring'''







					_UpperCAmelCase		:							Optional[Any]             =   F"""{self.__class__.__name__} is deprecated and will be removed in `0.20.0`. Please use `from diffusers.models.attention_processor import {''.join(self.__class__.__name__.split('Cross'			)			)} instead."""
					deprecate("cross_attention"						,	"0.20.0"						,	lowerCamelCase__						,	standard_warn=lowerCamelCase__			)
					super().__init__(*lowerCamelCase__						,	**lowerCamelCase__			)






class 						lowerCAmelCase__      (      UpperCAmelCase__						):




			def __init__(		self	:  List[Any]						,	*lowerCamelCase__	:  int						,	**lowerCamelCase__	:  Optional[int]			) ->Optional[int]:



					'''simple docstring'''







					_UpperCAmelCase		:							List[Any]             =   F"""{self.__class__.__name__} is deprecated and will be removed in `0.20.0`. Please use `from diffusers.models.attention_processor import {''.join(self.__class__.__name__.split('Cross'			)			)} instead."""
					deprecate("cross_attention"						,	"0.20.0"						,	lowerCamelCase__						,	standard_warn=lowerCamelCase__			)
					super().__init__(*lowerCamelCase__						,	**lowerCamelCase__			)






class 						lowerCAmelCase__      (      UpperCAmelCase__						):




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



					'''simple docstring'''







					_UpperCAmelCase		:							int             =   F"""{self.__class__.__name__} is deprecated and will be removed in `0.20.0`. Please use `from diffusers.models.attention_processor import {''.join(self.__class__.__name__.split('Cross'			)			)} instead."""
					deprecate("cross_attention"						,	"0.20.0"						,	lowerCamelCase__						,	standard_warn=lowerCamelCase__			)
					super().__init__(*lowerCamelCase__						,	**lowerCamelCase__			)






class 						lowerCAmelCase__      (      UpperCAmelCase__						):




			def __init__(		self	:  Optional[Any]						,	*lowerCamelCase__	:  List[Any]						,	**lowerCamelCase__	:  Dict			) ->Any:



					'''simple docstring'''







					_UpperCAmelCase		:							int             =   F"""{self.__class__.__name__} is deprecated and will be removed in `0.20.0`. Please use `from diffusers.models.attention_processor import {''.join(self.__class__.__name__.split('Cross'			)			)} instead."""
					deprecate("cross_attention"						,	"0.20.0"						,	lowerCamelCase__						,	standard_warn=lowerCamelCase__			)
					super().__init__(*lowerCamelCase__						,	**lowerCamelCase__			)



