You have n clothes and a washer. The washer is large enough to wash all clothes at once. However, we should worry about the color transfer: if we put clothes of different colors in the washer, the dye from one may stain another. Precisely, let r
i , g
i , b
i denote the amount of red, green, blue color of the i-th clothes. When n clothes are washed together, the color transfer c is defined by
ܿ

(r
i - r
%5E2)
+ (g
i - g
%5E2)
+ (b
i - b
where r, g, and b are the averages of

,

, and

, respectively. The i-th clothes with

,

, and

is defined as a point

,

,
)
in 3-dimensional RGB space. You can assume that no three points (clothes) are on a same line and no four points (clothes) are on a same plane in RGB space.
The washer consumes a lot of electricity, and you have to partition n clothes into at most k groups, and run the washer for each group. The total color transfer is the sum of color transfers from each run. Given the color information of n clothes and k, write a program to calculate the minimum total color transfer.