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

#include<stdio.h>
int main(){
  int ,j,N,count,ch,flag;
  int a[100];
  count=0;
  
  scanf("%d",&N);
  
  for(i=0;i<N;i++){
    scanf("%d",&a[i]);
  }
  flag=1;
  while(flag){
    flag=0;
    for(j=N-1;j>=1;j--){
      if(a[j]<a[j-1]){
	ch=a[j-1];
	a[j-1]=a[j];
	a[j]=ch;
	count++;
	flag=1;
      }
    }
  }

  for(j=0;j<=N-1;j++){
    printf("%d ",a[j]);
  }
  printf("\n");
  printf("%d",count);

  return 0;
}



Compiler output:
main.c: In function 'main':
main.c:3:7: error: expected identifier or '(' before ',' token
    3 |   int ,j,N,count,ch,flag;
      |       ^
main.c:5:3: error: 'count' undeclared (first use in this function)
    5 |   count=0;
      |   ^~~~~
main.c:5:3: note: each undeclared identifier is reported only once for each function it appears in
main.c:7:15: error: 'N' undeclared (first use in this function)
    7 |   scanf("%d",&N);
      |               ^
main.c:9:7: error: 'i' undeclared (first use in this function)
    9 |   for(i=0;i<N;i++){
      |       ^
main.c:12:3: error: 'flag' undeclared (first use in this function)
   12 |   flag=1;
      |   ^~~~
main.c:15:9: error: 'j' undeclared (first use in this function)
   15 |     for(j=N-1;j>=1;j--){
      |         ^
main.c:17:9: error: 'ch' undeclared (first use in this function)
   17 |         ch=a[j-1];
      |         ^~
Language: C

#include<iostream>
using namespace std;

int bubbleSort(int A[],int N){
  int s=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;
        s++;
      }
    }
  }
  return s;
}

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


Compiler output:
main.c:1:9: fatal error: iostream: No such file or directory
    1 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C

#include<stdio.h>

int BubbleSort(int A[],int N){
  int i,j,count=0,tmp;
  
  for(i = 0 ; i < N-1 ; i++){
    for(j = N-1 ; j >= 1 ; j--){
      if(A[j] < A[j - 1]){
	tmp = A[j];
	A[j] = A[j - 1];
	A[j - 1] = tmp;
	count++;
      }
    }
  }
  return count;
}


int main(){
  int N,i,count;

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

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

  prinbt("%d",A[0]);
  for(i = 1 ; i < N ; i++){
    printf(" %d",A[i]);
  }
  
  printf("\n");
  printf("%d\n",count);

  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:33:3: error: implicit declaration of function 'prinbt'; did you mean 'printf'? [-Wimplicit-function-declaration]
   33 |   prinbt("%d",A[0]);
      |   ^~~~~~
      |   printf
Language: C

#include<stdio.h>

int BubbleSort(int A[],int N){
  int i,j,count=0,tmp;
  
  for(i = 0 ; i < N-1 ; i++){
    for(j = N-1 ; j >= 1 ; j--){
      if(A[j] < A[j - 1]){
	tmp = A[j];
	A[j] = A[j - 1];
	A[j - 1] = tmp;
	count++;
      }
    }
  }
  return count;
}


int main(){
  int N,i,count;

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

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

  prinbt("%d",A[0]);
  for(i = 1 ; i < N ; i++){
    printf(" %d",A[i]);
  }
  
  printf("\n");
  printf("%d\n",count);

  return 0;
}



Compiler output:
main.c: In function 'main':
main.c:33:3: error: implicit declaration of function 'prinbt'; did you mean 'printf'? [-Wimplicit-function-declaration]
   33 |   prinbt("%d",A[0]);
      |   ^~~~~~
      |   printf
Language: C

#include<stdio.h>
int main(){
 int flag,i,j,count=0,n;
 scanf("%d",&n);
 int A[n];
 for(i=0;i<n;i++)
 scanf("%d",&A[i]);
   flag = 1;
   while (flag){
     flag = 0;
     for(j=n-1;j>1;j--){
       if (A[j] < A[j-1]){
       count++;
       key = A[j];
         A[j] = A[j-1];
         A[j-1] = key;
       }
     }
     flag = 1;
   }
   for(i=0;i<n;i++)
   printf("%d",A[i]);
   printf("\n%d\n",count);
   return 0;
}


Compiler output:
main.c: In function 'main':
main.c:14:8: error: 'key' undeclared (first use in this function)
   14 |        key = A[j];
      |        ^~~
main.c:14:8: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
int main(){
  int i,j,frag = 1,n,A[100],tmp,count = 0;
  scanf("%d",&n);
  for(i = 0 ; i < n ; i++){
    scanf("%d",&A[i]);
  }
  while(frag != 0){
    frag = 0;
    for(j = n - 1 ; j > 0 ; j--){
      if(A[j] < A[j - 1]){
	tmp = A[j];
	A[j] = A[j - 1];
	A[j - 1] = tmp;
	frag = 1;
	count += 1;
      }
    }
  }
  for(i = 0 ; i < n ; i++){
    if(i == k - 1)printf("%d",A[i]);
    else printf("%d ",A[i]);
  }
  printf("\n");
  printf("%d\n",count);
  return 0;
}



Compiler output:
main.c: In function 'main':
main.c:21:13: error: 'k' undeclared (first use in this function)
   21 |     if(i == k - 1)printf("%d",A[i]);
      |             ^
main.c:21:13: note: each undeclared identifier is reported only once for each function it appears in
Language: C


#include<stdio.h>


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


void insertionSort(int A[], int n){
  int j,i,v;
  for(i = 1;i < n;i++){
    v = A[i];
    j = i - 1;
    while(j >= 0 && A[j] > v){
      A[j+1] = A[j];
      j--;

    }
    A[j + 1] = v;
    output(A, n);
    }
  }

int main(){

  int i,n,j;
  int A[100];

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



Compiler output:
main.c: In function 'output':
main.c:8:23: error: 'x' undeclared (first use in this function)
    8 |     if(i > 0) &&  i < x{
      |                       ^
main.c:8:23: note: each undeclared identifier is reported only once for each function it appears in
main.c:8:24: error: expected ';' before '{' token
    8 |     if(i > 0) &&  i < x{
      |                        ^
      |                        ;
main.c:8:5: error: label 'i' used but not defined
    8 |     if(i > 0) &&  i < x{
      |     ^~
Language: C

#include<stdio.h>

#define NUMBER 100

int main(){

    int i,n;
    int count = 0;
    int flag,stock;
    int A[NUMBER];

    scanf("%d",&n);

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

        scanf("%d",&a[i]);
        
    }

    flag = 1;

    while(flag>0){

        flag = 0;

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

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

                stock = A[i];
                A[i] = A[i-1];
                A[i-1] = stock;
                count++;

                falg = 1;
            }
        }
    }

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

        if(i != n && i != 0){
            printf(" ");
        }

        printf("%d",A[i]);

    }

    printf("\n");
    printf("%d\n",count);
return 0;
}



Compiler output:
main.c: In function 'main':
main.c:16:21: error: 'a' undeclared (first use in this function)
   16 |         scanf("%d",&a[i]);
      |                     ^
main.c:16:21: note: each undeclared identifier is reported only once for each function it appears in
main.c:35:17: error: 'falg' undeclared (first use in this function); did you mean 'flag'?
   35 |                 falg = 1;
      |                 ^~~~
      |                 flag
Language: C

#include<stdio.h>

#define NUMBER 100

int main(){

    int i,n;
    int count = 0;
    int flag,stock;
    int A[NUMBER];

    scanf("%d",&n);

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

        scanf("%d",&a[i]);
        
    }

    flag = 1;

    while(flag>0){

        flag = 0;

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

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

                stock = A[i];
                A[i] = A[i-1];
                A[i-1] = stock;
                count++;

                flag = 1;
            }
        }
    }

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

        if(i != n && i != 0){
            printf(" ");
        }

        printf("%d",A[i]);

    }

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

    return 0;
}


Compiler output:
main.c: In function 'main':
main.c:16:21: error: 'a' undeclared (first use in this function)
   16 |         scanf("%d",&a[i]);
      |                     ^
main.c:16:21: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>

int a[110];

void swap(int &a,int &b);

int main()
{
    int i,j,n;
    while(scanf("%d",&n) != EOF)
    {
        int count = 0;

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

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

        for(i = 0; i < n; i++)
        {
            if(i == n-1)
                printf("%d\n",a[i]);
            else
                printf("%d ",a[i]);
        }
        printf("%d\n",count);
    }
}

void swap(int &a,int &b)
{
    int t;
    t = a;
    a = b;
    b = t;

    return;
}


Compiler output:
main.c:5:15: error: expected ';', ',' or ')' before '&' token
    5 | void swap(int &a,int &b);
      |               ^
main.c: In function 'main':
main.c:23:21: error: implicit declaration of function 'swap' [-Wimplicit-function-declaration]
   23 |                     swap(a[j],a[j-1]);
      |                     ^~~~
main.c: At top level:
main.c:40:15: error: expected ';', ',' or ')' before '&' token
   40 | void swap(int &a,int &b)
      |               ^
Language: C

#include <stdio.h>
int main(void){
  int i, j, cnt = 0, flag, k;
  int numbers[100];
 
  scanf("%d", &k);
   
  for(i = 0;i < k;i++){
    scanf("%d", &numbers[i]);
  }
 
  flag = 1;
  while(flag){
    flag = 0;
      for(j=k-1;j>=1;j--){
        if(r[j] < r[j-1]){
          i = numbers[j-1];
          numbers[j-1] = numbers[j];
          numbers[j] = i;
          flag = 1;
          cnt++;
        }
      }
 
  }
  for(i = 0;i < k-1;i++){
    printf("%d ", numbers[i]);
  }
  printf("%d\n", numbers[i]);
  printf("%d\n", cnt);
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:16:12: error: 'r' undeclared (first use in this function)
   16 |         if(r[j] < r[j-1]){
      |            ^
main.c:16:12: note: each undeclared identifier is reported only once for each function it appears in
Language: C

\#include <stdio.h>
int main(){
  int i, j, n, num[101], cnt=0, tmp;
  
  scanf("%d", &n);
  for(i = 0 ; i < n ; i++){
    scanf("%d", &num[i]);
  }

  for(i = 0 ; i < n ; i++){
    for(j = n-1 ; j > i ; j--){
      if(num[j] < num[j-1]){
	cnt++;
	tmp = num[j];
	num[j] = num[j-1];
	num[j-1] = tmp;
      }
    }
  }

  for(i = 0 ; i < n ; i++){
    printf("%d%c", num[i], (i == n-1)? '\n':' ');
  }
  printf("%d\n", cnt);

  return 0;
}


  

Compiler output:
main.c:1:1: error: stray '\' in program
    1 | \#include <stdio.h>
      | ^
main.c:1:2: error: stray '#' in program
    1 | \#include <stdio.h>
      |  ^
main.c:1:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | \#include <stdio.h>
      |           ^
Language: C

#include<stdio>
void main(int);

main(){
  int N,i,j,k,x;
  int A[101];
  
scanf("%d",&n);
 for(i=0;i<=N;i++){
   scanf("%d"&A[i])
     }
 x=0;
 for(i=0;i<=N;i++){
   for(j=N-1;i<j;j--){
     k=A[j];
     if(A[j] = A[j-1]){}
     A[j]=A[j-1];
A[j-1]=k;
 x++;
   }
 }
 
 for(i=0;i<N;i++){
   if(i != 0)
     {
       printf(" ");
     }
   printf("%d",A[i]);
 }
 printf("\n");
 printf("%d\n",C);
 return 0;
 }

Compiler output:
main.c:1:9: fatal error: stdio: No such file or directory
    1 | #include<stdio>
      |         ^~~~~~~
compilation terminated.
Language: C

#include<stdio>
void main(int);

main(){
  int N,i,j,k,x;
  int A[101];
  
scanf("%d",&n);
 for(i=0;i<=N;i++){
   scanf("%d"&A[i])
     }
 x=0;
 for(i=0;i<=N;i++){
   for(j=N-1;i<j;j--){
     k=A[j];
     if(A[j] = A[j-1]){}
     A[j]=A[j-1];
A[j-1]=k;
 x++;
   }
 }
 
 for(i=0;i<N;i++){
   if(i != 0)
     {
       printf(" ");
     }
   printf("%d",A[i]);
 }
 printf("\n");
 printf("%d\n",x);
 return 0;
 }

Compiler output:
main.c:1:9: fatal error: stdio: No such file or directory
    1 | #include<stdio>
      |         ^~~~~~~
compilation terminated.
Language: C

#include<stdio.h>

int main(void){
	int a,n,b[100000],j,h,w,count;
	
	scanf("%d",&n);
	for(j=0;j<n;++j){
	scanf("%d",%b[j]);
	}
	for(h=0;h<n;++h){
		for(a=h+1;a<n;++h){
			if(b[a]>b[a+1]){
				w=b[a];
				b[a]=b[a+1];
				b[a+1]=w;
				count++;
			}
		}
	}
	for(j=0;j<n-1;++j){
		printf("%d ",b[j]);
	}
	printf("%d\n"b[n-1]);
	printf("%d\n",count);
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:8:20: error: expected expression before '%' token
    8 |         scanf("%d",%b[j]);
      |                    ^
main.c:23:22: error: expected ')' before 'b'
   23 |         printf("%d\n"b[n-1]);
      |               ~      ^
      |                      )
Language: C

#include<stdio.h>
#define N 100
int main(){
int lengh;
int A[N],i,j,key,count=0;
scanf("%d",&lengh);	
for(i=1;i<=lengh;i++){
scanf("%d",&A[i]);}
for(i=1;i<=lengh;i++){
for(j=lengh;j>=i+1;j--){
if(A[j]<A[j-1]){
key=A[j];
A[j]=A[j-1];
A[j-1]=key;
count++;}}}
for(i=1;i<=lengh;i++){
printf("%d",A[i]);
printf("\n%d",count);
return 0;}

Compiler output:
main.c: In function 'main':
main.c:19:1: error: expected declaration or statement at end of input
   19 | return 0;}
      | ^~~~~~
Language: C

#include<stdio.h>
#define N 100
int main(){
int i,j,lengh,key,A[N],mini,count=0,k;
 
scanf("%d",&lengh);
for(i=1;i<=lengh;i++){
scanf("%d",&A[i]);}
     
for(i=1;i<=lengh;i++){
    mini=i;
    for(j=i;j<=lengh;j++){
        if(A[j]<A[mini]){
        mini=j;
        }}         
    if(A[mini]<A[i]){
    key=A[i];
    A[i]=A[mini];
    A[mini]=key;
    count++;}}
    for(i=1;i<=lengh;i++){
        printf("%d ",A[i]);}
    printf("\n%d",count);
    return 0;

Compiler output:
main.c: In function 'main':
main.c:24:5: error: expected declaration or statement at end of input
   24 |     return 0;
      |     ^~~~~~
Language: C

#include<stdio.h>
#define N 100
 
int main(){
  int lengh;
  int A[N],i,j,key,count=0;
  scanf("%d",&lengh);  
for(i=1;i<=lengh;i++){
    scanf("%d",&A[i]);}
  for(i=1;i<=lengh;i++){
    for(j=lengh;j>=i+1;j--){
      if(A[j]<A[j-1]){
    key=A[j];
    A[j]=A[j-1];
    A[j-1]=key;
    count++;}}}
if(lengh=1) {count++;break;}
  for(i=1;i<=lengh;i++){
if(i=lengh) printf("%d\n",A[i]);
 printf("%d",A[i]);

}
  
printf("%d",count);
  return 0;}

Compiler output:
main.c: In function 'main':
main.c:17:22: error: break statement not within loop or switch
   17 | if(lengh=1) {count++;break;}
      |                      ^~~~~
Language: C

#include<stdio.h>
#define N 100
 
int main(){
  int lengh;
  int A[N],i,j,key,count=0;
  scanf("%d",&lengh);  
for(i=1;i<=lengh;i++){
    scanf("%d",&A[i]);}
  for(i=1;i<=lengh;i++){
    for(j=lengh;j>=i+1;j--){
      if(A[j]<A[j-1]){
    key=A[j];
    A[j]=A[j-1];
    A[j-1]=key;
    count++;}}}
if(lengh==1){
count++;
break;}
  for(i=1;i<=lengh;i++){
if(i=lengh) printf("%d\n",A[i]);
 printf("%d",A[i]);

}
  
printf("%d",count);
  return 0;}

Compiler output:
main.c: In function 'main':
main.c:19:1: error: break statement not within loop or switch
   19 | break;}
      | ^~~~~
Language: C

#include<stdio.h>
#define N 100
  
int main(){
  int lengh;
  int A[N],i,j,key,count=0;
  scanf("%d",&lengh); 
for(i=1;i<=lengh;i++){
    scanf("%d",&A[i]);}
  for(i=1;i<=lengh;i++){
 for(j=lengh;j>=i+1;j--){
      if(A[j]<A[j-1]){
    key=A[j];
    A[j]=A[j-1];
    A[j-1]=key;
    count++}}}
  for(i=1;i<=lengh;i++){
if(i=lengh) printf("%d\n",A[i]);
 printf("%d",A[i]);

}
   
printf("%d",count);
  return 0;}

Compiler output:
main.c: In function 'main':
main.c:16:12: error: expected ';' before '}' token
   16 |     count++}}}
      |            ^
      |            ;
Language: C

#include<stdio.h>
#define N 101
  
int main(){
  int lengh;
  int A[N],i,j,key,count=0;
  scanf("%d",&lengh); 
for(i=1;i<=lengh;i++){
    scanf("%d",&A[i]);}
  for(i=1;i<=lengh;i++){
    for(j=lengh;j>=i+1;j--){
      if(A[j]<A[j-1]){
    key=A[j];
    A[j]=A[j-1];
    A[j-1]=key;
    count++;}}}
  for(i=1;i<=lengh;i++){
if(i==lengh){

 printf("%d",A[i]);
 if(i<lengh) printf(" ");
}
   
printf("\n%d",count);
  return 0;}

Compiler output:
main.c: In function 'main':
main.c:25:3: error: expected declaration or statement at end of input
   25 |   return 0;}
      |   ^~~~~~
Language: C

#include<stdio.h>
#define N 100
int main(){

int i,j,a[N],n,m=0,tmp;
scanf("%d",&n);
for(i=0;i<n;i++){
for(j=n-1;j>i;j--){
if(a[j]<a[j-1]){
m++;
tmp=a[j];
a[j]=a[j-1]:
a[j-1]=tmp;
}
}
for(i=0;i<n;i++){
printf("%d",a[i]);
if(i!=n-1)printf(" ");
else printf("\n%dm\n");
}
return 0;
}

Compiler output:
main.c: In function 'main':
main.c:12:12: error: expected ';' before ':' token
   12 | a[j]=a[j-1]:
      |            ^
      |            ;
main.c:22:1: error: expected declaration or statement at end of input
   22 | }
      | ^
Language: C

#include<stdio.h>
#define N 100
int main(){

int i,j,a[N],n,m=0,tmp;
scanf("%d",&n);
for(i=0;i<n;i++){
for(j=n-1;j>i;j--){
if(a[j]<a[j-1]){
m++;
tmp=a[j];
a[j]=a[j-1]:
a[j-1]=tmp;
}
}
}
for(i=0;i<n;i++){
printf("%d",a[i]);
if(i!=n-1)printf(" ");
else printf("\n%dm\n");
}
return 0;
}

Compiler output:
main.c: In function 'main':
main.c:12:12: error: expected ';' before ':' token
   12 | a[j]=a[j-1]:
      |            ^
      |            ;
Language: C

#include<stdio.h>
#define N 100
int main(){

int i,j,a[N],n,m=0,tmp;
scanf("%d",&n);
for(i=0;i<n;i++){
for(j=n-1;j>i;j--){
if(a[j]<a[j-1]){
m++;
tmp=a[j];
a[j]=a[j-1]:
a[j-1]=tmp;
}
}
}
for(i=0;i<n;i++){
printf("%d",a[i]);
if(i!=n-1)printf(" ");
else printf("\n%d\n",m);
}
return 0;
}

Compiler output:
main.c: In function 'main':
main.c:12:12: error: expected ';' before ':' token
   12 | a[j]=a[j-1]:
      |            ^
      |            ;
Language: C

#include<stdio.h>
define N 100
int main(){

int i,j,a[N],n,m=0,tmp;
scanf("%d",&n);
for(i=0;i<n;i++){
for(j=n-1;j>i;j--){
if(a[j]<a[j-1]){
m++;
tmp=a[j];
a[j]=a[j-1]:
a[j-1]=tmp;
}
}
}
for(i=0;i<n;i++){
printf("%d",a[i]);
if(i!=n-1)printf(" ");
else printf("\n%d\n",m);
}
return 0;
}

Compiler output:
main.c:2:1: error: unknown type name 'define'
    2 | define N 100
      | ^~~~~~
main.c:2:10: error: expected '=', ',', ';', 'asm' or '__attribute__' before numeric constant
    2 | define N 100
      |          ^~~
Language: C

#include<stdio.h>
define N 100
void main(){

int i,j,a[N],n,m=0,tmp;
scanf("%d",&n);
for(i=0;i<n;i++){
for(j=n-1;j>i;j--){
if(a[j]<a[j-1]){
m++;
tmp=a[j];
a[j]=a[j-1]:
a[j-1]=tmp;
}
}
}
for(i=0;i<n;i++){
printf("%d",a[i]);
if(i!=n-1)printf(" ");
else printf("\n%d\n",m);
}
return 0;
}

Compiler output:
main.c:2:1: error: unknown type name 'define'
    2 | define N 100
      | ^~~~~~
main.c:2:10: error: expected '=', ',', ';', 'asm' or '__attribute__' before numeric constant
    2 | define N 100
      |          ^~~
Language: C

#include<stdio.h>
void swap(int*,int*);
int main(){

int i,j,a[100],n,m=0,tmp;
scanf("%d",&n);
for(i=0;i<n;i++)scanf("%d",a[i]);
for(i=0;i<n;i++){
for(j=n-1;j>i;j--){
if(a[j]<a[j-1]){
m++;
sawp(&a[j],&a[j-1]);
}
}
}
for(i=0;i<n;i++){
printf("%d",a[i]);
if(i!=n-1)printf(" ");
else printf("\n%d\n",m);
}
return 0;
}
void swap(int* a , int* b)
{
int tmp;

tmp = a;
a = b;
b = a;
}

Compiler output:
main.c: In function 'main':
main.c:12:1: error: implicit declaration of function 'sawp'; did you mean 'swap'? [-Wimplicit-function-declaration]
   12 | sawp(&a[j],&a[j-1]);
      | ^~~~
      | swap
main.c: In function 'swap':
main.c:27:5: error: assignment to 'int' from 'int *' makes integer from pointer without a cast [-Wint-conversion]
   27 | tmp = a;
      |     ^
Language: C

#include<stdio.h>
void swap(int*,int*);
int main(){

int i,j,a[100],n,m=0,tmp;
scanf("%d",&n);
for(i=0;i<n;i++)scanf("%d",a[i]);
for(i=0;i<n;i++){
for(j=n-1;j>i;j--){
if(a[j]<a[j-1]){
m++;
sawp(&a[j],&a[j-1]);
}
}
}
for(i=0;i<n;i++){
printf("%d",a[i]);
if(i!=n-1)printf(" ");
else printf("\n%d\n",m);
}
return 0;
}
void swap(int* a , int* b)
{
int tmp;

tmp = *a;
a = b;
b = a;
}

Compiler output:
main.c: In function 'main':
main.c:12:1: error: implicit declaration of function 'sawp'; did you mean 'swap'? [-Wimplicit-function-declaration]
   12 | sawp(&a[j],&a[j-1]);
      | ^~~~
      | swap
Language: C

#include<stdio.h>

int BubbleSort(int *A,int length) {

  int i, j, tmp, cnt=0;
  for(i = 0; i < length; i++) {#include<stdio.h>

int BubbleSort(int *A,int length) {

  int i, j, tmp, cnt=0;
  for(i = 0; i < length; i++) {
    for(j = length-1; j > i; j--) {
      if(A[j] < A[j-1]) {
	tmp = A[j];
	A[j] = A[j-1];
	A[j-1] = tmp;
	cnt++;
      }
    }
  }
  return cnt;
}


main()
{
  int i;
  int n;
  int Arr[100];
  int cnt = 0;

  scanf("%d", &n);

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

  cnt = BubbleSort(Arr,n);

  /* スペースをいれない方法！ */
  printf("%d", Arr[0]);

  for(i = 1; i < n; i++) {
    printf(" %d" ,Arr[i]);
  }

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

}



    for(j = length-1; j > i; j--) {
      if(A[j] < A[j-1]) {
	tmp = A[j];
	A[j] = A[j-1];
	A[j-1] = tmp;
	cnt++;
      }
    }
  }
  return cnt;
}


main()
{
  int i;
  int n;
  int Arr[100];
  int cnt = 0;

  scanf("%d", &n);

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

  cnt = BubbleSort(Arr,n);

  /* スペースをいれない方法！ */
  printf("%d", Arr[0]);

  for(i = 1; i < n; i++) {
    printf(" %d" ,Arr[i]);
  }

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

}

Compiler output:
main.c: In function 'BubbleSort':
main.c:6:32: error: stray '#' in program
    6 |   for(i = 0; i < length; i++) {#include<stdio.h>
      |                                ^
main.c:6:33: error: 'include' undeclared (first use in this function)
    6 |   for(i = 0; i < length; i++) {#include<stdio.h>
      |                                 ^~~~~~~
main.c:6:33: note: each undeclared identifier is reported only once for each function it appears in
main.c:6:41: error: 'stdio' undeclared (first use in this function); did you mean 'stdin'?
    6 |   for(i = 0; i < length; i++) {#include<stdio.h>
      |                                         ^~~~~
      |                                         stdin
main.c:8:1: error: expected expression before 'int'
    8 | int BubbleSort(int *A,int length) {
      | ^~~
main.c: At top level:
main.c:66:1: error: return type defaults to 'int' [-Wimplicit-int]
   66 | main()
      | ^~~~
Language: C

#include<stdio.h>
#define N 100
int main(){

int i,j,a[N],n,m=0,tmp;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",a[i]);
for(j=n-1;j>i;j--){
if(a[j]<a[j-1]){
m++;
tmp=a[j];
a[j]=a[j-1];
a[j-1]=a[j];
}
}
}
for(i=0;i<n;i++){
if(i==n-1)printf("%d",a[i]);
eles printf("%d ",a[i]);

}
printf("\n%d\n",m);

return 0;
}

Compiler output:
main.c: In function 'main':
main.c:20:1: error: unknown type name 'eles'
   20 | eles printf("%d ",a[i]);
      | ^~~~
main.c:20:13: error: expected declaration specifiers or '...' before string constant
   20 | eles printf("%d ",a[i]);
      |             ^~~~~
main.c:20:19: error: expected declaration specifiers or '...' before 'a'
   20 | eles printf("%d ",a[i]);
      |                   ^
Language: C

#include<stdio.h>
#define N 100

int main(){
int a[N],i,j,n,m=0,tmp;
scanf("%d",&n);
for(i=0;i<n;i++)scanf("%d",&a[i]);
for(i=0;i<n;i++){
for(j=n-1;j>i;j--){
if(a[j]<a[j-1]){
tmp=a[j];
a[j]=a[j-1];
a[j-1]=tmp;
m++;
}
｝
｝
for(i=0;i<n;i++){
if(i==n-1)printf("%d\n",a[i]);
else printf("%d ",a[i]);
}
printf("%d\n",m)
return 0;
}

Compiler output:
main.c: In function 'main':
main.c:16:1: error: unknown type name '\U0000ff5d'
   16 | ｝
      | ^~
main.c:18:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'for'
   18 | for(i=0;i<n;i++){
      | ^~~
main.c:18:16: error: expected ';' before ')' token
   18 | for(i=0;i<n;i++){
      |                ^
      |                ;
main.c:18:16: error: expected statement before ')' token
main.c:22:17: error: expected ';' before 'return'
   22 | printf("%d\n",m)
      |                 ^
      |                 ;
   23 | return 0;
      | ~~~~~~           
main.c:24:1: error: expected declaration or statement at end of input
   24 | }
      | ^
main.c:24:1: error: expected declaration or statement at end of input
Language: C

#include<stdio.h>
#define N 100

int main(){
int a[N],i,j,n,m=0,tmp;
scanf("%d",&n);
for(i=0;i<n;i++)scanf("%d",&a[i]);
for(i=0;i<n;i++){
for(j=n-1;j>i;j--){
if(a[j]<a[j-1]){
tmp=a[j];
a[j]=a[j-1];
a[j-1]=tmp;
m++;
}
｝
｝
for(i=0;i<n;i++){
if(i==n-1)printf("%d\n",a[i]);
else printf("%d ",a[i]);
}
printf("%d\n",m);
return 0;
}

Compiler output:
main.c: In function 'main':
main.c:16:1: error: unknown type name '\U0000ff5d'
   16 | ｝
      | ^~
main.c:18:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'for'
   18 | for(i=0;i<n;i++){
      | ^~~
main.c:18:16: error: expected ';' before ')' token
   18 | for(i=0;i<n;i++){
      |                ^
      |                ;
main.c:18:16: error: expected statement before ')' token
main.c:24:1: error: expected declaration or statement at end of input
   24 | }
      | ^
main.c:24:1: error: expected declaration or statement at end of input
Language: C

#include<stdio.h>
#define MAX 100
int main()
{
  int i,j;
  int x,y,count=0;
  int array[MAX];
  scanf("%d",&x);
  for(i=0;i<x;i++)
    {
      scanf("%d",&array[i]);
    }
  for(i=0;i<x;i++)
    {
      for(j=x-1;j>=1;j--)
	{
	  if(array[j] < array[j-1])
	    {
	      y = array[j-1];
	      array[j-1] = array[j];
	      array[j] = y;
	      count++;
	    }
	}
    }
  for(i=0;i<x;i++)
    {
      printf("%d",array[i]);
      if(i !=x-1)
	{
	  printf(" ");
	}
      else
	{
	  printf("\n");
	}
    }

Compiler output:
main.c: In function 'main':
main.c:37:5: error: expected declaration or statement at end of input
   37 |     }
      |     ^
Language: C

main(){
  int i,j,n;

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

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

    }
  }

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

  return 0;
}

void swap(int x,int y){
  int tmp;

  tmp=A[x];
  A[x]=A[y];
  A[y]=tmp;

  c++;
}

Compiler output:
main.c:1:1: error: return type defaults to 'int' [-Wimplicit-int]
    1 | main(){
      | ^~~~
main.c: In function 'main':
main.c:4:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    4 |   scanf("%d",&n);
      |   ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | main(){
main.c:4:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    4 |   scanf("%d",&n);
      |   ^~~~~
main.c:4:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:6:17: error: 'A' undeclared (first use in this function)
    6 |     scanf("%d",&A[i]);
      |                 ^
main.c:6:17: note: each undeclared identifier is reported only once for each function it appears in
main.c:11:23: error: implicit declaration of function 'swap' [-Wimplicit-function-declaration]
   11 |       if(A[j]<A[j-1]) swap(j,j-1);
      |                       ^~~~
main.c:17:5: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   17 |     printf("%d ",A[i]);
      |     ^~~~~~
main.c:17:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:17:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:17:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:19:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   19 |   printf("\n%d\n",c);
      |   ^~~~~~
main.c:19:3: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:19:19: error: 'c' undeclared (first use in this function)
   19 |   printf("\n%d\n",c);
      |                   ^
main.c: At top level:
main.c:24:6: warning: conflicting types for 'swap'; have 'void(int,  int)'
   24 | void swap(int x,int y){
      |      ^~~~
main.c:11:23: note: previous implicit declaration of 'swap' with type 'void(int,  int)'
   11 |       if(A[j]<A[j-1]) swap(j,j-1);
      |                       ^~~~
main.c: In function 'swap':
main.c:27:7: error: 'A' undeclared (first use in this function)
   27 |   tmp=A[x];
      |       ^
main.c:31:3: error: 'c' undeclared (first use in this function)
   31 |   c++;
      |   ^
Language: C

#include<stdio.h>

static const int N = 100;
void bubbleSort(int [], int);
void swap(int *, int *);

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

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

void swap(int *p, int *q){
  int swap;
  swap = *p;
  *p = *q;
  *q = swap;
}

Compiler output:
main.c:7:1: error: return type defaults to 'int' [-Wimplicit-int]
    7 | main(){
      | ^~~~
main.c: In function 'bubbleSort':
main.c:35:12: error: stray '\' in program
   35 |   printf(即\n);
      |            ^
main.c:35:10: error: '\U00005373' undeclared (first use in this function)
   35 |   printf(即\n);
      |          ^~
main.c:35:10: note: each undeclared identifier is reported only once for each function it appears in
main.c:35:12: error: expected ')' before 'n'
   35 |   printf(即\n);
      |         ~  ^~
      |            )
Language: C

#include<stdio.h>

static const int N = 100;

void Bubble(int[] ,int);


int main(){
 int A[N];
 int t;
 int i;

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

  
  for(i = 0 ; i <= t ; i++)Bubble(A,t);
   printf("\n");
   return 0;
}

void Bubble(int A[], int t)
{
  int i;
  int j;
  int n = 0;
  int temp;
for(i = 0 ; i <= t-1 ; i++){
  for(j = t-1  ; j < i + 1 ; j++ ){
    if(A[j] < A[j-1]){
      temp = A[j];
      A[j] = A[j-1];
      A[j-1] = temp;
      printf("%d",A[j]);#include<stdio.h>

static const int N = 100;

void Bubble(int[] ,int);


int main(){
 int A[N];
 int t;
 int i;

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

  
  for(i = 0 ; i <= t ; i++)Bubble(A,t);
   printf("\n");
   return 0;
}

void Bubble(int A[], int t)
{
  int i;
  int j;
  int n = 0;
  int temp;
for(i = 0 ; i <= t-1 ; i++){
  for(j = t-1  ; j < i + 1 ; j++ ){
    if(A[j] < A[j-1]){
      temp = A[j];
      A[j] = A[j-1];
      A[j-1] = temp;
      printf("%d",A[j]);

    }

    n = n + 1;
  }

  }


}



    }

    n = n + 1;
  }

  }


}

Compiler output:
main.c: In function 'Bubble':
main.c:36:25: error: stray '#' in program
   36 |       printf("%d",A[j]);#include<stdio.h>
      |                         ^
main.c:36:26: error: 'include' undeclared (first use in this function)
   36 |       printf("%d",A[j]);#include<stdio.h>
      |                          ^~~~~~~
main.c:36:26: note: each undeclared identifier is reported only once for each function it appears in
main.c:36:34: error: 'stdio' undeclared (first use in this function); did you mean 'stdin'?
   36 |       printf("%d",A[j]);#include<stdio.h>
      |                                  ^~~~~
      |                                  stdin
main.c:38:1: error: expected expression before 'static'
   38 | static const int N = 100;
      | ^~~~~~
main.c:59:6: error: redefinition of 'Bubble'
   59 | void Bubble(int A[], int t)
      |      ^~~~~~
main.c:24:6: note: previous definition of 'Bubble' with type 'void(int *, int)'
   24 | void Bubble(int A[], int t)
      |      ^~~~~~
Language: C

#include <stdio.h>
#define N 100
void trace(int A[], int n){
  int i;
  for ( i = 1; i <= n; i++ ){
    if ( i > 1 ){
    printf("%d", A[i]);
  }
  printf("\n");
}

int main(void)
{
  int A[N+1],i,j,key,n,count=0;
  scanf("%d",&n);
  for(i=1 ; i<n+1 ; i++){
      scanf("%d",&A[i]);
    }
  for(i=1 ; i<n+1 ; i++){
      for(j=n ; j >= i+1 ; j--){
      if(A[j] < A[j-1]){
          key = A[j];
          A[j] = A[j-1];
          A[j-1] = key;
          count++;
        }
    }
    }
  trace(A, n);
  printf("%d\n",count);
  return 0;
}

Compiler output:
main.c: In function 'trace':
main.c:32:1: error: expected declaration or statement at end of input
   32 | }
      | ^
Language: C

include <stdio.h>
#define N 100

int bubbleSort(int *a,int n);

main()
{
  int a[N],n,i,count;
  scanf("%d",&n);

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

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

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

  return 0;
}

int bubbleSort(int *a,int n)
{
  int i,j,temp,count=0;
  for(i=0; i<n; i++){
    for(j=n-1; j>i; j--){
      if(a[j]<a[j-1]){
	temp = a[j];
	a[j] = a[j-1];
	a[j-1] = temp;
	count++;
      }
    }
  }
  return count;
}

Compiler output:
main.c:1:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | include <stdio.h>
      |         ^
main.c:6:1: error: return type defaults to 'int' [-Wimplicit-int]
    6 | main()
      | ^~~~
main.c: In function 'main':
main.c:9:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    9 |   scanf("%d",&n);
      |   ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | include <stdio.h>
main.c:9:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    9 |   scanf("%d",&n);
      |   ^~~~~
main.c:9:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:14:11: error: implicit declaration of function 'bubbleSort' [-Wimplicit-function-declaration]
   14 |   count = bubbleSort(a,n);
      |           ^~~~~~~~~~
main.c:15:3: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   15 |   printf("%d",a[0]);
      |   ^~~~~~
main.c:15:3: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:15:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:15:3: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C

include <stdio.h>
#define N 100

int bubbleSort(int *a,int n);

main()
{
  int a[N],n,i,count;
  scanf("%d",&n);

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

  for(i=1; i<n; i++){
    printf(" %d",a[i]);
  }

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

  return 0;
}

int bubbleSort(int *a,int n)
{
  int i,j,temp,count=0;
  for(i=0; i<n; i++){
    for(j=n-1; j>i; j--){
      if(a[j]<a[j-1]){
	temp = a[j];
	a[j] = a[j-1];
	a[j-1] = temp;
	count++;
      }
    }
  }
  return count;
}

Compiler output:
main.c:1:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | include <stdio.h>
      |         ^
main.c:6:1: error: return type defaults to 'int' [-Wimplicit-int]
    6 | main()
      | ^~~~
main.c: In function 'main':
main.c:9:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    9 |   scanf("%d",&n);
      |   ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | include <stdio.h>
main.c:9:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    9 |   scanf("%d",&n);
      |   ^~~~~
main.c:9:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:14:11: error: implicit declaration of function 'bubbleSort' [-Wimplicit-function-declaration]
   14 |   count = bubbleSort(a,n);
      |           ^~~~~~~~~~
main.c:15:3: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   15 |   printf("%d",a[0]);
      |   ^~~~~~
main.c:15:3: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:15:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:15:3: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C

include <stdio.h>
#define N 100

int bubbleSort(int *a,int n);

int main(void)
{
  int a[N],n,i,count;
  scanf("%d",&n);

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

  for(i=1; i<n; i++){
    printf(" %d",a[i]);
  }

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

  return 0;
}

int bubbleSort(int *a,int n)
{
  int i,j,temp,count=0;
  for(i=0; i<n; i++){
    for(j=n-1; j>i; j--){
      if(a[j]<a[j-1]){
	temp = a[j];
	a[j] = a[j-1];
	a[j-1] = temp;
	count++;
      }
    }
  }
  return count;
}

Compiler output:
main.c:1:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | include <stdio.h>
      |         ^
main.c: In function 'main':
main.c:9:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    9 |   scanf("%d",&n);
      |   ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | include <stdio.h>
main.c:9:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    9 |   scanf("%d",&n);
      |   ^~~~~
main.c:9:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:14:11: error: implicit declaration of function 'bubbleSort' [-Wimplicit-function-declaration]
   14 |   count = bubbleSort(a,n);
      |           ^~~~~~~~~~
main.c:15:3: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   15 |   printf("%d",a[0]);
      |   ^~~~~~
main.c:15:3: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:15:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:15:3: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C

include <stdio.h>
#define N 100

main()
{
  int a[N],n,i,count;
  scanf("%d",&n);

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

  for(i=1; i<n; i++){
    printf(" %d",a[i]);
  }

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

  return 0;
}

int bubbleSort(int *a,int n)
{
  int i,j,temp,count=0;
  for(i=0; i<n; i++){
    for(j=n-1; j>i; j--){
      if(a[j]<a[j-1]){
	temp = a[j];
	a[j] = a[j-1];
	a[j-1] = temp;
	count++;
      }
    }
  }
  return count;
}

Compiler output:
main.c:1:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | include <stdio.h>
      |         ^
Language: C

#include <stdio.h>
#include <memory.h>

int bubble_sort(int lst[], int n);

int main(void) {
	int i, n;
	int lst[100];
	int count;
	memset((char*)lst, 0x00, sizeof(lst));

	scanf("%d\n", &n);
	for(i=0;i<n;i++) {
		scanf("%d", &lst[i]);
	}
	
	count = bubble_sort(lst, n);
	
	for(i=0;i<n;i++) {
		printf("%d", lst[i]);
		if(i<n-1) {
			printf(" ");
		} else {
			printf("\n");
		}
	}
	printf("%d\n", count);
	
	return 0;
}

int bubble_sort(int lst[], int n) {
	int i, j, tmp, count;
	for(i=0,count=0;i<n-1;i++) {
		for(j=n-1;j>i;j--) {
			if(lst[j-1] > lst[j]) {
				tmp = lst[j];
				lst[j] = lst[j-1];
				lst[j-1] = tmp;
				ischange = 1;
				count++;
			}
		}
	}
	
	return count;
}

Compiler output:
main.c: In function 'bubble_sort':
main.c:40:33: error: 'ischange' undeclared (first use in this function)
   40 |                                 ischange = 1;
      |                                 ^~~~~~~~
main.c:40:33: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include <iostream>
#include <algorithm>

using namespace std;

unsigned int d[101];

int main()
{
	unsigned int n;
	unsigned int num;
	bool flag = true;
	cin >> n;
	for (unsigned int i = 0; i < n; ++i)
		cin >> d[i];

	while (flag) {
		flag = false;
		for (unsigned int i = n-1; i > 0; --i)
			if (d[i] < d[i-1]) {
				unsigned int x = d[i-1];
				d[i-1] = d[i];
				d[i] = x;
				flag = true;
			}
		}
	}
	for (unsigned int i = 0; i < n - 1; ++i)
		cout << d[i] << " ";
	cout << d[n-1] << "\n" << num << endl;
	return 0;
}



Compiler output:
a.cc:28:9: error: expected unqualified-id before 'for'
   28 |         for (unsigned int i = 0; i < n - 1; ++i)
      |         ^~~
a.cc:28:34: error: 'i' does not name a type
   28 |         for (unsigned int i = 0; i < n - 1; ++i)
      |                                  ^
a.cc:28:45: error: expected unqualified-id before '++' token
   28 |         for (unsigned int i = 0; i < n - 1; ++i)
      |                                             ^~
a.cc:30:9: error: 'cout' does not name a type
   30 |         cout << d[n-1] << "\n" << num << endl;
      |         ^~~~
a.cc:31:9: error: expected unqualified-id before 'return'
   31 |         return 0;
      |         ^~~~~~
a.cc:32:1: error: expected declaration before '}' token
   32 | }
      | ^
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;
}

int bubbleSort(int A[], int N) int {
    int sw = 0;
    int j;
    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]);
                sw++;
                flag = 1;
            }
        }
    }
    return sw;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:26:10: error: 'bubbleSort' was not declared in this scope
   26 |     sw = bubbleSort(A, N);
      |          ^~~~~~~~~~
a.cc: At global scope:
a.cc:38:32: error: expected initializer before 'int'
   38 | int bubbleSort(int A[], int N) int {
      |                                ^~~
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;
}

int bubbleSort(int A[], int N) {
    int sw = 0;
    int j;
    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]);
                sw++;
                flag = 1;
            }
        }
    }
    return sw;
}



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

#include<iostream>
using namespace std;

int SortT(int A[], int n){
    int count = 0;
    int flag = 1;

    while(flag){
        flag = 0;
        for(int i = n-1; i > 0; i--){
            if(A[i] < A[i-1]){
                swap(A[i], A[i-1]);
                count++;
                flag = 1;
            }
        }
    }

    return count;
}

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

    count = Sort(A,n);

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

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

    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:29:13: error: 'Sort' was not declared in this scope; did you mean 'SortT'?
   29 |     count = Sort(A,n);
      |             ^~~~
      |             SortT
Language: C++

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

int bubbleSort(vector<int> A, int N)
{
  int count = 0;
  bool flag = true;
  while(flag)
  {
    flag = false;
    for (int i = N-1; 0 < i; i--)
    {
      if(A.at(j) < A.at(j-1))
      {
        swap(A.at(j), A.at(j-1));
        flag = true;
        count++;
      }
    }
  }
  return count;
}

int main(void){

  int N;
  cin >> N;

  vector<int> A(N);
  for(int i = 0; i > N; i++) cin >> A.at(i);

  int count = bubbleSort(A, N);

  for(int i = 0; i < N; i++)
  {
    cout << A.at(i);
    if(i == N-1) cout << endl;
    else cout << " ";
  }
  cout << count << endl;

  return 0;

}



Compiler output:
a.cc: In function 'int bubbleSort(std::vector<int>, int)':
a.cc:13:15: error: 'j' was not declared in this scope
   13 |       if(A.at(j) < A.at(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 << end1;
  cout << sw << end1;


  return 0;
} 



Compiler output:
a.cc: In function 'int bubblesort(int*, int)':
a.cc:8:8: error: expected ';' before '\U0000ff1d'
    8 |    flag ＝ 0;
      |        ^~~
      |        ;
a.cc:11:27: error: expected ']' before ')' token
   11 |        swap( A[j], A[j - 1 ) ;
      |                           ^~
      |                           ]
a.cc: In function 'int main()':
a.cc:22:9: error: 'N' was not declared in this scope
   22 |  cin >> N;
      |         ^
a.cc:31:11: error: 'end1' was not declared in this scope
   31 |   cout << end1;
      |           ^~~~
Language: C++


#include <stdio.h>

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

int bubbleSort(int A[],int N) {
    int i,j;
    int sw = 0;
    unsigned short flag = 1;
    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(void) {
    int i, A[100], N, sw;
    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) printf(" ");
        printf("%d",A[i]);
    }
    printf("\n%d\n",sw);
return 0:
}

    


Compiler output:
a.cc: In function 'int main()':
a.cc:39:9: error: expected ';' before ':' token
   39 | return 0:
      |         ^
      |         ;
a.cc:39:9: error: expected primary-expression before ':' token
Language: C++

int main()//冒泡
{	int A[100],n,j,flag=1,change=0,x;
	cin>>n;
	for(j=0;j<n;j++)
			cin>>A[j];
	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;
				change++;
				flag=1;
			}	
	}
	for(j=0;j<n;j++)
	{	cout<<A[j];
		if(j==n-1)
			cout<<endl;
		else if(j!=n-1)
			cout<<" ";
	}	
	cout<<change<<endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:3:9: error: 'cin' was not declared in this scope
    3 |         cin>>n;
      |         ^~~
a.cc:18:17: error: 'cout' was not declared in this scope
   18 |         {       cout<<A[j];
      |                 ^~~~
a.cc:20:31: error: 'endl' was not declared in this scope
   20 |                         cout<<endl;
      |                               ^~~~
a.cc:24:9: error: 'cout' was not declared in this scope
   24 |         cout<<change<<endl;
      |         ^~~~
a.cc:24:23: error: 'endl' was not declared in this scope
   24 |         cout<<change<<endl;
      |                       ^~~~