Language: C++

#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <tuple>
#include <queue>
#include <bitset>
#include <set>
#include <map>
#include <list>

using ll = long long;
using ld = long double;
using namespace std;
const int INF = 1e9+100;
const ll INF64 = 7e18l;
const int mod = 1000000007;
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(a) (a).begin(), (a).end()
#define FIN ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);


vector<ll> dup;
ll size,start,last;
ll n;
vector<ll> a;
ll ans = 0;


void dfs(ll i){
    if(i == size){
        if(dup[1]-dup[0] == a[dup[1]]+a[dup[0]]) ans++;
    }else{
        if(i == 0){
            for(int j=start;j<=last;j++){
                dup[i] = j;
                dfs(i+1);
            }
        }else{
            for(int j=dup[i-1];j<=last;j++){
                dup[i] = j;
                dfs(i+1);
            }
        }
    }
}

int main(){
    FIN;
    cin >> n;
    a.resize(n);

    rep(i,0,n) cin >> a[i];

    size = 2; start = 0; last = n-1;
    dup.resize(size);
    dfs(0);

    cout << ans << endl;
    return 0;
}



Compiler output:
a.cc: In function 'void dfs(ll)':
a.cc:35:13: error: reference to 'size' is ambiguous
   35 |     if(i == size){
      |             ^~~~
In file included 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/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:28:4: note:                 'll size'
   28 | ll size,start,last;
      |    ^~~~
a.cc: In function 'int main()':
a.cc:59:5: error: reference to 'size' is ambiguous
   59 |     size = 2; start = 0; last = n-1;
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:28:4: note:                 'll size'
   28 | ll size,start,last;
      |    ^~~~
a.cc:60:16: error: reference to 'size' is ambiguous
   60 |     dup.resize(size);
      |                ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:28:4: note:                 'll size'
   28 | ll size,start,last;
      |    ^~~~