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

import java.util.Scanner;

class Main {
	//scanner生成
	static Scanner scan = new Scanner(System.in);
	//要素数指定
	static int N = scan.nextInt();
	//配列にメモリ割当
	static int[] A = new int[N];
	static int change = 0;
	
	public static void main(String[] args) {
		System.out.print("aaa");
		Main main = new Main();
		//ループのカウント
		int count = 0;
		//配列に値を代入
		while(count < Main.N){
			Main.A[count] = scan.nextInt();
			count++;
		}
		//
		for (int i = 0;i < Main.N-1;i++){
			int mini = 0;
			mini=i;
			for(int j = i;j < Main.N-1;j++){
				if(Main.A[j] < Main.A[mini]){
					mini = j;
					main.swap(i,mini);
					Main.change++;
				}
			}	
		}
		main.call();
		System.out.println();
		System.out.print(Main.change);
	}
	
	public void swap(int i,int j){
		//添字iと添字jの配列の値を入れ替える
		int m = 0;
		m = Main.A[i];
		Main.A[i] = Main.A[j];
		Main.A[j] = m;
		
	}
	
	public int call(){
		int i = 0;
		while(true){
			System.out.print(Main.A[i]);
			if(i < Main.N - 1){
			System.out.print(" ");
			}
		}
	}
	
	
}

Compiler output:
main.c:1:1: error: unknown type name 'import'
    1 | import java.util.Scanner;
      | ^~~~~~
main.c:1:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    1 | import java.util.Scanner;
      |            ^
main.c:3:1: error: unknown type name 'class'
    3 | class Main {
      | ^~~~~
main.c:3:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    3 | class Main {
      |            ^
Language: C

#include<stdio.h>

int main(){

  int n,i,j,min,m=0,f;
  int A[100];
  int temp;
  scanf("%d",&n);
  
    for(i = 0 ; i < n ; i++)scanf("%d",&A[i]);
  

    for(i = 0 ; i <= n-1 ; i++){
      min = i;
     
      for(j = i ; j <= n-1 ; j++){
       
	if(A[j] < A[min]){
	  min = j;
	  temp = A[i];
          A[i] = A[min];
          A[min] = temp;
	 
          }
      }
      m = m + 1;
    }
    for(i = 0 ; i < n ; i++)printf("%d",A[i]);
    printf("\n");
    printf("%d\n",m);

  return 0;

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

#include<iostream>

using namespace std;

int selectionSort(int A[],int N){
	for(int i=0; i<N; i++){
		int minj = i,j,count;
		for(j=1; j<N; j++){
			if(A[j]<A[minj]){
				minj=j;
			}
		}
		swap(A[j],A[minj]);
		count++;
	}
	return count;
}
int main(){
	int N,A[100],count;
	cin >> N;
	for(int i=0; i<N; i++) cin >> A[i];
	count = selectionSort(A,N);
	for(int i=0; i<N; i++){
		if(i==N-1)cout << A[i];
		else cout << A[i] << " ";
	}
	cout << endl << count << endl;	
}


Compiler output:
a.cc: In function 'int selectionSort(int*, int)':
a.cc:16:16: error: 'count' was not declared in this scope
   16 |         return count;
      |                ^~~~~
Language: C++

#include<stdio.h>
#include <sstream>
#include <iostream>
#include <cstdlib>
 
using namespace std;
 
#define BUF_SIZE 1024
#define ARRAY_SIZE 100

void selectionSort(int array[],int n,int& change_count)
{
  int min;
  for(int(i=0;i<n-1;i++)){
    min=i;
    for(intj=i+1;j<n;j++){
      if(array[j]<array[min]){
        min=j;
      }
    }
    if(i!=min){
      swap(array[i],array[min]);
      change_count++;
    }
  }
}


int main()
{
  char buf[BUF_SIZE];
  int n=atoi(fgets(buf,BUF_SIZE,stdin));
  int array[ARRAY_SIZE];
  int change_count=0;

  for(int i=0;i<n;i++){
    cin>>array[i];
  }
  selectionSort(array,n,change_count);

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


Compiler output:
a.cc: In function 'void selectionSort(int*, int, int&)':
a.cc:14:11: error: 'i' was not declared in this scope
   14 |   for(int(i=0;i<n-1;i++)){
      |           ^
a.cc:14:25: error: expected primary-expression before ')' token
   14 |   for(int(i=0;i<n-1;i++)){
      |                         ^
Language: C++

#include<iostream>


using namespace std;
int main(){
    int N;
    int count=0;
    cin>>N;
    vector<int> vec(N);
    for (int i=0;i<N;++i){
        int a;
        cin>>a;
        vec[i]=a;
    }
    int flag=0;
    for(int i=0;i<N;++i){
        int minj=i;
        flag=0;
        for(int j=i;j<N;++j){
            if(vec[j]<vec[minj]){
                minj=j;
                flag=1;
            }

        }
        swap(vec[minj],vec[i]);
        if(flag==1){++count;}
    }

    for(int i=0;i<N;++i){
        cout<<vec[i]<<" ";
    }
    cout<<endl;
    cout<<count<<endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:9:5: error: 'vector' was not declared in this scope
    9 |     vector<int> vec(N);
      |     ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include<iostream>
  +++ |+#include <vector>
    2 | 
a.cc:9:12: error: expected primary-expression before 'int'
    9 |     vector<int> vec(N);
      |            ^~~
a.cc:13:9: error: 'vec' was not declared in this scope
   13 |         vec[i]=a;
      |         ^~~
a.cc:20:16: error: 'vec' was not declared in this scope
   20 |             if(vec[j]<vec[minj]){
      |                ^~~
a.cc:26:14: error: 'vec' was not declared in this scope
   26 |         swap(vec[minj],vec[i]);
      |              ^~~
a.cc:31:15: error: 'vec' was not declared in this scope
   31 |         cout<<vec[i]<<" ";
      |               ^~~
Language: C++

#include <iostream>
#include <algorithm>

using namespace std;

unsigned int d[101];

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

	for (unsigned int i = 0; i < n; ++i)
		unsigned int minj = i;
		for (unsigned int j = i; j < n; ++j) {
			if (d[j] < d[minj]) {
				minj = j;
			}
		}
		unsigned int t = d[i];
		d[i] = d[minj];
		d[minj] = t;
		++num;
	}
	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: In function 'int main()':
a.cc:18:39: error: 'i' was not declared in this scope
   18 |                 for (unsigned int j = i; j < n; ++j) {
      |                                       ^
a.cc:19:38: error: 'minj' was not declared in this scope
   19 |                         if (d[j] < d[minj]) {
      |                                      ^~~~
a.cc:23:36: error: 'i' was not declared in this scope
   23 |                 unsigned int t = d[i];
      |                                    ^
a.cc:24:26: error: 'minj' was not declared in this scope
   24 |                 d[i] = d[minj];
      |                          ^~~~
a.cc: At global scope:
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>
#include <algorithm>

using namespace std;

unsigned int d[101];

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

	for (unsigned int i = 0; i < n; ++i) {
		unsigned int minj = i;
		for (unsigned int j = i+1; j < n; ++j) {
			if (d[j] < d[minj]) {
				minj = j;
			}
		}
		if (i != j) {
			unsigned int t = d[i];
			d[i] = d[minj];
			d[minj] = t;
			++num;
		}
	}
	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: In function 'int main()':
a.cc:23:26: error: 'j' was not declared in this scope
   23 |                 if (i != j) {
      |                          ^
Language: C++

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

using namespace std;


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

int selectionSort(int A[], int N){
    int minj, cnt = 0;
    for (int i = 0; i < N; i++) {
        minj = i;
        for (int j = i; j < N; j++) {
            if (A[j] < A[minj]) {
                jnum = j;
                swap(A[minj], A[jnum]);
                cnt += 1;
            }
        }
    }
    return cnt;
}


int main() {
    int n, num_sec[101]={}, cnt=0;
    cin >> n;
    for (int i = 0; i < n; i++) cin >> num_sec[i];
    cnt=selectionSort(num_sec, n);
    cout << cnt << endl;
}


Compiler output:
a.cc: In function 'int selectionSort(int*, int)':
a.cc:25:17: error: 'jnum' was not declared in this scope; did you mean 'enum'?
   25 |                 jnum = j;
      |                 ^~~~
      |                 enum
Language: C++

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

using namespace std;


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

int selectionSort(int A[], int N){
    int minj,  cnt = 0;
    for (int i = 0; i < N; i++) {
        minj = i;
        for (int j = i; j < N; j++) {
            if (A[j] < A[minj]) {
                swap(A[minj], A[j);
                cnt += 1;
            }
        }
    }
    return cnt;
}


int main() {
    int n, num_sec[101]={}, cnt=0;
    cin >> n;
    for (int i = 0; i < n; i++) cin >> num_sec[i];
    cnt=selectionSort(num_sec, n);
    cout << cnt << endl;
}


Compiler output:
a.cc: In function 'int selectionSort(int*, int)':
a.cc:25:34: error: expected ']' before ')' token
   25 |                 swap(A[minj], A[j);
      |                                  ^
      |                                  ]
Language: C++

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

using namespace std;


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

int selectionSort(int A[], int N){
    int jnum, cnt = 0;
    for (int i = 0; i < N; i++) {
        for (int j = i; j < N; j++) {
            if (A[j] < A[i]) {
                jnum = j;
                
            }
        }
        swap(A[minj], A[jnum]);
        cnt += 1;
    }
    return cnt;
}


int main() {
    int n, num_sec[101]={}, cnt=0;
    cin >> n;
    for (int i = 0; i < n; i++) cin >> num_sec[i];
    cnt=selectionSort(num_sec, n);
    cout << cnt << endl;
}


Compiler output:
a.cc: In function 'int selectionSort(int*, int)':
a.cc:26:16: error: 'minj' was not declared in this scope
   26 |         swap(A[minj], A[jnum]);
      |                ^~~~
Language: C++

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

using namespace std;


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

int selectionSort(int A[], int N){
    int minj, cnt = 0;
    for (int i = 0; i < N; i++) {
        minj = i;
        for (int j = i; j < N; j++) if (A[j] < minj) minj = j;
        if (i != minj) {
            swap(A[i], A[minj]);
            cnt += 1;
        }
    }
    trace(A, N)
    return cnt;
}


int main() {
    int n, num_sec[101]={}, cnt=0;
    cin >> n;
    for (int i = 0; i < n; i++) cin >> num_sec[i];
    cnt=selectionSort(num_sec, n);
    cout << cnt << endl;
}




Compiler output:
a.cc: In function 'int selectionSort(int*, int)':
a.cc:29:16: error: expected ';' before 'return'
   29 |     trace(A, N)
      |                ^
      |                ;
   30 |     return cnt;
      |     ~~~~~~      
a.cc:31:1: warning: no return statement in function returning non-void [-Wreturn-type]
   31 | }
      | ^
Language: C++

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

void showVecotr(std::vector<int> readVec){
    for(int i = 0; i < readVec.size(); ++i){
        std::cout << readVec.at(i) << std::endl;
        if(readVec.size() - 1 != i){
            std::cout << " ";
        }else{
            std::cout << std::endl;
        }
    }
}
int main(){
    int n;
    std::cin >> n;

    std::vector<int> a(n);
    for(int i = 0; i < n; ++i){
        std::cin >> a.at(i);
    }

    int count = 0;

    for(int i = 0; i < n; ++i){
        int temp = i;
        for(int j = i; j < n; ++j){
            if(a.at(j) < a.at(temp)){
                temp = j;
                ++count;
            }
        }

        a.at(i) += a.at(temp);
        a.at(temp) = a.at(i) - a.at(temp);
        a.at(i) = a.at(i) - a.at(temp);
    }

    showVector(a);
    std::cout << count << std::endl;

    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:40:5: error: 'showVector' was not declared in this scope; did you mean 'showVecotr'?
   40 |     showVector(a);
      |     ^~~~~~~~~~
      |     showVecotr
Language: C++

#include <iostream>

using namespace std;

int main() {
    int N, i, A[100], j. mini, s;
    cin>>N;
    for(i=0;i<N;i++)
        cin >> A[i];
    for(i=0;i<N;i++) {
        mini = i;
        for(j=i;j<N;j++){
            if(A[j]<A[mini])
                mini = j;
        }
        s = A[i];
        A[i] = A[mini];
        A[mini] = s;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:24: error: expected initializer before '.' token
    6 |     int N, i, A[100], j. mini, s;
      |                        ^
a.cc:11:9: error: 'mini' was not declared in this scope
   11 |         mini = i;
      |         ^~~~
a.cc:12:13: error: 'j' was not declared in this scope
   12 |         for(j=i;j<N;j++){
      |             ^
a.cc:16:9: error: 's' was not declared in this scope
   16 |         s = A[i];
      |         ^
Language: C++

#include <iostream>

using namespace std;

int main() {
    int N, i, A[100], j, mini, s, k, count=0;
    cin>>N;
    for(i=0;i<N;i++)
        cin >> A[i];
    for(i=0;i<N;i++) {
        mini = i;
        for(j=i;j<N;j++){
            if(A[j]<A[mini])
                mini = j;
        }
        s = A[i];
        A[i] = A[mini];
        A[mini] = s;
        }
        count++;
    }
cout << count << endl;
        for(k=0;k<N;k++) { 
           if(k<N-1)  cout << A[k] << " ";
           else cout << A[k] << endl;
}

Compiler output:
a.cc:22:1: error: 'cout' does not name a type
   22 | cout << count << endl;
      | ^~~~
a.cc:23:9: error: expected unqualified-id before 'for'
   23 |         for(k=0;k<N;k++) {
      |         ^~~
a.cc:23:17: error: 'k' does not name a type
   23 |         for(k=0;k<N;k++) {
      |                 ^
a.cc:23:21: error: 'k' does not name a type
   23 |         for(k=0;k<N;k++) {
      |                     ^
Language: C++

#include <iostream>

using namespace std;

int main() {
    int N, i, A[100], j, mini, s, k, count=0;
    cin>>N;
    for(i=0;i<N;i++)
        cin >> A[i];
    for(i=0;i<N;i++) {
        mini = i;
        for(j=i;j<N;j++){
            if(A[j]<A[mini])
                mini = j;
        }
        s = A[i];
        A[i] = A[mini];
        A[mini] = s;
        }
        count++;
    }
cout << count << endl;
        for(k=0;k<N;k++) { 
           if(k<N-1)  cout << A[k] << " ";
           else cout << A[k] << endl;
        }
}

Compiler output:
a.cc:22:1: error: 'cout' does not name a type
   22 | cout << count << endl;
      | ^~~~
a.cc:23:9: error: expected unqualified-id before 'for'
   23 |         for(k=0;k<N;k++) {
      |         ^~~
a.cc:23:17: error: 'k' does not name a type
   23 |         for(k=0;k<N;k++) {
      |                 ^
a.cc:23:21: error: 'k' does not name a type
   23 |         for(k=0;k<N;k++) {
      |                     ^
a.cc:27:1: error: expected declaration before '}' token
   27 | }
      | ^
Language: C++

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

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

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

   return 0;
}

Compiler output:
a.cc:3:7: error: expected nested-name-specifier before 'naespace'
    3 | using naespace std;
      |       ^~~~~~~~
a.cc: In function 'int selectionSort(int*, int)':
a.cc:20:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   20 | int main(){
      |         ^~
a.cc:20:9: note: remove parentheses to default-initialize a variable
   20 | int main(){
      |         ^~
      |         --
a.cc:20:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:20:11: error: a function-definition is not allowed here before '{' token
   20 | int main(){
      |           ^
a.cc:35:2: error: expected '}' at end of input
   35 | }
      |  ^
a.cc:5:33: note: to match this '{'
    5 | int selectionSort(int A[],int N){
      |                                 ^
a.cc:35:2: warning: control reaches end of non-void function [-Wreturn-type]
   35 | }
      |  ^
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;
 
int selectionSort(int A[],int N){
   int i,j,minj,count;
   count = 0;
   for(i=0;i<N;i++){
     minj = i;
     for(j=i;j<N;j++){
       if(A[j]<A[minj])minj = j;
     if(i!=minj){
       A[i] = A[minj];
       count++;
     }
   }
   return count;
}
 
int main(){
   int A[100],N,count,i;
   cin >> N;
   for(i=0;i<N;i++)cin >> A[i];
    
   count = selectionSort(A,N);
    
   for(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 selectionSort(int*, int)':
a.cc:20:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   20 | int main(){
      |         ^~
a.cc:20:9: note: remove parentheses to default-initialize a variable
   20 | int main(){
      |         ^~
      |         --
a.cc:20:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:20:11: error: a function-definition is not allowed here before '{' token
   20 | int main(){
      |           ^
a.cc:35:2: error: expected '}' at end of input
   35 | }
      |  ^
a.cc:5:33: note: to match this '{'
    5 | int selectionSort(int A[],int N){
      |                                 ^
a.cc:35:2: warning: control reaches end of non-void function [-Wreturn-type]
   35 | }
      |  ^
Language: C++

#include<iostream>
#include<algorithm>
using naespace std;
 
int selectionSort(int A[],int N){
   int i,j,minj,count;
   count = 0;
   for(i=0;i<N;i++){
     minj = i;
     for(j=i;j<N;j++){
       if(A[j]<A[minj])minj = j;
     }
     if(i!=minj){
       A[i] = A[minj];
       count++;
     }
   }
   return count;
}
 
int main(){
   int A[100],N,count,i;
   cin >> N;
   for(i=0;i<N;i++)cin >> A[i];
    
   count = selectionSort(A,N);
    
   for(i=0;i<N;i++){
     if(i)cout << " ";
     cout << A[i];
   }
   cout << endl;
   cout << count << endl;
 
   return 0;
}

Compiler output:
a.cc:3:7: error: expected nested-name-specifier before 'naespace'
    3 | using naespace std;
      |       ^~~~~~~~
a.cc: In function 'int main()':
a.cc:23:4: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   23 |    cin >> N;
      |    ^~~
      |    std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:29:11: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   29 |      if(i)cout << " ";
      |           ^~~~
      |           std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:30:6: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   30 |      cout << A[i];
      |      ^~~~
      |      std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:32:4: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   32 |    cout << endl;
      |    ^~~~
      |    std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:32:12: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   32 |    cout << endl;
      |            ^~~~
      |            std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

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

struct Card{ char suit,value; };

void bubbleSort(struct Card A[],int N){
   for(int i=0;i<N;i++){
     for(int j=N-1;j>=i;j--){
       if(A[j].value<A[j-1].value){
         swap(A[j],A[j-1]);
       }
     }
   }
}

void selecctionSort(struct Card A[],int N){
   for(int i=0;i<N;i++){
     int minj = i;
     for(int j=i;j<N;j++){
       if(A[j].value<A[minj].value)minj = j;
     }
     swap(A[j],A[minj]);
   }
}


void print(struct Card A[],int N){
   for(int i=0;i<N;i++){
     if(i>0)cout << " ";
     cout << A[i].suit << A[i].value;
   }
   cout << endl;
}

bool inStable(struct Card C1[],struct Card C2[],int N){
   for(int i=0;i<N;i++)
     if(C1[i].suit != C2[i].suit)return false;
   }
   return true;
}

int main(){
   Card C1[100],C2[100];
   int N;
   char ch;

   cin >> N;
   for(int i=0;i<N;i++){
     cin >> C1[i].suit >> C1[i].value;
   }

   for(int i=0;i<N;i++)C2[i] = C1[i];

   bubbleSort(C1,N);
   selectionSort(C2,N);
   
   print(C1,N);
   cout << "Stable" << endl;
   print(C2,N);
   if(isSable(C1,C2,N)){
   cout << "Stable" << endl;
   }else {
   cout <<"Not Stable" << endl;
   }

   return 0;
}

Compiler output:
a.cc: In function 'void selecctionSort(Card*, int)':
a.cc:23:13: error: 'j' was not declared in this scope
   23 |      swap(A[j],A[minj]);
      |             ^
a.cc: At global scope:
a.cc:40:4: error: expected unqualified-id before 'return'
   40 |    return true;
      |    ^~~~~~
a.cc:41:1: error: expected declaration before '}' token
   41 | }
      | ^
a.cc: In function 'int main()':
a.cc:56:4: error: 'selectionSort' was not declared in this scope; did you mean 'selecctionSort'?
   56 |    selectionSort(C2,N);
      |    ^~~~~~~~~~~~~
      |    selecctionSort
a.cc:61:7: error: 'isSable' was not declared in this scope; did you mean 'inStable'?
   61 |    if(isSable(C1,C2,N)){
      |       ^~~~~~~
      |       inStable
a.cc: In function 'bool inStable(Card*, Card*, int)':
a.cc:39:4: warning: control reaches end of non-void function [-Wreturn-type]
   39 |    }
      |    ^
Language: C++

#include<iostream>
using namespace std;
 
struct Card{ char suit,value; };
 
void bubbleSort(struct Card A[],int N){
   for(int i=0;i<N;i++){
     for(int j=N-1;j>=i;j--){
       if(A[j].value<A[j-1].value){
         Card t = A[j];A[j] = A[j-1];A[j-1] = t;
       }
     }
   }
}
 
void selecctionSort(struct Card A[],int N){
   for(int i=0;i<N;i++){
     int minj = i;
     for(int j=i;j<N;j++){
       if(A[j].value<A[minj].value)minj = j;
     }
     Card t = A[j];A[j] = A[j-1];A[j-1] = t;
   }
}
 
 
void print(struct Card A[],int N){
   for(int i=0;i<N;i++){
     if(i>0)cout << " ";
     cout << A[i].suit << A[i].value;
   }
   cout << endl;
}
 
bool inStable(struct Card C1[],struct Card C2[],int N){
   for(int i=0;i<N;i++)
     if(C1[i].suit != C2[i].suit)return false;
   }
   return true;
}
 
int main(){
   Card C1[100],C2[100];
   int N;
   char ch;
 
   cin >> N;
   for(int i=0;i<N;i++){
     cin >> C1[i].suit >> C1[i].value;
   }
 
   for(int i=0;i<N;i++)C2[i] = C1[i];
 
   bubbleSort(C1,N);
   selectionSort(C2,N);
    
   print(C1,N);
   cout << "Stable" << endl;
   print(C2,N);
   if(isSable(C1,C2,N)){
   cout << "Stable" << endl;
   }else {
   cout <<"Not Stable" << endl;
   }
 
   return 0;
}

Compiler output:
a.cc: In function 'void selecctionSort(Card*, int)':
a.cc:22:17: error: 'j' was not declared in this scope
   22 |      Card t = A[j];A[j] = A[j-1];A[j-1] = t;
      |                 ^
a.cc: At global scope:
a.cc:39:4: error: expected unqualified-id before 'return'
   39 |    return true;
      |    ^~~~~~
a.cc:40:1: error: expected declaration before '}' token
   40 | }
      | ^
a.cc: In function 'int main()':
a.cc:55:4: error: 'selectionSort' was not declared in this scope; did you mean 'selecctionSort'?
   55 |    selectionSort(C2,N);
      |    ^~~~~~~~~~~~~
      |    selecctionSort
a.cc:60:7: error: 'isSable' was not declared in this scope; did you mean 'inStable'?
   60 |    if(isSable(C1,C2,N)){
      |       ^~~~~~~
      |       inStable
a.cc: In function 'bool inStable(Card*, Card*, int)':
a.cc:38:4: warning: control reaches end of non-void function [-Wreturn-type]
   38 |    }
      |    ^
Language: C++

#include<iostream>
using namespace std;
  
struct Card{ char suit,value; };
  
void bubbleSort(struct Card A[],int N){
   for(int i=0;i<N;i++){
     for(int j=N-1;j>=i;j--){
       if(A[j].value<A[j-1].value){
         Card t = A[j];A[j] = A[j-1];A[j-1] = t;
       }
     }
   }
}
  
void selecctionSort(struct Card A[],int N){
   for(int i=0;i<N;i++){
     int minj = i;
     for(int j=i;j<N;j++){
       if(A[j].value<A[minj].value)minj = j;
     }
     Card t = A[i];A[i] = A[minj];A[minj] = t;
   }
}
  
  
void print(struct Card A[],int N){
   for(int i=0;i<N;i++){
     if(i>0)cout << " ";
     cout << A[i].suit << A[i].value;
   }
   cout << endl;
}
  
bool inStable(struct Card C1[],struct Card C2[],int N){
   for(int i=0;i<N;i++)
     if(C1[i].suit != C2[i].suit)return false;
   }
   return true;
}
  
int main(){
   Card C1[100],C2[100];
   int N;
   char ch;
  
   cin >> N;
   for(int i=0;i<N;i++){
     cin >> C1[i].suit >> C1[i].value;
   }
  
   for(int i=0;i<N;i++)C2[i] = C1[i];
  
   bubbleSort(C1,N);
   selectionSort(C2,N);
     
   print(C1,N);
   cout << "Stable" << endl;
   print(C2,N);
   if(isSable(C1,C2,N)){
   cout << "Stable" << endl;
   }else {
   cout <<"Not Stable" << endl;
   }
  
   return 0;
}

Compiler output:
a.cc:39:4: error: expected unqualified-id before 'return'
   39 |    return true;
      |    ^~~~~~
a.cc:40:1: error: expected declaration before '}' token
   40 | }
      | ^
a.cc: In function 'int main()':
a.cc:55:4: error: 'selectionSort' was not declared in this scope; did you mean 'selecctionSort'?
   55 |    selectionSort(C2,N);
      |    ^~~~~~~~~~~~~
      |    selecctionSort
a.cc:60:7: error: 'isSable' was not declared in this scope; did you mean 'inStable'?
   60 |    if(isSable(C1,C2,N)){
      |       ^~~~~~~
      |       inStable
a.cc: In function 'bool inStable(Card*, Card*, int)':
a.cc:38:4: warning: control reaches end of non-void function [-Wreturn-type]
   38 |    }
      |    ^
Language: C++

#include<iostream>
using namespace std;
   
struct Card{ char suit,value; };
   
void bubbleSort(struct Card A[],int N){
   for(int i=0;i<N;i++){
     for(int j=N-1;j>=i;j--){
       if(A[j].value<A[j-1].value){
         Card t = A[j];A[j] = A[j-1];A[j-1] = t;
       }
     }
   }
}
   
void selecctionSort(struct Card A[],int N){
   for(int i=0;i<N;i++){
     int minj = i;
     for(int j=i;j<N;j++){
       if(A[j].value<A[minj].value)minj = j;
     }
     Card t = A[i];A[i] = A[minj];A[minj] = t;
   }
}
   
   
void print(struct Card A[],int N){
   for(int i=0;i<N;i++){
     if(i>0)cout << " ";
     cout << A[i].suit << A[i].value;
   }
   cout << endl;
}
   
bool inStable(struct Card C1[],struct Card C2[],int N){
   for(int i=0;i<N;i++){
     if(C1[i].suit != C2[i].suit)return false;
   }
   return true;
}
   
int main(){
   Card C1[100],C2[100];
   int N;
   char ch;
   
   cin >> N;
   for(int i=0;i<N;i++){
     cin >> C1[i].suit >> C1[i].value;
   }
   
   for(int i=0;i<N;i++)C2[i] = C1[i];
   
   bubbleSort(C1,N);
   selectionSort(C2,N);
      
   print(C1,N);
   cout << "Stable" << endl;
   print(C2,N);
   if(isSable(C1,C2,N)){
   cout << "Stable" << endl;
   }else {
   cout <<"Not Stable" << endl;
   }
   
   return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:55:4: error: 'selectionSort' was not declared in this scope; did you mean 'selecctionSort'?
   55 |    selectionSort(C2,N);
      |    ^~~~~~~~~~~~~
      |    selecctionSort
a.cc:60:7: error: 'isSable' was not declared in this scope; did you mean 'inStable'?
   60 |    if(isSable(C1,C2,N)){
      |       ^~~~~~~
      |       inStable
Language: C++

#include<iostream>
using namespace std;
    
struct Card{ char suit,value; };
    
void bubbleSort(struct Card A[],int N){
   for(int i=0;i<N;i++){
     for(int j=N-1;j>=i;j--){
       if(A[j].value<A[j-1].value){
         Card t = A[j];A[j] = A[j-1];A[j-1] = t;
       }
     }
   }
}
    
void selectionSort(struct Card A[],int N){
   for(int i=0;i<N;i++){
     int minj = i;
     for(int j=i;j<N;j++){
       if(A[j].value<A[minj].value)minj = j;
     }
     Card t = A[i];A[i] = A[minj];A[minj] = t;
   }
}
    
    
void print(struct Card A[],int N){
   for(int i=0;i<N;i++){
     if(i>0)cout << " ";
     cout << A[i].suit << A[i].value;
   }
   cout << endl;
}
    
bool isStable(struct Card C1[],struct Card C2[],int N){
   for(int i=0;i<N;i++){
     if(C1[i].suit != C2[i].suit)return false;
   }
   return true;
}
    
int main(){
   Card C1[100],C2[100];
   int N;
   char ch;
    
   cin >> N;
   for(int i=0;i<N;i++){
     cin >> C1[i].suit >> C1[i].value;
   }
    
   for(int i=0;i<N;i++)C2[i] = C1[i];
    
   bubbleSort(C1,N);
   selectionSort(C2,N);
       
   print(C1,N);
   cout << "Stable" << endl;
   print(C2,N);
   if(isSable(C1,C2,N)){
   cout << "Stable" << endl;
   }else {
   cout <<"Not Stable" << endl;
   }
    
   return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:60:7: error: 'isSable' was not declared in this scope; did you mean 'isStable'?
   60 |    if(isSable(C1,C2,N)){
      |       ^~~~~~~
      |       isStable
Language: C++

#include<iostream>
#include<stdio.h>

int main()
{
int N,b,min,tmp,cou;cou=0;
int num[101]={};
cin>>N;
for(int i=0;i<N;i++)
{cin>>b;num[i]=b;}
for(int i=0;i<N;i++)
{

min=i;
for(int j=i;j<N;j++)
{if(num[min]>num[j])
{tmp=num[min];num[min]=num[j];num[j]=tmp;cou++;}
}
}
for(int i=0;i<N;i++)
{if(i)cout<<" ";
cout<<num[i];
}
cout<<endl;cout<<cou<<endl;
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:1: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    8 | cin>>N;
      | ^~~
      | std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:21:7: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   21 | {if(i)cout<<" ";
      |       ^~~~
      |       std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:22:1: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   22 | cout<<num[i];
      | ^~~~
      | std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:24:1: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   24 | cout<<endl;cout<<cou<<endl;
      | ^~~~
      | std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:24:7: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   24 | cout<<endl;cout<<cou<<endl;
      |       ^~~~
      |       std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

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

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

	for(int i = 0; i < n; i++){
		minj = i;
		for(int j = i; j < n; j++){
			if(A[j] < A[minj])
				minj = j;
			swap(A[i], A[minj]);
			if(A[i] != A[min])
				count++;
		}
	}

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

Compiler output:
a.cc: In function 'int main()':
a.cc:18:37: error: invalid types 'int [n][<unresolved overloaded function type>]' for array subscript
   18 |                         if(A[i] != A[min])
      |                                     ^
Language: C++

#include <stdio.h>

int main(){
 int N,A[100]cnt=0;
 scanf("%d",&N);
 for(int i=0;i<N;i++){
  scanf("%d",&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;
         }
     }
     if(mini!=i){
      swap A[i] and A[mini];
      int a=A[i];
      A[i]=A[mini];
      A[mini]=a;
      cnt++;
     }
 }
 for(int i=0;i<N-1;i++){
  printf("%d ",A[i]);
 }
 printf("%d\n%d\n",A[N-1],N);
 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:14: error: expected initializer before 'cnt'
    4 |  int N,A[100]cnt=0;
      |              ^~~
a.cc:7:15: error: 'A' was not declared in this scope
    7 |   scanf("%d",&A[i]);
      |               ^
a.cc:12:14: error: 'A' was not declared in this scope
   12 |          if( A[j] < A[mini]){
      |              ^
a.cc:17:7: error: 'swap' was not declared in this scope
   17 |       swap A[i] and A[mini];
      |       ^~~~
a.cc:18:13: error: 'A' was not declared in this scope
   18 |       int a=A[i];
      |             ^
a.cc:21:7: error: 'cnt' was not declared in this scope; did you mean 'int'?
   21 |       cnt++;
      |       ^~~
      |       int
a.cc:25:16: error: 'A' was not declared in this scope
   25 |   printf("%d ",A[i]);
      |                ^
a.cc:27:20: error: 'A' was not declared in this scope
   27 |  printf("%d\n%d\n",A[N-1],N);
      |                    ^
Language: C++

#include <stdio.h>

int main(){
 int N,A[100],cnt=0;
 scanf("%d",&N);
 for(int i=0;i<N;i++){
  scanf("%d",&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;
         }
     }
     if(mini!=i){
      swap A[i] and A[mini];
      int a=A[i];
      A[i]=A[mini];
      A[mini]=a;
      cnt++;
     }
 }
 for(int i=0;i<N-1;i++){
  printf("%d ",A[i]);
 }
 printf("%d\n%d\n",A[N-1],N);
 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:7: error: 'swap' was not declared in this scope
   17 |       swap A[i] and A[mini];
      |       ^~~~
Language: C++

//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_2_B&lang=jp
#include <iostream>
#include <algorithm>
using namespace std;

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

  for(int i=0; i<n; i++){
    int min = i;
    for(int j =???i; j<n; j++){
      if(a[j] < a[min]) {
        min = j;
      }
    }
    swap(a[j], a[min]);
  }



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

Compiler output:
a.cc: In function 'int main()':
a.cc:16:16: error: expected primary-expression before '?' token
   16 |     for(int j =???i; j<n; j++){
      |                ^
a.cc:16:17: error: expected primary-expression before '?' token
   16 |     for(int j =???i; j<n; j++){
      |                 ^
a.cc:16:18: error: expected primary-expression before '?' token
   16 |     for(int j =???i; j<n; j++){
      |                  ^
a.cc:16:20: error: expected ':' before ';' token
   16 |     for(int j =???i; j<n; j++){
      |                    ^
      |                    :
a.cc:16:20: error: expected primary-expression before ';' token
a.cc:16:20: error: expected ':' before ';' token
   16 |     for(int j =???i; j<n; j++){
      |                    ^
      |                    :
a.cc:16:20: error: expected primary-expression before ';' token
a.cc:16:20: error: expected ':' before ';' token
   16 |     for(int j =???i; j<n; j++){
      |                    ^
      |                    :
a.cc:16:20: error: expected primary-expression before ';' token
a.cc:21:12: error: 'j' was not declared in this scope
   21 |     swap(a[j], a[min]);
      |            ^
Language: C++

//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_2_B&lang=jp
#include <iostream>
#include <algorithm>
using namespace std;

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

  for(int i=0; i<n; i++){
    int min = i;
    for(int j =???i; j<n; j++){
      if(a[j] < a[min]) {
        min = j;
      }
    }
    swap(a[i], a[min]);
  }



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

Compiler output:
a.cc: In function 'int main()':
a.cc:16:16: error: expected primary-expression before '?' token
   16 |     for(int j =???i; j<n; j++){
      |                ^
a.cc:16:17: error: expected primary-expression before '?' token
   16 |     for(int j =???i; j<n; j++){
      |                 ^
a.cc:16:18: error: expected primary-expression before '?' token
   16 |     for(int j =???i; j<n; j++){
      |                  ^
a.cc:16:20: error: expected ':' before ';' token
   16 |     for(int j =???i; j<n; j++){
      |                    ^
      |                    :
a.cc:16:20: error: expected primary-expression before ';' token
a.cc:16:20: error: expected ':' before ';' token
   16 |     for(int j =???i; j<n; j++){
      |                    ^
      |                    :
a.cc:16:20: error: expected primary-expression before ';' token
a.cc:16:20: error: expected ':' before ';' token
   16 |     for(int j =???i; j<n; j++){
      |                    ^
      |                    :
a.cc:16:20: error: expected primary-expression before ';' token
Language: C++

include<bits/stdc++.h>
using namespace std;
int cnt,minj,A[100];;
int selectionSort(int N);
int main(){
  int N;
  cin >> N;
  for(int i=0;i<N;i++){
    cin >> A[i];
  }
  selectionSort(N);
  for(int i=0;i<N;i++){
    if(i!= N-1){
    cout << A[i] << " ";
    }else{
      cout << A[i];
    }
  }
  cout << endl << cnt << endl;
}
int selectionSort(int N){ 
  for(int i = 0;i<N;i++){
    minj = i;
    for (int j = i+1;j<N;j++){
      if( A[j] < A[minj]){
	minj = j;
      }
    }
    if(i != minj){
      swap(A[i],A[minj]);
      cnt++;
    }
  }
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include<bits/stdc++.h>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:7:3: error: 'cin' was not declared in this scope
    7 |   cin >> N;
      |   ^~~
a.cc:14:5: error: 'cout' was not declared in this scope
   14 |     cout << A[i] << " ";
      |     ^~~~
a.cc:16:7: error: 'cout' was not declared in this scope
   16 |       cout << A[i];
      |       ^~~~
a.cc:19:3: error: 'cout' was not declared in this scope
   19 |   cout << endl << cnt << endl;
      |   ^~~~
a.cc:19:11: error: 'endl' was not declared in this scope
   19 |   cout << endl << cnt << endl;
      |           ^~~~
a.cc: In function 'int selectionSort(int)':
a.cc:30:7: error: 'swap' was not declared in this scope
   30 |       swap(A[i],A[minj]);
      |       ^~~~
a.cc:34:1: warning: no return statement in function returning non-void [-Wreturn-type]
   34 | }
      | ^
Language: C++

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

int selectionSort(A[], N){
  int i, j, minj, cnt;

  for(i = 0; i < N; i++){
    minj = i ;
    for(j = i; j < N; j++){
      if(A[j] < A[minj]){
        minj = j;
      swap(A[i], minj);
      cnt++; 
      }
    }
  }

  return cnt;
}

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

  cnt = selectionSort(A, N);

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

Compiler output:
a.cc:6:19: error: 'A' was not declared in this scope
    6 | int selectionSort(A[], N){
      |                   ^
a.cc:6:21: error: expected primary-expression before ']' token
    6 | int selectionSort(A[], N){
      |                     ^
a.cc:6:24: error: 'N' was not declared in this scope
    6 | int selectionSort(A[], N){
      |                        ^
a.cc:6:25: error: expression list treated as compound expression in initializer [-fpermissive]
    6 | int selectionSort(A[], N){
      |                         ^
a.cc: In function 'int main()':
a.cc:29:22: error: 'selectionSort' cannot be used as a function
   29 |   cnt = selectionSort(A, N);
      |         ~~~~~~~~~~~~~^~~~~~
a.cc:31:7: error: 'i' was not declared in this scope
   31 |   for(i = 0; i < N; i++){
      |       ^
Language: C++

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

int selectionSort(int A[], int N){
  int i, j, minj, cnt;

  for(i = 0; i < N; i++){
    minj = i ;
    for(j = i; j < N; j++){
      if(A[j] < A[minj]){
        minj = j;
      swap(A[i], minj);
      cnt++; 
      }
    }
  }

  return cnt;
}

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

  cnt = selectionSort(A, N);

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

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

#include <iostream>

using namespace std;

void selectionSort(int *,int);

int main(){
	int n;
	cin>>n;
	int *array;
	array=new int [n];
	if (array==NULL){
		cout<<"Error!"<<endl;
		return -1;
	}
	for (int i=0;i<n;i++){
		cin>>array[i];
	}
	selectionSort(array,n);
	return 0;
}

void selectionSort(int *a,int n){
	int cnt=0;
	for (int i=0;i<n;i++){
		int mini=i;
		for (int j=i;j<n;j++){
			if (a[j]<a[mini]){
				mini=j;
			}
		}
		if (i!=mini){
			int temp;
			temp=a[i];
			a[i]=a[mini];
			a[mini]=temp;
			cnt++
		}
	}
	for (int i=0;i<n;i++){
		cout<<a[i];
		if (i!=n-1){
			cout<<" ";
		}
	}
	cout<<endl;
	cout<<cnt<<endl;
}

Compiler output:
a.cc: In function 'void selectionSort(int*, int)':
a.cc:37:30: error: expected ';' before '}' token
   37 |                         cnt++
      |                              ^
      |                              ;
   38 |                 }
      |                 ~
Language: C++

#include <iostream>
using namespace std;

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


int selectionSort(int A[], int N) {
	int num_of_exchange = 0;
	for (int i = 0; i < N; i++) {
		int minj = i;
		for (j = i; j < N; j++) {
			if (A[j] < A[minj]) {
				minj = j;
			}
		}
		if(i!=minj){
			int temp = A[i];
			A[i] = A[minj];
			A[minj] = temp;
			num_of_exchange++;
		}
	}
	return num_of_exchange;
}

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

	int num_of_exchange = selectionSort(A, N);

	displayA(A, N);

	cout << num_of_exchange << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int selectionSort(int*, int)':
a.cc:15:22: error: 'j' was not declared in this scope
   15 |                 for (j = i; j < N; j++) {
      |                      ^
Language: C++

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

int main(){
	long cnt = 0;
	long minj;
	long N;
	cin >> N;
	vector<long> A(N);
	for (long i = 0; i < N; i++){
		cin >> A[i];
	}
	for (long i = 0; i < N; i++){
		minj = i;
		for (long j = i; j < N; j++){
			if (A[j] < A[minj]){
				minj = j;
			}
		}
		tmp = A[i];
		A[i] = A[minj];
		A[minj] = tmp;
		if (tmp != A[i]) cnt++;
	}
	for (long i = 0; i < N - 1; i++){
		cout << A[i] << " ";
	}
	cout << A[N - 1] << endl;
	cout << cnt << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:17: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   21 |                 tmp = A[i];
      |                 ^~~
      |                 tm
Language: C++

import java.util.Scanner;

public class Main {
	private static Scanner sc;
	public static void main(String[] args){
		sc=new Scanner(System.in);
		int n=sc.nextInt();
		int[] a=new int[n];
		for(int i=0;i<n;i++){
			a[i]=sc.nextInt();
		}
		int ans=selectionSort(a,n);
		write(a,n);
		System.out.println(ans);
	}
	static void write(int[] a,int n){
		for(int i=0;i<n-1;i++){
			System.out.print(a[i]+" ");
		}
		System.out.println(a[n-1]);
	}
	static int selectionSort(int[] a, int n){
		int minj;
		int count=0;
		for(int i=0;i<n;i++){
			minj=i;
			for(int j=i;j<n;j++){
				if(a[j]<a[minj]){
					minj=j;
				}
			}
			if(minj!=i) count++;
			int temp=a[i];
			a[i]=a[minj];
			a[minj]=temp;
		}
		return count;
	}

}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.Scanner;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: expected unqualified-id before 'public'
    3 | public class Main {
      | ^~~~~~
Language: C++

#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<bitset>
#include<vector>
#include<deque>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<iomanip>
#include <functional>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
//cout << fixed << std::setprecision(9)
//memset(a, 0, sizeof(a));
//--------------------------


int n;
int a[110];

void print(void)
{
	for (int i = 0; i<n; i++) {
		if (i>0) cout << " ";
		cout << a[i];
	}
	cout << endl;
}

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

	int ans = 0;
        for(int i=0;i<n;i++) {
         int minj = i;
         for(int j=i;j<n;;j++) {
           if(a[minj] > a[j]) {
              minj = j;
           }
         }
         if(a[minj] < a[i]) {
          int v = a[i];a[i] = a[minj];a[minj]=a[i];
          ans++;
         }
        }
        print();
        cout << ans << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:44:26: error: expected primary-expression before ';' token
   44 |          for(int j=i;j<n;;j++) {
      |                          ^
a.cc:44:26: error: expected ')' before ';' token
   44 |          for(int j=i;j<n;;j++) {
      |             ~            ^
      |                          )
a.cc:44:27: error: 'j' was not declared in this scope
   44 |          for(int j=i;j<n;;j++) {
      |                           ^