func_code_string: #include <bits/stdc++.h>   #pragma warning(disable : 4996)   using namespace std;   long long dyn[5001][5001];   int A[300000];   int main() {     int n, k;     scanf( %d , &(n));     scanf( %d , &(k));     for (int(i) = 0; (i) < n; (i)++) scanf( %d , &(A[i]));     sort(A, A + n);     int rem = n % k;     int q = n / k;     for (int i = 0; i <= k; i++) {       if (i == 0) {         dyn[0][0] = 0;         dyn[0][1] = -1;         continue;       }       int j = min(i, rem);       for (int t = 0; t <= j; t++) {         dyn[i][t] = 2000000000;         if (t > 0) {           dyn[i][t] = min(dyn[i][t], dyn[i - 1][t - 1] + A[i * q + t - 1] -                                          A[(i - 1) * q + t - 1]);         }         if (dyn[i - 1][t] != -1) {           dyn[i][t] = min(dyn[i][t],                           dyn[i - 1][t] + A[i * q + t - 1] - A[(i - 1) * q + t]);         }       }       dyn[i][j + 1] = -1;     }     printf( %I64d , dyn[k][rem]);     return 0;   }   