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

#include<bits/stdc++.h>
using namespace std;
int main(){
int N,T,A;
  cin>>N>>T>>A;
  vector<int> B(N);
  vector<int> a(N);
  double b=1000;

  for(int i=0;i<N;i++){
  cin>>B[i];
    int a[i]=T-B[i]*0.006;
     b=min(b,abs(A-a[i]));
  
  }
  if(b==abs(A-a[i])){
cout<<b<<endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:15: error: array must be initialized with a brace-enclosed initializer
   12 |     int a[i]=T-B[i]*0.006;
      |              ~^~~~~~~~~~~
a.cc:13:11: error: no matching function for call to 'min(double&, int)'
   13 |      b=min(b,abs(A-a[i]));
      |        ~~~^~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:13:11: note:   deduced conflicting types for parameter 'const _Tp' ('double' and 'int')
   13 |      b=min(b,abs(A-a[i]));
      |        ~~~^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:13:11: note:   mismatched types 'std::initializer_list<_Tp>' and 'double'
   13 |      b=min(b,abs(A-a[i]));
      |        ~~~^~~~~~~~~~~~~~~
a.cc:16:17: error: 'i' was not declared in this scope
   16 |   if(b==abs(A-a[i])){
      |                 ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
int N,T,A;
  cin>>N>>T>>A;
  vector<int> B(N);
  int b=A;
  for(int i=0;i<N;i++){
  cin>>B[i];
    int a[i]=T-B[i]*0.006;
     b=min(b,abs(A-a[i]));
  
  }
cout<<b<<endl;
}


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

#include<bits/stdc++.h>
using namespace std;
int main(){
int N,T,A;
  cin>>N>>T>>A;
  vector<int> B(N);
  b=A;
  for(int i=0;i<N;i++){
  cin>>B[i];
    int a=T-B[i]*0.006;
    int b=min(b,abs(A-a));
  
  }
cout<<b<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: 'b' was not declared in this scope
    7 |   b=A;
      |   ^
Language: C++

#include <bits/stdc++.h>
#define ll long long
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
using P = pair <int, int>;


int main(){
  int n, t, a;
    cin >> n;
    cin >> t >> a;
 
    int h, ans;
    double diff, MIN = double(1e9);
    rep(i, n) {
        cin >> h;
        diff = abs(a - (t - h * 0.006));
        if (diff < min_diff) {
            MIN = diff;
            ans = i + 1;
        }
    }
 
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:20: error: 'min_diff' was not declared in this scope
   18 |         if (diff < min_diff) {
      |                    ^~~~~~~~
Language: C++

#include <iostream>
using namespace std;
int N, T, A;
int H[100010];
int TH[100010];

int main(){
  cin >> N >> T >> A;
  for(int i = 0; i < N; i++){
    cin >> H[i];
  }
  for(int i = 0; i < N; i++){
    TH[i] = (1000*T - H[i] * 6 )- 1000* A; 
  }
  int findID = -1;
  int min = INF;
  for(int i = 0; i < N; i++){
    if(TH[i] < 0 ) TH[i] = -TH[i];
    if(TH[i] < min) min = TH[i];
    findID = i;
  }
  cout << findID  << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:13: error: 'INF' was not declared in this scope
   16 |   int min = INF;
      |             ^~~
Language: C++

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

int main(){
    int N;
    cin >> N;
    int T, A;
    cin >> T >> A;
    int H[N];
    vector<int> t[N];
    for (int i = 1; i < N+1; ++i){
        cin >> H[i];
        t[i] = abs(1000*T - 6*H[i] - 1000*A);
    }
    vector<int>::iterator iter = min_element(t.begin, t.end());
    size_t index = distance(t.begin(), iter);
    cout << index << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:44: error: no match for 'operator=' (operand types are 'std::vector<int>' and 'int')
   15 |         t[i] = abs(1000*T - 6*H[i] - 1000*A);
      |                                            ^
In file included from /usr/include/c++/14/vector:72,
                 from a.cc:2:
/usr/include/c++/14/bits/vector.tcc:210:5: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>]'
  210 |     vector<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/vector.tcc:211:42: note:   no known conversion for argument 1 from 'int' to 'const std::vector<int>&'
  211 |     operator=(const vector<_Tp, _Alloc>& __x)
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/14/vector:66:
/usr/include/c++/14/bits/stl_vector.h:766:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = int; _Alloc = std::allocator<int>]'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:766:26: note:   no known conversion for argument 1 from 'int' to 'std::vector<int>&&'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |                 ~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:788:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = int; _Alloc = std::allocator<int>]'
  788 |       operator=(initializer_list<value_type> __l)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:788:46: note:   no known conversion for argument 1 from 'int' to 'std::initializer_list<int>'
  788 |       operator=(initializer_list<value_type> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
a.cc:17:48: error: request for member 'begin' in 't', which is of non-class type 'std::vector<int> [N]'
   17 |     vector<int>::iterator iter = min_element(t.begin, t.end());
      |                                                ^~~~~
a.cc:17:57: error: request for member 'end' in 't', which is of non-class type 'std::vector<int> [N]'
   17 |     vector<int>::iterator iter = min_element(t.begin, t.end());
      |                                                         ^~~
a.cc:18:31: error: request for member 'begin' in 't', which is of non-class type 'std::vector<int> [N]'
   18 |     size_t index = distance(t.begin(), iter);
      |                               ^~~~~
Language: C++

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

int main(){
    int N;
    cin >> N;
    int T, A;
    cin >> T >> A;
    int H[N], t[N];
    for (int i = 1; i < N+1; ++i){
        cin >> H[i];
        t[i] = abs(1000*T - 6*H[i] - 1000*A);
    }
    vector<int>::iterator iter = min_element(t.begin, t.end());
    size_t index = distance(t.begin(), iter);
    cout << index << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:48: error: request for member 'begin' in 't', which is of non-class type 'int [N]'
   16 |     vector<int>::iterator iter = min_element(t.begin, t.end());
      |                                                ^~~~~
a.cc:16:57: error: request for member 'end' in 't', which is of non-class type 'int [N]'
   16 |     vector<int>::iterator iter = min_element(t.begin, t.end());
      |                                                         ^~~
a.cc:17:31: error: request for member 'begin' in 't', which is of non-class type 'int [N]'
   17 |     size_t index = distance(t.begin(), iter);
      |                               ^~~~~
Language: C++

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

int main(){
    int N;
    cin >> N;
    int T, A;
    cin >> T >> A;
    int H[N], t[N];
    for (int i = 1; i < N+1; ++i){
        cin >> H[i];
        t[i] = abs(1000*T - 6*H[i] - 1000*A);
    }
    vector<int>::iterator min = min_element(t.bigin(), t.end());
    size_t index = distance(t.bigin(), min);
    cout << index << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:47: error: request for member 'bigin' in 't', which is of non-class type 'int [N]'
   16 |     vector<int>::iterator min = min_element(t.bigin(), t.end());
      |                                               ^~~~~
a.cc:16:58: error: request for member 'end' in 't', which is of non-class type 'int [N]'
   16 |     vector<int>::iterator min = min_element(t.bigin(), t.end());
      |                                                          ^~~
a.cc:17:31: error: request for member 'bigin' in 't', which is of non-class type 'int [N]'
   17 |     size_t index = distance(t.bigin(), min);
      |                               ^~~~~
Language: C++

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

int main(){
    int N;
    cin >> N;
    int T, A;
    cin >> T >> A;
    int H[N], Th[N];
    for (int i = 0; i < N; ++i){
        cin >> H[i];
        Th[i] = abs(1000*T - 6*H[i] - 1000*A);
    }
    vector<int>::iterator min = min_element(Th.bigin(), Th.end());
    size_t index = distance(Th.bigin(), min);
    cout << index << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:48: error: request for member 'bigin' in 'Th', which is of non-class type 'int [N]'
   16 |     vector<int>::iterator min = min_element(Th.bigin(), Th.end());
      |                                                ^~~~~
a.cc:16:60: error: request for member 'end' in 'Th', which is of non-class type 'int [N]'
   16 |     vector<int>::iterator min = min_element(Th.bigin(), Th.end());
      |                                                            ^~~
a.cc:17:32: error: request for member 'bigin' in 'Th', which is of non-class type 'int [N]'
   17 |     size_t index = distance(Th.bigin(), min);
      |                                ^~~~~
Language: C++

#include<iostream>
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
int main(){
    int N, T, A;
    cin >> N >> T >> A;
    double d = 1000;
    int e = 0;
    int x;
    double gap;
    rep(i, N){
        cin >> x;
        gap = abs(x-A)
        if(d>gap) e = i+1;
        d = min(d,gap);
        
    }
    cout << e;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:23: error: expected ';' before 'if'
   14 |         gap = abs(x-A)
      |                       ^
      |                       ;
   15 |         if(d>gap) e = i+1;
      |         ~~
Language: Java

import java.util.*;
import java.io.*;

import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main (String[] args) {
		InputReader in = new InputReader(System.in);
	    int n  = in.readInt();
	    int t  = in.readInt();
	    int a = in.readInt(); 
	    double ans = Double.MAX_VALUE;
	    int i = 1;
	    int lol = 0; 
	    while(n-- > 0) {
	    	int h = in.readInt(); 
	    	if(  a - (t - (h*0.006))< ans) {
	    		ans =   a - (t - (h*0.006));
	    		lol = i; 
	    	}
	    	i++;
	    }
	    System.out.println(lol);
	}
}

class InputReader {

	private InputStream stream;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;
	private SpaceCharFilter filter;

	public InputReader(InputStream stream) {
		this.stream = stream;
	}

	public int read() {
		if (numChars == -1)
			throw new InputMismatchException();
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}

	public int readInt() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public String readString() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isSpaceChar(c));
		return res.toString();
	}

	public long readLong() {
		int c = read();
		while (isSpaceChar(c)) {
			c = read();
		}
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		long res = 0;
		do {
			if (c < '0' || c > '9') {
				throw new InputMismatchException();
			}
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}
	
	public boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}

	public String next() {
		return readString();
	}


Compiler output:
Main.java:118: error: reached end of file while parsing
	}
	 ^
1 error
Language: C++

#include <cmath>

using namespace std;

int main(int argc, char* argv[]) {
  long long N, T, A;
  cin >> N >> T >> A;

  long long min_diff = 1000000000;
  int index = -1;
  for (int i = 0; i < N; ++i) {
    double h;
    cin >> h;
    double temp = (double) T - h * 0.006;
    if (abs(temp - A) < min_diff) {
      min_diff = abs(temp - A);
      index = i + 1;
    }
  }

  cout << index << endl;

  return 0;
}

Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:7:3: error: 'cin' was not declared in this scope
    7 |   cin >> N >> T >> A;
      |   ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include <cmath>
  +++ |+#include <iostream>
    2 | 
a.cc:21:3: error: 'cout' was not declared in this scope
   21 |   cout << index << endl;
      |   ^~~~
a.cc:21:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:21:20: error: 'endl' was not declared in this scope
   21 |   cout << index << endl;
      |                    ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    1 | #include <cmath>
  +++ |+#include <ostream>
    2 |
Language: C++

#include <cmath>

using namespace std;

int main(int argc, char* argv[]) {
  long long N, T, A;
  cin >> N >> T >> A;

  long long min_diff = 100000000000;
  int index = -1;
  for (int i = 0; i < N; ++i) {
    double h;
    cin >> h;
    double temp = (double) T - h * 0.006;
    if (abs(temp - A) < min_diff) {
      min_diff = abs(temp - A);
      index = i + 1;
    }
  }

  cout << index << endl;

  return 0;
}

Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:7:3: error: 'cin' was not declared in this scope
    7 |   cin >> N >> T >> A;
      |   ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include <cmath>
  +++ |+#include <iostream>
    2 | 
a.cc:21:3: error: 'cout' was not declared in this scope
   21 |   cout << index << endl;
      |   ^~~~
a.cc:21:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:21:20: error: 'endl' was not declared in this scope
   21 |   cout << index << endl;
      |                    ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    1 | #include <cmath>
  +++ |+#include <ostream>
    2 |
Language: Java

import java.util.*;
import java.util.Arrays;

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 [] a = new int[N];
    float [] temp = new float[N];
    for(int i=0;i<N;i++){
      a[i] = sc.nextInt();
      temp[i] = (float)T-a[i]*0.006;
      
    }
    float min =100.0;
    int ans = 0;
    float x;
    for(int i=0;i<N;i++){
      x = Math.abs(A-temp[i]);
      if(x<min){
        min = x;
        ans = i;
      }
    }
    System.out.println(ans);
  }
}
                          
                         
                    
    
    
    
    
    
    


Compiler output:
Main.java:14: error: incompatible types: possible lossy conversion from double to float
      temp[i] = (float)T-a[i]*0.006;
                        ^
Main.java:17: error: incompatible types: possible lossy conversion from double to float
    float min =100.0;
               ^
2 errors
Language: Java

import java.util.*;
import java.util.Arrays;

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 [] a = new int[N];
    float [] temp = new float[N];
    for(int i=0;i<N;i++){
      a[i] = sc.nextInt();
      temp[i] = T-a[i]*0.006;
      
    }
    int min =100;
    int ans = 0;
    float x;
    for(int i=0;i<N;i++){
      x = Math.abs(A-temp[i]);
      if(x<min){
        min = x;
        ans = i;
      }
    }
    System.out.println(ans);
  }
}
                          
                         
                    
    
    
    
    
    
    


Compiler output:
Main.java:14: error: incompatible types: possible lossy conversion from double to float
      temp[i] = T-a[i]*0.006;
                 ^
Main.java:23: error: incompatible types: possible lossy conversion from float to int
        min = x;
              ^
2 errors
Language: Java

import java.util.*;
import java.util.Arrays;

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 [] a = new int[N];
    float [] temp = new int[N];
    for(int i=0;i<N;i++){
      a[i] = sc.nextInt();
      temp[i] = T-a[i]*0.006;
      
    }
    int min =100;
    int ans = 0;
    float x;
    for(int i=0;i<N;i++){
      x = Math.abs(A-temp[i]);
      if(x<min){
        min = x;
        ans = i;
      }
    }
    System.out.println(ans);
  }
}
                          
                         
                    
    
    
    
    
    
    


Compiler output:
Main.java:11: error: incompatible types: int[] cannot be converted to float[]
    float [] temp = new int[N];
                    ^
Main.java:14: error: incompatible types: possible lossy conversion from double to float
      temp[i] = T-a[i]*0.006;
                 ^
Main.java:23: error: incompatible types: possible lossy conversion from float to int
        min = x;
              ^
3 errors
Language: Java

import util.java.*;
import java.util.Arrays;

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 [] a = new int[N];
    int [] temp = sc.nextInt();
    for(int i=0;i<N;i++){
      a[i] = sc.nextInt();
      temp[i] = T-a[i]*0.006;
      
    }
    int min =100;
    int ans = 0;
    for(int i=0;i<N;i++){
      x = Math.abs(A-temp[i]);
      if(x<min){
        min = x;
        ans = i;
      }
    }
    System.out.println(ans);
  }
}
                          
                         
                    
    
    
    
    
    
    


Compiler output:
Main.java:1: error: package util.java does not exist
import util.java.*;
^
Main.java:6: error: cannot find symbol
    Scanner sc = new Scanner(System.in);
    ^
  symbol:   class Scanner
  location: class Main
Main.java:6: error: cannot find symbol
    Scanner sc = new Scanner(System.in);
                     ^
  symbol:   class Scanner
  location: class Main
Main.java:14: error: incompatible types: possible lossy conversion from double to int
      temp[i] = T-a[i]*0.006;
                 ^
Main.java:20: error: cannot find symbol
      x = Math.abs(A-temp[i]);
      ^
  symbol:   variable x
  location: class Main
Main.java:21: error: cannot find symbol
      if(x<min){
         ^
  symbol:   variable x
  location: class Main
Main.java:22: error: cannot find symbol
        min = x;
              ^
  symbol:   variable x
  location: class Main
7 errors
Language: Java

import util.java.*;
import java.util.Arrays;

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 [] a = new int[N];
    int [] temp = sc.nextInt();
    for(int i=0;i<N;i++){
      a[i] = sc.nextInt();
      temp[i] = T-a[i]*0.006;
      
    }
    int min =100;
    int ans = 0;
    for(int i=0;i<N;i++){
      x = Math.abs(A-temp[i]);
      if(x<min){
        min = x;
        ans = i;
      }
    }
    System.out.println(ans);
  }
}
                          
                         
                    
    
    
    
    
    
    


Compiler output:
Main.java:5: error: '(' expected
  public static void main{String[] args){
                         ^
Main.java:5: error: ';' expected
  public static void main{String[] args){
                                       ^
Main.java:28: error: reached end of file while parsing
}
 ^
3 errors
Language: C++

#include <bits/stdc++.h>
using namespace std; 
int main(){
  int n,t,a;
  cin >> n;
  cin >> t >> a;
  int i;
  vector<pair<int,int>> vec(n);
  for(i=0;i<n;i++){
    cin >> vec.at(i).first;
    vec.at(i).second=i;
  }
  int mini=vec.at(0).first;
  for(i=0;i<n;i++){
    double tem=t-0.006*vec.at(i).first;
    mini=min(mini,abs(tem-a));
  }
   for(i=0;i<n;i++){
     double tem=t-0.006*vec.at(i).first;
     if(mini==tem-a){
       break;
     }
   }
  cout << i+1;
  
}
    

Compiler output:
a.cc: In function 'int main()':
a.cc:16:13: error: no matching function for call to 'min(int&, double)'
   16 |     mini=min(mini,abs(tem-a));
      |          ~~~^~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:16:13: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'double')
   16 |     mini=min(mini,abs(tem-a));
      |          ~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:16:13: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   16 |     mini=min(mini,abs(tem-a));
      |          ~~~^~~~~~~~~~~~~~~~~
Language: C

#include<stdio.h>
#include<stdlib.h>
int main(){
  int N,T,A,i;
  scanf("%d",&N);
  scanf("%d %d",&T,&A);
  int H[N];
  for(i=1;i<=N;i++){
    scanf("%d",&H[i]);
  }
  int c[N];
  int n[N];
  int count=0;
  int min=50000;
  for(i=1;i<=N;i++){
    c[i]=12-H[i]*0.006;
    n[i]=abs(A-c[i]);
    if(n[i]<min){
      min=n[i];
      count=i;
    }
    }
  }
  printf("%d",count);
}


Compiler output:
main.c:24:10: error: expected declaration specifiers or '...' before string constant
   24 |   printf("%d",count);
      |          ^~~~
main.c:24:15: error: unknown type name 'count'
   24 |   printf("%d",count);
      |               ^~~~~
main.c:25:1: error: expected identifier or '(' before '}' token
   25 | }
      | ^
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 >> Hat(i);
for(int i=0;i<N;i++){
      H.at(i) = T - 0.006*H.at(i);
      H.at(i) = abs(H.at(i) - A);
}
int diff = 100 ;
int kai;
for (int i=0;i<N;i++){
       if(H.at(i)<diff){
                diff = H.at(i);
                kai = i;
        }
}
cout << kai << endl;

}



Compiler output:
a.cc: In function 'int main()':
a.cc:10:29: error: 'Hat' was not declared in this scope
   10 | for(int i=0;i<N;i++) cin >> Hat(i);
      |                             ^~~
Language: C++

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

 int main() {

int N, T, A;
cin >> N >> T >> A ;
vector<int>H(N);

for(i=0;i<N;i++) cin >> Hat(i);
for(i=0;i<N;i++){
      H.at(i) = T - 0.006*H.at(i);
      H.at(i) = abs(H.at(i) - A);
}
int diff = 100 ;
int kai;
for (int i=0;i<N;i++){
       if(H.at(i)<diff){
                diff = H.at(i);
                kai = i;
        }
}
cout << kai << endl;

}



Compiler output:
a.cc: In function 'int main()':
a.cc:10:5: error: 'i' was not declared in this scope
   10 | for(i=0;i<N;i++) cin >> Hat(i);
      |     ^
a.cc:10:25: error: 'Hat' was not declared in this scope
   10 | for(i=0;i<N;i++) cin >> Hat(i);
      |                         ^~~
a.cc:11:5: error: 'i' was not declared in this scope
   11 | for(i=0;i<N;i++){
      |     ^
Language: C++

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

int main(){
  int N,T,A;
  cin>>N>>T>>A;
  vector<int> H(N);
  vector<double> dif(N);
  double min;
  int n,i;
  
  for(i=0;i<N;i++){
    if(A>H[i]){
      dif[i]=A-(T-H(i)*0.006);
    }
    else{
      dif[i]=T-H(i)*0.006-A;
    }
  }
  
  min=dif[0];
  for(i=1;i<N;i++){
    if(min>dif[i]){
      min=dif[i];
      n=i;
    }
  }
  
  cout<<n+1<<endl;
}
  
  
  
  


Compiler output:
a.cc: In function 'int main()':
a.cc:15:20: error: no match for call to '(std::vector<int>) (int&)'
   15 |       dif[i]=A-(T-H(i)*0.006);
      |                   ~^~~
a.cc:18:17: error: no match for call to '(std::vector<int>) (int&)'
   18 |       dif[i]=T-H(i)*0.006-A;
      |                ~^~~
Language: C++

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

int main(){
  int N,T,A;
  cin>>N>>T>>A;
  vector<int> H(N);
  double dif(N);
  double min;
  int n;
  
  for(i=0;i<N;i++){
    if(A>H[i]){
      dif[i]=A-(T-H(i)*0.006);
    }
    else{
      dif[i]=T-H(i)*0.006-A;
    }
  }
  
  min=dif[0];
  for(i=1;i<N;i++){
    if(min>dif[i]){
      min=dif[i];
      n=i;
    }
  }
  
  cout<<n+1<<endl;
}
  
  
  
  

Compiler output:
a.cc: In function 'int main()':
a.cc:13:7: error: 'i' was not declared in this scope
   13 |   for(i=0;i<N;i++){
      |       ^
a.cc:22:10: error: invalid types 'double[int]' for array subscript
   22 |   min=dif[0];
      |          ^
a.cc:23:7: error: 'i' was not declared in this scope
   23 |   for(i=1;i<N;i++){
      |       ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int N;
	cin>>N;
	double T,A;
	cin>>T>>A;
	vector<double> vi;
	for(int i=0;i<N;i++)
	{
		double k;
		cin>>k;
		k = k*0.006;
		vi.push_back(T-k);
	}
	double mi=1e17
    int pos = -1;
	for(int i=0;i<vi.size();i++)
	{
		if(abs(vi[i]-A)<mi)
		{
			mi = abs(vi[i]-A);
			pos = i+1;
		}
	}
	cout<<pos<<endl;
 } 

Compiler output:
a.cc: In function 'int main()':
a.cc:18:5: error: expected ',' or ';' before 'int'
   18 |     int pos = -1;
      |     ^~~
a.cc:24:25: error: 'pos' was not declared in this scope; did you mean 'pow'?
   24 |                         pos = i+1;
      |                         ^~~
      |                         pow
a.cc:27:15: error: 'pos' was not declared in this scope; did you mean 'pow'?
   27 |         cout<<pos<<endl;
      |               ^~~
      |               pow
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repd(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)

int main()
{
  int N, T, A;
  cin >> N;
  cin >> T >> A;
  int h[N];
  int diff = 100000;
  int num = 0;
  rep(i, N)
  {
    cin >> h[i];
    int temp = (T * 1000 - h[i] * 6) if (abs(A * 1000 - temp) < diff)
    {
      diff = abs(A - temp);
      num = i + 1;
    }
  }

  cout << num;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:38: error: expected ',' or ';' before 'if'
   22 |     int temp = (T * 1000 - h[i] * 6) if (abs(A * 1000 - temp) < diff)
      |                                      ^~
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0;i < (n);i++)
using namespace std;
typedef long long ll;

int main(){
    int n;
    cin >> n;
    int t,a;
    cin >> t >> a;
    vector<int> h(n);
    rep(i,n) cin >> h[i];
    double s = pow(10,5);
    int ans;
    rep(i,n){
        double p = t - h[i] * 0.006;
        int d = abs(p - a);
        s = min(d,s);
        if(s == d) ans = i+1;
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:16: error: no matching function for call to 'min(int&, double&)'
   18 |         s = min(d,s);
      |             ~~~^~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:18:16: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'double')
   18 |         s = min(d,s);
      |             ~~~^~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:18:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   18 |         s = min(d,s);
      |             ~~~^~~~~
Language: C++

#include <iostream>
using namespace std;

int main () {
  int N, T, A;
  cin >> N >> T >> A;
  int I = 0;
  int min = 1<<30;
  for (int i=0; i < N; ++i) {
    int H;
    cin >> H;
    int d = abs(A*1000 - (T*1000 - H * 6));s
    if (d < min) {
      min = d;
      I = i;
    }
  }
  cout << I + 1 << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:44: error: 's' was not declared in this scope
   12 |     int d = abs(A*1000 - (T*1000 - H * 6));s
      |                                            ^
Language: C++

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

int main()
{
  int N;
  cin >> N;
  int T, A;
  cin >> T >> A;
  
 
  int vector<int> vec(N);
  int min_ind;
  double min = 50;
  
  for (int i = 0; i < N; i++) {
    cin >> vec(i);
    if ( abs( T - vec(i) * 0.006) < min ) {
      min_ind = i;
      min = abs(T- vec(i)) * 0.006;
    }
  }
   cout << min_ind << endl;        
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:19: error: invalid declarator before 'vec'
   12 |   int vector<int> vec(N);
      |                   ^~~
a.cc:17:12: error: 'vec' was not declared in this scope
   17 |     cin >> vec(i);
      |            ^~~
Language: C++

#indlude <iostream>
using namespace std;
int main(){
  int n, t, a, h[1000];
  cin >> n >> t >> a;
  int out;
  double min = 1e9;
  for(int i = 0; i < n; i++){
    cin >> h[i];
    if(min > abs(a - (t - (0.006 * h)))) min = abs(a - (t - (0.006 * h))); out = i + 1;
  }
  cout << i << endl;
}

Compiler output:
a.cc:1:2: error: invalid preprocessing directive #indlude; did you mean #include?
    1 | #indlude <iostream>
      |  ^~~~~~~
      |  include
a.cc: In function 'int main()':
a.cc:5:3: error: 'cin' was not declared in this scope
    5 |   cin >> n >> t >> a;
      |   ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | #indlude <iostream>
a.cc:10:34: error: invalid operands of types 'double' and 'int [1000]' to binary 'operator*'
   10 |     if(min > abs(a - (t - (0.006 * h)))) min = abs(a - (t - (0.006 * h))); out = i + 1;
      |                            ~~~~~ ^ ~
      |                            |       |
      |                            double  int [1000]
a.cc:10:14: error: 'abs' was not declared in this scope
   10 |     if(min > abs(a - (t - (0.006 * h)))) min = abs(a - (t - (0.006 * h))); out = i + 1;
      |              ^~~
a.cc:10:68: error: invalid operands of types 'double' and 'int [1000]' to binary 'operator*'
   10 |     if(min > abs(a - (t - (0.006 * h)))) min = abs(a - (t - (0.006 * h))); out = i + 1;
      |                                                              ~~~~~ ^ ~
      |                                                              |       |
      |                                                              double  int [1000]
a.cc:12:3: error: 'cout' was not declared in this scope
   12 |   cout << i << endl;
      |   ^~~~
a.cc:12:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:12:11: error: 'i' was not declared in this scope
   12 |   cout << i << endl;
      |           ^
a.cc:12:16: error: 'endl' was not declared in this scope
   12 |   cout << i << endl;
      |                ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | #indlude <iostream>
Language: C++

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

using namespace std;

int main(){
  float N,T,A,X=10001;
  cin >> N >> T >> A;
  vector<float> H(N);
  
  vector<double> heikin(N);
  int ans = 0;
  for(int i=0;i<N;i++){
    heikin(i) = abs(A-(T-H[i]*0.006));
    if(heikin[i]<X){
      X=heikin[i];
      ans = i+1;
    }
  }
  
  cout << ans << endl;
}
 
                    
      


Compiler output:
a.cc: In function 'int main()':
a.cc:15:11: error: no match for call to '(std::vector<double>) (int&)'
   15 |     heikin(i) = abs(A-(T-H[i]*0.006));
      |     ~~~~~~^~~
Language: C++

#include <iostream>
using namespace std;

int main(){
  int N, T, A;
  cin >> N;
  cin >> T >> A;
  int H[N];
  for(int i = 0; i < N; i++) cin >> H[i];
  
  float close_temp;
  int result_num = 0;
  for(int i = 0; i < N; i++){
    float temp = T - H[i] * 0.006;
    if(i == 0) close_temp = temp;
    if (fabs(close_temp - A) > fabs(temp - A)){
      close_temp = temp;
      result_num = i;
    }
  }
  cout << result_num << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:9: error: 'fabs' was not declared in this scope; did you mean 'labs'?
   16 |     if (fabs(close_temp - A) > fabs(temp - A)){
      |         ^~~~
      |         labs
Language: C++

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

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

#include <iostream>
#include <string>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <iomanip>

using namespace std;

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

  int idx;
  float abs_min = abs(A - 600);
  for (int i = 0; i < N; ++i)
  {
    int H;
    cin >> H;
    
    float temp = T - H * 0.006;
    if (abs_min > fabs(A - temp))
    {
      abs_min = abs(A - temp);
      idx = i + 1;
    }
  }

  cout << idx << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:19: error: 'fabs' was not declared in this scope; did you mean 'labs'?
   25 |     if (abs_min > fabs(A - temp))
      |                   ^~~~
      |                   labs
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
ll z(ll a) {
  if(a > 0) {
    return a;
  } else {
    return -a;
  }
}

template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}
int idx = -1;
int main() {
  int N, T, A; cin >> N >> T >> A;
  ll x = 10000000000;
  int idx;
  for(int i = 0; i < N; i++) {
    ll H; cin >> H;
    if(chmin(x, z(T * 1000 - H * 6 - A * 1000)) {
      idx = i + 1;
    }
  }
  cout << idx << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:48: error: expected ')' before '{' token
   27 |     if(chmin(x, z(T * 1000 - H * 6 - A * 1000)) {
      |       ~                                        ^~
      |                                                )
a.cc:30:3: error: expected primary-expression before '}' token
   30 |   }
      |   ^
Language: C++

#include<iostream>
#include<cmath>
using namespace std;
int main(){
    int n;cin>>n;
    int t,a;cin>>t>>a;
    int h,ans;
    double sub=10000;
    for(int i=1;i<=n;i++){
        cin>>h;
        if(sub>abs(t-h*0.006-a)){
            sub=t-h*0.006-a;
            ans=i;
        }
    }
    cout<<i<<endl;
}

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

// Palace
#include<iostream>
using namespace std;
int N,T,A,answear,delta;
int main(){
    cin>>N;
    int H[N];
    cin >> T >> A;
    for(int i=0;i<N;++i){
        cin >> H[i];
    }
    answear = 0;
    delta = std::pow(H[0],2);
    for(int i = 0; i<N;++i){
        if(std::pow((H[i]-A),2)<delta){
            delta = abs(H[i]-A)^2;
            answear = i+1;
        }
    }
    cout << answear << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:18: error: 'pow' is not a member of 'std'
   13 |     delta = std::pow(H[0],2);
      |                  ^~~
a.cc:15:17: error: 'pow' is not a member of 'std'
   15 |         if(std::pow((H[i]-A),2)<delta){
      |                 ^~~
Language: C++

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

int main() {
  int N;
  cin >> N;
  int T; 
  int A;
  cin >> T >> A;
  int min_temp=500000#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N;
  cin >> N;
  int T; 
  int A;
  cin >> T >> A;
  int min_temp=50000;
  int titen=0;
  for(int i=0; i<N; i++){
    int H;
    cin >> H;
    if(min_temp>abs(T-H*0.006-A)){
      min_temp=abs(T-H*0.006-A);
      titen=i+1;
    }
  }
  cout << titen << endl;
}

Compiler output:
a.cc:11:22: error: stray '#' in program
   11 |   int min_temp=500000#define _GLIBCXX_DEBUG
      |                      ^
a.cc: In function 'int main()':
a.cc:11:23: error: expected ',' or ';' before 'define'
   11 |   int min_temp=500000#define _GLIBCXX_DEBUG
      |                       ^~~~~~
a.cc:15:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   15 | int main() {
      |         ^~
a.cc:15:9: note: remove parentheses to default-initialize a variable
   15 | int main() {
      |         ^~
      |         --
a.cc:15:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:15:12: error: a function-definition is not allowed here before '{' token
   15 | int main() {
      |            ^
a.cc:32:2: error: expected '}' at end of input
   32 | }
      |  ^
a.cc:5:12: note: to match this '{'
    5 | int main() {
      |            ^
Language: C++

int main(){

  int n,t,a; cin>>n>>t>>a;



  int min_num, min_diff =MAX ;

  REP(i,n){
    int h;
    cin >> h;
    if(min_diff>abs(t*1000-h*6-a*1000)){
      min_diff = abs(t*1000-h*6-a*1000);
      min_num = i + 1;
    }
  }

  cout << min_num << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:3:14: error: 'cin' was not declared in this scope
    3 |   int n,t,a; cin>>n>>t>>a;
      |              ^~~
a.cc:7:26: error: 'MAX' was not declared in this scope
    7 |   int min_num, min_diff =MAX ;
      |                          ^~~
a.cc:9:7: error: 'i' was not declared in this scope
    9 |   REP(i,n){
      |       ^
a.cc:9:3: error: 'REP' was not declared in this scope
    9 |   REP(i,n){
      |   ^~~
a.cc:18:3: error: 'cout' was not declared in this scope
   18 |   cout << min_num << endl;
      |   ^~~~
a.cc:18:22: error: 'endl' was not declared in this scope
   18 |   cout << min_num << endl;
      |                      ^~~~
Language: C++

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

int main() {
	int n,t,a;
	cin >> n >> t >> a;
	int k;
	float cc = 111;
	for(int i = 1;i <= n;i++)
	{
		int h;
		cin >> h;
		float c = t - (0.006 * h);
		if(cc > abs(a - c))
		{
			cc = abs(a - c);
			k = i;
		}
	}
	cout << i << endl;
	return 0;
}


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

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

int main() {

	int N, T, A;
	cin >> N;
	cin >> T >> A;

	vector<int> high(N);

	for (int i = 0;i < N;i++)
		cin >> high.at(i);


	int ans;
	for (int i = 0;i < N;i++) {
		double near_i = fabs(A - T + 0.06 * high.at(i));

		if (i == 0)
			ans = 1;

		else if (fbs(A - T + 0.06 * high.at(ans - 1)) > near_i)
			ans = i++;

		else;

	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:26: error: 'fbs' was not declared in this scope; did you mean 'ffs'?
   23 |                 else if (fbs(A - T + 0.06 * high.at(ans - 1)) > near_i)
      |                          ^~~
      |                          ffs
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,ans,m,b,t;
    double m=999999;
    cin >> n;
    cin >> t >> b;
    for(int i=1;i<=n;i++)
    {
        cin >> m;
        double x=t-m*0.006;
        if(abs(x-b)<mn)
        {
            ans=i;
            mn=abs(x-b);
        }
    }
    cout << ans << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:12: error: conflicting declaration 'double m'
    8 |     double m=999999;
      |            ^
a.cc:7:15: note: previous declaration as 'int m'
    7 |     int n,ans,m,b,t;
      |               ^
a.cc:15:21: error: 'mn' was not declared in this scope; did you mean 'm'?
   15 |         if(abs(x-b)<mn)
      |                     ^~
      |                     m
Language: C++

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

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

    vector<int> h(n);
    int index = 1000;
    int ans = -1;
    for (int i = 0; i < n; i++)
    {
        cin >> h.at(i);
        dif = (t*1000 - h.at(i)*6) - a;
        if (dif < 0 )
        {
            dif = -dif;
        }
        if (dif < index)
        {
            index = dif;
            ans = i + 1;
        }
    }
    cout << ans << endl;
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:15:9: error: 'dif' was not declared in this scope; did you mean 'div'?
   15 |         dif = (t*1000 - h.at(i)*6) - a;
      |         ^~~
      |         div
Language: C++

#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int ctoi(char c){
  return c - '0';
}

int main(){
  int N
  double T, A;
  cin >> N >>  T >> A;
  vector<pair<double, int>> H(N);
  
  for(int i = 0; i < N; i++){
    double h;
    cin >> h;
    H.at(i).first = abs(A - (T - h * 0.06));
    H.at(i).second = i + 1;
  }
  sort(ALL(H));
  cout << H.at(0).second << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:3: error: expected initializer before 'double'
   14 |   double T, A;
      |   ^~~~~~
a.cc:15:10: error: 'N' was not declared in this scope
   15 |   cin >> N >>  T >> A;
      |          ^
a.cc:15:16: error: 'T' was not declared in this scope
   15 |   cin >> N >>  T >> A;
      |                ^
a.cc:15:21: error: 'A' was not declared in this scope
   15 |   cin >> N >>  T >> A;
      |                     ^
Language: C++

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

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

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

  int max = 0 ;
  int ans = 0;
  for(int i=0;i<n;i++){
    cin >> h;
    if(i==0){
       dif = abs(a-calc(t,h));
       ans = i ;
       continue;
    }
    if(abs(a-calc(t,h))<dif){
      dif = abs(a-calc(t,h));
      ans = i ;
    }
  }
   cout << ans+1 << "\n" ;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:8: error: 'dif' was not declared in this scope; did you mean 'div'?
   21 |        dif = abs(a-calc(t,h));
      |        ^~~
      |        div
a.cc:25:25: error: 'dif' was not declared in this scope; did you mean 'div'?
   25 |     if(abs(a-calc(t,h))<dif){
      |                         ^~~
      |                         div
Language: C++

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

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

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

  int max = 0 ;
  int ans = 0;
  for(int i=0;i<n;i++){
    cin >> h;
    if(calc(t,h)>max){
      max = calc(t,h);
      ans = i ;
    }
  }
   cout << ans << "\n" ;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:8: error: 'calc' was not declared in this scope; did you mean 'cala'?
   20 |     if(calc(t,h)>max){
      |        ^~~~
      |        cala