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

#include<iostream>

using namespace std;

/*void print(int a[],int n)
{
    for(int i=0;i<n;i++)
        {
            cout<<a[i];
            if(i!=n-1)
                cout<<" ";
        }
    cout<<endl;
}
*/
int main()
{
    int n,i,j,v=0,temp;
    int a[100];
    cin>>n;
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    }

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

        }

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

}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:24: error: 'A' was not declared in this scope
   32 |                 temp = A[j];
      |                        ^
a.cc:41:15: error: 'N' was not declared in this scope
   41 |    for(i =0;i<N;i++){
      |               ^
a.cc:43:15: error: 'A' was not declared in this scope
   43 |         cout<<A[i];
      |               ^
Language: C++

#include <iostream>
#include <utility>

#define MAX_N 100

void bubble_sort(int*,int);

int A[MAX_N];
int count = 0;

void solve(){
    int n;
    scanf("%d",&n);
    for(int i = 0; i < n; i++){
        scanf("%d",&A[i]);
    }
    bubble_sort(A,n);
    for(int i = 0; i < n; i++){
        printf("%d ",A[i]);
    }
    printf("\n");
    printf("%d\n",count);

}

void bubble_sort(int* a,int n){
    for(int i = 0; i < n; i++){
        for(int j = (n - 1); j > i; j--){
            if(A[j] < A[j-1]){
                std::swap(A[j],A[j-1]);
                count++;
            }
        }
    }
}

Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
using namespace std;

int bubbleSort(int A[],int N) {
	int sw = 0; // ???????????° 0??§?????????
	bool flag = 1;
	while(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(void) {
	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:7:22: error: expected ')' before ';' token
    7 |         while(int i=0; flag; i++) {
      |              ~       ^
      |                      )
a.cc:7:30: error: 'i' was not declared in this scope
    7 |         while(int i=0; flag; i++) {
      |                              ^
Language: C++

#include <iostream>
using namespace std;

int bubbleSort(int A[],int N) {
	int sw = 0;
	bool flag = 1;
	while(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(void) {
	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:7:22: error: expected ')' before ';' token
    7 |         while(int i=0; flag; i++) {
      |              ~       ^
      |                      )
a.cc:7:30: error: 'i' was not declared in this scope
    7 |         while(int i=0; flag; i++) {
      |                              ^
Language: C++

int bubbleSort(int A[], int N) {
  int flag, j, num;
  flag = 1;
  num = 0;
  while ( flag ) {
    flag = 0;
    for ( j = N - 1; j >= 1; j-- ) {
      if ( A[j] < A[j - 1]) {
        int v = A[j];
        A[j] = A[j - 1];
        A[j - 1] = v;
        num++;
        flag = 1;
      }
    }
  }
  return num;
}

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

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

  num = bubbleSort(A, N);
  for ( i = 0; i < N; i++ ) printf("%d", A[i]);
  printf("\n");
  printf("%d", num);
  printf("\n");

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:3: error: 'scanf' was not declared in this scope
   24 |   scanf("%d", &N);
      |   ^~~~~
a.cc:28:29: error: 'printf' was not declared in this scope
   28 |   for ( i = 0; i < N; i++ ) printf("%d", A[i]);
      |                             ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | int bubbleSort(int A[], int N) {
a.cc:29:3: error: 'printf' was not declared in this scope
   29 |   printf("\n");
      |   ^~~~~~
a.cc:29:3: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
Language: C++

int bubbleSort(int A[], int N) {
  int flag, j, num;
  flag = 1;
  num = 0;
  while ( flag ) {
    flag = 0;
    for ( j = N - 1; j >= 1; j-- ) {
      if ( A[j] < A[j - 1]) {
        int v = A[j];
        A[j] = A[j - 1];
        A[j - 1] = v;
        num++;
        flag = 1;
      }
    }
  }
  return num;
}

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

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

  num = bubbleSort(A, N);
  for ( i = 0; i < N; i++ ) printf("%d", A[i]);
  printf("\n");
  printf("%d", num);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:3: error: 'scanf' was not declared in this scope
   24 |   scanf("%d", &N);
      |   ^~~~~
a.cc:28:29: error: 'printf' was not declared in this scope
   28 |   for ( i = 0; i < N; i++ ) printf("%d", A[i]);
      |                             ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | int bubbleSort(int A[], int N) {
a.cc:29:3: error: 'printf' was not declared in this scope
   29 |   printf("\n");
      |   ^~~~~~
a.cc:29:3: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
Language: C++



#include <iostream>
using namespace std;
 
int main() {
    int N, count=0;
    const int MAX_N = 100;
    int a[MAX_N];
     
    cin >> N;
    for(int i=0; i<N; i++){
        cin >> a[i];
    }
     
    int tmp;
    for(int i=0; i<N-1; i++){
        for(int j=N-1; j>=i+1; j--){
            if(a[j-1]>a[j]){
                tmp = a[j];
                a[j] = a[j-1];
                a[j-1] = tmp;
                count++;
            }
        }
    }
     
    if(N==1){
        cout << a[0] <<endl;
        cout << 0 << endl;
        return 0;
    }
     
    for(int i=0; i<N-1; i++){
        cout << a[i] << " ";
    }
    cout << a[N-1] << endl;
    cout << count << endl;
}
 

 
Compile Error Logs: 

You are not authorized to see the message. 
 
 
??????????????? 
Judge: 10/10  C++  CPU: 00.00 sec  Memory: 1160 KB  Length: 512 B  2016-06-21 10:05  2016-06-21 10:05  
???????????±????????????????????? 
Case # Verdict CPU Time Memory In Out Case Name 
 Case #1: : Accepted  00.00 sec 1160 KB    
 Case #2: : Accepted  00.00 sec 1160 KB    
 Case #3: : Accepted  00.00 sec 1160 KB    
 Case #4: : Accepted  00.00 sec 1160 KB    
 Case #5: : Accepted  00.00 sec 1156 KB    
 Case #6: : Accepted  00.00 sec 1156 KB    
 Case #7: : Accepted  00.00 sec 1160 KB    
 Case #8: : Accepted  00.00 sec 1160 KB    
 Case #9:  

Compiler output:
a.cc:50:12: error: extended character ± is not valid in an identifier
   50 | ???????????±?????????????????????
      |            ^
a.cc:51:6: error: stray '#' in program
   51 | Case # Verdict CPU Time Memory In Out Case Name
      |      ^
a.cc:52:7: error: stray '#' in program
   52 |  Case #1: : Accepted  00.00 sec 1160 KB
      |       ^
a.cc:53:7: error: stray '#' in program
   53 |  Case #2: : Accepted  00.00 sec 1160 KB
      |       ^
a.cc:54:7: error: stray '#' in program
   54 |  Case #3: : Accepted  00.00 sec 1160 KB
      |       ^
a.cc:55:7: error: stray '#' in program
   55 |  Case #4: : Accepted  00.00 sec 1160 KB
      |       ^
a.cc:56:7: error: stray '#' in program
   56 |  Case #5: : Accepted  00.00 sec 1156 KB
      |       ^
a.cc:57:7: error: stray '#' in program
   57 |  Case #6: : Accepted  00.00 sec 1156 KB
      |       ^
a.cc:58:7: error: stray '#' in program
   58 |  Case #7: : Accepted  00.00 sec 1160 KB
      |       ^
a.cc:59:7: error: stray '#' in program
   59 |  Case #8: : Accepted  00.00 sec 1160 KB
      |       ^
a.cc:60:7: error: stray '#' in program
   60 |  Case #9:
      |       ^
a.cc:43:1: error: 'Compile' does not name a type
   43 | Compile Error Logs:
      | ^~~~~~~
Language: C++

#include <cstdio>
#include <iostream>
using namespace std;
const int N = 1000;

int BubbleSort(int a[], int n)
{
	int ans = 0;
	bool flag = 1;
	while (flag)
	{
		flag = 0;
		for (int j = n - 1; j >= i+1; j--)
		{
			if (a[j] < a[j - 1])
			{
				swap(a[j], a[j - 1]);
				ans++;
				flag = 1;
			}
		}
	}
	return ans;
}

int main() {
	int n, i,ans;
	int A[N + 1];
	scanf("%d", &n);
	for (i = 0; i < n; i++) scanf("%d", &A[i]);
	ans=BubbleSort(A, n);
	for (i = 0; i < n; i++)
	{
		if (i > 0) printf(" ");
		printf("%d", A[i]);
	}
	printf("\n%d\n", ans);
	return 0;
}

Compiler output:
a.cc: In function 'int BubbleSort(int*, int)':
a.cc:13:42: error: 'i' was not declared in this scope
   13 |                 for (int j = n - 1; j >= i+1; j--)
      |                                          ^
Language: C++

#include <iostream>

using namespace std;

//bubble sort


int main() {

    int n, tmp;
    int a[100];
    int count = 0;
    int flag = 1;

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

    }


    while (flag) {
        flag = 0;
        for (int j=n-1; j>=1; j--){
            if (a[j] < a[j-1]) {
                tmp = a[j];
                a[j] = a[j-1];
                a[j-1] = tmp;
                flag = 1;
                count++;
            }
        }
    }

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

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:20: error: expected ';' before '}' token
   17 |         cin >> a[i]
      |                    ^
      |                    ;
   18 | 
   19 |     }
      |     ~
Language: C++

#include<iostream>
#include<algorithm>

static const int N = 100000;
using namespace std;
int a[N];

int main() {
  int n;
  cin>>n;
  for (int i =0;i<n;i++){
      cin>> a[i];
  }
  int cnt;
  int flag;
  for (int i=0;i<n;i++){
      for (int j=i;j>0;j--){
          flag = 0;
          if (a[j]<a[j-1]){
              int temp = a[j];
              a[j]=a[j-1];
              a[j-1]=temp;
              flag = 1;
          }
          if(flag==1) cnt++;
      }
  }
  for (int i=0;i<n;i++){
      flag=0;
      if (a[j]<a[j-1]){
              int temp = a[j];
              a[j]=a[j-1];
              a[j-1]=temp;
              flag=1;
      }
      if(flag==1) cnt++;
  }
  for (int i=0;i<n;i++) {
      if(i>0) cout << " ";
      cout << a[i];
  }
  cout << cnt;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:13: error: 'j' was not declared in this scope
   30 |       if (a[j]<a[j-1]){
      |             ^
Language: C++

#include<iostream>
#include<algorithm>

static const int N = 100000;
using namespace std;
int a[N];

int main() {
  int n;
  cin>>n;
  for (int i =0;i<n;i++){
      cin>> a[i];
  }
  int cnt;
  int flag;
  for (int i=0;i<n;i++){
      for (int j=i;j>0;j--){
          flag = 0;
          if (a[j]<a[j-1]){
              int temp = a[j];
              a[j]=a[j-1];
              a[j-1]=temp;
              flag = 1;
          }
          if(flag==1) cnt++;
      }
  }
  for (int j=0;i<n;i++){
      flag=0;
      if (a[j]<a[j-1]){
              int temp = a[j];
              a[j]=a[j-1];
              a[j-1]=temp;
              flag=1;
      }
      if(flag==1) cnt++;
  }
  for (int i=0;i<n;i++) {
      if(i>0) cout << " ";
      cout << a[i];
  }
  cout << cnt;
  return 0;
}

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

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

int main(void)
{	
	int n, a[100];
	cin >> n;
	for (int i = 0; i < n; i++) cin >> a[i];
	
	int num = sort(a, n);
	
	for (int i = 0; i < n; i++) {
		cout << a[i];
		if (i < n - 1) cout << " ";
		else cout << endl;
	}
	cout << num << endl;
	
	return 0;
}

int sort(int a[], int n)
{
	int cnt = 0;
	int flag = 1;
	while (flag) {
		for (j = n - 1; j >= 1; j--) {
			if (a[j] < a[j-1]) {
				int temp = a[j];
				a[j] = a[j-1];
				a[j-1] = temp;
				flag = 1;
				cnt++;
			}
		}
	}
	
	return cnt;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:19: error: 'sort' was not declared in this scope; did you mean 'short'?
   11 |         int num = sort(a, n);
      |                   ^~~~
      |                   short
a.cc: In function 'int sort(int*, int)':
a.cc:28:22: error: 'j' was not declared in this scope
   28 |                 for (j = n - 1; j >= 1; j--) {
      |                      ^
Language: C++

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

int sort(int a[], int n);

int main(void)
{	
	int n, a[100];
	cin >> n;
	for (int i = 0; i < n; i++) cin >> a[i];
	
	int num = sort(a, n);
	
	for (int i = 0; i < n; i++) {
		cout << a[i];
		if (i < n - 1) cout << " ";
		else cout << endl;
	}
	cout << num << endl;
	
	return 0;
}

int sort(int a[], int n)
{
	int cnt = 0;
	int flag = 1;
	while (flag) {
		for (j = n - 1; j >= 1; j--) {
			if (a[j] < a[j-1]) {
				int temp = a[j];
				a[j] = a[j-1];
				a[j-1] = temp;
				flag = 1;
				cnt++;
			}
		}
	}
	
	return cnt;
}

Compiler output:
a.cc: In function 'int sort(int*, int)':
a.cc:30:22: error: 'j' was not declared in this scope
   30 |                 for (j = n - 1; j >= 1; j--) {
      |                      ^
Language: C++

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

inline void swap(int *a, int *b);
int sort(int a[], int n);

int main(void)
{	
	int n;
	cin >> n;
	a = new int[n];
	for (int i = 0; i < n; i++) cin >> a[i];
	
	int num = sort(a, n);
	
	for (int i = 0; i < n; i++) {
		cout << a[i];
		if (i < n - 1) cout << " ";
		else cout << endl;
	}
	cout << num << endl;
	
	delete[] a;
	return 0;
}

int sort(int a[], int n)
{
	int cnt = 0;
	for (int i = 0; i < n; i++) {
		for (int j = n - 1; j > i; i--) {
			if (a[j] < a[j-1]) {
				swap(a[j], a[j-1]);
				cnt++;
			}
		}
	}
	
	return cnt;
}


inline void swap(int *a, int *b)
{
	int temp = *a;
	*a = *b;
	*b = temp;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:9: error: 'a' was not declared in this scope
   12 |         a = new int[n];
      |         ^
a.cc:24:9: error: type '<type error>' argument given to 'delete', expected pointer
   24 |         delete[] a;
      |         ^~~~~~~~~~
Language: C++

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

int partition(int A[],int p,int r){
	int x=A[r];
	int i=p-1;
	
	for(int j=p;j<=r-1;j++){
		if(A[j]<=x){
			i++;	
			swap(A[i],A[j]);
		}
	}

	swap(A[i+1],A[r]);

	return i+1;
}

int main(){
	int n;
	cin>>n;
	
	Card A[100000];
	for(int i=0;i<n;i++){
		cin>>A[i];
	}
	
	int q=partition(A,0,n-1);
	
	for(int i=0;i<n;i++){
		if(i==q){
			cout<<'['<<A[i]<<']'<<endl;
		}
		else{
			cout<<A[i];
		}
		
		if(i<n-1){
			cout<<' ';
		}
		else{
			cout<<endl;
		}
	}
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:9: error: 'Card' was not declared in this scope
   25 |         Card A[100000];
      |         ^~~~
a.cc:27:22: error: 'A' was not declared in this scope
   27 |                 cin>>A[i];
      |                      ^
a.cc:30:25: error: 'A' was not declared in this scope
   30 |         int q=partition(A,0,n-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(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 main()':
a.cc:22:5: error: 'i' was not declared in this scope
   22 | for(i=0;i<N;i++) cin >>A[i];
      |     ^
Language: C++

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

    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    for(int i = 0; i < n; i++){
        for(int j = n; j > i; j--){
            if(a[j] < a[j-1]){
                int b = a[j];
                a[j] = a[j-1];
                a[j-1] = b;
                count++
            }
        }
    }
    for(int i = 0; i < n; i++){
        cout << a[i];
        if(i != n) cout << " ";
    }
    cout << endl << count << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:5: error: expected ',' or ';' before 'for'
    9 |     for(int i = 0; i < n; i++){
      |     ^~~
a.cc:9:20: error: 'i' was not declared in this scope
    9 |     for(int i = 0; i < n; i++){
      |                    ^
a.cc:18:24: error: expected ';' before '}' token
   18 |                 count++
      |                        ^
      |                        ;
   19 |             }
      |             ~
Language: C++

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

    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    for(int i = 0; i < n; i++){
        for(int j = n; j > i; j--){
            if(a[j] < a[j-1]){
                int b = a[j];
                a[j] = a[j-1];
                a[j-1] = b;
                count++
            }
        }
    }
    for(int i = 0; i < n; i++){
        cout << a[i];
        if(i != n) cout << " ";
    }
    cout << endl << count << endl;
    return 0;
}

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

#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int n,count = 0,b;
    cin >> n;
    vector <int> a(n);

    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    for(int i = 0; i < n; i++){
        for(int j = n; j > i; j--){
            if(a[j] < a[j-1]){
                b = a[j];
                a[j] = a[j-1];
                a[j-1] = b;
                count++
            }
        }
    }
    for(int i = 0; i < n; i++){
        cout << a[i];
        if(i != n) cout << " ";
    }
    cout << endl << count << endl;
    return 0;
}

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

#include <bits/stdc++.h>
using namespace std;
 
int main()
{
  int n,h,count=0;
 
  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;j>i;j--){
          if(a[j] < a[j-1]){
              h = a[j];
              a[j] = a[j-1];
              a[j-1] = h;
              count++;
              }
        }
    }
 
  for(int i=0;i<n;i++){
      cout << a[i];    
      if(i != N)cout << " ";
      }
  cout << endl << count << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:15: error: 'N' was not declared in this scope
   29 |       if(i != N)cout << " ";
      |               ^
Language: C++

#include <iostream>
#include <vector>

using namespace std;
using std::vector;

#define MAX_N 100

void print(vector<int>& A, int N) {
  for (int i = 0; i < N - 1; i++)
    cout << A[i] << " ";
  cout << A[N-1] << endl;
}

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

int main() {

  vector<int> A;
  int N, sw;

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

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

Compiler output:
a.cc: In function 'int bubbleSort(std::vector<int>&, int)':
a.cc:20:39: error: 'aA' was not declared in this scope; did you mean 'A'?
   20 |     for (int j = N - 1; j >= 1; j--) {aA
      |                                       ^~
      |                                       A
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;
static const int MAX=200000;
int mian()
{
	int n,R[MAX];
	cin>>n;
	for(int i=0;i<n;i++)
	cin>>R[i];
	int maxv=-2000000000;
	int minv=2000000000;
	for(int i=0;i,n;i++)
	{
	maxv=max(maxv,R[i]-minv);
	minv=min(minv,R[i]);
    }
	cout<<maxv<<endl;
	return 0;
}

Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

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

void print_vector(vector<int>& v)
{
    for (vector<int>::iterator it = v.begin(); it != v.end(); it++)
    {
        std::cout << *it << " ";
    }
    std::cout << endl;
}

int main()
{
#ifdef LOCAL
    // ??\??? cin ?????\????????? 'xxx.txt' ?????????
    std::ifstream in("alds1_2_a.txt");
    std::cin.rdbuf(in.rdbuf());
#else
#endif        

    vector<int> vec;
    int n = 0;
    int change_num = 0;

    cin >> n;
    for(int i = 0; i < n; ++i)
    {
        int tmp;
        cin >> tmp;
        vec.push_back(tmp);
    }
    
    for (int i = 0; i < n; i++)
    {
        for (int j = n - 1; j > 0; j--)
        {
            if (vec[j-1] > vec[j])
            {
                int tmp = vec[j-1];
                vec[j-1] = vec[j];
                vec[j] = tmp;
                change_num++;
            }
        }
        
    }

    print_vector(vec);
    cout << change_num
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:52:23: error: expected ';' before 'return'
   52 |     cout << change_num
      |                       ^
      |                       ;
   53 |     return 0;
      |     ~~~~~~
Language: C++

#include <iostream>

const int MAX = 110;

int count = 0;

void bubble_sort(int a[], int n) {
    for (int i = 0; i < n-1; ++i) {
        for (int j = i+1; j < n; ++j) {
            if (a[j] < a[i]) {
                int t = a[j]; a[j] = a[i]; a[i] = t;
                ++count;
            }
        }
    }
}

int main()
{
    int N;
    cin >> N;
    int a[MAX];
    for (int i = 0; i < N; ++i) cin >> a[i];
    bubble_sort(a, N);
    for (int i = 0; i < N; ++i) {
        if (i) cout << " ";
        cout << a[i];
    }
    cout << endl << count << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   21 |     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:26:16: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   26 |         if (i) 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:27:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   27 |         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:29:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   29 |     cout << endl << count << 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:29:13: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   29 |     cout << endl << count << 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++

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; i--){
            if(A[j] < A[j-1]){
                swap(A[j], A[j-1]);
                flag = 1;
                sw++;
            }
        }
    }
    
    return sw;
}

int main(){
    int n, A[100], 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:17: error: 'swap' was not declared in this scope; did you mean 'sw'?
    8 |                 swap(A[j], A[j-1]);
      |                 ^~~~
      |                 sw
a.cc: In function 'int main()':
a.cc:20:5: error: 'cin' was not declared in this scope
   20 |     cin >> n;
      |     ^~~
a.cc:26:15: error: 'cout' was not declared in this scope
   26 |         if(i) cout << ' ';
      |               ^~~~
a.cc:27:9: error: 'cout' was not declared in this scope
   27 |         cout << A[i];
      |         ^~~~
a.cc:29:5: error: 'cout' was not declared in this scope
   29 |     cout << endl;
      |     ^~~~
a.cc:29:13: error: 'endl' was not declared in this scope
   29 |     cout << endl;
      |             ^~~~
Language: C++

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

 int counter = 0;   //count???????´???????????????¨???

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

	int flag = 1;
	int tmp;
	while (flag) {
		flag = 0;
		for(int j=N-1;j>=1;j--)
			if (A[j] < A[j - 1]) {
				tmp = A[j - 1];
				A[j - 1] = A[j];
				A[j] = tmp;
		     	flag = 1;
		     	counter++;
			}
	}
}

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

	bubbleSort(A, N);

	for (int i = 0;i < N;i++) {
		cout << A[i];
		if (i != N - 1) cout << ' ';
	}
	cout<<'\n '<<counter;
	return 0;
}}

Compiler output:
a.cc:36:15: warning: multi-character character constant [-Wmultichar]
   36 |         cout<<'\n '<<counter;
      |               ^~~~~
a.cc:38:2: error: expected declaration before '}' token
   38 | }}
      |  ^
Language: C++

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

void int_display(int *A,int n)
{
  int i;
  for(i=0;i<n;i++){
    printf("%d",A[i]);
    if(i<n-1) printf(" ");
  }
  printf("\n");
}

int bubble_sort(int *A,int n)
{
  int i,j,Aj,swap;
  swap=0;
  for(i=0;i<n;i++){
    for(j=n-1;j>i;j--){
      if(A[j]<A[j-1]){
        Aj=A[j];
        A[j]=A[j-1];
        A[j-1]=Aj;
        swap++;
      }
    }
  }
  return swap;
}

int main()
{
  int *A;
  int i,n,swap;
  scanf("%d",&n);
  A=malloc(n*sizeof(int));
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  swap=bubble_sort(A,n);
  int_display(A,n);
  printf("%d\n",swap);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:11: error: invalid conversion from 'void*' to 'int*' [-fpermissive]
   38 |   A=malloc(n*sizeof(int));
      |     ~~~~~~^~~~~~~~~~~~~~~
      |           |
      |           void*
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;
  coutVVsw<<endl;

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:3: error: 'coutVVsw' was not declared in this scope
   33 |   coutVVsw<<endl;
      |   ^~~~~~~~
Language: C++

#include <iostream>
using namespace std;

int bubbleSort(int A[], N){
	int swapNumber = 0;
	int flag = 1;
	int i, j;
	for(i = 0; flag; i++){
		flag = 0;
		for(j = N-1, j >= i+1; j--){
			if(A[j - 1] > A[j]){
				swap(A[j], A[j - 1]);
				swapNumber++;
			}
		}
	}
	return swapNumber;
}
int main(int argc, char const *argv[])
{
	int A[100];
	int N, swapNumber;
	cin >> N;
	for(int i = 0; i < N; i++){
		cin >> A[i];
	}
	swapNumber = bubbleSort(A, N);
	for(int i = 0; i < N; i++){
		if(i){
			cout << " ";
		}
		cout << A[i];
	}
	cout << endl;
	cout << swapNumber <<endl;
}

Compiler output:
a.cc:4:25: error: 'N' has not been declared
    4 | int bubbleSort(int A[], N){
      |                         ^
a.cc: In function 'int bubbleSort(int*, int)':
a.cc:10:25: error: 'N' was not declared in this scope
   10 |                 for(j = N-1, j >= i+1; j--){
      |                         ^
a.cc:10:43: error: expected ';' before ')' token
   10 |                 for(j = N-1, j >= i+1; j--){
      |                                           ^
      |                                           ;
Language: C++

#include <iostream>
using namespace std;

int bubbleSort(int A[], int N){
	int swapNumber = 0;
	int flag = 1;
	int i, j;
	for(i = 0; flag; i++){
		flag = 0;
		for(j = N-1, j >= i+1; j--){
			if(A[j - 1] > A[j]){
				swap(A[j], A[j - 1]);
				swapNumber++;
			}
		}
	}
	return swapNumber;
}
int main(int argc, char const *argv[])
{
	int A[100];
	int N, swapNumber;
	cin >> N;
	for(int i = 0; i < N; i++){
		cin >> A[i];
	}
	swapNumber = bubbleSort(A, N);
	for(int i = 0; i < N; i++){
		if(i){
			cout << " ";
		}
		cout << A[i];
	}
	cout << endl;
	cout << swapNumber <<endl;
}

Compiler output:
a.cc: In function 'int bubbleSort(int*, int)':
a.cc:10:43: error: expected ';' before ')' token
   10 |                 for(j = N-1, j >= i+1; j--){
      |                                           ^
      |                                           ;
Language: C++

// bubblesort.cpp : ??????????????? ??¢????????±????????§????????¨????????? ?????????????????????????????????
//

#include "stdafx.h"


int main()
{
    int N, a, A[1000],j,x;
    scanf("%d", &N);

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

    int flag = 1;
    
    while (flag) {
       flag = 0;
        for (j = N - 1;  j > 0; j--) {
            if (A[j] < A[j - 1]) {
                x = A[j];
                A[j] = A[j - 1];
                A[j - 1] = x;
                flag = 1;
            }
        }
    }
    int i = (N*N - N) / 2;

    for (j = 0; j < N - 1; j++)
        printf("%d ", A[j]);

    printf("%d\n", A[N - 1]);
    printf("%d", i);
    return 0;
}

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

#include<iostream>
 
using namespace std;

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

    int i = 0, j, v, count = 0, flag = 1;

    while (flag) {

        flag = 0;

        for (j = n - 1; j >= i + 1; j--) {

            if (A[j] < A[j - 1]) {

                v = A[j];
                A[j] = A[j - 1];
                A[j - 1] = v;


                flag = 1;

                count++:

            }

        }

    }

    return count;

}

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

    count = bubbleSort (A, n);

    for (i = 0; i < n; i++) {

        cout << A[i];

        if (i < n - 1) {

            cout << " ";

        }

    }

    cout << endl;
    cout << count << endl;

    return 0;

}

}

Compiler output:
a.cc: In function 'int bubbleSort(int*, int)':
a.cc:24:24: error: expected ';' before ':' token
   24 |                 count++:
      |                        ^
      |                        ;
a.cc: At global scope:
a.cc:69:1: error: expected declaration before '}' token
   69 | }
      | ^
Language: C++

#include<iostream>
 
using namespace std;

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

    int i = 0, j, v, count = 0, flag = 1;

    while (flag) {

        flag = 0;

        for (j = n - 1; j >= i + 1; j--) {

            if (A[j] < A[j - 1]) {

                v = A[j];
                A[j] = A[j - 1];
                A[j - 1] = v;


                flag = 1;

                count += 1:

            }

        }

    }

    return count;

}

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

    count = bubbleSort (A, n);

    for (i = 0; i < n; i++) {

        cout << A[i];

        if (i < n - 1) {

            cout << " ";

        }

    }

    cout << endl;
    cout << count << endl;

    return 0;

}

Compiler output:
a.cc: In function 'int bubbleSort(int*, int)':
a.cc:24:27: error: expected ';' before ':' token
   24 |                 count += 1:
      |                           ^
      |                           ;
Language: C++

#include<iostream>
 
using namespace std;

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

    int i = 0, j, v, count = 0;
    bool flag = 1;

    while (flag) {

        flag = 0;

        for (j = n - 1; j >= i + 1; j--) {

            if (A[j] < A[j - 1]) {

                v = A[j];
                A[j] = A[j - 1];
                A[j - 1] = v;


                flag = 1;

                count += 1:

            }

        }

    }

    return count;

}

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

    count = bubbleSort (A, n);

    for (i = 0; i < n; i++) {

        cout << A[i];

        if (i < n - 1) {

            cout << " ";

        }

    }

    cout << endl;
    cout << count << endl;

    return 0;

}

Compiler output:
a.cc: In function 'int bubbleSort(int*, int)':
a.cc:25:27: error: expected ';' before ':' token
   25 |                 count += 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++;
          }
       }
   }
   retun sw;
}


int main() {

   int A[100], N, sw;
   cin >> N;

   for (int i = 0; i < N; 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:19:4: error: 'retun' was not declared in this scope
   19 |    retun sw;
      |    ^~~~~
a.cc:20:1: warning: no return statement in function returning non-void [-Wreturn-type]
   20 | }
      | ^
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++;
          }
       }
   }
   retun 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:19:4: error: 'retun' was not declared in this scope
   19 |    retun sw;
      |    ^~~~~
a.cc:20:1: warning: no return statement in function returning non-void [-Wreturn-type]
   20 | }
      | ^
Language: C++

#include<stdio.h>

void bubbleSort(int A[], int N){
  int i, j, k, count = 0;
  for( i = 0; i < N; i++ ){
    for(j = i + 1 ; j < N; j++ ){
      if(A[i] > A[j]){
        k = A[j];
        A[j] = A[i];
        A[i] = k;
        count += 1;
      }
    }
  }
  space(A, N);
  printf("%d\n",count);
}

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

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

Compiler output:
a.cc: In function 'void bubbleSort(int*, int)':
a.cc:15:3: error: 'space' was not declared in this scope
   15 |   space(A, N);
      |   ^~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){ 
    int N; cin >> N;
    vector<int> v;
    for(int i=0; i<N; i++){
        int a; cin >> a;
        v.push_back(a);
    }
    int flag = 1, cnt = 0;
    while(flag){
        flag = 0;
        for(int j = N-1; j >= 1; j--){
            if(v[j] < v[j-1]){
                swap(v[j], v[j-1]);
                cnt++;
                flag = 1;
            }
        }
    }
    for(int i = 0; i < N; i++){
        if(i == N-1){
            cout << v[i] << endl;
            break;
        }
        cout << v[i];
    }
    cout << cnt << endl;
    return

Compiler output:
a.cc: In function 'int main()':
a.cc:29:11: error: expected primary-expression at end of input
   29 |     return
      |           ^
a.cc:29:11: error: expected ';' at end of input
   29 |     return
      |           ^
      |           ;
a.cc:29:11: error: expected '}' at end of input
a.cc:3:11: note: to match this '{'
    3 | int main(){
      |           ^
Language: C++

package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)

	a := make([]int, n)
	for i := range a {
		fmt.Scan(&a[i])
	}

	flag := true
	sortedIndex := 0
	swapCount := 0

	for flag {
		flag = false
		for i := n - 1; i > sortedIndex; i-- {
			if a[i] < a[i-1] {
				a[i], a[i-1] = a[i-1], a[i]
				flag = true
				swapCount++
			}
		}
		sortedIndex++
	}

	fmt.Println(a)
	fmt.Println("swap count:", swapCount)
}

Compiler output:
a.cc:1:1: error: 'package' does not name a type
    1 | package main
      | ^~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,cnt=0;
    scanf("%d",&n);
    int arr[n];
    for(int i=0;i<n;i++)
    scanf("%d",&arr[i]);
     for(int i=0;i<n;i++)
         for(int j=0;j<n-i;j++)
         {
             if(arr[j]>arr[j+1])
             {
                 swap(arr[j],arr[j+1]);
                 cnt++;
             }
         }
 for(int i=0;i<n-1;i++)
    printf("%d ",arr[i]);
printf("%d",arr[n-1];
 printf("\n%d",cnt);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:21: error: expected ')' before ';' token
   21 | printf("%d",arr[n-1];
      |       ~             ^
      |                     )
Language: C++

#define _CRT_SECURE_NO_WARNINGS

#include <vector>
#include <deque>
#include <list>
#include <forward_list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <tuple>
#include <functional>
#include <limits>
#include <utility>
#include <string>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cstring>

using namespace std;

// Print each element of a container.
template <typename Container>
void print(const Container& container)
{
    stringstream sstream;

    string delim("");
	for (const auto& element : container)
	{
		sstream << delim << element;
        delim = " ";
	}

    cout << sstream.str() << endl;
}

template <typename Container>
int bubbleSort(Container& container)
{
    int count(0);

    for(auto it(begin(container)); it != end(container); ++it)
    {
        for(auto jt(prev(end(container))); jt != it; --jt)
        {
            if(*jt < *prev(jt))
            {
                iter_swap(jt, prev(jt));
                ++count;
            }
        }
    }

    return count;
}

int main()
{
    vector<int> v;

    int n;
    cin >> n;

    for(size_t i(0); i < n; ++i)
    {
        int x;
        cin >> x;

        v.push_back(x);
    }

    int count(selectionSort(v));

    print(v);

    cout << count << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:77:15: error: 'selectionSort' was not declared in this scope
   77 |     int count(selectionSort(v));
      |               ^~~~~~~~~~~~~
Language: C++

#include<iostream>
using namespace std;

void 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; j-- ){
      if (A[j] < A[j-1]) {
        swap(A[j], A[j-1]);
        flag = 1;
        sw++;
      }
    }
  }
  return sw;
}
       

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

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

  sw = bubbleSort(A, N);

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

  return 0;
}

  


Compiler output:
a.cc: In function 'void bubbleSort(int*, int)':
a.cc:17:10: error: return-statement with a value, in function returning 'void' [-fpermissive]
   17 |   return sw;
      |          ^~
a.cc: In function 'int main()':
a.cc:26:9: error: 'i' was not declared in this scope
   26 |   for ( i = 0; i < N; i++) cin >> A[i]
      |         ^
a.cc:30:19: error: expected ';' before 'i'
   30 |   for ( int i = 0l i < N; i ++ ) {
      |                   ^~
      |                   ;
Language: C++

#include<iostream>
using namespace std;
 
void 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; j-- ){
      if ( A[j] < A[j-1] ) {
        swap(A[j], A[j-1]);
        flag = 1;
        sw++;
      }
    }
  }
  return sw;
}
        
 
int main() {
  int N, sw;
  int A[100];
 
  cin >> N;
  for ( 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 'void bubbleSort(int*, int)':
a.cc:17:10: error: return-statement with a value, in function returning 'void' [-fpermissive]
   17 |   return sw;
      |          ^~
a.cc: In function 'int main()':
a.cc:26:9: error: 'i' was not declared in this scope
   26 |   for ( i = 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; j-- ){
      if ( A[j] < A[j-1] ) {
        swap(A[j], A[j-1]);
        flag = 1;
        sw++;
      }
    }
  }
  return sw;
}
         
  
int main() {
  int N, sw;
  int A[100];
  
  cin >> N;
  for ( 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 main()':
a.cc:26:9: error: 'i' was not declared in this scope
   26 |   for ( i = 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; j-- ){
      if ( A[j] < A[j-1] ) {
        swap(A[j], A[j-1]);
        flag = 1;
        sw++;
      }
    }
  }
  return sw;
}
          
   
int main() {
  int N, sw;
  int A[100];
   
  cin >> N;
  for ( 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 main()':
a.cc:26:9: error: 'i' was not declared in this scope
   26 |   for ( i = 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 N, sw;
  int A[100];
     
  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:11:9: error: 'swap' was not declared in this scope; did you mean 'sw'?
   11 |         swap(A[j], A[j-1]);
      |         ^~~~
      |         sw
a.cc: In function 'int main()':
a.cc:25:3: error: 'cin' was not declared in this scope
   25 |   cin >> N;
      |   ^~~
a.cc:31:12: error: 'cout' was not declared in this scope
   31 |     if (i) cout << " ";
      |            ^~~~
a.cc:32:5: error: 'cout' was not declared in this scope
   32 |     cout << A[i];
      |     ^~~~
a.cc:34:3: error: 'cout' was not declared in this scope
   34 |   cout << endl;
      |   ^~~~
a.cc:34:11: error: 'endl' was not declared in this scope
   34 |   cout << endl;
      |           ^~~~
Language: C++

#include <iostream>
using namespace std; 
int bubblesort(int a[], int n) {
	bool flag=1;
	int sw = 0;
	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]);
			sw++;
			flag = 1;
		}
	return sw;
}


int main()
{
	int a[100];
	int n;
	int 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 > 0) cout << " ";
		cout << a[i];
	}
	cout << endl;
	cout << sw<<endl;
	
	return 0;
	
}




Compiler output:
a.cc: In function 'int bubblesort(int*, int)':
a.cc:17:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   17 | int main()
      |         ^~
a.cc:17:9: note: remove parentheses to default-initialize a variable
   17 | int main()
      |         ^~
      |         --
a.cc:17:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:18:1: error: a function-definition is not allowed here before '{' token
   18 | {
      | ^
a.cc:35:2: error: expected '}' at end of input
   35 | }
      |  ^
a.cc:3:32: note: to match this '{'
    3 | int bubblesort(int a[], int n) {
      |                                ^
a.cc:35:2: warning: control reaches end of non-void function [-Wreturn-type]
   35 | }
      |  ^
Language: C++

bubble(a,n)
  t = 0           
  for i in 0..n-1
    j = 0
    while a[i-j] < a[i-j-1] and j <= i-1
      k = a[i-j]
      a[i-j] = a[i-j-1]
      a[i-j-1] = k
      j += 1
      t += 1
    end
  end
  print (a)
  print ("\n")
  print (t)
  print("\stimes_exhange\n")
  return 0




Compiler output:
a.cc:3:12: error: too many decimal points in number
    3 |   for i in 0..n-1
      |            ^~~~
a.cc:1:7: error: expected constructor, destructor, or type conversion before '(' token
    1 | bubble(a,n)
      |       ^
Language: C++

def bubble(A,n)
   t = 0           
   for i in 0..n-1
    j = 0
    while A[i-j] < A[i-j-1] and j <= i-1
      k = A[i-j]
      A[i-j] = A[i-j-1]
      A[i-j-1] = k
      j += 1
      t += 1
    end
  end



Compiler output:
a.cc:3:13: error: too many decimal points in number
    3 |    for i in 0..n-1
      |             ^~~~
a.cc:1:1: error: 'def' does not name a type
    1 | def bubble(A,n)
      | ^~~