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

#include<stdio.h>

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

void intsertionSort(int A[], int N){
    int i,j,minj,temp,count=0;
    for(i=1;i<=N-1;i++){
        minj = i;
        for(j=i;j<=N-1;j++){
            if (A[j] < A[minj]){
                minj = j;
            }
        }
        if(i!=minj){
            temp = A[i];
            A[i] = A[minj];
            A[minj] = temp;
            count++;
        }
    }
    trace(A,N);
    printf("%d",count);
    printf("\n");
}

int main(){
    int a,i,num[100];
    scanf("%d",&a);
    for(i=0;i<a;i++){
        scanf("%d",&num[i]);        
    }
    intsertionSort(num,a);

}

Compiler output:
main.c: In function 'intsertionSort':
main.c:34:5: error: implicit declaration of function 'trace' [-Wimplicit-function-declaration]
   34 |     trace(A,N);
      |     ^~~~~
Language: C

#include<stdio.h>
??
int main(void){
????int n,a[100],i,j,count=0,min,temp,flag;
????scanf("%d",&n);
????for(i=0;i<n;i++) scanf("%d",&a[i]);
??
????for(i=0;i<n;i++){
????????min=i;
????????flag=0;
????????for(j=i;j<n;j++){
????????????if(a[j]<a[min]) {
????????min=j;
????????flag=1;
????????????}
????????}
????????if(flag==1){
????????temp=a[min];
????????a[min]=a[i];
????????a[i]=temp;
????????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);
??
????return 0;
}

Compiler output:
main.c:2:1: error: expected identifier or '(' before '?' token
    2 | ??
      | ^
Language: C

#include <stdio.h>
void swap(int *,int *);
??
int main(){
????int i,j,n,A[100],c=0,mini;
??????
????scanf("%d",&n);
????for(i=0;i<n;i++){
????????scanf("%d",&A[i]);
????}
??????
????for(i=0;i<n-1;i++){
????????mini=i;
????????for(j=i;j<n;j++){
????????????if(A[j] < A[mini]){
????????mini=j; 
????????????}
????????}
????????if(A[mini]<A[i])c++;
????????swap(&A[i],&A[mini]);
????}
??
????for(i=0;i<n;i++){
????????printf("%d",A[i]);
????????if(i<n-1)printf(" ");
????}
????printf("\n%d\n",c);
????return 0;
}
??
void swap(int *a,int *b){
????int t;
????t=*a;
????*a=*b;
????*b=t;
}

Compiler output:
main.c:3:1: error: expected identifier or '(' before '?' token
    3 | ??
      | ^
main.c:30:1: error: expected identifier or '(' before '?' token
   30 | ??
      | ^
Language: C

#include<stdio.h>
void swap(int*,int*);
main()
{
????int i,j,n,A[100],c=0,mini;
????scanf("%d",&n);
????for(i=0;i<n;i++){
????????scanf("%d",&A[i]);
????}
??????
????for(i=0;i<n-1;i++){
????????mini=i;
????????for(j=i;j<n;j++){
????????????if(A[j] < A[mini]){
????????mini=j; 
????????????}
????????}
????????if(A[mini]<A[i])c++;
????????swap(&A[i],&A[mini]);
????}
??
????for(i=0;i<n;i++){
????????printf("%d",A[i]);
????????if(i<n-1)printf(" ");
????}
????printf("\n%d\n",c);
????return 0;
}
void swap(int *a,int *b){
????int t;
????t=*a;
????*a=*b;
????*b=t;
}

Compiler output:
main.c:3:1: error: return type defaults to 'int' [-Wimplicit-int]
    3 | main()
      | ^~~~
main.c: In function 'main':
main.c:5:1: error: expected expression before '?' token
    5 | ????int i,j,n,A[100],c=0,mini;
      | ^
main.c:6:1: error: expected expression before '?' token
    6 | ????scanf("%d",&n);
      | ^
main.c:6:17: error: 'n' undeclared (first use in this function)
    6 | ????scanf("%d",&n);
      |                 ^
main.c:6:17: note: each undeclared identifier is reported only once for each function it appears in
main.c:7:1: error: expected expression before '?' token
    7 | ????for(i=0;i<n;i++){
      | ^
main.c:27:1: error: expected expression before '?' token
   27 | ????return 0;
      | ^
main.c: In function 'swap':
main.c:30:1: error: expected expression before '?' token
   30 | ????int t;
      | ^
main.c:31:1: error: expected expression before '?' token
   31 | ????t=*a;
      | ^
main.c:31:5: error: 't' undeclared (first use in this function)
   31 | ????t=*a;
      |     ^
main.c:32:1: error: expected expression before '?' token
   32 | ????*a=*b;
      | ^
main.c:33:1: error: expected expression before '?' token
   33 | ????*b=t;
      | ^
Language: C

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

int CountSwap=0;

void swap(int* a,int* b){
  int tmp=*a;
  *a=*b;
  *b=tmp;
  CountSwap++;
}

void SelectionSort(int list[],int num){
  int i,j,min,key;
  for(i=0;i<num;i++){
    min=list[i];key=i;
    //i+1~num-1?????§????????¢??¢?´¢???????°???????????????????
    for(j=i+1;j<num;j++){
      if(list[j]<min){min=list[j];key=j;}
    }
    if(i!=key)swap(&list[i],&list[key]);
  }
}

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

  int* list=(int*)malloc(sizeof(int)*N);
  if(list==NULL)exit(0);

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

  SelectionSort(list,N);
  for(i=0;i<N-1;i++)printf("%d ",list[i]);
  printf("%d\n%d\n",list[N-1],CountSwap);

  free(list);
  return 0;
}

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

  int* list=(int*)malloc(sizeof(int)*N);
  if(list==NULL)exit(0);

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

  SelectionSort(list,N);
  for(i=0;i<N-1;i++)printf("%d ",list[i]);
  printf("%d\n%d\n",list[N-1],CountSwap);

  free(list);
  return 0;
}

Compiler output:
main.c:42:5: error: redefinition of 'main'
   42 | int main(void){
      |     ^~~~
main.c:25:5: note: previous definition of 'main' with type 'int(void)'
   25 | int main(void){
      |     ^~~~
Language: C

#include <stdio.h>
#include <math.h>
 
#define ELEMENT_CNT_MIN (1)
#define ELEMENT_CNT_MAX (100)
#define ELEMENT_MIN (0)
#define ELEMENT_MAX (100)
#define SUCCESS     (0)
#define FAILURE     (-1)
 
int selection_sort(int *p_arr, int size);
void swap(int *px, int *py);
void put_arr(int *p_arr, int size);
int get_int_sequence(int *p_num, int min, int max, int size);
int get_int(int *p_num, int min, int max);
int judge_constraint(int test_num, int min, int max);
 
 
int main(void){
     
    int element_num;
    int element[ELEMENT_CNT_MAX];
    int cnt_exchange;
     
    if(get_int(&element_num, ELEMENT_CNT_MIN, ELEMENT_CNT_MAX) == FAILURE)
    {
        return FAILURE;
    }
     
    if(get_int_sequence(&element[0], ELEMENT_MIN, ELEMENT_MAX, element_num) == FAILURE)
    {
        return FAILURE;
    }
     
    cnt_exchange = selection_sort(&element[0], element_num);
     
    put_arr(&element[0], element_num);
    printf("%d\n", cnt_exchange);
     
    return SUCCESS;
}
 
int selection_sort(int *p_arr, int size)
{
    int i;
    int j;
    int min_idx;
    int cnt = 0;    /* exchange count */
     
    for(i = 0; i < size - 1; i++)
    {
        min_idx = i;
        for(j = i + 1; j < size; j++)
        {
            if(p_arr[j] < p_arr[min_idx])   
            {
                min_idx = j;        /* minimum value [i,size - 1] */
            }
        }
        if(p_arr[i] != p_arr[min_idx])
        {
            swap(&p_arr[i], &p_arr[min_idx]);
            cnt++;
        }
    }
     
    return cnt;
}
 
void swap(int *px, int *py)
{
    int tmp = *px;
    *px = *py;
    *py = tmp;
     
    return;
}
 
void put_arr(const int *p_arr, int size)
{
    int i;
     
    for(i = 0; i < size - 1; i++)
    {
        printf("%d ", p_arr[i]);
    }
    printf("%d\n", p_arr[size - 1]);
}
 
int get_int_sequence(int *p_num, int min, int max, int size)
{
    int i;
     
    for(i = 0; i < size; i++)
    {
        if(get_int(&p_num[i], min, max) == FAILURE)
        {
            return FAILURE;
        }
    }
     
    return SUCCESS;
}
 
int get_int(int *p_num, int min, int max)
{
    scanf("%d", p_num);
     
    if(judge_constraint(*p_num, min, max) == FAILURE)
    {
        return FAILURE;
    }
     
    return SUCCESS;
}
int judge_constraint(int test_num, int min, int max)
{
    if(test_num < min || test_num > max)
    {
        return FAILURE;
    }
     
    return SUCCESS;
}

Compiler output:
main.c:79:6: error: conflicting types for 'put_arr'; have 'void(const int *, int)'
   79 | void put_arr(const int *p_arr, int size)
      |      ^~~~~~~
main.c:13:6: note: previous declaration of 'put_arr' with type 'void(int *, int)'
   13 | void put_arr(int *p_arr, int size);
      |      ^~~~~~~
Language: C

#include<stdio.h>

int selectionSort(int A[],int N){
 int i,j,t,sw=0,minj;
	for(i=0;i<N-1;i++){
	 minj=i;
		for(j=i;j<N;j++){
			if(A[j]<A[minj])minnj=j;
			}
		t=A[i];A[i]=A[minj];A[minj]=t;
		if(i!=minj)sw++;
		}
	return sw;
	
	}

int main(){
 int A[100],N,i,sw;
	
	scanf("%d",&N);
	for(i=0;i<N;i++)scanf("%d",&A[i]);
	
	sw=selectionSort(A,N);
	
	for(i=0;i<N;i++){
		if(i>0)printf(" ");
		printf("%d",A[i]);
	 }

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



Compiler output:
main.c: In function 'selectionSort':
main.c:8:41: error: 'minnj' undeclared (first use in this function); did you mean 'minj'?
    8 |                         if(A[j]<A[minj])minnj=j;
      |                                         ^~~~~
      |                                         minj
main.c:8:41: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>

int selectionSort(int A[], int N){
	int i, j, t, sw = 0, minj;
	for(i = 0; i < N - 1; i++){
		minj = i;
		for(j = i; j < N; j++){
			if(A[j ]< A[minj]) minj = j;
		}
		t = A[i]; A[i] = A[minj]; A[minj] = t;
	}
	retrun sw;
}

int main(){
	intA[100], N, i, sw;
	
	scanf("%d" ,&N);
	for(i = 0; i < N; i++) scanf("%d",&A[i]);
	
	sw = seiectionSort(A, N);
	
	for(i = 0; i < N; i++){
		if(i > 0) printf(" ");
		printf("%d", A[i]);
	}
	printf("\n");
	printf("%d\n", sw);
	
	retrun 0;
}



Compiler output:
main.c: In function 'selectionSort':
main.c:12:9: error: unknown type name 'retrun'
   12 |         retrun sw;
      |         ^~~~~~
main.c:12:16: error: redeclaration of 'sw' with no linkage
   12 |         retrun sw;
      |                ^~
main.c:4:22: note: previous definition of 'sw' with type 'int'
    4 |         int i, j, t, sw = 0, minj;
      |                      ^~
main.c: In function 'main':
main.c:16:9: error: 'intA' undeclared (first use in this function); did you mean 'int'?
   16 |         intA[100], N, i, sw;
      |         ^~~~
      |         int
main.c:16:9: note: each undeclared identifier is reported only once for each function it appears in
main.c:16:20: error: 'N' undeclared (first use in this function)
   16 |         intA[100], N, i, sw;
      |                    ^
main.c:16:23: error: 'i' undeclared (first use in this function)
   16 |         intA[100], N, i, sw;
      |                       ^
main.c:16:26: error: 'sw' undeclared (first use in this function)
   16 |         intA[100], N, i, sw;
      |                          ^~
main.c:19:44: error: 'A' undeclared (first use in this function)
   19 |         for(i = 0; i < N; i++) scanf("%d",&A[i]);
      |                                            ^
main.c:21:14: error: implicit declaration of function 'seiectionSort'; did you mean 'selectionSort'? [-Wimplicit-function-declaration]
   21 |         sw = seiectionSort(A, N);
      |              ^~~~~~~~~~~~~
      |              selectionSort
main.c:30:9: error: 'retrun' undeclared (first use in this function)
   30 |         retrun 0;
      |         ^~~~~~
main.c:30:15: error: expected ';' before numeric constant
   30 |         retrun 0;
      |               ^~
      |               ;
Language: C

#include <stdio.h>

/* 選択ソート (0オリジン) */
int selectionSort(int A[], int N) {
  int i, j, t, sw = 0, mini;
  for(i=0; i<N-1; i++) {
    mini = i;
    for(j=i; j<N; j++) {
      if(A[j] < A[mini]) mini = j;
    }

  	t = A[i];
  	A[i] = A[mini];
  	A[mini] = t;

  	if(i != mini) sw++;
  }
  return sw;
}

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

  sw = selectionSort(A,N);

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

  return 0;



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

#include<stdio.h>

int selectionSort(int A[], int N){
	int i, j, t, sw = 0, minj;
	for ( i = 0; i < n - 1; i++ ){
		minj = i;
		for( j = i; j < n; j++ ){
			if( A[j] < A[minj] )minj = j;
		}
		t = A[i]; A[i] = A[minj]; A[minj] = t;
		if( i != minj ) sw++;
	}
	return sw;
}

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


Compiler output:
main.c: In function 'selectionSort':
main.c:5:26: error: 'n' undeclared (first use in this function)
    5 |         for ( i = 0; i < n - 1; i++ ){
      |                          ^
main.c:5:26: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <iostream>
using namespace std;
int selectionSort(int A[], int N){
    int i, j, s=0, tmp, minj;
    for(i=0; i<N-1; i++){
        minj = i;
        for(j=i; j<N; j++){
            if(A[j]<A[minj]) minj = j;
        }
        tmp = A[i];
        A[i] = A[minj];
        A[minj] = tmp;
        
        if(i != minj) s++;
    }
    return s;
}

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



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

#include"stdio.h"
#include"stdlib.h"
int main()
{
    int n;
    int i,j;
    int *A;
    int min;
    int buf;
    int count=0;
    scanf("%d",&n);
    A=(int*)malloc(sizeof(int)*n);
    scanf("%d",&A[0]);
    for(i=0;i<n;i++)
    {
        scanf("%d",&A[i]);
        if(min>A[i])min=A[i];
    }
    min=0;
    for(i=0;i<n;i++)
    {
        for(j=i+1;j<n;j++)
        {
            if(A[min]>A[j])min=j;
        }
        buf=A[min];
        A[min]=A[i]
        A[i]=buf;
        count++;
    }
    printf("%d",A[0]);
    for(i=1;i<n;i++)
    {
        printf(" %d",A[i]);
    }
    printf("\n%d\n",count);
    return 0;
}


Compiler output:
main.c: In function 'main':
main.c:27:20: error: expected ';' before 'A'
   27 |         A[min]=A[i]
      |                    ^
      |                    ;
   28 |         A[i]=buf;
      |         ~
Language: C

#include<stdio.h>

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

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

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

  sw selectionSort(A,N);

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



Compiler output:
main.c: In function 'selectionSort':
main.c:5:27: error: expected ';' before ')' token
    5 |   for(i =0; i > N - 1, i++){
      |                           ^
      |                           ;
main.c: In function 'main':
main.c:24:5: error: expected ';' before 'selectionSort'
   24 |   sw selectionSort(A,N);
      |     ^~~~~~~~~~~~~~
      |     ;
Language: C

#include<iostream>
using namespace std;

//flag を用いたバブルソート

int bubbleSort(int A[],int N){
  int sw = 0;
  bool flag = 1;
  for (int i = 0; flag; i++){
    flag = 0;
    for( int j = N - 1; j >= i + 1; j--){
      if( A[j] < A[j - 1]){
	//隣接要素を交換する。
	swap(A[j],A[j - 1]);
	flag = 1;
	sw++;
      }
    }
  }
  return sw;
}

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

  sw = bubbleSort(A,N);

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

  return 0;

}




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

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



Compiler output:
main.c: In function 'main':
main.c:27:7: error: implicit declaration of function 'pritnf'; did you mean 'printf'? [-Wimplicit-function-declaration]
   27 |       pritnf("%d ", a[i]);
      |       ^~~~~~
      |       printf
Language: C

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



Compiler output:
main.c: In function 'main':
main.c:14:5: error: 'num' undeclared (first use in this function)
   14 |     num = i;
      |     ^~~
main.c:14:5: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
#include<stdlib.h>
void selectionSort(int *A,int N);
int main(){
  int *A,i,N;
  scanf("%d\n",&N);
  A=(int *)malloc(N*sizeof(int));
  for(i=0;i<N;i++){
    scanf("%d",&A[i]);
  }
  selectionSort(A,N);
  return 0;
}
void selectionSort(int *A,int N){
  int i,j,v,k,minj,count=0;
  for(i=0;i<=N-1;i++){
    minj=i;
    for(j=i;j<=N-1;j++){
      if(A[j]<A[minj]){
	minj=j;
      }
    }
    v=A[i];
    A[i]=A[minj];
    A[minj]=v;
    if(A[minj]!=A[i])count++;
  for(i=0;i<N-1;i++){
    printf("%d",A[i]);
    printf(" ");
  }
  printf("%d\n",A[N-1]);
  printf("%d\n",count);
}



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

include <stdio.h>
int main(){
  int i,j,A[100],change,N,s,k,flag=0;
  scanf("%d",&N);
  for(i=0;i < N;i++){
    scanf("%d",&A[i]);
  }
  for(i=0; i < N-1;i++){

    s=i;
    k=i;
    for(j=i+1; j < N ;j++){
      if(A[k] > A[j]){

        k =j;

      }
    }
    if(s!=k){
    change=A[i];
    A[i]=A[k];
    A[k]=change;
    flag++;
    }
  }
   for(j=0;j < N ;j++){
      if(j==N-1){
        printf("%d",A[j]);
      }
      else{
      printf("%d ",A[j]);
      }
    }
    printf("\n");
    printf("%d\n",flag);
      return 0;
  }



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

include <stdio.h>
int main(){
  int i,j,A[100],change,N,s,k,flag=0;
  scanf("%d",&N);
  for(i=0;i < N;i++){
    scanf("%d",&A[i]);
  }
  for(i=0; i < N-1;i++){

    s=i;
    k=i;
    for(j=i+1; j < N ;j++){
      if(A[k] > A[j]){

        k =j;

      }
    }
    if(s!=k){
      change=A[i];
      A[i]=A[k];
      A[k]=change;
      flag++;
    }
  }
  for(j=0;j < N ;j++){
    if(j==N-1){
      printf("%d",A[j]);
    }
    else{
      printf("%d ",A[j]);
    }
  }
  printf("\n");
  printf("%d\n",flag);
  return 0;
}



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

#include<stdio.h>
#define MAX 100
int main(){
  int i,j,minj,tmp,N;
  int A[MAX];
  int count = 0;
  
  scanf("%d",&N);
  for( i=0 ; i<N ; i++ )
    scanf("%d",&A[i]);

  for( i=0 ; i<=N-1 ; i++ ){
    minj = i;

    for( j=i ; j<=N-1 ; j++ ){
      if(A[j] < A[minj])
	minj = j;
    }

    if(i != minj){
      count++;
      tmp = A[i];
      A[i] = A[minj];
      A[minj] = tmp;
    }
  }

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



Compiler output:
main.c: In function 'main':
main.c:30:24: error: expected ';' before 'printf'
   30 |     printf("%d",A[N-1])
      |                        ^
      |                        ;
   31 |     printf("\n%d\n",count);
      |     ~~~~~~
Language: C

#include <std.io>

int main(){
    int N, array[100];
    scanf("%d\n",&N);
    for ( int ix = 0 ; ix < N ; ix++)
        scanf("%d ",&array[ix]);
    int counter = 0;
    for ( int ix = 0 ; ix < N ; ix++ ){
        ixmin = ix;
        for ( int jx = ix ; jx < N ; jx++)
            if ( array[jx] < array[ixmin]) ixmin = jx;
        if ( ixmin != ix ){
            int temp = array[ixmin];
            array[ixmin] = array[ix];
            array[ix] = temp;
            counter++;
        }
    }
    
    for ( int ix = 0; ix < N; ix++){
        if ( ix != N-1 ) printf("%d ",array[ix]);
        else printf("%d\n",array[ix]);
    }
    printf("%d\n",counter);
    return 0;
}


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

#include <std.io>

int main(){
    int N, array[100];
    scanf("%d\n",&N);
    for ( int ix = 0 ; ix < N ; ix++)
        scanf("%d ",&array[ix]);
    int counter = 0;
    for ( int ix = 0 ; ix < N ; ix++ ){
        int ixmin = ix;
        for ( int jx = ix ; jx < N ; jx++)
            if ( array[jx] < array[ixmin]) ixmin = jx;
        if ( ixmin != ix ){
            int temp = array[ixmin];
            array[ixmin] = array[ix];
            array[ix] = temp;
            counter++;
        }
    }
    
    for ( int ix = 0; ix < N; ix++){
        if ( ix != N-1 ) printf("%d ",array[ix]);
        else printf("%d\n",array[ix]);
    }
    printf("%d\n",counter);
    return 0;
}


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

#include<stdio.h>

int selectionSort(int A[], int N) {
  int i, j, swap_medium, swap_cnt = 0, minj;
  for (i = 0; i < N - 1; i++) {
    // iからN-1までの、はじめに見つかる最小値の位置minjを得る
    minj = i;
    for (j = i; j < N; j++) {
      if (A[j] < A[minj]) minj = j;
    }
    // 最小のminjと端のiの値を交換する
    swap_medium = A[i]; A[i] = A[minj]; A[minj] = swap_medium;
    // minj = iでなければ交換があるので記録する
    if (minj != i) swap_cnt++;
  }
  return swap_cnt;
}

int main() {
  // 宣言 & 入力
  int N, i, swap_cnt;
  scanf("%d", &N);
  int A[N];
  for (i = 0; i < N; i++) scanf("%d", &A[i]);
  // 実行
  swap_cnt = selectionSort(A, N);
  //出力
  for (i = 0; i < N; i++) {
    if (i > 0) printf(" ");
    printf("%d", &A[i]);
  }
  printf("\n")
  printf("%d\n", swap_cnt);

  return 0;
}



Compiler output:
main.c: In function 'main':
main.c:32:15: error: expected ';' before 'printf'
   32 |   printf("\n")
      |               ^
      |               ;
   33 |   printf("%d\n", swap_cnt);
      |   ~~~~~~
Language: C

    #include<stdio.h>
    #include<stdlib.h>
    #define MIN 1
    #define MAX 100
    int main(){
      int N,A[MAX],i,j,tmp,count=0,minj;
      scanf("%d",&N);
      if(N<MIN||N>MAX) exit(1);
      for(i=0;i<N;i++){
        scanf("%d",&A[i]);
      }
      for(i=0;i<N;i++){
        minj = i;
        for(j=i; j<N; j++)
          if(A[j] < A[minj]){
            minj = j;
          }
        if(minj!=i){
          tmp = A[i];
          A[i] = A[minj];
          A[minj] =tmp;
          count++;
          }
          printf("%d ",A[i]);
      }
      printf("\n")
      printf("%d\n",count);
      return 0;
    }



Compiler output:
main.c: In function 'main':
main.c:26:19: error: expected ';' before 'printf'
   26 |       printf("\n")
      |                   ^
      |                   ;
   27 |       printf("%d\n",count);
      |       ~~~~~~
Language: C

#include<stdio.h>
int main(){
  int N,i,j,temp,mini,count=0;
  int argv[100];
  scanf("%d",&N);
  for(i=0;i<N;i++){
    scanf("%d",&argv[i]);
  }
  for(i=0;i<=N-1;i++){
    mini=i;
    for(j=i;j<=N-1;j++){
      if(B[j]<B[mini]){
        mini=j;
      }
    }
      if(i != mini){
        count++;
        temp=B[i];
        argv[i]=argv[mini];
        argv[mini]=temp;
      }}
    for(i=0;i<n-1;i++){
      printf("%d ",argv[i]);

        }
    printf("%d\n",argv[n-1]);
    printf("%d\n",count);
    return 0;
}


Compiler output:
main.c: In function 'main':
main.c:12:10: error: 'B' undeclared (first use in this function)
   12 |       if(B[j]<B[mini]){
      |          ^
main.c:12:10: note: each undeclared identifier is reported only once for each function it appears in
main.c:22:15: error: 'n' undeclared (first use in this function)
   22 |     for(i=0;i<n-1;i++){
      |               ^
Language: C

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

int SelectionSort(int *,int );
int OutputData(int *,int);

int main(){

  int *a;
  int i,n,c;

  scanf("%d",&n);

  a=(int*)malloc(n*sizeof(int));

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

  c=SelectionSort(a,n);
  OutputData(a,n);
  printf("%d\n",c);

  return 0;
}

int SelectionSort(int *a,int n){

  int i,j,min,tmp,c=0;

  for(i=0;i<n-1;i++){
    min=i;
    for(j=i+1;j<n;j++){
      if(a[j]>a[min]){
	min=j;
      }
    }
    if(x[i]>x[min]){
      tmp=a[i];
      a[min]=tmp;
      c++;
    }
  }
  return c;
}

void OutputData(int *a,int n){

  int i;

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



Compiler output:
main.c: In function 'SelectionSort':
main.c:38:8: error: 'x' undeclared (first use in this function)
   38 |     if(x[i]>x[min]){
      |        ^
main.c:38:8: note: each undeclared identifier is reported only once for each function it appears in
main.c: At top level:
main.c:47:6: error: conflicting types for 'OutputData'; have 'void(int *, int)'
   47 | void OutputData(int *a,int n){
      |      ^~~~~~~~~~
main.c:5:5: note: previous declaration of 'OutputData' with type 'int(int *, int)'
    5 | int OutputData(int *,int);
      |     ^~~~~~~~~~
main.c: In function 'OutputData':
main.c:59:3: error: expected declaration or statement at end of input
   59 |   }
      |   ^
Language: C

#include<stdio.h>
void Selection(int *x,int *y){
    int v;
    v = *x;
    *x = *y;
    *y = v;
}
int main(){
    int N;
    int i,j,minj;
    int count=0;
    scanf("%d",&N);
    int A[N];
    for(i=0;i<N;i++){
        scanf("%d",&A[i]);
    }
    for(i=0;i<=N-1;i++){
        minj=i;
        for(j=i;j<=N-1;j++){
            if(A[j]<A[minj]){
                minj=j;
            }
        }
            if(A[i]!=A[minj]){
                Selection(&A[i],&A[minj]);
                count++;
            }
    }
    for(i=0i<N-1;i++){
        printf("%d",A[i]);
    }
    printf("%d\n",A[N-1]);
    printf("%d\n",count);
    return 0;
}


Compiler output:
main.c: In function 'main':
main.c:29:13: error: invalid operands to binary < (have 'complex int' and 'int')
   29 |     for(i=0i<N-1;i++){
      |             ^~~~
      |               |
      |               int
main.c:29:21: error: expected ';' before ')' token
   29 |     for(i=0i<N-1;i++){
      |                     ^
      |                     ;
Language: C

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include<string.h>

int bubbleSort(int R[],int N);
int selectionSort(int R[], int N);
void insertionSort(int R[], int N);
void swap(int *a, int *b);

int main(void) {

	int N;
	scanf_s("%d\n", &N);

	int *R;
	R = (int *)malloc(sizeof(int) * N);

	int t,k,x;
	char str[500],*cn;
	fgets(str, sizeof(str), stdin);  // Rにnこの値を代入できた。
	cn = strtok(str, " ,");
	for (t = 0; t < N ; t++) {
		R[t] = atoi(cn);  // Rにnこの値を代入できた。
		cn = strtok(NULL," ");
	}
	
	x = selectionSort(R, N);
	
	for (k = 0; k < N; k++) {
		printf("%d ", R[k]);
	}
	printf("\n%d",x);
	return 0;
	
	}

void insertionSort(int R[], int N) {
	int i, v, j;
	for (i = 1; i < N; i++) {
			v = R[i];
			j = i - 1;
			while (j >= 0 && R[j] > v) {
				R[j + 1] = R[j];
				j--;
				R[j + 1] = v;
			}
		}
}
			
		
int bubbleSort(int R[],int N){
	int flag = 1;
	int count = 0;
	int j;
	while(flag != 0){	//forにして、ソートを終える場所を少しづつ変えていけば完璧。（恐らくオーダーは変わらない。）
		flag = 0;
			for (j = N - 1; j >= 1; j--) {
			if (R[j] < R[j - 1]) {
				swap(&R[j], &R[j - 1]);
				flag = 1;
				count++;
			}
		}
	}
	return count;
}

int selectionSort(int R[],int N) {
	int i,j,minj;
	int count = 0;
	int h = 0;
	for (i = 0; i < N; i++) {
		minj = i;
		for (j = i; j < N; j++) {
			if (R[j] < R[minj]) {
				minj = j;
			}
		}
		if (minj != i) {
			swap(&R[i], &R[minj]);
			count++;
		}
	}
	return count;
}

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



Compiler output:
main.c: In function 'main':
main.c:14:9: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration]
   14 |         scanf_s("%d\n", &N);
      |         ^~~~~~~
      |         scanf
Language: C

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include<string.h>

int selectionSort(int R[], int N);

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

int main(void) {

	int N;
	scanf("%d\n", &N);//半角スペースで区切ることができる。

	int R[100];

	int t,k,x;
	for (t = 0; t < N ; t++) {
		scanf("%d", &R[t]);
	}
	
	x = selectionSort(R, N);
	
	for (k = 0; k < N; k++) {
        if(i =0){printf(" ");}
	printf("%d", R[k]);
	}
	printf("\n%d\n",x);

	return 0;
	
	}

int selectionSort(int R[],int N) {
	int i,j,minj;
	int count = 0;
	for (i = 0; i < N-1; i++) {
		minj = i;
		for (j = i; j < N; j++) {
			if (R[j] < R[minj]) {
				minj = j;
			}
		}
		swap(&R[i], &R[minj]);
		if (i != minj) {
			count++;
		}
	}
	return count;
}

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


Compiler output:
main.c: In function 'main':
main.c:25:12: error: 'i' undeclared (first use in this function)
   25 |         if(i =0){printf(" ");}
      |            ^
main.c:25:12: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include<string.h>

int selectionSort(int R[], int N);

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

int main(void) {

	int N;
	scanf("%d\n", &N);//半角スペースで区切ることができる。

	int R[100];

	int t,k,x;
	for (t = 0; t < N ; t++) {
		scanf("%d", &R[t]);
	}
	
	x = selectionSort(R, N);
	
	for (k = 0; k < N; k++) {
        if(i > 0){printf(" ");}
	printf("%d", R[k]);
	}
	printf("\n%d\n",x);

	return 0;
	
	}

int selectionSort(int R[],int N) {
	int i,j,minj;
	int count = 0;
	for (i = 0; i < N-1; i++) {
		minj = i;
		for (j = i; j < N; j++) {
			if (R[j] < R[minj]) {
				minj = j;
			}
		}
		swap(&R[i], &R[minj]);
		if (i != minj) {
			count++;
		}
	}
	return count;
}

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


Compiler output:
main.c: In function 'main':
main.c:25:12: error: 'i' undeclared (first use in this function)
   25 |         if(i > 0){printf(" ");}
      |            ^
main.c:25:12: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>
int main(void){
  int i, j, cnt = 0, minj, k,temp;
  int numbers[100];
 
  scanf("%d", &k);
   
  for(i = 0;i < k;i++){
    scanf("%d", &numbers[i]);
  }
 
  for(i = 0; i < k; i++ ) {
    minj = i;
    for(j= i; j < k; j++) {
      if(numbers[j] < numbers[minj]) {
         minj = j;
         temp = numbers[i];
         numbers[i] = numbers[minj];
         numbers[minj] = minj;
         cnt++;
      }

    }
  }
  for(i=0; i<N; i++)
    {
      printf("%d", A[i]);
      if(i<N-1)
    {
      printf(" ");
    }
    }
  printf("\n");
  printf("%d\n", cnt);
 
  return 0;  
}


Compiler output:
main.c: In function 'main':
main.c:25:14: error: 'N' undeclared (first use in this function)
   25 |   for(i=0; i<N; i++)
      |              ^
main.c:25:14: note: each undeclared identifier is reported only once for each function it appears in
main.c:27:20: error: 'A' undeclared (first use in this function)
   27 |       printf("%d", A[i]);
      |                    ^
Language: C


  int i,j;
  int mini,N,count=0;

  scanf("%d",&len);

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

  for(i=1; i<=N; i++){
    mini = i;

    for(j=i; j<=N; j++){
      if(A[j] < A[mini]){
	mini = j;
	tmp = A[i];
	A[i] = A[mini];
	A[mini] = A[i];
	count++;
      }
    }

  }
  for(i=1; i<=len; i++){
    printf("%d",A[i]);
    if(i!=len){
      printf(" ");
    }
  }
  printf("\n%d\n",count);

  return 0;

}

Compiler output:
main.c:5:9: error: expected declaration specifiers or '...' before string constant
    5 |   scanf("%d",&len);
      |         ^~~~
main.c:5:14: error: expected declaration specifiers or '...' before '&' token
    5 |   scanf("%d",&len);
      |              ^
main.c:7:3: error: expected identifier or '(' before 'for'
    7 |   for(i=1; i<=len; i++){
      |   ^~~
main.c:7:13: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<=' token
    7 |   for(i=1; i<=len; i++){
      |             ^~
main.c:7:21: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
    7 |   for(i=1; i<=len; i++){
      |                     ^~
main.c:11:3: error: expected identifier or '(' before 'for'
   11 |   for(i=1; i<=N; i++){
      |   ^~~
main.c:11:13: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<=' token
   11 |   for(i=1; i<=N; i++){
      |             ^~
main.c:11:19: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
   11 |   for(i=1; i<=N; i++){
      |                   ^~
main.c:25:3: error: expected identifier or '(' before 'for'
   25 |   for(i=1; i<=len; i++){
      |   ^~~
main.c:25:13: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<=' token
   25 |   for(i=1; i<=len; i++){
      |             ^~
main.c:25:21: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
   25 |   for(i=1; i<=len; i++){
      |                     ^~
main.c:31:10: error: expected declaration specifiers or '...' before string constant
   31 |   printf("\n%d\n",count);
      |          ^~~~~~~~
main.c:31:19: error: expected declaration specifiers or '...' before 'count'
   31 |   printf("\n%d\n",count);
      |                   ^~~~~
main.c:33:3: error: expected identifier or '(' before 'return'
   33 |   return 0;
      |   ^~~~~~
main.c:35:1: error: expected identifier or '(' before '}' token
   35 | }
      | ^
Language: C

#include <stdio.h>

main(){

  int i,j;
  int Sel[37];
  int N;
  int tmp;
  int mini;

  scanf("%d",&N);

  for(i=1; i<=N;i++){
    scanf("%d",&Sel[i]);
  }

  // selection
  for (i=1; i<=N; i++){
    mini = i;
    for (j=i; j<=N; j++){
      if(Sel[j] < Sel[mini]){
	mini = j;
      }
    }
    if(i != mini){
      
      tmp = Sel[i];
      Sel[i] = Sel[mini];
      Sel[mini] = tmp;
      
    }

  }

  for (i=1; i<=N; i++){
    printf("%c%d",Sel[i][1],Sel[i][0]);

    if(i!=N){
      printf(" ");
    }
  }

return 0;

}

Compiler output:
main.c:3:1: error: return type defaults to 'int' [-Wimplicit-int]
    3 | main(){
      | ^~~~
main.c: In function 'main':
main.c:36:25: error: subscripted value is neither array nor pointer nor vector
   36 |     printf("%c%d",Sel[i][1],Sel[i][0]);
      |                         ^
main.c:36:35: error: subscripted value is neither array nor pointer nor vector
   36 |     printf("%c%d",Sel[i][1],Sel[i][0]);
      |                                   ^
Language: C

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

int main(void){
  int A[100];
  int i,j,N,x,min;
  int a,b;
  
  scanf("%d",&N);
  for(i=0; i<N; i++){
    scanf("%d",&A[i]);
  }
  
  x = 0;
  for(i=0; i<N; i++){
    mini = i;
    for(j=i; j<N; j++){
      if(A[j] < A[min]){
	min = j;
      }
    }
    a = A[i];
    b = A[min];
    if(b < a){
      x++;
    }
    swap(&a,&b);
    A[i] = a;
    A[min] = b;
  }
  for(i=0; i<N; i++){
    if(i != 0)printf(" ");
    printf("%d",A[i]);
  }
  printf("\n");
  printf("%d\n",x);
  return 0;
}

void swap(int *x,int *y){
  int temp;
  temp=*x;
  *x=*y;
  *y=temp;
}

Compiler output:
main.c: In function 'main':
main.c:16:5: error: 'mini' undeclared (first use in this function); did you mean 'min'?
   16 |     mini = i;
      |     ^~~~
      |     min
main.c:16:5: note: each undeclared identifier is reported only once for each function it appears in
main.c:27:5: error: implicit declaration of function 'swap' [-Wimplicit-function-declaration]
   27 |     swap(&a,&b);
      |     ^~~~
main.c: At top level:
main.c:40:6: warning: conflicting types for 'swap'; have 'void(int *, int *)'
   40 | void swap(int *x,int *y){
      |      ^~~~
main.c:27:5: note: previous implicit declaration of 'swap' with type 'void(int *, int *)'
   27 |     swap(&a,&b);
      |     ^~~~
Language: C

#include<stdio.h>

int main(void){
  int key,N,mi,i,jcount=0;
  int A[100];

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

Compiler output:
main.c: In function 'main':
main.c:15:9: error: 'j' undeclared (first use in this function)
   15 |     for(j=i+1;j<N;j++){
      |         ^
main.c:15:9: note: each undeclared identifier is reported only once for each function it appears in
main.c:24:21: error: 'count' undeclared (first use in this function); did you mean 'jcount'?
   24 |     if(A[i]!=A[mi]) count++;
      |                     ^~~~~
      |                     jcount
Language: C

#include<stdio.h>
main(){
  int n,i,j,min,data[100],count,tmp;
  scanf("%d",&n);
  for(i=0;i<n;i++)
    scanf("%d",&data[i]);
  for(i=0;i<n;i++){
    min=i;
    for(j=i+1;j<n;j++)
      if(data[j]<data[min])
        min=j;
    if(data[i]>data[min]){
      tmp=data[i];
      data[i]=data[min];
      data[min]=tmp;
      count++;
    }z
  }
  for(i=0;i<n;i++){
    if(i)
      printf(" ");
    printf("%d",data[i]);
  }
  printf("\n");
  printf("%d\n",count);
  return 0;
}

Compiler output:
main.c:2:1: error: return type defaults to 'int' [-Wimplicit-int]
    2 | main(){
      | ^~~~
main.c: In function 'main':
main.c:17:6: error: 'z' undeclared (first use in this function)
   17 |     }z
      |      ^
main.c:17:6: note: each undeclared identifier is reported only once for each function it appears in
main.c:17:7: error: expected ';' before '}' token
   17 |     }z
      |       ^
      |       ;
   18 |   }
      |   ~
Language: C

#include<stdio.h>
main(){
     int a,b;
     sncanf("%d%d",&a,&b);
    printf("100\n0\n");
    return 0;
}

Compiler output:
main.c:2:1: error: return type defaults to 'int' [-Wimplicit-int]
    2 | main(){
      | ^~~~
main.c: In function 'main':
main.c:4:6: error: implicit declaration of function 'sncanf'; did you mean 'sscanf'? [-Wimplicit-function-declaration]
    4 |      sncanf("%d%d",&a,&b);
      |      ^~~~~~
      |      sscanf
Language: C

#include<stdio.h>

int main(int argc, char* argv[])
{
  int a[200], n;
  int i, j, w, mini, swc;

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

  swc = 0;
  for(i = 1; i <= n; i++){
    mini = a[i];
    for(j = i; j <= n; j++){
      if(a[j] < a[mini]){
        mini = j;
      }
    }
    w = a[i];
    a[i] = a[mini]:
    a[mini] = a[i];
    swc++;
  }

  return(0);
}

Compiler output:
main.c: In function 'main':
main.c:22:19: error: expected ';' before ':' token
   22 |     a[i] = a[mini]:
      |                   ^
      |                   ;
Language: C

#include<stdio.h>

int main(int argc, char* argv[])
{
  int a[200], n;
  int i, j, w, mini, swc;

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

  swc = 0;
  for(i = 1; i <= n; i++){
    mini = a[i];
    for(j = i; j <= n; j++){
      if(a[j] < a[mini]){
        mini = j;
      }
    }
    w = a[i];
    a[i] = a[mini]:
    a[mini] = a[i];
    swc++;
  }

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

Compiler output:
main.c: In function 'main':
main.c:22:19: error: expected ';' before ':' token
   22 |     a[i] = a[mini]:
      |                   ^
      |                   ;
Language: C

#include<stdio.h>
int main(void)
{
  int n,i,count=0;
  scanf("%d",&n);
  int a[n];
  for(i=0;i<n;i++)
    scanf("%d",&a[i]);
  int j,mini,p;
  for(i=0;i<n;i++){
    mini = i;
    for(j=i;j<n;j++){
      if (a[j]<a[mini]){
	mini=j;
      }
    }
    p=a[i];
    a[i]=a[mini];
    a[mini]=p;
    count++;
    int t;
    /*for(t=0;t<n;t++){
      printf("%d",a[t]);
      if(t<n-1) printf(" ");
      if (t==n-1) printf("\n");*/
    }
  }

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

Compiler output:
main.c:29:3: error: expected identifier or '(' before 'for'
   29 |   for(i=0;i<n;i++){
      |   ^~~
main.c:29:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
   29 |   for(i=0;i<n;i++){
      |            ^
main.c:29:16: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
   29 |   for(i=0;i<n;i++){
      |                ^~
main.c:34:10: error: expected declaration specifiers or '...' before string constant
   34 |   printf("%d",count);
      |          ^~~~
main.c:34:15: error: unknown type name 'count'
   34 |   printf("%d",count);
      |               ^~~~~
main.c:35:3: error: expected identifier or '(' before 'return'
   35 |   return 0;
      |   ^~~~~~
main.c:36:1: error: expected identifier or '(' before '}' token
   36 | }
      | ^
Language: C

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

int main(void){
	int n;
	int a[200];
	int swap = 0;

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

	for(int i=0; i<n; i++){
		int mini = i;
		for(int j=i; j<n; j++){
			if(a[j] < a[mini]){
				mini = j;
			}
		}
		int temp = a[mini];
		a[mini] = a[i];
		a[i] = temp;
		if(i!=mini)swap++;
	}
	
	for(int i=0; i<n; i++){
		if(i!=n-1)printf("%d ", a[i]);
		else printf("%d\n", a[i]);
	}
	printf("%d\n", swap);

	return 0;
}

Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
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++){
if(i<1) printf(" ");       
printf("%d",A[i]);}
    printf("\n%d",count);
    return 0;

Compiler output:
main.c: In function 'main':
main.c:25:5: 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,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]);
if(i!=lengh) printf(" ");

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

Compiler output:
main.c: In function 'main':
main.c:28:5: error: expected declaration or statement at end of input
   28 |     return 0;
      |     ^~~~~~
main.c:28:5: 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,b;
scanf("%d",&n);
for(i=0;i<n;i++)scanf("%d",&a[i]);
for(i=0;i<n;i++){
tmp = i
for(j=n-1;j>i;j--){
if(a[j]<a[tmp]){
tmp=j;
}
b=a[i];
a[i]=a[tmp];
a[tmp]=b; 
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:9:8: error: expected ';' before 'for'
    9 | tmp = i
      |        ^
      |        ;
   10 | for(j=n-1;j>i;j--){
      | ~~~     
main.c:30:1: error: expected declaration or statement at end of input
   30 | }
      | ^
main.c:30: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,b;
scanf("%d",&n);
for(i=0;i<n;i++)scanf("%d",&a[i]);
for(i=0;i<n;i++){
tmp = i
for(j=n-1;j>i;j--){
if(a[j]<a[tmp]){
tmp=j;
}
b=a[i];
a[i]=a[tmp];
a[tmp]=b; 
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:9:8: error: expected ';' before 'for'
    9 | tmp = i
      |        ^
      |        ;
   10 | for(j=n-1;j>i;j--){
      | ~~~     
main.c:30:1: error: expected declaration or statement at end of input
   30 | }
      | ^
main.c:30: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,b;
scanf("%d",&n);
for(i=0;i<n;i++)scanf("%d",&a[i]);
for(i=0;i<n;i++){
tmp = i
for(j=n-1;j>i;j--){
if(a[j]<a[tmp]){
tmp=j;
}
b=a[i];
a[i]=a[tmp];
a[tmp]=b; 
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:9:8: error: expected ';' before 'for'
    9 | tmp = i
      |        ^
      |        ;
   10 | for(j=n-1;j>i;j--){
      | ~~~
Language: C

  for(i=0;i<s;i++){
    scanf("%d",&a[i]);
  }
  for(i=0;i<s-2;i++){
      mini = i;
      for(j=i;j<s;j++){
	if(a[j]<a[mini])
	 mini = j;
       }
       p = a[i];
       a[i] = a[mini];
       a[mini] = p;
       if(i != mini)
       count++;
      
  }
      for(i=0;i<s;i++){
      printf("%d",a[i]);
      if(i != s-1)
	printf(" ");
    }
    printf("\n%d\n",count);
    return 0;
}
 

Compiler output:
main.c:1:3: error: expected identifier or '(' before 'for'
    1 |   for(i=0;i<s;i++){
      |   ^~~
main.c:1:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 |   for(i=0;i<s;i++){
      |            ^
main.c:1:16: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
    1 |   for(i=0;i<s;i++){
      |                ^~
main.c:4:3: error: expected identifier or '(' before 'for'
    4 |   for(i=0;i<s-2;i++){
      |   ^~~
main.c:4:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    4 |   for(i=0;i<s-2;i++){
      |            ^
main.c:4:18: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
    4 |   for(i=0;i<s-2;i++){
      |                  ^~
main.c:17:7: error: expected identifier or '(' before 'for'
   17 |       for(i=0;i<s;i++){
      |       ^~~
main.c:17:16: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
   17 |       for(i=0;i<s;i++){
      |                ^
main.c:17:20: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
   17 |       for(i=0;i<s;i++){
      |                    ^~
main.c:22:12: error: expected declaration specifiers or '...' before string constant
   22 |     printf("\n%d\n",count);
      |            ^~~~~~~~
main.c:22:21: error: unknown type name 'count'
   22 |     printf("\n%d\n",count);
      |                     ^~~~~
main.c:23:5: error: expected identifier or '(' before 'return'
   23 |     return 0;
      |     ^~~~~~
main.c:24:1: error: expected identifier or '(' before '}' token
   24 | }
      | ^