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

#include <iostream>
#include <fstream>
#include <stdio.h>
#include <cstdlib>
#include <string>
#include <tuple>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <math.h>
#include <random>
#include <time.h>
#include <cassert>
using namespace std;
#define LL long long
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#define LL_MIN -9223372036854775808
#define LL_MAX 9223372036854775807

int main(){
    
	int N, T, A;
  	cin >> N >> T >> A;
    int ans;
    double now = 1000;
  	for(int i=0; i<N; i++){
     	int tmp;
        cin >> tmp;
        if(now > abs(A-(T-tmp*0.006))){
             now = abs(A-(T-tmp*0.006);
             ans = i+1;
        }
    }
    cout << ans << endl;
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:39: error: expected ')' before ';' token
   37 |              now = abs(A-(T-tmp*0.006);
      |                       ~               ^
      |                                       )
Language: C++

#include <iostream>
#include <fstream>
#include <stdio.h>
#include <cstdlib>
#include <string>
#include <tuple>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <math.h>
#include <random>
#include <time.h>
#include <cassert>
using namespace std;
#define LL long long
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#define LL_MIN -9223372036854775808
#define LL_MAX 9223372036854775807

int main(){
    
	int N, T, A;
  	cin >> N >> T >> A;
    int ans;
    double now = 1000;
  	for(int i=0; i<N; i++){
     	int tmp;
        cin >> tmp;
        if(now > abs(A-(T-tmp*0.006)){
             now = abs(A-(T-tmp*0.006);
             ans = i+1;
        }
    }
    cout << ans << endl;
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:38: error: expected ')' before '{' token
   36 |         if(now > abs(A-(T-tmp*0.006)){
      |           ~                          ^
      |                                      )
a.cc:40:5: error: expected primary-expression before '}' token
   40 |     }
      |     ^
Language: C++

#include <stdio.h>

int main(void)
{
	int n;
	int t, a,i;
	int h[1000];
	int avtp[1000];
	int dif[1000];
	int p=1;

	scanf("%d", &n);
	scanf("%d %d", &t, &a);
	for (i = 0; i < n; i++){
		scanf("%d", &h[i]);
		h *= 1000;
	}

	t *= 1000;

	for (i = 0; i < n; i++){
		avtp[i] = t - (h[i] * 6);
		dif[i] = (avtp[i] - a);
		if (dif[i] < 0) dif[i] *= -1;
		if (i != 0){
			if (dif[i] < dif[i - 1]){
				p = i+1;
			}
		}
	}

	printf("%d\n", p);

	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:16:19: error: invalid operands of types 'int [1000]' and 'int' to binary 'operator*'
   16 |                 h *= 1000;
      |                 ~~^~~~~~~
a.cc:16:19: note:   in evaluation of 'operator*=(int [1000], int)'
Language: C++

#include <stdio.h>

int main(void)
{
	int n;
	int t, a,i;
	int h[1000];
	int avtp[1000];
	int dif[1000];
	int p=1;

	scanf("%d", &n);
	scanf("%d %d", &t, &a);
	for (i = 0; i < n; i++){
		scanf("%d", &h[i]);
		h *= 1000;
	}

	t *= 1000;

	for (i = 0; i < n; i++){
		avtp[i] = t - (h[i] * 6);
		dif[i] = (avtp[i] - a);
		if (dif[i] < 0) dif *= -1;
		if (i != 0){
			if (dif[i] < dif[i - 1]){
				p = i+1;
			}
		}
	}

	printf("%d\n", p);

	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:16:19: error: invalid operands of types 'int [1000]' and 'int' to binary 'operator*'
   16 |                 h *= 1000;
      |                 ~~^~~~~~~
a.cc:16:19: note:   in evaluation of 'operator*=(int [1000], int)'
a.cc:24:37: error: invalid operands of types 'int [1000]' and 'int' to binary 'operator*'
   24 |                 if (dif[i] < 0) dif *= -1;
      |                                 ~~~~^~~~~
a.cc:24:37: note:   in evaluation of 'operator*=(int [1000], int)'
Language: C++

#include <stdio.h>

int main(void)
{
	int n;
	int t, a,i;
	int h[1000];
	double avtp[1000];
	double dif[1000];
	int p=1;

	scanf("%d", &n);
	scanf("%d %d", &t, &a);
	for (i = 0; i < n; i++){
		scanf("%d", &h[i]);
	}

	for (i = 0; i < n; i++){
		avtp[i] = t - (h[i] * 0.006);
		dif[i] = abs(avtp[i] - a);
		if (dif[i] < 0){
			dif[i] = -dif[i];
		}
		if (i != 0){
			if (dif[i] < dif[i - 1]){
				p = i+1;
			}
		}
	}

	printf("%d\n", p);

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:26: error: 'abs' was not declared in this scope
   20 |                 dif[i] = abs(avtp[i] - a);
      |                          ^~~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
 
int main () {
  int n, t, a;
  cin >> n >> t >> a;
  vector<double> hc;
  for ( int i = 0; i < n; i++ ) {
     int h;
     cin >> h;
     hc.push_back(t - h * 0.006);
  }
  vector<double>::iterator minIt = *min_element(hc.begin(), hc.end());
  size_t minIndex = distance(hc.begin(), minIt);
  cout<< minIndex;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:36: error: conversion from 'double' to non-scalar type 'std::vector<double>::iterator' requested
   15 |   vector<double>::iterator minIt = *min_element(hc.begin(), hc.end());
      |                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
 
int main () {
  int n, t, a;
  cin >> n >> t >> a;
  vector<double> hc;
  for ( int i = 0; i < n; i++ ) {
     int h;
     cin >> h;
     hc.push_back(t - h * 0.006);
  }
  vector<int>::iterator minIt = *min_element(hc.begin(), hc.end());
  size_t minIndex = distance(hc.begin(), minIt);
  cout<< minIndex;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:33: error: conversion from 'double' to non-scalar type 'std::vector<int>::iterator' requested
   15 |   vector<int>::iterator minIt = *min_element(hc.begin(), hc.end());
      |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:16:29: error: no matching function for call to 'distance(std::vector<double>::iterator, std::vector<int>::iterator&)'
   16 |   size_t minIndex = distance(hc.begin(), minIt);
      |                     ~~~~~~~~^~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:47,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:148:5: note: candidate: 'template<class _InputIterator> constexpr typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::distance(_InputIterator, _InputIterator)'
  148 |     distance(_InputIterator __first, _InputIterator __last)
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:148:5: note:   template argument deduction/substitution failed:
a.cc:16:29: note:   deduced conflicting types for parameter '_InputIterator' ('__gnu_cxx::__normal_iterator<double*, std::vector<double> >' and '__gnu_cxx::__normal_iterator<int*, std::vector<int> >')
   16 |   size_t minIndex = distance(hc.begin(), minIt);
      |                     ~~~~~~~~^~~~~~~~~~~~~~~~~~~
Language: C++

#include <iostream>
#include <vector>
using namespace std;
 
 
int main () {
  int n, t, a;
  cin >> n >> t >> a;
  vector<double> hc;
  for ( int i = 0; i < n; i++ ) {
     int h;
     cin >> h;
     hc.push_back(t - h * 0.006);
  }
  vector<int>::iterator minIt = *min_element(hc.begin(), hc.end());
  size_t minIndex = distance(hc.begin(), minIt);
  cout<< minIndex;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:34: error: 'min_element' was not declared in this scope
   15 |   vector<int>::iterator minIt = *min_element(hc.begin(), hc.end());
      |                                  ^~~~~~~~~~~
a.cc:16:29: error: no matching function for call to 'distance(std::vector<double>::iterator, std::vector<int>::iterator&)'
   16 |   size_t minIndex = distance(hc.begin(), minIt);
      |                     ~~~~~~~~^~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:47,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:148:5: note: candidate: 'template<class _InputIterator> constexpr typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::distance(_InputIterator, _InputIterator)'
  148 |     distance(_InputIterator __first, _InputIterator __last)
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:148:5: note:   template argument deduction/substitution failed:
a.cc:16:29: note:   deduced conflicting types for parameter '_InputIterator' ('__gnu_cxx::__normal_iterator<double*, std::vector<double> >' and '__gnu_cxx::__normal_iterator<int*, std::vector<int> >')
   16 |   size_t minIndex = distance(hc.begin(), minIt);
      |                     ~~~~~~~~^~~~~~~~~~~~~~~~~~~
Language: C++

#include <iostream>
using namespace std;


int main () {
  int n, t, a;
  cin >> n >> t >> a;
  vector<double> hc;
  for ( int i = 0; i < n; i++ ) {
     int h;
     cin >> h;
     hc.push_back(t - h * 0.006);
  }
  vector<int>::iterator minIt = *min_element(hc.begin(), hc.end());
  size_t minIndex = distance(hc.begin(), minIt);
  cout<< minIndex;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:3: error: 'vector' was not declared in this scope
    8 |   vector<double> hc;
      |   ^~~~~~
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 | using namespace std;
a.cc:8:10: error: expected primary-expression before 'double'
    8 |   vector<double> hc;
      |          ^~~~~~
a.cc:12:6: error: 'hc' was not declared in this scope; did you mean 'h'?
   12 |      hc.push_back(t - h * 0.006);
      |      ^~
      |      h
a.cc:14:10: error: expected primary-expression before 'int'
   14 |   vector<int>::iterator minIt = *min_element(hc.begin(), hc.end());
      |          ^~~
a.cc:15:30: error: 'hc' was not declared in this scope
   15 |   size_t minIndex = distance(hc.begin(), minIt);
      |                              ^~
a.cc:15:42: error: 'minIt' was not declared in this scope
   15 |   size_t minIndex = distance(hc.begin(), minIt);
      |                                          ^~~~~
Language: Java

import java.util.*;
 
public class Main{
  public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    
    int N = sc.nextInt();
    int T = sc.nextInt();
    int A = sc.nextInt();
    
    int x = (T - A) *1000 / 6;
    int diff = -1;
    int no = -1;
    
    for(int i=0;i<N-1;i++)
    {
      int H = sc.nextInt();
      
      if (diff == -1 || diff > Math.abs(H-x) ){
        diff = abs(H-x);
        no = i + 1;
      }
    }
    System.out.println(no);
  }
}

Compiler output:
Main.java:21: error: cannot find symbol
        diff = abs(H-x);
               ^
  symbol:   method abs(int)
  location: class Main
1 error
Language: Java

import java.util.*;
 
public class Main{
  public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    
    int N = sc.nextInt();
    int T = sc.nextInt();
    int A = sc.nextInt();
    
    int x = (T - A) *1000 / 6;
    int diff = -1;
    int no = -1;
    
    for(int i=0;i<N-1;i++)
    {
      int H = sc.nextint();
      
      if (diff == -1 || diff > abs(H-x) ){
        diff = abs(H-x);
        no = i + 1;
      }
    }
    System.out.println(no);
  }
}

Compiler output:
Main.java:18: error: cannot find symbol
      int H = sc.nextint();
                ^
  symbol:   method nextint()
  location: variable sc of type Scanner
Main.java:20: error: cannot find symbol
      if (diff == -1 || diff > abs(H-x) ){
                               ^
  symbol:   method abs(int)
  location: class Main
Main.java:21: error: cannot find symbol
        diff = abs(H-x);
               ^
  symbol:   method abs(int)
  location: class Main
3 errors
Language: Java

import java.util.*;

public class Main{
  public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    
    int N = sc.nextInt();
    int T = sc.nextInt();
    int A = sc.nextInt();
    
    int x = (T - A) / 0.006;
    int diff = -1;
    int no = -1;
    
    for(int i=0;i<N-1;i++)
    {
      int H = sc.nextint();
      
      if (diff == -1 || diff > abs(H-x) ){
        diff = abs(H-x);
        no = i + 1;
      }
    }
    System.out.println(no);
  }
}

Compiler output:
Main.java:12: error: incompatible types: possible lossy conversion from double to int
    int x = (T - A) / 0.006;
                    ^
Main.java:18: error: cannot find symbol
      int H = sc.nextint();
                ^
  symbol:   method nextint()
  location: variable sc of type Scanner
Main.java:20: error: cannot find symbol
      if (diff == -1 || diff > abs(H-x) ){
                               ^
  symbol:   method abs(int)
  location: class Main
Main.java:21: error: cannot find symbol
        diff = abs(H-x);
               ^
  symbol:   method abs(int)
  location: class Main
4 errors
Language: Java

import java.util.*;

public class Main{
  public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    
    int N = sc.nextint();
    int T = sc.nextint();
    int A = sc.nextint();
    
    int x = (T - A) / 0.006;
    int diff = -1;
    int no = -1;
    
    for(int i=0;i<N-1;i++)
    {
      int H = sc.nextint();
      
      if (diff == -1 || diff > abs(H-x) ){
        diff = abs(H-x);
        no = i + 1;
      }
    }
    System.out.println(no);
  }
}

    

Compiler output:
Main.java:8: error: cannot find symbol
    int N = sc.nextint();
              ^
  symbol:   method nextint()
  location: variable sc of type Scanner
Main.java:9: error: cannot find symbol
    int T = sc.nextint();
              ^
  symbol:   method nextint()
  location: variable sc of type Scanner
Main.java:10: error: cannot find symbol
    int A = sc.nextint();
              ^
  symbol:   method nextint()
  location: variable sc of type Scanner
Main.java:12: error: incompatible types: possible lossy conversion from double to int
    int x = (T - A) / 0.006;
                    ^
Main.java:18: error: cannot find symbol
      int H = sc.nextint();
                ^
  symbol:   method nextint()
  location: variable sc of type Scanner
Main.java:20: error: cannot find symbol
      if (diff == -1 || diff > abs(H-x) ){
                               ^
  symbol:   method abs(int)
  location: class Main
Main.java:21: error: cannot find symbol
        diff = abs(H-x);
               ^
  symbol:   method abs(int)
  location: class Main
7 errors
Language: C++

#include <cstdio>
#include <cstdlib>
#include <algorithm>

int N, T, A, X,z;

int main(){
    scanf("%d%d%d",&N,&T,&A);
    for (int i=0;i <= N;i++){
       scanf("%d",&X);
       int d=(T*1000-X*6);
       z=min(abs(d-1000*A));

    }
    printf("%d\n", z);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:10: error: 'min' was not declared in this scope; did you mean 'std::min'?
   12 |        z=min(abs(d-1000*A));
      |          ^~~
      |          std::min
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: 'std::min' declared here
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
Language: C++

#include <cstdio>
#include <cstdlib>

int N, T, A, X,z;

int main(){
    scanf("%d%d%d",&N,&T,&A);
    for (int i=0;i <= N;i++){
       scanf("%d",&X);
       int d=(T*1000-X*6);
       z=min(abs(d-1000*A));

    }
    printf("%d\n", z);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:10: error: 'min' was not declared in this scope; did you mean 'main'?
   11 |        z=min(abs(d-1000*A));
      |          ^~~
      |          main
Language: C++

#include <cstdio>
#include <math>

int N, T, A, H[N],X[N],z;

int main(){
    scanf("%d%d%d",&N,&T,&A);
    for (int i=0;i <= N;i++){
        X[i]=T-H[i]*0.006;
        z=min(abs(X[i]-A);
    }
    printf("%d\n", z);
}


Compiler output:
a.cc:2:10: fatal error: math: No such file or directory
    2 | #include <math>
      |          ^~~~~~
compilation terminated.
Language: Java

import java.util.*;

public class Palace{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int T = sc.nextInt();
    int A = sc.nextInt();
    int[] H = new int[N];
    double[] temp = new double[N];

    for (int i = 0; i<N; i++){
      H[i] = sc.nextInt();
      temp[i] = 0;
    }
    for (int i=0;i<N;i++){
      temp[i] = T - H[i] * 0.006 - A;
    }
    int min_index = 0;
    double tmp = temp[0];
    for (int i = 0; i<N; i++){
      if (tmp < temp[i]) {
        tmp = temp[i];
        min_index = i;
      }
    }
    System.out.println(min_index+1);

  }
}


Compiler output:
Main.java:3: error: class Palace is public, should be declared in a file named Palace.java
public class Palace{
       ^
1 error
Language: Java

import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int T = sc.nextInt();
    int A = sc.nextInt();
    int[] H = new int[N];
    double[] temp = new int[N];

    for (int i = 0; i<N; i++){
      H[i] = sc.nextInt();
      temp[i] = T - H[i] * 0.006 - A;
    }
    int min_index = 0;
    int tmp = temp[0];
    for (int i = 0; i<N; i++){
      if (tmp < temp[i]) {
        tmp = temp[i];
        min_index = i;
      }
    }
    System.out.println(min_index);

  }
}


Compiler output:
Main.java:10: error: incompatible types: int[] cannot be converted to double[]
    double[] temp = new int[N];
                    ^
Main.java:17: error: incompatible types: possible lossy conversion from double to int
    int tmp = temp[0];
                  ^
Main.java:20: error: incompatible types: possible lossy conversion from double to int
        tmp = temp[i];
                  ^
3 errors
Language: Java

import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int T = sc.nextInt();
    int A = sc.nextInt();
    int[] H = new int[N];
    double[] temp = new temp[N];

    for (int i = 0; i<N; i++){
      H[i] = sc.nextInt();
      temp[i] = T - H[i] * 0.006 - A;
    }
    int min_index = 0;
    int tmp = temp[0];
    for (int i = 0; i<N; i++){
      if (tmp < temp[i]) {
        tmp = temp[i];
        min_index = i;
      }
    }
    System.out.println(min_index);

  }
}


Compiler output:
Main.java:10: error: cannot find symbol
    double[] temp = new temp[N];
                        ^
  symbol:   class temp
  location: class Main
Main.java:17: error: incompatible types: possible lossy conversion from double to int
    int tmp = temp[0];
                  ^
Main.java:20: error: incompatible types: possible lossy conversion from double to int
        tmp = temp[i];
                  ^
3 errors
Language: C++

#include <iostream>
#include <cmath>

using namespace std;

int main(int argc, const char * argv[]) {
    int point_num = 0;
    
    cin >> point_num;
    
    int T;
    int A;
    cin >> T;
    cin >> A;
    
    int heights[point_num];
    for (int i = 0; i < point_num; i++) {
        cin >> heights[i];
    }
    
    float max = (float)INT_MAX;
    int min_index = 0;
    for (int i = 0; i < point_num; i++) {
        float result = fabs((float)(T - heights[i] * 0.006f) - A);
        if (max > result) {
            max = result;
            min_index = (i + 1);
        }
    }
    
    cout << min_index << endl;
    
    return 0;
}

Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:21:24: error: 'INT_MAX' was not declared in this scope
   21 |     float max = (float)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 <stdio.h>

int max(int a,int b){
  	if(a>b){
      return a;
    }else{
      	return b;
    }
}

int main(void){
  int N,A,T,H;
  int count = 0;
  int min;
  scanf("%d", &N);
  scanf("%d %d", &T,&A);
  
  int a = 1000*T - 6*H - 1000*A;
  int b = 1000*A - 1000*T + 6*H;
  
  scanf"%d", &H);
  min = max(a,b);
  
  for(int 2 = 1; i<=N; i++){
    scanf("%d", &H);
    if(max(a,b)<=min){
      min = max(a,b);
      count = i;
    }else{
    }
  }
  printf("%d", count);
}


Compiler output:
main.c: In function 'main':
main.c:21:8: error: expected ';' before string constant
   21 |   scanf"%d", &H);
      |        ^~~~
      |        ;
main.c:21:16: error: expected statement before ')' token
   21 |   scanf"%d", &H);
      |                ^
main.c:24:11: error: expected identifier or '(' before numeric constant
   24 |   for(int 2 = 1; i<=N; i++){
      |           ^
main.c:24:18: error: 'i' undeclared (first use in this function)
   24 |   for(int 2 = 1; i<=N; i++){
      |                  ^
main.c:24:18: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>

int max(int a,int b){
  	if(a>b){
      return a;
    }else{
      	return b;
    }
}

int main(void){
  int N,A,T,H;
  int count = 0;
  int min = 0;
  scanf("%d", &N);
  scanf("%d %d", &T,&A);
  
  int a = 1000*T - 6*H - A;
  int b = A - 1000*T + 6*H;
  
  for(int i = 1; i<=N; i++){
    scan("%d", &H);
    if(max(a,b)<=min){
      min = max(a,b);
      count = i;
    }else{
    }
  }
  printf("%d", count);
}


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

#include <stdio.h>

int max(int a,int b){
  	if(a>b){
      return a;
    }else{
      	return b;
    }
}

int main(void){
  int N,A,T,H;
  int count = 0;
  int min = 0;
  scanf("%d", &N);
  scanf("%d %d", &T,&A);
  
  int a = 1000*T - 6*H - A;
  int b = A - 1000*T + 6*H;
  
  for(int i = 1; i<=N; i++){
    scan("%d", &H);
    if(max(a,b)<=min){
      min = max(a,b);
      count = i;
    }else{
    }
  }
  printf("%d", i);
}


Compiler output:
main.c: In function 'main':
main.c:22:5: error: implicit declaration of function 'scan'; did you mean 'scanf'? [-Wimplicit-function-declaration]
   22 |     scan("%d", &H);
      |     ^~~~
      |     scanf
main.c:29:16: error: 'i' undeclared (first use in this function)
   29 |   printf("%d", i);
      |                ^
main.c:29:16: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>

int max(int a,b){
  	if(a>b){
      return a;
    }else{
      	return b;
    }
}

int main(void){
  int N,A,T,H;
  int count = 0;
  int min = 0;
  scanf("%d", &N);
  scanf("%d %d", &T,&A);
  
  int a = 1000*T - 6*H - A;
  int b = A - 1000*T + 6*H;
  
  for(int i = 1; i<=N; i++){
    scan("%d", &H);
    if(max(a,b)<=min){
      min = max(a,b);
      count = i;
    }else{
    }
  }
  printf("%d", i);
}

Compiler output:
main.c:3:15: error: unknown type name 'b'
    3 | int max(int a,b){
      |               ^
main.c: In function 'main':
main.c:22:5: error: implicit declaration of function 'scan'; did you mean 'scanf'? [-Wimplicit-function-declaration]
   22 |     scan("%d", &H);
      |     ^~~~
      |     scanf
main.c:23:8: error: implicit declaration of function 'max' [-Wimplicit-function-declaration]
   23 |     if(max(a,b)<=min){
      |        ^~~
main.c:29:16: error: 'i' undeclared (first use in this function)
   29 |   printf("%d", i);
      |                ^
main.c:29:16: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

# include <bits/stdc++.h>
using namespace std;
int N,T,A,X;
int main ()
{
    cin>>N>>T>>A;
    int res=100000000;
    for(int i=1;i<=N;i++)
    {
      cin>>X;
      int c=T-X*0.006;
      int d=c-T;
      if(d<0) d=-d;
      if(d<cha)
		res=i;
    } 
    cout<<res;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:12: error: 'cha' was not declared in this scope; did you mean 'char'?
   14 |       if(d<cha)
      |            ^~~
      |            char
Language: C++

#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <utility>
#include <string>
#include <algorithm>
#include <map>
#include <vector>
#include <climits>
#include <numeric>
#include<stdio.h>
#include <queue>
#include <iomanip>
#include <float.h>
#include <set>
#include<functional>
using namespace std;
long long gcd(long long a, long long b) { return b ? gcd(b, a%b) : a; }
long long lcm(long long a, long long b) {
	return a / gcd(a, b) * b;
}
signed main()
{
	int n, t, a;
	cin >> n >> t >> a;
	double risou = (double)(t - a) / 0.006;
	int ans = INT_MAX/2;
	int ansnum;
	int tmp;
	for (int i = 0; i < n; i++) {
		cin >> tmp;
		double tmp2 = tmp;
		if (fabs(tmp2 - risou) < abs(ans - risou)) { ans = tmp; ansnum = i + 1; }
	}
	cout << ansnum;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:21: error: 'fabs' was not declared in this scope; did you mean 'labs'?
   32 |                 if (fabs(tmp2 - risou) < abs(ans - risou)) { ans = tmp; ansnum = i + 1; }
      |                     ^~~~
      |                     labs
Language: C++

#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<utility>
#include<map>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define REPR(i,n) for(int i=n-1;i>=0;i--)
#define FORR(i,n,m) for(int i=n-1;i>=m;i--)
#define all(in) in.begin(),in.end()
#define ALL(in,K) in,in+K
#define INF 1e18
#define MOD 100000007
#define SIZE 100005
#define PI 	3.14159265358979323846
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,T;
    double A;

    int ans_num;
    double ans_val;
    cin >> N >> T >> A;
    REP(i,n){
        int H;
        cin >> H;
        if(A-H*0.006 < ans_val){
            ans_val = A-H*0.006;
            ans_num = i;
        }
    }
    cout << ans_num << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:11: error: 'n' was not declared in this scope
   36 |     REP(i,n){
      |           ^
a.cc:17:32: note: in definition of macro 'REP'
   17 | #define REP(i,n) for(int i=0;i<n;i++)
      |                                ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
const double X=0.006;
int main()
{
  int N,T,A,val;
  cin>>N>>T>>A;
  int val,tmp,idx=0;
  tmp=1e9;
  for(int i=;i<=n;i++)
  {
     cin>>val;
     val=T-val*X;
     if(abs(A-tmp)>(abs(A-val))tmp=val,idx=i;
   }
    cout<<idx<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:7: error: redeclaration of 'int val'
    8 |   int val,tmp,idx=0;
      |       ^~~
a.cc:6:13: note: 'int val' previously declared here
    6 |   int N,T,A,val;
      |             ^~~
a.cc:10:13: error: expected primary-expression before ';' token
   10 |   for(int i=;i<=n;i++)
      |             ^
a.cc:10:17: error: 'n' was not declared in this scope
   10 |   for(int i=;i<=n;i++)
      |                 ^
a.cc:14:32: error: expected ';' before 'tmp'
   14 |      if(abs(A-tmp)>(abs(A-val))tmp=val,idx=i;
      |                                ^~~
      |                                ;
a.cc:15:4: error: expected primary-expression before '}' token
   15 |    }
      |    ^
a.cc:14:46: error: expected ')' before '}' token
   14 |      if(abs(A-tmp)>(abs(A-val))tmp=val,idx=i;
      |        ~                                     ^
      |                                              )
   15 |    }
      |    ~                                          
a.cc:15:4: error: expected primary-expression before '}' token
   15 |    }
      |    ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
const double X=0.006;
int main()
{
  int N,T,A,val;
  cin>>N>>T>>A;
  int val,tmp,idx=0;
  tmp=1e9;
  for(int i=;i<=n;i++)
  {
     cin>>val;
     val=T-val*X;
     if(abs(A-tmp)>(abs(A-val))tmp=val,idx=i;
   }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:7: error: redeclaration of 'int val'
    8 |   int val,tmp,idx=0;
      |       ^~~
a.cc:6:13: note: 'int val' previously declared here
    6 |   int N,T,A,val;
      |             ^~~
a.cc:10:13: error: expected primary-expression before ';' token
   10 |   for(int i=;i<=n;i++)
      |             ^
a.cc:10:17: error: 'n' was not declared in this scope
   10 |   for(int i=;i<=n;i++)
      |                 ^
a.cc:14:32: error: expected ';' before 'tmp'
   14 |      if(abs(A-tmp)>(abs(A-val))tmp=val,idx=i;
      |                                ^~~
      |                                ;
a.cc:15:4: error: expected primary-expression before '}' token
   15 |    }
      |    ^
a.cc:14:46: error: expected ')' before '}' token
   14 |      if(abs(A-tmp)>(abs(A-val))tmp=val,idx=i;
      |        ~                                     ^
      |                                              )
   15 |    }
      |    ~                                          
a.cc:15:4: error: expected primary-expression before '}' token
   15 |    }
      |    ^
Language: C++

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

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


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

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

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


Compiler output:
a.cc: In function 'int main()':
a.cc:8:10: error: 'i' was not declared in this scope
    8 |    for ( i=0; i<n; i++){
      |          ^
a.cc:14:10: error: 'i' was not declared in this scope
   14 |    for ( i=0; i<n; i++){
      |          ^
Language: C++

#include <cstdio>

int main()
{
	int n,t,a;
	scanf("%d %d %d",&n,&t,&a);

	double min=1000;

	int h,ans;
	for(int i=0;i<n;i++){
		scanf("%d",&h);
		if(abs(t-0.006*h-a)<min){
			min=abs(t-0.006*h-a);
			ans=i;
		}
	}

	printf("%d\n",ans);

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:20: error: 'abs' was not declared in this scope; did you mean 'ans'?
   13 |                 if(abs(t-0.006*h-a)<min){
      |                    ^~~
      |                    ans
Language: C++

#include <cstdio>

int N, T, A, H[N+1], TH[N+1];
int main() {
  scanf("%d%d%d",&N,&T, &A);
  TH[0]=0;
  
  for (int i=0;i<=N;i++){
    TH[i+1]=T+0.006*H[i];
    a=min(abs(A-TH[i]),abs(A-TH[i+1]));
  }
  printf("%d\n",a);
  
    
      
    


Compiler output:
a.cc:3:17: error: size of array 'H' is not an integral constant-expression
    3 | int N, T, A, H[N+1], TH[N+1];
      |                ~^~
a.cc:3:26: error: size of array 'TH' is not an integral constant-expression
    3 | int N, T, A, H[N+1], TH[N+1];
      |                         ~^~
a.cc: In function 'int main()':
a.cc:10:5: error: 'a' was not declared in this scope
   10 |     a=min(abs(A-TH[i]),abs(A-TH[i+1]));
      |     ^
a.cc:10:11: error: 'abs' was not declared in this scope
   10 |     a=min(abs(A-TH[i]),abs(A-TH[i+1]));
      |           ^~~
a.cc:10:7: error: 'min' was not declared in this scope; did you mean 'main'?
   10 |     a=min(abs(A-TH[i]),abs(A-TH[i+1]));
      |       ^~~
      |       main
a.cc:12:17: error: 'a' was not declared in this scope
   12 |   printf("%d\n",a);
      |                 ^
a.cc:12:20: error: expected '}' at end of input
   12 |   printf("%d\n",a);
      |                    ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C

#include <stdio.h>
#include <stdlib.h>
int main(){
  int n,t,a,i,best;
  scanf("%d",&n);
  scanf("%d %d",&t,&a);
  for(i=0;i<n;i++){
    scanf("%d ",&h[i]);
  }
  int h[n],temp[n];
  for(i=0;i<n;i++){
    temp[i]=t-h[i]*0.006;
  }
  best=temp[0];
  for(i=1;i<n;i++){
    if(abs(a-best)>abs(a-temp[i])) best = temp[i];
  }
  printf("%d\n",temp[i]);
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:8:18: error: 'h' undeclared (first use in this function)
    8 |     scanf("%d ",&h[i]);
      |                  ^
main.c:8:18: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>
#include <stdlib.h>
int main(){
  int n,t,a,i,best;
  scanf("%d",&n);
  scanf("%d %d",&t,&a);
  for(i=0;i<n;i++){
    scanf("%d ",&h[i]);
    temp[i]=t-h[i]*0.006;
  }
  int h[n],temp[n];
  best=temp[0];
  for(i=1;i<n;i++){
    if(abs(a-best)>abs(a-temp[i])) best = temp[i];
  }
  printf("%d\n",temp[i]);
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:8:18: error: 'h' undeclared (first use in this function)
    8 |     scanf("%d ",&h[i]);
      |                  ^
main.c:8:18: note: each undeclared identifier is reported only once for each function it appears in
main.c:9:5: error: 'temp' undeclared (first use in this function); did you mean 'mktemp'?
    9 |     temp[i]=t-h[i]*0.006;
      |     ^~~~
      |     mktemp
Language: C++

#include <iostream>
#include <string>

using namespace std;

int main()
{
	int n, t, a;
	cin >> n >> t >> a;
	int *h = new int[n];
	for (int i = 0; i < n; i++) {
		cin >> h[i];
	}

	double min = LONG_MAX;
	int index = 0;
	for (int i = 0; i < n; i++) {
		if (abs(a - (t - 0.006*h[i])) < min) {
			index = i;
			min = abs(a - (t - 0.006*h[i]));
		}
	}

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



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

#include <iostream>
#include <math.h>
using namespace std;
int main() {
  int n, t;
  float a;
  cin >>n;
  cin >> t >> a;
  int h[n];
  float ht[n];
  for(int i=0;i<n;i++){
    cin>> h[i];
    
    ht[i] = t -h[i]*0.006;
  }
  
  int ans=0;
  for(int i=0;i<n;i++){
    if( pow(a - ht[i], 2) < pow(a - ht[ans]), 2){
      ans = i;
    }
  }
  cout <<ans+1;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:32: error: no matching function for call to 'pow(float)'
   19 |     if( pow(a - ht[i], 2) < pow(a - ht[ans]), 2){
      |                             ~~~^~~~~~~~~~~~~
In file included from /usr/include/c++/14/math.h:36,
                 from a.cc:2:
/usr/include/c++/14/cmath:1074:5: note: candidate: 'template<class _Tp, class _Up> constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type std::pow(_Tp, _Up)'
 1074 |     pow(_Tp __x, _Up __y)
      |     ^~~
/usr/include/c++/14/cmath:1074:5: note:   candidate expects 2 arguments, 1 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/bits/requires_hosted.h:31,
                 from /usr/include/c++/14/iostream:38,
                 from a.cc:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:173:1: note: candidate: 'double pow(double, double)'
  173 | __MATHCALL_VEC (pow,, (_Mdouble_ __x, _Mdouble_ __y));
      | ^~~~~~~~~~~~~~
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:173:1: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/cmath:380:3: note: candidate: 'constexpr long double std::pow(long double, long double)'
  380 |   pow(long double __x, long double __y)
      |   ^~~
/usr/include/c++/14/cmath:380:3: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/cmath:376:3: note: candidate: 'constexpr float std::pow(float, float)'
  376 |   pow(float __x, float __y)
      |   ^~~
/usr/include/c++/14/cmath:376:3: note:   candidate expects 2 arguments, 1 provided
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <thread>
#include <chrono>
#include <queue>
#include <set>

using namespace std;

double temp(int t, int x){
	return t - (x*0.006);
}

int main(void){
	int n, t, a;
	vector<int> h(n);
	for(int i=0;i<n;i++){
		cin >> h[i];
	}

	vector<double> arr(n);
	for(int i=0;i<n;i++){
		arr.push_back(abs(a - temp(t, h.at(i))));
	}

	cout << arr[max_element(arr.begin(), arr.end())] << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:20: error: no match for 'operator[]' (operand types are 'std::vector<double>' and '__gnu_cxx::__normal_iterator<double*, std::vector<double> >')
   30 |         cout << arr[max_element(arr.begin(), arr.end())] << endl;
      |                    ^
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_vector.h:1128:7: note: candidate: 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = double; _Alloc = std::allocator<double>; reference = double&; size_type = long unsigned int]'
 1128 |       operator[](size_type __n) _GLIBCXX_NOEXCEPT
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1128:28: note:   no known conversion for argument 1 from '__gnu_cxx::__normal_iterator<double*, std::vector<double> >' to 'std::vector<double>::size_type' {aka 'long unsigned int'}
 1128 |       operator[](size_type __n) _GLIBCXX_NOEXCEPT
      |                  ~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1147:7: note: candidate: 'std::vector<_Tp, _Alloc>::const_reference std::vector<_Tp, _Alloc>::operator[](size_type) const [with _Tp = double; _Alloc = std::allocator<double>; const_reference = const double&; size_type = long unsigned int]'
 1147 |       operator[](size_type __n) const _GLIBCXX_NOEXCEPT
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1147:28: note:   no known conversion for argument 1 from '__gnu_cxx::__normal_iterator<double*, std::vector<double> >' to 'std::vector<double>::size_type' {aka 'long unsigned int'}
 1147 |       operator[](size_type __n) const _GLIBCXX_NOEXCEPT
      |                  ~~~~~~~~~~^~~
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <thread>
#include <chrono>
#include <queue>
#include <set>

using namespace std;

double temp(int t, int x){
	return t - (x*0.006);
}

int main(void){
	int n, t, a;
	vector<int> h(n);
	for(int i=0;i<n;i++){
		cin >> h[i];
	}

	vector<double> arr(n);
	for(int i=0;i<n;i++){
		arr.push_back(abs(a - temp(t, h.at(i))));
	}

	cout << arr.at(max_element(arr.begin(), arr.end())) << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:23: error: no matching function for call to 'std::vector<double>::at(__gnu_cxx::__normal_iterator<double*, std::vector<double> >)'
   30 |         cout << arr.at(max_element(arr.begin(), arr.end())) << endl;
      |                 ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_vector.h:1180:7: note: candidate: 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::at(size_type) [with _Tp = double; _Alloc = std::allocator<double>; reference = double&; size_type = long unsigned int]'
 1180 |       at(size_type __n)
      |       ^~
/usr/include/c++/14/bits/stl_vector.h:1180:20: note:   no known conversion for argument 1 from '__gnu_cxx::__normal_iterator<double*, std::vector<double> >' to 'std::vector<double>::size_type' {aka 'long unsigned int'}
 1180 |       at(size_type __n)
      |          ~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1199:7: note: candidate: 'std::vector<_Tp, _Alloc>::const_reference std::vector<_Tp, _Alloc>::at(size_type) const [with _Tp = double; _Alloc = std::allocator<double>; const_reference = const double&; size_type = long unsigned int]'
 1199 |       at(size_type __n) const
      |       ^~
/usr/include/c++/14/bits/stl_vector.h:1199:20: note:   no known conversion for argument 1 from '__gnu_cxx::__normal_iterator<double*, std::vector<double> >' to 'std::vector<double>::size_type' {aka 'long unsigned int'}
 1199 |       at(size_type __n) const
      |          ~~~~~~~~~~^~~
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <thread>
#include <chrono>
#include <queue>
#include <set>

using namespace std;

double temp(int t, int x){
	return t - (x*0.006);
}

int main(void){
	int n, t, a;
	vector<int> h(n);
	for(int i=0;i<n;i++){
		cin >> h[i];
	}

	vector<auto> arr(n);
	for(int i=0;i<n;i++){
		arr.push_back(abs(a - temp(t, h.at(i))));
	}

	cout << arr.at(max_element(arr.begin(), arr.end())) << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:20: error: template argument 1 is invalid
   25 |         vector<auto> arr(n);
      |                    ^
a.cc:25:20: error: template argument 2 is invalid
a.cc:27:21: error: request for member 'push_back' in 'arr', which is of non-class type 'int'
   27 |                 arr.push_back(abs(a - temp(t, h.at(i))));
      |                     ^~~~~~~~~
a.cc:30:21: error: request for member 'at' in 'arr', which is of non-class type 'int'
   30 |         cout << arr.at(max_element(arr.begin(), arr.end())) << endl;
      |                     ^~
a.cc:30:40: error: request for member 'begin' in 'arr', which is of non-class type 'int'
   30 |         cout << arr.at(max_element(arr.begin(), arr.end())) << endl;
      |                                        ^~~~~
a.cc:30:53: error: request for member 'end' in 'arr', which is of non-class type 'int'
   30 |         cout << arr.at(max_element(arr.begin(), arr.end())) << endl;
      |                                                     ^~~
Language: C++

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

int main(){
  int N,T,A; cin>>N; cin>>T>>A;
  vector<int> h(N);
  for(x:h)
    cin>>x;
  
  vector<int> check(N);
  for(int i=0; i<N; i++){
    check.at(i) = T*1000-h.at(i)*6-A*1000;
    if(check.at(i)<0)
      check.at(i) *= -1;
  }
  
  int answer = 1; int inspect = check.at(0);
  for(int i=1; i<N; I++){
    if(check.at(i) < inspect){
      answer = i+1;
      inspect = check.at(i);
    }
  }
  
  cout<<answer<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:8: error: found ':' in nested-name-specifier, expected '::'
    7 |   for(x:h)
      |        ^
      |        ::
a.cc:7:7: error: 'x' has not been declared
    7 |   for(x:h)
      |       ^
a.cc:10:20: error: expected initializer before '(' token
   10 |   vector<int> check(N);
      |                    ^
a.cc:10:20: error: could not convert 'check' from 'std::vector<int>' to 'bool'
   10 |   vector<int> check(N);
      |                    ^
      |                    |
      |                    std::vector<int>
a.cc:10:20: error: expected ';' before '(' token
   10 |   vector<int> check(N);
      |                    ^
      |                    ;
a.cc:10:23: error: expected ')' before ';' token
   10 |   vector<int> check(N);
      |                       ^
      |                       )
a.cc:7:6: note: to match this '('
    7 |   for(x:h)
      |      ^
a.cc:12:5: error: 'check' was not declared in this scope
   12 |     check.at(i) = T*1000-h.at(i)*6-A*1000;
      |     ^~~~~
a.cc:17:33: error: 'check' was not declared in this scope
   17 |   int answer = 1; int inspect = check.at(0);
      |                                 ^~~~~
a.cc:18:21: error: 'I' was not declared in this scope
   18 |   for(int i=1; i<N; I++){
      |                     ^
Language: C++


#include<stdio.h>
#include<stdlib.h>
int main(void){
        int n,t,a,h[1000];
        int i;
        int x=0;
        double min=1000.0;
        scanf("%d%d%d",&n,&t,&a);
        for(i=0;i<n;i++) scanf("%d",&h[i]);
        for(i=0;i<n;i++){
                if(min>fabs(a-(t-h[i]*0.006))){
                        min=t-h[i]*0.006;
                        x=i;
                }
        }
        printf("%d\n",x);
        return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:24: error: 'fabs' was not declared in this scope; did you mean 'labs'?
   12 |                 if(min>fabs(a-(t-h[i]*0.006))){
      |                        ^~~~
      |                        labs
Language: C++

#include<stdio.h>
#include<stdlib.h>
int main(void){
        int n,t,a,h[1000];
        int i;
        int x=0;
        double min=1000.0;
        scanf("%d%d%d",&n,&t,&a);
        for(i=0;i<n;i++) scanf("%d",&h[i]);
        for(i=0;i<n;i++){
                if(min>fabs(a,t-h[i]*0.006)){
                        min=t-h[i]*0.006;
                        x=i;
                }
        }
        printf("%d\n",x);
        return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:24: error: 'fabs' was not declared in this scope; did you mean 'labs'?
   11 |                 if(min>fabs(a,t-h[i]*0.006)){
      |                        ^~~~
      |                        labs
Language: Java

import java.util.*;

public class Main{
  public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);

    int N=sc.nextInt();
    int T=sc.nextInt();
    int A=sc.nextInt();
    int num=110;
    int count =0;

    for(int i=0;i<N;i++){
      int H = sc.nextInt();
      int a=Math.abs(A-(T-H*0.006));

      if(a < num)
      {
        num = a;
        count = i;
      }
  }
  System.out.println(count);
}
}


Compiler output:
Main.java:16: error: incompatible types: possible lossy conversion from double to int
      int a=Math.abs(A-(T-H*0.006));
                    ^
1 error
Language: Java

import java.util.*;

public class Main{
  public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);

    int N=sc.nextInt();
    int T=sc.nextInt();
    int A=sc.nextInt();
    int num=110;
    int count =0;

    for(int i=0;i<N;i++){
      int H = sc.nextInt();
      int a=abs(A-(T-H*0.006));

      if(a < num)
      {
        num = a;
        count = i;
      }
  }
  System.out.println(i);
}
}


Compiler output:
Main.java:16: error: cannot find symbol
      int a=abs(A-(T-H*0.006));
            ^
  symbol:   method abs(double)
  location: class Main
Main.java:24: error: cannot find symbol
  System.out.println(i);
                     ^
  symbol:   variable i
  location: class Main
2 errors