Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>

using namespace std;

struct node
{
	vector<int> next;

};

int calc(vector<node> &n, int index, vector<bool> &map)
{
	map[index] = true;
	int result = 0;
	if (all_of(map.begin(), map.end(), [](auto &v) {return v; }))
	{
		result = 1;
	}
	for (auto&& v : n[index].next)
	{
		if (!map[v])
			result += calc(n, v, map);

	}
	map[index] = false;
	return result;
}

int main()
{
	int n, m;
	cin >> n >> m;
	vector<node> a(n);
	for (int i = 0; i < m; i++)
	{
		int x, y;
		cin >> x >> y;
		a[x - 1].next.push_back(y - 1);
		a[y - 1].next.push_back(x - 1);
	}
	vector<bool> map(n,false);
	cout << calc(a, 0, map) << endl;
}


Compiler output:
In file included from /usr/include/c++/14/bits/stl_algobase.h:71,
                 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/predefined_ops.h: In instantiation of 'bool __gnu_cxx::__ops::_Iter_negate<_Predicate>::operator()(_Iterator) [with _Iterator = std::_Bit_iterator; _Predicate = calc(std::vector<node>&, int, std::vector<bool>&)::<lambda(auto:1&)>]':
/usr/include/c++/14/bits/stl_algobase.h:2107:14:   required from '_RandomAccessIterator std::__find_if(_RandomAccessIterator, _RandomAccessIterator, _Predicate, random_access_iterator_tag) [with _RandomAccessIterator = _Bit_iterator; _Predicate = __gnu_cxx::__ops::_Iter_negate<calc(std::vector<node>&, int, std::vector<bool>&)::<lambda(auto:1&)> >]'
 2107 |           if (__pred(__first))
      |               ~~~~~~^~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:112:28:   required from '_InputIterator std::__find_if_not(_InputIterator, _InputIterator, _Predicate) [with _InputIterator = _Bit_iterator; _Predicate = __gnu_cxx::__ops::_Iter_pred<calc(std::vector<node>&, int, std::vector<bool>&)::<lambda(auto:1&)> >]'
  112 |       return std::__find_if(__first, __last,
      |              ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
  113 |                             __gnu_cxx::__ops::__negate(__pred),
      |                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  114 |                             std::__iterator_category(__first));
      |                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:471:32:   required from '_IIter std::find_if_not(_IIter, _IIter, _Predicate) [with _IIter = _Bit_iterator; _Predicate = calc(std::vector<node>&, int, std::vector<bool>&)::<lambda(auto:1&)>]'
  471 |       return std::__find_if_not(__first, __last,
      |              ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
  472 |                                 __gnu_cxx::__ops::__pred_iter(__pred));
      |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:411:40:   required from 'bool std::all_of(_IIter, _IIter, _Predicate) [with _IIter = _Bit_iterator; _Predicate = calc(std::vector<node>&, int, std::vector<bool>&)::<lambda(auto:1&)>]'
  411 |     { return __last == std::find_if_not(__first, __last, __pred); }
      |                        ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:18:12:   required from here
   18 |         if (all_of(map.begin(), map.end(), [](auto &v) {return v; }))
      |             ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/predefined_ops.h:395:31: error: no match for call to '(calc(std::vector<node>&, int, std::vector<bool>&)::<lambda(auto:1&)>) (std::_Bit_iterator::reference)'
  395 |         { return !bool(_M_pred(*__it)); }
      |                        ~~~~~~~^~~~~~~
a.cc:18:44: note: candidate: 'calc(std::vector<node>&, int, std::vector<bool>&)::<lambda(auto:1&)> [with auto:1 = std::_Bit_reference]' (near match)
   18 |         if (all_of(map.begin(), map.end(), [](auto &v) {return v; }))
      |                                            ^
a.cc:18:44: note:   conversion of argument 1 would be ill-formed:
/usr/include/c++/14/bits/predefined_ops.h:395:32: error: cannot bind non-const lvalue reference of type 'std::_Bit_reference&' to an rvalue of type 'std::_Bit_iterator::reference'
  395 |         { return !bool(_M_pred(*__it)); }
      |                                ^~~~~