func_code_string: #include <bits/stdc++.h>   using namespace std;   int A[5005], n, k, L[5005][5005], S[5005], E[5005];   void doc() {     scanf( %d%d , &n, &k);     for (int i = 1; i <= n; i++) {       scanf( %d , &A[i]);     }   }   void xuly() {     sort(A + 1, A + n + 1);     for (int i = 1; i <= n; i++) {       S[i] = 1;       E[i] = i;       for (int j = i - 1; j > 0; j--)         if (A[i] - A[j] <= 5) {           S[i]++;           E[i] = j;         } else           break;     }     for (int i = 1; i <= k; i++) {       for (int j = 1; j <= n; j++) {         L[i][j] = max(max(L[i][j - 1], L[i][j]), L[i - 1][E[j] - 1] + S[j]);       }     }     cout << L[k][n];   }   int main() {     doc();     xuly();     return 0;   }   