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

#include<iostream>
using namespace std;

struct Card {char suit, value; };

void bubble(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 selection(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(stable 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];

  bubble(C1, N);
  selection(C2, N);

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

  return 0;
}

Compiler output:
a.cc: In function 'void print(Card*, int)':
a.cc:35:38: error: expected primary-expression before ';' token
   35 |     cout << A[i].suit << A[i].value<<;
      |                                      ^
a.cc: At global scope:
a.cc:40:15: error: 'stable' was not declared in this scope; did you mean 'isStable'?
   40 | bool isStable(stable Card C1[], struct Card C2[], int N){
      |               ^~~~~~
      |               isStable
a.cc:40:33: error: expected primary-expression before 'struct'
   40 | bool isStable(stable Card C1[], struct Card C2[], int N){
      |                                 ^~~~~~
a.cc:40:51: error: expected primary-expression before 'int'
   40 | bool isStable(stable Card C1[], struct Card C2[], int N){
      |                                                   ^~~
a.cc:40:56: error: expression list treated as compound expression in initializer [-fpermissive]
   40 | bool isStable(stable Card C1[], struct Card C2[], int N){
      |                                                        ^
a.cc: In function 'int main()':
a.cc:67:14: error: 'isStable' cannot be used as a function
   67 |   if(isStable(C1, C2, N)){
      |      ~~~~~~~~^~~~~~~~~~~
Language: C++

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

int main(){
	char A_symbol[36+1];//列の文字のみを格納する配列
	char A_symboltmp[36+1];
	int A_num[36+1];//列の数字のみ格納する配列
	int A_numtmp[36+1];
	int num;//数列の長さ(カードの枚数)
	char tmpstr[3];

	/*配列を0で初期化modify
	for(int i=0;i<1001;i++){
		A[i] = 0;
	}
	*/

	cin >>num;
	
	for(int i=0;i<num;i++){
		scanf("%s",tmpstr);
		A_symbol[i]=tmpstr[0];
		A_symboltmp[i] = A_symbol[i];
		A_num[i] = atoi(&tmpstr[1]);
		A_numtmp[i] = A_num[i];
		//cout <<A_symbol[i] <<A_num[i] <<endl;
	}

	void bubbleSort(char A_symbol[],int A_num[],int N);
	void selectionSort(char A_symbol[],int A_num[],int N);
	
	bubbleSort(A_symboltmp,A_numtmp,num);//ほんとはポインタで定義してやるべき
	cout <<"Stable" <<endl;
	selectionSort(A_symbol,A_num,num);
	
	//バブルソートが常に安定なソートであることを利用して選択ソートが安定であるかどうかを判断
	for(int i=0;i<sizeof(A_num)/sizeof(A_num[0]);i++){
		if(A_numtmp[i] != A_num[i] || A_symbol[i] != A_symboltmp[i]){
			cout <<"Not stable";
			return 0;
		}
	}
	cout <<"Stable" ;

	
	return 0;
}

void selectionSort(char A_symbol[], int A_num[],int N){
	int minj;//minjはA[i]?A[N-1]の最小値の添え字
	char tmpstr;
	int tmp;
	int cnt=0;//交換回数
	for(int i=0;i<N;i++){
		minj = i;
		for(int j=i;j<N;j++){
			if(A_num[j] < A_num[minj]){
				minj = j;
			}
		}
		
		if(minj != i){//iより後ろにiより小さいものがない場合
			cnt++;
			tmpstr = A_symbol[minj];
			A_symbol[minj] = A_symbol[i];
			A_symbol[i] = tmpstr;
			tmp = A_num[minj];
			A_num[minj] = A_num[i];
			A_num[i] = tmp;
		}


		//minj = iの場合，実際は交換になっていないのでこの場合はcnt++しない！
		
	}
	//ソート完了後の状態を出力
		for(int k=0;k<N-1;k++){
			cout <<A_symbol[k] <<A_num[k] <<" ";
		}
		cout <<A_symbol[N-1] <<A_num[N-1] ;
		cout <<endl
		//cout <<cnt <<endl;

}

void bubbleSort(char A_symbol[],int A_num[],int N){
	bool flag = true;
	int tmp;
	int tmpstr;
	int cnt = 0;//交換回数のカウンタ

	/*まずソートを行う前の状態を出力
	for(int k=0;k<N-1;k++){
			cout <<A[k] <<" ";
		}
		cout <<A[N-1];
		cout <<endl;
		*/

	while(flag){
		flag = false;

		//交換が一回も行われなかった場合flag = trueでforループを抜ける
		for(int j=N-1;j>0;j--){
			if(A_num[j] < A_num[j-1]){
				tmp = A_num[j];
				A_num[j] = A_num[j-1];
				A_num[j-1] = tmp;
				tmpstr = A_symbol[j];
				A_symbol[j] = A_symbol[j-1];
				A_symbol[j-1] = tmpstr;
				cnt++;
				flag = true;
			}
		}
		/*この交換後の状態を出力
		for(int k=0;k<N-1;k++){
			cout <<A[k] <<" ";
		}
		cout <<A[N-1];
		cout <<endl;
		*/
	}
	/*ソート終了後の状態を出力*/
	for(int k=0;k<N-1;k++){
			cout <<A_symbol[k] << A_num[k] <<" ";
	}
	cout <<A_symbol[N-1] <<A_num[N-1] ;
	cout <<endl;
}

Compiler output:
a.cc: In function 'void selectionSort(char*, int*, int)':
a.cc:83:28: error: expected ';' before '}' token
   83 |                 cout <<endl
      |                            ^
      |                            ;
......
   86 | }
      | ~
Language: C++

#include <iostream>
using namespace std;

struct Card{int num; char suit;};

void bubbleSort(Card c[], int N);
void selectionSort(Card c[], int N);
void showArray(Card c[], int N);
bool Stable(Card x[], Card y[], int N);

int main()
{
	int N;
	Card c1[36], c2[36];
	cin >> N;
	for(int i = 0; i < N; i++)
	{
		cin >> c1[i].suit >> c1[i].num;
		c2[i] = c1[i];
	}
	bubbleSort(c1, N);
	cout << "Stable" << endl;
	selectionSort(c2, N);
	if(Stable(c1, c2, N))
		cout << "Stable" << endl;
	else
		cout << "Not stable" << endl;
	return 0;
}

void bubbleSort(Card c[], int N)
{
	for(int i = 0; i < N; i++)
		for(int j = N-1; j>=i; j--)
			if(c[j].num < c[j-1].num)
			{
			Card temp = c[j];
			c[j] = c[j-1];
			c[j-1] = temp;
			 }
	showArray(c, N);
}

void selectionSort(Card c[], int N)
{
	int min;
	for(int i = 0; i<N; i++)
	{
		min = i;
		for(int j = i; j < N; j++)
			if(c[j].num<c[min].num)
				min = j;
		Card temp = c[j];
                c[j] = c[min];
                c[min] = temp;
	}
	showArray(c, N);
}

void showArray(Card c[], int N)
{
	cout<<c[0].suit << c[0].num;
	for(int i = 1; i < N; i++)
		cout<<' '<< c[i].suit << c[i].num;
	cout<<endl;
}

bool Stable(Card x[], Card y[], int N)
{
	for(int i = 0; i < N; i++)
		if(x[i].suit != y[i].suit)
			return false;
	return true;
}

Compiler output:
a.cc: In function 'void selectionSort(Card*, int)':
a.cc:53:31: error: 'j' was not declared in this scope
   53 |                 Card temp = c[j];
      |                               ^
Language: C++

#include <iostream>
using namespace std;
  
struct Card{int num; char suit;};
  
void bubbleSort(struct Card c[], int N);
void selectionSort(struct Card c[], int N);
void showArray(struct Card c[], int N);
bool Stable(struct Card x[], struct Card y[], int N);
  
int main()
{
    int N;
    Card c1[36], c2[36];
    cin >> N;
    for(int i = 0; i < N; i++)
    {
        cin >> c1[i].suit >> c1[i].num;
        c2[i] = c1[i];
    }
    bubbleSort(c1, N);
    cout << "Stable" << endl;
    selectionSort(c2, N);
    if(Stable(c1, c2, N))
        cout << "Stable" << endl;
    else
        cout << "Not stable" << endl;
    return 0;
}
  
void bubbleSort(struct Card c[], int N)
{
    for(int i = 0; i < N; i++)
        for(int j = N-1; j>=i; j--)
            if(c[j].num < c[j-1].num)
            {
                Card temp = c[j];
                c[j] = c[j-1];
                c[j-1] = temp;
             }
    showArray(c, N);
}
  
void selectionSort(struct Card c[], int N)
{
    int min;
    for(int i = 0; i<N; i++)
    {
        min = i;
        for(int j = i; j < N; j++)
            if(c[j].num<c[min].num)
                min = j;
        Card temp = c[i];
        c[i] = c[min];
        c[min] = temp;
    }
    showArray(c, N);
}
  
void showArray(structCard c[], int N)
{
    cout<<c[0].suit << c[0].num;
    for(int i = 1; i < N; i++)
        cout<<' '<< c[i].suit << c[i].num;
    cout<<endl;
}
  
bool Stable(struct Card x[], struct Card y[], int N)
{
    for(int i = 0; i < N; i++)
        if(x[i].suit != y[i].suit)
            return false;
    return true;
}

Compiler output:
a.cc:60:6: error: variable or field 'showArray' declared void
   60 | void showArray(structCard c[], int N)
      |      ^~~~~~~~~
a.cc:60:16: error: 'structCard' was not declared in this scope; did you mean 'struct'?
   60 | void showArray(structCard c[], int N)
      |                ^~~~~~~~~~
      |                struct
a.cc:60:32: error: expected primary-expression before 'int'
   60 | void showArray(structCard c[], int N)
      |                                ^~~
Language: C++

#include <iostream>
using namespace std;

struct Card { int num; char suit; };

void bubbleSort(struct Card c[], int N)
{
	for(int i = 0; i < N; i++)
		for(int j = N-1; j>=i; j--)
			if(c[j].num < c[j-1].num)
			{
				Card temp = c[j];
				c[j] = c[j-1];
				c[j-1] = temp;
			}
	showArray(c, N);
}

void selectionSort(struct Card c[], int N)
{
	int min;
	for(int i = 0; i<N; i++)
	{
		min = i;
		for(int j = i; j < N; j++)
			if(c[j].num<c[min].num)
				min = j;
		Card temp = c[i];
		c[i] = c[min];
		c[min] = temp;
	}
	showArray(c, N);
}

void showArray(struct Card c[], int N)
{
	cout<<c[0].suit<<c[0].num;
	for(int i = 1; i < N; i++)
		cout<<' '<<c[i].suit<<c[i].num;
	cout<<endl;
}

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

int main()
{
	int N;
	Card c1[100], c2[100];
	cin>>N;
	for(int i = 0; i < N; i++)
	{
		cin>>c1[i].suit>>c1[i].num;
		c2[i] = c1[i];
	}
	bubbleSort(c1, N);
	cout<<"Stable"<<endl;
	selectionSort(c2, N);
	if(Stable(c1, c2, N))
		cout<<"Stable"<<endl;
	else
		cout<<"Not stable"<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'void bubbleSort(Card*, int)':
a.cc:16:9: error: 'showArray' was not declared in this scope
   16 |         showArray(c, N);
      |         ^~~~~~~~~
a.cc: In function 'void selectionSort(Card*, int)':
a.cc:32:9: error: 'showArray' was not declared in this scope
   32 |         showArray(c, N);
      |         ^~~~~~~~~
Language: C++

# ALDS1_2_C Stable Sort
n = gets.chomp.to_i
a = gets.chomp.split(" ")
def bubbleSort(c, n)
  a = c.dup
  (0..n-1).each do |i|
    (n-1).downto(i) do |j|
      if a[j][1].to_i < a[j-1][1].to_i
        a[j], a[j-1] = a[j-1], a[j]
      end
    end
  end
  return a
end

def selectionSort(c, n)
  a = c.dup
  (0..n-1).each do |i|
    minj = i
    (i..n-1).each do |j|
      if a[j][1].to_i < a[minj][1].to_i then
        minj = j
      end
    end
    a[i], a[minj] = a[minj], a[i]
  end
  return a
end
bubble = bubbleSort(a, n)
selection = selectionSort(a, n)
puts bubble.join(" ")
puts "Stable"
puts selection.join(" ")
if bubble == selection then
  puts "Stable"
else
  puts "Not Stable"
end

Compiler output:
a.cc:1:3: error: invalid preprocessing directive #ALDS1_2_C
    1 | # ALDS1_2_C Stable Sort
      |   ^~~~~~~~~
a.cc:6:4: error: too many decimal points in number
    6 |   (0..n-1).each do |i|
      |    ^~~~
a.cc:18:4: error: too many decimal points in number
   18 |   (0..n-1).each do |i|
      |    ^~~~
a.cc:2:1: error: 'n' does not name a type
    2 | n = gets.chomp.to_i
      | ^
Language: C++

#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b) - 1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)

#define PB push_back
#define INF INT_MAX/3
#define ALL(a) (a).begin(),(a).end()
#define CLR(a) memset(a,0,sizeof(a))

typedef long long int ll;

using namespace std;
int N;

void BabbleSort(string s[]){
    REP(i,N){
	RFOR(j,i+1,N){
	    if((int)(s[j-1][1] - '0') > (int)(s[j][1] - '0')) swap(s[j-1],s[j]);
	}
    }	
}
void SelectionSort(string s[]){
    REP(i,N){
	int mini = i;
	FOR(j,i,N){
	    if((int)(s[mini][1] - '0') > (int)(s[j][1] - '0')) {
		mini = j;
	    }
	}
	swap(s[i],s[mini]);
    }
}

int main(){

    bool stableflag;
    cin >> N;
    string s[50],s1[50],s2[50];
    REP(i,N){
       	cin >> s[i];
	s1[i] = s[i];
	s2[i] = s[i];
    }
    BabbleSort(s1);
    SelectionSort(s2);
    stableflag = true;
    REP(i,N-1) cout << s1[i] << " ";
    cout << s1[N-1];
    cout << endl;
    cout << "Stable"<<endl;
    REP(i,N) if(s2[i][0] != s1[i][0]) stableflag = false;
    REP(i,N-1) cout << s2[i] << " ";
    cout << s2[N-1];
    cout << endl;
    if(stableflag) cout << "Stable"<<endl;
    else cou

Compiler output:
a.cc: In function 'int main()':
a.cc:58:10: error: 'cou' was not declared in this scope; did you mean 'cos'?
   58 |     else cou
      |          ^~~
      |          cos
a.cc:58:13: error: expected '}' at end of input
   58 |     else cou
      |             ^
a.cc:36:11: note: to match this '{'
   36 | int main(){
      |           ^
Language: C++

#include <iostream>
#include <algorithm>

using namespace std;

struct card {
	int num;
	char ch;
};

void show(card cd[], int n) {
	for (int i = 0; i < n - 1; i++)
		cout << cd[i].ch<<cd[i].num << " ";
	cout << cd[n - 1].ch<< cd[n - 1].num << endl;
}

void isStable(card cd_1[], card cd_2[], int n) {
	int j = 0;
	for (int i = 0; i < n - 1; i++) {
		while (cd_1[i].num != cd_2[j].num) j++;
		if (cd_1[i].ch != cd_2[j].ch) {
			cout << "Not stable" << endl;
			return;
		}
		j++;
		if (cd_1[i].num != cd_1[i + 1].num) j = 0;
	}
	cout << "Stable" << endl;

}

void bubbleSort(card cd[], int n) {
	bool f = true;
	while (f) {
		f = false;
		for (int i = n - 1; i >= 1; i--)
			if (cd[i].num < cd[i - 1].num) {
				swap(cd[i],cd[i-1]);
				f = true;
			}
	}
}

void selsctionSort(card cd[], int n) {
	int minj;
	for (int i = 0; i < n - 1; i++) {
		minj = i;
		for (int j = i + 1; j < n; j++) {
			if (cd[j].num < cd[minj].num)
				minj = j;
		}
		if (i != minj) {
			swap(cd[i], cd[minj]);
		}
	}
}

int main() {
	card cd[100];
	card cd_m[100];
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> cd[i].ch >> cd[i].num;
		cd_m[i] = cd[i];
	}

	bubbleSort(cd, n);
	show(cd, n);
	isStable(cd, cd_m, n);

	for (int i = 0; i < n; i++)
		cd[i] = cd_m[i];

	selsctionSort(cd, n);
	show(cd, n);
	isStable(cd, cd_m, n);
	return 0;

Compiler output:
a.cc: In function 'int main()':
a.cc:78:18: error: expected '}' at end of input
   78 |         return 0;
      |                  ^
a.cc:58:12: note: to match this '{'
   58 | int main() {
      |            ^
Language: C++

#include <iostream>
#include<algorithm>
using namespace std;
void BubbleSort(string C[], int N)
{
  for(int i = 0; i < N; i++)
    for(int j = N - 1; j > i; j--)
      if(C[j][1] < C[j - 1][1])
    swap(C[j], C[j - 1]);
}

void SelectionSort(string C[], int N)
{
  for(int i = 0, minj; i < N; i++){
    minj = i;
    for(int j = i; j < N; j++)
      if(C[j][1] < C[minj][1])
    minj = j;
    swap(C[i], C[minj]);
  }
}

int main()
{
  int N;
  cin >> N;
  string a[N];
  string b[N];
  for(int i = 0; i < N; i++)cin >> a[i];
  copy(a, a + N, b);

  BubbleSort(a, N);
  for(int i = 0; i < N; i++)
    if(i)
      cout << " " << a[i];
    else
      cout << a[i];
  cout << endl << "Stable" << endl;

  SelectionSort(b, N);
  for(int i = 0; i < N; i++)
    if(i)
      cout << " " << b[i];
    else
      cout << b[i];
  for(int i=0;i<N;i++){
    if(a[i]=b[i])
    else goto not;
  }
    cout <<endl<< "Stable" << endl;
    not:
    cout <<endl<< "Not stable" << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:47:12: error: could not convert 'a[i].std::__cxx11::basic_string<char>::operator=(b[i])' from 'std::__cxx11::basic_string<char>' to 'bool'
   47 |     if(a[i]=b[i])
      |        ~~~~^~~~~
      |            |
      |            std::__cxx11::basic_string<char>
a.cc:48:5: error: expected primary-expression before 'else'
   48 |     else goto not;
      |     ^~~~
a.cc:51:8: error: expected primary-expression before ':' token
   51 |     not:
      |        ^
Language: C++

#include "iostream"

using namespace std;

void sentaku(int a[100], char k[100][2], int num ) {

	for (int i = 0; i < num; i++) {
		int minj = i;
		int s = 0;
		for (int j = i; j < num; j++) {
			if (a[j] < a[minj]) {
				minj = j;
				s = 1;
			}
		}
		if (s == 1) {
			int b = a[i];
			a[i] = a[minj];
			a[minj] = b;

			char l = k[i][0];
			k[i][0] = k[minj][0];
			k[minj][0] = l;
			
			l = k[i][1];
			k[i][1] = k[minj][1];
			k[minj][1] = l;
		}
	}


	for (int i = 0; i < num; i++) {
		cout << k[i][0] << k[i][1];
		if (i < num - 1) cout << " ";

	}
	cout << endl;

}

void baburu(int a[100], char k[100][2], int num) {

	int frag = 1;
	while (frag == 1) {
		frag = 0;
		for (int j = num - 1; j > 0; j--) {
			if (a[j] < a[j - 1]) {
				int b = a[j];
				a[j] = a[j - 1];
				a[j - 1] = b;

				char l = k[j][0];
				k[j][0] = k[j-1][0];
				k[j-1][0] = l;

				l = k[j][1];
				k[j][1] = k[j-1][1];
				k[j-1][1] = l;

				snum++;

				frag = 1;
			}
		}
	}

	for (int i = 0; i < num; i++) {
		cout << k[i][0] << k[i][1];
		if (i < num - 1) cout << " ";

	}
	cout << endl;

}

int main() {

	int num;
	char ka[100][2], kb[100][2];
	int a[100], b[100];

	cin >> num;

	for (int i = 0; i < num; i++) {
		cin >> ka[i];
		a[i] = ka[i][1] - '0';

		kb[i][0] = ka[i][0];
		kb[i][1] = ka[i][1];
		b[i] = a[i];
	}

	baburu(b, kb, num);
	cout << "Stable" << endl;
	sentaku(a, ka, num);
	
	int s = 0;

	for (int i = 0; i < num; i++) {
		if (ka[i][0] != kb[i][0]) {
			s = 1;
			cout << "Not stable" << endl;
			break;
		}
	}
	if (s == 0) cout << "Stable" << endl;

	return 0;
}

Compiler output:
a.cc: In function 'void baburu(int*, char (*)[2], int)':
a.cc:60:33: error: 'snum' was not declared in this scope; did you mean 'num'?
   60 |                                 snum++;
      |                                 ^~~~
      |                                 num
Language: C++

// -*- mode:c++; coding:utf-8; c-basic-offset:2; -*-
// ALDS1_2-C: Stable Sort

#include <cstring>
#include <algorithm>
#include <iostream>

struct Card {
  char suit;
  unsigned int rank;
  bool operator<(const Card& rhs) { return rank < rhs.rank; }
};

std::ostream& operator<<(std::ostream& os, const Card& card)
{
  return os << card.suit << card.rank;
}

std::istream& operator>>(std::istream& is, Card& card)
{
  return is >> card.suit >> card.rank;
}

static void print_cards(const Card cards[], const unsigned int n)
{
  const char* sep = "";
  for (unsigned int i = 0u; i < n; ++i) {
    std::cout << sep << cards[i];
    sep = " ";
  }
  std::cout << std::endl;
}

static void bubble_sort(Card cards[], const unsigned int n)
{
  for (unsigned int j = 0u; j < n-1; ++j) {
    for (unsigned int i = n-1; i > j; --i) {
      if (cards[i] < cards[i-1]) {
        std::swap(cards[i], cards[i-1]);
      }
    }
  }
}

static void selection_sort(Card cards[], const unsigned int n)
{
  for (unsigned int i = 0u; i < n-1; ++i) {
    unsigned int min_j = i;
    for (unsigned int j = i+1; j < n; ++j) {
      if (cards[j] < cards[min_j]) {
        min_j = j;
      }
    }
    if (i != min_j) {
      std::swap(cards[i], cards[min_j]);
    }
  }
}

int main()
{
  unsigned int n;
  std::cin >> n;
  Card cards1[n], cards2[n];
  for (unsigned int i = 0u; i < n; ++i) {
    std::cin >> cards1[i];
  }
  //std::memcpy(cards2, cards1, sizeof(cards1));
  for (unsigned int i = 0u; i < n; ++i) {
    cards2[i] = cards1[i];
  }

  bubble_sort(cards1, n);
  print_cards(cards1, n);
  std::cout << "Stable" << std::endl; // bubble sort is stable

  selection_sort(cards2, n);
  print_cards(cards2, n);
  /*
  if (std::memcmp(cards1, cards2, sizeof(cards1)) == 0) {
    std::cout << "Stable" << std::endl;
  } else {
    std::cout << "Not stable" << std::endl;
  }
  */
  for (unsigned int i = 0u; i < n; ++i) {
    if (cards2[i] != cards1[i]) {
      std::cout << "Not stable" << std::endl;
      return;
    }
  }
  std::cout << "Stable" << std::endl;
}

// eof

Compiler output:
a.cc: In function 'int main()':
a.cc:87:19: error: no match for 'operator!=' (operand types are 'Card' and 'Card')
   87 |     if (cards2[i] != cards1[i]) {
      |         ~~~~~~~~~ ^~ ~~~~~~~~~
      |                 |            |
      |                 Card         Card
a.cc:89:7: error: return-statement with no value, in function returning 'int' [-fpermissive]
   89 |       return;
      |       ^~~~~~
Language: C++

#include<iostream>
using namespace std;

struct Card { char suit, value;};

void bubble(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 selection(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];

  bubble(C1,N);
  selection(C2, N);

  print(C1, N);
  cout << "Stable" << endl;
  print(C2, N);
  if (isStable(C1,C2,N)){
    cout << "Stable" << endl;
  } else {
    cout << "Not stable" << endl;
  }

  return0;
}

Compiler output:
a.cc:34:48: error: expected ')' before ';' token
   34 | bool isStable(struct Card C1[],struct Card C2[];, int N){
      |              ~                                 ^
      |                                                )
a.cc:34:49: error: expected unqualified-id before ',' token
   34 | bool isStable(struct Card C1[],struct Card C2[];, int N){
      |                                                 ^
a.cc:34:51: error: expected unqualified-id before 'int'
   34 | bool isStable(struct Card C1[],struct Card C2[];, int N){
      |                                                   ^~~
a.cc: In function 'int main()':
a.cc:59:15: error: too many arguments to function 'bool isStable(Card*, Card*)'
   59 |   if (isStable(C1,C2,N)){
      |       ~~~~~~~~^~~~~~~~~
a.cc:34:6: note: declared here
   34 | bool isStable(struct Card C1[],struct Card C2[];, int N){
      |      ^~~~~~~~
a.cc:65:3: error: 'return0' was not declared in this scope
   65 |   return0;
      |   ^~~~~~~
Language: C++

import java.util.Arrays;
import java.util.Scanner;
 
public class Main {
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        String[] a=new String[n];
        String[] b=new String[n];
        for(int i=0;i<n;i++){
            a[i]=sc.next();
            b[i]=a[i];
        }
         
        a=bubbleSort(a,n);
        write(a,n);
        System.out.println("Stable");
         
        b=selectionSort(b,n);
        write(b,n);
        if(Arrays.equals(a,b)){
            System.out.println("Stable");
        }else{
            System.out.println("Not stable");
        }
    }
    static void write(String[] a,int n){
        for(int i=0;i<n-1;i++){
            System.out.print(a[i]+" ");
        }
        System.out.println(a[n-1]);
    }
    static String[] bubbleSort(String[] a, int n){
        boolean flag=true;
        int i=0;
        while(flag){
            flag=false;
            for(int j=n-1;j>i;j--){
                if(a[j].charAt(1)<a[j-1].charAt(1)){
                    String temp=a[j];
                    a[j]=a[j-1];
                    a[j-1]=temp;
                    flag=true;
                }
            }
            i++;
        }
        return a;
    }
    static String[] selectionSort(String[] a, int n){
        int minj;
        for(int i=0;i<n;i++){
            minj=i;
            for(int j=i;j<n;j++){
                if(a[j].charAt(1)<a[minj].charAt(1)){
                    minj=j;
                }
            }
            String temp=a[i];
            a[i]=a[minj];
            a[minj]=temp;
        }
        return a;
    }
 
}

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

#include<stdio.h>
#include<iostream>
using namespace std;
struct Card{char suit,value;};

void bubble(struct Card A[], int n){
  int i,j;
  bool flag=1;
  for ( i = 0; flag; i++ ){
      flag=0;
      for ( j = n-1; i < j; j-- ){
        if(A[j].value < A[j-1].value){
        swap(A[j],A[j-1]);
        flag=1;
        }
      }
  }
}

void selectinsert(struct Card A[], int n){
  int i,j,minv;
    for ( i = 0;i<n-1;i++){
      minv=i;
      for (j=i;n>j;j++){
        if(A[minv].value>A[j].value){
        minv=j;
        }
      }
      swap(A[i],A[minv]);
  }
}
void print(struct Card A[],int N){
  for ( i = 0; i < n; i++ ){
    if ( i > 0 ) cout << " ";
    cout << A[i].suit << A[i].value;
  }
  cout << endl;
}
bool isStable(struct Card A1[],Struct Card A2[],int n){
  for ( i = 0; i < n; i++ ){
  if (A1[i].suit != A2[i].suit){
  return falese;
  }
 return true;
 }
}


int main(){
  int n, i, j,sw;
  Card C1[100],C2[100];
  scanf("%d", &n);
  for ( i = 0; i < n; i++ ) cin >> C1[i].suit >> C1[i].value ;
  for(i=0;i<n;i++)C2[i]=C1[i];
  bubble(C1,n);
  selectinsert(C2,n);
  print(C1,n);
  cout << "Stable" << endl;
  print(C2,n);
  if (isStable(C1,C2,N){
  cout << "Stable" << endl;
  }else{
  cout << "Not stable" << endl;
  }

    return 0;
}

Compiler output:
a.cc: In function 'void print(Card*, int)':
a.cc:33:9: error: 'i' was not declared in this scope
   33 |   for ( i = 0; i < n; i++ ){
      |         ^
a.cc:33:20: error: 'n' was not declared in this scope
   33 |   for ( i = 0; i < n; i++ ){
      |                    ^
a.cc: At global scope:
a.cc:39:32: error: 'Struct' has not been declared
   39 | bool isStable(struct Card A1[],Struct Card A2[],int n){
      |                                ^~~~~~
a.cc:39:44: error: expected ',' or '...' before 'A2'
   39 | bool isStable(struct Card A1[],Struct Card A2[],int n){
      |                                            ^~
a.cc: In function 'bool isStable(Card*, int)':
a.cc:40:9: error: 'i' was not declared in this scope
   40 |   for ( i = 0; i < n; i++ ){
      |         ^
a.cc:40:20: error: 'n' was not declared in this scope
   40 |   for ( i = 0; i < n; i++ ){
      |                    ^
a.cc:41:21: error: 'A2' was not declared in this scope; did you mean 'A1'?
   41 |   if (A1[i].suit != A2[i].suit){
      |                     ^~
      |                     A1
a.cc:42:10: error: 'falese' was not declared in this scope; did you mean 'fclose'?
   42 |   return falese;
      |          ^~~~~~
      |          fclose
a.cc: In function 'int main()':
a.cc:60:22: error: 'N' was not declared in this scope
   60 |   if (isStable(C1,C2,N){
      |                      ^
a.cc:62:4: error: expected primary-expression before 'else'
   62 |   }else{
      |    ^~~~
a.cc:62:4: error: expected ')' before 'else'
   62 |   }else{
      |    ^~~~
      |    )
a.cc:60:6: note: to match this '('
   60 |   if (isStable(C1,C2,N){
      |      ^
Language: C++

#include<stdio.h>
#include<iostream>
using namespace std;
struct Card{char suit,value;};

void bubble(struct Card A[], int n){
  int i,j;
  bool flag=1;
  for ( i = 0; flag; i++ ){
      flag=0;
      for ( j = n-1; i < j; j-- ){
        if(A[j].value < A[j-1].value){
        swap(A[j],A[j-1]);
        flag=1;
        }
      }
  }
}

void selectinsert(struct Card A[], int n){
  int i,j,minv;
    for ( i = 0;i<n-1;i++){
      minv=i;
      for (j=i;n>j;j++){
        if(A[minv].value>A[j].value){
        minv=j;
        }
      }
      swap(A[i],A[minv]);
  }
}
void print(struct Card A[],int N){
int i;
  for ( i = 0; i < n; i++ ){
    if ( i > 0 ) cout << " ";
    cout << A[i].suit << A[i].value;
  }
  cout << endl;
}
bool isStable(struct Card A1[],Struct Card A2[],int n){
  for ( i = 0; i < n; i++ ){
  if (A1[i].suit != A2[i].suit){
  return falese;
  }
 return true;
 }
}


int main(){
  int n, i, j,sw;
  Card C1[100],C2[100];
  scanf("%d", &n);
  for ( i = 0; i < n; i++ ) cin >> C1[i].suit >> C1[i].value ;
  for(i=0;i<n;i++)C2[i]=C1[i];
  bubble(C1,n);
  selectinsert(C2,n);
  print(C1,n);
  cout << "Stable" << endl;
  print(C2,n);
  if (isStable(C1,C2,N){
  cout << "Stable" << endl;
  }else{
  cout << "Not stable" << endl;
  }

    return 0;
}

Compiler output:
a.cc: In function 'void print(Card*, int)':
a.cc:34:20: error: 'n' was not declared in this scope
   34 |   for ( i = 0; i < n; i++ ){
      |                    ^
a.cc: At global scope:
a.cc:40:32: error: 'Struct' has not been declared
   40 | bool isStable(struct Card A1[],Struct Card A2[],int n){
      |                                ^~~~~~
a.cc:40:44: error: expected ',' or '...' before 'A2'
   40 | bool isStable(struct Card A1[],Struct Card A2[],int n){
      |                                            ^~
a.cc: In function 'bool isStable(Card*, int)':
a.cc:41:9: error: 'i' was not declared in this scope
   41 |   for ( i = 0; i < n; i++ ){
      |         ^
a.cc:41:20: error: 'n' was not declared in this scope
   41 |   for ( i = 0; i < n; i++ ){
      |                    ^
a.cc:42:21: error: 'A2' was not declared in this scope; did you mean 'A1'?
   42 |   if (A1[i].suit != A2[i].suit){
      |                     ^~
      |                     A1
a.cc:43:10: error: 'falese' was not declared in this scope; did you mean 'fclose'?
   43 |   return falese;
      |          ^~~~~~
      |          fclose
a.cc: In function 'int main()':
a.cc:61:22: error: 'N' was not declared in this scope
   61 |   if (isStable(C1,C2,N){
      |                      ^
a.cc:63:4: error: expected primary-expression before 'else'
   63 |   }else{
      |    ^~~~
a.cc:63:4: error: expected ')' before 'else'
   63 |   }else{
      |    ^~~~
      |    )
a.cc:61:6: note: to match this '('
   61 |   if (isStable(C1,C2,N){
      |      ^
Language: C++

#include<stdio.h>
#include<iostream>
using namespace std;
struct Card{char suit,value;};

void bubble(struct Card A[], int n){
  int i,j;
  bool flag=1;
  for ( i = 0; flag; i++ ){
      flag=0;
      for ( j = n-1; i < j; j-- ){
        if(A[j].value < A[j-1].value){
        swap(A[j],A[j-1]);
        flag=1;
        }
      }
  }
}

void selectinsert(struct Card A[], int n){
  int i,j,minv;
    for ( i = 0;i<n-1;i++){
      minv=i;
      for (j=i;n>j;j++){
        if(A[minv].value>A[j].value){
        minv=j;
        }
      }
      swap(A[i],A[minv]);
  }
}
void print(struct Card A[],int n){
int i;
  for ( i = 0; i < n; i++ ){
    if ( i > 0 ) cout << " ";
    cout << A[i].suit << A[i].value;
  }
  cout << endl;
}
bool isStable(struct Card A1[],Struct Card A2[],int n){
  for ( i = 0; i < n; i++ ){
  if (A1[i].suit != A2[i].suit){
  return falese;
  }
 return true;
 }
}


int main(){
  int n, i, j,sw;
  Card C1[100],C2[100];
  scanf("%d", &n);
  for ( i = 0; i < n; i++ ) cin >> C1[i].suit >> C1[i].value ;
  for(i=0;i<n;i++)C2[i]=C1[i];
  bubble(C1,n);
  selectinsert(C2,n);
  print(C1,n);
  cout << "Stable" << endl;
  print(C2,n);
  if (isStable(C1,C2,N){
  cout << "Stable" << endl;
  }else{
  cout << "Not stable" << endl;
  }

    return 0;
}

Compiler output:
a.cc:40:32: error: 'Struct' has not been declared
   40 | bool isStable(struct Card A1[],Struct Card A2[],int n){
      |                                ^~~~~~
a.cc:40:44: error: expected ',' or '...' before 'A2'
   40 | bool isStable(struct Card A1[],Struct Card A2[],int n){
      |                                            ^~
a.cc: In function 'bool isStable(Card*, int)':
a.cc:41:9: error: 'i' was not declared in this scope
   41 |   for ( i = 0; i < n; i++ ){
      |         ^
a.cc:41:20: error: 'n' was not declared in this scope
   41 |   for ( i = 0; i < n; i++ ){
      |                    ^
a.cc:42:21: error: 'A2' was not declared in this scope; did you mean 'A1'?
   42 |   if (A1[i].suit != A2[i].suit){
      |                     ^~
      |                     A1
a.cc:43:10: error: 'falese' was not declared in this scope; did you mean 'fclose'?
   43 |   return falese;
      |          ^~~~~~
      |          fclose
a.cc: In function 'int main()':
a.cc:61:22: error: 'N' was not declared in this scope
   61 |   if (isStable(C1,C2,N){
      |                      ^
a.cc:63:4: error: expected primary-expression before 'else'
   63 |   }else{
      |    ^~~~
a.cc:63:4: error: expected ')' before 'else'
   63 |   }else{
      |    ^~~~
      |    )
a.cc:61:6: note: to match this '('
   61 |   if (isStable(C1,C2,N){
      |      ^
Language: C++

#include<stdio.h>
#include<iostream>
using namespace std;
struct Card{char suit,value;};

void bubble(struct Card A[], int n){
  int i,j;
  bool flag=1;
  for ( i = 0; flag; i++ ){
      flag=0;
      for ( j = n-1; i < j; j-- ){
        if(A[j].value < A[j-1].value){
        swap(A[j],A[j-1]);
        flag=1;
        }
      }
  }
}

void selectinsert(struct Card A[], int n){
  int i,j,minv;
    for ( i = 0;i<n-1;i++){
      minv=i;
      for (j=i;n>j;j++){
        if(A[minv].value>A[j].value){
        minv=j;
        }
      }
      swap(A[i],A[minv]);
  }
}
void print(struct Card A[],int n){
int i;
  for ( i = 0; i < n; i++ ){
    if ( i > 0 ) cout << " ";
    cout << A[i].suit << A[i].value;
  }
  cout << endl;
}
bool isStable(struct Card A1[],struct Card A2[],int n){
int n
  for ( i = 0; i < n; i++ ){
  if (A1[i].suit != A2[i].suit){
  return false;
  }
 return true;
 }
}


int main(){
  int n, i, j,sw;
  Card C1[100],C2[100];
  scanf("%d", &n);
  for ( i = 0; i < n; i++ ) cin >> C1[i].suit >> C1[i].value ;
  for(i=0;i<n;i++)C2[i]=C1[i];
  bubble(C1,n);
  selectinsert(C2,n);
  print(C1,n);
  cout << "Stable" << endl;
  print(C2,n);
  if (isStable(C1,C2,n){
  cout << "Stable" << endl;
  }else{
  cout << "Not stable" << endl;
  }

    return 0;
}

Compiler output:
a.cc: In function 'bool isStable(Card*, Card*, int)':
a.cc:42:3: error: expected initializer before 'for'
   42 |   for ( i = 0; i < n; i++ ){
      |   ^~~
a.cc:42:16: error: 'i' was not declared in this scope
   42 |   for ( i = 0; i < n; i++ ){
      |                ^
a.cc:48:1: warning: no return statement in function returning non-void [-Wreturn-type]
   48 | }
      | ^
a.cc: In function 'int main()':
a.cc:62:24: error: expected ';' before '{' token
   62 |   if (isStable(C1,C2,n){
      |                        ^
      |                        ;
a.cc:64:4: error: expected primary-expression before 'else'
   64 |   }else{
      |    ^~~~
a.cc:64:4: error: expected ')' before 'else'
   64 |   }else{
      |    ^~~~
      |    )
a.cc:62:6: note: to match this '('
   62 |   if (isStable(C1,C2,n){
      |      ^
Language: C++

#include<stdio.h>
#include<iostream>
using namespace std;
struct Card{char suit,value;};

void bubble(struct Card A[], int n){
  int i,j;
  bool flag=1;
  for ( i = 0; flag; i++ ){
      flag=0;
      for ( j = n-1; i < j; j-- ){
        if(A[j].value < A[j-1].value){
        swap(A[j],A[j-1]);
        flag=1;
        }
      }
  }
}

void selectinsert(struct Card A[], int n){
  int i,j,minv;
    for ( i = 0;i<n-1;i++){
      minv=i;
      for (j=i;n>j;j++){
        if(A[minv].value>A[j].value){
        minv=j;
        }
      }
      swap(A[i],A[minv]);
  }
}
void print(struct Card A[],int n){
int i;
  for ( i = 0; i < n; i++ ){
    if ( i > 0 ) cout << " ";
    cout << A[i].suit << A[i].value;
  }
  cout << endl;
}
bool isStable(struct Card A1[],struct Card A2[],int n){
int i;
  for ( i = 0; i < n; i++ ){
  if (A1[i].suit != A2[i].suit){
  return false;
  }
 return true;
 }
}


int main(){
  int n, i, j,sw;
  Card C1[100],C2[100];
  scanf("%d", &n);
  for ( i = 0; i < n; i++ ) cin >> C1[i].suit >> C1[i].value ;
  for(i=0;i<n;i++)C2[i]=C1[i];
  bubble(C1,n);
  selectinsert(C2,n);
  print(C1,n);
  cout << "Stable" << endl;
  print(C2,n);
  if (isStable(C1,C2,n){
  cout << "Stable" << endl;
  }else{
  cout << "Not stable" << endl;
  }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:62:24: error: expected ';' before '{' token
   62 |   if (isStable(C1,C2,n){
      |                        ^
      |                        ;
a.cc:64:4: error: expected primary-expression before 'else'
   64 |   }else{
      |    ^~~~
a.cc:64:4: error: expected ')' before 'else'
   64 |   }else{
      |    ^~~~
      |    )
a.cc:62:6: note: to match this '('
   62 |   if (isStable(C1,C2,n){
      |      ^
a.cc: In function 'bool isStable(Card*, Card*, int)':
a.cc:48:1: warning: control reaches end of non-void function [-Wreturn-type]
   48 | }
      | ^
Language: C++

#include<stdio.h>
#include<iostream>
using namespace std;
struct Card{char suit,value;};

void bubble(struct Card A[], int n){
  int i,j;
  bool flag=1;
  for ( i = 0; flag; i++ ){
      flag=0;
      for ( j = n-1; i < j; j-- ){
        if(A[j].value < A[j-1].value){
        swap(A[j],A[j-1]);
        flag=1;
        }
      }
  }
}

void selectinsert(struct Card A[], int n){
  int i,j,minv;
    for ( i = 0;i<n-1;i++){
      minv=i;
      for (j=i;n>j;j++){
        if(A[minv].value>A[j].value){
        minv=j;
        }
      }
      swap(A[i],A[minv]);
  }
}
void print(struct Card A[],int n){
int i;
  for ( i = 0; i < n; i++ ){
    if ( i > 0 ) cout << " ";
    cout << A[i].suit << A[i].value;
  }
  cout << endl;
}
bool isStable(struct Card A1[],struct Card A2[],int n){
int i;
  for ( i = 0; i < n; i++ ){
  if (A1[i].suit != A2[i].suit){
  return false;
  }

 }
 return true;
}


int main(){
  int n, i, j,sw;
  Card C1[100],C2[100];
  scanf("%d", &n);
  for ( i = 0; i < n; i++ ) cin >> C1[i].suit >> C1[i].value ;
  for(i=0;i<n;i++)C2[i]=C1[i];
  bubble(C1,n);
  selectinsert(C2,n);
  print(C1,n);
  cout << "Stable" << endl;
  print(C2,n);
  if (isStable(C1,C2,n){
  cout << "Stable" << endl;
  }else{
  cout << "Not stable" << endl;
  }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:63:24: error: expected ';' before '{' token
   63 |   if (isStable(C1,C2,n){
      |                        ^
      |                        ;
a.cc:65:4: error: expected primary-expression before 'else'
   65 |   }else{
      |    ^~~~
a.cc:65:4: error: expected ')' before 'else'
   65 |   }else{
      |    ^~~~
      |    )
a.cc:63:6: note: to match this '('
   63 |   if (isStable(C1,C2,n){
      |      ^
Language: C++

#include <iostream>
#include <map>

struct card {
    int number;
    char suit;
    int order;
};

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

int main() {
    int n;
    std::cin >> n;
    int orders[9];
    for (int i=0; i<9; i++) {
        orders[i] = 0;
    }
    card a[n];
    for (int i=0; i<n; i++) {
        std::cin >> a[i].suit >> a[i].number;
        a[i].order = orders[a[i].number];
        orders[a[i].number]++;
    }
    card b[n];
    memcpy(b, a, n * sizeof(card));
    
    // Bubble sort
    for (int i=0; i<n; i++) {
        for (int j=n-1; j>i; j--) {
            if ( a[j-1].number > a[j].number ) {
                swap(j, j-1, a);
            }
        }
    }
    for (int i=0; i<n-1; i++) {
        std::cout << a[i].suit << a[i].number << " ";
    }
    std::cout << a[n-1].suit << a[n-1].number << std::endl;
    
    // Check stability
    int bubble_orders[9];
    for (int i=0; i<9; i++) {
        bubble_orders[i] = 0;
    }
    std::string str = "Stable";
    for (int i=0; i<n; i++) {
        if ( bubble_orders[a[i].number] > a[i].order ) {
            str = "Not stable";
        } else {
            bubble_orders[a[i].number] = a[i].order;
        }
    }
    std::cout << str << std::endl;
    
    // Selection sort
    for (int i=0; i<n; i++) {
        int mini = i;
        for (int j=i+1; j<n; j++) {
            if ( b[mini].number > b[j].number ) {
                mini = j;
            }
        }
        swap(mini, i, b);
    }
    for (int i=0; i<n-1; i++) {
        std::cout << b[i].suit << b[i].number << " ";
    }
    std::cout << b[n-1].suit << b[n-1].number << std::endl;
    
    // Check stability
    int selection_orders[9];
    for (int i=0; i<9; i++) {
        selection_orders[i] = 0;
    }
    std::string str2 = "Stable";
    for (int i=0; i<n; i++) {
        if ( selection_orders[b[i].number] > b[i].order ) {
            str2 = "Not stable";
        } else {
            selection_orders[b[i].number] = b[i].order;
        }
    }
    std::cout << str2 << std::endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:5: error: 'memcpy' was not declared in this scope
   30 |     memcpy(b, a, n * sizeof(card));
      |     ^~~~~~
a.cc:3:1: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <map>
  +++ |+#include <cstring>
    3 |
Language: C++

#include<iostream>
using namespace std;

struct Card { char suit, value;} ;

void bubble(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 selection(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++){
			bubble(C1,N);
			selection(C2,N);
			
			print(C1,N);
			cout << "Stable" << endl;
			print(C2,N);
			if(isStable(C1,C2,N)){
				cout << "Stable" << endl;
			}else{
				cout << "Not stable" <<  endl;
			}
			return 0;
		}
	}
	
	
	
	
	

Compiler output:
a.cc: In function 'void selection(Card*, int)':
a.cc:17:31: error: expected primary-expression before ';' token
   17 |         for (int i = 0; i < N,; i++){
      |                               ^
a.cc: In function 'void print(Card*, int)':
a.cc:27:25: error: expected ';' before '<' token
   27 |         for(int i = 0, i  <N; i++){
      |                         ^ ~
      |                         ;
a.cc:27:27: error: expected primary-expression before '<' token
   27 |         for(int i = 0, i  <N; i++){
      |                           ^
Language: C++

#include<iostream>
using namespace std;

void swapEx(char *a, char *b)
{
	char temp[3];
	strcpy(temp, b);
	strcpy(b, a);
	strcpy(a, temp);
}

void BubleSort(char C[][3], int N)
{
	int flag = 1;
	for (int i = 0; i < N, flag == 1; i++) {
		flag = 0;
		for (int j = N-1; j > i; j--) {
			if (C[j - 1][1] > C[j][1]) {
				swapEx(C[j - 1], C[j]);
				flag = 1;
			}
		}
	}
	for (int i = 0; i < N-1; i++) cout << C[i] << " ";
	cout << C[N - 1] << endl;
}

void SelectionSort(char C[][3], int N)
{
	int minj;
	for (int i = 0; i < N; i++) {
		minj = i;
		for (int j = i+1; j < N; j++) {
			if (C[minj][1] > C[j][1]) {
				minj = j;
			}
		}
		swapEx(C[minj], C[i]);
	}
	for (int i = 0; i < N - 1; i++) cout << C[i] << " ";
	cout << C[N - 1] << endl;
}

int main()
{
	int N;
	char C1[36][3];
	char C2[36][3];

	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> C1[i];
		strcpy(C1[i], C2[i]);
	}

	BubleSort(C1, N);
	cout << "Stable" << endl;

	SelectionSort(C2, N);
	for (int i = 0; i < N; i++) {
		if (C1[i] != C2[i]) {
			cout << "Not Stable" << endl;
		}
	}
	cout << "Stable" << endl;


}

Compiler output:
a.cc: In function 'void swapEx(char*, char*)':
a.cc:7:9: error: 'strcpy' was not declared in this scope
    7 |         strcpy(temp, b);
      |         ^~~~~~
a.cc:2:1: note: 'strcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include<iostream>
  +++ |+#include <cstring>
    2 | using namespace std;
a.cc: In function 'int main()':
a.cc:53:17: error: 'strcpy' was not declared in this scope
   53 |                 strcpy(C1[i], C2[i]);
      |                 ^~~~~~
a.cc:53:17: note: 'strcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
Language: C++

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

void swapEx(char *a, char *b)
{
	char temp[3];
	strcpy(temp, b);
	strcpy(b, a);
	strcpy(a, temp);
}

void BubleSort(char C[][3], int N)
{
	int flag = 1;
	for (int i = 0; i < N, flag == 1; i++) {
		flag = 0;
		for (int j = N-1; j > i; j--) {
			if (C[j - 1][1] > C[j][1]) {
				swapEx(C[j - 1], C[j]);
				flag = 1;
			}
		}
	}
	for (int i = 0; i < N-1; i++) cout << C[i] << " ";
	cout << C[N - 1] << endl;
}

void SelectionSort(char C[][3], int N)
{
	int minj;
	for (int i = 0; i < N; i++) {
		minj = i;
		for (int j = i+1; j < N; j++) {
			if (C[minj][1] > C[j][1]) {
				minj = j;
			}
		}
		swapEx(C[minj], C[i]);
	}
	for (int i = 0; i < N - 1; i++) cout << C[i] << " ";
	cout << C[N - 1] << endl;
}

int main()
{
	int N;
	char C1[36][3];
	char C2[36][3];

	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> C1[i];
		strcpy(C1[i], C2[i]);
	}

	BubleSort(C1, N);
	cout << "Stable" << endl;

	SelectionSort(C2, N);
	for (int i = 0; i < N; i++) {
		if (C1[i] != C2[i]) {
			cout << "Not Stable" << endl;
		}
	}
	cout << "Stable" << endl;


}

Compiler output:
a.cc: In function 'void swapEx(char*, char*)':
a.cc:8:9: error: 'strcpy' was not declared in this scope
    8 |         strcpy(temp, b);
      |         ^~~~~~
a.cc:2:1: note: 'strcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include<iostream>
  +++ |+#include <cstring>
    2 | #include<string>
a.cc: In function 'int main()':
a.cc:54:17: error: 'strcpy' was not declared in this scope
   54 |                 strcpy(C1[i], C2[i]);
      |                 ^~~~~~
a.cc:54:17: note: 'strcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
Language: C++

#include<iostream>
#pragma warning(disable:4996)
using namespace std;

struct Card{char suit, value;};

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

void selection(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 << "\n";
}

// ????????????????????¨?????????????????????????????????
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++) C2[i] = C1[i];
	bubble(C1,N);
	selection(C2,N);
	print(C1,N);
	cout << "Stable" << "\n";
	print(C2,N);

	if( isStable(C1, C2, N)) ){
		cout << "Stable" << "\n";
	}else{
		cout << "Not stable" << "\n";
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:60:34: error: expected primary-expression before ')' token
   60 |         if( isStable(C1, C2, N)) ){
      |                                  ^