Language: C++

#include <algorithm>
#include <bitset>
#include <cassert>
#include <deque>
#include <fstream>
#include <iostream>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <sstream>
#include <stdio.h>
#include <string>
#include <vector>

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define POW(n) ((n) * (n))
#define ALL(a) (a).begin(), (a).end()
#define dump(v) (cerr << #v << ": " << v << endl)
#define cerr                                                                   \
  if (true)                                                                    \
  cerr

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<unsigned long long> vull;

// ll n = to_T<ll>("114514")
template <class T> T to_T(const string &s) {
  istringstream is(s);
  T res;
  is >> res;
  return res;
}
template <class T> string to_s(const T &a) {
  ostringstream os;
  os << a;
  return os.str();
}

ll N, M;
bool E[10][10];
ll ans;
int end;

void dfs(int n, int flag) {
  if (flag == end) {
    ans++;
    return;
  }

  REP(i, N) if (E[n][i]) {
    if (flag & 0x01 << i)
      continue;
    unsigned char buf = flag + (0x01 << i);
    dfs(i, buf);
  }
}

void solve(long long NN, long long MM, vector<long long> a,
           vector<long long> b) {
  N = NN;
  M = MM;

  REP(i, N) { end += 0x01 << i; }
  // cout << (int)end << endl;

  REP(i, M)
  E[a[i]][b[i]] = E[b[i]][a[i]] = true;

  dfs(0, 1);

  cout << ans << endl;
}

int main() {
  ios::sync_with_stdio(false);
  long long M;
  long long N;
  cin >> N;
  cin >> M;
  vector<long long> a(M - 1 + 1);
  vector<long long> b(M - 1 + 1);
  for (int i = 0; i <= M - 1; i++) {
    cin >> a[i];
    a[i]--;
    cin >> b[i];
    b[i]--;
  }
  solve(N, M, a, b);
  return 0;
}


Compiler output:
a.cc: In function 'void dfs(int, int)':
a.cc:54:15: error: reference to 'end' is ambiguous
   54 |   if (flag == end) {
      |               ^~~
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bitset:52,
                 from a.cc:2:
/usr/include/c++/14/bits/range_access.h:116:37: note: candidates are: 'template<class _Tp> const _Tp* std::end(const valarray<_Tp>&)'
  116 |   template<typename _Tp> const _Tp* end(const valarray<_Tp>&) noexcept;
      |                                     ^~~
/usr/include/c++/14/bits/range_access.h:115:31: note:                 'template<class _Tp> _Tp* std::end(valarray<_Tp>&)'
  115 |   template<typename _Tp> _Tp* end(valarray<_Tp>&) noexcept;
      |                               ^~~
/usr/include/c++/14/bits/range_access.h:106:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])'
  106 |     end(_Tp (&__arr)[_Nm]) noexcept
      |     ^~~
/usr/include/c++/14/bits/range_access.h:85:5: note:                 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&)'
   85 |     end(const _Container& __cont) -> decltype(__cont.end())
      |     ^~~
/usr/include/c++/14/bits/range_access.h:74:5: note:                 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)'
   74 |     end(_Container& __cont) -> decltype(__cont.end())
      |     ^~~
In file included from /usr/include/c++/14/bits/algorithmfwd.h:39,
                 from /usr/include/c++/14/bits/stl_algo.h:59,
                 from /usr/include/c++/14/algorithm:61,
                 from a.cc:1:
/usr/include/c++/14/initializer_list:99:5: note:                 'template<class _Tp> constexpr const _Tp* std::end(initializer_list<_Tp>)'
   99 |     end(initializer_list<_Tp> __ils) noexcept
      |     ^~~
a.cc:51:5: note:                 'int end'
   51 | int end;
      |     ^~~
a.cc: In function 'void solve(long long int, long long int, std::vector<long long int>, std::vector<long long int>)':
a.cc:72:15: error: reference to 'end' is ambiguous
   72 |   REP(i, N) { end += 0x01 << i; }
      |               ^~~
/usr/include/c++/14/bits/range_access.h:116:37: note: candidates are: 'template<class _Tp> const _Tp* std::end(const valarray<_Tp>&)'
  116 |   template<typename _Tp> const _Tp* end(const valarray<_Tp>&) noexcept;
      |                                     ^~~
/usr/include/c++/14/bits/range_access.h:115:31: note:                 'template<class _Tp> _Tp* std::end(valarray<_Tp>&)'
  115 |   template<typename _Tp> _Tp* end(valarray<_Tp>&) noexcept;
      |                               ^~~
/usr/include/c++/14/bits/range_access.h:106:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])'
  106 |     end(_Tp (&__arr)[_Nm]) noexcept
      |     ^~~
/usr/include/c++/14/bits/range_access.h:85:5: note:                 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&)'
   85 |     end(const _Container& __cont) -> decltype(__cont.end())
      |     ^~~
/usr/include/c++/14/bits/range_access.h:74:5: note:                 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)'
   74 |     end(_Container& __cont) -> decltype(__cont.end())
      |     ^~~
/usr/include/c++/14/initializer_list:99:5: note:                 'template<class _Tp> constexpr const _Tp* std::end(initializer_list<_Tp>)'
   99 |     end(initializer_list<_Tp> __ils) noexcept
      |     ^~~
a.cc:51:5: note:                 'int end'
   51 | int end;
      |     ^~~