Language: C++

#include <iostream>
#include <vector>



int main()
{
    int N, M;
    std::cin >> N >> M;
    std::vector<long long> dp(N, 0);

    int a;
    for (int i = 0; i < M; i++) {
        std::cin >> a;
        dp[a] = -1;
    }
    
    if (dp[N-1] == 0) {
        dp[N-1] = 1;
        if (a.find(N-2) == std::end(a)) {
            dp[N-1] = 2;
        }
    }
    else {
        if (a.find(N-2) == std::end(a)) {
            dp[N-1] = 1;
        }
        else {
            dp[N-1] = 0;
        }
    }

    for (int i = N-1; i <= 0; i--) {
        if (dp[i] == -1) continue;

        if (i + 1 < N && dp[i+1] != -1) {
            dp[i] += dp[i+1];
        }

        if (i + 2 < N && dp[i+2] != -1) {
            dp[i] += dp[i+2];
        } 
    }

    long long ans = dp[0] % 1000000007;

    std::cout << ans << std::endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:15: error: request for member 'find' in 'a', which is of non-class type 'int'
   20 |         if (a.find(N-2) == std::end(a)) {
      |               ^~~~
a.cc:20:36: error: no matching function for call to 'end(int&)'
   20 |         if (a.find(N-2) == std::end(a)) {
      |                            ~~~~~~~~^~~
In file included from /usr/include/c++/14/bits/range_access.h:36,
                 from /usr/include/c++/14/string:53,
                 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/initializer_list:99:5: note: candidate: 'template<class _Tp> constexpr const _Tp* std::end(initializer_list<_Tp>)'
   99 |     end(initializer_list<_Tp> __ils) noexcept
      |     ^~~
/usr/include/c++/14/initializer_list:99:5: note:   template argument deduction/substitution failed:
a.cc:20:36: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   20 |         if (a.find(N-2) == std::end(a)) {
      |                            ~~~~~~~~^~~
/usr/include/c++/14/bits/range_access.h:74:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)'
   74 |     end(_Container& __cont) -> decltype(__cont.end())
      |     ^~~
/usr/include/c++/14/bits/range_access.h:74:5: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/range_access.h: In substitution of 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&) [with _Container = int]':
a.cc:20:36:   required from here
   20 |         if (a.find(N-2) == std::end(a)) {
      |                            ~~~~~~~~^~~
/usr/include/c++/14/bits/range_access.h:74:48: error: request for member 'end' in '__cont', which is of non-class type 'int'
   74 |     end(_Container& __cont) -> decltype(__cont.end())
      |                                         ~~~~~~~^~~
/usr/include/c++/14/bits/range_access.h:85:5: note: candidate: '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:85:5: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/range_access.h: In substitution of 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&) [with _Container = int]':
a.cc:20:36:   required from here
   20 |         if (a.find(N-2) == std::end(a)) {
      |                            ~~~~~~~~^~~
/usr/include/c++/14/bits/range_access.h:85:54: error: request for member 'end' in '__cont', which is of non-class type 'const int'
   85 |     end(const _Container& __cont) -> decltype(__cont.end())
      |                                               ~~~~~~~^~~
/usr/include/c++/14/bits/range_access.h:106:5: note: candidate: '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:106:5: note:   template argument deduction/substitution failed:
a.cc:20:36: note:   mismatched types '_Tp [_Nm]' and 'int'
   20 |         if (a.find(N-2) == std::end(a)) {
      |                            ~~~~~~~~^~~
/usr/include/c++/14/bits/range_access.h:115:31: note: candidate: '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:115:31: note:   template argument deduction/substitution failed:
a.cc:20:36: note:   mismatched types 'std::valarray<_Tp>' and 'int'
   20 |         if (a.find(N-2) == std::end(a)) {
      |                            ~~~~~~~~^~~
/usr/include/c++/14/bits/range_access.h:116:37: note: candidate: '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:116:37: note:   template argument deduction/substitution failed:
a.cc:20:36: note:   mismatched types 'const std::valarray<_Tp>' and 'int'
   20 |         if (a.find(N-2) == std::end(a)) {
      |                            ~~~~~~~~^~~
a.cc:25:15: error: request for member 'find' in 'a', which is of non-class type 'int'
   25 |         if (a.find(N-2) == std::end(a)) {
      |               ^~~~
a.cc:25:36: error: no matching function for call to 'end(int&)'
   25 |         if (a.find(N-2) == std::end(a)) {
      |                            ~~~~~~~~^~~
/usr/include/c++/14/initializer_list:99:5: note: candidate: 'template<class _Tp> constexpr const _Tp* std::end(initializer_list<_Tp>)'
   99 |     end(initializer_list<_Tp> __ils) noexcept
      |     ^~~
/usr/include/c++/14/initializer_list:99:5: note:   template argument deduction/substitution failed:
a.cc:25:36: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   25 |         if (a.find(N-2) == std::end(a)) {
      |                            ~~~~~~~~^~~
/usr/include/c++/14/bits/range_access.h:74:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)'
   74 |     end(_Container& __cont) -> decltype(__cont.end())
      |     ^~~
/usr/include/c++/14/bits/range_access.h:74:5: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/range_access.h: In substitution of 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&) [with _Container = int]':
a.cc:25:36:   required from here
   25 |         if (a.find(N-2) == std::end(a)) {
      |                            ~~~~~~~~^~~
/usr/include/c++/14/bits/range_access.h:74:48: error: request for member 'end' in '__cont', which is of non-class type 'int'
   74 |     end(_Container& __cont) -> decltype(__cont.end())
      |                                         ~~~~~~~^~~
/usr/include/c++/14/bits/range_access.h:85:5: note: candidate: '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:85:5: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/range_access.h: In substitution of 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&) [with _Container = int]':
a.cc:25:36:   required from here
   25 |         if (a.find(N-2) == std::end(a)) {
      |                            ~~~~~~~~^~~
/usr/include/c++/14/bits/range_access.h:85:54: error: request for member 'end' in '__cont', which is of non-class type 'const int'
   85 |     end(const _Container& __cont) -> decltype(__cont.end())
      |                                               ~~~~~~~^~~
/usr/include/c++/14/bits/range_access.h:106:5: note: candidate: '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:106:5: note:   template argument deduction/substitution failed:
a.cc:25:36: note:   mismatched types '_Tp [_Nm]' and 'int'
   25 |         if (a.find(N-2) == std::end(a)) {
      |                            ~~~~~~~~^~~
/usr/include/c++/14/bits/range_access.h:115:31: note: candidate: '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:115:31: note:   template argument deduction/substitution failed:
a.cc:25:36: note:   mismatched types 'std::valarray<_Tp>' and 'int'
   25 |         if (a.find(N-2) == std::end(a)) {
      |                            ~~~~~~~~^~~
/usr/include/c++/14/bits/range_access.h:116:37: note: candidate: '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:116:37: note:   template argument deduction/substitution failed:
a.cc:25:36: note:   mismatched types 'const std::valarray<_Tp>' and 'int'
   25 |         if (a.find(N-2) == std::end(a)) {
      |                            ~~~~~~~~^~~