func_code_string: #include <bits/stdc++.h>   using namespace std;   long long M = 1e9 + 7;   const int N = 3e5 + 7;   const int K = 5e3 + 7;   int n, k;   int a[N];   int dp[K][K];   int main() {     scanf( %d%d , &n, &k);     for (int i = 1; i <= n; i++) scanf( %d , &a[i]);     sort(a + 1, a + n + 1);     int top = (n + k - 1) / k;     int low = n / k;     int ctop = n % k;     int clow = k - ctop;     for (int i = 0; i < K; i++)       for (int j = 0; j < K; j++) dp[i][j] = -1;     dp[0][0] = 0;     for (int i = 0; i <= ctop; i++)       for (int j = 0; j <= clow; j++)         if (i || j) {           dp[i][j] = 2e9 + 7;           int pnt = i * top + j * low;           if (j) dp[i][j] = dp[i][j - 1] + a[pnt] - a[pnt - low + 1];           if (i)             dp[i][j] = min(dp[i][j], dp[i - 1][j] + a[pnt] - a[pnt - top + 1]);         }     cout << dp[ctop][clow];     return 0;   }   