
import dataclasses
import enum
import functools
import math
import re

# The following script is adapted from the script of TaPas.
# Original: https://github.com/google-research/tapas/master/wikisql_utils.py
from typing import Any, List, Text


_A       =					"none"
_A       =					"none"






def        lowerCamelCase__    (    __lowerCAmelCase  :  Tuple   ,							__lowerCAmelCase  :  Union[str, Any]    ):




			"""simple docstring"""


			lowerCAmelCase_      =     value.split(__lowerCAmelCase    )
			return len(__lowerCAmelCase    ) > 1 and any((len(__lowerCAmelCase    ) == 3 for x in split)    )






def        lowerCamelCase__    (    __lowerCAmelCase  :  List[str]    ):




			"""simple docstring"""


			if isinstance(__lowerCAmelCase   ,							__lowerCAmelCase    ):
						return value
			if isinstance(__lowerCAmelCase   ,							__lowerCAmelCase    ):
						return float(__lowerCAmelCase    )
			if not isinstance(__lowerCAmelCase   ,							__lowerCAmelCase    ):
						raise ValueError("Argument value is not a string. Can\'t parse it as float"    )
			lowerCAmelCase_      =     value

			try:
						# Example: 1,000.7
						if "." in sanitized and "," in sanitized:
									return float(sanitized.replace(","   ,							""    )    )
						# 1,000
						if "," in sanitized and _split_thousands(","   ,							__lowerCAmelCase    ):
									return float(sanitized.replace(","   ,							""    )    )
						# 5,5556
						if "," in sanitized and sanitized.count(","    ) == 1 and not _split_thousands(","   ,							__lowerCAmelCase    ):
									return float(sanitized.replace(","   ,							"."    )    )
						# 0.0.0.1
						if sanitized.count("."    ) > 1:
									return float(sanitized.replace("."   ,							""    )    )
						# 0,0,0,1
						if sanitized.count(","    ) > 1:
									return float(sanitized.replace(","   ,							""    )    )
						return float(__lowerCAmelCase    )
			except ValueError:
						# Avoid adding the sanitized value in the error message.
						raise ValueError("Unable to convert value to float"    )






def        lowerCamelCase__    (    __lowerCAmelCase  :  str    ):




			"""simple docstring"""


			if answer is None:
						return None
			try:
						lowerCAmelCase_      =     convert_to_float(__lowerCAmelCase    )
						if isinstance(__lowerCAmelCase   ,							__lowerCAmelCase    ) and math.isnan(__lowerCAmelCase    ):
									return None
						return value
			except ValueError:
						return answer.lower()


_A       =					{
    "text": lambda x: x,
    "real": convert_to_float,
}





class      _lowerCAmelCase (     enum.Enum	):
				_lowercase      		=0
				_lowercase      		=1
				_lowercase      		=2
				_lowercase      		=3
				_lowercase      		=4
				_lowercase      		=5





class      _lowerCAmelCase (     enum.Enum	):
				_lowercase      		=0
				_lowercase      		=1
				_lowercase      		=2





@dataclasses.dataclass
class      _lowerCAmelCase :
				_lowercase      		=42
				_lowercase      		=42
				_lowercase      		=42


_A       =					re.compile(R"\w+|[^\w\s]+", re.UNICODE | re.MULTILINE | re.DOTALL)






def        lowerCamelCase__    (    __lowerCAmelCase  :  Optional[int]    ):




			"""simple docstring"""


			return list(_TOKENIZER.findall(x.lower()    )    )






def        lowerCamelCase__    (    __lowerCAmelCase  :  int   ,							__lowerCAmelCase  :  str   ,							__lowerCAmelCase  :  Any    ):




			"""simple docstring"""


			if operator == _Operator.EQUALS:
						return src == tgt
			elif operator == _Operator.GREATER:
						return src > tgt
			elif operator == _Operator.LESSER:
						return src < tgt
			raise ValueError(F"""Unknown operator: {operator}"""    )






def        lowerCamelCase__    (    __lowerCAmelCase  :  Optional[Any]   ,							__lowerCAmelCase  :  Any   ,							__lowerCAmelCase  :  Any    ):




			"""simple docstring"""


			lowerCAmelCase_      =     table['''types''']
			return _TYPE_CONVERTER[types[column]](__lowerCAmelCase    )






def        lowerCamelCase__    (    __lowerCAmelCase  :  List[str]    ):




			"""simple docstring"""


			return isinstance(__lowerCAmelCase   ,							__lowerCAmelCase    )






def        lowerCamelCase__    (    __lowerCAmelCase  :  Optional[int]   ,							__lowerCAmelCase  :  str   ,							__lowerCAmelCase  :  List[Any]    ):




			"""simple docstring"""


			for cond in conditions:
						lowerCAmelCase_      =     row[cond.column]

						lowerCAmelCase_      =     _parse_value(__lowerCAmelCase   ,							cond.column   ,							cond.cmp_value    )

						if _is_string(__lowerCAmelCase    ) and _is_string(__lowerCAmelCase    ):
									lowerCAmelCase_      =     _normalize_for_match(__lowerCAmelCase    )
									lowerCAmelCase_      =     _normalize_for_match(__lowerCAmelCase    )

						if not isinstance(__lowerCAmelCase   ,							type(__lowerCAmelCase    )    ):
									raise ValueError("Type difference {} != {}".format(type(__lowerCAmelCase    )   ,							type(__lowerCAmelCase    )    )    )

						if not _compare(cond.operator   ,							__lowerCAmelCase   ,							__lowerCAmelCase    ):
									return False
			return True






def        lowerCamelCase__    (    __lowerCAmelCase  :  Dict   ,							__lowerCAmelCase  :  Optional[Any]   ,							__lowerCAmelCase  :  Tuple    ):




			"""simple docstring"""


			if not answer_coordinates:
						if aggregation_op == _Aggregation.COUNT:
									return 0.0
						else:
									return EMPTY_ANSWER_AGG

						# Count can support non numeric answers.
			if aggregation_op == _Aggregation.COUNT:
						return float(len(__lowerCAmelCase    )    )

			# If we have just one answer, if float returns it or try a conversion.
			lowerCAmelCase_      =     [table['''rows'''][i][j] for (i, j) in answer_coordinates]
			if len(__lowerCAmelCase    ) == 1:
						try:
									return convert_to_float(values[0]    )
						except ValueError as e:
									if aggregation_op != _Aggregation.NONE:
												raise e

			if aggregation_op == _Aggregation.NONE:
						return None

			# Other aggregation only support numeric values. Bail out if we have strings.
			if not all((isinstance(__lowerCAmelCase   ,							(int, float)    ) for v in values)    ):
						return None

			if aggregation_op == _Aggregation.SUM:
						return float(sum(__lowerCAmelCase    )    )
			elif aggregation_op == _Aggregation.AVERAGE:
						return sum(__lowerCAmelCase    ) / len(__lowerCAmelCase    )
			else:
						raise ValueError(F"""Unknown aggregation: {aggregation_op}"""    )






def        lowerCamelCase__    (    __lowerCAmelCase  :  int   ,							__lowerCAmelCase  :  List[Any]    ):




			"""simple docstring"""


			lowerCAmelCase_      =     sql_query['''agg''']
			if aggregation_op_index >= 3:
						lowerCAmelCase_      =     _Aggregation(__lowerCAmelCase    )
			else:
						lowerCAmelCase_      =     _Aggregation.NONE

			lowerCAmelCase_      =     sql_query['''sel''']
			lowerCAmelCase_      =     [
			    _Condition(__lowerCAmelCase   ,							_Operator(__lowerCAmelCase    )   ,							__lowerCAmelCase    )
			    for column, operator, cmp_value in zip(
			        sql_query["conds"]["column_index"]   ,							sql_query["conds"]["operator_index"]   ,							sql_query["conds"]["condition"]    )
			]

			lowerCAmelCase_      =     []
			for row in range(len(table["rows"]    )    ):
						if _respect_conditions(__lowerCAmelCase   ,							table["rows"][row]   ,							__lowerCAmelCase    ):
									indices.append((row, target_column)    )

			if not indices:
						return [], aggregation_op

			if len(__lowerCAmelCase    ) == 1:
						return indices, aggregation_op

			# Parsing of MIN/MAX.
			if aggregation_op_index in (1, 2):
						lowerCAmelCase_      =     {2: min, 1: max}
						lowerCAmelCase_      =     [(table['''rows'''][i][j], index) for index, (i, j) in enumerate(__lowerCAmelCase    )]
						lowerCAmelCase_      =     functools.reduce(operators[sql_query["agg"]]   ,							__lowerCAmelCase    )

						lowerCAmelCase_      =     [indices[reduced[1]]]
						return ret, _Aggregation.NONE

			return indices, aggregation_op






def        lowerCamelCase__    (    __lowerCAmelCase  :  List[str]   ,							__lowerCAmelCase  :  List[str]   ,							__lowerCAmelCase  :  Union[str, Any]    ):




			"""simple docstring"""


			if float_answer is not None:
						return [str(__lowerCAmelCase    )]
			return [str(table["real_rows"][r][c]    ) for r, c in answer_coordinates]






def        lowerCamelCase__    (    __lowerCAmelCase  :  Union[str, Any]   ,							__lowerCAmelCase  :  Optional[int]    ):




			"""simple docstring"""


			lowerCAmelCase_      =     _get_answer_coordinates(__lowerCAmelCase   ,							__lowerCAmelCase    )
			lowerCAmelCase_      =     _get_float_answer(__lowerCAmelCase   ,							__lowerCAmelCase   ,							__lowerCAmelCase    )
			lowerCAmelCase_      =     _get_answer_text(__lowerCAmelCase   ,							__lowerCAmelCase   ,							__lowerCAmelCase    )
			# keep the original data the same with TaPas
			if len(__lowerCAmelCase    ) == 0:
						lowerCAmelCase_      =     [EMPTY_ANSWER]
			return answer_text





import math






def        lowerCamelCase__    (    __lowerCAmelCase  :  int    ):




			"""simple docstring"""


			if 1 < number < 4:
						# 2 and 3 are primes
						return True
			elif number < 2 or number % 2 == 0 or number % 3 == 0:
						# Negatives, 0, 1, all even numbers, all multiples of 3 are not primes
						return False

			# All primes number are in format of 6k +/- 1
			for i in range(5   ,							int(math.sqrt(__lowerCAmelCase    ) + 1    )   ,							6    ):
						if number % i == 0 or number % (i + 2) == 0:
									return False
			return True






def        lowerCamelCase__    (    __lowerCAmelCase  :  int = 600851475143    ):




			"""simple docstring"""


			try:
						lowerCAmelCase_      =     int(__lowerCAmelCase    )
			except (TypeError, ValueError):
						raise TypeError("Parameter n must be int or castable to int."    )
			if n <= 0:
						raise ValueError("Parameter n must be greater than or equal to one."    )
			lowerCAmelCase_      =     0
			if is_prime(__lowerCAmelCase    ):
						return n
			while n % 2 == 0:
						n //= 2
			if is_prime(__lowerCAmelCase    ):
						return n
			for i in range(3   ,							int(math.sqrt(__lowerCAmelCase    )    ) + 1   ,							2    ):
						if n % i == 0:
									if is_prime(n // i    ):
												lowerCAmelCase_      =     n // i
												break
									elif is_prime(__lowerCAmelCase    ):
												lowerCAmelCase_      =     i
			return max_number


if __name__ == "__main__":
			print(f"""{solution() = }""")



