




"""simple docstring"""




from __future__ import annotations



def        a__					(							snake_case__			,					snake_case__							)		->   int:
			print(F'Vertex\tShortest Distance from vertex {src}'							)
			for i, d in enumerate(snake_case__							):
						print(F'{i}\t\t{d}'							)



def        a__					(							snake_case__			,					snake_case__			,					snake_case__							)		->   Any:
			for j in range(snake_case__							):
						lowerCamelCase ,  lowerCamelCase ,  lowerCamelCase      =   (graph[j][k] for k in ["""src""", """dst""", """weight"""])
						if distance[u] != float("""inf"""							) and distance[u] + w < distance[v]:
									return True
			return False



def        a__					(							snake_case__			,					snake_case__			,					snake_case__			,					snake_case__							)		->   list[float]:
			lowerCamelCase      =   [float("""inf"""							)] * vertex_count
			lowerCamelCase      =   0.0

			for _ in range(vertex_count - 1							):
						for j in range(snake_case__							):
									lowerCamelCase ,  lowerCamelCase ,  lowerCamelCase      =   (graph[j][k] for k in ["""src""", """dst""", """weight"""])

									if distance[u] != float("""inf"""							) and distance[u] + w < distance[v]:
												lowerCamelCase      =   distance[u] + w

			lowerCamelCase      =   check_negative_cycle(snake_case__			,					snake_case__			,					snake_case__							)
			if negative_cycle_exists:
						raise Exception("""Negative cycle found"""							)

			return distance


if __name__ == "__main__":
					import doctest

					doctest.testmod()

					lowerCAmelCase				:     List[str]					=				int(input("""Enter number of vertices: """).strip())
					lowerCAmelCase				:     Union[str, Any]					=				int(input("""Enter number of edges: """).strip())

					lowerCAmelCase				:     list[dict[str, int]]					=				[{} for _ in range(E)]

					for i in range(E):
										print("""Edge """, i + 1)
										lowerCAmelCase				,		lowerCAmelCase				,		lowerCAmelCase				:     List[str]					=				(
										    int(x)
										    for x in input("""Enter source, destination, weight: """).strip().split(""" """)
										)
										lowerCAmelCase				:     Tuple					=				{"""src""": src, """dst""": dest, """weight""": weight}

					lowerCAmelCase				:     Union[str, Any]					=				int(input("""\nEnter shortest path source:""").strip())
					lowerCAmelCase				:     Dict					=				bellman_ford(graph, V, E, source)
					print_distance(shortest_distance, 0)









"""simple docstring"""




def        a__					(							snake_case__ = 50_00_00_00							)		->   int:
			lowerCamelCase      =   set()
			lowerCamelCase      =   int((limit - 24) ** (1 / 2)							)

			lowerCamelCase      =   set(range(3			,					prime_square_limit + 1			,					2							)							)
			primes.add(2							)
			for p in range(3			,					prime_square_limit + 1			,					2							):
						if p not in primes:
									continue
						primes.difference_update(set(range(p * p			,					prime_square_limit + 1			,					snake_case__							)							)							)

			for primea in primes:
						lowerCamelCase      =   primea * primea
						for primea in primes:
									lowerCamelCase      =   primea * primea * primea
									if square + cube >= limit - 16:
												break
									for primea in primes:
												lowerCamelCase      =   primea * primea * primea * primea
												lowerCamelCase      =   square + cube + tetr
												if total >= limit:
															break
												ret.add(snake_case__							)

			return len(snake_case__							)


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



