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

/*
 * ITP1_6_B.cpp
 *
 *  Created on: Apr 20, 2018
 *      Author: 13743
 */

#include<iostream>
#include<cmath>

using namespace std;


struct card {
	char suit;
	int value;

	card(char suit, int value) :suit(suit), value(value) {}
};

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

void printCard(card *a, int n) {
	cout << a[0].suit << a[0].value;
	for(int i=1; i<n; i++) {
		cout << " " << a[i].suit << a[i].value;
	}
	cout << endl;
}

int main() {
	int n;
	card a[36];
	card b[36];
	cin >> n;
	for(int i=0; i<n; i++) {
		cin >> a[i].suit >> a[i].value;
		b[i].suit = a[i].suit;
		b[i].value = a[i].value;
	}

	for(int i=0; i<n; i++) {
		for(int j=n-1; j>i; j++) {
			if(a[j-1].value > a[j].value) {
				swap(a, j-1, j);
			}
		}
	}
	printCard(a, n);
	cout << "Stable" << endl;

	for(int i=0; i<n; i++) {
		int mini = i;
		for(int j=i+1; j<n; j++) {
			if(b[j].value < b[mini].value) {
				mini = j;
			}
			swap(b, i, mini);
		}
	}
	printCard(b, n);
	for(int i=0; i<n; i++) {
		if(a[i].suit != b[i].suit) {
			cout << "Not Stable" << endl;
			return 0;
		}
	}
	cout << "Stable" << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:37:18: error: no matching function for call to 'card::card()'
   37 |         card a[36];
      |                  ^
a.cc:18:9: note: candidate: 'card::card(char, int)'
   18 |         card(char suit, int value) :suit(suit), value(value) {}
      |         ^~~~
a.cc:18:9: note:   candidate expects 2 arguments, 0 provided
a.cc:14:8: note: candidate: 'constexpr card::card(const card&)'
   14 | struct card {
      |        ^~~~
a.cc:14:8: note:   candidate expects 1 argument, 0 provided
a.cc:14:8: note: candidate: 'constexpr card::card(card&&)'
a.cc:14:8: note:   candidate expects 1 argument, 0 provided
a.cc:38:18: error: no matching function for call to 'card::card()'
   38 |         card b[36];
      |                  ^
a.cc:18:9: note: candidate: 'card::card(char, int)'
   18 |         card(char suit, int value) :suit(suit), value(value) {}
      |         ^~~~
a.cc:18:9: note:   candidate expects 2 arguments, 0 provided
a.cc:14:8: note: candidate: 'constexpr card::card(const card&)'
   14 | struct card {
      |        ^~~~
a.cc:14:8: note:   candidate expects 1 argument, 0 provided
a.cc:14:8: note: candidate: 'constexpr card::card(card&&)'
a.cc:14:8: note:   candidate expects 1 argument, 0 provided
Language: C++

/*
 * ITP1_6_B.cpp
 *
 *  Created on: Apr 20, 2018
 *      Author: 13743
 */

#include<iostream>
#include<cmath>

using namespace std;


struct card {
	char suit;
	int value;

	card(char suit, int value) :suit(suit), value(value) {}
};

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

void printCard(card *a, int n) {
	cout << a[0].suit << a[0].value;
	for(int i=1; i<n; i++) {
		cout << " " << a[i].suit << a[i].value;
	}
	cout << endl;
}

int main() {
	int n;
	card a[36] = {};
	card b[36] = {};
	cin >> n;
	for(int i=0; i<n; i++) {
		cin >> a[i].suit >> a[i].value;
		b[i].suit = a[i].suit;
		b[i].value = a[i].value;
	}

	for(int i=0; i<n; i++) {
		for(int j=n-1; j>i; j++) {
			if(a[j-1].value > a[j].value) {
				swap(a, j-1, j);
			}
		}
	}
	printCard(a, n);
	cout << "Stable" << endl;

	for(int i=0; i<n; i++) {
		int mini = i;
		for(int j=i+1; j<n; j++) {
			if(b[j].value < b[mini].value) {
				mini = j;
			}
			swap(b, i, mini);
		}
	}
	printCard(b, n);
	for(int i=0; i<n; i++) {
		if(a[i].suit != b[i].suit) {
			cout << "Not Stable" << endl;
			return 0;
		}
	}
	cout << "Stable" << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:37:23: error: could not convert '<brace-enclosed initializer list>()' from '<brace-enclosed initializer list>' to 'card'
   37 |         card a[36] = {};
      |                       ^
      |                       |
      |                       <brace-enclosed initializer list>
a.cc:38:23: error: could not convert '<brace-enclosed initializer list>()' from '<brace-enclosed initializer list>' to 'card'
   38 |         card b[36] = {};
      |                       ^
      |                       |
      |                       <brace-enclosed initializer list>
Language: C++

/*
 * ITP1_6_B.cpp
 *
 *  Created on: Apr 20, 2018
 *      Author: 13743
 */

#include<iostream>
#include<cmath>

using namespace std;


struct card {
	char suit;
	int value;

	card(char suit, int value) :suit(suit), value(value) {}
};

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

void printCard(card *a, int n) {
	cout << a[0].suit << a[0].value;
	for(int i=1; i<n; i++) {
		cout << " " << a[i].suit << a[i].value;
	}
	cout << endl;
}

int main() {
	int n;
	struct card a[36];
	struct card b[36];
	cin >> n;
	for(int i=0; i<n; i++) {
		cin >> a[i].suit >> a[i].value;
		b[i].suit = a[i].suit;
		b[i].value = a[i].value;
	}

	for(int i=0; i<n; i++) {
		for(int j=n-1; j>i; j++) {
			if(a[j-1].value > a[j].value) {
				swap(a, j-1, j);
			}
		}
	}
	printCard(a, n);
	cout << "Stable" << endl;

	for(int i=0; i<n; i++) {
		int mini = i;
		for(int j=i+1; j<n; j++) {
			if(b[j].value < b[mini].value) {
				mini = j;
			}
			swap(b, i, mini);
		}
	}
	printCard(b, n);
	for(int i=0; i<n; i++) {
		if(a[i].suit != b[i].suit) {
			cout << "Not Stable" << endl;
			return 0;
		}
	}
	cout << "Stable" << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:37:25: error: no matching function for call to 'card::card()'
   37 |         struct card a[36];
      |                         ^
a.cc:18:9: note: candidate: 'card::card(char, int)'
   18 |         card(char suit, int value) :suit(suit), value(value) {}
      |         ^~~~
a.cc:18:9: note:   candidate expects 2 arguments, 0 provided
a.cc:14:8: note: candidate: 'constexpr card::card(const card&)'
   14 | struct card {
      |        ^~~~
a.cc:14:8: note:   candidate expects 1 argument, 0 provided
a.cc:14:8: note: candidate: 'constexpr card::card(card&&)'
a.cc:14:8: note:   candidate expects 1 argument, 0 provided
a.cc:38:25: error: no matching function for call to 'card::card()'
   38 |         struct card b[36];
      |                         ^
a.cc:18:9: note: candidate: 'card::card(char, int)'
   18 |         card(char suit, int value) :suit(suit), value(value) {}
      |         ^~~~
a.cc:18:9: note:   candidate expects 2 arguments, 0 provided
a.cc:14:8: note: candidate: 'constexpr card::card(const card&)'
   14 | struct card {
      |        ^~~~
a.cc:14:8: note:   candidate expects 1 argument, 0 provided
a.cc:14:8: note: candidate: 'constexpr card::card(card&&)'
a.cc:14:8: note:   candidate expects 1 argument, 0 provided
Language: C++

/*
 * ITP1_6_B.cpp
 *
 *  Created on: Apr 20, 2018
 *      Author: 13743
 */

#include<iostream>
#include<cmath>

using namespace std;


struct card {
	char suit;
	int value;
	
	card(char suit, int value) :suit(suit), value(value) {}
};

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

void printCard(card *a, int n) {
	cout << a[0].suit << a[0].value;
	for(int i=1; i<n; i++) {
		cout << " " << a[i].suit << a[i].value;
	}
	cout << endl;
}

int main() {
	int n;
	card a[36];
	card b[36];
	cin >> n;
	for(int i=0; i<n; i++) {
		char c;
		int val;
		
		cin >> c >> val;
		a[i] = {c, val};
		b[i].suit = a[i].suit;
		b[i].value = a[i].value;
	}

	for(int i=0; i<n; i++) {
		for(int j=n-1; j>i; j++) {
			if(a[j-1].value > a[j].value) {
				swap(a, j-1, j);
			}
		}
	}
	printCard(a, n);
	cout << "Stable" << endl;

	for(int i=0; i<n; i++) {
		int mini = i;
		for(int j=i+1; j<n; j++) {
			if(b[j].value < b[mini].value) {
				mini = j;
			}
			swap(b, i, mini);
		}
	}
	printCard(b, n);
	for(int i=0; i<n; i++) {
		if(a[i].suit != b[i].suit) {
			cout << "Not Stable" << endl;
			return 0;
		}
	}
	cout << "Stable" << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:37:18: error: no matching function for call to 'card::card()'
   37 |         card a[36];
      |                  ^
a.cc:18:9: note: candidate: 'card::card(char, int)'
   18 |         card(char suit, int value) :suit(suit), value(value) {}
      |         ^~~~
a.cc:18:9: note:   candidate expects 2 arguments, 0 provided
a.cc:14:8: note: candidate: 'constexpr card::card(const card&)'
   14 | struct card {
      |        ^~~~
a.cc:14:8: note:   candidate expects 1 argument, 0 provided
a.cc:14:8: note: candidate: 'constexpr card::card(card&&)'
a.cc:14:8: note:   candidate expects 1 argument, 0 provided
a.cc:38:18: error: no matching function for call to 'card::card()'
   38 |         card b[36];
      |                  ^
a.cc:18:9: note: candidate: 'card::card(char, int)'
   18 |         card(char suit, int value) :suit(suit), value(value) {}
      |         ^~~~
a.cc:18:9: note:   candidate expects 2 arguments, 0 provided
a.cc:14:8: note: candidate: 'constexpr card::card(const card&)'
   14 | struct card {
      |        ^~~~
a.cc:14:8: note:   candidate expects 1 argument, 0 provided
a.cc:14:8: note: candidate: 'constexpr card::card(card&&)'
a.cc:14:8: note:   candidate expects 1 argument, 0 provided
Language: C++

/*
 * ITP1_6_B.cpp
 *
 *  Created on: Apr 20, 2018
 *      Author: 13743
 */

#include<iostream>
#include<cmath>

using namespace std;


struct card {
	char suit;
	int value;
};

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

void printCard(card *a, int n) {
	cout << a[0].suit << a[0].value;
	for(int i=1; i<n; i++) {
		cout << " " << a[i].suit << a[i].value;
	}
	cout << endl;
}

int main() {
	int n;
	card a[36];
	card b[36];
	cin >> n;
	for(int i=0; i<n; i++) {
		char c;
		int val;

		cin >> c >> val;
		a[i] = {c, val};
//		b[i].suit = a[i].suit;
//		b[i].value = a[i].value;
//	}
//
//	for(int i=0; i<n; i++) {
//		for(int j=n-1; j>i; j++) {
//			if(a[j-1].value > a[j].value) {
//				swap(a, j-1, j);
//			}
//		}
//	}
//	printCard(a, n);
//	cout << "Stable" << endl;
//
//	for(int i=0; i<n; i++) {
//		int mini = i;
//		for(int j=i+1; j<n; j++) {
//			if(b[j].value < b[mini].value) {
//				mini = j;
//			}
//			swap(b, i, mini);
//		}
//	}
//	printCard(b, n);
//	for(int i=0; i<n; i++) {
//		if(a[i].suit != b[i].suit) {
//			cout << "Not Stable" << endl;
//			return 0;
//		}
//	}
//	cout << "Stable" << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:75:2: error: expected '}' at end of input
   75 | }
      |  ^
a.cc:33:12: note: to match this '{'
   33 | int main() {
      |            ^
Language: C++

std2dc13:doing s1260165[90]$ #include<bits/stdc++.h>
using namespace std;


void bsort(int *b,string *a,int n){
  bool j=true;
  while(j){
    j=false;
    for(int i=1;i<n;i++){
      if(*(b+i-1)>*(b+i)){j=true; swap(*(b+i-1),*(b+i)); swap(*(a+i-1),*(a+i));}
  }}
}


void ssort(int *b,string *a,int n){
  for(int i=0;i<n-1;i++){
    int mi=*(b+i);
    int k=i;
    for(int t=i+1;t<n;t++){
      if(mi>*(b+t)){mi=*(b+t); k=t;}
    }
    swap(*(b+i),*(b+k)); swap(*(a+i),*(a+k));
  }
}


int main(){
  int n;
  cin>>n;
  string a[1000],ad[1000];
  int b[1000],bd[1000];
  for(int i=0;i<n;i++){
    cin>>a[i];
    ad[i]=a[i];
    b[i]=a[i][1]-'0';
    bd[i]=b[i];
  }
  bsort(b,a,n);
  for(int i=0;i<n;i++){
    cout<<a[i];
    if(i!=n-1){cout<<" ";}
  }
  cout<<endl<<"Stable"<<endl;

  ssort(bd,ad,n);
  for(int i=0;i<n;i++){
    cout<<ad[i];
    if(i!=n-1){cout<<" ";}
  }
  cout<<endl<<"Stable"<<endl;
  
  return 0;
}




Compiler output:
a.cc:1:30: error: stray '#' in program
    1 | std2dc13:doing s1260165[90]$ #include<bits/stdc++.h>
      |                              ^
a.cc:1:9: error: found ':' in nested-name-specifier, expected '::'
    1 | std2dc13:doing s1260165[90]$ #include<bits/stdc++.h>
      |         ^
      |         ::
a.cc:1:1: error: 'std2dc13' does not name a type
    1 | std2dc13:doing s1260165[90]$ #include<bits/stdc++.h>
      | ^~~~~~~~
a.cc:5:19: error: 'string' has not been declared
    5 | void bsort(int *b,string *a,int n){
      |                   ^~~~~~
a.cc: In function 'void bsort(int*, int*, int)':
a.cc:10:35: error: 'swap' was not declared in this scope
   10 |       if(*(b+i-1)>*(b+i)){j=true; swap(*(b+i-1),*(b+i)); swap(*(a+i-1),*(a+i));}
      |                                   ^~~~
a.cc: At global scope:
a.cc:15:19: error: 'string' has not been declared
   15 | void ssort(int *b,string *a,int n){
      |                   ^~~~~~
a.cc: In function 'void ssort(int*, int*, int)':
a.cc:22:5: error: 'swap' was not declared in this scope
   22 |     swap(*(b+i),*(b+k)); swap(*(a+i),*(a+k));
      |     ^~~~
a.cc: In function 'int main()':
a.cc:29:3: error: 'cin' was not declared in this scope
   29 |   cin>>n;
      |   ^~~
a.cc:30:3: error: 'string' was not declared in this scope
   30 |   string a[1000],ad[1000];
      |   ^~~~~~
a.cc:33:10: error: 'a' was not declared in this scope
   33 |     cin>>a[i];
      |          ^
a.cc:34:5: error: 'ad' was not declared in this scope; did you mean 'bd'?
   34 |     ad[i]=a[i];
      |     ^~
      |     bd
a.cc:38:11: error: 'a' was not declared in this scope
   38 |   bsort(b,a,n);
      |           ^
a.cc:40:5: error: 'cout' was not declared in this scope
   40 |     cout<<a[i];
      |     ^~~~
a.cc:43:3: error: 'cout' was not declared in this scope
   43 |   cout<<endl<<"Stable"<<endl;
      |   ^~~~
a.cc:43:9: error: 'endl' was not declared in this scope
   43 |   cout<<endl<<"Stable"<<endl;
      |         ^~~~
a.cc:45:12: error: 'ad' was not declared in this scope; did you mean 'bd'?
   45 |   ssort(bd,ad,n);
      |            ^~
      |            bd
Language: C++

#include<iostream>
#include<cstring>

using namespace std;

struct Card{
    char symbol;
    int number;
};

void outCards(Card C[], int N){
    for(int i = 0; i < N; i++){
        if(i)cout << " ";
        cout << C[i].symbol << C[i].number;
    }
    cout << endl;

}

bool isStable(Card C1[], Card C2[], int N){
    for(int i = 1; i < N; i++){
        if(C1[i].symbol != C2[i].symbol){
            return false;
        }
    }
    return true;
}


void BubbleSort(Card C[], int N){
    for(int i = 0; i < N; i++){
        for(int j = N; j >= i; j++){
            if(C[j].number < C[j-1].number)swap(C[j].number, C[j-1].number);
        }
    }
    outCards(C, N);
    cout << "Stable" << endl;

    return C;

}

void SelectionSort(Card C[], int N){
    for(int i = 0; i < N; i++){
        int minj = i;
        for(int j = i; j < N; j++){
            if(C[j].number < C[minj].number)minj = j;
        }
        swap(C[i].number, C[minj].number);
    }
    outCards(C, N);
}



int main(){
    int N;
    cin >>N;
    Card C1[N], C2[N];
    string s;
    for(int i = 0; i < N; i++){
        cin >>s;
        C1[i].symbol = s[0];
        C1[i].number = s[1] - '0';
        C2[i].symbol = s[0];
        C2[i].number = s[1] - '0';
    }
    BubbleSort(C1, N);
    SelectionSort(C2, N);

    cout << (isStable(C1, C2, N) ? "Stable" : "Not Stable") << endl;




    return 0;
}


Compiler output:
a.cc: In function 'void BubbleSort(Card*, int)':
a.cc:39:12: error: return-statement with a value, in function returning 'void' [-fpermissive]
   39 |     return C;
      |            ^
Language: C++

#include<iostream>
using namespace std;

struct Card{ char suit, value;};

void bubble(struct Card A[], int N){
  Card tmp;

  for( i = 0; i < N-1; i++){
    for( j = N-1; i < j; j--) {
      if (A[j].value < A[j-1].value) {
        tmp = A[j-1]; A[j-1] = A[j]; A[j] = tmp;
      }
    }
  }
}

void selection(struct Card A[], int N) {
  int minj;
  Card tmp;

  for ( int i = 0; i < N-1; i++) {
    minj = i;
    for ( int j = i; j < N-1; j++) {
      if ( A[j].value < A[minj].value ) minj = j;
    }
    tmp = A[i]; A[i] = A[mimj]; A[minj] = tmp;
}

void print(strudt  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;
  }

  return 0;
}


Compiler output:
a.cc: In function 'void bubble(Card*, int)':
a.cc:9:8: error: 'i' was not declared in this scope
    9 |   for( i = 0; i < N-1; i++){
      |        ^
a.cc:10:10: error: 'j' was not declared in this scope
   10 |     for( j = N-1; i < j; j--) {
      |          ^
a.cc: In function 'void selection(Card*, int)':
a.cc:27:26: error: 'mimj' was not declared in this scope; did you mean 'minj'?
   27 |     tmp = A[i]; A[i] = A[mimj]; A[minj] = tmp;
      |                          ^~~~
      |                          minj
a.cc:30:6: error: variable or field 'print' declared void
   30 | void print(strudt  Card A[], int N) {
      |      ^~~~~
a.cc:30:12: error: 'strudt' was not declared in this scope; did you mean 'struct'?
   30 | void print(strudt  Card A[], int N) {
      |            ^~~~~~
      |            struct
a.cc:30:30: error: expected primary-expression before 'int'
   30 | void print(strudt  Card A[], int N) {
      |                              ^~~
a.cc:38:58: error: a function-definition is not allowed here before '{' token
   38 | bool isStable(struct Card C1[], struct Card C2[], int N) {
      |                                                          ^
a.cc:45:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   45 | int main() {
      |         ^~
a.cc:45:9: note: remove parentheses to default-initialize a variable
   45 | int main() {
      |         ^~
      |         --
a.cc:45:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:45:12: error: a function-definition is not allowed here before '{' token
   45 | int main() {
      |            ^
a.cc:70:2: error: expected '}' at end of input
   70 | }
      |  ^
a.cc:18:40: note: to match this '{'
   18 | void selection(struct Card A[], int N) {
      |                                        ^
Language: C++

#include<iostream>
using namespace std;

struct Card{ char suit, value;};

void bubble(struct Card A[], int N){
  Card tmp;

  for( int i = 0; i < N-1; i++){
    for( int j = N-1; i < j; j--) {
      if (A[j].value < A[j-1].value) {
        tmp = A[j-1]; A[j-1] = A[j]; A[j] = tmp;
      }
    }
  }
}

void selection(struct Card A[], int N) {
  int minj;
  Card tmp;

  for ( int i = 0; i < N-1; i++) {
    minj = i;
    for ( int j = i; j < N-1; j++) {
      if ( A[j].value < A[minj].value ) minj = j;
    }
    tmp = A[i]; A[i] = A[mimj]; A[minj] = tmp;
}

void print(strudt  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;
  }

  return 0;
}


Compiler output:
a.cc: In function 'void selection(Card*, int)':
a.cc:27:26: error: 'mimj' was not declared in this scope; did you mean 'minj'?
   27 |     tmp = A[i]; A[i] = A[mimj]; A[minj] = tmp;
      |                          ^~~~
      |                          minj
a.cc:30:6: error: variable or field 'print' declared void
   30 | void print(strudt  Card A[], int N) {
      |      ^~~~~
a.cc:30:12: error: 'strudt' was not declared in this scope; did you mean 'struct'?
   30 | void print(strudt  Card A[], int N) {
      |            ^~~~~~
      |            struct
a.cc:30:30: error: expected primary-expression before 'int'
   30 | void print(strudt  Card A[], int N) {
      |                              ^~~
a.cc:38:58: error: a function-definition is not allowed here before '{' token
   38 | bool isStable(struct Card C1[], struct Card C2[], int N) {
      |                                                          ^
a.cc:45:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   45 | int main() {
      |         ^~
a.cc:45:9: note: remove parentheses to default-initialize a variable
   45 | int main() {
      |         ^~
      |         --
a.cc:45:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:45:12: error: a function-definition is not allowed here before '{' token
   45 | int main() {
      |            ^
a.cc:70:2: error: expected '}' at end of input
   70 | }
      |  ^
a.cc:18:40: note: to match this '{'
   18 | void selection(struct Card A[], int N) {
      |                                        ^
Language: C++

#include<iostream>
using namespace std;

struct Card{ char suit, value;};

void bubble(struct Card A[], int N){
  Card tmp;

  for( int i = 0; i < N-1; i++){
    for( int j = N-1; i < j; j--) {
      if (A[j].value < A[j-1].value) {
        tmp = A[j-1]; A[j-1] = A[j]; A[j] = tmp;
      }
    }
  }
}

void selection(struct Card A[], int N) {
  int minj;
  Card tmp;

  for ( int i = 0; i < N-1; i++) {
    minj = i;
    for ( int j = i; j < N-1; j++) {
      if ( A[j].value < A[minj].value ) minj = j;
    }
    tmp = A[i]; A[i] = A[minj]; A[minj] = tmp;
}

void print(strudt  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;
  }

  return 0;
}


Compiler output:
a.cc: In function 'void selection(Card*, int)':
a.cc:30:6: error: variable or field 'print' declared void
   30 | void print(strudt  Card A[], int N) {
      |      ^~~~~
a.cc:30:12: error: 'strudt' was not declared in this scope; did you mean 'struct'?
   30 | void print(strudt  Card A[], int N) {
      |            ^~~~~~
      |            struct
a.cc:30:30: error: expected primary-expression before 'int'
   30 | void print(strudt  Card A[], int N) {
      |                              ^~~
a.cc:38:58: error: a function-definition is not allowed here before '{' token
   38 | bool isStable(struct Card C1[], struct Card C2[], int N) {
      |                                                          ^
a.cc:45:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   45 | int main() {
      |         ^~
a.cc:45:9: note: remove parentheses to default-initialize a variable
   45 | int main() {
      |         ^~
      |         --
a.cc:45:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:45:12: error: a function-definition is not allowed here before '{' token
   45 | int main() {
      |            ^
a.cc:70:2: error: expected '}' at end of input
   70 | }
      |  ^
a.cc:18:40: note: to match this '{'
   18 | void selection(struct Card A[], int N) {
      |                                        ^
Language: C++

#include<iostream>
using namespace std;

struct Card{ char suit, value;};

void bubble(struct Card A[], int N){
  Card tmp;

  for( int i = 0; i < N-1; i++){
    for( int j = N-1; i < j; j--) {
      if (A[j].value < A[j-1].value) {
        tmp = A[j-1]; A[j-1] = A[j]; A[j] = tmp;
      }
    }
  }
}

void selection(struct Card A[], int N) {
  int minj;
  Card tmp;

  for ( int i = 0; i < N-1; i++) {
    minj = i;
    for ( int j = i; j < N-1; j++) {
      if ( A[j].value < A[minj].value ) minj = j;
    }
    tmp = A[i]; A[i] = A[minj]; A[minj] = tmp;
}

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;
  }

  return 0;
}


Compiler output:
a.cc: In function 'void selection(Card*, int)':
a.cc:30:37: error: a function-definition is not allowed here before '{' token
   30 | void print(struct  Card A[], int N) {
      |                                     ^
a.cc:38:58: error: a function-definition is not allowed here before '{' token
   38 | bool isStable(struct Card C1[], struct Card C2[], int N) {
      |                                                          ^
a.cc:45:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   45 | int main() {
      |         ^~
a.cc:45:9: note: remove parentheses to default-initialize a variable
   45 | int main() {
      |         ^~
      |         --
a.cc:45:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:45:12: error: a function-definition is not allowed here before '{' token
   45 | int main() {
      |            ^
a.cc:70:2: error: expected '}' at end of input
   70 | }
      |  ^
a.cc:18:40: note: to match this '{'
   18 | void selection(struct Card A[], int N) {
      |                                        ^
Language: C++

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

struct Card {
  char suit;
  char value;
};

void print(const vector<Card>& A) {
  for(int i = 0; i < A.size(); i++) {
    if (i > 0) {
      cout << " ";
    }
    cout << A[i].suit << A[i].value;
  }
  cout << endl;
}

void bubbleSort(vector<Card>& A) {

  for (int i = 0; i < A.size(); i++) {
    for (int j = A.size() - 1; j >= i + 1; j--) {
      if (A[j].value < A[j-1].value) {
        swap(A[j], A[j-1]);
      }
    }
  }
  return sw;
}

void selectionSort(vector<Card>& A) {
  for (int i = 0; i < A.size() - 1; i++) {
    int minj = i;
    for (int j = i; j < A.size(); j++) {
      if (A[j].value < A[minj].value) {
        minj = j;
      }
    }
    swap(A[i], A[minj]);
  }
}

bool isStable(vector<Card>& C1, vector<Card>& C2, int N) {
  for (int i = 0; i < N; i++) {
    if (C1[i].suit != C2[i].suit) {
      return false;
    }
  }

  return true;
}

int main(){
  vector<Card> C1, C2;
  C1.reserve(36);
  C2.reserve(36);

  int N;
  cin >> N;
  C1.resize(N);
  C2.resize(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);
  selectionSort(C2);

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

  return 0;
}


Compiler output:
a.cc: In function 'void bubbleSort(std::vector<Card>&)':
a.cc:29:10: error: 'sw' was not declared in this scope
   29 |   return sw;
      |          ^~
Language: C++

#include <stdio.h>

void bubbleSort(int *C, char *S, int N) {
    for (int i=0; i<N; i++) {
        for (int j=N-1; j>i; j--) {
            if (C[j] < C[j-1]) { 
                int tn = C[j];
                C[j] = C[j-1];
                C[j-1] = tn;
                
                char ts = S[j];
                S[j] = S[j-1];
                S[j-1] = ts;
            }
        }
    }
}

void selectionSort(int *C, char *S, int N) { 
    for (int i=0; i<N; i++) {
        minj = i;
        for (int j=i; j<N; j++) {
            if (C[j] < C[minj]) {
                minj = j;
            }
        }
        int tn = C[i];
        C[i] = C[minj];
        C[minj] = tn;
                
        char ts = S[i];
        S[i] = S[minj];
        S[minj] = ts;
    }
}

void outputArray(int *C, char *S, int N) {
    printf("%s%d",S[0], C[0]);
    for (int i=1; i<N; i++) printf(" %s%d", S[i], C[i]);
    printf("\n");
}

int checkCorrect(char *S1, char *S2, int N){
    check = 1;
    for (int i=0; i<N; i++) {
        if (S1[i] != S2[i]) check=0;
    }
    retuen check;
}

int main() {
    int n;
    scanf("%d", &n);
    
    char s1[n], s2[n];
    int c1[n], c2[n];
    for (int i=0; i<N; i++) {
        scanf("%s", s1[i]);
        scanf("%d", c1[i]);
        c2[i] = c1[i];
        s2[i] = s1[i];
    }
    
    bubbleSort(c1, s1, n);
    outputArray(c1, s1, n);
    printf("Stable\n");
    
    selectionSort(c2, s2, n);
    outputArray(c2, s2, n);
    check=checkCorrect(s1, s2, n);
    if(check) printf("Stable");
    else printf("Not stable")
    
    return 0;
}


Compiler output:
a.cc: In function 'void selectionSort(int*, char*, int)':
a.cc:21:9: error: 'minj' was not declared in this scope
   21 |         minj = i;
      |         ^~~~
a.cc: In function 'int checkCorrect(char*, char*, int)':
a.cc:44:5: error: 'check' was not declared in this scope
   44 |     check = 1;
      |     ^~~~~
a.cc:48:5: error: 'retuen' was not declared in this scope
   48 |     retuen check;
      |     ^~~~~~
a.cc:49:1: warning: no return statement in function returning non-void [-Wreturn-type]
   49 | }
      | ^
a.cc: In function 'int main()':
a.cc:57:21: error: 'N' was not declared in this scope
   57 |     for (int i=0; i<N; i++) {
      |                     ^
a.cc:70:5: error: 'check' was not declared in this scope
   70 |     check=checkCorrect(s1, s2, n);
      |     ^~~~~
a.cc:72:30: error: expected ';' before 'return'
   72 |     else printf("Not stable")
      |                              ^
      |                              ;
   73 | 
   74 |     return 0;
      |     ~~~~~~
Language: C++

#include <stdio.h>

void bubbleSort(int *C, char *S, int N) {
    for (int i=0; i<N; i++) {
        for (int j=N-1; j>i; j--) {
            if (C[j] < C[j-1]) { 
                int tn = C[j];
                C[j] = C[j-1];
                C[j-1] = tn;
                
                char ts = S[j];
                S[j] = S[j-1];
                S[j-1] = ts;
            }
        }
    }
}

void selectionSort(int *C, char *S, int N) { 
    for (int i=0; i<N; i++) {
        int minj = i;
        for (int j=i; j<N; j++) {
            if (C[j] < C[minj]) {
                minj = j;
            }
        }
        int tn = C[i];
        C[i] = C[minj];
        C[minj] = tn;
                
        char ts = S[i];
        S[i] = S[minj];
        S[minj] = ts;
    }
}

void outputArray(int *C, char *S, int N) {
    printf("%s%d",S[0], C[0]);
    for (int i=1; i<N; i++) printf(" %s%d", S[i], C[i]);
    printf("\n");
}

int checkCorrect(char *S1, char *S2, int N){
    int check = 1;
    for (int i=0; i<N; i++) {
        if (S1[i] != S2[i]) check=0;
    }
    return check;
}

int main() {
    int n;
    scanf("%d", &n);
    
    char s1[n], s2[n];
    int c1[n], c2[n];
    for (int i=0; i<n; i++) {
        scanf("%s", s1[i]);
        scanf("%d", c1[i]);
        c2[i] = c1[i];
        s2[i] = s1[i];
    }
    
    bubbleSort(c1, s1, n);
    outputArray(c1, s1, n);
    printf("Stable\n");
    
    selectionSort(c2, s2, n);
    outputArray(c2, s2, n);
    check=checkCorrect(s1, s2, n);
    if(check) printf("Stable");
    else printf("Not stable")
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:70:5: error: 'check' was not declared in this scope
   70 |     check=checkCorrect(s1, s2, n);
      |     ^~~~~
a.cc:72:30: error: expected ';' before 'return'
   72 |     else printf("Not stable")
      |                              ^
      |                              ;
   73 | 
   74 |     return 0;
      |     ~~~~~~
Language: C++

#include <stdio.h>

void bubbleSort(int *C, char *S, int N) {
    for (int i=0; i<N; i++) {
        for (int j=N-1; j>i; j--) {
            if (C[j] < C[j-1]) { 
                int tn = C[j];
                C[j] = C[j-1];
                C[j-1] = tn;
                
                char ts = S[j];
                S[j] = S[j-1];
                S[j-1] = ts;
            }
        }
    }
}

void selectionSort(int *C, char *S, int N) { 
    for (int i=0; i<N; i++) {
        int minj = i;
        for (int j=i; j<N; j++) {
            if (C[j] < C[minj]) {
                minj = j;
            }
        }
        int tn = C[i];
        C[i] = C[minj];
        C[minj] = tn;
                
        char ts = S[i];
        S[i] = S[minj];
        S[minj] = ts;
    }
}

void outputArray(int *C, char *S, int N) {
    printf("%s%d",S[0], C[0]);
    for (int i=1; i<N; i++) printf(" %s%d", S[i], C[i]);
    printf("\n");
}

int checkCorrect(char *S1, char *S2, int N){
    int check = 1;
    for (int i=0; i<N; i++) {
        if (S1[i] != S2[i]) check=0;
    }
    return check;
}

int main() {
    int n;
    scanf("%d", &n);
    
    char s1[n], s2[n];
    int c1[n], c2[n];
    for (int i=0; i<n; i++) {
        scanf("%s", s1[i]);
        scanf("%d", c1[i]);
        c2[i] = c1[i];
        s2[i] = s1[i];
    }
    
    bubbleSort(c1, s1, n);
    outputArray(c1, s1, n);
    printf("Stable\n");
    
    selectionSort(c2, s2, n);
    outputArray(c2, s2, n);
    check=checkCorrect(s1, s2, n);
    if(check) printf("Stable");
    else printf("Not stable");
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:70:5: error: 'check' was not declared in this scope
   70 |     check=checkCorrect(s1, s2, n);
      |     ^~~~~
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 + 1: 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;
}
return 0;
} 


Compiler output:
a.cc:6:1: error: extended character 　 is not valid in an identifier
    6 | 　for ( int i = 0; i < N; i++) {
      | ^
a.cc:7:1: error: extended character 　 is not valid in an identifier
    7 | 　　for ( int j = N - 1; j >= i + 1: j-- )　｛
      | ^
a.cc:7:1: error: extended character 　 is not valid in an identifier
a.cc:7:43: error: extended character 　 is not valid in an identifier
    7 | 　　for ( int j = N - 1; j >= i + 1: j-- )　｛
      |                                           ^
a.cc:8:1: error: extended character 　 is not valid in an identifier
    8 | 　　　if ( A[j].value < A[j - 1].value ) {
      | ^
a.cc:8:1: error: extended character 　 is not valid in an identifier
a.cc:8:1: error: extended character 　 is not valid in an identifier
a.cc:56:9: error: extended character 　 is not valid in an identifier
   56 | cout << "Stable"　<< endl;
      |         ^
a.cc: In function 'void bubble(Card*, int)':
a.cc:6:9: error: expected primary-expression before 'int'
    6 | 　for ( int i = 0; i < N; i++) {
      |         ^~~
a.cc:6:20: error: 'i' was not declared in this scope
    6 | 　for ( int i = 0; i < N; i++) {
      |                    ^
a.cc: At global scope:
a.cc:13:1: error: expected declaration before '}' token
   13 | }
      | ^
a.cc: In function 'int main()':
a.cc:56:9: error: unable to find string literal operator 'operator""\U00003000' with 'const char [7]', 'long unsigned int' arguments
   56 | cout << "Stable"　<< endl;
      |         ^~~~~~~~~~
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 + 1; 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;
}
return 0;
} 


Compiler output:
a.cc:7:1: error: extended character 　 is not valid in an identifier
    7 | 　for ( int i = 0; i < N; i++) {
      | ^
a.cc:8:1: error: extended character 　 is not valid in an identifier
    8 | 　　for ( int j = N - 1; j >= i + 1; j-- )　｛
      | ^
a.cc:8:1: error: extended character 　 is not valid in an identifier
a.cc:8:43: error: extended character 　 is not valid in an identifier
    8 | 　　for ( int j = N - 1; j >= i + 1; j-- )　｛
      |                                           ^
a.cc:9:1: error: extended character 　 is not valid in an identifier
    9 | 　　　if ( A[j].value < A[j - 1].value ) {
      | ^
a.cc:9:1: error: extended character 　 is not valid in an identifier
a.cc:9:1: error: extended character 　 is not valid in an identifier
a.cc:57:9: error: extended character 　 is not valid in an identifier
   57 | cout << "Stable"　<< endl;
      |         ^
a.cc: In function 'void bubble(Card*, int)':
a.cc:7:9: error: expected primary-expression before 'int'
    7 | 　for ( int i = 0; i < N; i++) {
      |         ^~~
a.cc:7:20: error: 'i' was not declared in this scope
    7 | 　for ( int i = 0; i < N; i++) {
      |                    ^
a.cc: At global scope:
a.cc:14:1: error: expected declaration before '}' token
   14 | }
      | ^
a.cc: In function 'int main()':
a.cc:57:9: error: unable to find string literal operator 'operator""\U00003000' with 'const char [7]', 'long unsigned int' arguments
   57 | cout << "Stable"　<< endl;
      |         ^~~~~~~~~~
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 + 1; 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" << ebdl;
  }
  else{
    cout << "Not Stable" << ebdl;
  }

  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:62:13: error: expected ';' before ':' token
   62 |  print(C2,N):
      |             ^
      |             ;
a.cc:66:3: error: 'else' without a previous 'if'
   66 |   else{
      |   ^~~~
a.cc:67:29: error: 'ebdl' was not declared in this scope
   67 |     cout << "Not Stable" << ebdl;
      |                             ^~~~
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 + 1; 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" << ebdl;
  }
  else{
    cout << "Not Stable" << ebdl;
  }

  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:64:25: error: 'ebdl' was not declared in this scope
   64 |     cout << "Stable" << ebdl;
      |                         ^~~~
a.cc:67:29: error: 'ebdl' was not declared in this scope
   67 |     cout << "Not Stable" << ebdl;
      |                             ^~~~
Language: C++

#include<iostream>
using namespace std;

struct Card { char suit, value;};

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

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

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

bool hikaku(struct Card C1[], sturct 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);

  out(C1,N);
  cout << "Stable" << endl;
  out(C2,N);
  if(hikaku(C1,C2,N)){
    cout << "Stable" << endl;
  } else{
    cout << "Not stable" << endl;
  }
  return 0;
}



Compiler output:
a.cc:38:31: error: 'sturct' has not been declared
   38 | bool hikaku(struct Card C1[], sturct Card C2[],int N){
      |                               ^~~~~~
a.cc:38:43: error: expected ',' or '...' before 'C2'
   38 | bool hikaku(struct Card C1[], sturct Card C2[],int N){
      |                                           ^~
a.cc: In function 'bool hikaku(Card*, int)':
a.cc:39:17: error: 'N' was not declared in this scope
   39 |   for(int i=0;i<N;i++){
      |                 ^
a.cc:40:22: error: 'C2' was not declared in this scope; did you mean 'C1'?
   40 |     if(C1[i].suit != C2[i].suit) return false;
      |                      ^~
      |                      C1
a.cc: In function 'int main()':
a.cc:62:16: error: invalid conversion from 'Card*' to 'int' [-fpermissive]
   62 |   if(hikaku(C1,C2,N)){
      |                ^~
      |                |
      |                Card*
a.cc:62:12: error: too many arguments to function 'bool hikaku(Card*, int)'
   62 |   if(hikaku(C1,C2,N)){
      |      ~~~~~~^~~~~~~~~
a.cc:38:6: note: declared here
   38 | bool hikaku(struct Card C1[], sturct Card C2[],int N){
      |      ^~~~~~
Language: C++

import copy

N = int(input())
A = list(input().split())

def is_stable(sorted_list):
    for i in range(len(sorted_list)-1):
        if sorted_list[i][1] == sorted_list[i+1][1]:
            for j in range(len(A)):
                if A[j] == sorted_list[i]:
                    smaller_idx = j
                if A[j] == sorted_list[i+1]:
                    larger_idx = j
            if smaller_idx > larger_idx:
                return False
    return True

def print_stable_or_not(is_stable):
    if is_stable:
        print("Stable")
    else:
        print("Not stable")

def bubble_sort(A1):
    flg = True
    while flg:
        for i in range(N):
            flg = False
            for j in range(N-1, i, -1):
                if int(A1[j-1][1]) > int(A1[j][1]):
                    A1[j-1], A1[j] = A1[j], A1[j-1]
                    flg = True
    print(" ".join(A1))
    print_stable_or_not(is_stable(A1))

def insertion_sort(A2):
    for i in range(N-1):
        min_idx = i
        for j in range(i+1, N):
            if int(A2[min_idx][1]) > int(A2[j][1]):
                min_idx = j
        if min_idx != i:
            A2[i], A2[min_idx] = A2[min_idx], A2[i]
    print(" ".join(A2))
    print_stable_or_not(is_stable(A2))

if __name__ == '__main__':
    A1 = copy.deepcopy(A)
    A2 = copy.deepcopy(A)
    bubble_sort(A1)
    insertion_sort(A2)


Compiler output:
a.cc:47:16: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes
   47 | if __name__ == '__main__':
      |                ^~~~~~~~~~
a.cc:1:1: error: 'import' does not name a type
    1 | import copy
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
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 + 1; 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;
  }
  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:47:3: error: expected initializer before 'int'
   47 |   int N;
      |   ^~~
a.cc:50:10: error: 'N' was not declared in this scope
   50 |   cin >> N;
      |          ^
a.cc:55:29: error: 'C2' was not declared in this scope; did you mean 'C1'?
   55 |   for(int i = 0; i < N; i++)C2[i] = C1[i];
      |                             ^~
      |                             C1
a.cc:58:13: error: 'C2' was not declared in this scope; did you mean 'C1'?
   58 |   selection(C2,N);
      |             ^~
      |             C1