


"""simple docstring"""


from abc import ABC, abstractmethod
from typing import List, Optional
class snake_case      (  _UpperCamelCase):







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





						'''simple docstring'''







						self.test()







		def  a_ (					self      :       Union[str, Any]		)       ->						List[Any]:





						'''simple docstring'''







						_A					  =			0
						_A					  =			False
						while not completed:
										if counter == 1:
														self.reset()
										_A					  =			self.advance()
										if not self.does_advance(a__		):
														raise Exception(
														    "Custom Constraint is not defined correctly. self.does_advance(self.advance()) must be true."		)

										_A  ,		_A  ,		_A					  =			self.update(a__		)
										counter += 1

										if counter > 1_00_00:
														raise Exception("update() does not fulfill the constraint."		)

						if self.remaining() != 0:
										raise Exception("Custom Constraint is not defined correctly."		)







		@abstractmethod
		def  a_ (					self      :       Any		)       ->						List[str]:





						'''simple docstring'''







						raise NotImplementedError(
						    F"""{self.__class__} is an abstract class. Only classes inheriting this class can be called."""		)







		@abstractmethod
		def  a_ (					self      :       Tuple    ,   a__      :       str		)       ->						Tuple:





						'''simple docstring'''







						raise NotImplementedError(
						    F"""{self.__class__} is an abstract class. Only classes inheriting this class can be called."""		)







		@abstractmethod
		def  a_ (					self      :       List[Any]    ,   a__      :       Optional[int]		)       ->						str:





						'''simple docstring'''







						raise NotImplementedError(
						    F"""{self.__class__} is an abstract class. Only classes inheriting this class can be called."""		)







		@abstractmethod
		def  a_ (					self      :       str		)       ->						str:





						'''simple docstring'''







						raise NotImplementedError(
						    F"""{self.__class__} is an abstract class. Only classes inheriting this class can be called."""		)







		@abstractmethod
		def  a_ (					self      :       int		)       ->						str:





						'''simple docstring'''







						raise NotImplementedError(
						    F"""{self.__class__} is an abstract class. Only classes inheriting this class can be called."""		)







		@abstractmethod
		def  a_ (					self      :       Optional[int]    ,   a__      :       Optional[int]=False		)       ->						List[Any]:





						'''simple docstring'''







						raise NotImplementedError(
						    F"""{self.__class__} is an abstract class. Only classes inheriting this class can be called."""		)





class snake_case      (  _UpperCamelCase):







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





						'''simple docstring'''







						super(a__    ,   self		).__init__()

						if not isinstance(a__    ,   a__		) or len(a__		) == 0:
										raise ValueError(F"""`token_ids` has to be a non-empty list, but is {token_ids}."""		)
						if any((not isinstance(a__    ,   a__		) or token_id < 0) for token_id in token_ids		):
										raise ValueError(F"""Each list in `token_ids` has to be a list of positive integers, but is {token_ids}."""		)

						_A					  =			token_ids

						_A					  =			len(self.token_ids		)
						_A					  =			-1  # the index of the currently fulfilled step
						_A					  =			False







		def  a_ (					self      :       List[Any]		)       ->						Optional[Any]:





						'''simple docstring'''







						if self.completed:
										return None
						return self.token_ids[self.fulfilled_idx + 1]







		def  a_ (					self      :       Any    ,   a__      :       str		)       ->						Tuple:





						'''simple docstring'''







						if not isinstance(a__    ,   a__		):
										raise ValueError(F"""`token_id` has to be an `int`, but is {token_id} of type {type(a__		)}"""		)

						if self.completed:
										return False

						return token_id == self.token_ids[self.fulfilled_idx + 1]







		def  a_ (					self      :       Dict    ,   a__      :       List[str]		)       ->						Dict:





						'''simple docstring'''







						if not isinstance(a__    ,   a__		):
										raise ValueError(F"""`token_id` has to be an `int`, but is {token_id} of type {type(a__		)}"""		)

						_A					  =			False
						_A					  =			False
						_A					  =			False

						if self.does_advance(a__		):
										self.fulfilled_idx += 1
										_A					  =			True
										if self.fulfilled_idx == (self.seqlen - 1):
														_A					  =			True
										_A					  =			completed
						else:
										# failed to make progress.
										_A					  =			True
										self.reset()
						return stepped, completed, reset







		def  a_ (					self      :       List[str]		)       ->						str:





						'''simple docstring'''







						_A					  =			False
						_A					  =			0







		def  a_ (					self      :       Tuple		)       ->						List[Any]:





						'''simple docstring'''







						return self.seqlen - (self.fulfilled_idx + 1)







		def  a_ (					self      :       Dict    ,   a__      :       str=False		)       ->						int:





						'''simple docstring'''







						_A					  =			PhrasalConstraint(self.token_ids		)

						if stateful:
										_A					  =			self.seqlen
										_A					  =			self.fulfilled_idx
										_A					  =			self.completed

						return new_constraint





class snake_case      :







		def __init__(					self      :       Optional[int]    ,   a__      :       str    ,   a__      :       Dict=True		)       ->						Any:





						'''simple docstring'''







						_A					  =			max([len(a__		) for one in nested_token_ids]		)

						_A					  =			{}
						for token_ids in nested_token_ids:
										_A					  =			root
										for tidx, token_id in enumerate(a__		):
														if token_id not in level:
																		_A					  =			{}

														_A					  =			level[token_id]

						if no_subsets and self.has_subsets(a__    ,   a__		):
										raise ValueError(
										    "Each list in `nested_token_ids` can't be a complete subset of another list, but is"
										    F""" {nested_token_ids}."""		)

						_A					  =			root







		def  a_ (					self      :       Dict    ,   a__      :       Optional[int]		)       ->						int:





						'''simple docstring'''







						_A					  =			self.trie

						for current_token in current_seq:
										_A					  =			start[current_token]

						_A					  =			list(start.keys()		)

						return next_tokens







		def  a_ (					self      :       Optional[int]    ,   a__      :       List[str]		)       ->						Dict:





						'''simple docstring'''







						_A					  =			self.next_tokens(a__		)

						return len(a__		) == 0







		def  a_ (					self      :       Union[str, Any]    ,   a__      :       Dict		)       ->						Any:





						'''simple docstring'''







						_A					  =			list(root.values()		)
						if len(a__		) == 0:
										return 1
						else:
										return sum([self.count_leaves(a__		) for nn in next_nodes]		)







		def  a_ (					self      :       int    ,   a__      :       str    ,   a__      :       List[str]		)       ->						Dict:





						'''simple docstring'''







						_A					  =			self.count_leaves(a__		)
						return len(a__		) != leaf_count





class snake_case      (  _UpperCamelCase):







		def __init__(					self      :       List[Any]    ,   a__      :       Tuple		)       ->						int:





						'''simple docstring'''







						super(a__    ,   self		).__init__()

						if not isinstance(a__    ,   a__		) or len(a__		) == 0:
										raise ValueError(F"""`nested_token_ids` has to be a non-empty list, but is {nested_token_ids}."""		)
						if any(not isinstance(a__    ,   a__		) for token_ids in nested_token_ids		):
										raise ValueError(F"""`nested_token_ids` has to be a list of lists, but is {nested_token_ids}."""		)
						if any(
						    any((not isinstance(a__    ,   a__		) or token_id < 0) for token_id in token_ids		)
						    for token_ids in nested_token_ids		):
										raise ValueError(
										    F"""Each list in `nested_token_ids` has to be a list of positive integers, but is {nested_token_ids}."""		)

						_A					  =			DisjunctiveTrie(a__		)
						_A					  =			nested_token_ids

						_A					  =			self.trie.max_height
						_A					  =			[]
						_A					  =			False







		def  a_ (					self      :       Any		)       ->						Union[str, Any]:





						'''simple docstring'''







						_A					  =			self.trie.next_tokens(self.current_seq		)

						if len(a__		) == 0:
										return None
						else:
										return token_list







		def  a_ (					self      :       Any    ,   a__      :       str		)       ->						str:





						'''simple docstring'''







						if not isinstance(a__    ,   a__		):
										raise ValueError(F"""`token_id` is supposed to be type `int`, but is {token_id} of type {type(a__		)}"""		)

						_A					  =			self.trie.next_tokens(self.current_seq		)

						return token_id in next_tokens







		def  a_ (					self      :       List[str]    ,   a__      :       Any		)       ->						List[str]:





						'''simple docstring'''







						if not isinstance(a__    ,   a__		):
										raise ValueError(F"""`token_id` is supposed to be type `int`, but is {token_id} of type {type(a__		)}"""		)

						_A					  =			False
						_A					  =			False
						_A					  =			False

						if self.does_advance(a__		):
										self.current_seq.append(a__		)
										_A					  =			True
						else:
										_A					  =			True
										self.reset()

						_A					  =			self.trie.reached_leaf(self.current_seq		)
						_A					  =			completed

						return stepped, completed, reset







		def  a_ (					self      :       Union[str, Any]		)       ->						int:





						'''simple docstring'''







						_A					  =			False
						_A					  =			[]







		def  a_ (					self      :       List[str]		)       ->						Optional[Any]:





						'''simple docstring'''







						if self.completed:
										# since this can be completed without reaching max height
										return 0
						else:
										return self.seqlen - len(self.current_seq		)







		def  a_ (					self      :       List[Any]    ,   a__      :       Any=False		)       ->						Union[str, Any]:





						'''simple docstring'''







						_A					  =			DisjunctiveConstraint(self.token_ids		)

						if stateful:
										_A					  =			self.seqlen
										_A					  =			self.current_seq
										_A					  =			self.completed

						return new_constraint





class snake_case      :







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





						'''simple docstring'''







						_A					  =			constraints

						# max # of steps required to fulfill a given constraint
						_A					  =			max([c.seqlen for c in constraints]		)
						_A					  =			len(a__		)
						_A					  =			False

						self.init_state()







		def  a_ (					self      :       Tuple		)       ->						Union[str, Any]:





						'''simple docstring'''







						_A					  =			[]
						_A					  =			None
						_A					  =			[constraint.copy(stateful=a__		) for constraint in self.constraints]







		def  a_ (					self      :       Tuple		)       ->						Optional[int]:





						'''simple docstring'''







						_A					  =			0
						if self.inprogress_constraint:
										# extra points for having a constraint mid-fulfilled
										add += self.max_seqlen - self.inprogress_constraint.remaining()

						return (len(self.complete_constraints		) * self.max_seqlen) + add







		def  a_ (					self      :       Union[str, Any]		)       ->						Optional[Any]:





						'''simple docstring'''







						_A					  =			[]
						if self.inprogress_constraint is None:
										for constraint in self.pending_constraints:  # "pending" == "unfulfilled yet"
														_A					  =			constraint.advance()
														if isinstance(a__    ,   a__		):
																		token_list.append(a__		)
														elif isinstance(a__    ,   a__		):
																		token_list.extend(a__		)
						else:
										_A					  =			self.inprogress_constraint.advance()
										if isinstance(a__    ,   a__		):
														token_list.append(a__		)
										elif isinstance(a__    ,   a__		):
														token_list.extend(a__		)

						if len(a__		) == 0:
										return None
						else:
										return token_list







		def  a_ (					self      :       int    ,   a__      :       Dict		)       ->						Union[str, Any]:





						'''simple docstring'''







						self.init_state()

						if token_ids is not None:
										for token in token_ids:
														# completes or steps **one** constraint
														_A  ,		_A					  =			self.add(a__		)

														# the entire list of constraints are fulfilled
														if self.completed:
																		break







		def  a_ (					self      :       Optional[int]    ,   a__      :       List[Any]		)       ->						Union[str, Any]:





						'''simple docstring'''







						if not isinstance(a__    ,   a__		):
										raise ValueError(F"""`token_id` should be an `int`, but is `{token_id}`."""		)

						_A  ,		_A					  =			False, False

						if self.completed:
										_A					  =			True
										_A					  =			False
										return complete, stepped

						if self.inprogress_constraint is not None:
										# In the middle of fulfilling a constraint. If the `token_id` *does* makes an incremental progress to current
										# job, simply update the state

										_A  ,		_A  ,		_A					  =			self.inprogress_constraint.update(a__		)
										if reset:
														# 1. If the next token breaks the progress, then we must restart.
														#     e.g. constraint = "I love pies" and sequence so far is "I love" but `token_id` == "books".

														#     But that doesn't mean we self.init_state(), since we only reset the state for this particular
														#     constraint, not the full list of constraints.

														self.pending_constraints.append(self.inprogress_constraint.copy(stateful=a__		)		)
														_A					  =			None

										if complete:
														# 2. If the next token completes the constraint, move it to completed list, set
														#     inprogress to None. If there are no pending constraints either, then this full list of constraints
														#     is complete.

														self.complete_constraints.append(self.inprogress_constraint		)
														_A					  =			None

														if len(self.pending_constraints		) == 0:
																		# we're done!
																		_A					  =			True

						else:
										# Not in the middle of fulfilling a constraint. So does this `token_id` helps us step towards any of our list
										# of constraints?

										for cidx, pending_constraint in enumerate(self.pending_constraints		):
														if pending_constraint.does_advance(a__		):
																		_A  ,		_A  ,		_A					  =			pending_constraint.update(a__		)

																		if not stepped:
																						raise Exception(
																						    "`constraint.update(token_id)` is not yielding incremental progress, "
																						    "even though `constraint.does_advance(token_id)` is true."		)

																		if complete:
																						self.complete_constraints.append(a__		)
																						_A					  =			None

																		if not complete and stepped:
																						_A					  =			pending_constraint

																		if complete or stepped:
																						# If we made any progress at all, then it's at least not a "pending constraint".

																						_A					  =			(
																						    self.pending_constraints[:cidx] + self.pending_constraints[cidx + 1 :]
																						)

																						if len(self.pending_constraints		) == 0 and self.inprogress_constraint is None:
																										# If there's no longer any pending after this and no inprogress either, then we must be
																										# complete.

																										_A					  =			True

																						break  # prevent accidentally stepping through multiple constraints with just one token.

						return complete, stepped







		def  a_ (					self      :       Any    ,   a__      :       Tuple=True		)       ->						List[Any]:





						'''simple docstring'''







						_A					  =			ConstraintListState(self.constraints		)  # we actually never though self.constraints objects
						# throughout this process. So it's at initialization state.

						if stateful:
										_A					  =			[
										    constraint.copy(stateful=a__		) for constraint in self.complete_constraints
										]
										if self.inprogress_constraint is not None:
														_A					  =			self.inprogress_constraint.copy(stateful=a__		)
										_A					  =			[constraint.copy() for constraint in self.pending_constraints]

						return new_state






"""simple docstring"""


from __future__ import annotations






def      a__ (				__lowercase     ,			__lowercase   )	->	float:
				_A					  =			sorted(numsa + numsa   )
				_A  ,		_A					  =			divmod(len(__lowercase   )     ,			2   )
				if mod == 1:
								return all_numbers[div]
				else:
								return (all_numbers[div] + all_numbers[div - 1]) / 2


if __name__ == "__main__":
		import doctest

		doctest.testmod()
		a_       							=    [float(x) for x in input("Enter the elements of first array: ").split()]
		a_       							=    [float(x) for x in input("Enter the elements of second array: ").split()]
		print(f'''The median of two arrays is: {median_of_two_arrays(array_a, array_a)}''')