
from random import shuffle

import tensorflow as tf
from numpy import array
def  snake_case_		(    __SCREAMING_SNAKE_CASE :			str				,				__SCREAMING_SNAKE_CASE :			List[str]							):



						"""simple docstring"""





						lowercase_     :					Optional[int]													=	int(lowercase_							)
						assert noofclusters < len(lowercase_							)

						# Find out the dimensionality
						lowercase_     :					Optional[Any]													=	len(vectors[0]							)

						# Will help select random centroids from among the available vectors
						lowercase_     :					List[Any]													=	list(range(len(lowercase_							)							)							)
						shuffle(lowercase_							)

						# GRAPH OF COMPUTATION
						# We initialize a new graph and set it as the default during each run
						# of this algorithm. This ensures that as this function is called
						# multiple times, the default graph doesn't keep getting crowded with
						# unused ops and Variables from previous function calls.

						lowercase_     :					Optional[Any]													=	tf.Graph()

						with graph.as_default():
												# SESSION OF COMPUTATION

												lowercase_     :					Optional[int]													=	tf.Session()

												##CONSTRUCTING THE ELEMENTS OF COMPUTATION

												##First lets ensure we have a Variable vector for each centroid,
												##initialized to one of the vectors from the available data points
												lowercase_     :					Any													=	[
												    tf.Variable(vectors[vector_indices[i]]							) for i in range(lowercase_							)
												]
												##These nodes will assign the centroid Variables the appropriate
												##values
												lowercase_     :					str													=	tf.placeholder('''float64'''				,				[dim]							)
												lowercase_     :					Any													=	[]
												for centroid in centroids:
																		cent_assigns.append(tf.assign(lowercase_				,				lowercase_							)							)

												##Variables for cluster assignments of individual vectors(initialized
												##to 0 at first)
												lowercase_     :					List[Any]													=	[tf.Variable(0							) for i in range(len(lowercase_							)							)]
												##These nodes will assign an assignment Variable the appropriate
												##value
												lowercase_     :					Any													=	tf.placeholder('''int32'''							)
												lowercase_     :					Any													=	[]
												for assignment in assignments:
																		cluster_assigns.append(tf.assign(lowercase_				,				lowercase_							)							)

												##Now lets construct the node that will compute the mean
												# The placeholder for the input
												lowercase_     :					Union[str, Any]													=	tf.placeholder('''float'''				,				[None, dim]							)
												# The Node/op takes the input and computes a mean along the 0th
												# dimension, i.e. the list of input vectors
												lowercase_     :					Tuple													=	tf.reduce_mean(lowercase_				,				0							)

												##Node for computing Euclidean distances
												# Placeholders for input
												lowercase_     :					str													=	tf.placeholder('''float'''				,				[dim]							)
												lowercase_     :					int													=	tf.placeholder('''float'''				,				[dim]							)
												lowercase_     :					Tuple													=	tf.sqrt(tf.reduce_sum(tf.pow(tf.sub(lowercase_				,				lowercase_							)				,				2							)							)							)

												##This node will figure out which cluster to assign a vector to,
												##based on Euclidean distances of the vector from the centroids.
												# Placeholder for input
												lowercase_     :					Optional[Any]													=	tf.placeholder('''float'''				,				[noofclusters]							)
												lowercase_     :					Any													=	tf.argmin(lowercase_				,				0							)

												##INITIALIZING STATE VARIABLES

												##This will help initialization of all Variables defined with respect
												##to the graph. The Variable-initializer should be defined after
												##all the Variables have been constructed, so that each of them
												##will be included in the initialization.
												lowercase_     :					List[str]													=	tf.initialize_all_variables()

												# Initialize all variables
												sess.run(lowercase_							)

												##CLUSTERING ITERATIONS

												# Now perform the Expectation-Maximization steps of K-Means clustering
												# iterations. To keep things simple, we will only do a set number of
												# iterations, instead of using a Stopping Criterion.
												lowercase_     :					Tuple													=	100
												for _ in range(lowercase_							):
																		##EXPECTATION STEP
																		##Based on the centroid locations till last iteration, compute
																		##the _expected_ centroid assignments.
																		# Iterate over each vector
																		for vector_n in range(len(lowercase_							)							):
																								lowercase_     :					Optional[Any]													=	vectors[vector_n]
																								# Compute Euclidean distance between this vector and each
																								# centroid. Remember that this list cannot be named
																								#'centroid_distances', since that is the input to the
																								# cluster assignment node.
																								lowercase_     :					Dict													=	[
																								    sess.run(lowercase_				,				feed_dict={va: vect, va: sess.run(lowercase_							)}							)
																								    for centroid in centroids
																								]
																								# Now use the cluster assignment node, with the distances
																								# as the input
																								lowercase_     :					List[Any]													=	sess.run(
																								    lowercase_				,				feed_dict={centroid_distances: distances}							)
																								# Now assign the value to the appropriate state variable
																								sess.run(
																								    cluster_assigns[vector_n]				,				feed_dict={assignment_value: assignment}							)

																		##MAXIMIZATION STEP
																		# Based on the expected state computed from the Expectation Step,
																		# compute the locations of the centroids so as to maximize the
																		# overall objective of minimizing within-cluster Sum-of-Squares
																		for cluster_n in range(lowercase_							):
																								# Collect all the vectors assigned to this cluster
																								lowercase_     :					int													=	[
																								    vectors[i]
																								    for i in range(len(lowercase_							)							)
																								    if sess.run(assignments[i]							) == cluster_n
																								]
																								# Compute new centroid location
																								lowercase_     :					List[Any]													=	sess.run(
																								    lowercase_				,				feed_dict={mean_input: array(lowercase_							)}							)
																								# Assign value to appropriate variable
																								sess.run(
																								    cent_assigns[cluster_n]				,				feed_dict={centroid_value: new_location}							)

        # Return centroids and assignments
												lowercase_     :					Optional[int]													=	sess.run(lowercase_							)
												lowercase_     :					Optional[int]													=	sess.run(lowercase_							)
												return centroids, assignments





'''simple docstring'''







import sys

_lowercase			:  Union[str, Any]   							=	(
    "73167176531330624919225119674426574742355349194934"
    "96983520312774506326239578318016984801869478851843"
    "85861560789112949495459501737958331952853208805511"
    "12540698747158523863050715693290963295227443043557"
    "66896648950445244523161731856403098711121722383113"
    "62229893423380308135336276614282806444486645238749"
    "30358907296290491560440772390713810515859307960866"
    "70172427121883998797908792274921901699720888093776"
    "65727333001053367881220235421809751254540594752243"
    "52584907711670556013604839586446706324415722155397"
    "53697817977846174064955149290862569321978468622482"
    "83972241375657056057490261407972968652414535100474"
    "82166370484403199890008895243450658541227588666881"
    "16427171479924442928230863465674813919123162824586"
    "17866458359124566529476545682848912883142607690042"
    "24219022671055626321111109370544217506941658960408"
    "07198403850962455444362981230987879927244284909188"
    "84580156166097919133875499200524063689912560717606"
    "05886116467109405077541002256983155200055935729725"
    "71636269561882670428252483600823257530420752963450"
)
def  snake_case_		(    __SCREAMING_SNAKE_CASE :			str							):



						"""simple docstring"""





						lowercase_     :					Any													=	1
						for digit in s:
												product *= int(__SCREAMING_SNAKE_CASE							)
						return product
def  snake_case_		(    __SCREAMING_SNAKE_CASE :			str = N							):



						"""simple docstring"""





						lowercase_     :					Any													=	-sys.maxsize - 1
						lowercase_     :					List[Any]													=	n[:13]
						lowercase_     :					List[str]													=	13
						while cur_index < len(__SCREAMING_SNAKE_CASE							) - 13:
												if int(n[cur_index]							) >= int(substr[0]							):
																		lowercase_     :					Tuple													=	substr[1:] + n[cur_index]
																		cur_index += 1
												else:
																		lowercase_     :					str													=	max(__SCREAMING_SNAKE_CASE				,				str_eval(__SCREAMING_SNAKE_CASE							)							)
																		lowercase_     :					List[Any]													=	n[cur_index : cur_index + 13]
																		cur_index += 13
						return largest_product


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



