



'''simple docstring'''

from __future__ import annotations

from queue import Queue

class __snake_case:


						'''simple docstring'''



						def __init__(					self      )	->	None:
							lowerCAmelCase    =	{}


						def 				__snake_case    (					self      )	->	None:
							for i in self.vertices:
								print(A_	,       """ : """	,       """ -> """.join([str(A_      ) for j in self.vertices[i]]      )      )


						def 				__snake_case    (					self	,       A_	,       A_      )	->	None:
							if from_vertex in self.vertices:
								self.vertices[from_vertex].append(A_      )
							else:
								lowerCAmelCase    =	[to_vertex]




						def 				__snake_case    (					self	,       A_      )	->	set[int]:
							lowerCAmelCase    =	set()

							# create a first in first out queue to store all the vertices for BFS
							lowerCAmelCase    =	Queue()

							# mark the source node as visited and enqueue it
							visited.add(A_      )
							queue.put(A_      )

							while not queue.empty():
								lowerCAmelCase    =	queue.get()

								# loop through all adjacent vertex and enqueue it if not yet visited
								for adjacent_vertex in self.vertices[vertex]:
									if adjacent_vertex not in visited:
										queue.put(A_      )
										visited.add(A_      )
							return visited


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

				testmod(verbose=True)

				UpperCAmelCase			=    Graph()
				g.add_edge(0, 1)
				g.add_edge(0, 2)
				g.add_edge(1, 2)
				g.add_edge(2, 0)
				g.add_edge(2, 3)
				g.add_edge(3, 3)

				g.print_graph()
				# 0  :  1 -> 2
				# 1  :  2
				# 2  :  0 -> 3
				# 3  :  3

				assert sorted(g.bfs(2)) == [0, 1, 2, 3]




'''simple docstring'''

from __future__ import annotations

from pathlib import Path






def 		_snake_case		(					_SCREAMING_SNAKE_CASE     :						tuple[int, int]							,		_SCREAMING_SNAKE_CASE     :						tuple[int, int]							)			->						int:







	"""simple docstring"""
	return pointa[0] * pointa[1] - pointa[1] * pointa[0]






def 		_snake_case		(					_SCREAMING_SNAKE_CASE     :						int							,		_SCREAMING_SNAKE_CASE     :						int							,		_SCREAMING_SNAKE_CASE     :						int							,		_SCREAMING_SNAKE_CASE     :						int							,		_SCREAMING_SNAKE_CASE     :						int							,		_SCREAMING_SNAKE_CASE     :						int							)			->						bool:







	"""simple docstring"""
	lowerCAmelCase    =	(xa, ya)
	lowerCAmelCase    =	(xa - xa, ya - ya)
	lowerCAmelCase    =	(xa - xa, ya - ya)
	lowerCAmelCase    =	-vector_product(_SCREAMING_SNAKE_CASE							,		_SCREAMING_SNAKE_CASE							) / vector_product(
	    _SCREAMING_SNAKE_CASE							,		_SCREAMING_SNAKE_CASE							)
	lowerCAmelCase    =	+vector_product(_SCREAMING_SNAKE_CASE							,		_SCREAMING_SNAKE_CASE							) / vector_product(
	    _SCREAMING_SNAKE_CASE							,		_SCREAMING_SNAKE_CASE							)

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






def 		_snake_case		(					_SCREAMING_SNAKE_CASE     :						str = "p102_triangles.txt"							)			->						int:







	"""simple docstring"""
	lowerCAmelCase    =	Path(_SCREAMING_SNAKE_CASE							).parent.joinpath(_SCREAMING_SNAKE_CASE							).read_text(encoding="""utf-8"""							)

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

	lowerCAmelCase    =	0
	lowerCAmelCase    =	42

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

	return ret


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