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

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

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


Compiler output:
a.cc: In function 'int main()':
a.cc:8:22: error: expected ')' before ';' token
    8 |   for(int i=0;i<N;i=i;1){
      |      ~               ^
      |                      )
a.cc:8:24: error: expected ';' before ')' token
    8 |   for(int i=0;i<N;i=i;1){
      |                        ^
      |                        ;
Language: C++

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

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

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

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

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) cin >> A.at(i);
  
  int m = 1000000000;
  int M = 0;
  
  for (int i = 0; i < N; i++) {
    int x = A.at(i);
    if (m > x) m = x;
    if (M < x) M = x;
  }
  cout << M - m << endl
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:24: error: expected ';' before '}' token
   18 |   cout << M - m << endl
      |                        ^
      |                        ;
   19 | }
      | ~
Language: C++

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

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) cin >> A.at(i);
  
  int m = 1000000000;
  int M = 0;
  
  for (int i = 0; i < N; i++) {
    int x = A.at(i);
    if (m > x) m = x;
    if (M < x) M = x;
  }
  cout << max - min << endl
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:15: error: invalid operands of types '<unresolved overloaded function type>' and '<unresolved overloaded function type>' to binary 'operator-'
   18 |   cout << max - min << endl
      |           ~~~~^~~~~
Language: C++

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

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) cin >> A.at(i);
  
  int m = 1000000000;
  int M = 0;
  
  for (int i = 0; i < N; i++) {
    int x = A.at(i);
    if (min > x) min = x;
    if (max < x) max = x;
  }
  cout << max - min << endl
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:13: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator>'
   15 |     if (min > x) min = x;
      |         ~~~~^~~
a.cc:15:24: error: overloaded function with no contextual type information
   15 |     if (min > x) min = x;
      |                        ^
a.cc:16:9: error: parse error in template argument list
   16 |     if (max < x) max = x;
      |         ^~~~~~~
a.cc:16:16: error: cannot resolve overloaded function 'max' based on conversion to type 'bool'
   16 |     if (max < x) max = x;
      |                ^
a.cc:16:24: error: overloaded function with no contextual type information
   16 |     if (max < x) max = x;
      |                        ^
a.cc:18:15: error: invalid operands of types '<unresolved overloaded function type>' and '<unresolved overloaded function type>' to binary 'operator-'
   18 |   cout << max - min << endl
      |           ~~~~^~~~~
Language: C++

#include <iostream>
using namespace std;

int N;
int A[1000000000000];

int main() {
    cin >> N;
    for (int i = 0; i < N; ++i) {
      cin >> A[i];
    if (A[i] < A[i+1]) {
     cout << A[i+1] << endl;
    }
    else {
      break;
    }
  }
  cout << A[i+1] << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:13: error: 'i' was not declared in this scope
   18 |   cout << A[i+1] << endl;
      |             ^
Language: C++

#include <iostream>
using namespace std;

int N;
int A[1000000000000];

int main() {
    cin >> N;
    for (int i = 0; i < N; ++i) 
      cin >> A[i];
    if (A[i] < A[i+1]) {
     cout << A[i+1] << endl;
    }
    else {
      break;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:11: error: 'i' was not declared in this scope
   11 |     if (A[i] < A[i+1]) {
      |           ^
a.cc:15:7: error: break statement not within loop or switch
   15 |       break;
      |       ^~~~~
Language: Java

import java.util.*;

public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    List<Integer> list = new ArrayList<>(n);
    for(int i = 0;i < n; i++){
      list.add(sc.nextInt());
      }
    Collections.sort(list);
    System.out.println(Math.abs(list.get(list.size() -1) - list.get(0));
                       }}

Compiler output:
Main.java:12: error: ')' or ',' expected
    System.out.println(Math.abs(list.get(list.size() -1) - list.get(0));
                                                                       ^
1 error
Language: Java

import java.util.scanner;
public class Main{
  public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int max = 0;
    int min = 0;
    for(int i=0; i<N; i++){
      int x = sc.nextInt();
      if(i == 0){ max = x; min = x;}
      else{
        if(x > max) { max = x}
        if(x < min) { min = x}
      }
    }
    System.out.println( max - min);  
  }
}




Compiler output:
Main.java:12: error: ';' expected
        if(x > max) { max = x}
                             ^
Main.java:13: error: ';' expected
        if(x < min) { min = x}
                             ^
2 errors
Language: C++


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

int main()
{
  int N;
  cin >> N;
  vector<int> A(N);
  for (auto & a : A)
    cin >> a;
  auto minmax = *minmax_element(A.begin(), A.end());
  cout << minmax.second - minmax.first;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:17: error: no match for 'operator*' (operand type is 'std::pair<__gnu_cxx::__normal_iterator<int*, std::vector<int> >, __gnu_cxx::__normal_iterator<int*, std::vector<int> > >')
   14 |   auto minmax = *minmax_element(A.begin(), A.end());
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

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

int main(){
  int N;
  cin >> N;
  
  int num;
  int max = 0;
  int min = pow(10,9);
  
  for(int i = 0; i < N; i++){
    cin >> num;
    max = max < num? num:max;
    min = min > num? num:min;
    }
  }
  cout << max - min << endl;
}

Compiler output:
a.cc:18:3: error: 'cout' does not name a type
   18 |   cout << max - min << endl;
      |   ^~~~
a.cc:19:1: error: expected declaration before '}' token
   19 | }
      | ^
Language: C++

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

int main() {
  int n, m = 0;
  cin >> n;
  vector<int> v(n);
  rep(i, n) cin >> v[i];
  sort(v.begin(), v,end());
  rep(i, n-1) m = max(m, v[i+1] - v[i]);
  cout << m << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:24: error: no matching function for call to 'end()'
   11 |   sort(v.begin(), v,end());
      |                     ~~~^~
In file included from /usr/include/c++/14/bits/algorithmfwd.h:39,
                 from /usr/include/c++/14/bits/stl_algo.h:59,
                 from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/initializer_list:99:5: note: candidate: 'template<class _Tp> constexpr const _Tp* std::end(initializer_list<_Tp>)'
   99 |     end(initializer_list<_Tp> __ils) noexcept
      |     ^~~
/usr/include/c++/14/initializer_list:99:5: note:   candidate expects 1 argument, 0 provided
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/bits/range_access.h:74:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)'
   74 |     end(_Container& __cont) -> decltype(__cont.end())
      |     ^~~
/usr/include/c++/14/bits/range_access.h:74:5: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/range_access.h:85:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&)'
   85 |     end(const _Container& __cont) -> decltype(__cont.end())
      |     ^~~
/usr/include/c++/14/bits/range_access.h:85:5: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/range_access.h:106:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])'
  106 |     end(_Tp (&__arr)[_Nm]) noexcept
      |     ^~~
/usr/include/c++/14/bits/range_access.h:106:5: note:   candidate expects 1 argument, 0 provided
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166:
/usr/include/c++/14/valarray:1249:5: note: candidate: 'template<class _Tp> _Tp* std::end(valarray<_Tp>&)'
 1249 |     end(valarray<_Tp>& __va) noexcept
      |     ^~~
/usr/include/c++/14/valarray:1249:5: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/valarray:1265:5: note: candidate: 'template<class _Tp> const _Tp* std::end(const valarray<_Tp>&)'
 1265 |     end(const valarray<_Tp>& __va) noexcept
      |     ^~~
/usr/include/c++/14/valarray:1265:5: note:   candidate expects 1 argument, 0 provided
Language: C++

#include <iostream>
using namespace std;
int a[105];
int main(int argc, const char * argv[])
{
    int n,ans=0;
    cin>>n;
    for(int i=0;i<n;i++) cin>>a[i];
    sort(a,a+n);
    ans=a[n-1]-a[0];
    cout<<ans<<endl;
    return 0;
}

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

import java.util.*

public class Main {
	public static void main(String args[]) {
 		Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int number[] = new int[n]
        for(int i=0;i<n;i++) {
        number[i] = sc.nextInt();
        }
        Arrays.sort(number);
        System.out.println(number[n-1] - number[0]);
    }
}

Compiler output:
Main.java:1: error: ';' expected
import java.util.*
                  ^
Main.java:7: error: ';' expected
        int number[] = new int[n]
                                 ^
2 errors
Language: C++

#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int n,a,min=INT_MAX,max=INT_MIN;
    cin>>n;
    for(int i=0; i<n; i++){
        cin>>a;
        if(a>max){
            max=a;
        }
        if(a<min){
            min=a;
        }
    }
    cout<< max-min <<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:5:17: error: 'INT_MAX' was not declared in this scope
    5 |     int n,a,min=INT_MAX,max=INT_MIN;
      |                 ^~~~~~~
a.cc:2:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    1 | #include <iostream>
  +++ |+#include <climits>
    2 | using namespace std;
a.cc:9:13: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator>'
    9 |         if(a>max){
      |            ~^~~~
a.cc:10:17: error: overloaded function with no contextual type information
   10 |             max=a;
      |                 ^
a.cc:16:15: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator-'
   16 |     cout<< max-min <<endl;
      |            ~~~^~~~
Language: C

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(void){
    int n,min,max;
    a[105];
    scanf("%d",&n);
    for(int count=1;count<=n;count++){
        scanf("%d",&a[count]);
    }
    min=100000005;
    max=0;

    for(int count2=1;count2<=n;count2++){
        if(a[count2]<=min){min=a[count2];}
        if(a[count2]>=max){max=a[count2];}   
    }
    printf("%d\n",abs(max-min));
}


Compiler output:
main.c: In function 'main':
main.c:6:5: error: 'a' undeclared (first use in this function)
    6 |     a[105];
      |     ^
main.c:6:5: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

v#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    int n;cin>>n;
    vector<ll> a(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    ll d=0;
    for(int i=0;i<n-1;i++){
        for(int j=i+1;j<n;j++){
            d=max(d,abs(a[i]-a[j]));
        }
    }
    cout<<d<<endl;
}

Compiler output:
a.cc:1:2: error: stray '#' in program
    1 | v#include<bits/stdc++.h>
      |  ^
a.cc:1:1: error: 'v' does not name a type
    1 | v#include<bits/stdc++.h>
      | ^
a.cc: In function 'int main()':
a.cc:5:11: error: 'cin' was not declared in this scope
    5 |     int n;cin>>n;
      |           ^~~
a.cc:6:5: error: 'vector' was not declared in this scope
    6 |     vector<ll> a(n);
      |     ^~~~~~
a.cc:6:14: error: expected primary-expression before '>' token
    6 |     vector<ll> a(n);
      |              ^
a.cc:6:16: error: 'a' was not declared in this scope
    6 |     vector<ll> a(n);
      |                ^
a.cc:13:21: error: 'abs' was not declared in this scope
   13 |             d=max(d,abs(a[i]-a[j]));
      |                     ^~~
a.cc:13:15: error: 'max' was not declared in this scope
   13 |             d=max(d,abs(a[i]-a[j]));
      |               ^~~
a.cc:16:5: error: 'cout' was not declared in this scope
   16 |     cout<<d<<endl;
      |     ^~~~
a.cc:16:14: error: 'endl' was not declared in this scope
   16 |     cout<<d<<endl;
      |              ^~~~
Language: C++

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

int main() {

	int N,ma=0,mi=inf;
	cin>>N;
  vector<int>A(N);
  for(int i=0;i<N;i++){
    cin>>A(N);
  if(ma<A.at(i))ma=A.at(i);
  if(mi>A.at(i))mi=A.at(i);}
  cout<<ma-mi<<endl;
	
//	cout<< <<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:23: error: 'inf' was not declared in this scope; did you mean 'ynf'?
    6 |         int N,ma=0,mi=inf;
      |                       ^~~
      |                       ynf
a.cc:10:11: error: no match for call to '(std::vector<int>) (int&)'
   10 |     cin>>A(N);
      |          ~^~~
Language: C++

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

int main() {

	int N;
	cin>>N;
  vector<int>A(N);
  for(int i=0;i<N;i++){
    cin>>A(N);}
  cout<<max(A(N))-min(A(N))<<endl;
	
//	cout<< <<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:11: error: no match for call to '(std::vector<int>) (int&)'
   10 |     cin>>A(N);}
      |          ~^~~
a.cc:11:14: error: no match for call to '(std::vector<int>) (int&)'
   11 |   cout<<max(A(N))-min(A(N))<<endl;
      |             ~^~~
a.cc:11:24: error: no match for call to '(std::vector<int>) (int&)'
   11 |   cout<<max(A(N))-min(A(N))<<endl;
      |                       ~^~~
Language: C++

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

int main(){
	int N; 
	cin >> N;
	vector<int> a(N);
	for(int i=0; i<N; i++) cin >> a[i] ;
	int min = min_element(a[0], a[N]);
	int max = max_element(a[0], a[N]);	
	cout << (max - min )^2 << endl;


} 



Compiler output:
a.cc: In function 'int main()':
a.cc:15:32: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
   15 |         cout << (max - min )^2 << endl;
      |                              ~~^~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:71,
                 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/predefined_ops.h: In instantiation of 'constexpr bool __gnu_cxx::__ops::_Iter_less_iter::operator()(_Iterator1, _Iterator2) const [with _Iterator1 = int; _Iterator2 = int]':
/usr/include/c++/14/bits/stl_algo.h:5562:12:   required from 'constexpr _ForwardIterator std::__min_element(_ForwardIterator, _ForwardIterator, _Compare) [with _ForwardIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
 5562 |         if (__comp(__first, __result))
      |             ~~~~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:5586:43:   required from 'constexpr _FIter std::min_element(_FIter, _FIter) [with _FIter = int]'
 5586 |       return _GLIBCXX_STD_A::__min_element(__first, __last,
      |                                           ^
a.cc:13:23:   required from here
   13 |         int min = min_element(a[0], a[N]);
      |                   ~~~~~~~~~~~^~~~~~~~~~~~
/usr/include/c++/14/bits/predefined_ops.h:45:16: error: invalid type argument of unary '*' (have 'int')
   45 |       { return *__it1 < *__it2; }
      |                ^~~~~~
/usr/include/c++/14/bits/predefined_ops.h:45:25: error: invalid type argument of unary '*' (have 'int')
   45 |       { return *__it1 < *__it2; }
      |                         ^~~~~~
Language: C++

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

int main(){
	int N; 
	cin >> N;
	vector<int> a(N);
	for(int i=0; i<N; i++) cin >> a[i] ;
	int min = min_element(a.begin(), a.end());
	int max = max_element(a.begin(), a.end());	
	cout << (max - min )^2 << endl;


} 



Compiler output:
a.cc: In function 'int main()':
a.cc:13:30: error: cannot convert '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' to 'int' in initialization
   13 |         int min = min_element(a.begin(), a.end());
      |                   ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
      |                              |
      |                              __gnu_cxx::__normal_iterator<int*, std::vector<int> >
a.cc:14:30: error: cannot convert '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' to 'int' in initialization
   14 |         int max = max_element(a.begin(), a.end());
      |                   ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
      |                              |
      |                              __gnu_cxx::__normal_iterator<int*, std::vector<int> >
a.cc:15:32: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
   15 |         cout << (max - min )^2 << endl;
      |                              ~~^~~~~~~
Language: C++

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

int main(){
	int N;
	int a[N+10]; 
	cin >> N;
	for(int i=0; i<N; i++) cin >> a[i] ;
	int min = min_element(a.begin(), a.end());
	int max = max_element(a.begin(), a.end());	
	cout << (max - min )^2 << endl;


} 



Compiler output:
a.cc: In function 'int main()':
a.cc:12:33: error: request for member 'begin' in 'a', which is of non-class type 'int [(N + 10)]'
   12 |         int min = min_element(a.begin(), a.end());
      |                                 ^~~~~
a.cc:12:44: error: request for member 'end' in 'a', which is of non-class type 'int [(N + 10)]'
   12 |         int min = min_element(a.begin(), a.end());
      |                                            ^~~
a.cc:13:33: error: request for member 'begin' in 'a', which is of non-class type 'int [(N + 10)]'
   13 |         int max = max_element(a.begin(), a.end());
      |                                 ^~~~~
a.cc:13:44: error: request for member 'end' in 'a', which is of non-class type 'int [(N + 10)]'
   13 |         int max = max_element(a.begin(), a.end());
      |                                            ^~~
a.cc:14:32: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
   14 |         cout << (max - min )^2 << endl;
      |                              ~~^~~~~~~
Language: C++

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

int main(){
	int N,
	int a[N+10] 
	cin << N;
	for(int i=0; i<N, i++) cin >> a[i] ;
	int min = min_element(a.begin(), a.end());
	int max = max_element(a.begin(), a.end());	
	cout << (max - min )^2 << endl;


} 



Compiler output:
a.cc: In function 'int main()':
a.cc:9:9: error: expected unqualified-id before 'int'
    9 |         int a[N+10]
      |         ^~~
a.cc:11:30: error: expected ';' before ')' token
   11 |         for(int i=0; i<N, i++) cin >> a[i] ;
      |                              ^
      |                              ;
a.cc:11:39: error: 'a' was not declared in this scope
   11 |         for(int i=0; i<N, i++) cin >> a[i] ;
      |                                       ^
a.cc:12:31: error: 'a' was not declared in this scope
   12 |         int min = min_element(a.begin(), a.end());
      |                               ^
a.cc:14:32: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
   14 |         cout << (max - min )^2 << endl;
      |                              ~~^~~~~~~
Language: C++

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

int main(){
    int n,ma=0,mi=10000000001; cin>>n;
    vector<int>d(n);
    for(int i=0;i<n;i++){
        cin>>x;
        ma=max(x,ma);
        mi=min(x,mi);
        }
    sort(d.begin(),d.end());
    cout<<ma-mi<<endl;
    }


Compiler output:
a.cc: In function 'int main()':
a.cc:5:19: warning: overflow in conversion from 'long int' to 'int' changes value from '10000000001' to '1410065409' [-Woverflow]
    5 |     int n,ma=0,mi=10000000001; cin>>n;
      |                   ^~~~~~~~~~~
a.cc:8:14: error: 'x' was not declared in this scope
    8 |         cin>>x;
      |              ^
Language: C++

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

int main(){
  
  int n;
  cin >> n;
  a[110];
  for(int i=0; i<n; i++) cin >> a[i];
  int m=0;
  for(int i=0; i<n; i++) {
  	m=max(abs(a[i]-a[i+1]),m);
  }
  
  cout << m << endl;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:3: error: 'a' was not declared in this scope
    8 |   a[110];
      |   ^
Language: C++

#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define inf LLONG_MAX/10000000
#define INF LLONG_MAX/3
#define P pair<int,int>
using namespace std;
signed main(){
  int n;
  cin>>n;
  vector<int> a(n);
  rep(i,n){
    cin>>a[i];
  }
  Sort(a.begin(),a.end());
  int b=a[n-1];
  int c=a[0];
  cout<<b-c<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:3: error: 'Sort' was not declared in this scope
   15 |   Sort(a.begin(),a.end());
      |   ^~~~
Language: C++

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


int main() {
	int n;
	cin >> n;
	vector<int> A(n);
	rep(i, n) {
		cin >> A[i];
	}
	sort(A.begin(), A.end());
	ans = abs(A[0] - A[A.size() - 1]);

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


Compiler output:
a.cc: In function 'int main()':
a.cc:14:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   14 |         ans = abs(A[0] - A[A.size() - 1]);
      |         ^~~
      |         abs
Language: Java

mport java.util.*;

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

        int number = sc.nextInt();

        int member[] = new int[number];
        for (int i = 0; i < number; i++){
            member[i] = sc.nextInt();
            if (i == 0){
                min = member[i];
                max = member[i];
            }

            if (i != 0 && min > member[i]){
                min = member[i];
            }

            if (i != 0 && max < member[i]){
                max = member[i];
            }
        }

        System.out.println(Math.abs(max - min));
    }
}

Compiler output:
Main.java:1: error: class, interface, enum, or record expected
mport java.util.*;
^
1 error
Language: C++

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

int main()
{
  int n;
  cin >> n;
  array<int, n> ary;
  int min = 0, max = 0;
  for (int i=0; i<n i++) {
    cin >> ary[i];
    if (min > ary[i]) min = ary[i];
    if (max < ary[i]) max = ary[i];
  }
  cout << max - min << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:15: error: the value of 'n' is not usable in a constant expression
    9 |   array<int, n> ary;
      |               ^
a.cc:7:7: note: 'int n' is not const
    7 |   int n;
      |       ^
a.cc:9:15: note: in template argument for type 'long unsigned int'
    9 |   array<int, n> ary;
      |               ^
a.cc:11:20: error: expected ';' before 'i'
   11 |   for (int i=0; i<n i++) {
      |                    ^~
      |                    ;
a.cc:12:15: error: invalid types 'int[int]' for array subscript
   12 |     cin >> ary[i];
      |               ^
a.cc:13:18: error: invalid types 'int[int]' for array subscript
   13 |     if (min > ary[i]) min = ary[i];
      |                  ^
a.cc:13:32: error: invalid types 'int[int]' for array subscript
   13 |     if (min > ary[i]) min = ary[i];
      |                                ^
a.cc:14:18: error: invalid types 'int[int]' for array subscript
   14 |     if (max < ary[i]) max = ary[i];
      |                  ^
a.cc:14:32: error: invalid types 'int[int]' for array subscript
   14 |     if (max < ary[i]) max = ary[i];
      |                                ^
Language: Java

import java.util.*;
public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   int N = sc.nextInt();
   int[] Ai = new int[N];
   for(int i = 0;i<N;i++) Ai[i] = sc.nextInt(); 

   Arrays.sort(Ai);
   
   System.out.println(Ai[i]-Ai[0]);
 }
}

Compiler output:
Main.java:11: error: cannot find symbol
   System.out.println(Ai[i]-Ai[0]);
                         ^
  symbol:   variable i
  location: class Main
1 error
Language: C++

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

int main() {
    int N;
    vector<int> a(N);
    cin >> N;
    for(auto i : a)cin >> i;
    sort(a.begin,a.end,greater<int>());
    cout << a[0]-a[N-1] <<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:9: error: no matching function for call to 'sort(<unresolved overloaded function type>, <unresolved overloaded function type>, std::greater<int>)'
   11 |     sort(a.begin,a.end,greater<int>());
      |     ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_algo.h:4762:5: note: candidate: 'template<class _RAIter> void std::sort(_RAIter, _RAIter)'
 4762 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last)
      |     ^~~~
/usr/include/c++/14/bits/stl_algo.h:4762:5: note:   candidate expects 2 arguments, 3 provided
/usr/include/c++/14/bits/stl_algo.h:4793:5: note: candidate: 'template<class _RAIter, class _Compare> void std::sort(_RAIter, _RAIter, _Compare)'
 4793 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last,
      |     ^~~~
/usr/include/c++/14/bits/stl_algo.h:4793:5: note:   template argument deduction/substitution failed:
a.cc:11:9: note:   couldn't deduce template parameter '_RAIter'
   11 |     sort(a.begin,a.end,greater<int>());
      |     ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator, class _Compare> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare)'
  292 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp);
      | ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note:   candidate expects 4 arguments, 3 provided
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator)'
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note:   template argument deduction/substitution failed:
a.cc:11:9: note:   couldn't deduce template parameter '_ExecutionPolicy'
   11 |     sort(a.begin,a.end,greater<int>());
      |     ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

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

int main() {
    int N;
    vector<int> a(N);
    cin >> N;
    for(auto i : a)cin >> i;
    sort(a.begin,a.end,greater());
    cout << a[0]-a[N-1] <<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:9: error: no matching function for call to 'sort(<unresolved overloaded function type>, <unresolved overloaded function type>, std::greater<void>)'
   11 |     sort(a.begin,a.end,greater());
      |     ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_algo.h:4762:5: note: candidate: 'template<class _RAIter> void std::sort(_RAIter, _RAIter)'
 4762 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last)
      |     ^~~~
/usr/include/c++/14/bits/stl_algo.h:4762:5: note:   candidate expects 2 arguments, 3 provided
/usr/include/c++/14/bits/stl_algo.h:4793:5: note: candidate: 'template<class _RAIter, class _Compare> void std::sort(_RAIter, _RAIter, _Compare)'
 4793 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last,
      |     ^~~~
/usr/include/c++/14/bits/stl_algo.h:4793:5: note:   template argument deduction/substitution failed:
a.cc:11:9: note:   couldn't deduce template parameter '_RAIter'
   11 |     sort(a.begin,a.end,greater());
      |     ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator, class _Compare> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare)'
  292 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp);
      | ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note:   candidate expects 4 arguments, 3 provided
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator)'
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note:   template argument deduction/substitution failed:
a.cc:11:9: note:   couldn't deduce template parameter '_ExecutionPolicy'
   11 |     sort(a.begin,a.end,greater());
      |     ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include<iostream>
using namespace std;
int main(){
int n;
cin>>n;
int a[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:7:2: error: expected initializer before 'for'
    7 |  for(int i=0;i<n;i++){
      |  ^~~
a.cc:7:14: error: 'i' was not declared in this scope
    7 |  for(int i=0;i<n;i++){
      |              ^
a.cc:10:8: error: 'a' was not declared in this scope
   10 |   sort(a,a+n);
      |        ^
a.cc:10:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   10 |   sort(a,a+n);
      |   ^~~~
      |   short
Language: C++

#include<iostream>
#include<cmath>
using namespace std;
int main()
{
    int n;
    cin>>n;
    long long x[n];
    for(int i=0;i<n;++i)
    {
        cin>>x[i];
    }
    long long max=-LONG_LONG_MAX;
    long long min=LONG_LONG_MAX;
    for(int i=0;i<n;++i)
    {
        if(x[i]>max) max=x[i];
        if(x[i]<min) min=x[i];
    }
    cout<<abs(max-min);
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:20: error: 'LONG_LONG_MAX' was not declared in this scope
   13 |     long long max=-LONG_LONG_MAX;
      |                    ^~~~~~~~~~~~~
Language: C++


#include<cmath>

int main() {
  int N;
  std::cin >> N;
  int temp_min;
  int temp_max;
  for (int i=0; i<N; i++) {
    if (i == 0) {
      int n;
      std::cin >> n;
      temp_max = n;
      temp_min = n;
    }
    else {
      int n;
      std::cin >> n;
      temp_max = std::max(temp_max, n);
      temp_min = std::min(temp_min, n);
    }
  }
  std::cout << temp_max - temp_min << std::endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:8: error: 'cin' is not a member of 'std'
    6 |   std::cin >> N;
      |        ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include<cmath>
  +++ |+#include <iostream>
    3 | 
a.cc:12:12: error: 'cin' is not a member of 'std'
   12 |       std::cin >> n;
      |            ^~~
a.cc:12:12: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:18:12: error: 'cin' is not a member of 'std'
   18 |       std::cin >> n;
      |            ^~~
a.cc:18:12: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:23:8: error: 'cout' is not a member of 'std'
   23 |   std::cout << temp_max - temp_min << std::endl;
      |        ^~~~
a.cc:23:8: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:23:44: error: 'endl' is not a member of 'std'
   23 |   std::cout << temp_max - temp_min << std::endl;
      |                                            ^~~~
a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    2 | #include<cmath>
  +++ |+#include <ostream>
    3 |
Language: C++


#include <iostream>
using namespace std;

int main() {
	int N;
	int A[110];
	cin >> N;
	for (int i = 0; i < N; i++) cin >> A[i];

	int max = 0;
	int diff = 0;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) 
			diff = abs(A[i] - A[j]);
			if (diff > max) max = diff;
		}
	}
	cout << max << endl;

	return 0;
}

Compiler output:
a.cc:19:9: error: 'cout' does not name a type
   19 |         cout << max << endl;
      |         ^~~~
a.cc:21:9: error: expected unqualified-id before 'return'
   21 |         return 0;
      |         ^~~~~~
a.cc:22:1: error: expected declaration before '}' token
   22 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main (){
  int n,a;
    cin>>n;
  vector<int> x;
  for(int i=0;i<n;i++){
    cin>>a;
    x.push_back(a);
  }

  sort(x.start(),x.end());
  cout<<x[n-1]-x[0];
  return 0;
}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:12:10: error: 'class std::vector<int>' has no member named 'start'
   12 |   sort(x.start(),x.end());
      |          ^~~~~
Language: C++

#include <iostream>
using namespace std;

int N;
int A[200];         
int main() {
    for (int i = 0; i < N; ++i) cin >> A[i];

    int max = 0;
   

    
        for (int j = 0; j < N; ++j) {
          for (int j = 0; j < N; ++j) {
            if(max < A[i] - A[j])max = A[i] - A[j];
          
          }
        }
      

    cout << max << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:24: error: 'i' was not declared in this scope
   15 |             if(max < A[i] - A[j])max = A[i] - A[j];
      |                        ^
Language: C++

#include <iostream>
using namespace std;

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

    int max = 0;
    int min = 0;

    
        for (int j = 0; j < N; ++j) {
            if(max < A[j])max = A[j];
          if(min > A[j])min = A[j];
        }
      

    cout << (max - min) << endl;
}

Compiler output:
a.cc:5:7: error: size of array 'A' is not an integral constant-expression
    5 | int A[N];
      |       ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {

  int N;
  cin >> N;
  
  vector<int> A(N);
  
  int num = 1e7;
  int num2 = -1e7;
  
  for(int i = 0;i < N;++i){
    cin >> A[i];
  }
  
  for(int i = 0;i < N;++i){
    num = min(num,N[i]);
    num2 = max(num2,N[i]);
  }
  
  cout << num2 - num << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:20: error: invalid types 'int[int]' for array subscript
   19 |     num = min(num,N[i]);
      |                    ^
a.cc:20:22: error: invalid types 'int[int]' for array subscript
   20 |     num2 = max(num2,N[i]);
      |                      ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {

  int N;
  cin >> N;
  
  vector<int> A(N);
  
  int num = 1e10;
  int num2 = -1e7;
  
  for(int i = 0;i < N;++i){
    cin >> A[i];
  }
  
  for(int i = 0;i < N;++i){
    num = min(num,N[i]);
    num2 = max(num2,N[i]);
  }
  
  cout << num2 - num << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:13: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+10' to '2147483647' [-Woverflow]
   11 |   int num = 1e10;
      |             ^~~~
a.cc:19:20: error: invalid types 'int[int]' for array subscript
   19 |     num = min(num,N[i]);
      |                    ^
a.cc:20:22: error: invalid types 'int[int]' for array subscript
   20 |     num2 = max(num2,N[i]);
      |                      ^
Language: C

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

int ordem(const void*a,const void*b){
    int x =*((int*)a), int y =*((int*)b);

    if(x<y){
        return -1;
    }else{
        return 1;
    }
}




int main(){
    int a,b;
    int n;
    int vet[n];

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

    qsort(n,vet,sizeof(int),ordem);
    printf(vet[n-1] - vet[0]);

return 0;
}


Compiler output:
main.c: In function 'ordem':
main.c:5:24: error: expected identifier or '(' before 'int'
    5 |     int x =*((int*)a), int y =*((int*)b);
      |                        ^~~
main.c:7:10: error: 'y' undeclared (first use in this function)
    7 |     if(x<y){
      |          ^
main.c:7:10: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'main':
main.c:26:11: error: passing argument 1 of 'qsort' makes pointer from integer without a cast [-Wint-conversion]
   26 |     qsort(n,vet,sizeof(int),ordem);
      |           ^
      |           |
      |           int
In file included from main.c:2:
/usr/include/stdlib.h:970:26: note: expected 'void *' but argument is of type 'int'
  970 | extern void qsort (void *__base, size_t __nmemb, size_t __size,
      |                    ~~~~~~^~~~~~
main.c:26:13: error: passing argument 2 of 'qsort' makes integer from pointer without a cast [-Wint-conversion]
   26 |     qsort(n,vet,sizeof(int),ordem);
      |             ^~~
      |             |
      |             int *
/usr/include/stdlib.h:970:41: note: expected 'size_t' {aka 'long unsigned int'} but argument is of type 'int *'
  970 | extern void qsort (void *__base, size_t __nmemb, size_t __size,
      |                                  ~~~~~~~^~~~~~~
main.c:27:21: error: passing argument 1 of 'printf' makes pointer from integer without a cast [-Wint-conversion]
   27 |     printf(vet[n-1] - vet[0]);
      |            ~~~~~~~~~^~~~~~~~
      |                     |
      |                     int
In file included from main.c:1:
/usr/include/stdio.h:363:43: note: expected 'const char * restrict' but argument is of type 'int'
  363 | extern int printf (const char *__restrict __format, ...);
      |                    ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
Language: C

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

int main(){
	int N, A, X;
	
	scanf("%d", &N);
	
	for (int i = 0; i < n; i++){
		scanf("%d", &A[i]);
	} 
	
	
	return 0;
}


Compiler output:
main.c: In function 'main':
main.c:9:29: error: 'n' undeclared (first use in this function)
    9 |         for (int i = 0; i < n; i++){
      |                             ^
main.c:9:29: note: each undeclared identifier is reported only once for each function it appears in
main.c:10:31: error: subscripted value is neither array nor pointer nor vector
   10 |                 scanf("%d", &A[i]);
      |                               ^
Language: C++

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

int main() {
  int a;
  cin >> a;
  int b[100];
  for(int i =0;i <a i++)
    cin >> b[i];
     
  sort(b,b+a);
  
  
  cout << b[a-1]-b[0] <<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:20: error: expected ';' before 'i'
    8 |   for(int i =0;i <a i++)
      |                    ^~
      |                    ;
Language: Java

import java.util.*;

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

        int n = sc.nextInt();
        int[] list = new int[n];

        for (int i = 0; i< n; i++){
            list[i] = sc.nextint();
        }

        Arrays.sort(list);

        System.out.println(Maths.abs(list[n-1] - list[0]);
    }
}



Compiler output:
Main.java:16: error: ')' or ',' expected
        System.out.println(Maths.abs(list[n-1] - list[0]);
                                                         ^
1 error
Language: Java

// https://atcoder.jp/contests/abc068/tasks/abc068_b

import java.util.*;

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

        int N = sc.nextInt();
        //1以上100以下の整数の中で最も2で割れる回数が多いのは64(2^6)
        int ans = 64;

        //64以下の整数で、次に割れる回数が多いのは32(2^5)
        while( N < ans ) {
            ans /= 2;
        }

        System.out.printout.(ans);
    }
}

Compiler output:
Main.java:18: error: <identifier> expected
        System.out.printout.(ans);
                            ^
1 error
Language: C

#include<stdio.h>
int main()
{
  int N;
  scanf("%d",&N);
  int A[N],i;
  for(i=1;i<=N;i=i+1)
  {
    scanf("%d",&A[i]);
  }
  
  int max,k,l;
  max=A[1]-A[2]
  for(k=1;k<=N;k=k+1)
    for(l=1;l<=N;l=l+1)
    {
      if(max<A[k]-A[l])
      {
        max=A[k]-A[l];
      }
    }
  printf("%d",max);
}
    

Compiler output:
main.c: In function 'main':
main.c:13:16: error: expected ';' before 'for'
   13 |   max=A[1]-A[2]
      |                ^
      |                ;
   14 |   for(k=1;k<=N;k=k+1)
      |   ~~~
Language: C++

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

int main() {
  int N;
  cin >> N;
  for (int i = 0; i < N; i++) {
    int A[i];
    cin >> A[i];
  }
  if (A[0] < A[1]) {
    int max = A[1];
    int min = A[0];
  }
  else {
    int max = A[0];
    int min = A[1];
  }
  for (int i = 2; i < N; i++) {
    if (A[i] > max) {
      max = A[i];
    }
    if (A[i] < min) {
      min = A[i];
    }
  }
  int ans = max - min
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:7: error: 'A' was not declared in this scope
   11 |   if (A[0] < A[1]) {
      |       ^
a.cc:20:9: error: 'A' was not declared in this scope
   20 |     if (A[i] > max) {
      |         ^
a.cc:23:9: error: 'A' was not declared in this scope
   23 |     if (A[i] < min) {
      |         ^
a.cc:27:17: error: invalid operands of types '<unresolved overloaded function type>' and '<unresolved overloaded function type>' to binary 'operator-'
   27 |   int ans = max - min
      |             ~~~~^~~~~
Language: C++

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

int main() {
  int N;
  cin >> N;
  for (int i = 0; i < N; i++) {
    int Ai;
    cin >> Ai;
  }
  if (A0 < A1) {
    int max = A1;
    int min = A0;
  }
  else {
    int max = A0;
    int min = A1;
  }
  for (int i = 2; i < N; i++) {
    if (Ai > max) {
      max = Ai;
    }
    if (Ai < min) {
      min = Ai;
    }
  }
  cout << max - min << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:7: error: 'A0' was not declared in this scope; did you mean 'y0'?
   11 |   if (A0 < A1) {
      |       ^~
      |       y0
a.cc:11:12: error: 'A1' was not declared in this scope; did you mean 'y1'?
   11 |   if (A0 < A1) {
      |            ^~
      |            y1
a.cc:20:9: error: 'Ai' was not declared in this scope; did you mean 'i'?
   20 |     if (Ai > max) {
      |         ^~
      |         i
a.cc:23:9: error: 'Ai' was not declared in this scope; did you mean 'i'?
   23 |     if (Ai < min) {
      |         ^~
      |         i
a.cc:27:15: error: invalid operands of types '<unresolved overloaded function type>' and '<unresolved overloaded function type>' to binary 'operator-'
   27 |   cout << max - min << endl;
      |           ~~~~^~~~~
Language: C++

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

int main() {
  int N;
  cin >> N;
  for (i = 0; i < N; i++) {
    int A(i);
    cin >> A(i);
  }
  if (A(0) < A(1)) {
    int max = A(1);
    int min = A(0);
  }
  else {
    int max = A(0);
    int min = A(1);
  }
  for (i = 2; i < N; 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:7:8: error: 'i' was not declared in this scope
    7 |   for (i = 0; i < N; i++) {
      |        ^
a.cc:9:13: error: 'A' cannot be used as a function
    9 |     cin >> A(i);
      |            ~^~~
a.cc:11:7: error: 'A' was not declared in this scope
   11 |   if (A(0) < A(1)) {
      |       ^
a.cc:19:8: error: 'i' was not declared in this scope
   19 |   for (i = 2; i < N; i++) {
      |        ^
a.cc:20:9: error: 'A' was not declared in this scope
   20 |     if (A(i) > max) {
      |         ^
a.cc:23:9: error: 'A' was not declared in this scope
   23 |     if (A(i) < min) {
      |         ^
a.cc:27:15: error: invalid operands of types '<unresolved overloaded function type>' and '<unresolved overloaded function type>' to binary 'operator-'
   27 |   cout << max - min << endl;
      |           ~~~~^~~~~
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
using namespace std;
int main(){
  int n;
  cin >>n;
  vector<int> a;
  for(int i = 0;i<n;i++){
    int temp;
    cin >>temp;
    a.push_back(abs(temp));
  }
  a.sort();
  cout << a[a.size()-1]-a[0];
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:5: error: 'class std::vector<int>' has no member named 'sort'
   15 |   a.sort();
      |     ^~~~
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
using namespace std;
int main(){
  int n;
  cin >>n;
  vector<int> a;
  for(int i = 0;i<n;i++){
    int temp;
    cin >>temp;
    a.pushback(abs(temp));
  }
  a.sort();
  cout << a[a.size()-1]-a[0];
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:7: error: 'class std::vector<int>' has no member named 'pushback'; did you mean 'push_back'?
   13 |     a.pushback(abs(temp));
      |       ^~~~~~~~
      |       push_back
a.cc:15:5: error: 'class std::vector<int>' has no member named 'sort'
   15 |   a.sort();
      |     ^~~~