Language: C++

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cmath>
#include <cstdlib>

#define INF 1000000000
#define REP(i,n) for(int i=0; i<n; i++)
#define REP_R(i,n,m) for(int i=m; i<n; i++)
#define MAX 100

using namespace std;
typedef long long ll;

std::vector<ll> data;
ll N;
ll n;
ll m[1000000001];
ll s[1000000001];
ll tt = 0;
ll k = 0;

int main() {

  scanf("%lld", &N);
  for (ll i=0; i<N; i++){
    scanf("%lld", &n);
    data.push_back(n);
    if ((n-(i+1)) >= 0) {
      m[n-(i+1)] += 1;
    } else {
      s[abs(n-(i+1))] += 1;
    }
  }
  ll max = 0;

  for (ll i=0; i<100000 * 2 + 1; i++) {
    if (m[i] > max) {
      max = m[i];
      k = i;
    }
  }

  for (ll i=0; i<100000 * 2 + 1; i++) {
    if (s[i] > max) {
      max = s[i];
      k = -i;
    }
  }

  for (ll i=0; i<data.size(); i++) {
    tt += abs(data[i] - (k + i + 1));
  }
  printf("%lld\n", tt);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:34:5: error: reference to 'data' is ambiguous
   34 |     data.push_back(n);
      |     ^~~~
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:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:21:17: note:                 'std::vector<long long int> data'
   21 | std::vector<ll> data;
      |                 ^~~~
a.cc:57:18: error: reference to 'data' is ambiguous
   57 |   for (ll i=0; i<data.size(); i++) {
      |                  ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:21:17: note:                 'std::vector<long long int> data'
   21 | std::vector<ll> data;
      |                 ^~~~
a.cc:58:15: error: reference to 'data' is ambiguous
   58 |     tt += abs(data[i] - (k + i + 1));
      |               ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:21:17: note:                 'std::vector<long long int> data'
   21 | std::vector<ll> data;
      |                 ^~~~