Language: C++

#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>

#define rep(i, n) for(int i=0;i<n;i++)

typedef int long long ll;
using namespace std;
typedef pair<int, int> P;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const ll MOD = 1e9 + 7;
static const int MAX = 100;
static const int INF = (1 << 23);

int main() {
    ll n,c,k;
    cin>>n>>c>>k;
    vector<ll> t(n);
    rep(i,n){cin>>t[i];t[i]+=c; }
    sort(t.begin(),t.end());
    ll ans = 0;
    ll no = 0;
    ll ma = 0;
    for(int i=0;i<n;i++){
        if(no==0){
            ma=t[i];
            ans++;
            no++;
        }else if(t[i]-c<=ma&&no<k){
            no++;
        }else{
            no=0;
            i--;
        }
    }
    if(no!=0)ans++;
    cout<<ans<<endl;




    return 0;
}
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>

#define rep(i, n) for(int i=0;i<n;i++)

typedef int long long ll;
using namespace std;
typedef pair<int, int> P;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const ll MOD = 1e9 + 7;
static const int MAX = 100;
static const int INF = (1 << 23);

int main() {
    ll n,c,k;
    cin>>n>>c>>k;
    vector<ll> t(n);
    rep(i,n){cin>>t[i];t[i]+=c; }
    sort(t.begin(),t.end());
    ll ans = 0;
    ll no = 0;
    ll ma = 0;
    for(int i=0;i<n;i++){
        if(no==0){
            ma=t[i];
            ans++;
            no++;
        }else if(t[i]-c<=ma&&no<k){
            no++;
        }else{
            no=0;
            i--;
        }
    }
    if(no!=0)ans++;
    cout<<ans<<endl;




    return 0;
}


Compiler output:
a.cc:76:5: error: redefinition of 'int dx [4]'
   76 | int dx[4] = {1, 0, -1, 0};
      |     ^~
a.cc:21:5: note: 'int dx [4]' previously defined here
   21 | int dx[4] = {1, 0, -1, 0};
      |     ^~
a.cc:77:5: error: redefinition of 'int dy [4]'
   77 | int dy[4] = {0, 1, 0, -1};
      |     ^~
a.cc:22:5: note: 'int dy [4]' previously defined here
   22 | int dy[4] = {0, 1, 0, -1};
      |     ^~
a.cc:78:10: error: redefinition of 'const ll MOD'
   78 | const ll MOD = 1e9 + 7;
      |          ^~~
a.cc:23:10: note: 'const ll MOD' previously defined here
   23 | const ll MOD = 1e9 + 7;
      |          ^~~
a.cc:79:18: error: redefinition of 'const int MAX'
   79 | static const int MAX = 100;
      |                  ^~~
a.cc:24:18: note: 'const int MAX' previously defined here
   24 | static const int MAX = 100;
      |                  ^~~
a.cc:80:18: error: redefinition of 'const int INF'
   80 | static const int INF = (1 << 23);
      |                  ^~~
a.cc:25:18: note: 'const int INF' previously defined here
   25 | static const int INF = (1 << 23);
      |                  ^~~
a.cc:82:5: error: redefinition of 'int main()'
   82 | int main() {
      |     ^~~~
a.cc:27:5: note: 'int main()' previously defined here
   27 | int main() {
      |     ^~~~