Language: C++

signed main(){
  Int n,t,a;
  cin>>n>>t>>a;
  vector<Int> h(n);
  for(Int i=0;i<n;i++) cin>>h[i];
  t*=1000;a*=1000;
  auto calc=[&](Int x){return abs((t-x*6)-a);};
  
  Int ans=0;
  for(Int i=0;i<n;i++)
    if(calc(h[i])<calc(h[ans])) ans=i;
 
  //for(Int i=0;i<n;i++) cout<<calc(h[i])<<endl;
  cout<<ans+1<<endl;
  return 0;
}
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

#include<bits/stdc++.h>
using namespace std;
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define SZ(x) ((int)(x).size())
#define INF 999999999
typedef long long int Int;
using ll = long long;
using VI = vector<int>;
//INSERT ABOVE HERE
signed main(){
  Int n,t,a;
  cin>>n>>t>>a;
  vector<Int> h(n);
  for(Int i=0;i<n;i++) cin>>h[i];
  t*=1000;a*=1000;
  auto calc=[&](Int x){return abs((t-x*6)-a);};
  
  Int ans=0;
  for(Int i=0;i<n;i++)
    if(calc(h[i])<calc(h[ans])) ans=i;
 
  //for(Int i=0;i<n;i++) cout<<calc(h[i])<<endl;
  cout<<ans+1<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:2:3: error: 'Int' was not declared in this scope; did you mean 'int'?
    2 |   Int n,t,a;
      |   ^~~
      |   int
a.cc:3:3: error: 'cin' was not declared in this scope
    3 |   cin>>n>>t>>a;
      |   ^~~
a.cc:3:8: error: 'n' was not declared in this scope
    3 |   cin>>n>>t>>a;
      |        ^
a.cc:3:11: error: 't' was not declared in this scope
    3 |   cin>>n>>t>>a;
      |           ^
a.cc:3:14: error: 'a' was not declared in this scope
    3 |   cin>>n>>t>>a;
      |              ^
a.cc:4:3: error: 'vector' was not declared in this scope
    4 |   vector<Int> h(n);
      |   ^~~~~~
a.cc:4:15: error: 'h' was not declared in this scope
    4 |   vector<Int> h(n);
      |               ^
a.cc:5:10: error: expected ';' before 'i'
    5 |   for(Int i=0;i<n;i++) cin>>h[i];
      |          ^~
      |          ;
a.cc:5:15: error: 'i' was not declared in this scope
    5 |   for(Int i=0;i<n;i++) cin>>h[i];
      |               ^
a.cc:7:17: error: 'Int' is not a type
    7 |   auto calc=[&](Int x){return abs((t-x*6)-a);};
      |                 ^~~
a.cc: In lambda function:
a.cc:7:31: error: 'abs' was not declared in this scope
    7 |   auto calc=[&](Int x){return abs((t-x*6)-a);};
      |                               ^~~
a.cc: In function 'int main()':
a.cc:9:6: error: expected ';' before 'ans'
    9 |   Int ans=0;
      |      ^~~~
      |      ;
a.cc:10:10: error: expected ';' before 'i'
   10 |   for(Int i=0;i<n;i++)
      |          ^~
      |          ;
a.cc:10:15: error: 'i' was not declared in this scope
   10 |   for(Int i=0;i<n;i++)
      |               ^
a.cc:11:26: error: 'ans' was not declared in this scope
   11 |     if(calc(h[i])<calc(h[ans])) ans=i;
      |                          ^~~
a.cc:14:3: error: 'cout' was not declared in this scope
   14 |   cout<<ans+1<<endl;
      |   ^~~~
a.cc:14:9: error: 'ans' was not declared in this scope
   14 |   cout<<ans+1<<endl;
      |         ^~~
a.cc:14:16: error: 'endl' was not declared in this scope
   14 |   cout<<ans+1<<endl;
      |                ^~~~
a.cc: At global scope:
a.cc:34:8: error: redefinition of 'int main()'
   34 | signed main(){
      |        ^~~~
a.cc:1:8: note: 'int main()' previously defined here
    1 | signed main(){
      |        ^~~~