

'''simple docstring'''







from collections import OrderedDict
from dataclasses import fields
from typing import Any, Tuple

import numpy as np

from .import_utils import is_torch_available






def 					_SCREAMING_SNAKE_CASE		(						snake_case_	):
	if is_torch_available():
		import torch

		if isinstance(snake_case_							,       torch.Tensor	):
			return True

	return isinstance(snake_case_							,       np.ndarray	)





class 					__a   (		_snake_case  ):

						def 	_UpperCAmelCase							(		self	:						Dict)						->Any:

							"""simple docstring"""



							_lowercase							=     fields(self)

							# Safety and consistency checks
							if not len(lowercase__):
								raise ValueError(f"""{self.__class__.__name__} has no fields.""")

							_lowercase							=     getattr(self    ,			class_fields[0].name)
							_lowercase							=     all(getattr(self    ,			field.name) is None for field in class_fields[1:])

							if other_fields_are_none and isinstance(lowercase__    ,			lowercase__):
								for key, value in first_field.items():
									_lowercase							=     value
							else:
								for field in class_fields:
									_lowercase							=     getattr(self    ,			field.name)
									if v is not None:
										_lowercase							=     v

						def __delitem__(		self	:						Tuple    ,			*lowercase__	:						int    ,			**lowercase__	:						Optional[int])						->Union[str, Any]:

							"""simple docstring"""



							raise Exception(f"""You cannot use ``__delitem__`` on a {self.__class__.__name__} instance.""")

						def 	_UpperCAmelCase							(		self	:						Optional[int]    ,			*lowercase__	:						Dict    ,			**lowercase__	:						Optional[Any])						->int:

							"""simple docstring"""



							raise Exception(f"""You cannot use ``setdefault`` on a {self.__class__.__name__} instance.""")

						def 	_UpperCAmelCase							(		self	:						int    ,			*lowercase__	:						Tuple    ,			**lowercase__	:						Optional[Any])						->Tuple:

							"""simple docstring"""



							raise Exception(f"""You cannot use ``pop`` on a {self.__class__.__name__} instance.""")

						def 	_UpperCAmelCase							(		self	:						str    ,			*lowercase__	:						Optional[int]    ,			**lowercase__	:						Optional[Any])						->List[str]:

							"""simple docstring"""



							raise Exception(f"""You cannot use ``update`` on a {self.__class__.__name__} instance.""")

						def __getitem__(		self	:						List[str]    ,			lowercase__	:						Tuple)						->List[Any]:

							"""simple docstring"""



							if isinstance(lowercase__    ,			lowercase__):
								_lowercase							=     dict(self.items())
								return inner_dict[k]
							else:
								return self.to_tuple()[k]

						def __setattr__(		self	:						Tuple    ,			lowercase__	:						List[Any]    ,			lowercase__	:						Dict)						->List[str]:

							"""simple docstring"""



							if name in self.keys() and value is not None:
								# Don't call self.__setitem__ to avoid recursion errors
								super().__setitem__(lowercase__    ,			lowercase__)
							super().__setattr__(lowercase__    ,			lowercase__)

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

							"""simple docstring"""



							super().__setitem__(lowercase__    ,			lowercase__)
							# Don't call self.__setattr__ to avoid recursion errors
							super().__setattr__(lowercase__    ,			lowercase__)


						def 	_UpperCAmelCase							(		self	:						int)						->Tuple[Any]:

							"""simple docstring"""



							return tuple(self[k] for k in self.keys())







'''simple docstring'''







from __future__ import annotations

from pathlib import Path






def 					_SCREAMING_SNAKE_CASE		(						snake_case_							,       snake_case_	):
	return pointa[0] * pointa[1] - pointa[1] * pointa[0]






def 					_SCREAMING_SNAKE_CASE		(						snake_case_							,       snake_case_							,       snake_case_							,       snake_case_							,       snake_case_							,       snake_case_	):
	_lowercase							=     (xa, ya)
	_lowercase							=     (xa - xa, ya - ya)
	_lowercase							=     (xa - xa, ya - ya)
	_lowercase							=     -vector_product(snake_case_							,       snake_case_	) / vector_product(
	    snake_case_							,       snake_case_	)
	_lowercase							=     +vector_product(snake_case_							,       snake_case_	) / vector_product(
	    snake_case_							,       snake_case_	)

	return a > 0 and b > 0 and a + b < 1






def 					_SCREAMING_SNAKE_CASE		(						snake_case_ = "p102_triangles.txt"	):
	_lowercase							=     Path(snake_case_	).parent.joinpath(snake_case_	).read_text(encoding="""utf-8"""	)

	_lowercase							=     []
	for line in data.strip().split("""\n"""	):
		triangles.append([int(snake_case_	) for number in line.split(""","""	)]	)

	_lowercase							=     0
	_lowercase							=     42

	for triangle in triangles:
		ret += contains_origin(*snake_case_	)

	return ret


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




