Language: C++

#define rep(i,n) for (int i=0; i<(int)(n); i++)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int n, c, k; cin >> n >> c >> k;
  priority_queue<int, vector<int>, greater<int>> arrival;
  priority_queue<int, vector<int>, greater<int>> limit;
  int ans = 0;
  rep(i,n) {
    int t; cin >> t;
    arrival.push(t);
    limit.push(t+k);
  }
  int now = 0;
  queue<int> train;
  while(!arrival.empty()) {
    now++;
    while(now == arrival.top()) {
      if (!arrival.empty() && train.size() < c) {
        train.push(arrival.top());
        arrival.pop();
      } else break;
    }
    if (now == limit.top() || train.size() >= c) {
      ans++;
      while(!train.empty()) {
        train.pop();
        limit.pop();
      }
    }
  }
  if (!train.empty()) {
    train.pop();
    ans++;
  }
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc:5:11: error: 'pair' does not name a type
    5 | using P = pair<int, int>;
      |           ^~~~
a.cc: In function 'int main()':
a.cc:8:16: error: 'cin' was not declared in this scope
    8 |   int n, c, k; cin >> n >> c >> k;
      |                ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | #define rep(i,n) for (int i=0; i<(int)(n); i++)
a.cc:9:3: error: 'priority_queue' was not declared in this scope
    9 |   priority_queue<int, vector<int>, greater<int>> arrival;
      |   ^~~~~~~~~~~~~~
a.cc:1:1: note: 'std::priority_queue' is defined in header '<queue>'; this is probably fixable by adding '#include <queue>'
  +++ |+#include <queue>
    1 | #define rep(i,n) for (int i=0; i<(int)(n); i++)
a.cc:9:18: error: expected primary-expression before 'int'
    9 |   priority_queue<int, vector<int>, greater<int>> arrival;
      |                  ^~~
a.cc:10:18: error: expected primary-expression before 'int'
   10 |   priority_queue<int, vector<int>, greater<int>> limit;
      |                  ^~~
a.cc:14:5: error: 'arrival' was not declared in this scope
   14 |     arrival.push(t);
      |     ^~~~~~~
a.cc:15:5: error: 'limit' was not declared in this scope
   15 |     limit.push(t+k);
      |     ^~~~~
a.cc:18:3: error: 'queue' was not declared in this scope
   18 |   queue<int> train;
      |   ^~~~~
a.cc:18:3: note: 'std::queue' is defined in header '<queue>'; this is probably fixable by adding '#include <queue>'
a.cc:18:9: error: expected primary-expression before 'int'
   18 |   queue<int> train;
      |         ^~~
a.cc:19:10: error: 'arrival' was not declared in this scope
   19 |   while(!arrival.empty()) {
      |          ^~~~~~~
a.cc:22:31: error: 'train' was not declared in this scope
   22 |       if (!arrival.empty() && train.size() < c) {
      |                               ^~~~~
a.cc:27:16: error: 'limit' was not declared in this scope
   27 |     if (now == limit.top() || train.size() >= c) {
      |                ^~~~~
a.cc:27:31: error: 'train' was not declared in this scope
   27 |     if (now == limit.top() || train.size() >= c) {
      |                               ^~~~~
a.cc:35:8: error: 'train' was not declared in this scope
   35 |   if (!train.empty()) {
      |        ^~~~~
a.cc:39:3: error: 'cout' was not declared in this scope
   39 |   cout << ans << endl;
      |   ^~~~
a.cc:39:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:39:18: error: 'endl' was not declared in this scope
   39 |   cout << ans << endl;
      |                  ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | #define rep(i,n) for (int i=0; i<(int)(n); i++)