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

#include <stdio.h>
#include <algorithm>
using namespace std;

int main()
{
    long int arr[200010]={0};
    long int arrmin;
    long int dmax;
    int n=0;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%ld",&arr[i]);
        if(i==0){
            arrmin=a[0];
            continue;
        } 
        if(i==1) dmax=arr[1]-arr[0];
        if(arr[i-1]<arr[i]){
            dmax=max(arr[i]-arrmin,dmax);
        }else{
            arrmin=min(arr[i],arrmin);
        }        
    } 
    printf("%ld",dmax);


    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:20: error: 'a' was not declared in this scope
   15 |             arrmin=a[0];
      |                    ^
Language: C++

#include <stdio.h>
#include <algorithm>
using namespace std;
const int MAX = 200010

int main()
{
    int min;
    int dmax=-2000000000;
    int var;
    int n=0;
    scanf("%d",&n);
    lo
    for(int i=0;i<n;i++){
        scanf("%d",&var);
        if(i==1) min=var;
        dmax=max(var-min,dmax);
        min=min(var,min);
    } 
    printf("%d\n",dmax);


    return 0;
}


Compiler output:
a.cc:6:1: error: expected ',' or ';' before 'int'
    6 | int main()
      | ^~~
Language: C++

#include <stdio.h>
#include <algorithm>
using namespace std;
const int MAX = 200010

int main()
{
    int min;
    int dmax=-2000000000;
    int var;
    int n=0;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&var);
        if(i==1) min=var;
        dmax=max(var-min,dmax);
        min=min(var,min);
    } 
    printf("%d\n",dmax);


    return 0;
}


Compiler output:
a.cc:6:1: error: expected ',' or ';' before 'int'
    6 | int main()
      | ^~~
Language: C++

#include <stdio.h>
#include <algorithm>
using namespace std;

int main()
{
    int min;
    int dmax=-2000000000;
    int var;
    int n=0;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&var);
        if(i==0) min=var;
        dmax=max(var-min,dmax);
        min=min(var,min);
    } 
    printf("%d\n",dmax);


    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:16: error: 'min' cannot be used as a function
   16 |         min=min(var,min);
      |             ~~~^~~~~~~~~
Language: C++

#include<iostream>
#include<algorithm>

int main() {
  int R[MAX], n;
  cin >> n;
  for ( int i = 0; i < n; i++ ) cin >> R[i];

  int maxv = -2000000000
  int minv = R[0]

  for ( int i = 1; i < n; i++ ) {
    maxv = max(maxv, R[i] - minv);
    minv = min(minv, R[i]);
  }

  cout << maxv << endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:5:9: error: 'MAX' was not declared in this scope
    5 |   int R[MAX], n;
      |         ^~~
a.cc:6:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    6 |   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:7:40: error: 'R' was not declared in this scope
    7 |   for ( int i = 0; i < n; i++ ) cin >> R[i];
      |                                        ^
a.cc:10:3: error: expected ',' or ';' before 'int'
   10 |   int minv = R[0]
      |   ^~~
a.cc:12:20: error: 'i' was not declared in this scope
   12 |   for ( int i = 1; i < n; i++ ) {
      |                    ^
a.cc:17:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   17 |   cout << maxv << 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:19: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   17 |   cout << maxv << 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>
#include<algorithm>
using namespace std;
static const int MAX = 200000;

int main() {
  int R[MAX], n;
  cin >> n;
  for ( int i = 0; i < n; i++ ) cin >> R[i];

  int maxv = -2000000000
  int minv = R[0]

  for ( int i = 1; i < n; i++ ) {
    maxv = max(maxv, R[i] - minv);
    minv = min(minv, R[i]);
  }

  cout << maxv << endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:3: error: expected ',' or ';' before 'int'
   12 |   int minv = R[0]
      |   ^~~
a.cc:14:20: error: 'i' was not declared in this scope
   14 |   for ( int i = 1; i < n; i++ ) {
      |                    ^
Language: C++

#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
using namespace std;
using ll = long long;
map <int ,int> mpa,mpb;

int main (){
  int N;
  cin >> N;
  int R[N];
  for(int i=0;i<N;i++){
    cin >> R[N];
  }
  int min_a=R[0];
  for(int i=1;i<N-1;i++){
    ans=max(R[i]-min_a,ans);
    min_a=min(min_a,R[i]);
  }

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


Compiler output:
a.cc: In function 'int main()':
a.cc:24:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   24 |     ans=max(R[i]-min_a,ans);
      |     ^~~
      |     abs
a.cc:28:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   28 |   cout << ans << endl;
      |           ^~~
      |           abs
Language: C++

#include <iostream>
using namespace std;
int main(void){
    int n, R[200001];
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> R[i];
    }
    int minv = R[0];
    int maxv = -1000000001;
    for(int j = i + 1; j < n; j++){
        if(R[j] - minv > maxv) maxv = R[j] - minv;
        if(R[j] < minv) minv = R[j];
    }
    
    cout << maxv << endl;
    
    return 0;
}



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

#include <iostream>
#include <queue>
#include <stack>
#include <cstdio>
#include <vector>
#include <sstream>

using namespace std;

const int N_MAX = numeric_limits<int>::max();

int maxprofit(vector<int> arr){
  int tmp_min = arr[0];
  int max_profit = -N_MAX;
  for(int i=1; i<arr.size(); i++){
    max_profit = max(max_profit, arr[i] - tmp_min);
    if(arr[i] <= tmp_min) tmp_min = arr[i];
  }
  return max_profit;
  
}

int main(){
  int n;
  int x;
  vector<int> arr;

  cin >> n;

  for(int i=0; i<n; i++){
    cin >> x;
    arr.push_back(x);
  }
  cout << maxprofit(arr) << endl;
  return 0;
}



Compiler output:
a.cc:10:19: error: 'numeric_limits' was not declared in this scope
   10 | const int N_MAX = numeric_limits<int>::max();
      |                   ^~~~~~~~~~~~~~
a.cc:10:34: error: expected primary-expression before 'int'
   10 | const int N_MAX = numeric_limits<int>::max();
      |                                  ^~~
Language: C++

#include <stdio.h>

int main() {
    int n=0;
    scanf("%d", &n);
    
    int maxdiff=-200000
    int prev=0, now=0;
    for(int i=0; i<n; i++) {
        scanf("%d", now);
        maxdiff = now - prev;
        prev = now;
    }
    
    printf("%d", maxdiff);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:5: error: expected ',' or ';' before 'int'
    8 |     int prev=0, now=0;
      |     ^~~
a.cc:10:21: error: 'now' was not declared in this scope
   10 |         scanf("%d", now);
      |                     ^~~
a.cc:11:25: error: 'prev' was not declared in this scope
   11 |         maxdiff = now - prev;
      |                         ^~~~
Language: C++

#include <stdio.h>

int main() {
    int n=0;
    scanf("%d", &n);
    
    int maxdiff=-200000
    int prev=0, now=0;
    for(int i=0; i<n; i++) {
        scanf("%d", &now);
        maxdiff = now - prev;
        prev = now;
    }
    
    printf("%d", maxdiff);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:5: error: expected ',' or ';' before 'int'
    8 |     int prev=0, now=0;
      |     ^~~
a.cc:10:22: error: 'now' was not declared in this scope
   10 |         scanf("%d", &now);
      |                      ^~~
a.cc:11:25: error: 'prev' was not declared in this scope
   11 |         maxdiff = now - prev;
      |                         ^~~~
Language: C++

#include <stdio.h>

int main() {
    int n=0;
    scanf("%d", &n);
    
    int maxdiff=-200000, diff=0;
    int prev=0, now=0;
    
    scanf("%d", &prev);
    
    for(int i=1; i<n; i++) {
        scanf("%d", &now);
        diff = now - prev;
        if(diff > max_diff) maxdiff = diff;
        prev = now;
    }
    
    printf("%d", maxdiff);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:19: error: 'max_diff' was not declared in this scope; did you mean 'maxdiff'?
   15 |         if(diff > max_diff) maxdiff = diff;
      |                   ^~~~~~~~
      |                   maxdiff
Language: C++

#include <stdio.h>

int main() {
    int n=0;
    scanf("%d", &n);
    
    int maxdiff=-200000, diff=0;
    int prev=0, now=0;
    
    scanf("%d", &prev);
    
    for(int i=1; i<n; i++) {
        scanf("%d", &now);
        diff = now - prev;
        if(diff > max_diff) { maxdiff = diff; }
        prev = now;
    }
    
    printf("%d", maxdiff);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:19: error: 'max_diff' was not declared in this scope; did you mean 'maxdiff'?
   15 |         if(diff > max_diff) { maxdiff = diff; }
      |                   ^~~~~~~~
      |                   maxdiff
Language: C++

#include <stdio.h>
#include <algorithm>
static const int MAX = 200000;

int main() {
    int n, R[MAX];
    
    scanf("%d", &n);
    for ( int i=0; i<n, i++) scanf("%d", &R[i]);
    
    int maxv = -2000000000;
    int minv = R[0];
    
    for (int j=1; j<n-1; j++) {
        for (int i=0; i<j-1; i++) {
            maxv = max(maxv, R[j] - R[i])
        }
    }
    
    printf("%d", maxv);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:28: error: expected ';' before ')' token
    9 |     for ( int i=0; i<n, i++) scanf("%d", &R[i]);
      |                            ^
      |                            ;
a.cc:16:20: error: 'max' was not declared in this scope; did you mean 'std::max'?
   16 |             maxv = max(maxv, R[j] - R[i])
      |                    ^~~
      |                    std::max
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:2:
/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 <stdio.h>
#include <algorithm>
static const int MAX = 200000;

int main() {
    int n, R[MAX];
    
    scanf("%d", &n);
    for ( int i=0; i<n, i++) scanf("%d", &R[i]);
    
    int maxv = -2000000000;
    int minv = R[0];
    
    for (int j=1; j<n-1; j++) {
        for (int i=0; i<j-1; i++) {
            maxv = max(maxv, R[j] - R[i]);
        }
    }
    
    printf("%d", maxv);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:28: error: expected ';' before ')' token
    9 |     for ( int i=0; i<n, i++) scanf("%d", &R[i]);
      |                            ^
      |                            ;
a.cc:16:20: error: 'max' was not declared in this scope; did you mean 'std::max'?
   16 |             maxv = max(maxv, R[j] - R[i]);
      |                    ^~~
      |                    std::max
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:2:
/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 <stdio.h>
#include <algorithm>
static const int MAX = 200000;

int main() {
    int n, R[MAX];
    
    scanf("%d", &n);
    for ( int i=0; i<n; i++) scanf("%d", &R[i]);
    
    int maxv = -2000000000;
    int minv = R[0];
    
    for (int j=1; j<n-1; j++) {
        for (int i=0; i<j-1; i++) {
            maxv = max(maxv, R[j] - R[i]);
        }
    }
    
    printf("%d", maxv);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:20: error: 'max' was not declared in this scope; did you mean 'std::max'?
   16 |             maxv = max(maxv, R[j] - R[i]);
      |                    ^~~
      |                    std::max
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:2:
/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 <stdio.h>
#include <algorithm>
using namespace std;
static const int MAX = 200000;

int main() {
    int n, R[MAX];
    
    scanf("%d", &n);
    for(int i=0; i<n; i++) scanf("%d", &R[i]);
    
    int maxv = -2000000000;
    int minv = R[0];
    
    for (int i=1; i<n; i++) {
        maxv = maxv(maxv, R[i] - minv);
        minv = minv(minv, R[i])
    }
    
    printf("%d", maxv);
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:20: error: 'maxv' cannot be used as a function
   16 |         maxv = maxv(maxv, R[i] - minv);
      |                ~~~~^~~~~~~~~~~~~~~~~~~
a.cc:17:20: error: 'minv' cannot be used as a function
   17 |         minv = minv(minv, R[i])
      |                ~~~~^~~~~~~~~~~~
Language: C++

#include <stdio.h>
#include <algorithm>
using namespace std;
static const int MAX = 200000;

int main() {
    int n, R[MAX];
    
    scanf("%d", &n);
    for(int i=0; i<n; i++) scanf("%d", &R[i]);
    
    int maxv = -2000000000;
    int minv = R[0];
    
    for (int i=1; i<n; i++) {
        maxv = maxv(maxv, R[i] - minv);
        minv = minv(minv, R[i]);
    }
    
    printf("%d", maxv);
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:20: error: 'maxv' cannot be used as a function
   16 |         maxv = maxv(maxv, R[i] - minv);
      |                ~~~~^~~~~~~~~~~~~~~~~~~
a.cc:17:20: error: 'minv' cannot be used as a function
   17 |         minv = minv(minv, R[i]);
      |                ~~~~^~~~~~~~~~~~
Language: C++

//
// Created by yoshihito.hotta on 2018/06/10.
//
#include <iostream>
using namespace std;

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

    int *r;
    r = new int[n];

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

    int minr;
    int maxv;

    minr = r[0];
    maxv  = - INT_MIN;
    for (int i = 0; i < n; i ++) {
        if (r[i] < minr) {
            minr = r[i] ;
        }

        if (r[i] - minr > maxv) {
            maxv = r[i] - minr;
        }
    }

    cout << maxv << endl;


    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:22:15: error: 'INT_MIN' was not declared in this scope
   22 |     maxv  = - INT_MIN;
      |               ^~~~~~~
a.cc:5:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    4 | #include <iostream>
  +++ |+#include <climits>
    5 | using namespace std;
Language: C++

//
// Created by yoshihito.hotta on 2018/06/10.
//
#include <iostream>
#include <climits>
using namespace std;

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

    int *r;
    r = new int[n];

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

    int minr;
    int maxv;

    minr = r[0]
    maxv  = - INT_MIN;
    for (int i = 1; i < n; i ++) {
        if (r[i] < minr) {
            minr = r[i] ;
        }

        if (r[i] - minr > maxv) {
            maxv = r[i] - minr;
        }
    }

    cout << maxv << endl;


    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:22:16: error: expected ';' before 'maxv'
   22 |     minr = r[0]
      |                ^
      |                ;
   23 |     maxv  = - INT_MIN;
      |     ~~~~
Language: C++

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

int main() {
	int n_col;
	cin >> n_col;
	int* p_currency;
	p_currency = new int[n_col];

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

	int max_profit = p_currency[1] - p_currency[0];
	//cout << "first max_profit: " << max_profit << "\n";
	int min = p_currency[0];
	//cout << "first min: " << min << "\n";

	for(int i=1; i<n_col; i++){
		int diff = p_currency[i] - min;

		max_profit = max(max_profit, diff);

		min = min(min, p_currency[i]);

		//cout << "min:" << min << "\n";
		//cout << "max_profit: " << max_profit << "\n";
	}
	cout << max_profit << "\n";
	delete[] p_currency;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:26: error: 'min' cannot be used as a function
   25 |                 min = min(min, p_currency[i]);
      |                       ~~~^~~~~~~~~~~~~~~~~~~~
Language: C++

#include<stdio.h>
#include<algorithm>
using namespace std;
static const int MAX = 200000;

int main()
{
  int R[MAX], n;

  cin >> n;

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

  int maxv = -2000000000;
  int minv = R[0];
  
  for(i = 0 ; i < n ; i++){
    maxv = max(maxv, R[i] - minv);
    minv = min(minv, R[i]);
  }
  
  cout << maxv << endl;

  return 0;
}
	  


Compiler output:
a.cc: In function 'int main()':
a.cc:10:3: error: 'cin' was not declared in this scope
   10 |   cin >> n;
      |   ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include<algorithm>
  +++ |+#include <iostream>
    3 | using namespace std;
a.cc:12:7: error: 'i' was not declared in this scope
   12 |   for(i = 0 ; i < n ; i++){
      |       ^
a.cc:19:7: error: 'i' was not declared in this scope
   19 |   for(i = 0 ; i < n ; i++){
      |       ^
a.cc:24:3: error: 'cout' was not declared in this scope
   24 |   cout << maxv << endl;
      |   ^~~~
a.cc:24:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:24:19: error: 'endl' was not declared in this scope
   24 |   cout << maxv << endl;
      |                   ^~~~
a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    2 | #include<algorithm>
  +++ |+#include <ostream>
    3 | using namespace std;
Language: C++

#include<stdio.h>
#include<bits/stdc++.h>
int main(void){
  int i,N,j,max,big;

  scanf("%d",&N);
  
  int array[N];
  

  for(i=0;i<N;i++){
    scanf("%d",&array[i]);
  }
  
  int ans = 0,min_ = array[0];
  for(int i = 1; i < N; ++i){
    min_ = min(min_, array[i]);
    ans = max(ans, array[i] - min_);
  }
  if(ans == 0) ans = -1;
  printf("%d\n",ans);
  return 0;
  
}



Compiler output:
a.cc: In function 'int main()':
a.cc:17:12: error: 'min' was not declared in this scope; did you mean 'std::min'?
   17 |     min_ = min(min_, array[i]);
      |            ^~~
      |            std::min
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:5696:5: note: 'std::min' declared here
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
a.cc:18:14: error: 'max' cannot be used as a function
   18 |     ans = max(ans, array[i] - min_);
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include<stdio.h>
#include<bits/stdc++.h>
int main(void){
  int N,j,max,big;

  scanf("%d",&N);
  
  int array[1000000];
  

  for(int i=0;i<N;i++){
    scanf("%d",&array[i]);
  }
  
  int ans = 0,min_ = array[0];
  for(int i = 1; i < N; ++i){
    min_ = min(min_, array[i]);
    ans = max(ans, array[i] - min_);
  }
  if(ans == 0) ans = -1;
  printf("%d\n",ans);
  return 0;
  
}



Compiler output:
a.cc: In function 'int main()':
a.cc:17:12: error: 'min' was not declared in this scope; did you mean 'std::min'?
   17 |     min_ = min(min_, array[i]);
      |            ^~~
      |            std::min
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:5696:5: note: 'std::min' declared here
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
a.cc:18:14: error: 'max' cannot be used as a function
   18 |     ans = max(ans, array[i] - min_);
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include<stdio.h>
#include<bits/stdc++.h>
int main(void){
  int N,j;

  scanf("%d",&N);
  
  int array[1000000];
  

  for(int i=0;i<N;i++){
    scanf("%d",&array[i]);
  }
  
  int ans = 0,min_ = array[0];
  for(int i = 1; i < N; ++i){
    min_ = min(min_, array[i]);
    ans = max(ans, array[i] - min_);
  }
  if(ans == 0) ans = -1;
  printf("%d\n",ans);
  return 0;
  
}



Compiler output:
a.cc: In function 'int main()':
a.cc:17:12: error: 'min' was not declared in this scope; did you mean 'std::min'?
   17 |     min_ = min(min_, array[i]);
      |            ^~~
      |            std::min
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:5696:5: note: 'std::min' declared here
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
a.cc:18:11: error: 'max' was not declared in this scope; did you mean 'std::max'?
   18 |     ans = max(ans, array[i] - min_);
      |           ^~~
      |           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 <iostream>

using namespace std;

int main() {
	int n;

	cin >> n;

	int* a = new int[n];

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

	int max = INT_MIN;
	int result = 0;
	for (int i = n - 1; i > 0; i--) {
		for (int j = i - 1; j >= 0; j--) {
			result = a[i] - a[j];
			if (result > max)
				max = result;
		}
	}

	cout << max;

	return 0;
}


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

#include <stdio.h>
int main(){
  int A[20000],i,max=-9999999999,min,a;

  scanf("%d",&a);
  for(i=0;i<a;i++)
    scanf("%d",&A[i]);

  min=A[0];
  
  for(i=1;i<a-i++){
     if(A[i]-min>max)	 max=A[i]-min;
     if(A[i]<min)        min=A[i];
   }

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

  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:3:22: warning: overflow in conversion from 'long int' to 'int' changes value from '-9999999999' to '-1410065407' [-Woverflow]
    3 |   int A[20000],i,max=-9999999999,min,a;
      |                      ^~~~~~~~~~~
a.cc:11:18: error: expected ';' before ')' token
   11 |   for(i=1;i<a-i++){
      |                  ^
      |                  ;
Language: C++

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

using namespace std;

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

	vector<int> mon;

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

	vector<int> mi(n);
	mi[0] = mon[0];
	for (int i = 1; i < n; i++)
	{
		mi[i] = (min(mi[i - 1], mon[i]));
	}

	vector<int> ma(n);
	ma[n - 1] = mon[n - 1];
	for (int i = n - 2; i >= 0; i--)
	{
		ma[i] = max(ma[i + 1], mon[i]);
	}

	int best = INT32_MIN;

	for (int i = 1; i < n - 1; i++)
	{
		int ans = ma[i] - mi[i - 1];
		if (ans > best)
			best = ans;
	}

	cout << best << endl;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:35:20: error: 'INT32_MIN' was not declared in this scope
   35 |         int best = INT32_MIN;
      |                    ^~~~~~~~~
Language: C++

#include <stdio.h>

int main() {
	int n;
	int a[1000000] = {};
	int min;
	int max = -10000000000;

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

	min = a[0];

	for(int j = 1; i < n-1; j++) {
		if(max < a[j] - min) {
			max = a[j] - min;
		}
		if(min > a[j]) {
			min = a[j];
		}
	}

	printf("%d", max);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:19: warning: overflow in conversion from 'long int' to 'int' changes value from '-10000000000' to '-1410065408' [-Woverflow]
    7 |         int max = -10000000000;
      |                   ^~~~~~~~~~~~
a.cc:11:35: error: expected ';' before 'min'
   11 |                 scanf("%d", &a[i])
      |                                   ^
      |                                   ;
   12 | 
   13 |         min = a[0];
      |         ~~~                        
a.cc:15:24: error: 'i' was not declared in this scope
   15 |         for(int j = 1; i < n-1; j++) {
      |                        ^
Language: C++

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


using namespace std;

int main(void)
{
	int n;
	cin >> n;
	double a[2000000];

	double i,max,min;
	max = -1000000000000;
	for (i = 0; i < n; i++)
	{
		scanf("%lf", &a[i]);
	}
	min = a[0];
	for (i = 1; i < n; i++)
	{
		if (max < a[i] - min)
		{
			max = a[i] - min;
		}
		if (min > a[i])
		{
			min = a[i];
		}
		
	}
	printf("%.lf\n",max);
	
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:32: error: invalid types 'double [2000000][double]' for array subscript
   21 |                 scanf("%lf", &a[i]);
      |                                ^
a.cc:26:28: error: invalid types 'double [2000000][double]' for array subscript
   26 |                 if (max < a[i] - min)
      |                            ^
a.cc:28:32: error: invalid types 'double [2000000][double]' for array subscript
   28 |                         max = a[i] - min;
      |                                ^
a.cc:30:28: error: invalid types 'double [2000000][double]' for array subscript
   30 |                 if (min > a[i])
      |                            ^
a.cc:32:32: error: invalid types 'double [2000000][double]' for array subscript
   32 |                         min = a[i];
      |                                ^
Language: C++

#include <stdio.h>
#include <math.h>
using namespace std;

int main() {
  int n;
  scanf("%d", &n);
  ll minv = 1e+9;
  ll ans = 0;
  for (int i = 0; i < n; i++) {
    ll v;
    scanf("%lld", &v);
    ans = max(ans, v - minv);
    minv = min(minv, v);
  }
  printf("%lld\n", ans);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:3: error: 'll' was not declared in this scope
    8 |   ll minv = 1e+9;
      |   ^~
a.cc:9:5: error: expected ';' before 'ans'
    9 |   ll ans = 0;
      |     ^~~~
      |     ;
a.cc:11:7: error: expected ';' before 'v'
   11 |     ll v;
      |       ^~
      |       ;
a.cc:12:20: error: 'v' was not declared in this scope
   12 |     scanf("%lld", &v);
      |                    ^
a.cc:13:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   13 |     ans = max(ans, v - minv);
      |     ^~~
      |     abs
a.cc:13:24: error: 'minv' was not declared in this scope
   13 |     ans = max(ans, v - minv);
      |                        ^~~~
a.cc:16:20: error: 'ans' was not declared in this scope; did you mean 'abs'?
   16 |   printf("%lld\n", ans);
      |                    ^~~
      |                    abs
Language: C++

#include<iostream>
using namespace std;
int main(){
  int n,a,mini,ans=;
  cin>>n>>mini;
  for(int i=0;i<n-1;i++){
    cin>>a;
    if(a-mini>ans)ans=a-mini;
    if(mini>a)mini=a;
  }
  cout<<ans<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:20: error: expected primary-expression before ';' token
    4 |   int n,a,mini,ans=;
      |                    ^
Language: C++


                max = tmp;
            }
        }
    }

    printf("%lld\n", max);

    return 0;
}

Compiler output:
a.cc:2:17: error: 'max' does not name a type
    2 |                 max = tmp;
      |                 ^~~
a.cc:3:13: error: expected declaration before '}' token
    3 |             }
      |             ^
a.cc:4:9: error: expected declaration before '}' token
    4 |         }
      |         ^
a.cc:5:5: error: expected declaration before '}' token
    5 |     }
      |     ^
a.cc:7:11: error: expected constructor, destructor, or type conversion before '(' token
    7 |     printf("%lld\n", max);
      |           ^
a.cc:9:5: error: expected unqualified-id before 'return'
    9 |     return 0;
      |     ^~~~~~
a.cc:10:1: error: expected declaration before '}' token
   10 | }
      | ^
Language: C++

#include<iostream>

int main(){
	int n;
	std::cin >> n;
	int ans = INT_MIN;
	int mini;
	std::cin >> mini;
	for (int i = 1; i < n; ++i){
		int a;
		std::cin >> a;
		if (a - mini>ans)ans = a - mini;
		if (mini>a)mini = a;
	}
	std::cout << ans << std::endl;
	return 0;
}

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

import java.util.Arrays;public class Main { 
	int[] random(int n) {  
		int[] a = new int[n];  
		for(int i = 0; i < n; i++) {   
			a[i] = (int)(Math.random() * 1000);  
			}       return a;   
			} 
	void swap(int[] a, int i, int j) {  
		int temp = a[i];  a[i] = a[j];  a[j] = temp; }
	void bubbleSort(int[] a) {  
		// バブルソート 未完成  for(int f =1; f<a.length; f++)
		{  
			for(int j=1; j<a.length; j++) {
			for(int i = 1; i < a.length; i++) {   
				if(a[i-1] > a[i]) {    swap(a, i-1, i);  
				}  
				}  
			} 
		}
		} 
	void quickSort(int[] a) { 
		// クイックソートを作ります 
		} 
	void main() {  
		int[] a = {5, 3, 1, 9, 8, 0, 4, 2, 7, 6}; 
		//int[] a = random(100); 
		System.out.println("Before: " + Arrays.toString(a)); 
		
		bubbleSort(a);  
		System.out.println("After " + Arrays.toString(a)); 
			public static void main(String[] args) {  
		new Main().main();
		}
	
	}



Compiler output:
Main.java:31: error: illegal start of expression
			public static void main(String[] args) {  
			^
1 error
Language: Java

import java.io.BufferReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main{
  public static final int BIG_NUM= 2000000000;
  public static final int MOD  = 1000000007;

  public static void main(String[] args) {
    BufferReader br=new BufferReader(new InputStreamReader(System.in));

    try{
      int N=Integer.parseInt(br.readLine());
      if(N==1){
        System.out.println(br.readLine());
        System.out.println(0);
                return;
      }

      String tmp_str[]=br.readLine().split("\\s+");
      int array[]=new int[N];

      for(int i=0;i<tmp_str.length;i++){
        for(int k=N-1;k>i+1;k--){
          if(array[k]<array[k-1]){
            work=array[k-1];
            array[k-1]=array[k];
            array[k]=work;
            swap_count++;
          }
        }
      }

      StringBuilder=new StringBuilder();
      sb.append(Integer.toBinaryString(array[0]));
      for(int i=1;i<array.length;i++){
        sb.append(" ").append(Integer.toString(array[i]));
        System.out.println(sb.toString());
            System.out.println(swap_count);
      }catch (NumberFormatException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
} 


Compiler output:
Main.java:40: error: 'catch' without 'try'
      }catch (NumberFormatException e) {
       ^
Main.java:42: error: 'catch' without 'try'
        } catch (IOException e) {
          ^
Main.java:12: error: 'try' without 'catch', 'finally' or resource declarations
    try{
    ^
Main.java:46: error: reached end of file while parsing
} 
 ^
4 errors
Language: Java

import java.util.Scanner;

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

        int n = Integer.parseInt(sc.nextLine());
        int[] array = new int[n];
        String[] input = sc.nextLine().split(" ");
        
        for(int i = 0; i < n; i++){
            array[i] = Integer.parseInt(input[i]);
        }


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

import java.util.Scanner;

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

        int n = Integer.parseInt(sc.nextLine());
        int[] array = new int[n];
        String[] input = sc.nextLine().split(" ");
        
        for(int i = 0; i < n; i++){
            array[i] = Integer.parseInt(input[i]);
        }
    }


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

import java.util.Scanner;

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

        int count = 0;
        int n = Integer.parseInt(sc.nextLine());
        int[] array = new int[n];
        String[] input = sc.nextLine().split(" ");
        
        for(int i = 0; i < n; i++){
            array[i] = Integer.parseInt(input[i]);
        }
        for(int i = 0; i < n-1; i++){
            for(int j = 0; j < n-1; j++){
                if(input[j] > input[j+1]){
                    int tmp = input[j];
                    input[j] = input[j+1];
                    input[j+1] = tmp;
                    count++;
                }
            }
        }
        for(int in: input){
            System.out.print(in+" ");
        }
        
    }
}


Compiler output:
Main.java:17: error: bad operand types for binary operator '>'
                if(input[j] > input[j+1]){
                            ^
  first type:  String
  second type: String
Main.java:18: error: incompatible types: String cannot be converted to int
                    int tmp = input[j];
                                   ^
Main.java:20: error: incompatible types: int cannot be converted to String
                    input[j+1] = tmp;
                                 ^
Main.java:25: error: incompatible types: String cannot be converted to int
        for(int in: input){
                    ^
4 errors
Language: Java

#include <iostream>
using namespace std;

int bubbleSort(int a[],int n){
    int flag=1;
    int c=0;
    for(int i=0;flag;i++){
        flag=0;
        for(int j=n-1;j>i;j--){
            if(a[j-1]>a[j]){
                swap(a[j],a[j-1]);
                flag=1;
                c++;
            }
        }
    }
    return c;
}

int main(void){
    int n;
    cin>>n;
    int a[n];
    string s="";
    for(int i=0;i<n;i++) cin>>a[i];
    int c=bubbleSort(a,n);
    for(int i=0;i<n;i++){
        cout<<s<<a[i];
        s=" ";
    }
    cout<<"\n"<<c<<"\n";
}


Compiler output:
Main.java:1: error: illegal character: '#'
#include <iostream>
^
Main.java:1: error: class, interface, enum, or record expected
#include <iostream>
         ^
Main.java:4: error: unnamed classes are a preview feature and are disabled by default.
int bubbleSort(int a[],int n){
^
  (use --enable-preview to enable unnamed classes)
Main.java:22: error: not a statement
    cin>>n;
       ^
Main.java:23: error: not a statement
    int a[n];
          ^
Main.java:25: error: not a statement
    for(int i=0;i<n;i++) cin>>a[i];
                            ^
Main.java:28: error: not a statement
        cout<<s<<a[i];
               ^
Main.java:31: error: not a statement
    cout<<"\n"<<c<<"\n";
                 ^
Main.java:20: error: <identifier> expected
int main(void){
             ^
Main.java:23: error: ';' expected
    int a[n];
           ^
10 errors
Language: Java

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


public class BubbleSort {

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

        int n = scanner.nextInt();
        int[] nums = new int[n];
        for (int i = 0; i < n; i++) nums[i] = scanner.nextInt();

        bubbleSort(n, nums);
    }

    private static void bubbleSort(int n, int[] a) {
    	boolean flg = true;
    	int i = 0;
    	int sw = 0;
    	while (flg) {
    		flg = false;
    		for (int j = n - 1; j > i; j--) {
    			if (a[j] < a[j-1]) {
    				int w = a[j];
    				a[j] = a[j-1];
    				a[j-1] = w;
    				sw++;
    				flg = true;
    			}
    		}
    		i++;
    	}
    	trace(a);
    	System.out.println(sw);
    }

    private static void trace(int[] nums) {
    	System.out.println(Arrays.toString(nums).replaceAll("[\\[\\],]", ""));
    }

}


Compiler output:
Main.java:5: error: class BubbleSort is public, should be declared in a file named BubbleSort.java
public class BubbleSort {
       ^
1 error
Language: Java

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main{

	public static void main(String[] args) throws NumberFormatException, IOException {
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		//BufferedReader br = new BufferedReader(new FileReader("sample.txt"));
		int n=Integer.parseInt(br.readLine());
		int[] in=new int[n];
		int count=0;
StringTokenizer st=new StringTokenizer(br.readLine());
		for(int i=0;i<n;i++) in[i]=Integer.parseInt(st.nextToken());
		
		for(int i=n;i>0;i--){
			for(int j=1;j<i;j++){
				if(in[j-1]>in[j]){count++;
					int tmp=in[j-1];
					in[j-1]=in[j];
					in[j]=tmp;
				}
			}
		}
StringBuilder stb=new StringBuilder(Integer.toString(in[0]));
for(int i=i;i<n;i++)stb.append(Integer.toString(in[i]));
System.out.println(stb);
		System.out.println(count);




	}

}

Compiler output:
Main.java:15: error: cannot find symbol
StringTokenizer st=new StringTokenizer(br.readLine());
^
  symbol:   class StringTokenizer
  location: class Main
Main.java:15: error: cannot find symbol
StringTokenizer st=new StringTokenizer(br.readLine());
                       ^
  symbol:   class StringTokenizer
  location: class Main
2 errors
Language: Java

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.*;
import java.io.InputStreamReader;

public class Main{

	public static void main(String[] args) throws NumberFormatException, IOException {
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		//BufferedReader br = new BufferedReader(new FileReader("sample.txt"));
		int n=Integer.parseInt(br.readLine());
		int[] in=new int[n];
		int count=0;
StringTokenizer st=new StringTokenizer(br.readLine());
		for(int i=0;i<n;i++) in[i]=Integer.parseInt(st.nextToken());
		
		for(int i=n;i>0;i--){
			for(int j=1;j<i;j++){
				if(in[j-1]>in[j]){count++;
					int tmp=in[j-1];
					in[j-1]=in[j];
					in[j]=tmp;
				}
			}
		}
StringBuilder stb=new StringBuilder(Integer.toString(in[0]));
for(int i=i;i<n;i++)stb.append(Integer.toString(in[i]));
System.out.println(stb);
		System.out.println(count);




	}

}

Compiler output:
Main.java:29: error: variable i might not have been initialized
for(int i=i;i<n;i++)stb.append(Integer.toString(in[i]));
          ^
1 error
Language: Java

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.StringTokenizer;
import java.io.InputStreamReader;

public class Main{

	public static void main(String[] args) throws NumberFormatException, IOException {
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		//BufferedReader br = new BufferedReader(new FileReader("sample.txt"));
		int n=Integer.parseInt(br.readLine());
		int[] in=new int[n];
		int count=0;
StringTokenizer st=new StringTokenizer(br.readLine());
		for(int i=0;i<n;i++) in[i]=Integer.parseInt(st.nextToken());
		
		for(int i=n;i>0;i--){
			for(int j=1;j<i;j++){
				if(in[j-1]>in[j]){count++;
					int tmp=in[j-1];
					in[j-1]=in[j];
					in[j]=tmp;
				}
			}
		}
StringBuilder stb=new StringBuilder(Integer.toString(in[0]));
for(int i=i;i<n;i++)stb.append(Integer.toString(in[i]));
System.out.println(stb);
		System.out.println(count);




	}

}

Compiler output:
Main.java:29: error: variable i might not have been initialized
for(int i=i;i<n;i++)stb.append(Integer.toString(in[i]));
          ^
1 error
Language: Java

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

public class Sort{
    public static void main(String[] args){
	BufferedReader br
	    = new BufferedReader(new InputStreamReader(System.in), 1);
	int n;
	int[] array;
	String[] tmp = null;

	try{
	    n = Integer.parseInt(br.readLine());
	    tmp = br.readLine().split(" ");
	}catch(IOException e){
	    e.getStackTrace();
	}
	if(tmp == null)
	    System.exit(1);

	array = new int[tmp.length];
	for(int i=0; i<tmp.length; i++){
	    array[i] = Integer.parseInt(tmp[i]);
	}
	    
	
	//sort
	int t;
	int cnt = 0;
	for(int i = 0; i < array.length; i++){
	    for(int j = array.length-1; j > i; j--){
		if( array[j] < array[j-1]){
		    t = array[j];
		    array[j] = array[j-1];
		    array[j-1] = t;
		    cnt++;
		}
	    }
	}
	for(int x : array)
	    System.out.print(x+" ");
	System.out.println();
	System.out.println(cnt);
    }
}

Compiler output:
Main.java:4: error: class Sort is public, should be declared in a file named Sort.java
public class Sort{
       ^
1 error
Language: Java

	    for(int j = array.length-1; j > i; j--){
		if( array[j] < array[j-1]){
		    t = array[j];
		    array[j] = array[j-1];
		    array[j-1] = t;
		    cnt++;
		}
	    }
	}
	for(int x : array)
	    System.out.print(x+" ");
	System.out.println();
	System.out.println(cnt);
    }
}

Compiler output:
Main.java:1: error: class, interface, enum, or record expected
	    for(int j = array.length-1; j > i; j--){
	    ^
Main.java:1: error: class, interface, enum, or record expected
	    for(int j = array.length-1; j > i; j--){
	                                ^
Main.java:1: error: class, interface, enum, or record expected
	    for(int j = array.length-1; j > i; j--){
	                                       ^
Main.java:4: error: class, interface, enum, or record expected
		    array[j] = array[j-1];
		    ^
Main.java:5: error: class, interface, enum, or record expected
		    array[j-1] = t;
		    ^
Main.java:6: error: class, interface, enum, or record expected
		    cnt++;
		    ^
Main.java:7: error: class, interface, enum, or record expected
		}
		^
Main.java:12: error: class, interface, enum, or record expected
	System.out.println();
	^
Main.java:13: error: class, interface, enum, or record expected
	System.out.println(cnt);
	^
Main.java:14: error: class, interface, enum, or record expected
    }
    ^
10 errors
Language: Java

import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main2 {
	public static void printArray(List<Integer> array) {
		StringBuilder sb = new StringBuilder();
		sb.append(array.get(0));
		for (int j = 1; j < array.size(); j++) {
			sb.append(" ").append(array.get(j));
		}
		System.out.println(sb.toString());
	}

	static public List<Integer> acceptArray (InputStream ins) {
		Scanner sc = new Scanner(ins);
		int num = sc.nextInt();
		List<Integer> array = new ArrayList<Integer>();
		for (int i = 0; i < num; i++) {
			array.add(sc.nextInt());
		}
		return array;
	}

	static public List<Integer> bubbleSort (List<Integer> array) {
		printArray(array);
		// 1, 2,4,5,3
		//
		for (int i = 0; i < array.size()-1; i++){
			for (int j = array.size()-1; j > i; j--) {
				if (array.get(j-1) > array.get(j)) {
					//swap
					int c = array.get(j);
					array.set(j, array.get(j-1));
					array.set(j-1, c);
				}

			}

		}
		return array;
	}

	static public void main(String[] args) {
		List<Integer> array = acceptArray(System.in);
		List<Integer> sorted = bubbleSort(array);

	}
}

Compiler output:
Main.java:6: error: class Main2 is public, should be declared in a file named Main2.java
public class Main2 {
       ^
1 error
Language: Java

import java.io.*;

public class Main {
  public static void main(String[] args) {
    try {
      BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
      int count = Integer.parseInt(in.readLine());
      String[] arrStr = in.readLine().split(" ");
      for(int i=0; i<count; i++) { arrInt[i] = Integer.parseInt(arrStr[i]); }
      int flag = 1;
      int cntResult = 0;
      while(flag) {
        flag = 0;
        for( int j = count-1; j > 0; j-- ) {
          if(arrInt[j] < arrInt[j-1]) {
            int tmp = arrInt[j];
            arrInt[j] = arrInt[j-1];
            arrInt[j-1] = tmp;
            flag = 1;
            cntResult++;
          }
        }
      }
      StringBuilder sb = new StringBuilder();
      for( int i : arrInt ) { sb.append(i).append(" "); }
      System.out.println(sb.toString().trim());
      System.out.println(cntResult);
    } catch (IOException e) {
    }
  }
}

Compiler output:
Main.java:9: error: cannot find symbol
      for(int i=0; i<count; i++) { arrInt[i] = Integer.parseInt(arrStr[i]); }
                                   ^
  symbol:   variable arrInt
  location: class Main
Main.java:12: error: incompatible types: int cannot be converted to boolean
      while(flag) {
            ^
Main.java:15: error: cannot find symbol
          if(arrInt[j] < arrInt[j-1]) {
             ^
  symbol:   variable arrInt
  location: class Main
Main.java:15: error: cannot find symbol
          if(arrInt[j] < arrInt[j-1]) {
                         ^
  symbol:   variable arrInt
  location: class Main
Main.java:16: error: cannot find symbol
            int tmp = arrInt[j];
                      ^
  symbol:   variable arrInt
  location: class Main
Main.java:17: error: cannot find symbol
            arrInt[j] = arrInt[j-1];
            ^
  symbol:   variable arrInt
  location: class Main
Main.java:17: error: cannot find symbol
            arrInt[j] = arrInt[j-1];
                        ^
  symbol:   variable arrInt
  location: class Main
Main.java:18: error: cannot find symbol
            arrInt[j-1] = tmp;
            ^
  symbol:   variable arrInt
  location: class Main
Main.java:25: error: cannot find symbol
      for( int i : arrInt ) { sb.append(i).append(" "); }
                   ^
  symbol:   variable arrInt
  location: class Main
9 errors
Language: Java

import java.io.*;

public class Main {
  public static void main(String[] args) {
    try {
      BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
      int count = Integer.parseInt(in.readLine());
      String[] arrStr = in.readLine().split(" ");
      int[] arrInt = new int[count];
      for(int i=0; i<count; i++) { arrInt[i] = Integer.parseInt(arrStr[i]); }
      int flag = 1;
      int cntResult = 0;
      while(flag) {
        flag = 0;
        for( int j = count-1; j > 0; j-- ) {
          if(arrInt[j] < arrInt[j-1]) {
            int tmp = arrInt[j];
            arrInt[j] = arrInt[j-1];
            arrInt[j-1] = tmp;
            flag = 1;
            cntResult++;
          }
        }
      }
      StringBuilder sb = new StringBuilder();
      for( int i : arrInt ) { sb.append(i).append(" "); }
      System.out.println(sb.toString().trim());
      System.out.println(cntResult);
    } catch (IOException e) {
    }
  }
}

Compiler output:
Main.java:13: error: incompatible types: int cannot be converted to boolean
      while(flag) {
            ^
1 error
Language: Java

public class Main {
	public static void main(String[] args){
		Scanner scanner = new Scanner(System.in);
		int count = scanner.nextInt();
		int[] sortList = new int[count];
		for(int i = 0; i < count; i++){
			sortList[i] = scanner.nextInt();
		}
		int anser = bubbleSort(sortList, count);
		for(int i = 0; i < count; i++){
			if(i != count - 1){
				System.out.print(sortList[i] + " ");
			}else{
				System.out.println(sortList[i]);
			}
		}
		System.out.println(anser);
	}

	private static int bubbleSort(int[] sortList, int count){
		int exchange_count = 0;
		int temp = 0;
		for(int j = 0; j < count; j++){
			for(int i = count - 1; i > j; i--){
				if(sortList[i] < sortList[i - 1]){
					temp = sortList[i];
					sortList[i] = sortList[i - 1];
					sortList[i - 1] = temp;
					exchange_count++;
				}
			}
		}
		return exchange_count;
	}
}

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
2 errors