Language: C++

#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<utility>
#include<numeric>
#include<vector>
#include<map>
#include<unordered_map>
#include<set>
#include<tuple>
#include<stack>
#include<queue>
#include<functional>
#include<iterator>
#include<cmath>
#include<cctype>

using namespace std;

typedef long long ll;
typedef pair<int,int> P;

const int INF = 1e9;
const ll LINF = 1e18;
const int MOD = INF+7;

struct edge{int to,cost;};
	
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);

	int n,c,k;
	cin >> n >> c >> k;

	int t[n];
	for(int i=0;i<n;i++){
		cin >> t[i];
	}
	sort(t,t+n);
	
	int ans=1,tmp;
	for(int i=0;i<n;){
		auto e=upper_bound(t,t+n,t[i]+k);
		tmp=min(e-(&t[i]),c);
		i+=tmp;
		if(i<=n-1) ans++;
		else break;
		//cout << i << "人目の" << t[i] << "時で" << ans << "台目のバス登場 前のバスは" << tmp <<"人乗った\n";
	}
//	int a=0,i=1;
//	while(true){
//		if(a+i == n) break;
//		if(i<c && t[a]+k>=t[a+i]){
//			i++;
//		}else{
//			ans++;
//			a=a+i;
//			i=1;
//		}
//	}
	cout << ans << "\n";

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:46:24: error: no matching function for call to 'min(long int, int&)'
   46 |                 tmp=min(e-(&t[i]),c);
      |                     ~~~^~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:46:24: note:   deduced conflicting types for parameter 'const _Tp' ('long int' and 'int')
   46 |                 tmp=min(e-(&t[i]),c);
      |                     ~~~^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:4:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:46:24: note:   mismatched types 'std::initializer_list<_Tp>' and 'long int'
   46 |                 tmp=min(e-(&t[i]),c);
      |                     ~~~^~~~~~~~~~~~~