Language: C++

#include <bits/stdc++.h>

using namespace std;

#define countof(a) (sizeof(a)/sizeof(*a))

#define vi vector<int>
#define vvi vector<vector<int> >
#define vpi vector<pi >
#define pi pair<int,int>
#define fi first
#define se second
#define all(n) n.begin(), n.end()

#define FROMTO(var, from, to) for (register int var = (from), var##down = ((int)(to)) < ((int)(from));var##down ? (var >= (int)(to)) : (var <= (int)(to));var##down ? var-- : var++)
#define UPTO(var, from, to)   for (register int var = (from); var <= ((int)to); var++)
#define DOWNTO(var, from, to) for (register int var = (from); var >= ((int)to); var--)
#define FOR(var, to)          UPTO(var, 0, (to)-1)
#define DOWN(var, from)       DOWNTO(var, (from)-1, 0) 

#define INIT(var, val) FOR(i,countof(var)) var[i] = val
#define INPUT(var) FOR(i,countof(var)) cin >> var[i]
#define INPUT1(var) FOR(i,countof(var)) cin >> var[i], var[i]--

#define SORT(v) qsort(v,countof(v),sizeof(*v),int_less)
#define SORTT(v) qsort(v,countof(v),sizeof(*v),int_greater)
#define QSORT(v,b) qsort(v,countof(v),sizeof(*v),b)

#define MOD 1000000007
#define INF ((1 << 30)-1)
#define LINF ((1LL << 62)-1)

typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;
typedef int8_t s8;
typedef int16_t s16;
typedef int32_t s32;
typedef int64_t s64;

/* ------------------------ */
/* BEGIN EXTERNAL LIBRARIES */
/* ------------------------ */

template<int mod>
struct ModInt{
    int x;
    ModInt():x(0){}
    ModInt(long long y):x(y>=0?y%mod:(mod-(-y)%mod)%mod){}
    ModInt &operator+=(const ModInt &p){
        if((x+=p.x)>=mod)x-=mod;
        return *this;
    }
    ModInt &operator-=(const ModInt &p){
        if((x+=mod-p.x)>=mod)x-=mod;
        return *this;
    }
    ModInt &operator*=(const ModInt &p){
        x=(int)(1LL*x*p.x%mod);
        return *this;
    }
    ModInt &operator/=(const ModInt &p){
        *this*=p.inverse();
        return *this;
    }
    ModInt operator-()const{return ModInt(-x);}
    ModInt operator+(const ModInt &p)const{return ModInt(*this)+=p;}
    ModInt operator-(const ModInt &p)const{return ModInt(*this)-=p;}
    ModInt operator*(const ModInt &p)const{return ModInt(*this)*=p;}
    ModInt operator/(const ModInt &p)const{return ModInt(*this)/=p;}
    bool operator==(const ModInt &p)const{return x==p.x;}
    bool operator!=(const ModInt &p)const{return x!=p.x;}
    operator int() const { return x; }                           // added by QCFium
    ModInt operator=(const int p) {x = p; return ModInt(*this);} // added by QCFium
    ModInt inverse()const{
        int a=x,b=mod,u=1,v=0,t;
        while(b>0){
            t=a/b;
            a-=t*b;
            swap(a,b);
            u-=t*v;
            swap(u,v);
        }
        return ModInt(u);
    }
    friend ostream &operator<<(ostream &os,const ModInt<mod> &p){
        return os<<p.x;
    }
    friend istream &operator>>(istream &is,ModInt<mod> &a){
        long long x;
        is>>x;
        a=ModInt<mod>(x);
        return (is);
    }
};
typedef ModInt<MOD> mint;

struct UnionFind{
    vi data;
    UnionFind(int size):data(size,-1){}
    bool unite(int x,int y) {
        x=root(x);y=root(y);
        if(x!=y){
            if(data[y]<data[x])swap(x,y);
            data[x]+=data[y];data[y]=x;
        }
        return x!=y;
    }
    bool find(int x,int y) {
        return root(x)==root(y);
    }
    int root(int x) {
        return data[x]<0?x:data[x]=root(data[x]);
    }
    int size(int x) {
        return -data[root(x)];
    }
    // added by QCFium
    bool united() {
        int comroot = -1;
        FOR(i,data.size()) {
            if (comroot != -1 && root(i) != comroot) return false;
            comroot = root(i);
        }
        return true;
    }
};

/* ---------------------- */
/* END EXTERNAL LIBRARIES */
/* ---------------------- */

int mpow(s64 num, s64 times) { // O(log(times))
    mint next = num%MOD;
	mint res = 1;
	while (times) {
		if (times%2)
            res *= next;
		next *= next;
		times /= 2;
	}
	return res;
}

struct Comb {
    vector<vector<s64> > data;
    Comb(int n) { // O(n^2)
        data = vector<vector<s64> >(n+1,vector<s64>(n+1,1));
        UPTO(i,1,n) {
            FOR(j,i+1) {
                if (!j || j == i) data[i][j] = 1;
                else data[i][j] = data[i-1][j-1] + data[i-1][j];
            }
        }
    }
    
    s64 ncr(int n, int r) {
        return data[n][r];
    }
};

struct MComb {
    vector<mint> fact;
    vector<mint> inversed;
    MComb(int n) { // O(n+log(mod))
        fact = vector<mint>(n+1,1);
        UPTO(i,1,n) fact[i] = fact[i-1]*mint(i);
        inversed = vector<mint>(n+1);
        inversed[n] = mpow(fact[n], MOD-2);
        DOWN(i,n) inversed[i]=inversed[i+1]*mint(i+1);
    }
    
    int ncr(int n, int r) {
        return fact[n] * inversed[r] * inversed[n-r];
    }
    
    int npr(int n, int r) {
        return fact[n] * inversed[n-r];
    }
    
    int nhr(int n, int r) {
        assert(n+r-1 < (int)fact.size());
        return ncr(n+r-1, r);
    }
};

template<class Key, class Compare = less<Key>, class Allocator = allocator<Key>>
set<Key> operator+(set<Key>& a, set<Key>& b) {
    set<Key> c = a;
    for (auto i : b) 
        c.insert(i);
    return c;
}
template<class Key, class Compare = less<Key>, class Allocator = allocator<Key>>
set<Key> operator+=(set<Key>& a, set<Key>& b) {
    for (auto& i : b)
        a.insert(i);
    return a;
}

template<class Key, class Compare = less<Key>, class Allocator = allocator<Key>>
set<Key> operator*(set<Key>& a, set<Key>& b) {
    set<Key> c;
    for (auto& i : a)
        if (b.count(i)) c.insert(i);
    return c;
}
template<class Key, class Compare = less<Key>, class Allocator = allocator<Key>>
set<Key> operator*=(set<Key>& a, set<Key>& b) {
    set<Key> c;
    for (auto& i : a)
        if (b.count(i)) c.insert(i);
        
    return a = c;
}

template<class Key, class Compare = less<Key>, class Allocator = allocator<Key>>
set<Key> operator-(set<Key>& a, set<Key>& b) {
    set<Key> c;
    for (auto& i : a)
        if (!b.count(i)) c.insert(i);
        
    return c;
}
template<class Key, class Compare = less<Key>, class Allocator = allocator<Key>>
set<Key> operator-=(set<Key>& a, set<Key>& b) {
    set<Key> c;
    for (auto& i : a)
        if (!b.count(i)) c.insert(i);
        
    return a = c;
}

static inline int ri() {
  int a;
  scanf("%d", &a);
  return a;
}

int int_less(const void *a, const void *b) {
  return (*((const int*)a) - *((const int*)b));
}
int int_greater(const void *a, const void *b) {
  return (*((const int*)b) - *((const int*)a));
}

int main() {
    int n = ri();
	int t = ri();
	int a = ri();
	int h[n];
	INPUT(h);
	int res = 0;
	double cur = INF;
	FOR(i,n) {
		if (cur > abs((double)a,t-h[i]*0.006)) {
			cur = abs((double)a,t-h[i]*0.006);
			res = i;
		}
	}
	cout << res+1 << endl;
    return 0;
}


Compiler output:
a.cc: In member function 'bool UnionFind::united()':
a.cc:122:13: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
  122 |         FOR(i,data.size()) {
      |             ^
a.cc:16:49: note: in definition of macro 'UPTO'
   16 | #define UPTO(var, from, to)   for (register int var = (from); var <= ((int)to); var++)
      |                                                 ^~~
a.cc:122:9: note: in expansion of macro 'FOR'
  122 |         FOR(i,data.size()) {
      |         ^~~
a.cc: In constructor 'Comb::Comb(int)':
a.cc:150:14: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
  150 |         UPTO(i,1,n) {
      |              ^
a.cc:16:49: note: in definition of macro 'UPTO'
   16 | #define UPTO(var, from, to)   for (register int var = (from); var <= ((int)to); var++)
      |                                                 ^~~
a.cc:151:17: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
  151 |             FOR(j,i+1) {
      |                 ^
a.cc:16:49: note: in definition of macro 'UPTO'
   16 | #define UPTO(var, from, to)   for (register int var = (from); var <= ((int)to); var++)
      |                                                 ^~~
a.cc:151:13: note: in expansion of macro 'FOR'
  151 |             FOR(j,i+1) {
      |             ^~~
a.cc: In constructor 'MComb::MComb(int)':
a.cc:168:14: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
  168 |         UPTO(i,1,n) fact[i] = fact[i-1]*mint(i);
      |              ^
a.cc:16:49: note: in definition of macro 'UPTO'
   16 | #define UPTO(var, from, to)   for (register int var = (from); var <= ((int)to); var++)
      |                                                 ^~~
a.cc:171:14: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
  171 |         DOWN(i,n) inversed[i]=inversed[i+1]*mint(i+1);
      |              ^
a.cc:17:49: note: in definition of macro 'DOWNTO'
   17 | #define DOWNTO(var, from, to) for (register int var = (from); var >= ((int)to); var--)
      |                                                 ^~~
a.cc:171:9: note: in expansion of macro 'DOWN'
  171 |         DOWN(i,n) inversed[i]=inversed[i+1]*mint(i+1);
      |         ^~~~
a.cc: In function 'int main()':
a.cc:22:24: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   22 | #define INPUT(var) FOR(i,countof(var)) cin >> var[i]
      |                        ^
a.cc:16:49: note: in definition of macro 'UPTO'
   16 | #define UPTO(var, from, to)   for (register int var = (from); var <= ((int)to); var++)
      |                                                 ^~~
a.cc:22:20: note: in expansion of macro 'FOR'
   22 | #define INPUT(var) FOR(i,countof(var)) cin >> var[i]
      |                    ^~~
a.cc:253:9: note: in expansion of macro 'INPUT'
  253 |         INPUT(h);
      |         ^~~~~
a.cc:256:13: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
  256 |         FOR(i,n) {
      |             ^
a.cc:16:49: note: in definition of macro 'UPTO'
   16 | #define UPTO(var, from, to)   for (register int var = (from); var <= ((int)to); var++)
      |                                                 ^~~
a.cc:256:9: note: in expansion of macro 'FOR'
  256 |         FOR(i,n) {
      |         ^~~
a.cc:257:30: error: no matching function for call to 'abs(double, double)'
  257 |                 if (cur > abs((double)a,t-h[i]*0.006)) {
      |                           ~~~^~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/valarray:605,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166,
                 from a.cc:1:
/usr/include/c++/14/bits/valarray_after.h:445:5: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_UnClos<std::_Abs, std::_ValArray, _Tp>, _Tp> std::abs(const valarray<_Tp>&)'
  445 |     _DEFINE_EXPR_UNARY_FUNCTION(abs, struct std::_Abs)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:445:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/valarray_after.h:445:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_UnClos<std::_Abs, std::_Expr, _Dom>, typename _Dom::value_type> std::abs(const _Expr<_Dom1, typename _Dom1::value_type>&)'
  445 |     _DEFINE_EXPR_UNARY_FUNCTION(abs, struct std::_Abs)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:445:5: note:   candidate expects 1 argument, 2 provided
In file included from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/complex:892:5: note: candidate: 'template<class _Tp> _Tp std::abs(const complex<_Tp>&)'
  892 |     abs(const complex<_Tp>& __z) { return __complex_abs(__z.__rep()); }
      |     ^~~
/usr/include/c++/14/complex:892:5: note:   candidate expects 1 argument, 2 provided
In file included from /usr/include/c++/14/cstdlib:79,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:42:
/usr/include/stdlib.h:980:12: note: candidate: 'int abs(int)'
  980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
      |            ^~~
/usr/include/stdlib.h:980:12: note:   candidate expects 1 argument, 2 provided
In file included from /usr/include/c++/14/cstdlib:81:
/usr/include/c++/14/bits/std_abs.h:137:3: note: candidate: 'constexpr __float128 std::abs(__float128)'
  137 |   abs(__float128 __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:137:3: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/std_abs.h:85:3: note: candidate: 'constexpr __int128 std::abs(__int128)'
   85 |   abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; }
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:85:3: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)'
   79 |   abs(long double __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:79:3: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)'
   75 |   abs(float __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:75:3: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)'
   71 |   abs(double __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:71:3: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)'
   61 |   abs(long long __x) { return __builtin_llabs (__x); }
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:61:3: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/std_abs.h:56:3: note: candidate: 'long int std::abs(long int)'
   56 |   abs(long __i) { return __builtin_labs(__i); }
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:56:3: note:   candidate expects 1 argument, 2 provided
a.cc:258:34: error: no matching function for call to 'abs(double, double)'
  258 |                         cur = abs((double)a,t-h[i]*0.006);
      |                               ~~~^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:445:5: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_UnClos<std::_Abs, std::_ValArray, _Tp>, _Tp> std::abs(const valarray<_Tp>&)'
  445 |     _DEFINE_EXPR_UNARY_FUNCTION(abs, struct std::_Abs)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:445:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/valarray_after.h:445:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_UnClos<std::_Abs, std::_Expr, _Dom>, typename _Dom::value_type> std::abs(const _Expr<_Dom1, typename _Dom1::value_type>&)'
  445 |     _DEFINE_EXPR_UNARY_FUNCTION(abs, struct std::_Abs)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:445:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/complex:892:5: note: candidate: 'template<class _Tp> _Tp std::abs(const complex<_Tp>&)'
  892 |     abs(const complex<_Tp>& __z) { return __complex_abs(__z.__rep()); }
      |     ^~~
/usr/include/c++/14/complex:892:5: note:   candidate expects 1 argument, 2 provided
/usr/include/stdlib.h:980:12: note: candidate: 'int abs(int)'
  980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
      |            ^~~
/usr/include/stdlib.h:980:12: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/std_abs.h:137:3: note: candidate: 'constexpr __float128 std::abs(__float128)'
  137 |   abs(__float128 __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:137:3: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/std_abs.h:85:3: note: candidate: 'constexpr __int128 std::abs(__int128)'
   85 |   abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; }
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:85:3: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)'
   79 |   abs(long double __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:79:3: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)'
   75 |   abs(float __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:75:3: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)'
   71 |   abs(double __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:71:3: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)'
   61 |   abs(long long __x) { return __builtin_llabs (__x); }
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:61:3: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/std_abs.h:56:3: note: candida