func_code_string: #include <bits/stdc++.h>   const int offs = 350;   int n, d, f[30005][705], gem[30005];   int main() {     scanf( %d%d , &n, &d);     for (int i = 0, t; i < n; i++) scanf( %d , &t), gem[t]++;     memset(f, -1, sizeof(f));     f[d][offs] = gem[d];     for (int i = d + 1, t; i < 30005; i++)       for (int j = 0; j < 705 - 1; j++)         if ((t = d + j - offs) > 0 && (i - t >= 0)) {           if (t - 1 > 0 && ~f[i - t][j - 1])             f[i][j] = std::max(f[i][j], f[i - t][j - 1]);           if (~f[i - t][j]) f[i][j] = std::max(f[i][j], f[i - t][j]);           if (~f[i - t][j + 1]) f[i][j] = std::max(f[i][j], f[i - t][j + 1]);           if (~f[i][j]) f[i][j] += gem[i];         }     int ans = 0;     for (int i = 0; i < 30005; i++)       for (int j = 0; j < 705; j++) ans = std::max(ans, f[i][j]);     printf( %d n , ans);     return 0;   }   