Language: C++

#include<bits/stdc++.h>
using namespace std;
int p(int n, int m){ //n P m
  for (int i = n; i = m; i--)
    n *= i;
  return n;
}

int main(){
  int N, M, ans;
  cin >> N >> M;
  vector<int> a(M);
  bool a = true;
  for (int i = 0; i < M; i++){
    cin >> a.at(i);
    if (i != 0){
      if (a.at(i) - a.at(i - 1) == 1)
        a = false;
    }
  }
  if(a = true){
    for (int i = 0; i < M; i++){
      if(i == 0){
        if (a.at(i) % 2 == 0){
          int j; int k = a.at(i) / 2 + 1
          while (a.at(i) == j){
            ans += p(k, j); //k P j
            k++; j += 2;
          }
          ans++;
        }
        else{
          int j = (a.at(i) + 1) / 2; int k = 1
            while(a.at(i) == j){
              ans += p(j,k); //j P k
              j++; k += 2;
            }
        }
        else{
          if ((a.at(i) - a.at(i - 1)) % 2 == 0){
            int j; int k = a.at(i) / 2 + 1
            while ((a.at(i) - a.at(i - 1)) == j){
              ans += p(k, j); //k P j
              k++; j += 2;
            }
            ans++;
          }
          else{
            int j = ((a.at(i) - a.at(i - 1)) + 1) / 2; int k = 1
              while((a.at(i) - a.at(i - 1))== j){
                ans += p(j,k); //j P k
                j++; k += 2;
              } 
          }
        }
      }
    }
  }
  if(a = false)
    ans = 0;
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:8: error: conflicting declaration 'bool a'
   13 |   bool a = true;
      |        ^
a.cc:12:15: note: previous declaration as 'std::vector<int> a'
   12 |   vector<int> a(M);
      |               ^
a.cc:18:13: error: no match for 'operator=' (operand types are 'std::vector<int>' and 'bool')
   18 |         a = false;
      |             ^~~~~
In file included from /usr/include/c++/14/vector:72,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/vector.tcc:210:5: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>]'
  210 |     vector<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/vector.tcc:211:42: note:   no known conversion for argument 1 from 'bool' to 'const std::vector<int>&'
  211 |     operator=(const vector<_Tp, _Alloc>& __x)
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/14/vector:66:
/usr/include/c++/14/bits/stl_vector.h:766:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = int; _Alloc = std::allocator<int>]'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:766:26: note:   no known conversion for argument 1 from 'bool' to 'std::vector<int>&&'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |                 ~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:788:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = int; _Alloc = std::allocator<int>]'
  788 |       operator=(initializer_list<value_type> __l)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:788:46: note:   no known conversion for argument 1 from 'bool' to 'std::initializer_list<int>'
  788 |       operator=(initializer_list<value_type> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
a.cc:21:10: error: no match for 'operator=' (operand types are 'std::vector<int>' and 'bool')
   21 |   if(a = true){
      |          ^~~~
/usr/include/c++/14/bits/vector.tcc:210:5: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>]'
  210 |     vector<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/vector.tcc:211:42: note:   no known conversion for argument 1 from 'bool' to 'const std::vector<int>&'
  211 |     operator=(const vector<_Tp, _Alloc>& __x)
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:766:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = int; _Alloc = std::allocator<int>]'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:766:26: note:   no known conversion for argument 1 from 'bool' to 'std::vector<int>&&'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |                 ~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:788:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = int; _Alloc = std::allocator<int>]'
  788 |       operator=(initializer_list<value_type> __l)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:788:46: note:   no known conversion for argument 1 from 'bool' to 'std::initializer_list<int>'
  788 |       operator=(initializer_list<value_type> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
a.cc:26:11: error: expected ',' or ';' before 'while'
   26 |           while (a.at(i) == j){
      |           ^~~~~
a.cc:34:13: error: expected ',' or ';' before 'while'
   34 |             while(a.at(i) == j){
      |             ^~~~~
a.cc:39:9: error: expected '}' before 'else'
   39 |         else{
      |         ^~~~
a.cc:23:17: note: to match this '{'
   23 |       if(i == 0){
      |                 ^
a.cc:42:13: error: expected ',' or ';' before 'while'
   42 |             while ((a.at(i) - a.at(i - 1)) == j){
      |             ^~~~~
a.cc:50:15: error: expected ',' or ';' before 'while'
   50 |               while((a.at(i) - a.at(i - 1))== j){
      |               ^~~~~
a.cc: At global scope:
a.cc:59:3: error: expected unqualified-id before 'if'
   59 |   if(a = false)
      |   ^~
a.cc:61:3: error: 'cout' does not name a type
   61 |   cout << ans << endl;
      |   ^~~~
a.cc:62:1: error: expected declaration before '}' token
   62 | }
      | ^