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

#include <bits/stdc++.h>

using namespace std;

#define ll long long int
#define MOD 1000000007
#define mt make_tuple
#define eb emplace_back
#define error(args...){string _s = #args; replace(_s.begin(),_s.end(),',',' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it,args);}
void err(istream_iterator<string> it){}
template<typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args){cerr<<*it<<" = "<<a<<endl; err(++it,args...);}



int main()
{
	ll n;
	cin>>n;
	cout<<(n*2)/__gcd(n,2);
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:26: error: no matching function for call to '__gcd(long long int&, int)'
   19 |         cout<<(n*2)/__gcd(n,2);
      |                     ~~~~~^~~~~
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:1:
/usr/include/c++/14/bits/stl_algo.h:1137:5: note: candidate: 'template<class _EuclideanRingElement> _EuclideanRingElement std::__gcd(_EuclideanRingElement, _EuclideanRingElement)'
 1137 |     __gcd(_EuclideanRingElement __m, _EuclideanRingElement __n)
      |     ^~~~~
/usr/include/c++/14/bits/stl_algo.h:1137:5: note:   template argument deduction/substitution failed:
a.cc:19:26: note:   deduced conflicting types for parameter '_EuclideanRingElement' ('long long int' and 'int')
   19 |         cout<<(n*2)/__gcd(n,2);
      |                     ~~~~~^~~~~
Language: C

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


using namespace std;
#define MAX 100000

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

    if (0 == N % 2){
        printf("%d", N);
    }
    else{
        printf("%d", N * 2);
    }

    return 0;

}

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

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  if(n%2==0) cout<<n<<endl;
  else cout<<N*2<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:14: error: 'N' was not declared in this scope
    7 |   else cout<<N*2<<endl;
      |              ^
Language: C++

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

int main()
{
  	cin>>n;
  	if(n%2==0)
      cout<<n<<endl;
  	else
      cout<<2*n<<endl;
  	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:14: error: 'n' was not declared in this scope; did you mean 'yn'?
    6 |         cin>>n;
      |              ^
      |              yn
Language: Java

import java.util.Scanner;

public class MAin {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		long N = scan.nextLong();
		if(N % 2 == 0) {
			System.out.println(N);
		}else {
			System.out.println(N * 2);
		}
		scan.close();
	}
}

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

#include <bits/stdc++.h>
using namespace std;
int main() {
    int N;
    cin >> N:
    if (N%2 == 0) {
        cout << N;
    }else if {
        cout << N*2;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:13: error: expected ';' before ':' token
    5 |     cin >> N:
      |             ^
      |             ;
a.cc:8:6: error: 'else' without a previous 'if'
    8 |     }else if {
      |      ^~~~
a.cc:8:14: error: expected '(' before '{' token
    8 |     }else if {
      |              ^
      |              (
Language: C++

int main() {
    int n;
    cin >> n;
    if(n % 2 == 0){ cout << n;}
    else{cout << n * 2;}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:5: error: 'cin' was not declared in this scope
    3 |     cin >> n;
      |     ^~~
a.cc:4:21: error: 'cout' was not declared in this scope
    4 |     if(n % 2 == 0){ cout << n;}
      |                     ^~~~
a.cc:5:10: error: 'cout' was not declared in this scope
    5 |     else{cout << n * 2;}
      |          ^~~~
Language: C++

//
//
///
//

#include "bits/stdc++.h"
using namespace std;
#define ri(a,b,c) for(int a=(b);a<(c);++a)
typedef long long ll;
#define fcout cout << fixed << setprecision(10)
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z;
    cin>>a;
















    cout<<a%2?a*2:a<<"\n";

    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:33:20: error: invalid operands of types 'int' and 'const char [2]' to binary 'operator<<'
   33 |     cout<<a%2?a*2:a<<"\n";
      |                   ~^~~~~~
      |                   |  |
      |                   |  const char [2]
      |                   int
Language: C++

#include <bits/stdc++.h>

using namespace std;

#define inf 1<<30
#define llong long long
#define usd unsigned
#define pqueue priority_queue
#define mp make_pair
#define pb push_back
#define fn fill_n
typedef pair<int, int> P;
typedef struct data{
	int now;
	int cost;
}data;
int nw[9] = {0, 1, 0, -1, -1, 1, 1, -1, 0};
int nh[9] = {1, 0, -1, 0, 1, 1, -1, -1, 0};
int a,b,c,d, A[100], B[100], C[100][100], D[100][100][100];
string s, t, r;




int main(){
	cin >> a;
	cout << a%2?a*2:a << endl;
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:27: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
   27 |         cout << a%2?a*2:a << endl;
      |                         ~~^~~~~~~
Language: C++

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

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

  int A;
  vector<int> A(N);
  int min_a = INT_MAX;
  int max_a = -INT_MAX;
  rep(i, N) {
    cin >> A;
    min_a = min(min_a, A);
    max_a = max(max_a, A);
  }

  cout << max_a - min_a << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:15: error: conflicting declaration 'std::vector<int> A'
   11 |   vector<int> A(N);
      |               ^
a.cc:10:7: note: previous declaration as 'int A'
   10 |   int A;
      |       ^
Language: C++

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

int main() {

    int N;
    cin >> N;
    int A[101];
    int Max = 0, Min = 100000000;
    for (int i = 1; i <= N; i++) {
        cin >> A[i];
        Max = max(Max, A[i]);
        Min = min(Min,A[i]);
    }
    cout << Max - Min << endl;
    return 0;
}

Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

    /**   Created by: Marcos Portales
          Codeforces User: marcosportales
          Country: Cuba
                         **/
#include<bits/stdc++.h>
using namespace std;
/// Macros:
#define int long long
#define f first
#define s second
#define db(x) cerr << #x << ": " << (x) << '\n';
#define pb push_back
#define lb lower_bound
#define up upper_bound
#define all(x) x.begin() , x.end()
#define rall(x) x.rbegin() , x.rend()
#define enl '\n'
#define vi vector<int>
#define sz size
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
typedef pair<int,int> ii;
typedef long double ld;
typedef unsigned long long ull;
/// Constraints:
const int maxn = 3*1e5+5;
const int mod = 1000000009;
const ld eps = 1e-9;
const int inf = ((1ll<<31ll)-1ll);
const int INF = 10000000000000000ll;
const ld pi = acos(-1);
/// Prime Numbers:
// 2, 173, 179, 181, 197, 311, 331, 737, 1009, 2011, 2027, 3079, 4001, 10037, 10079, 20011, 20089;
// 100003, 100019, 100043, 200003, 200017, 1000003, 1000033, 1000037, 1000081;
// 2000003, 2000029, 2000039, 1000000007, 1000000021, 2000000099;
/// Functions:
#define lg2(x) 31 - __builtin_clz(x)
#define lgx(x,b) ( log(x) / log(b) )
/// Red-Black Tree Template ---------------------------------
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//typedef tree < long long ,  null_type ,  less<long long> ,  rb_tree_tag ,  tree_order_statistics_node_update > ordered_set;
/// Quick Pow------------------------------------------------
int qpow(int b,int e){
    if( !e ) return 1;
    if( e & 1 ) return qpow(b,e-1) * b;
    int pwur = qpow(b,e>>1);
    return pwur * pwur;
}
int modinv(int x){
    return qpow(x,mod-2);
}

/// My Code -------------------------------------------------

int32_t main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout.setf(ios::fixed); cout.precision(0);
    srand(time(NULL));

    ///freopen("a.in","r",stdin);
    ///freopen("a.out","w",stdout);
    int n;
    cin>>n;
    vi v(n);
    rep(i,n)cin>>v[i];
    sort(all(v));
    cout<<a[n-1]-a[0]<<enl;


    return 0;
}


Compiler output:
a.cc: In function 'int32_t main()':
a.cc:69:11: error: 'a' was not declared in this scope
   69 |     cout<<a[n-1]-a[0]<<enl;
      |           ^
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[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;
}
#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[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:27:5: error: redefinition of 'int main()'
   27 | int main(){
      |     ^~~~
a.cc:5:5: note: 'int main()' previously defined here
    5 | int main(){
      |     ^~~~
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[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;
}
#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[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:27:5: error: redefinition of 'int main()'
   27 | int main(){
      |     ^~~~
a.cc:5:5: note: 'int main()' previously defined here
    5 | int main(){
      |     ^~~~
a.cc:45:1: error: '\U000063d0\U000051fa\U000060c5\U00005831' does not name a type
   45 | 提出情報
      | ^~~~~~~~
Language: C++


#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
//二項係数の計算
int nCr(int A, int B) {
    ll ans = 1;
    for (int i = 0; i < B; i++) {
        ans *= A - i;
    }
    for (int i = 0; i < B; i++) {
        ans /= i + 1;
    }
    return ans;
}
int main() {
    ll N;
  cin>>N;
  ll ans=0;
  vector<ll>A(N);
  rep(i,N){
cin>>A[i];
  }
  sort(A.begin,A.end());
  ans=abs(A[N-1]-A[0]);
  cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:7: error: no matching function for call to 'sort(<unresolved overloaded function type>, std::vector<long long int>::iterator)'
   26 |   sort(A.begin,A.end());
      |   ~~~~^~~~~~~~~~~~~~~~~
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: 'void std::sort(_RAIter, _RAIter) [with _RAIter = __gnu_cxx::__normal_iterator<long long int*, vector<long long int> >]'
 4762 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last)
      |     ^~~~
/usr/include/c++/14/bits/stl_algo.h:4762:32: note:   no known conversion for argument 1 from '<unresolved overloaded function type>' to '__gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >'
 4762 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last)
      |          ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
/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:   candidate expects 3 arguments, 2 provided
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, 2 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:   candidate expects 3 arguments, 2 provided
Language: C++

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

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

}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:10: error: 'i' was not declared in this scope
   15 |     if(a[i]<a[i+1])y=a[i+1];
      |          ^
a.cc: At global scope:
a.cc:17:3: error: 'cout' does not name a type
   17 |   cout << y-x << endl;
      |   ^~~~
a.cc:19:1: error: expected declaration before '}' token
   19 | }
      | ^
Language: C++

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

int main(){
int N,a;
  cin >> N;
  int x,y;
  
  for(int i=0;i<N;i++) {
    cin >> a[i];
    x=a[0];
    y=a[0];
    if(a[i]>a[i+1])x=a[i+1];
    if(a[i]<a[i+1])y=a[i+1];
  }
  cout << y-x << endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:13: error: invalid types 'int[int]' for array subscript
   10 |     cin >> a[i];
      |             ^
a.cc:11:8: error: invalid types 'int[int]' for array subscript
   11 |     x=a[0];
      |        ^
a.cc:12:8: error: invalid types 'int[int]' for array subscript
   12 |     y=a[0];
      |        ^
a.cc:13:9: error: invalid types 'int[int]' for array subscript
   13 |     if(a[i]>a[i+1])x=a[i+1];
      |         ^
a.cc:13:14: error: invalid types 'int[int]' for array subscript
   13 |     if(a[i]>a[i+1])x=a[i+1];
      |              ^
a.cc:13:23: error: invalid types 'int[int]' for array subscript
   13 |     if(a[i]>a[i+1])x=a[i+1];
      |                       ^
a.cc:14:9: error: invalid types 'int[int]' for array subscript
   14 |     if(a[i]<a[i+1])y=a[i+1];
      |         ^
a.cc:14:14: error: invalid types 'int[int]' for array subscript
   14 |     if(a[i]<a[i+1])y=a[i+1];
      |              ^
a.cc:14:23: error: invalid types 'int[int]' for array subscript
   14 |     if(a[i]<a[i+1])y=a[i+1];
      |                       ^
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.back() - A.front();
  return 0;
}

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

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int N, max;
  	cin >> N;
  	int a[N];
  	for(int i = 0; i < N; i++){
    	cin >> a[N];
    }
  	sort(a.begin() , a.end());
   max = a[N - 1] - a[0];
  cout << max << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:16: error: request for member 'begin' in 'a', which is of non-class type 'int [N]'
   11 |         sort(a.begin() , a.end());
      |                ^~~~~
a.cc:11:28: error: request for member 'end' in 'a', which is of non-class type 'int [N]'
   11 |         sort(a.begin() , a.end());
      |                            ^~~
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, greater<int>());
  
  cout << A[0] - A[N-1] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   11 |   sort(A, A + N, greater<int>());
      |   ^~~~
      |   short
Language: C++

#include <bits/stdc++.h>

using namespace std;
typedef long long int ll;
typedef pair<int, int> ii;
#define DEBUG freopen("in.txt", "r", stdin);

struct fastio {
    fastio() {
        ios::sync_with_stdio(false);
        cout << setprecision(10) << fixed;
        cin.tie(0);
    }
};

fastio _fast_io;

int n;

int main() {
    cin >> n;
    int mi = 1e9;
    int mx = 1;
    for (int i = 0; i < n; ++i) {
        cin >> t;
        mi = min(mi, t);
        mx = max(mx, t);
    }
    cout << mx - mi << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:16: error: 't' was not declared in this scope
   25 |         cin >> t;
      |                ^
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[i];
  	cout << *max_element(a.begin(), a.end()) - *min_element(a.begin(), a.end()) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:18: error: 'max_element' was not declared in this scope
   10 |         cout << *max_element(a.begin(), a.end()) - *min_element(a.begin(), a.end()) << endl;
      |                  ^~~~~~~~~~~
a.cc:10:53: error: 'min_element' was not declared in this scope
   10 |         cout << *max_element(a.begin(), a.end()) - *min_element(a.begin(), a.end()) << endl;
      |                                                     ^~~~~~~~~~~
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[i];
  	sort(a.begin(), a.end());
  	cout << a[a.size()-1] - a[0] << endl;
}

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

#include<iostream>
using namespace std;
int main(){
  int N, a, i, A[100];
  cin >> N;
  while(cin >> a){
    A[i] = a;
    i++
  }
  int min=A[0], max=A[0]; 
  for(int j=1; j++; j<N){
    if(A[j] < min) min = A[j];
    if(A[j] > max) max = A[j];
  }
  cout << abs(max - min);
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:8: error: expected ';' before '}' token
    8 |     i++
      |        ^
      |        ;
    9 |   }
      |   ~
Language: C++

#include<iostream>
using namespace std;
void main{
  int N, a, i, A[100];
  cin >> N;
  while(cin >> a){
    A[i] = a;
    i++
  }
  int min=A[0], max=A[0]; 
  for(int j=1; j++; j<N){
    if(A[j] < min) min = A[j];
    if(A[j] > max) max = A[j];
  }
  cout << abs(max - min);
}


Compiler output:
a.cc:3:6: error: variable or field 'main' declared void
    3 | void main{
      |      ^~~~
a.cc:4:3: error: expected primary-expression before 'int'
    4 |   int N, a, i, A[100];
      |   ^~~
a.cc:4:3: error: expected '}' before 'int'
a.cc:3:10: note: to match this '{'
    3 | void main{
      |          ^
a.cc:5:3: error: 'cin' does not name a type
    5 |   cin >> N;
      |   ^~~
a.cc:6:3: error: expected unqualified-id before 'while'
    6 |   while(cin >> a){
      |   ^~~~~
a.cc:10:11: error: 'A' was not declared in this scope
   10 |   int min=A[0], max=A[0];
      |           ^
a.cc:11:3: error: expected unqualified-id before 'for'
   11 |   for(int j=1; j++; j<N){
      |   ^~~
a.cc:11:16: error: 'j' does not name a type
   11 |   for(int j=1; j++; j<N){
      |                ^
a.cc:11:21: error: 'j' does not name a type
   11 |   for(int j=1; j++; j<N){
      |                     ^
a.cc:15:3: error: 'cout' does not name a type
   15 |   cout << abs(max - min);
      |   ^~~~
a.cc:16:1: error: expected declaration before '}' token
   16 | }
      | ^
Language: C

#include<stdio.h>
int main(){
  int n,a=1<<29,b=0,t,i;
  scanf("%d",&n);
  for(i=0;i<n;i++){scanf("%d",&t);a=a<t?a:t;b=b<t?y:b;}
  printf("%d",b-a);
}


Compiler output:
main.c: In function 'main':
main.c:5:51: error: 'y' undeclared (first use in this function)
    5 |   for(i=0;i<n;i++){scanf("%d",&t);a=a<t?a:t;b=b<t?y:b;}
      |                                                   ^
main.c:5:51: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include <iostream>
using namespace std;
int main()
{
  int N;
  cin >> N;
  int min = 1000000000;
  int max = 1;
  for (int i = 0; i < N; i++) {
    int A;
    cin >> A;
    if (a > max) max = a;
    if (a < min) min = a;
  }
  cout << max-min << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:9: error: 'a' was not declared in this scope
   12 |     if (a > max) max = a;
      |         ^
a.cc:13:9: error: 'a' was not declared in this scope
   13 |     if (a < min) min = a;
      |         ^
Language: C++

#include<bits/stdc++.h>
#include<cstdlib>
#include<cmath>
using namespace std;
int main(){
  int N; cin>>N;
  vetor<int>S(N);
  for(int i=0; i<N;i++){
    cin>>S.at(i);
  }

  sort(S.begin(),S.end());
  int Ans=abs(S.at(1)-S.at(0));
  for(int i=1; i<N-1; i++){
    if(abs(S.at(i+1)-S.at(i))>Ans)
      Ans=abs(S.at(i+1)-S.at(i));
    else continue;
  }
  cout<<Ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: 'vetor' was not declared in this scope
    7 |   vetor<int>S(N);
      |   ^~~~~
a.cc:7:9: error: expected primary-expression before 'int'
    7 |   vetor<int>S(N);
      |         ^~~
a.cc:9:10: error: 'S' was not declared in this scope
    9 |     cin>>S.at(i);
      |          ^
a.cc:12:8: error: 'S' was not declared in this scope
   12 |   sort(S.begin(),S.end());
      |        ^
Language: C++

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

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

 vector<int>B(N)=sort(A.begin(), A.end());
  
 cout<<B.at(N)-B.at(0)<<endl;

return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:17: error: expected ',' or ';' before '=' token
   17 |  vector<int>B(N)=sort(A.begin(), A.end());
      |                 ^
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:10:12: error: request for member 'begin' in 'A', which is of non-class type 'int [N]'
   10 |     sort(A.begin(), A.end())
      |            ^~~~~
a.cc:10:23: error: request for member 'end' in 'A', which is of non-class type 'int [N]'
   10 |     sort(A.begin(), A.end())
      |                       ^~~
a.cc:10:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   10 |     sort(A.begin(), A.end())
      |     ^~~~
      |     short
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
using ll = long long;
using vin=vector<int>;
using vll=vector<ll>;
using P = pair<int, int>;
const int inf=1e9+7;
const ll INF=1e18;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

int main() {
int n;
  cin>>n;
  vin a(n);
  rep(i,0,n){
    cin>>a[i]; 
  }
  ll mn=0;
  rep(i,0,n-1){
     rep(j,i+1,n){
       mn=max(mn,abs(a[i]-a[j]));
     }
  }
  cout<<mn<<endl;
}











Compiler output:
a.cc: In function 'int main()':
a.cc:27:14: error: no matching function for call to 'max(ll&, int)'
   27 |        mn=max(mn,abs(a[i]-a[j]));
      |           ~~~^~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: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:   template argument deduction/substitution failed:
a.cc:27:14: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   27 |        mn=max(mn,abs(a[i]-a[j]));
      |           ~~~^~~~~~~~~~~~~~~~~~~
/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, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:27:14: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   27 |        mn=max(mn,abs(a[i]-a[j]));
      |           ~~~^~~~~~~~~~~~~~~~~~~
Language: Java

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

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);
		
      　//入力表示
		int N = sc.nextInt();
      	//Aの配列を作成
		int A[]=new int[N];
		
		for(int i=0;i<A.length;i++) {
			 A[i]=sc.nextInt();

		}
      	//スキャナーに入れたものをきれいに並べる
		Arrays.sort(A);
     　 //最大値から最小値を引く計算
		int ans=A[A.length-1] - A[0];
		
		System.out.println(ans);
	}
}

Compiler output:
Main.java:11: error: illegal character: '\u3000'
      ?//????
      ^
Main.java:22: error: illegal character: '\u3000'
     ? //?????????????
     ^
2 errors
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  vector<int> totori(N);
  for (int i=0;i<N;i++){
  cin>>totori.(i);
 }
sort(totori.begin(), totori.end()); 
    reverse(totori.begin(), totori.end());
  
  cout <<totori.(0) - totori.(N-1)<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:15: error: expected unqualified-id before '(' token
    9 |   cin>>totori.(i);
      |               ^
a.cc:14:17: error: expected unqualified-id before '(' token
   14 |   cout <<totori.(0) - totori.(N-1)<<endl;
      |                 ^
a.cc:14:30: error: expected unqualified-id before '(' token
   14 |   cout <<totori.(0) - totori.(N-1)<<endl;
      |                              ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  vector<int> totori(N);
  for (int i=0;i<N;i++){
  cin>>totori.(i);
 }
sort(totori.begin(), totori.end()); 
    reverse(totori.begin(), totori.end());
  
  cout <<totori.(0) - totori.(N)<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:15: error: expected unqualified-id before '(' token
    9 |   cin>>totori.(i);
      |               ^
a.cc:14:17: error: expected unqualified-id before '(' token
   14 |   cout <<totori.(0) - totori.(N)<<endl;
      |                 ^
a.cc:14:30: error: expected unqualified-id before '(' token
   14 |   cout <<totori.(0) - totori.(N)<<endl;
      |                              ^
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <map> 
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i=0;i < (int)(n);i++)

 
int main(){
  int n;
  cin >> n;
  int ans = 0;
  vector<int> a(n);
  rep(i,n) 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]);
    }
  }
  return 0; 
}



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

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define eps 1e-9
#define maxp 1000400
#define mod 1000000007
#define pi 3.141592653589793238
#define sin(s) scanf("%lld",&s);
#define sout(s) printf("%lld\n",s);
#define in(s) cin>>s
#define in2(a,b) cin>>a>>b
#define in3(a,b,c) cin>>a>>b>>c
#define vll vector<ll>
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define endl '\n'
#define sp ' '
#define gear_change ios_base::sync_with_stdio(false),cin.tie(0)
#define nfl(i,n) for(i=0;i<n;i++)
#define sfl(i,s,e) for(i=s;i<e;i++)
#define ufl(i,n) for(i=n-1;i>=0;i--)
ll power(ll x,ll y){
    ll ret=1;
    while(y>0){
        if(y&1)
            ret=(ret*x);
        y/=2;
        x=(x*x);
    }
    return ret;
}
ll get(ll n){
	ll ret=0;
	while(n){
		ret+=n%10;
		n/=10;
	}
	return ret;
}
void solve(){
	ll n,k,i,pos=0;
	cin>>n>>k;
	vll vec(n);
	ll mn=INT_MAX:
	ll mx=INT_MIN;
	nfl(i,n){
		in(vec[i]);
		mx=max(mx,vec[i]);
		mn=min(mn,vec[i]);
	}	
	cout<<mx-mn<<endl;
}	
int main(){
	gear_change;
	ll test=1;
	// in(test);
	while(test--){
		solve();
	}
}	


Compiler output:
a.cc: In function 'void solve()':
a.cc:47:22: error: expected ',' or ';' before ':' token
   47 |         ll mn=INT_MAX:
      |                      ^
a.cc:51:17: error: 'mx' was not declared in this scope; did you mean 'mn'?
   51 |                 mx=max(mx,vec[i]);
      |                 ^~
      |                 mn
a.cc:54:15: error: 'mx' was not declared in this scope; did you mean 'mn'?
   54 |         cout<<mx-mn<<endl;
      |               ^~
      |               mn
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 a = sc.nextInt();
     int b = sc.nextInt();
     int c = sc.nextInt();
     int d = sc.nextInt();
     // int a = 1;
     // int b = 2;
     // int c = 3;
     // int d = 4;
     int answer = 0;

     if(()(a<c)&&(c<b))&&(b<d)){
       answer = b-c;
     }else if(b<c){
       answer = 0;
     }else if(()(c<a)&&(a<d))&&(d<b)){
       answer = d-a;
     }else{
       answer = 0;
     }
     System.out.println(answer);
  }

}

Compiler output:
Main.java:17: error: -> expected
     if(()(a<c)&&(c<b))&&(b<d)){
          ^
Main.java:17: error: illegal start of expression
     if(()(a<c)&&(c<b))&&(b<d)){
                       ^
Main.java:17: error: ';' expected
     if(()(a<c)&&(c<b))&&(b<d)){
                              ^
Main.java:21: error: -> expected
     }else if(()(c<a)&&(a<d))&&(d<b)){
                ^
Main.java:21: error: illegal start of expression
     }else if(()(c<a)&&(a<d))&&(d<b)){
                             ^
Main.java:21: error: ';' expected
     }else if(()(c<a)&&(a<d))&&(d<b)){
                                    ^
Main.java:19: error: 'else' without 'if'
     }else if(b<c){
      ^
Main.java:23: error: 'else' without 'if'
     }else{
      ^
8 errors
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 a = sc.nextInt();
     int b = sc.nextInt();
     int c = sc.nextInt();
     int d = sc.nextInt();
     // int a = 1;
     // int b = 2;
     // int c = 3;
     // int d = 4;
     // int answer = 0;

     if((a<c)&&(c<b)&&(b<d)){
       answer = b-c;
     }else if(b<c){
       answer = 0;
     }else if((c<a)&&(a<d)&&(d<b)){
       answer = d-a;
     }else{
       answer = 0;
     }
     System.out.println(answer);
  }

}

Compiler output:
Main.java:18: error: cannot find symbol
       answer = b-c;
       ^
  symbol:   variable answer
  location: class Main
Main.java:20: error: cannot find symbol
       answer = 0;
       ^
  symbol:   variable answer
  location: class Main
Main.java:22: error: cannot find symbol
       answer = d-a;
       ^
  symbol:   variable answer
  location: class Main
Main.java:24: error: cannot find symbol
       answer = 0;
       ^
  symbol:   variable answer
  location: class Main
Main.java:26: error: cannot find symbol
     System.out.println(answer);
                        ^
  symbol:   variable answer
  location: class Main
5 errors
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 a = sc.nextInt();
     int b = sc.nextInt();
     int c = sc.nextInt();
     int d = sc.nextInt();
     // int a = 1;
     // int b = 2;
     // int c = 3;
     // int d = 4;
     // int answer = 0;

     if((a<c)&&(c<b)&&(b<d)){
       answer = b-c;
     }else if(b<c)){
       answer = 0;
     }else if((c<a)&&(a<d)&&(d<b)){
       answer = d-a;
     }else{
       answer = 0;
     }
     System.out.println(answer);
  }

}

Compiler output:
Main.java:19: error: illegal start of expression
     }else if(b<c)){
                  ^
Main.java:21: error: 'else' without 'if'
     }else if((c<a)&&(a<d)&&(d<b)){
      ^
2 errors
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 a = sc.nextInt();
     int b = sc.nextInt();
     int c = sc.nextInt();
     int d = sc.nextInt();
     // int a = 1;
     // int b = 2;
     // int c = 3;
     // int d = 4;
     // int answer = 0;

     if((a<c)&&(c<b)&&(b<d)){
       answer = b-c;
     }else if(b<c)){
       answer = 0;
     }else if((c<a)&&(a<d)&&(d<b)){
       answer = d-a;
     }else if((d<a)){
       answer = 0;
     }
     System.out.println(answer);
  }

}

Compiler output:
Main.java:19: error: illegal start of expression
     }else if(b<c)){
                  ^
Main.java:21: error: 'else' without 'if'
     }else if((c<a)&&(a<d)&&(d<b)){
      ^
2 errors
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 a = sc.nextInt();
     int b = sc.nextInt();
     int c = sc.nextInt();
     int d = sc.nextInt()
     // int a = 1;
     // int b = 2;
     // int c = 3;
     // int d = 4;
     // int answer = 0;

     if((a<c)&&(c<b)&&(b<d)){
       answer = b-c;
     }else if(b<c)){
       answer = 0;
     }else if((c<a)&&(a<d)&&(d<b)){
       answer = d-a;
     }else if((d<a)){
       answer = 0;
     }
     System.out.println(answer);
  }

}

Compiler output:
Main.java:10: error: ';' expected
     int d = sc.nextInt()
                         ^
Main.java:19: error: illegal start of expression
     }else if(b<c)){
                  ^
Main.java:21: error: 'else' without 'if'
     }else if((c<a)&&(a<d)&&(d<b)){
      ^
3 errors
Language: C++

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

int main(){
    int n;
    cin >> n;
    int mini = 10 ** 9,maxa = 0;
    for(int i = 0; i < n; i++) {
        int a; cin >> a;
        mini = min(mini,a);
        maxa = max(maxa,a);
    }
    cout << maxa - mini << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:20: error: invalid type argument of unary '*' (have 'int')
    7 |     int mini = 10 ** 9,maxa = 0;
      |                    ^~~
a.cc:11:9: error: 'maxa' was not declared in this scope
   11 |         maxa = max(maxa,a);
      |         ^~~~
a.cc:13:13: error: 'maxa' was not declared in this scope
   13 |     cout << maxa - mini << endl;
      |             ^~~~
Language: C++

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

int main(){
    int n;
    int a[100];
    cin >> n;
    for(int i = 0; i < n; i++) cin >> a[i];
    sort(a.begin(), a.end());
    int s = a.size();
    int c = a[s - 1] - a[0];
    cout << c << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:12: error: request for member 'begin' in 'a', which is of non-class type 'int [100]'
    9 |     sort(a.begin(), a.end());
      |            ^~~~~
a.cc:9:23: error: request for member 'end' in 'a', which is of non-class type 'int [100]'
    9 |     sort(a.begin(), a.end());
      |                       ^~~
a.cc:10:15: error: request for member 'size' in 'a', which is of non-class type 'int [100]'
   10 |     int s = a.size();
      |               ^~~~
Language: C++

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

int main(){
    int n;
    int a[100];
    cin >> n;
    for(int i = 0; i < n; i++) cin >> a[i];
    sort(a.begin(), a.end())
    int s = a.size()
    int c = a[s - 1] - a[0];
    cout << c << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:12: error: request for member 'begin' in 'a', which is of non-class type 'int [100]'
    9 |     sort(a.begin(), a.end())
      |            ^~~~~
a.cc:9:23: error: request for member 'end' in 'a', which is of non-class type 'int [100]'
    9 |     sort(a.begin(), a.end())
      |                       ^~~
a.cc:12:13: error: 'c' was not declared in this scope
   12 |     cout << c << 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);
  }
  sort(A.begin(),A.end());
  cout<<A.at(N-1)-A.at(0)<<endl;
}


Compiler output:
a.cc:7:23: error: stray '`' in program
    7 |   for(int i=0;i<N;i++)`{
      |                       ^
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);
  }
  sort(A.begin(),A.end());
  cout<<A.at(N-1)-A.at(0)<<endl;
}

Compiler output:
a.cc:1:23: warning: extra tokens at end of #include directive
    1 | #include<bits/stdc++>h>
      |                       ^
a.cc:1:9: fatal error: bits/stdc++>: No such file or directory
    1 | #include<bits/stdc++>h>
      |         ^~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<int> vec(n);
  for(int i=0;i<n;i++){
    cin>>vec.at(i);}
  sort(vec.bigin(),vec.end());
  cout<<vec.at(n-1)-vec.at(0)<<endl;}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:9:12: error: 'class std::vector<int>' has no member named 'bigin'; did you mean 'begin'?
    9 |   sort(vec.bigin(),vec.end());
      |            ^~~~~
      |            begin
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<int> vec(n);
  cin>>vec(n);
  sort(vec.bigin(),vec.end());
  cout<<vec.at(n-1)-vec.at(0)<<endl;}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:7:11: error: no match for call to '(std::vector<int>) (int&)'
    7 |   cin>>vec(n);
      |        ~~~^~~
a.cc:8:12: error: 'class std::vector<int>' has no member named 'bigin'; did you mean 'begin'?
    8 |   sort(vec.bigin(),vec.end());
      |            ^~~~~
      |            begin
Language: C

#include <stdio.h>
 
int main(void)
{
    int n,,a[100],x,max,min,i;
   
      
    scanf("%d",&n);
  
    for(i=0;i<n;i++){
        scanf("%d",&a[i]);
    }
    
    max=a[0]; min=a[0];
  
    for(i=0;i<n;i++){
        if(max<a[i])       max=a[i];
        else if(min>a[i])  min=a[i];
    }
  
    x=max-min;
  
    printf("%d",x);
  
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:5:11: error: expected identifier or '(' before ',' token
    5 |     int n,,a[100],x,max,min,i;
      |           ^
main.c:10:9: error: 'i' undeclared (first use in this function)
   10 |     for(i=0;i<n;i++){
      |         ^
main.c:10:9: note: each undeclared identifier is reported only once for each function it appears in
main.c:11:21: error: 'a' undeclared (first use in this function)
   11 |         scanf("%d",&a[i]);
      |                     ^
main.c:14:5: error: 'max' undeclared (first use in this function)
   14 |     max=a[0]; min=a[0];
      |     ^~~
main.c:14:15: error: 'min' undeclared (first use in this function); did you mean 'main'?
   14 |     max=a[0]; min=a[0];
      |               ^~~
      |               main
main.c:21:5: error: 'x' undeclared (first use in this function)
   21 |     x=max-min;
      |     ^
Language: C++

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

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

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

#include <iostream>
#include <cmath>

using namespace std;

int main()
{
  int max,min
  int n;
  
  cin >> n;
  scanf("%d", &max);
  min = max;
  --n;
  while(n--) {
    int tmp;
    scanf("%d", &tmp);
    if ( tmp < min ) min = tmp;
    if ( tmp > max ) max = tmp;
  }
  
  cout << abs(min-max) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:3: error: expected initializer before 'int'
    9 |   int n;
      |   ^~~
a.cc:11:10: error: 'n' was not declared in this scope; did you mean 'yn'?
   11 |   cin >> n;
      |          ^
      |          yn
a.cc:13:9: error: overloaded function with no contextual type information
   13 |   min = max;
      |         ^~~
a.cc:18:14: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<'
   18 |     if ( tmp < min ) min = tmp;
      |          ~~~~^~~~~
a.cc:18:28: error: overloaded function with no contextual type information
   18 |     if ( tmp < min ) min = tmp;
      |                            ^~~
a.cc:22:18: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator-'
   22 |   cout << abs(min-max) << 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[i];
  }
  
  int min=a[0], max=[0];
  for (int i = 0; i < N; ++i) {
    if (min > A[i]) min = A[i];
    if (max < A[i]) max = A[i];
  }
  cout << max - min << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:11: error: 'a' was not declared in this scope
   12 |   int min=a[0], max=[0];
      |           ^
a.cc:15:18: error: call to non-'constexpr' function 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = int; _Alloc = std::allocator<int>; reference = int&; size_type = long unsigned int]'
   15 |     if (max < A[i]) max = A[i];
      |                  ^
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:1128:7: note: 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = int; _Alloc = std::allocator<int>; reference = int&; size_type = long unsigned int]' declared here
 1128 |       operator[](size_type __n) _GLIBCXX_NOEXCEPT
      |       ^~~~~~~~
a.cc:15:9: error: parse error in template argument list
   15 |     if (max < A[i]) max = A[i];
      |         ^~~~~~~~~~
a.cc:15:19: error: cannot resolve overloaded function 'max' based on conversion to type 'bool'
   15 |     if (max < A[i]) max = A[i];
      |                   ^
a.cc:15:30: error: overloaded function with no contextual type information
   15 |     if (max < A[i]) max = A[i];
      |                              ^
a.cc:17:15: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator-'
   17 |   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[i];
  }
  
  int min=a[0], max=[0];
  for (int i = 0; i < N; ++i) {
    if (min > a[i]) min = a[i];
    if (max < a[i]) max = a[i];
  }
  cout << max - min << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:11: error: 'a' was not declared in this scope
   12 |   int min=a[0], max=[0];
      |           ^
a.cc:15:9: error: parse error in template argument list
   15 |     if (max < a[i]) max = a[i];
      |         ^~~~~~~~~~
a.cc:15:19: error: cannot resolve overloaded function 'max' based on conversion to type 'bool'
   15 |     if (max < a[i]) max = a[i];
      |                   ^
a.cc:17:15: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator-'
   17 |   cout << max - min << endl;
      |           ~~~~^~~~~
Language: C++

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

int main() {
    int N;
    cin >> N ;
    vector<int> vec(N);

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

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

    cout << vec[N-1] - vec[0] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:34: error: expected ';' before 'cout'
   13 |     sort(vec.begin() , vec.end())
      |                                  ^
      |                                  ;
   14 | 
   15 |     cout << vec[N-1] - vec[0] << endl;
      |     ~~~~
Language: C++

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

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

    sort(NArray, NArray + N);
    
    cout << NArray[N-1] - NArray[0] << endl;

}

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

#include <iostream>
#include <cmath>
#include <vector>

using namespace std;

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

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

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

int main() {
  int n;
  cin >> n;
  
  string a;
  cin >> a;
  
  a.round();
  cout << a[a.size() - 1] - a[0] << endl;
}  

Compiler output:
a.cc: In function 'int main()':
a.cc:11:5: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'round'
   11 |   a.round();
      |     ^~~~~
Language: C++

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

int main(){
    int n;
    cin >> n;
    int A[n];
    for(int i=0;i<n;i++){
        cin >> A[i];
    }
    int ma=A[0];
    int mi =A[0];
    for(int i=0;i<n;i++){
        if(A[i]>ma) ma = A[i];
        if(A[i]<mi) mi = A[i];

    int z;
    z = ma-mi;
    if(z>0)z=z;
    else z = -z;
    cout << z << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:2: error: expected '}' at end of input
   22 | }
      |  ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^