




from __future__ import annotations

from pathlib import Path




def       SCREAMING_SNAKE_CASE			( __UpperCamelCase    :		tuple[int, int] ,  __UpperCamelCase    :		tuple[int, int]   )						->							int:
    return pointa[0] * pointa[1] - pointa[1] * pointa[0]




def       SCREAMING_SNAKE_CASE			( __UpperCamelCase    :		int ,  __UpperCamelCase    :		int ,  __UpperCamelCase    :		int ,  __UpperCamelCase    :		int ,  __UpperCamelCase    :		int ,  __UpperCamelCase    :		int   )						->							bool:
    UpperCAmelCase_											=  (xa, ya)
    UpperCAmelCase_											=  (xa - xa, ya - ya)
    UpperCAmelCase_											=  (xa - xa, ya - ya)
    UpperCAmelCase_											=  -vector_product(__UpperCamelCase ,  __UpperCamelCase   ) / vector_product(
        __UpperCamelCase ,  __UpperCamelCase   )
    UpperCAmelCase_											=  +vector_product(__UpperCamelCase ,  __UpperCamelCase   ) / vector_product(
        __UpperCamelCase ,  __UpperCamelCase   )

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




def       SCREAMING_SNAKE_CASE			( __UpperCamelCase    :		str = "p102_triangles.txt"   )						->							int:
    UpperCAmelCase_											=  Path(__UpperCamelCase   ).parent.joinpath(__UpperCamelCase   ).read_text(encoding='''utf-8'''   )

    UpperCAmelCase_											=  []
    for line in data.strip().split('''\n'''   ):
        triangles.append([int(__UpperCamelCase   ) for number in line.split(''','''   )]   )

    UpperCAmelCase_											=  0
    UpperCAmelCase_											=  42

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

    return ret


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











_lowerCamelCase    				=		10_00




def       SCREAMING_SNAKE_CASE			( __UpperCamelCase    :		float   )						->							float:
    return x * x




def       SCREAMING_SNAKE_CASE			( __UpperCamelCase    :		Optional[int] ,  __UpperCamelCase    :		float ,  __UpperCamelCase    :		float ,  __UpperCamelCase    :		int = 4   )						->							float:
    assert callable(
        __UpperCamelCase   ), f'the function(object) passed should be callable your input : {function}'
    assert isinstance(__UpperCamelCase ,  (float, int)   ), f'a should be float or integer your input : {a}'
    assert isinstance(function(__UpperCamelCase   ) ,  (float, int)   ), (
        "the function should return integer or float return type of your function, "
        f'{type(__UpperCamelCase   )}'
    )
    assert isinstance(__UpperCamelCase ,  (float, int)   ), f'b should be float or integer your input : {b}'
    assert (
        isinstance(__UpperCamelCase ,  __UpperCamelCase   ) and precision > 0
    ), f'precision should be positive integer your input : {precision}'

    # just applying the formula of simpson for approximate integration written in
    # mentioned article in first comment of this file and above this function

    UpperCAmelCase_											=  (b - a) / N_STEPS
    UpperCAmelCase_											=  function(__UpperCamelCase   ) + function(__UpperCamelCase   )

    for i in range(1 ,  __UpperCamelCase   ):
        UpperCAmelCase_											=  a + h * i
        result += function(__UpperCamelCase   ) * (4 if i % 2 else 2)

    result *= h / 3
    return round(__UpperCamelCase ,  __UpperCamelCase   )


if __name__ == "__main__":
 import doctest

 doctest.testmod()





