


from __future__ import annotations

from pathlib import Path







def 	A (		A__		,		A__			):
     return pointa[0] * pointa[1] - pointa[1] * pointa[0]







def 	A (		A__		,		A__		,		A__		,		A__		,		A__		,		A__			):
     UpperCAmelCase    :					Optional[Any]			=      (xa, ya)
     UpperCAmelCase    :					List[Any]			=      (xa - xa, ya - ya)
     UpperCAmelCase    :					Optional[int]			=      (xa - xa, ya - ya)
     UpperCAmelCase    :					Dict			=      -vector_product(UpperCamelCase_		,		UpperCamelCase_			) / vector_product(
         UpperCamelCase_		,		UpperCamelCase_			)
     UpperCAmelCase    :					Any			=      +vector_product(UpperCamelCase_		,		UpperCamelCase_			) / vector_product(
         UpperCamelCase_		,		UpperCamelCase_			)

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







def 	A (		A__ = "p102_triangles.txt"			):
     UpperCAmelCase    :					List[Any]			=      Path(UpperCamelCase_			).parent.joinpath(UpperCamelCase_			).read_text(encoding="utf-8"			)

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

     UpperCAmelCase    :					str			=      0
     UpperCAmelCase    :					Any			=      4_2

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

     return ret


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











"""simple docstring"""




from __future__ import annotations






def 							lowerCAmelCase			(   UpperCamelCase_:				int  ,			UpperCamelCase_:				int  ,			UpperCamelCase_:				int       )							->				tuple[float, float]:







  '''simple docstring'''







  assert (
      c % greatest_common_divisor(UpperCamelCase_  ,			UpperCamelCase_       ) == 0
  )  # greatest_common_divisor(a,b) function implemented below
  ((_a)      ,						(_a)      ,						(_a))					      =						extended_gcd(UpperCamelCase_  ,			UpperCamelCase_       )  # extended_gcd(a,b) function implemented below
  _a					      =						c / d
  return (r * x, r * y)






def 							lowerCAmelCase			(   UpperCamelCase_:				int  ,			UpperCamelCase_:				int  ,			UpperCamelCase_:				int  ,			UpperCamelCase_:				int = 2       )							->				None:







  '''simple docstring'''







  ((_a)      ,						(_a))					      =						diophantine(UpperCamelCase_  ,			UpperCamelCase_  ,			UpperCamelCase_       )  # Initial value
  _a					      =						greatest_common_divisor(UpperCamelCase_  ,			UpperCamelCase_       )
  _a					      =						a // d
  _a					      =						b // d

  for i in range(UpperCamelCase_       ):
    _a					      =						xa + i * q
    _a					      =						ya - i * p
    print(UpperCamelCase_  ,			UpperCamelCase_       )






def 							lowerCAmelCase			(   UpperCamelCase_:				int  ,			UpperCamelCase_:				int       )							->				int:







  '''simple docstring'''







  if a < b:
    _a      ,						_a					      =						b, a

  while a % b != 0:
    _a      ,						_a					      =						b, a % b

  return b






def 							lowerCAmelCase			(   UpperCamelCase_:				int  ,			UpperCamelCase_:				int       )							->				tuple[int, int, int]:







  '''simple docstring'''







  assert a >= 0 and b >= 0

  if b == 0:
    _a      ,						_a      ,						_a					      =						a, 1, 0
  else:
    ((_a)      ,						(_a)      ,						(_a))					      =						extended_gcd(UpperCamelCase_  ,			a % b       )
    _a					      =						q
    _a					      =						p - q * (a // b)

  assert a % d == 0 and b % d == 0
  assert d == a * x + b * y

  return (d, x, y)


if __name__ == "__main__":
     from doctest import testmod

     testmod(name="""diophantine""", verbose=True)
     testmod(name="""diophantine_all_soln""", verbose=True)
     testmod(name="""extended_gcd""", verbose=True)
     testmod(name="""greatest_common_divisor""", verbose=True)


