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

#include <iostream>
using namespace std;
int N,A,T,M,i;
int H[999999];
int S[999999];
int P[999999];

int main(){
    cin >> N;
    for (i=0; i<N; i++) cin >> H[i];
    for (i=0; i<N; i++) S[i]=T-0.006*H[i];
    for (i=0; i<N; i++){
         if (S[i]>A) {P[i]=S[i]-A;}
        else {P[i]=A-S[i]}
    }
    M=P[0];
    for(int i=1;i<N;i++){
		if(M>P[i]) M=P[i];
    }
    cout << M << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:26: error: expected ';' before '}' token
   14 |         else {P[i]=A-S[i]}
      |                          ^
      |                          ;
Language: C++

#include<iostream>
using namespace std;

int main(){
  int N,T,goAl,mini,answer;
  cin>>N>>T>>goAl;
  int altitude[N];
  for(int i=0;i<N;i++){
    cin>>altitude[i];
    float temp=T-0.006*altitude[i];
    if(abs(temp[i]-goAl)<mini){
      mini=abs(temp[i]-goAl);
      answer=i;
    }
  }
  cout<<answer<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:16: error: invalid types 'float[int]' for array subscript
   11 |     if(abs(temp[i]-goAl)<mini){
      |                ^
a.cc:12:20: error: invalid types 'float[int]' for array subscript
   12 |       mini=abs(temp[i]-goAl);
      |                    ^
Language: C++

#include<iostream>
using namespace std;

int main(){
  int N,T,goAl,mini,answer;
  cin>>N>>T>>goAl;
  int altitude[N],temp[N];
  for(int i=0;i<N;i++){
    cin>>altitude[i];
    int temp[i]=T-0.006*altitude[i];
    if(abs(temp[i]-goAl)<mini){
      mini=abs(temp[i]-goAl);
      answer=i;
    }
  }
  cout<<answer<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:18: error: array must be initialized with a brace-enclosed initializer
   10 |     int temp[i]=T-0.006*altitude[i];
      |                 ~^~~~~~~~~~~~~~~~~~
Language: C++

#include<iostream>
using namespace std;

int main(){
  int N,T,goAl,mini,answer;
  cin>>N>>T>>goAl;
  int altitude[N],temp[N];
  for(int i=0;i<N;i++){
    cin>>altitude[i];
    int temp[i]=T-0.006*alttitude[i];
    if(abs(temp[i]-goAl)<min){
      min=abs(temp[i]-goAl);
      answer=i;
    }
  }
  cout<<answer<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:25: error: 'alttitude' was not declared in this scope; did you mean 'altitude'?
   10 |     int temp[i]=T-0.006*alttitude[i];
      |                         ^~~~~~~~~
      |                         altitude
a.cc:11:25: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<'
   11 |     if(abs(temp[i]-goAl)<min){
      |        ~~~~~~~~~~~~~~~~~^~~~
a.cc:12:27: error: overloaded function with no contextual type information
   12 |       min=abs(temp[i]-goAl);
      |                           ^
Language: C++

n =int(input())
t,a = map(int,input().split())
h = list(map(int,input().split()))
H=[]
for i in range(n):
  H.append(abs(a - (t - 0.006*h[i])))
for j in range(n):
  if H[j] == min(H):
    print(j+1)

Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n =int(input())
      | ^
Language: C++

#include "bits/stdc++.h"
using namespace std;
int main() {
	int n;
	cin >> n;
	int t;
	cin >> t;
	int a;
	cin >> a;
	vector <double> h(n);
	for (int i = 0; i < n; ++i) cin >> h.at(i);
	for (int i = 0; i < n; ++i) h.at(i) = t - h.at(i) * 0.006;
	double res = 1000001;
	int cnt;
	for (int i = 0; i < n; ++i) {
		h.at(i) = a - h.at(i);
		if (h.at(i) < 0) h.at(i) = h.at(i) * (-1);
		if (h.at(i) < res) {
			res = h.at(i);
			cnt = i;
		}
	}
	cout << cnt + 1 << endl;


Compiler output:
a.cc: In function 'int main()':
a.cc:23:33: error: expected '}' at end of input
   23 |         cout << cnt + 1 << endl;
      |                                 ^
a.cc:3:12: note: to match this '{'
    3 | int main() {
      |            ^
Language: C++

#include <bits/stdc++.h>
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.at(i);
  }
  
 int tem,tem2;
  int count = 0;
  
  for (int i=0; i < N; i++){
      tem = abs(A - (T - H.at(i))*6/1000)*1000;
      tem2 = abs(A - (T - H.at(i + 1))*6/1000)*1000;
      if (tem2 < tem){count = i + 1};
    }
  cout << count << endl; 
    
    
  }
  
  

Compiler output:
a.cc: In function 'int main()':
a.cc:18:36: error: expected ';' before '}' token
   18 |       if (tem2 < tem){count = i + 1};
      |                                    ^
      |                                    ;
Language: C++

#include <bits/stdc++.h>
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.at(i);
  }
  
 int tem,tem2;
  int count = 0;
  
  for (int i=0; i < N; i++){
      tem = abs(A - (T - H.at(i))*6/1000)*1000;
      tem2 = abs(A - (T - H.at(i + 1))*6/1000)*1000;
      if (tem2 < tem){count = i + 1;}
    }
  }
  cout << count << endl; 
    
    
  }
  
  

Compiler output:
a.cc:21:3: error: 'cout' does not name a type
   21 |   cout << count << endl;
      |   ^~~~
a.cc:24:3: error: expected declaration before '}' token
   24 |   }
      |   ^
Language: C++

#include <bits/stdc++.h>
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.at(i);
  }
  
 int tem,tem2;
  int count = 0;
  
  for (int i=0; i < N-1; i++){
    for(int j = i+1; j < N; j++){
      tem = abs(A - (T - H.at(i)*6/1000)*1000;
      tem2 = abs(A - (T - H.at(j))*6/1000)*1000;
      if (tem2 < tem){count++;}
    }
  }
  cout << count << endl; 
    
    
  }
  
  

Compiler output:
a.cc: In function 'int main()':
a.cc:17:46: error: expected ')' before ';' token
   17 |       tem = abs(A - (T - H.at(i)*6/1000)*1000;
      |                ~                             ^
      |                                              )
Language: C++

#include <iostream>
#include <string>

using namespace std;

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

Compiler output:
a.cc: In function 'int main()':
a.cc:10:3: error: 'vector' was not declared in this scope
   10 |   vector<int> H(N);
      |   ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include <iostream>
  +++ |+#include <vector>
    2 | #include <string>
a.cc:10:10: error: expected primary-expression before 'int'
   10 |   vector<int> H(N);
      |          ^~~
a.cc:15:36: error: 'H' was not declared in this scope
   15 |   for(int i =0; i < N; i++) cin >> H[i];
      |                                    ^
a.cc:17:16: error: 'H' was not declared in this scope
   17 |     if(abs(T - H[i]*0.006 - A) < min){
      |                ^
a.cc:22:11: error: 'i' was not declared in this scope
   22 |   cout << i;
      |           ^
Language: C

#include <stdio.h>
#include <math.h>
int main(void){
  int n,t,a,h,i,r;
  double d=1000.0,c;
  scanf("%d%d%d",&n,&t,&a);
  for(i=1;i<=n;i++){
    scanf("%d",&h);
    c=fabs(a-(t-h*0.006));
    if(c<d){ d=c; r=i }
  }
  printf("%d",r);
}

Compiler output:
main.c: In function 'main':
main.c:10:22: error: expected ';' before '}' token
   10 |     if(c<d){ d=c; r=i }
      |                      ^~
      |                      ;
Language: C

#include <stdio.h>
#include <math.h>
int main(void){
  int n,t,a,h,i,r;
  double d=1000.0,c;
  scanf("%d%d%d",&n,&t,&a);
  for(i=1;i<=n;i++){
    scanf("%d",&h);
    c=abs(a-(t-h*0.006));
    if(c<d){ d=c; r=i }
  }
  printf("%d",r);
}

Compiler output:
main.c: In function 'main':
main.c:9:7: error: implicit declaration of function 'abs' [-Wimplicit-function-declaration]
    9 |     c=abs(a-(t-h*0.006));
      |       ^~~
main.c:3:1: note: include '<stdlib.h>' or provide a declaration of 'abs'
    2 | #include <math.h>
  +++ |+#include <stdlib.h>
    3 | int main(void){
main.c:9:12: warning: 'abs' argument 1 type is 'double' where 'int' is expected in a call to built-in function declared without prototype [-Wbuiltin-declaration-mismatch]
    9 |     c=abs(a-(t-h*0.006));
      |           ~^~~~~~~~~~~~
<built-in>: note: built-in 'abs' declared here
main.c:10:22: error: expected ';' before '}' token
   10 |     if(c<d){ d=c; r=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 clsd = 1110, clsi;
  for (int i = 0; i < N; ++i) {
    double tmpr = (double)T - (double)H[i] * 0.006
    double d = tmpr - (double)A;
    if (d < 0) d = -d;
    if (d < clsd) { clsd = d; clsi = i; }
  }
  cout << (clsi + 1) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:5: error: expected ',' or ';' before 'double'
   11 |     double d = tmpr - (double)A;
      |     ^~~~~~
a.cc:12:9: error: 'd' was not declared in this scope
   12 |     if (d < 0) d = -d;
      |         ^
a.cc:13:9: error: 'd' was not declared in this scope
   13 |     if (d < clsd) { clsd = d; clsi = i; }
      |         ^
Language: C++

#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<algorithm>
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];
	}
	double deg = DBL_MAX;
	int ans;
	for (int i = 0; i < n; i++)
	{
		double temp = fabs(a - (t - h[i] * 0.006));
		if (temp < deg) {
			deg = temp;
			ans = i + 1;
		}
	}

	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:22: error: 'DBL_MAX' was not declared in this scope
   16 |         double deg = DBL_MAX;
      |                      ^~~~~~~
a.cc:6:1: note: 'DBL_MAX' is defined in header '<cfloat>'; this is probably fixable by adding '#include <cfloat>'
    5 | #include<algorithm>
  +++ |+#include <cfloat>
    6 | using namespace std;
a.cc:20:31: error: 'fabs' was not declared in this scope; did you mean 'labs'?
   20 |                 double temp = fabs(a - (t - h[i] * 0.006));
      |                               ^~~~
      |                               labs
Language: C++

#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<algorithm>
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 deg = INT16_MAX;
	int ans;
	for (int i = 0; i < n; i++)
	{
		int temp = abs(a - (t - h[i] * 0.006));
		if (temp < deg) {
			deg = temp;
			ans = i + 1;
		}
	}

	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:19: error: 'INT16_MAX' was not declared in this scope
   16 |         int deg = INT16_MAX;
      |                   ^~~~~~~~~
a.cc:6:1: note: 'INT16_MAX' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
    5 | #include<algorithm>
  +++ |+#include <cstdint>
    6 | using namespace std;
Language: C++

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

int main(){
  int n,t,a,h[n];
  cin >> n >> t >> a;
  for (int i=0;i<n;i++){
    cin >> h[i];
  }
  for (int i=0;i<n;i++){
	h[i]=1000*t-6*h[i];
  }
  int h[n];
  int ans=1200000;
  for (int i=0;i<n;i++){
    h[i]=abs(1000*a-h[i]);
  ans=min(ans,h[i]);
  }
  int x;
  for (int i=0;i<n;i++){
    if(ans == h[i]){
      x=i;
    }
  }
  cout << x+1 << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:7: error: redeclaration of 'int h [n]'
   15 |   int h[n];
      |       ^
a.cc:7:13: note: 'int h [n]' previously declared here
    7 |   int n,t,a,h[n];
      |             ^
Language: C++

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

int main(){
  int n,t,a,h[n];
  cin >> n >> t >> a;
  for (int i=0;i<n;i++){
    cin >> h[i];
  }
  for (int i=0;i<n;i++){
	h[i]=t-0.006*h[i];
  }
  int p[n];
  int ans=120;
  for (int i=0;i<n;i++){
    p[i]=abs(a-c[i]);
  ans=min(ans,p[i]);
  }
  int x;
  for (int i=0;i<n;i++){
    if(ans == p[i]){
      x=i;
    }
  }
  cout << x << endl;
}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:18:16: error: 'c' was not declared in this scope
   18 |     p[i]=abs(a-c[i]);
      |                ^
Language: C++

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

int main(){
  int n,t,a,h[n];
  cin >> n >> t >> a;
  for (int i=0;i<n;i++){
    cin >> h[i];
  }
  for (int i=0;i<n;i++){
	h[i]=t-1000*h[i];
  }
  int p[n];
  int ans=120;
  for (int i=0;i<n;i++){
    p[i]=abs(a,h[i]);
  ans=min(ans,p[i]);
  }
  int x;
  for (int i=0;i<n;i++){
    if(ans == p[i]){
      x=i;
    }
  }
  cout << x << endl;
}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:18:13: error: no matching function for call to 'abs(int&, int&)'
   18 |     p[i]=abs(a,h[i]);
      |          ~~~^~~~~~~~
In file included from /usr/include/c++/14/cstdlib:79,
                 from /usr/include/c++/14/ext/string_conversions.h:43,
                 from /usr/include/c++/14/bits/basic_string.h:4154,
                 from /usr/include/c++/14/string:54,
                 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/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
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>

using namespace std;

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

	int h, index, sub;
	for (int i = 0; i < N; i++)
	{
		cin >> h;

		double point = abs((double)T - h * 0.006 - A);
      
        if(i == 0) sub = point, continue;
      
		if (sub > point)
		{
			sub = point;
			index = i + 1;
		}
	}

	cout << index << endl;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:33: error: expected primary-expression before 'continue'
   21 |         if(i == 0) sub = point, continue;
      |                                 ^~~~~~~~
Language: C++

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

int main(){
	int n;cin>>n;
	int t,a;cin>>t>>a;
	vector<int>h;
	for(int i=0;i<n;i++){
		int x;cin>>x;h.push_back(x);
	}
	double min = 100000;
	int ans;
	for(int i=0;i<h.size();i++){
		if(min>abs(a-t+(0.0006 * h[i]))){
			min = abs(a-t+(0.0006 * h[i]));
			ans = i+1;
		}
	}
	cout<<ans<<endl;
}

Compiler output:
a.cc:2:21: error: stray '#' in program
    2 | using namespace std;#include<bits/stdc++.h>
      |                     ^
a.cc:2:22: error: 'include' does not name a type
    2 | using namespace std;#include<bits/stdc++.h>
      |                      ^~~~~~~
Language: C++

#include <cstdio>
#include <cstdint>
#include <iostream>
#include <algorithm>
#include <array>
#include <vector>
#include <unordered_map>

int main()
{
    int n, t, a;
    std::cin >> n >> t >> a;

    double min = 999999999;
    int min_n = 0;
    int h = 0;
    for (std::size_t i = 0; i < n; ++i) {
        std::cin >> h;
        double temp = t - h * 0.006;
        double diff = std::fabs(a - temp);
        if (diff < min) {
            min = diff;
            min_n = i + 1;
        }
    }

    std::cout << min_n << std::endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:28: error: 'fabs' is not a member of 'std'; did you mean 'labs'?
   20 |         double diff = std::fabs(a - temp);
      |                            ^~~~
      |                            labs
Language: C++

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

int main(){
	int n, ans = 0;
	double t, a, temp = DBL_MAX;
	cin >> n >> t >> a;
	for (int i = 1; i <= n; i++) {
		double h;
		cin >> h;
		if (abs(a - (t - h * 0.006)) < temp) {
			temp = abs(a - (t - h * 0.006));
			ans = i;
		}
	}
	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:29: error: 'DBL_MAX' was not declared in this scope
    9 |         double t, a, temp = DBL_MAX;
      |                             ^~~~~~~
a.cc:5:1: note: 'DBL_MAX' is defined in header '<cfloat>'; this is probably fixable by adding '#include <cfloat>'
    4 | #include <cmath>
  +++ |+#include <cfloat>
    5 | using namespace std;
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main(){
	int n, m;
	cin >> n >> t >> a;
	double t,a,h[n];
	double ans = 1e18;

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

Compiler output:
a.cc: In function 'int main()':
a.cc:7:21: error: 't' was not declared in this scope
    7 |         cin >> n >> t >> a;
      |                     ^
a.cc:7:26: error: 'a' was not declared in this scope
    7 |         cin >> n >> t >> a;
      |                          ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
float n,t,a,ondosa=INT_MAX,ans;
  cin >> n >> t >>a;
  float h[n];
  for (int i=0;i<n;i++){
  	cin >> h[i];
    if(t-0.006*h[i]<ondosa) {
      ondosa=t-0.006*h[i];
      ans=i+1;
    }
  }
  cout << ans <<endl;
  
}

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

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

int main()
{
  int n,t,a,H[1000],num=1;
  double f;
  cin>>n;
  cin>>t>>a;
  for(int i=0;i<n;i++) cin>>H[i];
  f=fab(a-(t-H[0]*0.006));
  for(int i=1;i<n;i++){
    if(fab(a-(t-H[i]*0.006))<f){
      f=a-(t-H[i]*0.006);
      num=i+1;
    }
  }
  cout<<num<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:5: error: 'fab' was not declared in this scope; did you mean 'fabs'?
   11 |   f=fab(a-(t-H[0]*0.006));
      |     ^~~
      |     fabs
Language: C++

#include "bits/stdc++.h"

using namespace std;

#define print(s) cout << (s) << endl;
#define sp(x) cout<<setprecision(x);
#define rep(i,n)  for (int i = 0; i < (n); i++)
#define all(a) a.begin(), (a).end()
#define gre(t) greater<t>()
 
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, t;
    cin >> n >> t >> a;
    vector<int> a(n);

    rep(i,n){
        cin >> a[i];
    }
    int ans;
    double best = inf;
    double tem = inf;
    rep(i,n){
        tem = abs(a - (a[i]*0.006));
        if(tem < best){
           best = tem; 
           ans = i+1;
        }
    }
    print(ans);


}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:22: error: 'a' was not declared in this scope
   15 |     cin >> n >> t >> a;
      |                      ^
a.cc:22:19: error: 'inf' was not declared in this scope; did you mean 'ynf'?
   22 |     double best = inf;
      |                   ^~~
      |                   ynf
Language: C++

#include "bits/stdc++.h"

using namespace std;

#define print(s) cout << (s) << endl;
#define sp(x) cout<<setprecision(x);
#define rep(i,n)  for (int i = 0; i < (n); i++)
#define all(a) a.begin(), (a).end()
#define gre(t) greater<t>()
#define inf = 9876543210
 
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, t;
    cin >> n >> t >> a;
    vector<int> a(n);

    rep(i,n){
        cin >> a[i];
    }
    int ans;
    double best = inf;
    double tem = inf;
    rep(i,n){
        tem = abs(a - (a[i]*0.006));
        if(tem < best){
           best = tem; 
           ans = i+1;
        }
    }
    print(ans);


}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:22: error: 'a' was not declared in this scope
   16 |     cin >> n >> t >> a;
      |                      ^
a.cc:10:13: error: expected primary-expression before '=' token
   10 | #define inf = 9876543210
      |             ^
a.cc:23:19: note: in expansion of macro 'inf'
   23 |     double best = inf;
      |                   ^~~
a.cc:10:13: error: expected primary-expression before '=' token
   10 | #define inf = 9876543210
      |             ^
a.cc:24:18: note: in expansion of macro 'inf'
   24 |     double tem = inf;
      |                  ^~~
Language: C++

#include "bits/stdc++.h"

using namespace std;

#define print(s) cout << (s) << endl;
#define sp(x) cout<<setprecision(x);
#define rep(i,n)  for (int i = 0; i < (n); i++)
#define all(a) a.begin(), (a).end()
#define gre(t) greater<t>()
 
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, t, a;
    cin >> n >> t >> a;
    vector<int> a(n);

    rep(i,n){
        cin >> a[i];
    }
    int ans;
    double best = inf;
    double tem = inf;
    rep(i,n){
        tem = abs(a - (a[i]*0.006))
        if(tem < best){
           best = tem; 
           ans = i+1;
        }
    }
    print(ans);


}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:17: error: conflicting declaration 'std::vector<int> a'
   16 |     vector<int> a(n);
      |                 ^
a.cc:14:15: note: previous declaration as 'int a'
   14 |     int n, t, a;
      |               ^
a.cc:19:17: error: invalid types 'int[int]' for array subscript
   19 |         cin >> a[i];
      |                 ^
a.cc:22:19: error: 'inf' was not declared in this scope; did you mean 'ynf'?
   22 |     double best = inf;
      |                   ^~~
      |                   ynf
a.cc:25:25: error: invalid types 'int[int]' for array subscript
   25 |         tem = abs(a - (a[i]*0.006))
      |                         ^
Language: C++

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

int abs(int x, int y){
    if(x < y){
      return y - x;
    }
    else{
      return x - y;
    }
  }

int main(){
  int N, T, A;
  cin >> N >> T >> A;
  int divide = 100;
  for(i = 0; i < N;i++){
    int Hi;
    cin >> Hi;
    if(divide  > abs((T - A) / 0.006, Hi)){
      divide = abs((T - A) / 0.006, Hi);
      int ans = i;
    }
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:7: error: 'i' was not declared in this scope
   17 |   for(i = 0; i < N;i++){
      |       ^
a.cc:25:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   25 |   cout << ans << endl;
      |           ^~~
      |           abs
Language: C++

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

int main(){
  int N, T, A;
  cin >> N >> T >> A;
  
  int abs(x,y){
    if(x < y){
      return y - x;
    }
    else{
      return x - y;
    }
  }
  
  int divide = 100;
  for(i = 0; i < N;i++){
    int Hi;
    cin >> Hi;
    if(divide  > abs((T - A) / 0.006, Hi)){
      divide = abs((T - A) / 0.006, Hi);
      int ans = i;
    }
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:11: error: 'x' was not declared in this scope
    8 |   int abs(x,y){
      |           ^
a.cc:8:13: error: 'y' was not declared in this scope
    8 |   int abs(x,y){
      |             ^
a.cc:8:14: error: expression list treated as compound expression in initializer [-fpermissive]
    8 |   int abs(x,y){
      |              ^
a.cc:18:7: error: 'i' was not declared in this scope
   18 |   for(i = 0; i < N;i++){
      |       ^
a.cc:21:21: error: 'abs' cannot be used as a function
   21 |     if(divide  > abs((T - A) / 0.006, Hi)){
      |                  ~~~^~~~~~~~~~~~~~~~~~~~~
a.cc:22:19: error: 'abs' cannot be used as a function
   22 |       divide = abs((T - A) / 0.006, Hi);
      |                ~~~^~~~~~~~~~~~~~~~~~~~~
a.cc:26:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   26 |   cout << ans << endl;
      |           ^~~
      |           abs
Language: C++

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

int main(){
  int N, T, A;
  cin >> N >> T >> A;
  
  int abs(x,y){
    if(x < y){
      return y - x;
    }
    else{
      return x - y;
    }
  }
  
  int divide = 100;
  for(i = 0; i < N;i++){
    int Hi;
    cin >> Hi;
    if(divide > (T - A) / Hi){
      divide = (T - A) / Hi;
    }
  }
  cout << divide << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:11: error: 'x' was not declared in this scope
    8 |   int abs(x,y){
      |           ^
a.cc:8:13: error: 'y' was not declared in this scope
    8 |   int abs(x,y){
      |             ^
a.cc:8:14: error: expression list treated as compound expression in initializer [-fpermissive]
    8 |   int abs(x,y){
      |              ^
a.cc:18:7: error: 'i' was not declared in this scope
   18 |   for(i = 0; i < N;i++){
      |       ^
Language: C++

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

int main(){
  int N, T, A;
  cin >> N >> T >> A;
  
  int abs(x,y){
    if(x < y){
      return y - x
    }
    else{
      return x - y
    }
  }
  
  int divide = 100
  for(i = 0; i < N;i++){
    int Hi;
    cin >> Hi;
    if(divide > (T - A) / Hi){
      divide = (T - A) / Hi;
    }
  }
  cout << divide << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:11: error: 'x' was not declared in this scope
    8 |   int abs(x,y){
      |           ^
a.cc:8:13: error: 'y' was not declared in this scope
    8 |   int abs(x,y){
      |             ^
a.cc:8:14: error: expression list treated as compound expression in initializer [-fpermissive]
    8 |   int abs(x,y){
      |              ^
a.cc:18:3: error: expected ',' or ';' before 'for'
   18 |   for(i = 0; i < N;i++){
      |   ^~~
a.cc:18:14: error: 'i' was not declared in this scope
   18 |   for(i = 0; i < N;i++){
      |              ^
Language: C++

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <math.h>
#include <cmath>
using namespace std;
#define maxn 100000
long long h[maxn];
/*int fabs(int a,int b)
{
    if((a-b)>0)
        return a-b;
    else
        return b-a;
}*/
int main()
{
    int n,t,a;
    while(cin>>n>>t>>a)
    {
        for(int i=1;i<=n;i++)
    {
        cin>>h[i];
    }
   int min=99999;
   int sum,cnt;
    for(int i=1;i<=n;i++)
    {
        sum=fabs(a,t-h[i]*0.006);
        if(min>sum)
        {
            min=sum;
            cnt=i;
        }
    }
    cout<<cnt<<endl;
    }

}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:17: error: no matching function for call to 'fabs(int&, double)'
   29 |         sum=fabs(a,t-h[i]*0.006);
      |             ~~~~^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/math.h:36,
                 from a.cc:4:
/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/cstdio:41,
                 from a.cc:1:
/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 <cstdio>
#include <iostream>
#include <algorithm>
#include <math.h>
using namespace std;
#define maxn 100000
long long h[maxn];
/*int fabs(int a,int b)
{
    if((a-b)>0)
        return a-b;
    else
        return b-a;
}*/
int main()
{
    int n,t,a;
    while(cin>>n>>t>>a)
    {
        for(int i=1;i<=n;i++)
    {
        cin>>h[i];
    }
   int min=99999;
   int sum,cnt;
    for(int i=1;i<=n;i++)
    {
        sum=fabs(a,t-h[i]*0.006);
        if(min>sum)
        {
            min=sum;
            cnt=i;
        }
    }
    cout<<cnt<<endl;
    }

}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:17: error: no matching function for call to 'fabs(int&, double)'
   28 |         sum=fabs(a,t-h[i]*0.006);
      |             ~~~~^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/math.h:36,
                 from a.cc:4:
/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/cstdio:41,
                 from a.cc:1:
/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<stdio.h>
int main(){
  int n,t,a,h[i];
  scanf("%d%d%d",&n,&t,&a);
  for(i=0;i<n;i++){
    scanf("%d",h[i]);
  }
  double b;
  double tem=t-h[i]*0.006;
  for(i=0;i<n;i++){
  if(a>tem)b[i]=a-tem;
  else b[i]=tem-a;
  }
  double min=b[0];
  for(i=0;i<n;i++){
    if(b[i]<b[0])min=b[i];
  }
  printf("%d\n",min);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:3:15: error: 'i' undeclared (first use in this function)
    3 |   int n,t,a,h[i];
      |               ^
main.c:3:15: note: each undeclared identifier is reported only once for each function it appears in
main.c:14:15: error: subscripted value is neither array nor pointer nor vector
   14 |   double min=b[0];
      |               ^
main.c:16:14: error: subscripted value is neither array nor pointer nor vector
   16 |     if(b[i]<b[0])min=b[i];
      |              ^
Language: C++

#include<iostream>
#include<cmath>

using namespace std;

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

Compiler output:
a.cc: In function 'int main()':
a.cc:7:15: error: expected unqualified-id before ';' token
    7 |   int n, t, a,;
      |               ^
Language: C++

#include<bits/stdc++.h>
 
using namespace std;
int main(){
    int n,T,A;
    int a[1000+5];
    float b[1000+5];
    cin>>n>>T>>A;
    int flag = 0;
    for(int i = 1;i <= n;i++){
        cin>>a[i];
        b[i] = T-a[i]*0.006;
    }
    float minx = 0x3f3f3f3f;
    for(int i = 1;i <=n ;i++){
        if(minx > fabs(A-b[i])){
            minx = fabs(A-b[i]);
                flag = i;
        }
    }
    cout<<flag;

Compiler output:
a.cc: In function 'int main()':
a.cc:21:16: error: expected '}' at end of input
   21 |     cout<<flag;
      |                ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

#include <bits/stdc++.h>
#include <cstdlib>
#include <cmath>

#define REP(i, n) for(int i=0;i<int(n);i++)
#define REPR(i, n) for(int i=int(n)-1;i>=0;i--)
#define FOR(i, a, b) for(int i=a;i<int(b);i++)
#define FORS(i, a, b, s) for(int i=a;(s>0&&i<int(b))||(s<0&&i>int(b));i+=s)

using namespace std;


int main() {
  
  int N, T, A;
  
  cin >> N >> T >> A;
  int X[N];
  REP(i,N){
    cin >> X[i];
  }
  
  double m = abs(T-0.006*X[0]-A;
  int mi = 0;
  REP(i,N){
    if(abs(T-0.006*X[i]-A)<m){
      mi = i;
      m = abs(T-0.006*X[i]-A);
    }
  }
  
  printf("%d\n", mi+1);
  return 0;
}





Compiler output:
a.cc: In function 'int main()':
a.cc:23:32: error: expected ')' before ';' token
   23 |   double m = abs(T-0.006*X[0]-A;
      |                 ~              ^
      |                                )
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>


using namespace std;

float tem(int T0,int X0){

  return (float)T0-(float)X0*0.006;
}

float myabs(float a,float b){
if(a-b<=0) return b-a;
else return a-b;
  
}


int main(){
int mark=1;
int N;
int T;
float A;
cin>>N;
cin>>T>>A;
vector <int> H(N+1,0);
for (int input=1;input<=N;input++)
      {
        cin>>H[input];
      }

float gosamin=myabs(tem(T,H.at(1)-A));
for(int each=1;each<=N;each ++){
      gosamin=min(gosamin,myabs(tem(T,H.at(each))-A));
      if(gosamin==tem(T,H.at(each))) mark=each;
      
    }
    cout<<mark;
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:20: error: too few arguments to function 'float myabs(float, float)'
   33 | float gosamin=myabs(tem(T,H.at(1)-A));
      |               ~~~~~^~~~~~~~~~~~~~~~~~
a.cc:13:7: note: declared here
   13 | float myabs(float a,float b){
      |       ^~~~~
a.cc:35:32: error: too few arguments to function 'float myabs(float, float)'
   35 |       gosamin=min(gosamin,myabs(tem(T,H.at(each))-A));
      |                           ~~~~~^~~~~~~~~~~~~~~~~~~~~
a.cc:13:7: note: declared here
   13 | float myabs(float a,float b){
      |       ^~~~~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>


using namespace std;

float tem(int T0,int X0){

  return (float)T0-(float)X0*0.006;
}

int main(){
int mark=1;
int N;
int T;
float A;
cin>>N;
cin>>T>>A;
vector <int> H(N+1,0);
for (int input=1;input<=N;input++)
      {
        cin>>H[input];
      }

float gosamin=abs(tem(T,H.at(1)-A);
for(int each=1;each<=N;each ++){
      gosamin=min(gosamin,abs(tem(T,H.at(each))-A);
      if(gosamin==tem(T,H.at(each))) mark=each;
      
    }
    cout<<mark;
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:35: error: expected ')' before ';' token
   26 | float gosamin=abs(tem(T,H.at(1)-A);
      |                  ~                ^
      |                                   )
a.cc:28:51: error: expected ')' before ';' token
   28 |       gosamin=min(gosamin,abs(tem(T,H.at(each))-A);
      |                  ~                                ^
      |                                                   )
Language: C++

#include <iostream>


using namespace std;

float tem(int T0,int X0){

  return (float)T0-(float)X0*0.006;
}

int main(){
int mark=1;
int N;
int T;
int A;
cin>>N;
cin>>T>>A;
vector <int> H(N+1,0);
for (int input=1;input<=N;input++)
      {
        cin>>H[input];
      }

float gosamin=tem(T,H.at(1));
for(int each=1;each<=N;each ++){
      gosamin=min(gosamin,tem(T,H.at(each)));
      if(gosamin==tem(T,H.at(each))) mark=each;
      
    }
    cout<<mark;
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:1: error: 'vector' was not declared in this scope
   18 | vector <int> H(N+1,0);
      | ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include <iostream>
  +++ |+#include <vector>
    2 | 
a.cc:18:9: error: expected primary-expression before 'int'
   18 | vector <int> H(N+1,0);
      |         ^~~
a.cc:21:14: error: 'H' was not declared in this scope
   21 |         cin>>H[input];
      |              ^
a.cc:24:21: error: 'H' was not declared in this scope
   24 | float gosamin=tem(T,H.at(1));
      |                     ^
Language: C++

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

int read()
{
 char c=getchar(),int x=0,f=1;
 while (c<'0'||c>'9') if (c=='-') f=-1;
 while (c>='0'&&c<='9') x=(x<<3)+(x<<1)+c-'0';
 return x*f;
}

const int maxn=1e3+5,inf=0x7f7f7f7f;

double a[maxn];

int main()
{
 int n,t,x,pl,m,i;
 n=read(),t=read(),x=read();
 for (i=1;i<=n;i++) a[i]=1.0*t-0.006*read();
 pl=0;m=-inf;
 for (i=1;i<=n;i++)
  if (fabs(a[i]-x)<m) m=fabs(a[i]-x),pl=i;
 printf("%d\n",pl);
 return 0;
}


Compiler output:
a.cc: In function 'int read()':
a.cc:6:19: error: expected unqualified-id before 'int'
    6 |  char c=getchar(),int x=0,f=1;
      |                   ^~~
a.cc:7:35: error: 'f' was not declared in this scope
    7 |  while (c<'0'||c>'9') if (c=='-') f=-1;
      |                                   ^
a.cc:8:25: error: 'x' was not declared in this scope
    8 |  while (c>='0'&&c<='9') x=(x<<3)+(x<<1)+c-'0';
      |                         ^
a.cc:9:9: error: 'x' was not declared in this scope
    9 |  return x*f;
      |         ^
a.cc:9:11: error: 'f' was not declared in this scope
    9 |  return x*f;
      |           ^
Language: C++

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

int read()
{
 char c=getchar(),int x=0,f=1;
 while (c<'0'||c>'9') if (c=='-') f=-1;
 while (c>='0'&&c<='9) x=(x<<3)+(x<<1)+c-'0';
 return x*f;
}

const int maxn=1e3+5,inf=0x7f7f7f7f;

double a[maxn];

int main()
{
 int n,t,x,pl,m,i;
 n=read(),t=read(),x=read();
 for (i=1;i<=n;i++) a[i]=1.0*t-0.006*read();
 pl=0;m=-inf;
 for (i=1;i<=n;i++)
  if (fabs(a[i]-x)<m) m=fabs(a[i]-x),pl=i;
 printf("%d\n",pl);
 return 0;
}

Compiler output:
a.cc:8:20: warning: multi-character literal with 21 characters exceeds 'int' size of 4 bytes
    8 |  while (c>='0'&&c<='9) x=(x<<3)+(x<<1)+c-'0';
      |                    ^~~~~~~~~~~~~~~~~~~~~~~
a.cc:8:44: warning: missing terminating ' character
    8 |  while (c>='0'&&c<='9) x=(x<<3)+(x<<1)+c-'0';
      |                                            ^
a.cc:8:44: error: missing terminating ' character
    8 |  while (c>='0'&&c<='9) x=(x<<3)+(x<<1)+c-'0';
      |                                            ^~
a.cc: In function 'int read()':
a.cc:6:19: error: expected unqualified-id before 'int'
    6 |  char c=getchar(),int x=0,f=1;
      |                   ^~~
a.cc:7:35: error: 'f' was not declared in this scope
    7 |  while (c<'0'||c>'9') if (c=='-') f=-1;
      |                                   ^
a.cc:8:43: error: expected ')' before numeric constant
    8 |  while (c>='0'&&c<='9) x=(x<<3)+(x<<1)+c-'0';
      |        ~                                  ^
      |                                           )
a.cc:8:44: error: expected ';' before 'return'
    8 |  while (c>='0'&&c<='9) x=(x<<3)+(x<<1)+c-'0';
      |                                            ^
      |                                            ;
    9 |  return x*f;
      |  ~~~~~~                                     
a.cc:10:1: warning: no return statement in function returning non-void [-Wreturn-type]
   10 | }
      | ^
Language: C++

#include <cstdio>
#include <vector>
#include <cmath>

using namespace std;

int main() {
    int n;
    scanf("%d", &n);
    int t, a;
    scanf("%d%d", &t, &a);
    vector<float> temp;
    for (int i = 0; i < n; i++) {
       int d;
       scanf("%d", &d);
       temp.push_back(abs((t-d*0.006)-a));
    }
    vector<float>::iterator iter = min_element(temp.begin(), temp.end());
    size_t index = std::distance(temp.begin(), iter);
    printf("%ld\n", index+1);
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:36: error: 'min_element' was not declared in this scope
   18 |     vector<float>::iterator iter = min_element(temp.begin(), temp.end());
      |                                    ^~~~~~~~~~~
Language: C++

#include <cstdio>
#include <vector>
#include <cmath>

using namespace std;

int main() {
    int n;
    scanf("%d", &n);
    int t, a;
    scanf("%d%d", &t, &a);
    vector<int> h;
    vector<float> temp;
    for (int i = 0; i < n; i++) {
       int d;
       scanf("%d", &d);
       h.push_back(d);
       temp.push_back(abs((t-d*0.006)-a));
    }
    vector<float>::iterator iter = min_element(temp.begin(), temp.end());
    size_t index = std::distance(temp.begin(), iter);
    //printf("%f\n", min_element(temp.begin(), temp.end()));
    printf("%ld\n", index+1);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:36: error: 'min_element' was not declared in this scope
   20 |     vector<float>::iterator iter = min_element(temp.begin(), temp.end());
      |                                    ^~~~~~~~~~~
Language: C++

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

double myabs(double x){
    if (x < 0) x *= -1;
    return x;
}

int main() {
    int n,t,a;
    cin >> n;
    cin >> t;
    cin >> a;

    vector<double> h(n);
    long tmp;

    for (int i = 0; i < n; i++){
        cin >> tmp;
        h[i] = t - tmp * 0.006;
    }
    
    int min_arg = 1;
    double min = myabs(h[0]-a);
    double tmp2
    for (int i = 1; i < n; i++){
        tmp2 = myabs(h[i]-a);
        if (tmp2 < min){
            min = tmp2;
            min_arg = i + 1;
        }
    }
    cout << min_arg << "\n";

}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:5: error: expected initializer before 'for'
   27 |     for (int i = 1; i < n; i++){
      |     ^~~
a.cc:27:21: error: 'i' was not declared in this scope
   27 |     for (int i = 1; i < n; i++){
      |                     ^
Language: C++

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

double myabs(double x){
    if (x < 0) x *= -1;
    return x;
}

int main() {
    int n,t,a;
    cin >> n;
    cin >> t;
    cin >> a;

    vector<double> h(n);
    long tmp;

    for (int i = 0; i < n; i++){
        cin >> tmp;
        h[i] = t - tmp * 0.006;
    }
    
    int min_arg = 1;
    long min = myabs(h[0]-a);
    for (int i = 1; i < n; i++){
        tmp = myabs(h[i]-a);
        if (tmp < min){
            min = tmp;
            min_arg = i + 1;
        }
    }
    cout << min_arg << "\n";

Compiler output:
a.cc: In function 'int main()':
a.cc:33:29: error: expected '}' at end of input
   33 |     cout << min_arg << "\n";
      |                             ^
a.cc:10:12: note: to match this '{'
   10 | int main() {
      |            ^
Language: C

#include<stdio.h>
int main(void){

int t;
int n,k,K;
int h[1000];
int a;
int ne;
int ave;
scanf("%d",&n);
scanf("%d %d\n",&t,&a);
ne=0;
for(k=1;k<=n;k++){
scanf("%d ",&h[k]);
ave=(t-h[k]*0.006);
if(ne<(ave-a)||ne>(a-ave){
K=k;
ne=ave;
}
}
printf("%d",K);
return 0;
}


Compiler output:
main.c: In function 'main':
main.c:16:26: error: expected ')' before '{' token
   16 | if(ne<(ave-a)||ne>(a-ave){
      |   ~                      ^
      |                          )
main.c:20:1: error: expected expression before '}' token
   20 | }
      | ^
Language: C++

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

int main() {
    int N, T, A;
    cin >> N >> T >> A;
    int min_ = 10**5;
    int ans;
    for (int i = 0; i < N; i++) {
        int H;
        cin >> H;
        int tem = T - H * 0.006;
        int dif = max(tem,A) - min(tem,A);
        if (dif < min_) {
            min_ = dif;
            ans = i + 1;
        }
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:19: error: invalid type argument of unary '*' (have 'int')
    7 |     int min_ = 10**5;
      |                   ^~
Language: C++

#include <iostream>
using namespace std;
int main()
{
    int n, t, a, i, h[1001], poz;
    float min=INT_MAX;
    cin>>n>>t>>a;
    for(i=1; i<=n; i++)
    {
        cin>>h[i];
        if(a-t+h[i]*0.006 < min)
        {
            poz=i;
            min=a-t+h[i]*0.006;
        }
    }
    cout<<poz;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:15: error: 'INT_MAX' was not declared in this scope
    6 |     float min=INT_MAX;
      |               ^~~~~~~
a.cc:2:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    1 | #include <iostream>
  +++ |+#include <climits>
    2 | using namespace std;
Language: C++

#include <iostream>

using namespace std;

int main() {
	int N, T, A;

	cin >> N;
	cin >> T >> A;


	float minDif = INFINITY;
	int minPos = 0;
	for (int i = 0; i < N; i++) {
		int h;
		cin >> h;
		float x = T - h * 0.006;
		float dif = abs(A - x);
		if (dif < minDif) {
			minDif = dif;
			minPos = i + 1;
		}
	}

	cout << minPos << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:24: error: 'INFINITY' was not declared in this scope
   12 |         float minDif = INFINITY;
      |                        ^~~~~~~~
Language: C++

#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    int N,T,A;
    cin >> N >> T >> A;
    int mini = INF,ans;
    rep(i,0,N){
        int h;
        cin >> h;
        if(mini > abs(abs(T * 1000 - h * 6) - A)){
            mini = abs(abs(T * 1000 - h * 6) - A);
            ans = i;
        }
    }
    cout << i + 1 << endl;
}

Compiler output:
a.cc:7:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    7 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:19:13: error: 'i' was not declared in this scope
   19 |     cout << i + 1 << endl;
      |             ^