Language: C++

#include<bits/stdc++.h>
using namespace std;
int dist[2000];set<int>p[2000];
vector<pair<int,int>> vec[2000];
int n,m;
bool used2[2000];
set<int>R[2000][2000];
int dst[2000][2000];
vector<int>shor[2000];
void dijkstra(int s){
	for(int i=0;i<2000;i++){dist[i]=999999999;p[i].clear();}
	priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>>Q;
	Q.push(make_pair(0,s));dist[s]=0;
	while(!Q.empty()){
		int a1=Q.top().first,a2=Q.top().second;Q.pop();
		for(int i=0;i<(int)vec[a2].size();i++){
			int to=vec[a2][i].first,cost=vec[a2][i].second;
			if(dist[to]>a1+cost){
				p[to].clear();p[to].insert(a2);
				dist[to]=a1+cost;
				Q.push(make_pair(dist[to],to));
			}
			if(dist[to]==a1+cost && p[to].count(a2)==0){
				p[to].insert(a2);
			}
		}
	}
	for(int i=0;i<2000;i++){
		dst[s][i]=dist[i];
		R[s][i]=p[i];
	}
}
void solve(int s){
	queue<int>Q;
	bool used[2000];for(int i=0;i<2000;i++)used[i]=false;
	for(int i=0;i<(int)shor[s].size();i++){Q.push(shor[s][i]);used[shor[s][i]]=true;}
	while(!Q.empty()){
		int a1=Q.front();Q.pop();
		
		for(auto a2 : R[a1]){
			if(used[a2]==false){used[a2]=true;Q.push(a2);}
		}
	}
	for(int i=1;i<=n;i++){if(used[i]==true)used2[i]=true;}
}
int main(){
	cin>>n>>m;
	for(int i=0;i<m;i++){
		int a,b,c;cin>>a>>b>>c;
		vec[a].push_back(make_pair(b,c));
		vec[b].push_back(make_pair(a,c));
	}
	for(int i=1;i<=n;i++)dijkstra(i);
	int maxn=0;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			maxn=max(maxn,dst[i][j]);
		}
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			if(dst[i][j]==maxn)shor[i].push_back(j);
		}
	}
	for(int i=1;i<=n;i++)solve(i);
	int num=0;
	for(int i=1;i<=n;i++){if(used2[i]==false)num++;}
	cout<<num<<endl;
	for(int i=1;i<=n;i++){if(used2[i]==false)cout<<i<<endl;}
	return 0;
}

Compiler output:
a.cc: In function 'void solve(int)':
a.cc:41:32: error: no match for 'operator[]' (operand types are 'bool [2000]' and 'std::set<int>')
   41 |                         if(used[a2]==false){used[a2]=true;Q.push(a2);}
      |                                ^
a.cc:41:49: error: no match for 'operator[]' (operand types are 'bool [2000]' and 'std::set<int>')
   41 |                         if(used[a2]==false){used[a2]=true;Q.push(a2);}
      |                                                 ^
a.cc:41:65: error: no matching function for call to 'std::queue<int>::push(std::set<int>&)'
   41 |                         if(used[a2]==false){used[a2]=true;Q.push(a2);}
      |                                                           ~~~~~~^~~~
In file included from /usr/include/c++/14/queue:66,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:157,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_queue.h:283:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(const value_type&) [with _Tp = int; _Sequence = std::deque<int, std::allocator<int> >; value_type = int]'
  283 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:283:30: note:   no known conversion for argument 1 from 'std::set<int>' to 'const std::queue<int>::value_type&' {aka 'const int&'}
  283 |       push(const value_type& __x)
      |            ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_queue.h:288:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(value_type&&) [with _Tp = int; _Sequence = std::deque<int, std::allocator<int> >; value_type = int]'
  288 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:288:25: note:   no known conversion for argument 1 from 'std::set<int>' to 'std::queue<int>::value_type&&' {aka 'int&&'}
  288 |       push(value_type&& __x)
      |            ~~~~~~~~~~~~~^~~