input: 
  def kmeans(k: int, data: np.ndarray) -> tuple:
      """
      Perform k-means clustering on data.
      >>> kmeans(2, np.array([[1, 2], [3, 4], [5, 6], [7, 8]]))
      (array([0., 0., 1., 1.]), array([[2., 3.],
                                       [6., 7.]]))
      >>> kmeans(3, np.array([[1, 1], [2, 2], [9, 9], [10, 10], [19, 19], [20, 20]]))
      (array([0., 0., 1., 1., 2., 2.]), array([[ 1.5,  1.5],
                                               [ 9.5,  9.5],
                                               [19.5, 19.5]]))
      """
      centroids = data[np.random.randint(low=0, high=len(data), size=k)]
      prev_centroids = np.zeros(centroids.shape)
  
      clusters = np.zeros(len(data))
      distances = np.zeros((len(data), k))
      
      while not np.allclose(centroids, prev_centroids):
          prev_centroids = centroids
      
          for idx, centroid in enumerate(centroids):
              distances[:, idx] = np.linalg.norm(data - centroid, axis=1)
      
          clusters = np.argmin(distances, axis=1)
      
          for idx in range(k):
              centroids[idx] = np.mean(data[clusters == idx], axis=0)
      
      return clusters, centroids
  
output:     centroids = data[np.random.randint(low=0, high=len(data), size=k)]
      prev_centroids = np.zeros(centroids.shape)
  
      clusters = np.zeros(len(data))
      distances = np.zeros((len(data), k))
      
      while not np.allclose(centroids, prev_centroids):
          prev_centroids = centroids
      
          for idx, centroid in enumerate(centroids):
              distances[:, idx] = np.linalg.norm(data - centroid, axis=1)
      
          clusters = np.argmin(distances, axis=1)
      
          for idx in range(k):
              centroids[idx] = np.mean(data[clusters == idx], axis=0)
      
      return clusters, centroids