input: def kmeans(k: int, data: np.ndarray) -> (np.ndarray, np.ndarray):
      """
      Perform k-means clustering on data
      >>> kmeans(3, np.array([[1, 2], [3, 4], [5, 6], [7, 8]]))
      (array([0., 0., 1., 1.]), array([[1., 2.], [5., 6.]]))
      """
output:     np.random.seed(0)
      centroids = data[np.random.choice(data.shape[0], k, replace=False)]
      labels = np.zeros(data.shape[0])
      
      for _ in range(100):
          distances = np.linalg.norm(data[:, np.newaxis] - centroids, axis=2)
          labels = np.argmin(distances, axis=1)
          new_centroids = np.array([data[labels == i].mean(axis=0) for i in range(k)])
          
          if np.all(centroids == new_centroids):
              break
          centroids = new_centroids
      
      return labels, centroids