criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include <iostream>
#include <cmath>

using namespace std;

int main(int argc, char* argv[]) {
    int N;
    std::cin >> N;
    int T, A;
    std::cin >> T >> A;
    auto H = new int[N];

    for (int i = 0; i < N; i++) {
        std::cin >> H[i];
    }

    int diff_min = INT_MAX;
    int diff_i = 0;
    for (int i = 0; i < N; i++) {
        auto v = T - (H[i] * 6) / 1000;

        int diff = v - A;
        auto abs_diff = std::abs(diff);
        if (abs_diff < diff_min) {
            diff_i = i;
            diff_min = abs_diff;
        }
    }

    std::cout << diff_i + 1 << std::endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:17:20: error: 'INT_MAX' was not declared in this scope
   17 |     int diff_min = INT_MAX;
      |                    ^~~~~~~
a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include <cmath>
  +++ |+#include <climits>
    3 |
Language: C++

#include <iostream>
#include <vector>
using namespace std;

double calc(double t,double h,double a){
  double tem = t - h * 0.006;
  if(tem >= a)
    return tem - a;
  else
    return a - tem;
}

int main(void){
  int N,T,A;
  cin >> N >> T >> A;

  vector<double>height(1000,0);

  for(int i=0;i<N;i++){
    cin >> height[i];
  }

  double min = 9999999;
  int ans =0;

  for(int i=0;i<N;i++){
    if(min > calc(T,height[i],A))
      min = calc(T,height[i],A);
      ans = i;
  }

 	cout << i << endl;

       return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:17: error: 'i' was not declared in this scope
   32 |         cout << i << endl;
      |                 ^
Language: C++

#include <iostream>
#include <vector>
using namespace std;
 
double calc(double t,double h,double a){
  double tem = t - h * 0.006;
  if(tem >= a)
    return tem - a;
  else
    return a - tem;
}
 
int main(void){
  int N,T,A;
  cin >> N >> T >> A;
  
  vector<double>height(1000,0);
  
  for(int i=0;i<N;i++){
    cin >> height[i];
  }
  
  double min = 9999999;
  
  for(int i=0;i<N;i++){
    if(min > calc(T,height[i],A)
      min = calc(T,height[i],A);
  }
       
 	cout << min << endl;
       
       return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:33: error: expected ';' before 'min'
   26 |     if(min > calc(T,height[i],A)
      |                                 ^
      |                                 ;
   27 |       min = calc(T,height[i],A);
      |       ~~~                        
a.cc:28:3: error: expected primary-expression before '}' token
   28 |   }
      |   ^
a.cc:27:33: error: expected ')' before '}' token
   27 |       min = calc(T,height[i],A);
      |                                 ^
      |                                 )
   28 |   }
      |   ~                              
a.cc:26:7: note: to match this '('
   26 |     if(min > calc(T,height[i],A)
      |       ^
a.cc:28:3: error: expected primary-expression before '}' token
   28 |   }
      |   ^
Language: C++

#include <iostream>
#include <vector>
using namespace std;

double calc(double t,double h,double a){
  double tem = t - h * 0.006;
  if(tem >= a)
    return tem - a;
  else
    return a - tem;
}

int main(void){
  int N,T,A;
  cin >> N >> T >> A;
  
  vector<double>height(1000,0);
  
  for(int i=0;i<N;i++){
    cin >> height[i];
  }
  
  double min = 9999999;
  
  for(int i=0;i<N;i++){
    if(min > calc(T,height[i],A){
      min = calc(T,height[i],A);
    }
  }
       
 	cout << min << endl;
       
       return 0;
       }
       
  
       
  

Compiler output:
a.cc: In function 'int main()':
a.cc:26:33: error: expected ')' before '{' token
   26 |     if(min > calc(T,height[i],A){
      |       ~                         ^
      |                                 )
a.cc:29:3: error: expected primary-expression before '}' token
   29 |   }
      |   ^
Language: C++

#include <iostream>
#include <limits>
#include <cmath>

int main(int argc, char const* argv[])
{
    double n, t, a;
    std::cin >> n >> t >> a;

    auto diff = std::numeric_limits<int>::max();
    auto result = 0;
    for(int i=0; i < n;++i)
    {
        int h;
        std::cin >> h;
        double tmp = t - h * 0.006;
        auto abs_val = abs(tmp - a);
        if(abs_val <= diff)
        {
            result = i;
            diff = abs_val;
        }
/*         std::cout << result << " " << tmp  << " "
  */           << abs_val << " "<< diff << std::endl;
    }

    std::cout << result + 1 << std::endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:24:16: error: expected primary-expression before '<<' token
   24 |   */           << abs_val << " "<< diff << std::endl;
      |                ^~
Language: C

#include<stdio.h>
#include<stdlib.h>

int main(){
  int i,mini;
  double n,t,a;
  double kionsa,min=1000.0;
  scanf("%lf\n%lf %lf\n",&n,&t,&a);
  double h[n];
  for(i=0;i<n;i++){
    scanf("%lf ",&h[i]);
    kionsa=abs(t-0.006*h[i]-a);
    if(kionsa<min){
      min=kionsa;
      mini=i;
    }
  }
  printf("%d",mini+1);
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:9:10: error: size of array 'h' has non-integer type
    9 |   double h[n];
      |          ^
Language: C

#include<stdio.h>
#include<stdlib.h>

int main(){
  int i,mini;
  double n,t,a;
  double kionsa,min=1000.0;
  scanf("%lf\n%lf %lf\n",&n,&t,&a);
  double h[n];
  for(i=0;i<n;i++){
    scanf("%lf ",&h[i]);
    kionsa=abs(t-0.006*h[i]-a);
    if(kionsa<min){
      min=kionsa;
      mini=i;
    }
  }
  printf("%lf",mini+1);
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:9:10: error: size of array 'h' has non-integer type
    9 |   double h[n];
      |          ^
Language: C

#include<stdio.h>
#include<stdlib.h>

int main(){
  double n,t,a,i,mini;
  double kionsa,min=1000.0;
  scanf("%lf\n%lf %lf\n",&n,&t,&a);
  double h[n];
  for(i=0;i<n;i++){
    scanf("%lf ",&h[i]);
    kionsa=abs(t-0.006*h[i]-a);
    if(kionsa<min){
      min=kionsa;
      mini=i;
    }
  }
  printf("%lf",mini+1);
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:8:10: error: size of array 'h' has non-integer type
    8 |   double h[n];
      |          ^
main.c:10:20: error: array subscript is not an integer
   10 |     scanf("%lf ",&h[i]);
      |                    ^
main.c:11:25: error: array subscript is not an integer
   11 |     kionsa=abs(t-0.006*h[i]-a);
      |                         ^
Language: C

#include<stdio.h>
#include<stdlib.h>

int main(){
  double n,t,a,i,mini;
  double kionsa,min=1000.0;
  scanf("%lf\n%lf %lf\n",&n,&t,&a);
  int h[n];
  for(i=0;i<n;i++){
    scanf("%lf ",&h[i]);
    kionsa=abs(t-0.006*h[i]-a);
    if(kionsa<min){
      min=kionsa;
      mini=i;
    }
  }
  printf("%lf",mini+1);
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:8:7: error: size of array 'h' has non-integer type
    8 |   int h[n];
      |       ^
main.c:10:20: error: array subscript is not an integer
   10 |     scanf("%lf ",&h[i]);
      |                    ^
main.c:11:25: error: array subscript is not an integer
   11 |     kionsa=abs(t-0.006*h[i]-a);
      |                         ^
Language: C

#include<stdio.h>
#include<stdlib.h>

int main(){
  int n,t,a,i,mini;
  double kionsa=,min=1000.0;
  scanf("%d\n%d %d",&n,&t,&a);
  int h[n];
  for(i=0;i<n;i++){
    scanf("%d ",h[i]);
    kionsa=abs(t-0.006*h[i]-a);
    if(kionsa<min){
      min=kionsa;
      mini=i
    }
  }
  printf("%d",mini);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:6:17: error: expected expression before ',' token
    6 |   double kionsa=,min=1000.0;
      |                 ^
main.c:14:13: error: expected ';' before '}' token
   14 |       mini=i
      |             ^
      |             ;
   15 |     }
      |     ~
Language: C++

#include<bits/stdc++.h>
using namespace std;

int main(){
 int a,b,c,e;
  cin>>a>>b>>c;
vector<double>d(a);
  double ans;
  ans=1000000;
  for(int i=0;i<a;i++){
    cin>>d[i];
 d[i]=b-d[i]*0.006;
    if(ans>abs(c-d[i]){
   e=i;
      ans=min(ans,abs(c-d[i]));
  }
       }
  cout<<e<<endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:23: error: expected ')' before '{' token
   13 |     if(ans>abs(c-d[i]){
      |       ~               ^
      |                       )
a.cc:17:8: error: expected primary-expression before '}' token
   17 |        }
      |        ^
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main(){
  double n;
  cin >> n;
  double t,a;
  cin >> t >> a;
  int ans;
  double min=10000000;
  double com;
  double h[n+1];

  for(int i=1;i<=n;i++){
    cin >> h[i];
    com = t-(h[i]*0.006);
    if(abs(com-a)<min){
      ans = i;
      min = abs(com-a);
    }
  }

  cout << ans << endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:13: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
   12 |   double h[n+1];
      |            ~^~
a.cc:12:13: error: could not convert '(n + (double)1)' from 'double' to 'long unsigned int'
   12 |   double h[n+1];
      |            ~^~
      |             |
      |             double
a.cc:12:13: error: size of array 'h' has non-integral type 'double'
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main(){
  double n;
  cin >> n;
  double t,a;
  cin >> t >> a;
  double ans;
  double min=10000000;
  double com;
  double h[n+1];

  for(int i=1;i<=n;i++){
    cin >> h[i];
    com = t-(h[i]*0.006);
    if(abs(com-a)<min){
      ans = i;
      min = abs(com-a);
    }
  }

  cout << ans << endl;

}




Compiler output:
a.cc: In function 'int main()':
a.cc:12:13: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
   12 |   double h[n+1];
      |            ~^~
a.cc:12:13: error: could not convert '(n + (double)1)' from 'double' to 'long unsigned int'
   12 |   double h[n+1];
      |            ~^~
      |             |
      |             double
a.cc:12:13: error: size of array 'h' has non-integral type 'double'
Language: C

#include <stdio.h>

int main(){
	int n, t, a, i, x, h[1000];
	double y[1000];

	scanf_s("%d", &n);
	scanf_s("%d", &t);
	scanf_s("%d", &a);
	x = 0;
	for (i = 0; i < n; i++) {
		scanf_s("%d", &h[i]);
		y[i] = t - h[i] * 0.006;
		printf("%f", y[i]);
		if (y[i] < 0) y[i] = -1 * y[i];
		if (y[x] >= y[i]) x =i;
	}
	x++;
	printf("%d", x);
}

Compiler output:
main.c: In function 'main':
main.c:7:9: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration]
    7 |         scanf_s("%d", &n);
      |         ^~~~~~~
      |         scanf
Language: C

#include <stdio.h>

int main(){
	int n, t, a, i, x, h[1000];
	double y[1000];

	scanf_s("%d", &n);
	scanf_s("%d", &a);
	scanf_s("%d", &t);
	x = 0;
	for (i = 0; i < n; i++) {
		scanf_s("%f", &h[i]);
		y[i] = t - h[i] * 0.006 -a;
		if (y[i] < 0) y[i] = -1 * y[i];
		if (y[x] >= y[i]) x =i;
	}
	x++;
	printf("%d", x);
}

Compiler output:
main.c: In function 'main':
main.c:7:9: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration]
    7 |         scanf_s("%d", &n);
      |         ^~~~~~~
      |         scanf
Language: C++

#include <stdio.h>

int main(){
	int n, t, a, i, x;
	double h[1000];

	scanf_s("%d", &n);
	scanf_s("%d", &a);
	scanf_s("%d", &t);
	x = 0;
	for (i = 0; i < n; i++) {
		scanf_s("%d", &h[i]);
		h[i] = t - h[i] * 0.006;
		if (h[i] < 0) h[i] = -1 * h[i];
		if (h[x] >= h[i]) x =i;
	}
	x++;
	printf("%d", x);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
    7 |         scanf_s("%d", &n);
      |         ^~~~~~~
      |         scanf
Language: C++

#include <stdio.h>

int main(){
	int n, t, a, i, x, h[1000];

	scanf_s("%d", &n);
	scanf_s("%d", &a);
	scanf_s("%d", &t);
	x = 0;
	for (i = 0; i < n; i++) {
		scanf_s("%d", &h[i]);
		h[i] = t - h[i] * 0.006;
		if (h[i] < 0) h[i] = -1 * h[i];
		if (h[x] >= h[i]) x =i;
	}
	x++;
	printf("%d", x);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
    6 |         scanf_s("%d", &n);
      |         ^~~~~~~
      |         scanf
Language: C++

#include <iostream>
#include <vector>

using namespace std;

int main() {
    int N, T, A;
    cin >> N >> T >> A;
    vector<int> H(N);
    for (auto& i : H)
        cin >> i;

    double MIN = 99999.0;
    int index;
    for (int i = 0; i < N; i++) {
        const double cur = fabs(1.0 * A - (T - H[i] * 0.006));
        if (MIN > cur) {
            MIN   = cur;
            index = i;
        }
    }

    cout << index + 1 << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:28: error: 'fabs' was not declared in this scope; did you mean 'labs'?
   16 |         const double cur = fabs(1.0 * A - (T - H[i] * 0.006));
      |                            ^~~~
      |                            labs
Language: C++

#include<bits/stdc++.h>
using namespace std;

int main(){
  int N,T,A;
  cin>>N>>T>>A;
  int m = 1000000;
  vector<int> H(N);
  vector<double> C(N);
  for(int i=0;i<H.size();i++)
    cin>>H.at(i);
  
  for(int i=0;i<H.size();i++){
    C.at(i)=double(T-H.at(i)*0.006);
   
    m = min(m,A-C.at(i));
  }
  
  for(int i=0;i<C.size();i++){
    if(A-C.at(i)==m)
      cout<<i+1<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:12: error: no matching function for call to 'min(int&, __gnu_cxx::__alloc_traits<std::allocator<double>, double>::value_type)'
   16 |     m = min(m,A-C.at(i));
      |         ~~~^~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 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:16:12: note:   deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__alloc_traits<std::allocator<double>, double>::value_type' {aka 'double'})
   16 |     m = min(m,A-C.at(i));
      |         ~~~^~~~~~~~~~~~~
/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:
/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:16:12: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   16 |     m = min(m,A-C.at(i));
      |         ~~~^~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
#include<cmath>
using namespace std;

int main() {
  int N,T,A;
  cin>>N>>T>>A;
  vector<double>H(N);
  for(int i=0;i<N;i++){
    cin>>H[i];
  }
  int ans=999999999;
  for(int i=0;i<N;i++){
    ans = min(ans,abs((T*1000-H[i]*6)-A*1000));
  }
  cout<<ans/1000<<endl;
}
    


Compiler output:
a.cc: In function 'int main()':
a.cc:14:14: error: no matching function for call to 'min(int&, double)'
   14 |     ans = min(ans,abs((T*1000-H[i]*6)-A*1000));
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 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:14:14: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'double')
   14 |     ans = min(ans,abs((T*1000-H[i]*6)-A*1000));
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:
/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:14:14: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   14 |     ans = min(ans,abs((T*1000-H[i]*6)-A*1000));
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
#include<cmath>
using namespace std;

int main() {
  int N,T,A;
  cin>>N>>T>>A;
  vector<double>H(N);
  for(int i=0;i<N;i++){
    cin>>H[i];
  }
  int ans=999999999;
  for(int i=0;i<N;i++){
    ans = min(ans,fabs((T*1000-H[i]*6)-A*1000));
  }
  cout<<ans/1000<<endl;
}
    


Compiler output:
a.cc: In function 'int main()':
a.cc:14:14: error: no matching function for call to 'min(int&, double)'
   14 |     ans = min(ans,fabs((T*1000-H[i]*6)-A*1000));
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 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:14:14: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'double')
   14 |     ans = min(ans,fabs((T*1000-H[i]*6)-A*1000));
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:
/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:14:14: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   14 |     ans = min(ans,fabs((T*1000-H[i]*6)-A*1000));
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
#include<cmath>
using namespace std;

int main() {
  int N,T,A;
  cin>>N>>T>>A;
  vector<double>H(N);
  for(int i=0;i<N;i++){
    cin>>H[i];
  }
  int ans=999999999;
  for(int i=0;i<N;i++){
    ans = min(ans,fabs(T*1000-H[i]*6,A*1000));
  }
  cout<<ans/1000<<endl;
}
    


Compiler output:
a.cc: In function 'int main()':
a.cc:14:23: error: no matching function for call to 'fabs(__gnu_cxx::__alloc_traits<std::allocator<double>, double>::value_type, int)'
   14 |     ans = min(ans,fabs(T*1000-H[i]*6,A*1000));
      |                   ~~~~^~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127,
                 from a.cc:1:
/usr/include/c++/14/complex:2429:5: note: candidate: 'template<class _Tp> _Tp std::fabs(const complex<_Tp>&)'
 2429 |     fabs(const std::complex<_Tp>& __z)
      |     ^~~~
/usr/include/c++/14/complex:2429:5: note:   candidate expects 1 argument, 2 provided
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:114:
/usr/include/c++/14/cmath:250:5: note: candidate: 'template<class _Tp> constexpr typename __gnu_cxx::__enable_if<std::__is_integer<_Tp>::__value, double>::__type std::fabs(_Tp)'
  250 |     fabs(_Tp __x)
      |     ^~~~
/usr/include/c++/14/cmath:250:5: note:   candidate expects 1 argument, 2 provided
In file included from /usr/include/features.h:523,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683,
                 from /usr/include/c++/14/cassert:43,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:33:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:195:1: note: candidate: 'double fabs(double)'
  195 | __MATHCALLX (fabs,, (_Mdouble_ __x), (__const__));
      | ^~~~~~~~~~~
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:195:1: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/cmath:242:3: note: candidate: 'constexpr long double std::fabs(long double)'
  242 |   fabs(long double __x)
      |   ^~~~
/usr/include/c++/14/cmath:242:3: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/cmath:238:3: note: candidate: 'constexpr float std::fabs(float)'
  238 |   fabs(float __x)
      |   ^~~~
/usr/include/c++/14/cmath:238:3: note:   candidate expects 1 argument, 2 provided
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main(){
  int n,t,a,h;
  cin >>n >>t >>a;
  t*=1000;
  a*=1000;
  int m=1000000;
  for(int i=0;i<n;i++){
    cin >>h;
    if(m>abs(t-h*6)){
      int p=i+1;
      m=abs(t-h*6);
    }
  }
  cout <<p <<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:10: error: 'p' was not declared in this scope
   17 |   cout <<p <<endl;
      |          ^
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main(){
  int n,t,a,h;
  cin >>n >>t >>a;
  t*=1000;
  a*=1000;
  int m=1000000;
  for(int i=0;i<n;i++){
    cin >>h;
    if(m>abs(t-h*6)){
      int p=i+1;
      m=abs(t-h*6):;
    }
  }
  cout <<p <<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:19: error: expected ';' before ':' token
   14 |       m=abs(t-h*6):;
      |                   ^
      |                   ;
a.cc:17:10: error: 'p' was not declared in this scope
   17 |   cout <<p <<endl;
      |          ^
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;


double get_diff_temp(int A, int T, int H) {
    double ret = A-(T - H * 0.006);
    return fabs(ret);
}

int main() {

    int N, T, A;
    cin >> N >> T >> A;
    vector<int> H(N);
    for (int i = 0; i < N; i++) cin >> H[i];

    int ans = 0;
    double temp = get_diff_temp(A, T, H[0]);
    
    for (int i = 1; i < N; i++) {
        if (temp > get_diff_temp(A, T, H[i])) {
            temp = get_diff_temp(A, T, H[i]);
            ans = i;
        }
    }

    cout << (ans+1) << endl;
}


Compiler output:
a.cc: In function 'double get_diff_temp(int, int, int)':
a.cc:10:12: error: 'fabs' was not declared in this scope; did you mean 'labs'?
   10 |     return fabs(ret);
      |            ^~~~
      |            labs
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main() {
  int N,t,a,diff,ans;
  cin >> N >> t >> a;
  vector<int> s(N);
  vector<int> kion(N);
  vector<int> dif(N);

  for(int i=0;i<N;i++){
  cin >> s[i];
  kion[i] = t-s[i]*0.006;
  dif[i] = abs(a-kion[i]);
  }

  diff = dif[0];

  for(int i=0;i<N;i++){
       if(dif[i] < diff ){
       diff = dif[i];
       ans =i;
       }
       }
  }

 if(diff == dif[0]){
 ans =0;
 }
  cout << ans+1 << endl;
}

Compiler output:
a.cc:27:2: error: expected unqualified-id before 'if'
   27 |  if(diff == dif[0]){
      |  ^~
a.cc:30:3: error: 'cout' does not name a type
   30 |   cout << ans+1 << endl;
      |   ^~~~
a.cc:31:1: error: expected declaration before '}' token
   31 | }
      | ^
Language: C++

#include <bits/stdc++.h>
#include<cmath>
using namespace std;

int main() {
  double N,T,A;
  cin>>N>>T>>A;
  vector<double>H(N);
  for(int i=0;i<N;i++){
    cin>>H[i];
  }
  double ans=9999;
  for(int i=0;i<N;i++){
    ans = min(ans,fabs(T-H[i]*0.006,A));
  }
}
    


Compiler output:
a.cc: In function 'int main()':
a.cc:14:23: error: no matching function for call to 'fabs(double, double&)'
   14 |     ans = min(ans,fabs(T-H[i]*0.006,A));
      |                   ~~~~^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127,
                 from a.cc:1:
/usr/include/c++/14/complex:2429:5: note: candidate: 'template<class _Tp> _Tp std::fabs(const complex<_Tp>&)'
 2429 |     fabs(const std::complex<_Tp>& __z)
      |     ^~~~
/usr/include/c++/14/complex:2429:5: note:   candidate expects 1 argument, 2 provided
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:114:
/usr/include/c++/14/cmath:250:5: note: candidate: 'template<class _Tp> constexpr typename __gnu_cxx::__enable_if<std::__is_integer<_Tp>::__value, double>::__type std::fabs(_Tp)'
  250 |     fabs(_Tp __x)
      |     ^~~~
/usr/include/c++/14/cmath:250:5: note:   candidate expects 1 argument, 2 provided
In file included from /usr/include/features.h:523,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683,
                 from /usr/include/c++/14/cassert:43,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:33:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:195:1: note: candidate: 'double fabs(double)'
  195 | __MATHCALLX (fabs,, (_Mdouble_ __x), (__const__));
      | ^~~~~~~~~~~
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:195:1: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/cmath:242:3: note: candidate: 'constexpr long double std::fabs(long double)'
  242 |   fabs(long double __x)
      |   ^~~~
/usr/include/c++/14/cmath:242:3: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/cmath:238:3: note: candidate: 'constexpr float std::fabs(float)'
  238 |   fabs(float __x)
      |   ^~~~
/usr/include/c++/14/cmath:238:3: note:   candidate expects 1 argument, 2 provided
Language: C++

#include <bits/stdc++.h>
#include<cname>
using namespace std;

int main() {
  int N,T,A;
  cin>>N>>T>>A;
  vector<int>H(N);
  for(int i=0;i<N;i++){
    cin>>H[i];
  }
  int ans=9999;
  for(int i=0;i<N;i++){
    ans = min(ans,abs(T-H[i]*0.006,A));
  }
}
    


Compiler output:
a.cc:2:9: fatal error: cname: No such file or directory
    2 | #include<cname>
      |         ^~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;

double abs(double x,double y){
  if(x>=y){
    return x-y;
  }
  else{
    return y-x;
  }
}
int main() {
  int N,T,A;
  vector<int> H(N);
  for(int i=0;i<N;i++){
    cin >> H.at(i);
  }
  int ans=1;
  double tem =abs(A,T-H.at(0)*0.006);
  for(int i=1 i<N-1;i++){
    if(tem>abs(A,T-H.at(i))){
      tem=abs(A,T-H.at(i));
      ans=i;
    }
  }
  cout<<ans<<endl;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:14: error: expected ';' before 'i'
   20 |   for(int i=1 i<N-1;i++){
      |              ^~
      |              ;
Language: C++

#include <bits/stdc++.h>
 
using namespace std;
 

// 関数定義
double absol(double x, double y) {
 
  if (x-y<0) {
    return y-x;
  }
  else {
    return x-y;
  }
 
}


int main(){
  int N,T,A;
  cin >> N >> T >> A;
  vector<int> h(N);
  for(int i =0; i<N;i++){
    cin>> h.at(i) ;
  }
  double temp = T-0.006*h.at(0);
  int ans = 0;
  for(int i=1; i<N;i++){
    if(absol(temp,A) > absol(T -0.006*h.at(i),A){
      temp = T-0.006*h.at(i);
      ans = i;
    }
  }
  cout<< ans <<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:49: error: expected ')' before '{' token
   29 |     if(absol(temp,A) > absol(T -0.006*h.at(i),A){
      |       ~                                         ^
      |                                                 )
a.cc:33:3: error: expected primary-expression before '}' token
   33 |   }
      |   ^
Language: C++

#include <bits/stdc++.h>
 
using namespace std;
 

// 関数定義
double absol(double x, double y) {
 
  if (x-y<0) {
    return y-x;
  }
  else {
    return x-y;
  }
 
}


int main(){
  int N,T,A;
  cin >> N >> T >> A;
  vector<int> h(N);
  for(int =0; i<N;i++){
    cin>> h.at(i) ;
  }
  double temp = T-0.006*h.at(0);
  int ans = 0;
  for(int i=1; i<N;i++){
    if(absol(temp,A) > absol(T -0.006*h.at(i),A){
      temp = T-0.006*h.at(i);
      ans = i;
    }
  }
  cout<< ans <<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:11: error: expected unqualified-id before '=' token
   23 |   for(int =0; i<N;i++){
      |           ^
a.cc:23:10: error: expected ';' before '=' token
   23 |   for(int =0; i<N;i++){
      |          ^~
      |          ;
a.cc:23:11: error: expected primary-expression before '=' token
   23 |   for(int =0; i<N;i++){
      |           ^
a.cc:23:15: error: 'i' was not declared in this scope
   23 |   for(int =0; i<N;i++){
      |               ^
a.cc:23:18: error: expected ')' before ';' token
   23 |   for(int =0; i<N;i++){
      |      ~           ^
      |                  )
a.cc:23:19: error: 'i' was not declared in this scope
   23 |   for(int =0; i<N;i++){
      |                   ^
a.cc:29:49: error: expected ')' before '{' token
   29 |     if(absol(temp,A) > absol(T -0.006*h.at(i),A){
      |       ~                                         ^
      |                                                 )
a.cc:33:3: error: expected primary-expression before '}' token
   33 |   }
      |   ^
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main() {
  int n, t, a = 0;
  cin >> n;
  cin >> t >> a;
  double min = 9999;
  double x = 0;
  int res = 1;
  for( int i = 0; i < n; i++ {
    double h = 0;
    cin >> h;
    x = fabs(a - (t - h * 0.006));
    if (x < min) {
      min = x;
      res = i + 1;
    }
  }
  cout << res << endl;
  return 0;
      
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:29: error: expected ')' before '{' token
   11 |   for( int i = 0; i < n; i++ {
      |      ~                      ^~
      |                             )
Language: C++

#include<iostream>
using namespace std;

int main()
{
  int N, T, A;
  cin >> N >> T >> A;
  int H[N];
  for(int i=0; i<N; i++){
    cin >> H[i];
  }
  int a[N], min=A;
  for(int i=0; i<N; i++){
    a[i] = T - H[i];
  }
  int count=0;
  for(int i=0; i<N;i++){
    if(min > abs(A-a[i]))
      min = abs(A - a[i])
      count++;
  }
  cout << count << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:26: error: expected ';' before 'count'
   19 |       min = abs(A - a[i])
      |                          ^
      |                          ;
   20 |       count++;
      |       ~~~~~
Language: C++

#include <iostream>
#include<vector>
#include<algorithm>
#include<cstring>
#include<string>
#include <set>
#include <cassert>
#include<cmath>
#include<climits>
using namespace std;
#define MOD 1000000007
class UnionFind {
	vector<int> data;
public:
	UnionFind(int size) : data(size, -1) { }
	bool unionSet(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 findSet(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)];
	}
};


int find(vector<long long> &arr, long long obj) {
	if (arr[arr.size() - 1] < obj)return arr.size()-1;
	if (arr[0] > obj)return -1;

	int min = 0; int max = arr.size() - 1;
	for (int i = 0; i < arr.size(); i++) {
		if (arr[min+(max-min) / 2] > obj) {
			max = min + (max - min) / 2;
		}
		else {
			min = min + (max - min) / 2;
		}
		if (max - min == 1) {
			return min;
		}
	}


}


int main() {
	double n, t, a;
	cin >> n >> t >> a;
	double *h = new double[n];
	int num;
	double min = INT_MAX;
	for (int i = 0; i < n; i++) {
		cin >> h[i];
		if (abs(a - (t - h[i] * 0.006)) < min) {
			min = abs(a - (t - h[i] * 0.006));
			num = i + 1;
		}
	}
	cout << num;
	



	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:60:32: error: expression in new-declarator must have integral or enumeration type
   60 |         double *h = new double[n];
      |                                ^
a.cc: In function 'int find(std::vector<long long int>&, long long int)':
a.cc:54:1: warning: control reaches end of non-void function [-Wreturn-type]
   54 | }
      | ^
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <stack>
#include <cmath.h>
#define rep(i, n) for(int i = 0; i < (n); ++i)
using namespace std;
template<class T> inline bool chmax(T& a, T b){ if(a < b) { a=b; return 1; }return 0;}
template<class T> inline bool chmin(T& a, T b){ if(a > b) { a=b; return 1; }return 0;}
const long long INF = 1LL << 60;

// --------write my code!!!!!----------//

int main(){
    int res = 0;
    int min = 100000;
    int N,T,A; cin >> N >> T >> A;
    for(int i=1; i<=N; ++i){
        int H; cin >> H;
        if(abs(A-(T-H*0.006))<min){
            min = abs(A-(T-H*0.006));
            res = i;
        }
    }
    cout << res << endl;
}


Compiler output:
a.cc:9:10: fatal error: cmath.h: No such file or directory
    9 | #include <cmath.h>
      |          ^~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
using namespace std;

double diff(double x, double y){
  if(x-y<0){
    return y-x;
  }else{
    return x-y;
  }
}

int main(){
  int n;
  cin>>n;
  
  int T,a;
  cin>>T>>a;
  
  int h[n];
  for(int i=0;i<n;i++){
    cin>>h[i];
  }
  
  double t[n];
  for(int i=0;i<n;i++){
    t[i]=T-h[i]*0.006;
  }
  
  double min=diff(a-t[0]);
  int ans=1;
  for(int i=1;i<n;i++){
    if(min>diff(a-t[i])){
      min = diff(a-t[i]);
      ans = i+1;
    }
  }
  
  cout<<ans<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:18: error: too few arguments to function 'double diff(double, double)'
   29 |   double min=diff(a-t[0]);
      |              ~~~~^~~~~~~~
a.cc:4:8: note: declared here
    4 | double diff(double x, double y){
      |        ^~~~
a.cc:32:16: error: too few arguments to function 'double diff(double, double)'
   32 |     if(min>diff(a-t[i])){
      |            ~~~~^~~~~~~~
a.cc:4:8: note: declared here
    4 | double diff(double x, double y){
      |        ^~~~
a.cc:33:17: error: too few arguments to function 'double diff(double, double)'
   33 |       min = diff(a-t[i]);
      |             ~~~~^~~~~~~~
a.cc:4:8: note: declared here
    4 | double diff(double x, double y){
      |        ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;

#define FOR(i,a,b) for(int i = (a);i < (b);++i)

typedef long long ll;
double abs(double x){
    if(x >= 0) return x;
    else return -1*x;
}
int main(){
    int N; cin >> N;
    double T,A; cin >> T >> A;
    vector<pair<double,int>> P(N);
    for(int i = 0;i < N;i++){
        double h; cin >> h;
        P[i] = make_pair(abs(A-(T - h*0.006)),i);
    }
    sort(P.begin(),P.end());
    cout << P[0].second + 1 << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:29: error: call of overloaded 'abs(double)' is ambiguous
   17 |         P[i] = make_pair(abs(A-(T - h*0.006)),i);
      |                          ~~~^~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/cstdlib:79,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:42,
                 from a.cc:1:
/usr/include/stdlib.h:980:12: note: candidate: 'int abs(int)'
  980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
      |            ^~~
a.cc:7:8: note: candidate: 'double abs(double)'
    7 | double abs(double x){
      |        ^~~
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: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:79:3: note: candidate: 'constexpr long double std::abs(long double)'
   79 |   abs(long double __x)
      |   ^~~
/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:71:3: note: candidate: 'constexpr double std::abs(double)'
   71 |   abs(double __x)
      |   ^~~
/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:56:3: note: candidate: 'long int std::abs(long int)'
   56 |   abs(long __i) { return __builtin_labs(__i); }
      |   ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;

#define FOR(i,a,b) for(int i = (a);i < (b);++i)

typedef long long ll;
double abs(double x){
    if(x >= 0) return x;
    else return -1*x;
}
int main(){
    int N; cin >> N;
    double T,A; cin >> T >> A;
    vector<pair<double,int>> P(N);
    for(int i = 0;i < N;i++){
        double h; cin >> h;
        P[i] = make_pair(abs(A-(T -t*0.006)),i);
    }
    sort(P.begin(),P.end());
    cout << P[0].second + 1 << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:36: error: 't' was not declared in this scope
   17 |         P[i] = make_pair(abs(A-(T -t*0.006)),i);
      |                                    ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,T,A;
  cin>>N>>T>>A;
  vector<int> height(0);
  for(int i=0;i<N;i++){
    cin>>height[i];
  }
  int k,l=1;
  if(A<T-height[0]*0.006){
    k=T-height[0]*0.006-A;
  }
  else{
    k=A-T+height[0]*0.006;
  }
  for(int j=1;j<N-1;j++){
    if(A<T-height[j]&&k>T-height[j]-A){
      k=T-height[j]-A;
      l=i+1;
    }
    if(A>T-height[j]&&k>A-(T-height[j])){
      k=A-(T-height[j]);
      l=i+1;
    }
  }
  cout<<l<<endl;
}
      

Compiler output:
a.cc: In function 'int main()':
a.cc:20:9: error: 'i' was not declared in this scope
   20 |       l=i+1;
      |         ^
a.cc:24:9: error: 'i' was not declared in this scope
   24 |       l=i+1;
      |         ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,T,A,a,b;
  cin>>N>>T>>A;
  cin>>a;
  if(a>=A){
    a=a-A;
  }
  if(a<A){
    a=A-a;
  }
  b=1
  for(int i=0;i<N-1;i++){
    int H;
    cin>>H;
    if(H<A&&(A-H)<a){
      a=A-H;
      b=i+1;
    }
    if(H>=A&&(H-A)>a){
      a=H-A;
      b=i+1;
    }
  }
  cout<<b<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:6: error: expected ';' before 'for'
   13 |   b=1
      |      ^
      |      ;
   14 |   for(int i=0;i<N-1;i++){
      |   ~~~ 
a.cc:14:15: error: 'i' was not declared in this scope
   14 |   for(int i=0;i<N-1;i++){
      |               ^
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main(){
    int n, t, a, h, i, p;
    double min = 999999999;
    cin >> n >> t >> a;
    for(i=1; i<=n; i++){
        cin >> h;
        if((double)abs(a - t + x*0.006) < min){
            min = (double)abs(a - t + x*0.006);
            p = i;
        }
    }
    cout << p;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:32: error: 'x' was not declared in this scope
   10 |         if((double)abs(a - t + x*0.006) < min){
      |                                ^
Language: C++

#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
using namespace std;
int main() {
  int N,T,A;
  cin >> N >> T >> A;
  
  int H[N];
  for (int i=0; i<N; i++) cin >> H[i];
  
  int nimimum = 100000;
  int count = 0;
  double sa = 1000000;
  for (int i=0; i<N; i++) {
    sa = abs(T - H[i] * 0.006);
    minimum = min(minimum,sa);
    count++;
  }
  cout << count << endl;
}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:18:5: error: 'minimum' was not declared in this scope; did you mean 'nimimum'?
   18 |     minimum = min(minimum,sa);
      |     ^~~~~~~
      |     nimimum
Language: C++

#include <iostream>
#include <string>
#include<math.h>
using namespace std;

int main() {
	int N;
	int T, A;
	cin >> N >> T >> A;
	int H[1010];
	
	for (int i = 0; i < N; ++i) cin >> H[i];
	int ans = H[0];

	for (int i = 1; i < N; ++i) {
		double T1, T2;
		T1 = fabs((double)A-(double)T - (double)ans * 0.006);
		T2 = fabs((double)A - (double)T - (double)H[i] * 0.006);
		if (T1 > T2)  ans = A[i];
	}
	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:38: error: invalid types 'int[int]' for array subscript
   19 |                 if (T1 > T2)  ans = A[i];
      |                                      ^
Language: C++

#include <iostream>
#include <string>
#include<math.h>
using namespace std;

int main() {
	int N;
	int T, A;
	cin >> N >> T >> A;
	int H[1010];
	
	for (int i = 0; i < N; ++i) cin >> H[i];
	int ans = H[0];

	for (int i = 1; i < N; ++i) {
		double T1, T2;
		T1 = fabs((double)A-(double)T - (double)ans * 0.006);
		T2 = fabs((double)A - (double)T - (double)H[i] * 0.006);
		if(T1>T2)  ans=A[i]
	}
	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:33: error: invalid types 'int[int]' for array subscript
   19 |                 if(T1>T2)  ans=A[i]
      |                                 ^
Language: C

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>

#define MAX 99.9999

double kion(double T,double x){
	return (T - x * 0.006);
}

int main(int argc, char const *argv[])
{
	int N;
	double T,A;
	double H[1000];
	int mini;
	double min = 99.9999;
	scanf("%d",&N);
	scanf("%lf%lf",&T,&A);
	for (int i = 0; i < N; ++i){
		scanf("%lf",&H[i]);
		H[i] = kion(T,H[i]);
		if(fabs(H[i] - A) < min){
			mini = i;
			min = H[i];
		}
	}
	printf("%d\n",i + 1);
	return 0;
}


Compiler output:
main.c: In function 'main':
main.c:30:23: error: 'i' undeclared (first use in this function)
   30 |         printf("%d\n",i + 1);
      |                       ^
main.c:30:23: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>

#define MAX 99.9999

double kion(double T,double x){
	return (T - x * 0.006);
}

int main(int argc, char const *argv[])
{
	int N;
	double T,A;
	double H[1000];
	int mini;
	double min = 99.9999;
	scanf("%d",&N);
	scanf("%lf%lf",&T,&A);
	for (int i = 0; i < N; ++i){
		scanf("%lf",&H[i]);
		H[i] = kion(T,H[i]);
		if(fabs(H[i] - A) < min){
			mini = i;
			min = H[i];
	}
	printf("%d\n",i + 1);
	return 0;
}


Compiler output:
main.c: In function 'main':
main.c:31:1: error: expected declaration or statement at end of input
   31 | }
      | ^
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;

int main(){
	double N,T,A,H,minT,a;
  	int ans;
	cin>>N>>T>>A;
  	minT=A-T;
  	if(minT<0)minT=-minT;
  	for(int i=0;i<N;++i){
      cin>>H[i];
      a=A-T+H[i]*0.006;
      if(a<0)a=-a;
      minT=min(minT,a);
      if(minT==a)ans=i;
    }
     cout<<ans<<endl;
  	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:13: error: invalid types 'double[int]' for array subscript
   12 |       cin>>H[i];
      |             ^
a.cc:13:14: error: invalid types 'double[int]' for array subscript
   13 |       a=A-T+H[i]*0.006;
      |              ^
Language: C++

#include <iostream>
using namespace std;

int main() {
	int N, T, A, H, minP = 0, minH = 10000;
	cin >> N >> T >> A;
	for (int i = 0; i < N; i++) {
		cin >> H;
		double t = T - H * 0.006;
		double d = fabs(A - t);
		if (d < minH) {
			minH = d;
			minP = i;
		}
	}
	cout << minP + 1 << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:28: error: 'fabs' was not declared in this scope; did you mean 'labs'?
   10 |                 double d = fabs(A - t);
      |                            ^~~~
      |                            labs
Language: Java

import java.util.*;
import java.lang.*;
 
public class Main{
	public static void main(String[] args){
    	Scanner scan = new Scanner(System.in);
      	int n = scan.nextInt(); //number of spot
      	int T = scan.nextInt(); //state temperature
      	int A = scan.nextInt(); // temperature that princess wants
      	int[] H = new int[n]; // list of height
      	for (int i = 0; i < n; i++){
        	H[i] = scan.nextInt();
        }
      	int[] t = new int[n]; //list of temperature
      	for (int i = 0; i < n; i++){
        	t[i] = T - 0.006 * H[i];
        }
      	int rest = Math.abs(t[0]-A);
      	int key = 0;
      	for (int i = 0; i < n; i++){
        	if(rest > Math.abs(t[i]-A)){
            	rest = Math.abs(t[i]-A);
              	key = i;
            }
        }
      	System.out.print(key);
    }
}

Compiler output:
Main.java:16: error: incompatible types: possible lossy conversion from double to int
        	t[i] = T - 0.006 * H[i];
        	         ^
1 error
Language: Java

import java.util.*;
import java.lang.*;

public class Main{
	public static void main(String[] args){
    	Scanner scan = new Scanner(System.in);
      	int n = scan.nextInt(); //number of spot
      	int T = scan.nextInt(); //state temperature
      	int A = scan.nextInt(); // temperature that princess wants
      	int[] H = new int[n]; // list of height
      	for (int i = 0; i < n; i++){
        	H[i] = scan.nextInt();
        }
      	int[] t = new int[]; //list of temperature
      	for (int i = 0; i < n; i++){
        	t[i] = T - 0.006 * H[i];
        }
      	int rest = Math.abs(t[0]-A);
      	for (int i = 0; i < n; i++){
        	if(rest > Math.abs(t[i]-A)){
            	rest = Math.abs(t[i]-A);
            }
        }
      	System.out.print(rest);
    }
}

Compiler output:
Main.java:14: error: array dimension missing
      	int[] t = new int[]; //list of temperature
      	                   ^
1 error