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

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

int main() {
  int N;
  cin >> N;
  long A;
  long min=1000000000;max=-1;
  for(int i=0;i<N;i++) {
    if(min>A) min=A;
    if(max<A) max=A;
  }
  cout << max-min << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:28: error: overloaded function with no contextual type information
    8 |   long min=1000000000;max=-1;
      |                            ^
a.cc:11:8: error: parse error in template argument list
   11 |     if(max<A) max=A;
      |        ^~~~~
a.cc:11:13: error: cannot resolve overloaded function 'max' based on conversion to type 'bool'
   11 |     if(max<A) max=A;
      |             ^
a.cc:11:19: error: overloaded function with no contextual type information
   11 |     if(max<A) max=A;
      |                   ^
a.cc:13:14: error: invalid operands of types '<unresolved overloaded function type>' and 'long int' to binary 'operator-'
   13 |   cout << max-min << endl;
      |           ~~~^~~~
Language: C++

#include <iostream>
#include <sort>
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<<a[n-1]-a[0]<<endl;
  return 0;
}

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

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  vector<int> a;
  int ans=0;
  cin >> a.at(0);
  int mi=a.at(0);
  int ma=mi;
  for(int i=1;i<N;i++){
    cin >> a.at(i);
    ma=max(ma,a.at(i));
    mi=min(mi,a,at(i));
  }
  cout << ma-mi << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:17: error: 'at' was not declared in this scope; did you mean 'a'?
   15 |     mi=min(mi,a,at(i));
      |                 ^~
      |                 a
Language: C++

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

int main(){
	int N,x;

	vector<int> A;
	cin >> N;


	for(int i = 0; i<N; i++){
		cin >> x;
		A.push_back(x);
	}

	//set<int>::iterator j = A.begin();
	//while(j != A.end()){
	//	cout << *j++ << " ";
	//}
	//cout << endl;

	sort(A.begin(),A.end());
	//auto itr1 = A.begin();
	//auto itr2 = A.end();
	cout << abs(A[0] - A[N-1]) << endl;

	return 0;


Compiler output:
a.cc: In function 'int main()':
a.cc:30:18: error: expected '}' at end of input
   30 |         return 0;
      |                  ^
a.cc:7:11: note: to match this '{'
    7 | int main(){
      |           ^
Language: C++

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

int main() {
  int n;
  cin >> n;
  
  vector<int> v;
  while (n--) {
    int a;
    cin >> a;
    v.push_back(a);
  }
  sort(v.begin(), v.end());
  
  cout << v.back() - v.front() << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    7 |   cin >> n;
      |   ^~~
      |   std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:9:3: error: 'vector' was not declared in this scope
    9 |   vector<int> v;
      |   ^~~~~~
a.cc:9:3: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_vector.h:428:11: note:   'std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
/usr/include/c++/14/vector:93:13: note:   'std::pmr::vector'
   93 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
a.cc:9:10: error: expected primary-expression before 'int'
    9 |   vector<int> v;
      |          ^~~
a.cc:13:5: error: 'v' was not declared in this scope
   13 |     v.push_back(a);
      |     ^
a.cc:15:8: error: 'v' was not declared in this scope
   15 |   sort(v.begin(), v.end());
      |        ^
a.cc:15:3: error: 'sort' was not declared in this scope; did you mean 'std::sort'?
   15 |   sort(v.begin(), v.end());
      |   ^~~~
      |   std::sort
In file included from /usr/include/c++/14/algorithm:86,
                 from a.cc:3:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: 'std::sort' declared here
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
a.cc:17:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   17 |   cout << v.back() - v.front() << endl;
      |   ^~~~
      |   std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:17:35: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   17 |   cout << v.back() - v.front() << endl;
      |                                   ^~~~
      |                                   std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
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];
  }
  int max_value = *max_element(A,A+N);
  int min_value = *min_element(A,A+N);
  int answer = max_value-min_value;
  cout << answer << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:20: error: 'max_element' was not declared in this scope
   10 |   int max_value = *max_element(A,A+N);
      |                    ^~~~~~~~~~~
a.cc:11:20: error: 'min_element' was not declared in this scope
   11 |   int min_value = *min_element(A,A+N);
      |                    ^~~~~~~~~~~
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:8:6: error: structured binding declaration cannot have type 'int'
    8 |   int[N] A;
      |      ^~~
a.cc:8:6: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:8:7: error: conflicting declaration 'auto N'
    8 |   int[N] A;
      |       ^
a.cc:6:7: note: previous declaration as 'int N'
    6 |   int N;
      |       ^
a.cc:8:10: error: expected initializer before 'A'
    8 |   int[N] A;
      |          ^
a.cc:10:12: error: 'A' was not declared in this scope
   10 |     cin >> A[i];
      |            ^
a.cc:12:8: error: 'A' was not declared in this scope
   12 |   sort(A,A+N);
      |        ^
Language: C++

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

//絶対値
int abs(int x) {
				return max(x,-x);
}

int main(){
  int N;
  cin >> N;
  vector<int> a(N);
  for (int i=0;i<N;i++) {
	cin >>a.at(i);
  }
  int m = 0;
  for (int i=0;i<N;i++) {
	for (int j=0;j<N;j++) {
	  if (abs(a.at(i)-a.at(j)) >= m) {
		m = abs(a.at(i)-a.at(j))
		}
			}
		  }
		  cout << m << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:41: error: expected ';' before '}' token
   21 |                 m = abs(a.at(i)-a.at(j))
      |                                         ^
      |                                         ;
   22 |                 }
      |                 ~
Language: C++

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

//絶対値
int abs(int x) {
				return max(x,-x);
}

int main(){
  int N;
  cin >> N;
  vector<int> a(N);
  for (i=0;i<N;i++) {
	cin >>a.at(i);
  }
  int m = 0;
  for (i=0;i<N;i++) {
	for (j=0;j<N;j++) {
	  if (abs(a.at(i)-a.at(j)) >= m) {
		m = abs(a.at(i)-a.at(j))
		}
			}
		  }
		  cout << m << endl;
}


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

n = gets.chomp.to_i
a = gets.chomp.split(' ').map{|i| i.to_i}
max = 0
n.times do |i|
        i + 1.upto(n - 1) do |j|
                if max < (a[i] - a[j]).abs then
                        max = (a[i] - a[j]).abs
                end
        end
end
puts max

Compiler output:
Main.java:1: error: class, interface, enum, or record expected
n = gets.chomp.to_i
^
1 error
Language: C++

#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <array>
#include <vector>
#include <functional>
#include <unordered_map>
#include <map>
#include <numeric>
#include <limits>
#include <utility>
#include <queue>
#include <random>
using namespace std;
typedef long long LL;

int main()
{
    int n;
    cin >> n;

    vector<long long> a(n);

    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }

    sort(a.begin(), a.end());
    cout << abs(a[0] - a[N - 1]) << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:26: error: 'N' was not declared in this scope
   31 |     cout << abs(a[0] - a[N - 1]) << endl;
      |                          ^
Language: C++

#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <array>
#include <vector>
#include <functional>
#include <unordered_map>
#include <map>
#include <numeric>
#include <limits>
#include <utility>
#include <queue>
#include <random>
using namespace std;
typedef long long LL;

int main(void)
{
    int n;
    cin >> n;

    vector<long long> a(n);

    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }

    sort(a.begin(), a.end());
    cout << abs(a[0] - a[N - 1]) << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:26: error: 'N' was not declared in this scope
   31 |     cout << abs(a[0] - a[N - 1]) << endl;
      |                          ^
Language: Java

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

class Main {

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

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

#include <stdio.h>
#include <stdlib.h>
 
int max(int a[N][],int n){
  int i,j,max;
  max = a[0][0];
  for(i = 1; i < n; i++){
    for(j = 1; j < m; j++){
      if(a[j][k] > max){
        max = a[j][k];
      }
    }
  }
  return max;
}
  
  int main(){
  
  int N;
  scanf("%d",&N);
  int i,a[N];
  for(i = 0; i < N; i++){
    scanf("%d",&a[i]);
  }
  
  int sub[N][N];
  int j,k;
  for(j = 0; j < N; j++){
    for(k = 0; k < j; k++){
      sub[j][k] = abs(a[j] - a[k]);
    }
  }
  
  int ans = max(a,N,N);
  printf("%d",ans);
      
  return 0;
  
}
  

Compiler output:
main.c:4:15: error: 'N' undeclared here (not in a function)
    4 | int max(int a[N][],int n){
      |               ^
main.c: In function 'max':
main.c:8:20: error: 'm' undeclared (first use in this function)
    8 |     for(j = 1; j < m; j++){
      |                    ^
main.c:8:20: note: each undeclared identifier is reported only once for each function it appears in
main.c:9:15: error: 'k' undeclared (first use in this function)
    9 |       if(a[j][k] > max){
      |               ^
main.c: In function 'main':
main.c:34:17: error: type of formal parameter 1 is incomplete
   34 |   int ans = max(a,N,N);
      |                 ^
main.c:34:13: error: too many arguments to function 'max'
   34 |   int ans = max(a,N,N);
      |             ^~~
main.c:4:5: note: declared here
    4 | int max(int a[N][],int n){
      |     ^~~
Language: C++

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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}

int main2() {
  int N = nextInt();
  REP(i, N) A[i] = nextInt();
  sort(A, A+N);
  cout << A[N-1] - A[0] << endl;
  return 0;
}

int main() {
  for (;!cin.eof();cin>>ws)
    main2();
  return 0;
}


Compiler output:
a.cc: In function 'int main2()':
a.cc:18:13: error: 'A' was not declared in this scope
   18 |   REP(i, N) A[i] = nextInt();
      |             ^
a.cc:19:8: error: 'A' was not declared in this scope
   19 |   sort(A, A+N);
      |        ^
Language: C++


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

ソースコード
using namespace std;

int main()
{

	int N;

	cin >> N;

	int min_a = 1000000000;
	int max_a = 0;
	int a;
	for (int ni = 0; ni < N; ni++) {
		cin >> a;
		min_a = min(min_a, a);
		max_a = max(max_a, a);
	}

	printf("%d", max_a - min_a);

    return 0;
}



Compiler output:
a.cc:7:1: error: '\U000030bd\U000030fc\U000030b9\U000030b3\U000030fc\U000030c9' does not name a type
    7 | ソースコード
      | ^~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:15:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   15 |         cin >> N;
      |         ^~~
      |         std::cin
In file included from a.cc:2:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:22:25: error: 'min' was not declared in this scope; did you mean 'std::min'?
   22 |                 min_a = min(min_a, a);
      |                         ^~~
      |                         std::min
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:5:
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: 'std::min' declared here
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
a.cc:23:25: error: 'max' was not declared in this scope; did you mean 'std::max'?
   23 |                 max_a = max(max_a, a);
      |                         ^~~
      |                         std::max
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: 'std::max' declared here
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
Language: C++

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

int main()
{
	int n;
	cin>>n;
	for(int a=0;a<n;a++)
	{
		scanf("%d", &datas[a]);
	}
	int maxi=-1;
	for(int a=0;a<n;a++)
	{
		for(int b=a+1;b<n;b++)
		{
			int tmp=abs(datas[a]-datas[b]);
			maxi=max(maxi, tmp);
		}
	}
	cout<<maxi<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:30: error: 'datas' was not declared in this scope
   10 |                 scanf("%d", &datas[a]);
      |                              ^~~~~
a.cc:17:37: error: 'datas' was not declared in this scope
   17 |                         int tmp=abs(datas[a]-datas[b]);
      |                                     ^~~~~
Language: C++

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

int main()
{
	int n;
	cin>>n;
	for(int a=0;a<n;a++)
	{
		scanf("%d", &datas[a]);
	}
	for(int a=0;a<n;a++)
	{
		for(int b=a+1;b<n;b++)
		{
			int tmp=abs(datas[a]-datas[b]);
			maxi=max(maxi, tmp);
		}
	}
	cout<<maxi<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:30: error: 'datas' was not declared in this scope
   10 |                 scanf("%d", &datas[a]);
      |                              ^~~~~
a.cc:16:37: error: 'datas' was not declared in this scope
   16 |                         int tmp=abs(datas[a]-datas[b]);
      |                                     ^~~~~
a.cc:17:25: error: 'maxi' was not declared in this scope
   17 |                         maxi=max(maxi, tmp);
      |                         ^~~~
a.cc:20:15: error: 'maxi' was not declared in this scope
   20 |         cout<<maxi<<endl;
      |               ^~~~
Language: C++

int MIN=1e9;
    cin>>N;
    for(int i=0;i<N;i++){
        cin>>A[i];
    }

    for(int i=0;i<N;i++){
        MAX=max(MAX,A[i]);
        MIN=min(MIN,A[i]);
    }
    cout<<MAX-MIN<<endl;

    return 0;
}

Compiler output:
a.cc:2:5: error: 'cin' does not name a type
    2 |     cin>>N;
      |     ^~~
a.cc:3:5: error: expected unqualified-id before 'for'
    3 |     for(int i=0;i<N;i++){
      |     ^~~
a.cc:3:17: error: 'i' does not name a type
    3 |     for(int i=0;i<N;i++){
      |                 ^
a.cc:3:21: error: 'i' does not name a type
    3 |     for(int i=0;i<N;i++){
      |                     ^
a.cc:7:5: error: expected unqualified-id before 'for'
    7 |     for(int i=0;i<N;i++){
      |     ^~~
a.cc:7:17: error: 'i' does not name a type
    7 |     for(int i=0;i<N;i++){
      |                 ^
a.cc:7:21: error: 'i' does not name a type
    7 |     for(int i=0;i<N;i++){
      |                     ^
a.cc:11:5: error: 'cout' does not name a type
   11 |     cout<<MAX-MIN<<endl;
      |     ^~~~
a.cc:13:5: error: expected unqualified-id before 'return'
   13 |     return 0;
      |     ^~~~~~
a.cc:14:1: error: expected declaration before '}' token
   14 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int N;
int A[200];

int main()
{
  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) ans=max(ans,abs(A[i]-A[j]);
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:70: error: expected ')' before ';' token
   11 |   for(int i=0;i<N;++i)for(int j=0;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 << A.at(N - 1) - A.at(0);
  	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   14 |         sort(A.begin(), A.end());
      |         ^~~~
      |         short
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.at(0), A.at(N - 1));
  	cout << A.at(N - 1) - A.at(0);
  	return 0;
}


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

#include <iostream>
#include <array>

using namespace std;

int main ()
{
  	int N;
  	array<int, N>  A;
  	cin >> N;
  	for(int i = 0; i < N; i++){
      	cin >> A.at(i);
    }
  	int max = A.at(0), min = A.at(0);
  	for(int i = 0; i < N; i++){
      	if(A.at(i) >= max){
          	max = A.at(i);
        }
      	if(A.at(i) <= min){
			min = A.at(i);
        }
    }
  	cout << max - min;
  	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:21: error: the value of 'N' is not usable in a constant expression
    9 |         array<int, N>  A;
      |                     ^
a.cc:8:13: note: 'int N' is not const
    8 |         int N;
      |             ^
a.cc:9:21: note: in template argument for type 'long unsigned int'
    9 |         array<int, N>  A;
      |                     ^
a.cc:12:18: error: request for member 'at' in 'A', which is of non-class type 'int'
   12 |         cin >> A.at(i);
      |                  ^~
a.cc:14:21: error: request for member 'at' in 'A', which is of non-class type 'int'
   14 |         int max = A.at(0), min = A.at(0);
      |                     ^~
a.cc:16:14: error: request for member 'at' in 'A', which is of non-class type 'int'
   16 |         if(A.at(i) >= max){
      |              ^~
a.cc:17:25: error: request for member 'at' in 'A', which is of non-class type 'int'
   17 |                 max = A.at(i);
      |                         ^~
a.cc:19:14: error: request for member 'at' in 'A', which is of non-class type 'int'
   19 |         if(A.at(i) <= min){
      |              ^~
a.cc:20:33: error: request for member 'at' in 'A', which is of non-class type 'int'
   20 |                         min = A.at(i);
      |                                 ^~
a.cc:23:21: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator-'
   23 |         cout << max - min;
      |                 ~~~~^~~~~
Language: C++

#include<stdio.h>
int main(){
	int n;
	sanf("%d",&n);
	int a[n],i,j,tmp;
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
		}
	for(i=0;i<n;i++){
		for(j=n-1;j>i;j--){
			if(a[j]<a[j-1]){
				tmp=a[j-1];
				a[j-1]=a[j];
				a[j]=tmp;
				}
			}
		}
		printf("%d",a[n-1]-a[0]);
	return 0;
	}


Compiler output:
a.cc: In function 'int main()':
a.cc:4:9: error: 'sanf' was not declared in this scope; did you mean 'scanf'?
    4 |         sanf("%d",&n);
      |         ^~~~
      |         scanf
Language: C++

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

int main()
{
  int n, i, j, min_=1000000000, max_=1;
  cin >> n;
  int a[n];
  for(i=0; i<n; i++) {
    if(a[i]<min_)
      min_ = a[i];
    if(a[i]>max_)
      max_ = a[i];
  }
  cout << max_-min_;
  

Compiler output:
a.cc: In function 'int main()':
a.cc:17:21: error: expected '}' at end of input
   17 |   cout << max_-min_;
      |                     ^
a.cc:7:1: note: to match this '{'
    7 | {
      | ^
Language: C++

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

int main()
{
  int n, i, j, min_=1000000000, max_=1;
  cin >> n;
  int a[n];
  for(i=0; i<n; i++) {
    if(a[i]<min)
      min = a[i];
    if(a[i]>max)
      max = a[i];
  }
  cout << max_-min_;
  

Compiler output:
a.cc: In function 'int main()':
a.cc:12:12: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<'
   12 |     if(a[i]<min)
      |        ~~~~^~~~
a.cc:13:16: error: overloaded function with no contextual type information
   13 |       min = a[i];
      |                ^
a.cc:14:12: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator>'
   14 |     if(a[i]>max)
      |        ~~~~^~~~
a.cc:15:16: error: overloaded function with no contextual type information
   15 |       max = a[i];
      |                ^
a.cc:17:21: error: expected '}' at end of input
   17 |   cout << max_-min_;
      |                     ^
a.cc:7:1: note: to match this '{'
    7 | {
      | ^
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:10:12: error: 'A' was not declared in this scope
   10 |     cin >> A[i];
      |            ^
a.cc:11:8: error: expected unqualified-id before '(' token
   11 |   sort.(a, a+N);
      |        ^
Language: Java

import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner scanner = new Scanner(System.in);
    int len = scanner.nextInt();
    String[] nums = scanner.nextLine();
    Arrays.sort(nums);
    int first = Integer.parseInt(nums[0]);
    int last = Integer.parseInt(nums[len-1]);
    System.out.println(last-first);
  }
}

Compiler output:
Main.java:6: error: incompatible types: String cannot be converted to String[]
    String[] nums = scanner.nextLine();
                                    ^
1 error
Language: Java

public class Main {
  public static void main(String[] args){
    Scanner scanner = new Scanner(System.in);
    int len = scanner.nextInt();
    String[] nums = scanner.nextLine();
    Arrays.sort(nums);
    int first = (Int)nums[0];
    int last = (Int)nums[len-1];
    System.out.println(last-first);
  }
}

Compiler output:
Main.java:3: error: cannot find symbol
    Scanner scanner = new Scanner(System.in);
    ^
  symbol:   class Scanner
  location: class Main
Main.java:3: error: cannot find symbol
    Scanner scanner = new Scanner(System.in);
                          ^
  symbol:   class Scanner
  location: class Main
Main.java:6: error: cannot find symbol
    Arrays.sort(nums);
    ^
  symbol:   variable Arrays
  location: class Main
Main.java:7: error: cannot find symbol
    int first = (Int)nums[0];
                 ^
  symbol:   class Int
  location: class Main
Main.java:8: error: cannot find symbol
    int last = (Int)nums[len-1];
                ^
  symbol:   class Int
  location: class Main
5 errors
Language: C++

#include <iostream>

using namespace std;

int N;
int A[100];

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

Compiler output:
a.cc: In function 'int main()':
a.cc:16:22: error: no matching function for call to 'max(int)'
   16 |             ans = max(A[i] - A[j]);
      |                   ~~~^~~~~~~~~~~~~
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: Java

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

		//
		int max=0;
		inttemp=0;
		for(int i=0; i<n; i++){
			for(int j=i; j<n; j++){
				temp = A[i] - A[j];
				if(temp<0){
				temp = -temp;
				}
				if(max < temp){
				max=temp;
				}
			}
		}
		// 出力
		System.out.println(max);
	}
}

Compiler output:
Main.java:14: error: cannot find symbol
		inttemp=0;
		^
  symbol:   variable inttemp
  location: class Main
Main.java:17: error: cannot find symbol
				temp = A[i] - A[j];
				^
  symbol:   variable temp
  location: class Main
Main.java:18: error: cannot find symbol
				if(temp<0){
				   ^
  symbol:   variable temp
  location: class Main
Main.java:19: error: cannot find symbol
				temp = -temp;
				^
  symbol:   variable temp
  location: class Main
Main.java:19: error: cannot find symbol
				temp = -temp;
				        ^
  symbol:   variable temp
  location: class Main
Main.java:21: error: cannot find symbol
				if(max < temp){
				         ^
  symbol:   variable temp
  location: class Main
Main.java:22: error: cannot find symbol
				max=temp;
				    ^
  symbol:   variable temp
  location: class Main
7 errors
Language: Java

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

		//
		int max=0;
		for(int i=0; i<n; i++){
			for(int j=i; j<n; j++){
				temp = A[i] - A[j];
				if(temp<0){
				temp = -temp;
				}
				if(max < temp){
				max=temp;
				}
			}
		}
		// 出力
		System.out.println(max);
	}
}

Compiler output:
Main.java:16: error: cannot find symbol
				temp = A[i] - A[j];
				^
  symbol:   variable temp
  location: class Main
Main.java:17: error: cannot find symbol
				if(temp<0){
				   ^
  symbol:   variable temp
  location: class Main
Main.java:18: error: cannot find symbol
				temp = -temp;
				^
  symbol:   variable temp
  location: class Main
Main.java:18: error: cannot find symbol
				temp = -temp;
				        ^
  symbol:   variable temp
  location: class Main
Main.java:20: error: cannot find symbol
				if(max < temp){
				         ^
  symbol:   variable temp
  location: class Main
Main.java:21: error: cannot find symbol
				max=temp;
				    ^
  symbol:   variable temp
  location: class Main
6 errors
Language: Java

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

		//
		int max=0;
		for(int i=0; i<n; i++){
			for(int j=i; j<n; j++){
				temp = A[i] - A[j]
				if(temp<0){
				temp = -temp;
				}
				if(max < temp){
				max=temp;
				}
			}
		}
		// 出力
		System.out.println(max);
	}
}

Compiler output:
Main.java:16: error: ';' expected
				temp = A[i] - A[j]
				                  ^
1 error
Language: C

#include <stdio.h>

int main(){
  int n, min=1000000000, max=0, tmp;
  scanf ("%d", &n);
  
  for (i=0;i<n;i++) {
    scanf ("%d ", &tmp);
    if (tmp > max)
      max = tmp;
    if (tmp < min)
      min = tmp;
  }
  printf ("%d\n", max - min);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:7:8: error: 'i' undeclared (first use in this function)
    7 |   for (i=0;i<n;i++) {
      |        ^
main.c:7:8: 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, a;
  cin >> N;
  vector<int>vec(N);
  for(int i = 0; i < N; i++){
    cin >> vec.at(i);
  }

  sort(vec.begin(), vec.end());
  reverse(vec.begin(), vec.end());

  for(int i = 0; i < N - 1; i++){
    int difference = abs(vec.at(i) - vec.at(i + 1));
    if(difference > 0){
      int max_difference = difference;
    }
    else{
      max_difference = 0;
    }
  }
  cout << max_difference << endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:7: error: 'max_difference' was not declared in this scope; did you mean 'difference'?
   21 |       max_difference = 0;
      |       ^~~~~~~~~~~~~~
      |       difference
a.cc:24:11: error: 'max_difference' was not declared in this scope
   24 |   cout << max_difference << endl;
      |           ^~~~~~~~~~~~~~
Language: C++

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

int main(){
int n;cin>>n;
vector<int> num(n);
for(auto&& itr in num)cin>>itr;
cout<<*max_element(num.begin(),num.end())-*min_element(num.begin(),num.end())<<endl;

return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:15: error: expected ';' before 'in'
    9 | for(auto&& itr in num)cin>>itr;
      |               ^~~
      |               ;
a.cc:9:16: error: 'in' was not declared in this scope; did you mean 'n'?
    9 | for(auto&& itr in num)cin>>itr;
      |                ^~
      |                n
a.cc:9:18: error: expected ';' before 'num'
    9 | for(auto&& itr in num)cin>>itr;
      |                  ^~~~
      |                  ;
a.cc:9:28: error: use of 'itr' before deduction of 'auto'
    9 | for(auto&& itr in num)cin>>itr;
      |                            ^~~
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

using namespace std;
typedef int itn;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef map<int, int> M;
typedef pair<int, int> P;

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

    int n;
    cin >> n;
    int nmin = INT_MAX;
    int nmax = -1;
    for (itn i = 0; i < n; ++i) 
    {
        int a;
        cin >> a;
        nmax = max(nmax, a);
        nmin = min(nmin, a);
    }
    cout << nmax - nmin << endl;

    return 0;
}

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

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

using namespace std;


int main() {
	int N, MAX = 0, MIN = pow(10, 9);
	cin >> N;
	int val;
	for (int i = 0; i < N; i++) {
		cin >> val;
		MAX = max(MAX, val);
		MIN = min(MIN, val);
	}
	cout << abs(MAX - MIN) << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:31: error: 'pow' was not declared in this scope
   12 |         int N, MAX = 0, MIN = pow(10, 9);
      |                               ^~~
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;
bool cmp(int i,int j)
{return(i>j);} 
int main(){
    int n;
    cin>>n;
    int a[10101010];
    for(int i=0;i<n;i++);
    cin>>a[i];
    sort(a,a+n,cmp);
    int ans1=a[0];
    sort(a,a+n);
    int ans2=a[0];
    cout<<ans1-ans2<<endl;
    return 0;
}
    


Compiler output:
a.cc: In function 'int main()':
a.cc:11:12: error: 'i' was not declared in this scope
   11 |     cin>>a[i];
      |            ^
Language: Java

import java.util.Scanner;

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

    for(i=0;i<n;i++){
      int a =scanner.nextInt();
     if(i==0){
      max=a;
      min=a;
    }
    if(a>max)
      max=a;
    
    if(a<min)
      min=a;
    
  }
    System.out.println(max-min);
  }
}

Compiler output:
Main.java:12: error: cannot find symbol
    for(i=0;i<n;i++){
        ^
  symbol:   variable i
  location: class Main
Main.java:12: error: cannot find symbol
    for(i=0;i<n;i++){
            ^
  symbol:   variable i
  location: class Main
Main.java:12: error: cannot find symbol
    for(i=0;i<n;i++){
                ^
  symbol:   variable i
  location: class Main
Main.java:14: error: cannot find symbol
     if(i==0){
        ^
  symbol:   variable i
  location: class Main
4 errors
Language: Java

import java.util.Scanner;

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

    for(i=0;i<n;i++){
      int a =scanner.nextInt();
     if(i==0){
      max=a;
      min=a;
    }
    if(a>max){
      max=a;
    }
    if(a<min){
      min=a;
    }
  }
    System.out.println(max-min);
  }
}

Compiler output:
Main.java:12: error: cannot find symbol
    for(i=0;i<n;i++){
        ^
  symbol:   variable i
  location: class Main
Main.java:12: error: cannot find symbol
    for(i=0;i<n;i++){
            ^
  symbol:   variable i
  location: class Main
Main.java:12: error: cannot find symbol
    for(i=0;i<n;i++){
                ^
  symbol:   variable i
  location: class Main
Main.java:14: error: cannot find symbol
     if(i==0){
        ^
  symbol:   variable i
  location: class Main
4 errors
Language: C++

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

using namespace std;

int
main(int argc, char* argv[]) {
  int n, i;
  long long _a;
  vector<long long> a;

  cin >> n;

  for(i=0; i<n; i++) {
    cin >> _a;
    a.push_back(_a);
  }
  sort(a.begin(), a.end());

  long long int b = (a.back() - *a.begin());
  cout << b << endl;

  return 0;
}


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

package org.ebyhr.quick.atcoder;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

// https://abc102.contest.atcoder.jp/tasks/abc102_b
public class abc102_b
{

    public static void main(String[] args)
    {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        List<Integer> a = new ArrayList<>(){};
        for (int i=0; i<n; i++) {
            a.add(in.nextInt());
        }
        int max = Collections.max(a);
        int min = Collections.min(a);
        System.out.println(max - min);
    }
}


Compiler output:
Main.java:9: error: class abc102_b is public, should be declared in a file named abc102_b.java
public class abc102_b
       ^
1 error
Language: C++

#include <iostream>
using namespace std;
int main(void){
    int N;
    cin >> N;
    vector <int> a(N);
    for(int i = 0; i < N; i++)
    {
        cin >> a[i];
    }
    int mn = a[0], mx = a[0];
	for(int i = 1; i < n; i++){
		if(mn > a[i])
		    mn=a[i]
		if(mx<a[i])
			mx=a[i];
	}
	
	cout<<mx-mn<<endl;
}
	}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:5: error: 'vector' was not declared in this scope
    6 |     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:6:13: error: expected primary-expression before 'int'
    6 |     vector <int> a(N);
      |             ^~~
a.cc:9:16: error: 'a' was not declared in this scope
    9 |         cin >> a[i];
      |                ^
a.cc:11:14: error: 'a' was not declared in this scope
   11 |     int mn = a[0], mx = a[0];
      |              ^
a.cc:12:28: error: 'n' was not declared in this scope
   12 |         for(int i = 1; i < n; i++){
      |                            ^
a.cc:19:15: error: 'mx' was not declared in this scope; did you mean 'mn'?
   19 |         cout<<mx-mn<<endl;
      |               ^~
      |               mn
a.cc: At global scope:
a.cc:21:9: error: expected declaration before '}' token
   21 |         }
      |         ^
a.cc:22:1: error: expected declaration before '}' token
   22 | }
      | ^
Language: C++

#include <iostream>
using namespace std;
int main(void){
    int N;
    cin >> N;
    vector <int> a(N);
    for(int i = 0; i < N; i++)
    {
        cin >> a[i];
    }
    int mn = a[0], mx = a[0];
	for(int i = 1; i < n; i++){
		if(mn > a[i])
	}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:5: error: 'vector' was not declared in this scope
    6 |     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:6:13: error: expected primary-expression before 'int'
    6 |     vector <int> a(N);
      |             ^~~
a.cc:9:16: error: 'a' was not declared in this scope
    9 |         cin >> a[i];
      |                ^
a.cc:11:14: error: 'a' was not declared in this scope
   11 |     int mn = a[0], mx = a[0];
      |              ^
a.cc:12:28: error: 'n' was not declared in this scope
   12 |         for(int i = 1; i < n; i++){
      |                            ^
a.cc:14:9: error: expected primary-expression before '}' token
   14 |         }
      |         ^
Language: C++

#include <stdio.h>

int main (void)
{
   int n,i,max,min;
   int *p;

   scanf("%d",&n);

   p=(int*)malloc(sizeof(int)*n);

   for(i=0;i<n;i++)
   scanf("%d",p+i);

   max=min=*p;

   for(i=1;i<n;i++){
      if     (*(p+i)>max)   max=*(p+i);
      else if(*(p+i)<min)   min=*(p+i);
   }

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

   free(p);

   return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:12: error: 'malloc' was not declared in this scope
   10 |    p=(int*)malloc(sizeof(int)*n);
      |            ^~~~~~
a.cc:2:1: note: 'malloc' is defined in header '<cstdlib>'; this is probably fixable by adding '#include <cstdlib>'
    1 | #include <stdio.h>
  +++ |+#include <cstdlib>
    2 | 
a.cc:24:4: error: 'free' was not declared in this scope
   24 |    free(p);
      |    ^~~~
a.cc:24:4: note: 'free' is defined in header '<cstdlib>'; this is probably fixable by adding '#include <cstdlib>'
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;
int n;
main()
{
cin>>n;
  vector<int>a(n);
  for(int i=0;i<n;i++)cin>>a[i];
  sort(a.begin(),a.end());
  cout<<a[n-1]-a[0]<<endl;
}

Compiler output:
a.cc:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    5 | main()
      | ^~~~
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:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    2 | #include<algorithm>
  +++ |+#include <vector>
    3 | using namespace std;
a.cc:8:10: error: expected primary-expression before 'int'
    8 |   vector<int>a(n);
      |          ^~~
a.cc:9:28: error: 'a' was not declared in this scope
    9 |   for(int i=0;i<n;i++)cin>>a[i];
      |                            ^
a.cc:10:8: error: 'a' was not declared in this scope
   10 |   sort(a.begin(),a.end());
      |        ^
Language: C++

import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        int n;
        Scanner scan = new Scanner(System.in);
        n = scan.nextInt();
        int v[] = new int [n];
        for(int i = 0; i < n; i++)
            v[i] = scan.nextInt();
        int ans = -100000000;
        for(int a : v){
            for(int b:v){
                ans = Math.max(ans,Math.abs(a-b));
            }
        }
        System.out.println(ans);
    }
}


Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.Scanner;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: expected unqualified-id before 'public'
    2 | public class Main {
      | ^~~~~~
Language: C++

    #include<stdio.h>
    int main()
    {
        int a,i,mi,ma;
        int ret;
        int b[100];
        // 整数の入力
        
        ret=scanf("%d", &a);
        if(ret== EOF){
            return -1; 
        }
        // スペース区切りの整数の入力
        i=0;
        mi =10^9;
        ma =0;
        for(i;i<a;i++){
         ref=scanf("%d", &b[i]);
            if(ret== EOF){
            return -1; 
        }
           if(b[i]>ma){
           ma =b[i];
           }
           if(b[i]<mi){
           mi =b[i];
           }
        }             
        // 出力
        printf("%d\n",ma-mi);
        return 0;
    }

Compiler output:
a.cc: In function 'int main()':
a.cc:15:15: warning: result of '10^9' is 3; did you mean '1e9'? [-Wxor-used-as-pow]
   15 |         mi =10^9;
      |               ^
      |             ---
      |             1e
a.cc:15:13: note: you can silence this warning by using a hexadecimal constant (0xa rather than 10)
   15 |         mi =10^9;
      |             ^~
      |             0xa
a.cc:18:10: error: 'ref' was not declared in this scope; did you mean 'ret'?
   18 |          ref=scanf("%d", &b[i]);
      |          ^~~
      |          ret
Language: C++

int main(int argc, char *argv[]){
	int a;
	int b;
	char buf[128];	
	if(argc == 1){
		fgets(buf, 127, stdin);
		sscanf(buf, "%d", &a);

		if(a % 2 == 0){
			printf("%d\n", a);
			}else {
				b = a * 2;
			printf("%d\n" , b);
		}
	}
}

Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:6:33: error: 'stdin' was not declared in this scope
    6 |                 fgets(buf, 127, stdin);
      |                                 ^~~~~
a.cc:1:1: note: 'stdin' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | int main(int argc, char *argv[]){
a.cc:6:17: error: 'fgets' was not declared in this scope
    6 |                 fgets(buf, 127, stdin);
      |                 ^~~~~
a.cc:7:17: error: 'sscanf' was not declared in this scope
    7 |                 sscanf(buf, "%d", &a);
      |                 ^~~~~~
a.cc:10:25: error: 'printf' was not declared in this scope
   10 |                         printf("%d\n", a);
      |                         ^~~~~~
a.cc:10:25: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
a.cc:13:25: error: 'printf' was not declared in this scope
   13 |                         printf("%d\n" , b);
      |                         ^~~~~~
a.cc:13:25: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
Language: C++

#include <stdio.h>

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

return 0;

Compiler output:
a.cc: In function 'int main()':
a.cc:22:10: error: expected '}' at end of input
   22 | return 0;
      |          ^
a.cc:3:15: note: to match this '{'
    3 | int main(void){
      |               ^
Language: C++

#include <stdio.h>

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

return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:5: error: storage size of 'A' isn't known
    5 | int A[];
      |     ^
a.cc:16:7: error: 'a' was not declared in this scope
   16 | min = a[j];
      |       ^
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:11:14: error: invalid types 'int[int]' for array subscript
   11 |         min=N[0];
      |              ^
a.cc:12:14: error: invalid types 'int[int]' for array subscript
   12 |         max=N[0];
      |              ^
a.cc:14:34: error: invalid types 'int[int]' for array subscript
   14 |                 if(A[i]<min)min=N[i];
      |                                  ^
a.cc:15:34: error: invalid types 'int[int]' for array subscript
   15 |                 if(A[i]>max)max=N[i];
      |                                  ^
a.cc:17:34: error: expected ';' before '}' token
   17 |         printf("%d",abs(max-min))
      |                                  ^
      |                                  ;
   18 | }
      | ~
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:6:13: error: storage size of 'A' isn't known
    6 |         int A[];
      |             ^
a.cc:11:14: error: invalid types 'int[int]' for array subscript
   11 |         min=N[0];
      |              ^
a.cc:12:14: error: invalid types 'int[int]' for array subscript
   12 |         max=N[0];
      |              ^
a.cc:17:34: error: expected ';' before '}' token
   17 |         printf("%d",abs(max-min))
      |                                  ^
      |                                  ;
   18 | }
      | ~