Language: C++

#include<iostream>
#include<list>
#include<vector>
#include<set>
#include<queue>
using namespace std;

bool C[10000];
int N[10000];
class edge
{
public:
	edge(int _weight, int _i, int _j)
	{
		weight = _weight;
		i = _i;
		j = _j;
	}
	int weight;
	int i, j;
};

inline bool operator==(const edge& e1, const edge& e2)
{
	return (e1.weight == e2.weight && e1.i==e2.i&&e1.j == e2.j);
}


inline bool operator<(const edge& e1, const edge& e2)
{
	if (e1 == e2)return false;
	return 	e1.weight > e2.weight;
}


int main()
{
	for (unsigned int i = 0; i < 10000; i++)
	{
		C[i] = false;
		N[i] = -1;
	}
	int V, E;
	cin >> V >> E;
	priority_queue<edge> S;
	priority_queue<edge> S1;
	for (unsigned int i = 0; i < E; i++)
	{
		int s, t, w;
		cin >> s >> t >> w;
		S.push(edge(w, s, t));
	}
	int count = 0;
	int sum = 0;
	while (!S.empty())
	{
		edge front = S.top();
		if (C[front.i] == false && C[front.j] == false)
		{
			N[front.i] = front.i;
			N[front.j] = front.i;
			sum += front.weight;
			C[front.i] = true;
			C[front.j] = true;
			count+=2;
		}
		else if (C[front.i] == false)
		{
			N[front.i] = N[front.j];
			sum += front.weight;
			C[front.i] = true;
			count++;

		}
		else if (C[front.j] == false)
		{
			N[front.j] = N[front.i];
			sum += front.weight;
			C[front.j] = true;
			count++;
		}
		else
		{
			S1.push(front);
		}
		if (count == E)
		{
			while (!S.empty())
			{
				S1.push(S.top());
				S.pop();
			}
		}
		else S.pop();
	}
	set<int> ignore;
	while (!S1.empty())
	{
		edge front = S1.top();
		if (N[front.i] != N[front.j])
		{
			if (find(ignore.begin(), ignore.end(), N[front.i]) == ignore.end()
				|| find(ignore.begin(), ignore.end(), N[front.j]) == ignore.end())
			{
				sum += front.weight;
				ignore.insert(N[front.j]);
				ignore.insert(N[front.i]);
			}
		}
		S1.pop();
	}
	cout << sum << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:102:33: error: no matching function for call to 'find(std::set<int>::iterator, std::set<int>::iterator, int&)'
  102 |                         if (find(ignore.begin(), ignore.end(), N[front.i]) == ignore.end()
      |                             ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
                 from /usr/include/c++/14/bits/basic_ios.h:37,
                 from /usr/include/c++/14/ios:46,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note:   template argument deduction/substitution failed:
a.cc:102:33: note:   'std::_Rb_tree_const_iterator<int>' is not derived from 'std::istreambuf_iterator<_CharT>'
  102 |                         if (find(ignore.begin(), ignore.end(), N[front.i]) == ignore.end()
      |                             ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:103:40: error: no matching function for call to 'find(std::set<int>::iterator, std::set<int>::iterator, int&)'
  103 |                                 || find(ignore.begin(), ignore.end(), N[front.j]) == ignore.end())
      |                                    ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note:   template argument deduction/substitution failed:
a.cc:103:40: note:   'std::_Rb_tree_const_iterator<int>' is not derived from 'std::istreambuf_iterator<_CharT>'
  103 |                                 || find(ignore.begin(), ignore.end(), N[front.j]) == ignore.end())
      |                                    ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~