Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstring>
#include <string>
#include <math.h>
#include <numeric>
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<int,int> P;
#define PB push_back
#define INF 100000000000000000
using int64 = long long;

bool IsPrime(int num)
{
  if (num < 2) return false;
  else if (num == 2) return true;
  else if (num % 2 == 0) return false; // 偶数はあらかじめ除く
  
  double sqrtNum = sqrt(num);
  for (int i = 3; i <= sqrtNum; i += 2)
  {
    if (num % i == 0)
    {
      // 素数ではない
      return false;
    }
  }
  
  // 素数である
  return true;
}

/*********************************************************/
// 最大公約数（Greatest Common Divisor）を返す。
// 引数に０がある場合は０を返す。
//*********************************************************/
ll gcd( ll m, ll n )
{
  // 引数に０がある場合は０を返す
  if ( ( 0 == m ) || ( 0 == n ) )
    return 0;
  
  // ユークリッドの方法
  while( m != n )
  {
    if ( m > n ) m = m - n;
    else         n = n - m;
  }
  return m;
}//gcd

//*********************************************************
// 最小公倍数（Least Common Multiple）を返す。
// 引数に０がある場合は０を返す。
//*********************************************************
ll lcm( ll m, ll n )
{
  // 引数に０がある場合は０を返す
  if ( ( 0 == m ) || ( 0 == n ) )
    return 0;
  
  return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}//lcm

/********************************************************/

int main() {
  int N,T,A,i;
  int  ans = INF;
  cin >> N >> T >> A;
  vector<ll>H(N);
  vector<ll>TempAtH(N);
  vector<ll>AvgTempoAtH(N);
  for(i=0;i<N;i++){
    cin >> H.at(i);
    //TempAtH.at(i) = T - (H.at(i)*0.006);
    //AvgTempoAtH.at(i) = abs(A- TempAtH.at(i));
    ans = min(ans,abs(A - (T - H.at(i) * 0.006)));
  }

  for(i=0;i<=N;i++){
    if(ans == AvgTempoAtH.at(i)){
        cout << i+1 << endl;
        return 0 ;
    }
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:13: warning: overflow in conversion from 'long int' to 'int' changes value from '100000000000000000' to '1569325056' [-Woverflow]
   18 | #define INF 100000000000000000
      |             ^~~~~~~~~~~~~~~~~~
a.cc:77:14: note: in expansion of macro 'INF'
   77 |   int  ans = INF;
      |              ^~~
a.cc:86:14: error: no matching function for call to 'min(int&, double)'
   86 |     ans = min(ans,abs(A - (T - H.at(i) * 0.006)));
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 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/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:86:14: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'double')
   86 |     ans = min(ans,abs(A - (T - H.at(i) * 0.006)));
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:86:14: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   86 |     ans = min(ans,abs(A - (T - H.at(i) * 0.006)));
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~