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

#include<iostream>
#include<cmath>
using namespace std;
void bubbleSort(int a[], int n, int cnt){
	bool flag = true;
	while( flag ){
		flag = false;
		for( int j = n-1; j =1; j-- ){
			if(a[ j-1 ] > a[ j ]){
				swap(a[ j-1 ], a[ j ]);
				cnt++;
				flag = true;
			}
		}
	}
}
int main(){
	int n;
	cin >> n;
	int a[ n ];
	for( int i = 0; i < n; i++ ){
		cin >> a[ i ];
	}
	int cnt = 0;
	bubbleSort(a[n], n, cnt);
	for( int i = 0; i < n; i++ ){
		if( i < n-1 ) 
			cout << a[ i ] << " ";
		else            
			cout << a[ i ] << "?\n";
	}
	cout << cnt << "?\n";
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:23: error: invalid conversion from 'int' to 'int*' [-fpermissive]
   25 |         bubbleSort(a[n], n, cnt);
      |                    ~~~^
      |                       |
      |                       int
a.cc:4:21: note:   initializing argument 1 of 'void bubbleSort(int*, int, int)'
    4 | void bubbleSort(int a[], int n, int cnt){
      |                 ~~~~^~~
Language: C++

#include<iostream>
#include<cmath>
using namespace std;
void bubbleSort(int a, int n, int cnt){
	bool flag = true;
	while( flag ){
		flag = false;
		for( int j = n-1; j =1; j-- ){
			if(a[ j-1 ] > a[ j ]){
				swap(a[ j-1 ], a[ j ]);
				cnt++;
				flag = true;
			}
		}
	}
}
int main(){
	int n;
	cin >> n;
	int a[ n ];
	for( int i = 0; i < n; i++ ){
		cin >> a[ i ];
	}
	int cnt = 0;
	bubbleSort(a[n], n, cnt);
	for( int i = 0; i < n; i++ ){
		if( i < n-1 ) 
			cout << a[ i ] << " ";
		else            
			cout << a[ i ] << "?\n";
	}
	cout << cnt << "?\n";
}

Compiler output:
a.cc: In function 'void bubbleSort(int, int, int)':
a.cc:9:29: error: invalid types 'int[int]' for array subscript
    9 |                         if(a[ j-1 ] > a[ j ]){
      |                             ^
a.cc:9:40: error: invalid types 'int[int]' for array subscript
    9 |                         if(a[ j-1 ] > a[ j ]){
      |                                        ^
a.cc:10:39: error: invalid types 'int[int]' for array subscript
   10 |                                 swap(a[ j-1 ], a[ j ]);
      |                                       ^
a.cc:10:49: error: invalid types 'int[int]' for array subscript
   10 |                                 swap(a[ j-1 ], a[ j ]);
      |                                                 ^
Language: C++

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

int count = 0;

void swap(int a[], int i, int j) {
    int tmp = a[i];
    a[i] = a[j];
    a[j] = tmp;
    count++;
}

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

Compiler output:
a.cc: In function 'void swap(int*, int, int)':
a.cc:10:5: error: reference to 'count' is ambiguous
   10 |     count++;
      |     ^~~~~
In file included from /usr/include/c++/14/algorithm:86,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: candidates are: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
  101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~~
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:4025:5: note:                 'template<class _IIter, class _Tp> typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)'
 4025 |     count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
      |     ^~~~~
a.cc:4:5: note:                 'int count'
    4 | int count = 0;
      |     ^~~~~
a.cc: In function 'int main()':
a.cc:33:13: error: reference to 'count' is ambiguous
   33 |     cout << count << endl;
      |             ^~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: candidates are: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
  101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~~
/usr/include/c++/14/bits/stl_algo.h:4025:5: note:                 'template<class _IIter, class _Tp> typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)'
 4025 |     count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
      |     ^~~~~
a.cc:4:5: note:                 'int count'
    4 | int count = 0;
      |     ^~~~~
Language: C++

#include <iostream>
using namespace std;

int bubblesort(int A[], int N) {
  /* code */
  int sw = 0;
  bool flag = 1;
  for (i = 0; flag; i++) {
    /* code */
    flag = 0;
    for (int j = 0; j >= i + 1; j--) {
      /* code */
      if (A[j]< A[j -1]      ) {
        /* code */
        swap(A[j], A[j-1]);
        flag = 1;
        sw++;
      }
    }
  }
  return sw;
}

int main(int argc, char const *argv[]) {
  /* code */
  int A[100], N ,sw;
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> A[i];

    /* code */
  }
  sw = bubblesort(A,N);

  for (i = 0; i < N; i++) {
    if (i) cout << " ";
    cout << A[i];

    /* code */
  }
  cout << endl;
  cout << sw << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int bubblesort(int*, int)':
a.cc:8:8: error: 'i' was not declared in this scope
    8 |   for (i = 0; flag; i++) {
      |        ^
a.cc: In function 'int main(int, const char**)':
a.cc:35:8: error: 'i' was not declared in this scope
   35 |   for (i = 0; i < N; i++) {
      |        ^
Language: C++


#include <math.h>

int isPrime(int a[]);
int n,p;
int count = 0;
int main(){
	int a[10000], i, count =0,x[200000];

	scanf("%d", &n);

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

	p = isPrime(x);

	for (i = 0; i < n; i++){
		if (i != 0){ printf(" "); }
		printf("%d", x[i]);
	}

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

	return 0;
}

int isPrime(int a[]){
	int i;
	int min;
	int j;
	int g;
	int max;
	int p = 0;

	for (i = 0; i < n; i++){
		for (g = n-1; g > i; g--){
			if (a[g] < a[g-1]){
				j = a[g - 1];
				a[g - 1] = a[g];
				a[g] = j;
				count++;
			}
		}
	}

	return count;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:9: error: 'scanf' was not declared in this scope
   10 |         scanf("%d", &n);
      |         ^~~~~
a.cc:19:30: error: 'printf' was not declared in this scope
   19 |                 if (i != 0){ printf(" "); }
      |                              ^~~~~~
a.cc:3:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
    2 | #include <math.h>
  +++ |+#include <cstdio>
    3 | 
a.cc:20:17: error: 'printf' was not declared in this scope
   20 |                 printf("%d", x[i]);
      |                 ^~~~~~
a.cc:20:17: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
a.cc:23:9: error: 'printf' was not declared in this scope
   23 |         printf("\n");
      |         ^~~~~~
a.cc:23:9: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
Language: C++

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

void Out() {
	cout << A[0];
	for (int i = 1; i < N; i++)
		cout << ' ' << A[i];
	cout << endl;
}

void BubbleSort() {
	bool flag = true;
	while (flag) {
		flag = false;
		for (int i = N - 1; i >= 0; i--) {
			if (A[j] < A[j - 1]) {
				int tmp = A[j];
				A[j] = A[j - 1];
				A[j - 1] = tmp;
				flag = true;
			}
		}
	}
}

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

Compiler output:
a.cc: In function 'void BubbleSort()':
a.cc:17:31: error: 'j' was not declared in this scope
   17 |                         if (A[j] < A[j - 1]) {
      |                               ^
Language: C++

#include<iostream>
using namespace std;
int main (){
  int n,a[100],i,j,v,flag,count=0;

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

  for(i=0;i<n;i++){
    for(j=0;j<n-1;j++){
      if(a[j]>a[j+1]){      
	v=a[j];
	a[j]=a[j+1];
	a[j+1]=v;
	count++;
      }
    }
  }
    for(i=0;i<n;i++){
      if(i<n-1){
	cout<<a[i]<<" ";
      }else{
	cout<<a[i]<<endl;
      }
    cout<<count<<endl;

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:2: error: expected '}' at end of input
   30 | }
      |  ^
a.cc:3:12: note: to match this '{'
    3 | int main (){
      |            ^
Language: C++

include<iostream>

using namespace std;

int bubbleSort(int A[], int N){ 
    int sw = 0;
    bool flag = 1;

    for (int i = 0; flag; i++){
        flag = 0;
        for (int j = N - 1; j >= i + 1; j--){
            if (A[j] < A[j - 1]){
                swap(A[j], A[j - 1]);
                flag = 1;
                sw++;
            }   

        }   
    }   
    return sw; 
}

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

    sw = bubbleSort(A, N); 

    for (int i= 0; i < N; i++){
        if (i) cout << " ";
        cout << A[i];
    }   
    cout << endl;
    cout << sw << endl;
    
    return 0;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include<iostream>
      | ^~~~~~~
a.cc: In function 'int bubbleSort(int*, int)':
a.cc:13:17: error: 'swap' was not declared in this scope; did you mean 'sw'?
   13 |                 swap(A[j], A[j - 1]);
      |                 ^~~~
      |                 sw
a.cc: In function 'int main()':
a.cc:25:5: error: 'cin' was not declared in this scope
   25 |     cin >> N;
      |     ^~~
a.cc:31:16: error: 'cout' was not declared in this scope
   31 |         if (i) cout << " ";
      |                ^~~~
a.cc:32:9: error: 'cout' was not declared in this scope
   32 |         cout << A[i];
      |         ^~~~
a.cc:34:5: error: 'cout' was not declared in this scope
   34 |     cout << endl;
      |     ^~~~
a.cc:34:13: error: 'endl' was not declared in this scope
   34 |     cout << endl;
      |             ^~~~
Language: C++

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

int Bubble(vector<int>& A) {
    int cnt=0;
    bool flag = 1; // ????????£??\????´?????????¨??????
    while(flag) {
	flag = 0;
	for(int j=N-1; j>=1; j--){
	    if(A[j] < A[j-1]) {
		swap(A[j],A[j-1]);
		flag = 1;
		cnt++;
	    }
	}
    }
}

int main() {
    int n; cin >> n;
    vector<int> A(n);
    for(int i=0; i<n; i++) cin >> A[i];
    int ans = Bubble(A);
    for(int i=0; i<n; i++)
	if(i != n-1) 
	    cout << e << " ";
	else
	    cout << e << endl;

    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int Bubble(std::vector<int>&)':
a.cc:9:19: error: 'N' was not declared in this scope
    9 |         for(int j=N-1; j>=1; j--){
      |                   ^
a.cc:17:1: warning: no return statement in function returning non-void [-Wreturn-type]
   17 | }
      | ^
a.cc: In function 'int main()':
a.cc:26:21: error: 'e' was not declared in this scope
   26 |             cout << e << " ";
      |                     ^
a.cc:28:21: error: 'e' was not declared in this scope
   28 |             cout << e << endl;
      |                     ^
Language: C++

#include<iostream>
using namespace std;

int bubbleSort(int A[],int N){

   int sw=0;
   bool flg = 1;
   for(i=0;flag;i++){
      flag =0;
      for(int j=N-1;j>=i+1;j--){
         if(A[j]<A[j-1]){
            swap(A[j],A[j-1]);
            flg=1;
            sw++;
         }
      }
   }
   return sw;
}

int main(){

   int A[100],N,sw;
   cin>>N;
   for(i=0;i<N;i++)cin>>A[i];

   sw=bubbleSort(A,N);

   for(i=0;i<N;i++){
      if(i) cout << " ";
      cout<<A[i];
   }
   cout << endl;
   cout << sw <<endl;

   return 0;
}

Compiler output:
a.cc: In function 'int bubbleSort(int*, int)':
a.cc:8:8: error: 'i' was not declared in this scope
    8 |    for(i=0;flag;i++){
      |        ^
a.cc:8:12: error: 'flag' was not declared in this scope; did you mean 'flg'?
    8 |    for(i=0;flag;i++){
      |            ^~~~
      |            flg
a.cc: In function 'int main()':
a.cc:25:8: error: 'i' was not declared in this scope
   25 |    for(i=0;i<N;i++)cin>>A[i];
      |        ^
a.cc:29:8: error: 'i' was not declared in this scope
   29 |    for(i=0;i<N;i++){
      |        ^
Language: C++

#include<iostream>
using namespace std;

int bubbleSort(int A[],int N){

   int sw=0;
   bool flag = 1;
   for(i=0;flag;i++){
      flag =0;
      for(int j=N-1;j>=i+1;j--){
         if(A[j]<A[j-1]){
            swap(A[j],A[j-1]);
            flg=1;
            sw++;
         }
      }
   }
   return sw;
}

int main(){

   int A[100],N,sw;
   cin>>N;
   for(i=0;i<N;i++)cin>>A[i];

   sw=bubbleSort(A,N);

   for(i=0;i<N;i++){
      if(i) cout << " ";
      cout<<A[i];
   }
   cout << endl;
   cout << sw <<endl;

   return 0;
}

Compiler output:
a.cc: In function 'int bubbleSort(int*, int)':
a.cc:8:8: error: 'i' was not declared in this scope
    8 |    for(i=0;flag;i++){
      |        ^
a.cc:13:13: error: 'flg' was not declared in this scope; did you mean 'flag'?
   13 |             flg=1;
      |             ^~~
      |             flag
a.cc: In function 'int main()':
a.cc:25:8: error: 'i' was not declared in this scope
   25 |    for(i=0;i<N;i++)cin>>A[i];
      |        ^
a.cc:29:8: error: 'i' was not declared in this scope
   29 |    for(i=0;i<N;i++){
      |        ^
Language: C++

#include<iostream>
using namespace std;

int bubbleSort(int A[],int N){

   int sw=0;
   bool flag = 1;
   for(i=0;flag;i++){
      flag =0;
      for(int j=N-1;j>=i+1;j--){
         if(A[j]<A[j-1]){
            swap(A[j],A[j-1]);
            flag=1;
            sw++;
         }
      }
   }
   return sw;
}

int main(){

   int A[100],N,sw;
   cin>>N;
   for(i=0;i<N;i++)cin>>A[i];

   sw=bubbleSort(A,N);

   for(i=0;i<N;i++){
      if(i) cout << " ";
      cout<<A[i];
   }
   cout << endl;
   cout << sw <<endl;

   return 0;
}

Compiler output:
a.cc: In function 'int bubbleSort(int*, int)':
a.cc:8:8: error: 'i' was not declared in this scope
    8 |    for(i=0;flag;i++){
      |        ^
a.cc: In function 'int main()':
a.cc:25:8: error: 'i' was not declared in this scope
   25 |    for(i=0;i<N;i++)cin>>A[i];
      |        ^
a.cc:29:8: error: 'i' was not declared in this scope
   29 |    for(i=0;i<N;i++){
      |        ^
Language: C++

#include<iostream>
using namespace std;

int bubbleSort(int A[],int N){

   int sw=0;
   bool flag = 1;
   for(i=0;flag;i++){
      flag =0;
      for(int j=N-1;j>=i+1;j--){
         if(A[j]<A[j-1]){
            swap(A[j],A[j-1]);
            flag=1;
            sw++;
         }
      }
   }
   return sw;
}

int main(){

   int A[100],N,sw;
   cin>>N;
   for(int i=0;i<N;i++) cin>>A[i];

   sw=bubbleSort(A,N);

   for(int i=0;i<N;i++){
      if(i) cout << " ";
      cout<<A[i];
   }
   cout << endl;
   cout << sw <<endl;

   return 0;
}

Compiler output:
a.cc: In function 'int bubbleSort(int*, int)':
a.cc:8:8: error: 'i' was not declared in this scope
    8 |    for(i=0;flag;i++){
      |        ^
Language: C++

#include<stdio.h>

int main(void) {
	int i, j, n, temp, flag = 1, count = 0;
	
	scanf("%d", &n);
	for (i = 0; i < n; ++i)
	{
		scanf("%d", &a[i]);
	}
	
	while (flag)
	{
		flag = 0;
		
		for (j = n - 1; n > 0; --n)
		{
			if (a[j] < a[j-1])
			{
				temp = a[j];
				a[j] = a[j-1];
				a[j-1] = temp;
				flag = 1;
				++count;
			}
		}
	}
	
	for (i = 0; i < n; ++1)
	{
		printf("%d", a[i]);
		if (i != n-1) printf(" ");
	}
	printf("\n");
	printf("%d\n", count);
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:30: error: 'a' was not declared in this scope
    9 |                 scanf("%d", &a[i]);
      |                              ^
a.cc:18:29: error: 'a' was not declared in this scope
   18 |                         if (a[j] < a[j-1])
      |                             ^
a.cc:29:30: error: lvalue required as increment operand
   29 |         for (i = 0; i < n; ++1)
      |                              ^
a.cc:31:30: error: 'a' was not declared in this scope
   31 |                 printf("%d", a[i]);
      |                              ^
Language: C++

#include<iostream>
using namespace std;

int bubbleSort(int A[], int N)
{
   int sw = 0;
   bool flag = 1;

   int i, j;
   for(i=0; flag; i++) {
      flag = 0;
      for(j=N-1; j>=i+1; j--) {
         if(A[j]<A[j-1]) {
            swap(A[j], A[j-1]);
            flag = 1;
            sw++;
         }
      }
   }
   return sw;
}

int main()
{
   int A[100], N;
   cin >> N;

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

   sw = bubbleSort(A, N);

   for(i=0; i<N; i++) {
      if (i) cout << " ";
      cout << A[i];
   }
   cout << end1;
   cout << sw << end1;

   return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:4: error: 'sw' was not declared in this scope
   32 |    sw = bubbleSort(A, N);
      |    ^~
a.cc:38:12: error: 'end1' was not declared in this scope
   38 |    cout << end1;
      |            ^~~~
Language: C++

#include<iostream>
using namespace std;

int bubbleSort(int A[], int N)
{
   int sw = 0;
   bool flag = 1;

   int i, j;
   for(i=0; flag; i++) {
      flag = 0;
      for(j=N-1; j>=i+1; j--) {
         if(A[j]<A[j-1]) {
            swap(A[j], A[j-1]);
            flag = 1;
            sw++;
         }
      }
   }
   return sw;
}

int main()
{
   int A[100], N;
   cin >> N;

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

   sw = bubbleSort(A, N);

   for(i=0; i<N; i++) {
      if (i) cout << " ";
      cout << A[i];
   }
   cout << endl;
   cout << sw << endl;

   return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:4: error: 'sw' was not declared in this scope
   32 |    sw = bubbleSort(A, N);
      |    ^~
Language: C++

#include <iostream>

using namespace std;



int bubbleSort(int A[], int N) {
    int sw = 0;
    bool flag = 1;
    for ( int i = 0; flag; i++){
        flag = 0;
        for (int j = N - 1; j >= i + 1; j--){
              if ( A[j] < A[j - 1]){
                 swap(A[j], A[j - 1]);
                 flag = 1;
                 sw++;
              }
        }
    }
    return sw;
}




int main(){


int A[100], N , sw;
cin >> N;
for(int i = 0; i < N; i++) cin >> A[i];

sw = bubbleSort(A, N);

for ( int i = 0; i < N; i++){
     if(i) cout << " ";
     cout << A[i];
}
cout << end1;
cout << sw << end1;


return 0;

} 

Compiler output:
a.cc: In function 'int main()':
a.cc:39:9: error: 'end1' was not declared in this scope
   39 | cout << end1;
      |         ^~~~
Language: C++

#include <stdio.h>
int int main(int argc, char const *argv[]) {
  int flag=1;
  int nums[101];
  int sorted[101];
  int n;
  int i=0;
  int count=0;
  int temp;
  scanf("%d\n",&n );
  while (i<n) {
    scanf("%d",&nums[i]);
    i++;
  }
  while (flag) {
    /* code */
    flag=0;
    for (i =n-1; i < n; i++) {
      if (nums[i]<nums[i-1]) {
        temp=nums[i];
        nums[i]=nums[n-1];
        nums[i-1]=temp;
        flag=1;
        count++;
        /* code */
      }
    }

  }
  k=0;

  while(k<n){
    printf("%d",nums[k]);
    k++;
    if(k!=n)
    printf(" ");
  }
    printf("\n");
    printf("%d\n", count);
  return 0;
}

Compiler output:
a.cc:2:1: error: two or more data types in declaration of 'main'
    2 | int int main(int argc, char const *argv[]) {
      | ^~~
Language: C++

#include <stdio.h>
int int main(int argc, char const *argv[]) {
  int flag=1;
  int nums[101];
  int sorted[101];
  int n;
  int i=0;
  int k;
  int count=0;
  int temp;
  scanf("%d\n",&n );
  while (i<n) {
    scanf("%d",&nums[i]);
    i++;
  }
  while (flag) {
    /* code */
    flag=0;
    for (i =n-1; i < n; i++) {
      if (nums[i]<nums[i-1]) {
        temp=nums[i];
        nums[i]=nums[n-1];
        nums[i-1]=temp;
        flag=1;
        count++;
        /* code */
      }
    }

  }
  k=0;

  while(k<n){
    printf("%d",nums[k]);
    k++;
    if(k!=n)
    printf(" ");
  }
    printf("\n");
    printf("%d\n", count);
  return 0;
}

Compiler output:
a.cc:2:1: error: two or more data types in declaration of 'main'
    2 | int int main(int argc, char const *argv[]) {
      | ^~~
Language: C++

#include<iostream>
using namespace std;

int bubblesort(int A[], int N[]) {

int sw = 0;
bool flag = 1;
for(int i = 0; flag; i++){
    flag = 0;
    for(int j = N-1; j >= i+1; j--){
       if (A[j] < A[j-1]){
       swap(A[j], A[j-1]);
       flag = 1;
       sw++;
    }
  }
}

 return sw;
}

int main() {
int A[100], N, sw;
cin >> N;
for( int i = 0; i < N; i++){
    if (i) cout << " ";
    cout << A[i];
}
cout << end1;
cout << sw <<end1;

return 0;
}

Compiler output:
a.cc: In function 'int bubblesort(int*, int*)':
a.cc:10:18: error: invalid conversion from 'int*' to 'int' [-fpermissive]
   10 |     for(int j = N-1; j >= i+1; j--){
      |                 ~^~
      |                  |
      |                  int*
a.cc: In function 'int main()':
a.cc:29:9: error: 'end1' was not declared in this scope
   29 | cout << end1;
      |         ^~~~
Language: C++

#include<iostream>
using namespace std;

int bubbleSort(int A[], int N) {

int sw = 0;
bool flag = 1;
for(int i = 0; flag; i++){
    flag = 0;
    for(int j = N-1; j >= i+1; j--){
       if (A[j] < A[j-1]){
       swap(A[j], A[j-1]);
       flag = 1;
       sw++;
    }
  }
}

 return sw;
}

int main() {
int A[100], N, sw;
cin >> N;
for( int i = 0; i < N; i++){
    if (i) cout << " ";
    cout << A[i];
}
cout << end1;
cout << sw <<end1;

return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:9: error: 'end1' was not declared in this scope
   29 | cout << end1;
      |         ^~~~
Language: C++

#include<iostream>
using namespace std;

int bubbleSort(int A[], int N) {

int sw = 0;
bool flag = 1;
for(int i = 0; flag; i++){
    flag = 0;
    for(int j = N-1; j >= i+1; j--){
       if (A[j] < A[j-1]){
       swap(A[j], A[j-1]);
       flag = 1;
       sw++;
    }
  }
}

 return sw;
}

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

sw = bubbleSort(A,N);

for( int i = 0; i < N; i++){
    if (i) cout << " ";
    cout << A[i];
}
cout << end1;
cout << sw <<end1;

return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:10: error: expected unqualified-id before '=' token
   25 | for( int = 0; i < N; i++) cin >> A[i];
      |          ^
a.cc:25:9: error: expected ';' before '=' token
   25 | for( int = 0; i < N; i++) cin >> A[i];
      |         ^~
      |         ;
a.cc:25:10: error: expected primary-expression before '=' token
   25 | for( int = 0; i < N; i++) cin >> A[i];
      |          ^
a.cc:25:15: error: 'i' was not declared in this scope
   25 | for( int = 0; i < N; i++) cin >> A[i];
      |               ^
a.cc:25:20: error: expected ')' before ';' token
   25 | for( int = 0; i < N; i++) cin >> A[i];
      |    ~               ^
      |                    )
a.cc:25:22: error: 'i' was not declared in this scope
   25 | for( int = 0; i < N; i++) cin >> A[i];
      |                      ^
a.cc:33:9: error: 'end1' was not declared in this scope
   33 | cout << end1;
      |         ^~~~
Language: C++

#include<iostream>
using namespace std;

int bubbleSort(int A[], int N) {

int sw = 0;
bool flag = 1;
for(int i = 0; flag; i++){
    flag = 0;
    for(int j = N-1; j >= i+1; j--){
       if (A[j] < A[j-1]){
       swap(A[j], A[j-1]);
       flag = 1;
       sw++;
    }
  }
}

 return sw;
}

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

sw = bubbleSort(A,N);

for( int i = 0; i < N; i++){
    if (i) cout << " ";
    cout << A[i];
}
cout << endl;
cout << sw <<endl;

return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:10: error: expected unqualified-id before '=' token
   25 | for( int = 0; i < N; i++) cin >> A[i];
      |          ^
a.cc:25:9: error: expected ';' before '=' token
   25 | for( int = 0; i < N; i++) cin >> A[i];
      |         ^~
      |         ;
a.cc:25:10: error: expected primary-expression before '=' token
   25 | for( int = 0; i < N; i++) cin >> A[i];
      |          ^
a.cc:25:15: error: 'i' was not declared in this scope
   25 | for( int = 0; i < N; i++) cin >> A[i];
      |               ^
a.cc:25:20: error: expected ')' before ';' token
   25 | for( int = 0; i < N; i++) cin >> A[i];
      |    ~               ^
      |                    )
a.cc:25:22: error: 'i' was not declared in this scope
   25 | for( int = 0; i < N; i++) cin >> A[i];
      |                      ^
Language: C++

#include<iostream>
using namespace std;

int bubbleSort(int A[], int N) {

int sw = 0;
bool flag = 1;
for(int i = 0; flag; i++){
    flag = 0;
    for(int j = N-1; j >= i+1; j--){
       if (A[j] < A[j-1]){
       swap(A[j], A[j-1]);
       flag = 1;
       sw++;
    }
  }
}

 return sw;
}

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

sw = bubbleSort(A, N);

for( int i = 0; i < N; i++){
    if (i) cout << " ";
    cout << A[i];
}
cout << endl;
cout << sw <<endl;

return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:10: error: expected unqualified-id before '=' token
   25 | for( int = 0; i < N; i++) cin >> A[i];
      |          ^
a.cc:25:9: error: expected ';' before '=' token
   25 | for( int = 0; i < N; i++) cin >> A[i];
      |         ^~
      |         ;
a.cc:25:10: error: expected primary-expression before '=' token
   25 | for( int = 0; i < N; i++) cin >> A[i];
      |          ^
a.cc:25:15: error: 'i' was not declared in this scope
   25 | for( int = 0; i < N; i++) cin >> A[i];
      |               ^
a.cc:25:20: error: expected ')' before ';' token
   25 | for( int = 0; i < N; i++) cin >> A[i];
      |    ~               ^
      |                    )
a.cc:25:22: error: 'i' was not declared in this scope
   25 | for( int = 0; i < N; i++) cin >> A[i];
      |                      ^
Language: C++

#include<iostream>
using namespace std;

int bubbleSort(int A[], int N) {

int sw = 0;
bool flag = 1;
for(int i = 0; flag; i++){
    flag = 0;
    for(int j = N-1; j >= i+1; j--){
       if (A[j] < A[j-1]){
       swap(A[j], A[j-1]);
       flag = 1;
       sw++;
    }
  }
}

 return sw;
}

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

sw = bubbleSort(A, N);

for( int i = 0; i < N; i++){
    if (i) cout << " ";
    cout << A[i];
}
cout << endl;
cout << sw << endl;

return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:10: error: expected unqualified-id before '=' token
   25 | for( int = 0; i < N; i++) cin >> A[i];
      |          ^
a.cc:25:9: error: expected ';' before '=' token
   25 | for( int = 0; i < N; i++) cin >> A[i];
      |         ^~
      |         ;
a.cc:25:10: error: expected primary-expression before '=' token
   25 | for( int = 0; i < N; i++) cin >> A[i];
      |          ^
a.cc:25:15: error: 'i' was not declared in this scope
   25 | for( int = 0; i < N; i++) cin >> A[i];
      |               ^
a.cc:25:20: error: expected ')' before ';' token
   25 | for( int = 0; i < N; i++) cin >> A[i];
      |    ~               ^
      |                    )
a.cc:25:22: error: 'i' was not declared in this scope
   25 | for( int = 0; i < N; i++) cin >> A[i];
      |                      ^
Language: C++

#include<iostream>
using namespace std;

int bubbleSort(int A[], int N) {

int sw = 0;
bool flag = 1;
for(int i = 0; flag; i++){
    flag = 0;
    for(int j = N-1; j >= i+1; j--){
       if (A[j] < A[j-1]){
       swap(A[j], A[j-1]);
       flag = 1;
       sw++;
    }
  }
}

 return sw;
}

int main() {
int A[100], N, sw;
cin >> N;
for( int = 0; i < N; i++) {
cin >> A[i];
}
sw = bubbleSort(A, N);

for( int i = 0; i < N; i++){
    if (i) cout << " ";
    cout << A[i];
}
cout << endl;
cout << sw << endl;

return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:10: error: expected unqualified-id before '=' token
   25 | for( int = 0; i < N; i++) {
      |          ^
a.cc:25:9: error: expected ';' before '=' token
   25 | for( int = 0; i < N; i++) {
      |         ^~
      |         ;
a.cc:25:10: error: expected primary-expression before '=' token
   25 | for( int = 0; i < N; i++) {
      |          ^
a.cc:25:15: error: 'i' was not declared in this scope
   25 | for( int = 0; i < N; i++) {
      |               ^
a.cc:25:20: error: expected ')' before ';' token
   25 | for( int = 0; i < N; i++) {
      |    ~               ^
      |                    )
a.cc:25:22: error: 'i' was not declared in this scope
   25 | for( int = 0; i < N; i++) {
      |                      ^
Language: C++

#include<iostream>
using namespace std;

int bubbleSort(int A[], int N) {

int sw = 0;
bool flag = 1;
for(int i = 0; flag; i++){
    flag = 0;
    for(int j = N-1; j >= i+1; j--){
       if (A[j] < A[j-1]){
       swap(A[j], A[j-1]);
       flag = 1;
       sw++;
    }
  }
}

 return sw;
}

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

sw = bubbleSort(A, N);

for( int i = 0; i < N; i++){
    if (i) cout << " ";
    cout << A[i];
}
cout << endl;
cout << sw << endl;

return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:10: error: expected unqualified-id before '=' token
   25 | for( int = 0; i < N; i++)cin >> A[i];
      |          ^
a.cc:25:9: error: expected ';' before '=' token
   25 | for( int = 0; i < N; i++)cin >> A[i];
      |         ^~
      |         ;
a.cc:25:10: error: expected primary-expression before '=' token
   25 | for( int = 0; i < N; i++)cin >> A[i];
      |          ^
a.cc:25:15: error: 'i' was not declared in this scope
   25 | for( int = 0; i < N; i++)cin >> A[i];
      |               ^
a.cc:25:20: error: expected ')' before ';' token
   25 | for( int = 0; i < N; i++)cin >> A[i];
      |    ~               ^
      |                    )
a.cc:25:22: error: 'i' was not declared in this scope
   25 | for( int = 0; i < N; i++)cin >> A[i];
      |                      ^
Language: C++

#include<iostream>
using namespace std;

int bubbleSort(int A[], int N) {

int sw = 0;
bool flag = 1;
for(int i = 0; flag; i++){
    flag = 0;
    for(int j = N-1; j >= i+1; j--){
       if (A[j] < A[j-1]){
       swap(A[j], A[j-1]);
       flag = 1;
       sw++;
    }
  }
}

 return sw;
}

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

sw = bubbleSort(A, N);

for( int i = 0; i < N; i++){
    if (i) cout << " ";
    cout << A[i];
}
cout << endl;
cout << sw << endl;

return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:10: error: expected unqualified-id before '=' token
   25 | for( int = 0; i < N; i++;)cin >> A[i];
      |          ^
a.cc:25:9: error: expected ';' before '=' token
   25 | for( int = 0; i < N; i++;)cin >> A[i];
      |         ^~
      |         ;
a.cc:25:10: error: expected primary-expression before '=' token
   25 | for( int = 0; i < N; i++;)cin >> A[i];
      |          ^
a.cc:25:15: error: 'i' was not declared in this scope
   25 | for( int = 0; i < N; i++;)cin >> A[i];
      |               ^
a.cc:25:20: error: expected ')' before ';' token
   25 | for( int = 0; i < N; i++;)cin >> A[i];
      |    ~               ^
      |                    )
a.cc:25:22: error: 'i' was not declared in this scope
   25 | for( int = 0; i < N; i++;)cin >> A[i];
      |                      ^
a.cc:25:26: error: expected primary-expression before ')' token
   25 | for( int = 0; i < N; i++;)cin >> A[i];
      |                          ^
Language: C++

#include<iostream>
using namespace std;

int bubbleSort(int A[], int N) {

int sw = 0;
bool flag = 1;
for(int i = 0; flag; i++){
    flag = 0;
    for(int j = N-1; j >= i+1; j--){
       if (A[j] < A[j-1]){
       swap(A[j], A[j-1]);
       flag = 1;
       sw++;
    }
  }
}

 return sw;
}

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

sw = bubbleSort(A, N);

for( int i = 0; i < N; i++){
    if (i) cout << " ";
    cout << A[i];
}
cout << endl;
cout << sw << endl;

return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:10: error: expected unqualified-id before '=' token
   25 | for( int = 0; i < N; i++)cin >> A[i];
      |          ^
a.cc:25:9: error: expected ';' before '=' token
   25 | for( int = 0; i < N; i++)cin >> A[i];
      |         ^~
      |         ;
a.cc:25:10: error: expected primary-expression before '=' token
   25 | for( int = 0; i < N; i++)cin >> A[i];
      |          ^
a.cc:25:20: error: expected ')' before ';' token
   25 | for( int = 0; i < N; i++)cin >> A[i];
      |    ~               ^
      |                    )
a.cc:25:25: error: expected ';' before ')' token
   25 | for( int = 0; i < N; i++)cin >> A[i];
      |                         ^
      |                         ;
Language: C++

#include<iostream>

int bubbleSort(int A[],int N){
	int sw=0,i,j,temp;
	bool flag=1;
	for(i=0;flag;i++){
		flag=0;
		for(j=N-1;j>=i+1;j--){
			if(A[j]<A[j-1]){
				temp=A[j];
				A[j]=A[j-1];
				A[j-1]=temp;
				sw++;
				flag=1;
			}
		}
	}
	return sw;
}

int main(){
	int A[100],N,sw,i;

	cin >> N;
		for(i=0;i<N;i++)
			cin >> A[i];
	
	sw = bubbleSort(A,N);
	
	for(i=0;i<N;i++){
		if(i>0)
			cout << " ";
		cout << A[i];
	}
	cout << "\nsw\n";
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   24 |         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:32:25: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   32 |                         cout << " ";
      |                         ^~~~
      |                         std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:33:17: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   33 |                 cout << A[i];
      |                 ^~~~
      |                 std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:35:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   35 |         cout << "\nsw\n";
      |         ^~~~
      |         std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
Language: C++

#include <stdio.h>
#define scanf scanf_s

int bubbleSort(int A[], int N) {
	int sw, flag, i, j, e;
	sw = 0; flag = 1;

	while (flag) {
		flag = 0;
		for (i = 0; i < N; i++) {
			for (j = N - 1; j > i; j--) {
				if (A[j] < A[j - 1]) {
					e = A[j]; A[j] = A[j - 1]; A[j - 1] = e;
					flag = 1;
					sw++;
				}
			}
		}
	}

	return sw;

}

int main() {
	int A[100], N, sw, i;
	scanf("%d", &N);

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

	sw = bubbleSort(A, N);

	for (i = 0; i < N; i++) {
		if (i > 0) printf(" ");
		printf("%d", A[i]);
	}
	
	printf("\n%d\n", sw);

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:2:15: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
    2 | #define scanf scanf_s
      |               ^~~~~~~
a.cc:27:9: note: in expansion of macro 'scanf'
   27 |         scanf("%d", &N);
      |         ^~~~~
Language: C++

#include <iostream>
#include <cstdio>

using namespace std;

const int MAX = 101;
const int MAXN = 100000;
int n;
int a[MAX];

int bit[MAXN];

void add(int i, int x) {
    while (i < MAXN) {
        bit[i] += x;
        i += i & (-i);
    }
}

int sum(int i) {
    int s = 0;
    while (i > 0) {
        s += bit[i];
        i -= i & (-i);
    }
    return s;
}

int main() {
    scanf("%d", &n);
    memset(bit, 0, sizeof(bit));
    int ans = 0;
    for (int i = 0; i < n; i++) {
        scanf("%d", &a[i]);
        ans += sum(MAXN-1) - sum(a[i]-1);
        add(a[i], 1);
    }
    sort(a, a + n);
    for (int i = 0; i < n; i++) {
        if (i > 0) printf(" ");
        printf("%d", a[i]);
    }
    printf("\n");
    printf("%d\n", ans);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:5: error: 'memset' was not declared in this scope
   31 |     memset(bit, 0, sizeof(bit));
      |     ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <cstdio>
  +++ |+#include <cstring>
    3 | 
a.cc:38:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   38 |     sort(a, a + n);
      |     ^~~~
      |     short
Language: C++

#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

const int MAX = 101;
const int MAXN = 100000;
int n;
int a[MAX];

int bit[MAXN];

void add(int i, int x) {
    while (i < MAXN) {
        bit[i] += x;
        i += i & (-i);
    }
}

int sum(int i) {
    int s = 0;
    while (i > 0) {
        s += bit[i];
        i -= i & (-i);
    }
    return s;
}

int main() {
    scanf("%d", &n);
    memset(bit, 0, sizeof(bit));
    int ans = 0;
    for (int i = 0; i < n; i++) {
        scanf("%d", &a[i]);
        ans += sum(MAXN-1) - sum(a[i]-1);
        add(a[i], 1);
    }
    sort(a, a + n);
    for (int i = 0; i < n; i++) {
        if (i > 0) printf(" ");
        printf("%d", a[i]);
    }
    printf("\n");
    printf("%d\n", ans);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:5: error: 'memset' was not declared in this scope
   32 |     memset(bit, 0, sizeof(bit));
      |     ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <algorithm>
  +++ |+#include <cstring>
    4 |
Language: C++

#include<iostream>
using namespace std;

int bubbleSort(int A[], int N){
	int sw = 0;
	bool flag = 1;
	for(int i=0; flag; i++){
		flag = 0;
		for(int j = N-1; j >=i+1;j--){
			if(A[j]<A[j-1]){
				swap(A[j],A[j-1]);
				flag =1;
				sw++
			}
			
		}
		
		
	}
	
	return sw;
	
}

int main(){
	int A[100], N, sw;
	
	cin >> N;
	for(int i=0; i<N; i++) cin >> A[i];
	
	sw = bubbleSort(A,N);
	for (int i =0; i<N; i++){
		if(i)cout << " ";
		cout << A[i];
		
	}
	
	cout << endl;
	cout << sw << endl;
	
	return 0;
}

Compiler output:
a.cc: In function 'int bubbleSort(int*, int)':
a.cc:13:37: error: expected ';' before '}' token
   13 |                                 sw++
      |                                     ^
      |                                     ;
   14 |                         }
      |                         ~
Language: C++

#include "stdafx.h"
#include<iostream>

int bubbleSort(int[], int N) {
	int sw = 0;
	bool flag = true;
	for (i = 0; i < N; i++) {
		flag = false;
		for (int j = 0; j < N - 1; j++) {
			if (A[j] < A[j - 1]) {
				swap(A[j], A[j - 1]);
				flag = true;
				sw++;
			}
		}
	}
	return sw;
}

int main()
{
	int A[100], N, sw;
	cin >> N;
	for (int i = 0; i < N; i++) cin >> A[i];
	sw = bubbleSort(A, N);
	for (int i = 0; i < N; i++) {
		if (i)cout << " ";
		cout << A[i];
	}
	cout << endl;
	cout << sw << endl;
    return 0;
}

Compiler output:
a.cc:1:10: fatal error: stdafx.h: No such file or directory
    1 | #include "stdafx.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include<iostream>
using namespace std;

int bubbleSort(int[], int N) {
	int sw = 0;
	bool flag = true;
	for (int i = 0; i < N; i++) {
		flag = false;
		for (int j = 0; j < N - 1; j++) {
			if (A[j] < A[j - 1]) {
				swap(A[j], A[j - 1]);
				flag = true;
				sw++;
			}
		}
	}
	return sw;
}

int main()
{
	int A[100], N, sw;
	cin >> N;
	for (int i = 0; i < N; i++) cin >> A[i];
	sw = bubbleSort(A, N);
	for (int i = 0; i < N; i++) {
		if (i)cout << " ";
		cout << A[i];
	}
	cout << endl;
	cout << sw << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int bubbleSort(int*, int)':
a.cc:10:29: error: 'A' was not declared in this scope
   10 |                         if (A[j] < A[j - 1]) {
      |                             ^
Language: C++

#include<iostream>
using namespace std;

int bubbleSort(int A[], int N) {
        int sw = 0;
        bool flag = 1;
        for (int i = 0; flag; i++) {
                flag = 0;
                for (int j = N - 1; j >= i + 1; j--) {
                        if(A[j] < A[j - 1]) {
                        swap(A[j], A[j - 1]) 
                        flag = 1;
                        sw++;
                        }
                }
        }
        return sw;
}

int main() {
        int A[100], N, sw;
        cin >> N;
        for(int i = 0; i < N; i++) cin >> A[i];
        sw = bubbleSort(A, N);
        for(int i = 0; i < N; i++) {
                if (i) cout << " ";
                cout << A[i]
        }
        cout << endl;
        cout << sw << endl;
        return 0;
}

Compiler output:
a.cc: In function 'int bubbleSort(int*, int)':
a.cc:11:45: error: expected ';' before 'flag'
   11 |                         swap(A[j], A[j - 1])
      |                                             ^
      |                                             ;
   12 |                         flag = 1;
      |                         ~~~~                 
a.cc: In function 'int main()':
a.cc:27:29: error: expected ';' before '}' token
   27 |                 cout << A[i]
      |                             ^
      |                             ;
   28 |         }
      |         ~
Language: C++

#include<algorithm>
#include<stdio.h>
#include<iostream>
using namespace std;
static const int MAX = 200000;
int main(){
	int R[MAX], n;
	cnt >> n;
	for (int i = 0; i < n; i++){
		cnt >> R[i];
	}
	int k = 0;
	for (int i = 0; i < n; i++){
		for (int j = n - 1; i > i; j--){
			if (R[j - 1] > R[j]){
				swap(R[j - 1], R[j]);
				k++;
			}
		}
	}
	for (int i = 0; i < n; i++){
		if (i != 0)
			printf(" ");
		printd("%d", R[i]);
	}
	printf("\n%d", k);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:9: error: 'cnt' was not declared in this scope; did you mean 'int'?
    8 |         cnt >> n;
      |         ^~~
      |         int
a.cc:24:17: error: 'printd' was not declared in this scope; did you mean 'printf'?
   24 |                 printd("%d", R[i]);
      |                 ^~~~~~
      |                 printf
Language: C++

#include<algorithm>
#include<stdio.h>
#include<iostream>
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 k = 0;
	for (int i = 0; i < n; i++){
		for (int j = n - 1; i > i; j--){
			if (R[j - 1] > R[j]){
				swap(R[j - 1], R[j]);
				k++;
			}
		}
	}
	for (int i = 0; i < n; i++){
		if (i != 0)
			printf(" ");
		printd("%d", R[i]);
	}
	printf("\n%d", k);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:17: error: 'printd' was not declared in this scope; did you mean 'printf'?
   24 |                 printd("%d", R[i]);
      |                 ^~~~~~
      |                 printf
Language: C++

#include<algorithm>
#include<stdio.h>
#include<iostream>
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 k = 0;
	for (int i = 0; i < n; i++){
		for (int j = n - 1; i > i; j--){
			if (R[j - 1] > R[j]){
				swap(R[j - 1], R[j]);
				k++;
			}
		}
	}
	for (int i = 0; i < n; i++){
		if (i != 0)
			printf(" ");
		printd("%d", R[i]);
	}
	printf("\n%d", k);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:17: error: 'printd' was not declared in this scope; did you mean 'printf'?
   24 |                 printd("%d", R[i]);
      |                 ^~~~~~
      |                 printf
Language: C++

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

int main()
{
	int dataset;
	cin >> dataset;
	int a[100];
	for (int i = 0; i < dataset; i++)
	{
		cin >> a[i];
	}
	int flag = 1;
	int kaisuu = 0;
	while (flag) {
		flag = 0;
		for (int i = 1; i < dataset; i++)
		{
			if (a[i - 1] > a[i]) {
				reverse(a[i - 1], a[i]);
				flag = 1;
				kaisuu++;
			}
		}
	}
	for (int i = 0; i < dataset; i++)
	{
		if (i > 0) {
			cout << " " << a[i];
		}
		else {
			cout << a[i];
		}
	}

	cout << endl << kaisuu << endl;
}

Compiler output:
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_algo.h: In instantiation of 'void std::reverse(_BIter, _BIter) [with _BIter = int]':
a.cc:21:12:   required from here
   21 |                                 reverse(a[i - 1], a[i]);
      |                                 ~~~~~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1089:63: error: no matching function for call to '__iterator_category(int&)'
 1089 |       std::__reverse(__first, __last, std::__iterator_category(__first));
      |                                       ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_iterator_base_funcs.h:66,
                 from /usr/include/c++/14/string:47,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_iterator_base_types.h:239:5: note: candidate: 'template<class _Iter> constexpr typename std::iterator_traits< <template-parameter-1-1> >::iterator_category std::__iterator_category(const _Iter&)'
  239 |     __iterator_category(const _Iter&)
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_types.h:239:5: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_iterator_base_types.h: In substitution of 'template<class _Iter> constexpr typename std::iterator_traits< <template-parameter-1-1> >::iterator_category std::__iterator_category(const _Iter&) [with _Iter = int]':
/usr/include/c++/14/bits/stl_algo.h:1089:63:   required from 'void std::reverse(_BIter, _BIter) [with _BIter = int]'
 1089 |       std::__reverse(__first, __last, std::__iterator_category(__first));
      |                                       ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
a.cc:21:12:   required from here
   21 |                                 reverse(a[i - 1], a[i]);
      |                                 ~~~~~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_types.h:239:5: error: no type named 'iterator_category' in 'struct std::iterator_traits<int>'
  239 |     __iterator_category(const _Iter&)
      |     ^~~~~~~~~~~~~~~~~~~
Language: C++

#include <stdio.h>
#define N 100

int main(){

  int n,i,j,temp,flag=0;
  int array[N];

  scanf("%d",&n);

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

  for(i=0;i<n;i++){
    for(j=n-1;j>i;j--){
      if(array[j]<array[j-1]){

	temp=array[j];
	array[j]=array[j-1];
	array[j-1]=temp;
	flag++;

      }

    }
  }

  for(i=0;i<n;i++)
    printf("%d ",array[i]);

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


  return 0;
}
  
  

Compiler output:
a.cc: In function 'int main()':
a.cc:31:15: error: expected ';' before 'printf'
   31 |   printf("\n")
      |               ^
      |               ;
   32 |   printf("%d\n",flag);
      |   ~~~~~~