




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


__UpperCamelCase      : Tuple					      =   "none"
__UpperCamelCase      : Tuple					      =   "none"





def 	__A	(			__lowerCamelCase							,    __lowerCamelCase					)   -> str:
					a		       =							value.split(__lowerCamelCase					)
					return len(__lowerCamelCase					) > 1 and any((len(__lowerCamelCase					) == 3 for x in split)					)





def 	__A	(			__lowerCamelCase					)   -> int:
					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"""					)
					a		       =							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 	__A	(			__lowerCamelCase					)   -> Dict:
					if answer is None:
										return None
					try:
										a		       =							convert_to_float(__lowerCamelCase					)
										if isinstance(__lowerCamelCase							,    __lowerCamelCase					) and math.isnan(__lowerCamelCase					):
															return None
										return value
					except ValueError:
										return answer.lower()


__UpperCamelCase      : List[Any]					      =   {
    "text": lambda x: x,
    "real": convert_to_float,
}

class 	__lowerCAmelCase			(			enum.Enum				):
							UpperCamelCase__        =						0
							UpperCamelCase__        =						1
							UpperCamelCase__        =						2
							UpperCamelCase__        =						3
							UpperCamelCase__        =						4
							UpperCamelCase__        =						5







class 	__lowerCAmelCase			(			enum.Enum				):
							UpperCamelCase__        =						0
							UpperCamelCase__        =						1
							UpperCamelCase__        =						2







@dataclasses.dataclass
class 	__lowerCAmelCase			:
							UpperCamelCase__        =						42
							UpperCamelCase__        =						42
							UpperCamelCase__        =						42







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





def 	__A	(			__lowerCamelCase					)   -> Tuple:
					return list(_TOKENIZER.findall(x.lower()					)					)





def 	__A	(			__lowerCamelCase							,    __lowerCamelCase							,    __lowerCamelCase					)   -> Tuple:
					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 	__A	(			__lowerCamelCase							,    __lowerCamelCase							,    __lowerCamelCase					)   -> List[Any]:
					a		       =							table["""types"""]
					return _TYPE_CONVERTER[types[column]](__lowerCamelCase					)





def 	__A	(			__lowerCamelCase					)   -> List[str]:
					return isinstance(__lowerCamelCase							,    __lowerCamelCase					)





def 	__A	(			__lowerCamelCase							,    __lowerCamelCase							,    __lowerCamelCase					)   -> Union[str, Any]:
					for cond in conditions:
										a		       =							row[cond.column]

										a		       =							_parse_value(__lowerCamelCase							,    cond.column							,    cond.cmp_value					)

										if _is_string(__lowerCamelCase					) and _is_string(__lowerCamelCase					):
															a		       =							_normalize_for_match(__lowerCamelCase					)
															a		       =							_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 	__A	(			__lowerCamelCase							,    __lowerCamelCase							,    __lowerCamelCase					)   -> str:
					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.
					a		       =							[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 	__A	(			__lowerCamelCase							,    __lowerCamelCase					)   -> Tuple:
					a		       =							sql_query["""agg"""]
					if aggregation_op_index >= 3:
										a		       =							_Aggregation(__lowerCamelCase					)
					else:
										a		       =							_Aggregation.NONE

					a		       =							sql_query["""sel"""]
					a		       =							[
					    _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"""]					)
					]

					a		       =							[]
					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):
										a		       =							{2: min, 1: max}
										a		       =							[(table["""rows"""][i][j], index) for index, (i, j) in enumerate(__lowerCamelCase					)]
										a		       =							functools.reduce(operators[sql_query["""agg"""]]							,    __lowerCamelCase					)

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

					return indices, aggregation_op





def 	__A	(			__lowerCamelCase							,    __lowerCamelCase							,    __lowerCamelCase					)   -> List[str]:
					if float_answer is not None:
										return [str(__lowerCamelCase					)]
					return [str(table["""real_rows"""][r][c]					) for r, c in answer_coordinates]





def 	__A	(			__lowerCamelCase							,    __lowerCamelCase					)   -> List:
					a       ,				a		       =							_get_answer_coordinates(__lowerCamelCase							,    __lowerCamelCase					)
					a		       =							_get_float_answer(__lowerCamelCase							,    __lowerCamelCase							,    __lowerCamelCase					)
					a		       =							_get_answer_text(__lowerCamelCase							,    __lowerCamelCase							,    __lowerCamelCase					)
					# keep the original data the same with TaPas
					if len(__lowerCamelCase					) == 0:
										a		       =							[EMPTY_ANSWER]
					return answer_text







from itertools import combinations, product





def 	__A	(			__lowerCamelCase							,    __lowerCamelCase							,    __lowerCamelCase							,    __lowerCamelCase					)   -> bool:
	if xa == ya == 0 or xa == ya == 0:
		return False
	a		       =							xa * xa + ya * ya
	a		       =							xa * xa + ya * ya
	a		       =							(xa - xa) * (xa - xa) + (ya - ya) * (ya - ya)
	return (
	    a_square + b_square == c_square
	    or a_square + c_square == b_square
	    or b_square + c_square == a_square
	)





def 	__A	(			__lowerCamelCase = 50					)   -> int:
	return sum(
	    1
	    for pta, pta in combinations(product(range(limit + 1					)							,    repeat=2					)							,    2					)
	    if is_right(*__lowerCamelCase							,    *__lowerCamelCase					)					)


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

