



'''simple docstring'''




UpperCamelCase__	:     int				  =			float('''inf''')






class 						_UpperCamelCase  :


			'''simple docstring'''

			def __init__(							self					:			List[str]							,					lowerCAmelCase__					:			int						):





					"""simple docstring"""






					__SCREAMING_SNAKE_CASE	:		Tuple   	=		[0] * n
					__SCREAMING_SNAKE_CASE	:		Optional[Any]   	=		[0] * n
					__SCREAMING_SNAKE_CASE	:		List[Any]   	=		[0] * n
					__SCREAMING_SNAKE_CASE	:		Union[str, Any]   	=		[[] for _ in range(lowerCAmelCase__						)]

			def UpperCamelCase__ (							self					:			str							,					lowerCAmelCase__					:			Optional[int]							,					lowerCAmelCase__					:			Union[str, Any]							,					lowerCAmelCase__					:			Optional[int]							,					lowerCAmelCase__					:			str=0						):





					"""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 UpperCamelCase__ (							self					:			str							,					lowerCAmelCase__					:			Optional[int]							,					lowerCAmelCase__					:			List[str]							,					lowerCAmelCase__					:			Dict						):





					"""simple docstring"""






					if vertex == sink or not flow:
							return flow

					for i in range(self.ptr[vertex]							,					len(self.adj[vertex]						)						):
							__SCREAMING_SNAKE_CASE	:		Any   	=		self.adj[vertex][i]
							if self.lvl[e[0]] == self.lvl[vertex] + 1:
									__SCREAMING_SNAKE_CASE	:		Union[str, Any]   	=		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
							__SCREAMING_SNAKE_CASE	:		Union[str, Any]   	=		self.ptr[vertex] + 1
					return 0



			def UpperCamelCase__ (							self					:			Dict							,					lowerCAmelCase__					:			str							,					lowerCAmelCase__					:			Union[str, Any]						):





					"""simple docstring"""






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

									__SCREAMING_SNAKE_CASE	:		int   	=		self.depth_first_search(lowerCAmelCase__							,					lowerCAmelCase__							,					lowerCAmelCase__						)
									while p:
											flow += p
											__SCREAMING_SNAKE_CASE	:		Dict   	=		self.depth_first_search(lowerCAmelCase__							,					lowerCAmelCase__							,					lowerCAmelCase__						)

									if not self.lvl[sink]:
											break

					return flow
UpperCamelCase__	:     Tuple				  =			Dinic(10)
UpperCamelCase__	:     str				  =			0
UpperCamelCase__	:     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'''




import warnings
from contextlib import contextmanager

from ...processing_utils import ProcessorMixin






class 						_UpperCamelCase  (							lowerCamelCase__   ):


			'''simple docstring'''

			_A				:		int         =		['''image_processor''', '''tokenizer''']
			_A				:		Union[str, Any]         =		'''AutoImageProcessor'''
			_A				:		Optional[Any]         =		'''AutoTokenizer'''

			def __init__(							self					:			Tuple							,					lowerCAmelCase__					:			Tuple=None							,					lowerCAmelCase__					:			Union[str, Any]=None							,					**lowerCAmelCase__					:			Any						):





					"""simple docstring"""






					__SCREAMING_SNAKE_CASE	:		Tuple   	=		None
					if "feature_extractor" in kwargs:
							warnings.warn(
							    """The `feature_extractor` argument is deprecated and will be removed in v5, use `image_processor`"""
							    """ instead."""							,					lowerCAmelCase__							,					)
							__SCREAMING_SNAKE_CASE	:		str   	=		kwargs.pop("""feature_extractor"""						)

					__SCREAMING_SNAKE_CASE	:		Any   	=		image_processor if image_processor is not None else feature_extractor
					if image_processor is None:
							raise ValueError("""You need to specify an `image_processor`."""						)
					if tokenizer is None:
							raise ValueError("""You need to specify a `tokenizer`."""						)

					super().__init__(lowerCAmelCase__							,					lowerCAmelCase__						)
					__SCREAMING_SNAKE_CASE	:		List[str]   	=		self.image_processor
					__SCREAMING_SNAKE_CASE	:		Dict   	=		False

			def __call__(							self					:			List[str]							,					*lowerCAmelCase__					:			List[str]							,					**lowerCAmelCase__					:			Dict						):





					"""simple docstring"""






					if self._in_target_context_manager:
							return self.current_processor(*lowerCAmelCase__							,					**lowerCAmelCase__						)

					__SCREAMING_SNAKE_CASE	:		Optional[Any]   	=		kwargs.pop("""images"""							,					lowerCAmelCase__						)
					__SCREAMING_SNAKE_CASE	:		Union[str, Any]   	=		kwargs.pop("""text"""							,					lowerCAmelCase__						)
					if len(lowerCAmelCase__						) > 0:
							__SCREAMING_SNAKE_CASE	:		Tuple   	=		args[0]
							__SCREAMING_SNAKE_CASE	:		int   	=		args[1:]

					if images is None and text is None:
							raise ValueError("""You need to specify either an `images` or `text` input to process."""						)

					if images is not None:
							__SCREAMING_SNAKE_CASE	:		List[str]   	=		self.image_processor(lowerCAmelCase__							,					*lowerCAmelCase__							,					**lowerCAmelCase__						)
					if text is not None:
							__SCREAMING_SNAKE_CASE	:		Optional[int]   	=		self.tokenizer(lowerCAmelCase__							,					**lowerCAmelCase__						)

					if text is None:
							return inputs
					elif images is None:
							return encodings
					else:
							__SCREAMING_SNAKE_CASE	:		int   	=		encodings["""input_ids"""]
							return inputs

			def UpperCamelCase__ (							self					:			Any							,					*lowerCAmelCase__					:			Any							,					**lowerCAmelCase__					:			List[str]						):





					"""simple docstring"""






					return self.tokenizer.batch_decode(*lowerCAmelCase__							,					**lowerCAmelCase__						)

			def UpperCamelCase__ (							self					:			int							,					*lowerCAmelCase__					:			str							,					**lowerCAmelCase__					:			Dict						):





					"""simple docstring"""






					return self.tokenizer.decode(*lowerCAmelCase__							,					**lowerCAmelCase__						)

			@contextmanager
			def UpperCamelCase__ (							self					:			Union[str, Any]						):





					"""simple docstring"""






					warnings.warn(
					    """`as_target_processor` is deprecated and will be removed in v5 of Transformers. You can process your """
					    """labels by using the argument `text` of the regular `__call__` method (either in the same call as """
					    """your images inputs, or in a separate call."""						)
					__SCREAMING_SNAKE_CASE	:		List[Any]   	=		True
					__SCREAMING_SNAKE_CASE	:		Optional[Any]   	=		self.tokenizer
					yield
					__SCREAMING_SNAKE_CASE	:		Union[str, Any]   	=		self.image_processor
					__SCREAMING_SNAKE_CASE	:		List[str]   	=		False

			@property
			def UpperCamelCase__ (							self					:			Optional[Any]						):





					"""simple docstring"""






					warnings.warn(
					    """`feature_extractor_class` is deprecated and will be removed in v5. Use `image_processor_class` instead."""							,					lowerCAmelCase__							,					)
					return self.image_processor_class



			@property
			def UpperCamelCase__ (							self					:			List[Any]						):





					"""simple docstring"""






					warnings.warn(
					    """`feature_extractor` is deprecated and will be removed in v5. Use `image_processor` instead."""							,					lowerCAmelCase__							,					)
					return self.image_processor