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

#include<iostream>
using namespace std;
int main()
{
    // 1行目
    int n;
    cin >> n;
    
    vector<int> a[n];
	a[0] = 0;
	
	int max = 0;
	
    for (int i = 1; i < n + 1; i++) {
        a[i] = 0;
    	cin >> a[i];
	
    	if( max < a[i]){
    		max = a[i];
    	}
    }
	
	// 結果
	cout << max << endl;
    
    return 0;
}




Compiler output:
a.cc: In function 'int main()':
a.cc:9:5: error: 'vector' was not declared in this scope
    9 |     vector<int> a[n];
      |     ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include<iostream>
  +++ |+#include <vector>
    2 | using namespace std;
a.cc:9:12: error: expected primary-expression before 'int'
    9 |     vector<int> a[n];
      |            ^~~
a.cc:10:9: error: 'a' was not declared in this scope
   10 |         a[0] = 0;
      |         ^
Language: Java

import java.io.*;
import java.util.*;
public class Main
{
	public static void main(String[] args)throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        int t=Integer.parseInt(st.nextToken());
      	st = new StringTokenizer(br.readLine());
      	int y[]=new int[t];
      	int p=0;
      	while(st.hasMoreTokens())
        {
          y[p]=Integer.parseInt(st.nextToken());
          p++:
        }
      	Arrays.sort(y);
      	System.out.println(y[t-1]-y[0]);
    }
}

Compiler output:
Main.java:15: error: ';' expected
          p++:
             ^
1 error
Language: C++

#include<iostream>
using namespace std;
int main()
{
    // 1行目
    int n;
    cin >> n;
    
    int a[n];
	a[0] = 0;
    for (int i = 1; i < n + 1; i++) {
        a[i] = 0;
    	cin >> a[i];
	}
	// 最大値をresultに代入
	int result = max(a[n]);
	
	// 結果
	cout << result << endl;
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:25: error: no matching function for call to 'max(int&)'
   16 |         int result = max(a[n]);
      |                      ~~~^~~~~~
In file included from /usr/include/c++/14/string:51,
                 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_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 1 provided
Language: C++

#include<iostream>
using namespace std;
int main()
{
    // 1行目
    int n;
    cin >> n;
    
	// 配列の定義と初期化
    int a[n];
	a[] = 0;
	
    for (int i = 1; i < n + 1; i++) {
    	cin >> a[i];
	}
	// 最大値をresultに代入
	int result = max(a);
	
	// 結果
	cout << result << endl;
    
    return 0;
}




Compiler output:
a.cc: In function 'int main()':
a.cc:11:11: error: expected primary-expression before ']' token
   11 |         a[] = 0;
      |           ^
a.cc:17:25: error: no matching function for call to 'max(int [n])'
   17 |         int result = max(a);
      |                      ~~~^~~
In file included from /usr/include/c++/14/string:51,
                 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_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 1 provided
Language: C++

#include<iostream>
using namespace std;
int main()
{
    // 1行目
    int n;
    cin >> n;
    
    int a[n];
	
    for (int i = 1; i < n + 1; i++) {
        a[i] = 0;
    	cin >> a[i];
	}
	// 最大値をresultに代入
	int result = max(a[]);
	
	// 結果
	cout << result << endl;
    
    return 0;
}




Compiler output:
a.cc: In function 'int main()':
a.cc:16:28: error: expected primary-expression before ']' token
   16 |         int result = max(a[]);
      |                            ^
Language: C++

#include<iostream>
using namespace std;
int main()
{
    // 1行目
    int n;
    cin >> n;
    
    int a[n];
	
    for (int i = 1; i < n + 1; i++) {
        a[i] = 0;
    	cin >> a[i];
	}
	// 最大値をresultに代入
	int result = max(a);
	
	// 結果
	cout << result << endl;
    
    return 0;
}




Compiler output:
a.cc: In function 'int main()':
a.cc:16:25: error: no matching function for call to 'max(int [n])'
   16 |         int result = max(a);
      |                      ~~~^~~
In file included from /usr/include/c++/14/string:51,
                 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_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 1 provided
Language: C

#include<stdio.h>

int main(void){
 int N;
 int A[N] = [0];
 int i = 0;
  
  scanf("%d", &N);
  for(i= 0; i < N;i++){
    scanf("%d", &A[i]);
  }
  
  int max=A[0];
  for(i=1;i<N;i++){
    if(A[i]>max){
      max = A[i];
    }
    
    int min = A[0]
    for(i=1;i<N;i++){
    if(A[i]<min){
      min = A[i];
    }    
      
     printf("%d", (max-min));
  
  return 0;
  
}

Compiler output:
main.c: In function 'main':
main.c:5:13: error: expected expression before '[' token
    5 |  int A[N] = [0];
      |             ^
main.c:5:13: error: variable-sized object may not be initialized except with an empty initializer
main.c:20:5: error: expected ',' or ';' before 'for'
   20 |     for(i=1;i<N;i++){
      |     ^~~
main.c:20:20: error: expected ';' before ')' token
   20 |     for(i=1;i<N;i++){
      |                    ^
      |                    ;
main.c:20:20: error: expected statement before ')' token
main.c:29:1: error: expected declaration or statement at end of input
   29 | }
      | ^
main.c:29:1: error: expected declaration or statement at end of input
Language: C++

#include<iostream>
using namespace std;
int main()
{
    // 1行目
    int n;
    cin >> n;
    
    // 整数の入力
    int a[] = 0;
    
    for (int i = 1; i < n + 1; i++) {
    	cin >> a[i];
	}
	// 最大値をresultに代入
	int result = max_element(a.begin(), a.end());
	
	// 結果
	cout << result << endl;
    
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:10:15: error: initializer fails to determine size of 'a'
   10 |     int a[] = 0;
      |               ^
a.cc:10:15: error: array must be initialized with a brace-enclosed initializer
a.cc:16:36: error: request for member 'begin' in 'a', which is of non-class type 'int [1]'
   16 |         int result = max_element(a.begin(), a.end());
      |                                    ^~~~~
a.cc:16:47: error: request for member 'end' in 'a', which is of non-class type 'int [1]'
   16 |         int result = max_element(a.begin(), a.end());
      |                                               ^~~
a.cc:16:22: error: 'max_element' was not declared in this scope
   16 |         int result = max_element(a.begin(), a.end());
      |                      ^~~~~~~~~~~
Language: C++

#include <iostream>
#include <vector>

// using namespace std;

int main(){
  int n;
  
 std::vector<int> A(110);

  for(int i = 0; i < n; i++)
  {
    std::cin >> A[i];
  }
  int min = * std::min_element(A.begin(), A.end());
  int max = * std::max_element(A.begin(), A.end());
  std::cout << max - min << std::endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:20: error: 'min_element' is not a member of 'std'; did you mean 'tuple_element'?
   15 |   int min = * std::min_element(A.begin(), A.end());
      |                    ^~~~~~~~~~~
      |                    tuple_element
a.cc:16:20: error: 'max_element' is not a member of 'std'; did you mean 'tuple_element'?
   16 |   int max = * std::max_element(A.begin(), A.end());
      |                    ^~~~~~~~~~~
      |                    tuple_element
Language: C++

#include<iostream>
using namespace std;
int main()
{
    // 1行目
    int n;
    cin >> n;
    
    // 整数の入力
    int a[n] = 0;
    
    for (int i = 1; i < n + 1; i++) {
    	cin >> a[i];
	}
	// 最大値をresultに代入
	int result = max(a);
	
	// 結果
	cout << result << endl;
    
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:10:16: error: array must be initialized with a brace-enclosed initializer
   10 |     int a[n] = 0;
      |                ^
a.cc:16:25: error: no matching function for call to 'max(int [n])'
   16 |         int result = max(a);
      |                      ~~~^~~
In file included from /usr/include/c++/14/string:51,
                 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_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 1 provided
Language: C++

#include<iostream>
using namespace std;
int main()
{
    // 1行目
    int n;
    cin >> n;
    
    // 整数の入力
    int a[n] = 0;
    
    for (int i = 1; i < n + 1; i++) {
    	cin >> a[i];
	}

	cout << max(a) << endl;
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:16: error: array must be initialized with a brace-enclosed initializer
   10 |     int a[n] = 0;
      |                ^
a.cc:16:20: error: no matching function for call to 'max(int [n])'
   16 |         cout << max(a) << endl;
      |                 ~~~^~~
In file included from /usr/include/c++/14/string:51,
                 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_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 1 provided
Language: C++

#include <iostream>
using namespace std;

int main() {
	int N;
	int A[101];
	cin >> N;
	for (int i = 0; i < N; i++) cin >> A[i];
	int minv = A[i];
	int maxv = 0;
	for (int i = 0; i < N; i++) {
		if (minv > A[i]) minv = A[i];
		if (maxv < A[i]) maxv = A[i];
	}
	cout << maxv - minv << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:22: error: 'i' was not declared in this scope
    9 |         int minv = A[i];
      |                      ^
Language: C++

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

int main() {
  int N,i,j,L,M,D;
  int A[N];
	L = 1000000000;
	cin >> N;
  for(i=0;i<N;i++){
		cin >> A[i];
	}
	for(i=0;i<N;i++){
		for(j=0;j<N;j++){
			if(A[j] <= A[i] && M <= A[i]){
				M = A[i];
			}else if(L >= A[i]){
				L = A[i]
			}
		}
	}
	D = M - L;
	cout << D <<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:41: error: expected ';' before '}' token
   17 |                                 L = A[i]
      |                                         ^
      |                                         ;
   18 |                         }
      |                         ~
Language: C++

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

int main() {
    int N; cin >> N;
    vector<string> vec;
    vec.reserve(N);
    for (int i = 0; i < N; ++i) {
        cin >> vec[i];
    }
    auto itr = minmax_element(vec.begin(), vec.end());
    cout << *itr.second - *itr.first << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:16: error: 'minmax_element' was not declared in this scope
   12 |     auto itr = minmax_element(vec.begin(), vec.end());
      |                ^~~~~~~~~~~~~~
Language: C++

#include<iostream>
#include<string>

using namespace std;

int N,ans,min,max ;
int A[N];
min = 1000000000
max = 0
int main(){
   for(int i = 0 ; i < N; ++i ){
      if (a[i] > max){
         max = a[i] ;
      }
      if (a[i] < min){
         min = a[i] ;
      }
   ans = max - min;
   cout << ans << endl ;
}
   


Compiler output:
a.cc:7:7: error: size of array 'A' is not an integral constant-expression
    7 | int A[N];
      |       ^
a.cc:8:1: error: reference to 'min' is ambiguous
    8 | min = 1000000000
      | ^~~
In file included from /usr/include/c++/14/string:51,
                 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_algobase.h:281:5: note: candidates are: '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:233:5: note:                 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
a.cc:6:11: note:                 'int min'
    6 | int N,ans,min,max ;
      |           ^~~
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <fstream>
#include <sstream>
#include <random>
#include <queue>
#include <stack>
#include <limits>
#include <cmath>
#include <numeric>

int main(int argc, char* argv[]) {
	// 入力
	int n;
	std::cin >> n;
	std::vector<int> x(n);
	for(auto itr = x.begin(); itr != x.end(); ++itr) {
		std::cin >> *itr;
	}

	int max = *std::max_element(x.begin(), x.end());
	int min = *std::min_element(x.begin(), x.end());

	// 出力
	std::cout << max-min << std::endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:22:25: error: 'max_element' is not a member of 'std'; did you mean 'tuple_element'?
   22 |         int max = *std::max_element(x.begin(), x.end());
      |                         ^~~~~~~~~~~
      |                         tuple_element
a.cc:23:25: error: 'min_element' is not a member of 'std'; did you mean 'tuple_element'?
   23 |         int min = *std::min_element(x.begin(), x.end());
      |                         ^~~~~~~~~~~
      |                         tuple_element
Language: C++

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

int main() {
    int N; cin >> N;
    vector<string> vec;
    vec.reserve(N);
    for (int i = 0; i < N; ++i) {
        cin >> vec[i];
    }
    auto itr = maxmin_element(vec.begin(), vec.end());
    cout << *itr.second - *itr.first << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:16: error: 'maxmin_element' was not declared in this scope
   12 |     auto itr = maxmin_element(vec.begin(), vec.end());
      |                ^~~~~~~~~~~~~~
Language: C++

#include <iostream>
using namespace std;

int main() {
    int N; cin >> N;
    vector<string> vec;
    vec.reserve(N);
    for (int i = 0; i < N; ++i) {
        cin >> vec[i];
    }
    auto itr = maxmin_element(vec.begin(), vec.end());
    cout << *itr.second - *itr.first << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:5: error: 'vector' was not declared in this scope
    6 |     vector<string> vec;
      |     ^~~~~~
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:6:18: error: expected primary-expression before '>' token
    6 |     vector<string> vec;
      |                  ^
a.cc:6:20: error: 'vec' was not declared in this scope
    6 |     vector<string> vec;
      |                    ^~~
a.cc:11:16: error: 'maxmin_element' was not declared in this scope
   11 |     auto itr = maxmin_element(vec.begin(), vec.end());
      |                ^~~~~~~~~~~~~~
Language: C

#include <stdio.h>

int main(){
	int n,i;
	int max = 0;
	int min = 0;
	scanf("%d",&n);
	int a[n];
	for(i = 0;i < n;i++){
		scanf("%d",&a[n]);
	if(max < a[n])
		max = a[n];
	if(min == 0)
		min = a[n];
	if(a[n] < min)
		min = a[n];
	}

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

#include<iostream>

using namespace std;
int main()
{
    int N;
    cin >> N;
    
    int a;
    int min=INT_MAX;
    int max=0;
    
    for(int i=0;i<N;i++){
        cin >> a;
        if(min>a){
            min=a;
        }
        if(max<a){
            max=a;
        }
    }
    
    cout<< max-min << endl;
    
    return 0;
}


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

#include <iostream>
#include <string>
#include <array>
#include <vector>

using namespace std;

int main() {

    int n;
    cin >> n;
    
    vector<int> ar;

    for (int i=0; i<n; i++) {
        int temp;
        cin >> temp;
        ar.push_back(temp);
    }

    sort(ar.begin(), ar.end());
    
    int answer =ar[ar.size()-1] -ar[0];
    
    if (answer < 0) {
        cout << -answer<< endl;
        
    }else {
        cout << answer << endl;
    }

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   21 |     sort(ar.begin(), ar.end());
      |     ^~~~
      |     short
Language: C++

#include <iostream>
using namespace std;
int main()
{
	int n,a[1005];
	cin>>n;
	for(int i=0;i<n;i++)
		cin>>a[i];
	sort(a,a+n);
	cout<<abs(a[n-1]-a[0]);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:9: error: 'sort' was not declared in this scope; did you mean 'short'?
    9 |         sort(a,a+n);
      |         ^~~~
      |         short
Language: C++

#include <stdio.h>
/* For a given array arr[], returns the maximum j – i such that
    arr[j] > arr[i] */
int maxIndexDiff(int arr[], int n)
{
    int maxDiff = -1;
    int i, j;
 
    for (i = 0; i < n; ++i)
    {
        for (j = n-1; j > i; --j)
        {
            if(arr[j] > arr[i] && maxDiff < (j - i))
                maxDiff = j - i;
        }
    }
 
    return maxDiff;
}
 
int main()
{
    int arr[] ;
    int n = sizeof(arr)/sizeof(arr[0]);
    int maxDiff = maxIndexDiff(arr, n);
    printf("\n %d", maxDiff);
    getchar();
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:9: error: storage size of 'arr' isn't known
   23 |     int arr[] ;
      |         ^~~
Language: C

#include<stdio.h>
int max3(int a,int b,int c){
  ans = a;
  if(ans < b) ans = b;
  if(ans < c) ans = c;
  return ans;
}
int main(){
  int N,i,j,max;
  int a[100];
  scanf("%d",&N);
  for(i=0;i<N;i++) scanf("%d",&a[i]);
  max = 0;
  for(i=0;i<N;i++){
    for(j=i;j<N;j++){
      max = max3(max,a[i]-a[j],a[j]-a[i]);
    }
  }
  printf("%d\n",max);
  return 0;
}

Compiler output:
main.c: In function 'max3':
main.c:3:3: error: 'ans' undeclared (first use in this function)
    3 |   ans = a;
      |   ^~~
main.c:3:3: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include <iostream>
#include <vector>

using namespace std;

int N ;
vector<int> A;
int main() {
    cin >> N ;
    for (int i = 0; i < N; ++i) {
        int b;
        cin >> b;
        A.push_back(b);
    }
    sort(A.begin(), A.end());
    cout << A.at(N-1) - A.at(0) << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   15 |     sort(A.begin(), A.end());
      |     ^~~~
      |     short
Language: C++

#include <iostream>
using namespace std;

int main() {
    int a;
    cin >> a;
    int test[a];
  	for(int i = 0;i < a;i++){
    	cin >> test[i];
    }
  	int tmp,k;
  	for(int j = 0;j < a;j++){
    	for(k = j + 1;k++){
        	if(test[j] > test[k]){
            	tmp = test[j];
              	test[j] = test[k];
              	test[k] = tmp;
            }
        }
    }
  	a = a-1;
  	int ans = temp[a] - temp[0];
  	cout << ans << endl;
  	
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:26: error: expected ';' before ')' token
   13 |         for(k = j + 1;k++){
      |                          ^
      |                          ;
a.cc:22:19: error: 'temp' was not declared in this scope; did you mean 'tmp'?
   22 |         int ans = temp[a] - temp[0];
      |                   ^~~~
      |                   tmp
Language: C++

#include<bits/stdc++.h>

using namespace std;
int main(){
  int N,max=0,min=2000000000;
  cin >> N;
  int a[100];
  for(i=0;i!=N;i++) {
    cin >> a[i];
    if(a[i]>max) max=a[i];
    if(a[i]<min) min=a[i];
  }
  cout << max-min << endl;
}


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

#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
#include <stack>
#include <queue>
using namespace std;
using ll = long long;
map <int ,int> mpa,mpb;
typedef pair<ll, ll> P;
priority_queue<P, vector<P>, greater<P>> pque;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  ll N;
  cin >> N;
  ll a[N];
  for(int i=0;i<N;i++){
    cin >> a[i];
  }
  sort(a,a+N);
  ll ans=abs(a[0]-a[N];
  cout  << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:23: error: expected ')' before ';' token
   29 |   ll ans=abs(a[0]-a[N];
      |             ~         ^
      |                       )
Language: C++

#include <iostream>

using namespace std;

#define INT32_MAX   2147483647i32

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	long long max = -1;
	long long min = INT32_MAX;
	int n;
	cin >> n;
	int tmp;
	while (n--) {
		cin >> tmp;
		if (tmp < min) min = tmp;
		if (tmp > max) max = tmp;
	}
	
	cout << max - min << endl;
	// system("pause");
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:21: error: unable to find numeric literal operator 'operator""i32'
    5 | #define INT32_MAX   2147483647i32
      |                     ^~~~~~~~~~~~~
a.cc:11:25: note: in expansion of macro 'INT32_MAX'
   11 |         long long min = INT32_MAX;
      |                         ^~~~~~~~~
Language: C

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

int cmp_int(const void* v1, const void* v2)
{
  const int _v1 = *((const int*)v1);
  const int _v2 = *((const int*)v2);

  if ( _v1 > _v2 ) {
    return 1;
  } else if ( _v1 < _v2 ) {
    return -1;
  } else {
    return 0;
  }
}

int main(void)
{
  int N;
  int ans;
  int A[150];
  scanf("%d", &N);
  for(i = 0;i < N;i++){
      scanf("%d", &A[i]);
  }
  qsort(A, N, sizeof(int), cmp_int);
  ans = A[N-1] - A[0];
  printf("%d", ans);
}


Compiler output:
main.c: In function 'main':
main.c:24:7: error: 'i' undeclared (first use in this function)
   24 |   for(i = 0;i < N;i++){
      |       ^
main.c:24:7: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

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

int main()
{
  int n;
  cin>>n;
  int tab[110];
  for (int i=1;i<=n;i++)
    cin>>tab[i];
 int ans=0;
  for (int i=1;i<n;i++)
     for (int j=i+1;j<=n;j++)
     {
       ans=max(ans,abs(tab[i]-tab[j]);
      }
            cout<<ans<<"\n";
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:38: error: expected ')' before ';' token
   15 |        ans=max(ans,abs(tab[i]-tab[j]);
      |               ~                      ^
      |                                      )
Language: C++

#include <iostream>

using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	long long max = -1;
	long long min = INT_MAX;
	int n;
	cin >> n;
	int tmp;
	while (n--) {
		cin >> tmp;
		if (tmp < min) min = tmp;
		if (tmp > max) max = tmp;
	}
	
	cout << max - min << endl;
	// system("pause");
	return 0;
}

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

#include <iostream>
#include <vector>

using namespace std;

int main() {
  int N;
  cin >> N;
  vector<int> myvec;
  int test;
  while (N--) {
    cin >> test;
    myvec.push_back(test);
  }
  int min = *std::min_element(myvec.begin(), myvec.end());
  int max = *std::max_element(myvec.begin(), myvec.end());
  cout << max-min << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:19: error: 'min_element' is not a member of 'std'; did you mean 'tuple_element'?
   15 |   int min = *std::min_element(myvec.begin(), myvec.end());
      |                   ^~~~~~~~~~~
      |                   tuple_element
a.cc:16:19: error: 'max_element' is not a member of 'std'; did you mean 'tuple_element'?
   16 |   int max = *std::max_element(myvec.begin(), myvec.end());
      |                   ^~~~~~~~~~~
      |                   tuple_element
Language: C

#include <stdio.h>

int maxof(const int b[], int n){
  int i;
  int max = b[0];

  for(i = 1; i < n; i++){
    if(b[i] > max) max = b[i];
  }
  return max;
}

int minof(const int c[], int n){
  int i;
  int min = c[0];

  for(i = 1; i < n; i++){
    if(c[i] < min) min = c[i];
  }
  return min;
}

 int main(){
   int n,i,max,min,a;
   scanf("%d\n", &n);
   int a[102];
   for(i=0;i<n;i++){
     scanf("%d\n", a[n]);
   }

  max = maxof(a[n],n);
  min = minof(a[n],n);

  if(max-min<0){
    a=min-max;
  }else{
    a=max-min;
  }


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


 }

Compiler output:
main.c: In function 'main':
main.c:26:8: error: conflicting types for 'a'; have 'int[102]'
   26 |    int a[102];
      |        ^
main.c:24:20: note: previous declaration of 'a' with type 'int'
   24 |    int n,i,max,min,a;
      |                    ^
Language: C++

#include <cstdlib>
#include <algorithm>

int main()
{
    int n,k,minn,maxn;
    scanf("%d",&n);
    scanf("%d",&k);
    minn=maxn=k;
    for (int i=1;i<n;i++)
    {
        scanf("%d",&k);
        if (k<minn) minn=k;
        if (k>maxn) maxn=k;
    }
    printf("%d\n",maxn-minn);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:5: error: 'scanf' was not declared in this scope
    7 |     scanf("%d",&n);
      |     ^~~~~
a.cc:16:5: error: 'printf' was not declared in this scope
   16 |     printf("%d\n",maxn-minn);
      |     ^~~~~~
a.cc:3:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
    2 | #include <algorithm>
  +++ |+#include <cstdio>
    3 |
Language: C

#include <stdio.h>

int maxof(const int a[], int n){
  int i;
  int max = a[0];

  for(i = 1; i < n; i++){
    if(a[i] > max) max = a[i];
  }
  return max;
}

int minof(const int a[], int n){
  int i;
  int min = a[0];

  for(i = 1; i < n; i++){
    if(a[i] < min) min = a[i];
  }
  return min;
}

 int main(){
   int n,i,max,min,a;
   scanf("%d\n", &n);
   int a[102];
   for(i=0;i<n;i++){
     scanf("%d\n", a[n]);
   }

  max = maxof(a[n],n);
  min = minof(a[n],n);

  if(max-min<0){
    a=min-max;
  }else{
    a=max-min;
  }


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


 }

Compiler output:
main.c: In function 'main':
main.c:26:8: error: conflicting types for 'a'; have 'int[102]'
   26 |    int a[102];
      |        ^
main.c:24:20: note: previous declaration of 'a' with type 'int'
   24 |    int n,i,max,min,a;
      |                    ^
Language: C++


#include <bits/stdc++.h>
using namespace std;
int main()
{
    int vetor[110];
    int n;
    
    cin>>n;
    
    for(int i= 0; i<n; i++){
        cin>>vetor[i];
    }
    
    sort(vetor,vetor+n);
    cout<<vetor[i]-vetor[0]<<endl;
    return 0;
}


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

#include <cstdio>
#include <algorithm>
using std::sort;

int main(void)
{
  int *a,N;
  scanf("%d",&N);
  a=new int [N];
  for(int i=0;i<N;i++)
    scanf("%d",&a[i]);
 sort(a,a+N);
  printf("%d\n",a[N-1]-a[0]);
  delete a [];
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:13: error: expected primary-expression before ']' token
   14 |   delete a [];
      |             ^
Language: C++

#include <iostream>
#include <vector>

using namespace std;

int main() {
  int N;
  cin >> N;
  vector<int> myvec;
  int test;
  while (N--) {
    cin >> test;
    myvec.push_back(test);
  }
  int min = *min_element(myvec.begin(), myvec.end());
  int max = *max_element(myvec.begin(), myvec.end());
  cout << max-min << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:14: error: 'min_element' was not declared in this scope
   15 |   int min = *min_element(myvec.begin(), myvec.end());
      |              ^~~~~~~~~~~
a.cc:16:14: error: 'max_element' was not declared in this scope
   16 |   int max = *max_element(myvec.begin(), myvec.end());
      |              ^~~~~~~~~~~
Language: C++

#include <iostream>
#include <vector>
#include <string>
using namespace std;
 
int main(){
  int n;
  int t;
  int max=INT_MIN;
  int min=INT_MAX;
  cin >> n;
  for(int i = 0; i < n; i++){
  	cin >> t; 
    if (max < t) {
      max = t;
    }
    if (min > t) {
      min = t;
    }
  }
  cout << max - min << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:11: error: 'INT_MIN' was not declared in this scope
    9 |   int max=INT_MIN;
      |           ^~~~~~~
a.cc:3:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include <vector>
  +++ |+#include <climits>
    3 | #include <string>
a.cc:10:11: error: 'INT_MAX' was not declared in this scope
   10 |   int min=INT_MAX;
      |           ^~~~~~~
a.cc:10:11: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
Language: Java

import Java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner scnr = new Scanner(System.in);
		int n = scnr.nextInt();
		int max = Integer.MIN_VALUE;
		int min = Integer.MAX_VALUE;
		for(int i = 0; i < n; i++) {
			int num = scnr.nextInt();
			if (num > max) {
				max = num;
			}
			if (num < min) {
				min = num;
			}
		}
		System.out.println(max - min);
	}
}

Compiler output:
Main.java:1: error: package Java.util does not exist
import Java.util.*;
^
Main.java:5: error: cannot find symbol
		Scanner scnr = new Scanner(System.in);
		^
  symbol:   class Scanner
  location: class Main
Main.java:5: error: cannot find symbol
		Scanner scnr = new Scanner(System.in);
		                   ^
  symbol:   class Scanner
  location: class Main
3 errors
Language: C++

#include <stdio.h>

int main(int argc, char const *argv[]) {
	char str[101];
	int n, a[100];
	int i;

	fgets(str, 100, stdin);
	sscanf(str, "%d\n", &n);

	int max = 0;

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

		int tmp = a[i] - a[i-1];
		tmp = tmp < 0 ? -tmp : tmp;
		max = max < tmp ? tmp : max;
	}

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

	return 0;
}


Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:22:24: error: 'm' was not declared in this scope
   22 |         printf("%d\n", m);
      |                        ^
Language: Java

public class Main {
	public static void main(String[] args) {
		Scanner scnr = new Scanner(System.in);
		int n = scnr.nextInt();
		int max = Integer.MIN_VALUE;
		int min = Integer.MAX_VALUE;
		for(int i = 0; i < n; i++) {
			int num = scnr.nextInt();
			if (num > max) {
				max = num;
			}
			if (num < min) {
				min = num;
			}
		}
		System.out.println(max - min);
	}
}

Compiler output:
Main.java:3: error: cannot find symbol
		Scanner scnr = new Scanner(System.in);
		^
  symbol:   class Scanner
  location: class Main
Main.java:3: error: cannot find symbol
		Scanner scnr = new Scanner(System.in);
		                   ^
  symbol:   class Scanner
  location: class Main
2 errors
Language: C++

#include <iostream>
using namespace std;

int main() {
  int n;
  cin >> n;
  
  vector<int> a(n);
  for(int i = 0; i < n; i++) {
    cin >> a.at(i);
  }
  
  sort(vec.begin(), vec.end());
  
  cout << a.at(n - 1) - a.at(0) << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:3: error: 'vector' was not declared in this scope
    8 |   vector<int> a(n);
      |   ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include <iostream>
  +++ |+#include <vector>
    2 | using namespace std;
a.cc:8:10: error: expected primary-expression before 'int'
    8 |   vector<int> a(n);
      |          ^~~
a.cc:10:12: error: 'a' was not declared in this scope
   10 |     cin >> a.at(i);
      |            ^
a.cc:13:8: error: 'vec' was not declared in this scope
   13 |   sort(vec.begin(), vec.end());
      |        ^~~
a.cc:13:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   13 |   sort(vec.begin(), vec.end());
      |   ^~~~
      |   short
a.cc:15:11: error: 'a' was not declared in this scope
   15 |   cout << a.at(n - 1) - a.at(0) << endl;
      |           ^
Language: C++

#include<iostream>
using namespace std;
int main(){
  long N,A[100],s[10000],t=0,u;
  cin>>N;
  for(int i=0;i<N;i++)cin>>A[i];
  for(int j=0;j<N;j++){
    for(int k=0;k<N;k++){
    s[h]=A[j]-A[k];
    t++;
    }
  }
  for(int l;l<t;l++){
    if(s[l]>u)u=s[l];
  }
  cout<<u<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:7: error: 'h' was not declared in this scope
    9 |     s[h]=A[j]-A[k];
      |       ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int arr[101]
int main()
{
	int n,max=0,min=0x7fffffff;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
	    scanf("%d",&arr[i]);
	    if(max<arr[i])
		    max=arr[i];
		if(min>arr[i])
		    min=arr[i];
	}
	printf("%d",max+min)
	return 0;    
}

Compiler output:
a.cc:4:1: error: expected initializer before 'int'
    4 | int main()
      | ^~~
Language: C

#incldue <stdio.h>

int main()
{
   int N;
   
   scanf("%d",&N);

   int a[N];

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

   for(int i = 0;i<N;i++)
   {
       for(int j = N;j>0;j--)
       {
           if(a[j-1]>a[j])
           {
               int x = a[j];
               a[j] = a[j-1];
               a[j-1] = x;
           }
       }
   }

   printf("%d",a[N]-a[0]);

   return 0;
}

Compiler output:
main.c:1:2: error: invalid preprocessing directive #incldue; did you mean #include?
    1 | #incldue <stdio.h>
      |  ^~~~~~~
      |  include
main.c: In function 'main':
main.c:7:4: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    7 |    scanf("%d",&N);
      |    ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | #incldue <stdio.h>
main.c:7:4: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    7 |    scanf("%d",&N);
      |    ^~~~~
main.c:7:4: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:29:4: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   29 |    printf("%d",a[N]-a[0]);
      |    ^~~~~~
main.c:29:4: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:29:4: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:29:4: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n,minn=0x7fffffff,i,maxx=0,m;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d",&m);
		maxx=max(maxx,m);
		minn=min(minn,m);
	}
	printf("%d",maxx-minn)
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:31: error: expected ';' before 'return'
   13 |         printf("%d",maxx-minn)
      |                               ^
      |                               ;
   14 |         return 0;
      |         ~~~~~~
Language: C

#include<stdio.h>
int main(){
int i,j;
int max=-1;
int arr[101];
int N;
scanf("%d",&N);
for(i=0;i<N;i++){
scanf("%d",&arr[i]);
}
for(i=0;i<N;i++){
for(j=i+1;j<N;j++){
dif=arr[i]-arr[j];
if(dif<0) dif*=-1;

if(dif>max) max=dif;

}
}
printf("%d",max);
return 0;
}

Compiler output:
main.c: In function 'main':
main.c:13:1: error: 'dif' undeclared (first use in this function)
   13 | dif=arr[i]-arr[j];
      | ^~~
main.c:13:1: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include<bits/stdc++.h>
using namespace std;
int arr[101]
int main()
{
	int n,amax=0,min=0x7fffffff;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
	    scanf("%d",&arr[i]);
	    if(max<arr[i])
		    max=arr[i];
		if(min>arr[i])
		    min=arr[i];
	}
	printf("%d",max+min)
	return 0;    
}

Compiler output:
a.cc:4:1: error: expected initializer before 'int'
    4 | int main()
      | ^~~
Language: C++

#include <cstdio>
using namespace std;
int n;
int a[102]
int main() {
	int a;
	int ans;
	int max, min;
	scanf("%d", &n);
	scanf("%d", &a);
	max = min = a;
	for (int i = 0; i < n-1; i++) {
		int m;
		scanf("%d", &m);
		if (m < min)min = m;
		if (m > max)max = m;
	}

	ans = max - min;
	printf("%d\n", ans);
}

Compiler output:
a.cc:5:1: error: expected initializer before 'int'
    5 | int main() {
      | ^~~
Language: C++

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

int main(){
    int n;
    cin >> n;
    vector<int> v(n);
    for(int i = 0; i < n; i++){
        cin >> v[i];
    }
    int ans = 0; hozon;
    for(int i = 0; i < n; i++){
        hozon = 0;
        for(int j = 0; j < n; j++){
            if(i != j){
                hozon = v[i] + v[j];
            }
        }
        ans = max(ans, hozon);
    }
    cout << ans << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:18: error: 'hozon' was not declared in this scope
   11 |     int ans = 0; hozon;
      |                  ^~~~~
Language: C++

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

int main() {
  int n;
  cin >> n;
  int aa[n];
  int max = 0;
 
  for (int k = 0; k < n; k++) {
    for (int l = k; l < n; k++) {
      diff = (aa[k] > aa[l] ? aa[k] - aa[l] : aa[l] - aa[k]);
      if (max < diff) max = diff;
    }
  }

  cout << max << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:7: error: 'diff' was not declared in this scope
   12 |       diff = (aa[k] > aa[l] ? aa[k] - aa[l] : aa[l] - aa[k]);
      |       ^~~~
Language: C++

#include <bits/stdc++.h>
#include <cstring>
#define ll long long
using namespace std;
const int maxn = 1e5 + 5;
int a[maxn];
int main()
{


    int n;
    int ans = 0;
    cin>>n;
    for(int i = 0;i<n;i++)
    {
        cin>>a[i];
    }#include <bits/stdc++.h>
#include <cstring>
#define ll long long
using namespace std;
const int maxn = 1e5 + 5;
int a[maxn];
int main()
{


    int n;
    int ans = 0;
    cin>>n;
    for(int i = 0;i<n;i++)
    {
        cin>>a[i];
    }
    for(int i = 0;i<n;i++)
    {
        for(int j = 0;j<n;j++)
        {
            if(i == j) continue;
            ans  = max(ans,abs(a[i] - a[j]));
        }
    }
    cout<<ans<<endl;
    return 0;
}

    for(int i = 0;i<n;i++)
    {
        for(int j = 0;j<n;j++)
        {
            if(i == j) continue;
            ans  = max(ans,abs(a[i] - a[j]));
        }
    }
    cout<<ans<<endl;
    return 0;
}


Compiler output:
a.cc:17:6: error: stray '#' in program
   17 |     }#include <bits/stdc++.h>
      |      ^
a.cc: In function 'int main()':
a.cc:17:7: error: 'include' was not declared in this scope
   17 |     }#include <bits/stdc++.h>
      |       ^~~~~~~
a.cc:17:16: error: 'bits' was not declared in this scope
   17 |     }#include <bits/stdc++.h>
      |                ^~~~
a.cc:17:21: error: 'stdc' was not declared in this scope; did you mean 'std'?
   17 |     }#include <bits/stdc++.h>
      |                     ^~~~
      |                     std
a.cc:20:1: error: expected primary-expression before 'using'
   20 | using namespace std;
      | ^~~~~
a.cc:23:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   23 | int main()
      |         ^~
a.cc:23:9: note: remove parentheses to default-initialize a variable
   23 | int main()
      |         ^~
      |         --
a.cc:23:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:24:1: error: a function-definition is not allowed here before '{' token
   24 | {
      | ^
Language: C++

#include <iostream>
#include <vector>

using namespace std;

int N ;
vector<int> A;
int main() {
    cin >> N ;
    for (int i = 0; i < N; ++i) {
        int b;
        cin >> b;
        A.push_back(b);
    }
    sort(A.begin(), A.end());
    cout << A.at(N-1) - A.at(0) << endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   15 |     sort(A.begin(), A.end());
      |     ^~~~
      |     short
Language: C++

#include <cstdio>
#include <algorithm>
using std::sort;

int main(void)
{
  int *a,N;
  scanf("%d",&*N);
  a=new int [N];
  for(int i=0;i<N;i++)
    scanf("%d",&a[i]);
 sort(a,a+N);
  printf("%d\n",a[N-1]-a[0]);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:15: error: invalid type argument of unary '*' (have 'int')
    8 |   scanf("%d",&*N);
      |               ^~
Language: C

#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <functional>
#include <ccomplex>


using namespace std;
#define MAX 100000

int main(){
    int N;
    vector<int> A;
    scanf("%d", &N);
    
    for (int i = 0; i < N; i++){
        int temp;
        scanf("%d", &temp);
        A.push_back(temp);
    }
    int dif = 0;
    for (int j = 0; j < N; j++){
        for (int jj = j + 1; jj < N; jj++){
            int tempdif = abs(A[jj] - A[j]);

            if (tempdif > dif){
                dif = tempdif;
            }
        }
    }

    printf("%d", dif);
    return 0;

}

Compiler output:
main.c:2:10: fatal error: cstdio: No such file or directory
    2 | #include <cstdio>
      |          ^~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
using namespace std;

int main() {
  int n;
  cin >> n;
  
  vector<int> a(n);
  for(int i = 0; i < n; c++) {
    cin >> a.at(i);
  }
  
  sort(vec.begin(), vec.end());
  
  cout << a.at(n - 1) - a.at(0) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:3: error: 'vector' was not declared in this scope
    8 |   vector<int> a(n);
      |   ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include <iostream>
  +++ |+#include <vector>
    2 | using namespace std;
a.cc:8:10: error: expected primary-expression before 'int'
    8 |   vector<int> a(n);
      |          ^~~
a.cc:9:25: error: 'c' was not declared in this scope
    9 |   for(int i = 0; i < n; c++) {
      |                         ^
a.cc:10:12: error: 'a' was not declared in this scope
   10 |     cin >> a.at(i);
      |            ^
a.cc:13:8: error: 'vec' was not declared in this scope
   13 |   sort(vec.begin(), vec.end());
      |        ^~~
a.cc:13:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   13 |   sort(vec.begin(), vec.end());
      |   ^~~~
      |   short
a.cc:15:11: error: 'a' was not declared in this scope
   15 |   cout << a.at(n - 1) - a.at(0) << endl;
      |           ^
Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);

  int N;
  int A[110];
  cin >> N;
  REP(i,N) cin >> A[i];
  int ans=0;
  REP(i,N-1) for(int j=i+1;j<N;j++) ans=max(ans,abs(a[i]-a[j]));
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:53: error: 'a' was not declared in this scope
   29 |   REP(i,N-1) for(int j=i+1;j<N;j++) ans=max(ans,abs(a[i]-a[j]));
      |                                                     ^
Language: C++

#include<iostream>
#include<vector>
using namespace std;
int main()
{
  int n;
  cin>>n;
  vector<int> a(n);
  for(int i=0;i<n;i++) cin>>a.at(i);

  sort(a.begin(),a.end());
  cout<<abs(a.at(n-1)-a.at(0))<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   11 |   sort(a.begin(),a.end());
      |   ^~~~
      |   short