func_code_string: #include <bits/stdc++.h>   using namespace std;   void init_code() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);   }   long long dp[5002][5002];   long long solve(vector<long long>& v, long long k, long long n, long long idx) {     if (k == 0) return 0;     if (idx >= n) return 0;     if (dp[idx][k] != -1) return dp[idx][k];     auto i = (upper_bound(v.begin(), v.end(), v[idx] + 5) - v.begin());     long long cnt = i - idx;     long long temp = solve(v, k - 1, n, i) + cnt;     temp = max(temp, solve(v, k, n, idx + 1));     dp[idx][k] = temp;     return temp;   }   void solve() {     long long n, k;     cin >> n >> k;     vector<long long> v(n);     for (long long i = 0; i < n; i++) cin >> v[i];     sort(v.begin(), v.end());     memset(dp, -1, sizeof(dp));     cout << solve(v, k, n, 0);   }   signed main() {     init_code();     long long tc = 1;     long long num = 1;     while (tc--) {       num++;       solve();     }   }   