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

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

int main()
{
	int n = 0 , minj = 0, flag = 1, k = 0;
	char a[36][3], b[36][3], temp[3];

	cin >> n;

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

	for (int i = 0; i < n; i++)
		strcpy_s(b[i], a[i]);

	while (flag) {
		flag = 0;
		for (int j = n - 1; j > 0; j--) {
			if (b[j][1] < b[j - 1][1]) {
				strcpy(temp, b[j - 1]);
				strcpy(b[j - 1], b[j]);
				strcpy(b[j], temp);
				flag = 1;
			}
		}
	}

	for (int i = 0; i < n - 1; i++)
		cout << b[i] << " ";
	cout << b[n - 1] << endl;

	for (int i = 0; i < n - 1; i++) {
		if (b[i][1] == b[i + 1][1]) {

			int s = 0, t = 0;

			while (strcmp(a[s], b[i]))
				s++;

			while (strcmp(a[t], b[i + 1]))
				t++;

			if (s < t)
				k = 1;
		}
	}

	if (k == 1)
		cout << "Stable" << endl;
	else
		cout << "Not stable" << endl;

	for (int i = 0; i < n; i++)
		strcpy_s(b[i], a[i]);

	for (int i = 0; i < n - 1; i++){

		minj = i;

		for (int j = i + 1; j < n; j++) {
			if (b[j][1] < b[minj][1])
				minj = j;
		}

		if (minj > i) {
			strcpy(temp, b[i]);
			strcpy(b[i], b[minj]);
			strcpy(b[minj], temp);
		}
	}

	for (int i = 0; i < n - 1; i++)
		cout << b[i] << " ";
	cout << b[n - 1] << endl;

	k = 0;

	for (int i = 0; i < n - 1; i++) {
		if (b[i][1] == b[i + 1][1]) {

			int s = 0, t = 0;

			while (strcmp(a[s], b[i]))
				s++;

			while (strcmp(a[t], b[i + 1]))
				t++;

			if (s < t)
				k = 1;
		}
	}

	if (k == 1)
		cout << "Stable" << endl;
	else
		cout << "Not stable" << endl;
		
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:17: error: 'strcpy_s' was not declared in this scope; did you mean 'strcpy'?
   16 |                 strcpy_s(b[i], a[i]);
      |                 ^~~~~~~~
      |                 strcpy
a.cc:56:17: error: 'strcpy_s' was not declared in this scope; did you mean 'strcpy'?
   56 |                 strcpy_s(b[i], a[i]);
      |                 ^~~~~~~~
      |                 strcpy
Language: C++

#include <iostream>
using namespace std;

int main(){
	bool flag = true;
	pair<char, int> C[36], E[36], D;
	int N, i, j, k, minj;
	cin >> N;
	for (i = 0; i < N; i++) {
		cin >> C[i].first >> C[i].second;
		E[i] = C[i];
    }
	for (i = 0; i < N; i++){
		for (j = N - 1; j > i; j--){
			if (C[j].second < C[j - 1].second) {
				D = C[j - 1];
				C[j - 1] = C[j];
				C[j] = D;
			}
		}
	}
	for (i = 0; i < N; i++) {
		cout << C[i].first << C[i].second;
		if (i < N - 1) cout << " ";
		else cout << endl;
	}
	cout << "Stable" << endl;

	for (i = 0; i < N; i++) {
		minj = i;
		for (j = i; j < N; j++){
			if (E[j].second < E[minj].second)
				minj = j;
		}
		D = E[minj];
		E[minj] = E[i];
		E[i] = D;
	}
	for (i = 0; i < N; i++) {
		if (C[i].first != E[i].first) flag = false;
		cout << E[i].first << E[i].second;
		if (i < N - 1) cout << " ";
		else cout << endl;
	}
	if (flag)
		cout << endl << "Stable" << endl;
	else
		cout << endl << "Not stable" << endl;

Compiler output:
a.cc: In function 'int main()':
a.cc:48:54: error: expected '}' at end of input
   48 |                 cout << endl << "Not stable" << endl;
      |                                                      ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

#include <stdio.h>
#include <stdint.h>
#include <iostream>
#include <fstream>
#include <cassert>
#include <vector>
using namespace std;

#define DEBUG (1)

#ifdef DEBUG
#define DPRINT(...)  printf("D(L%d)%s: ", __LINE__, __func__); printf(__VA_ARGS__)
#else
#define DPRINT(...)
#endif

struct Card {
  Card() { };
  Card(char suit, int value) :
    suit_(suit),
    value_(value) { };

  char suit_;
  int value_;
  //enum Suit {'S', 'H', 'C', 'D'};
  void print(){ cout << suit_ << value_; }
};

class Solution {
public:
  Solution();
  ~Solution();
  void pre();
  void run();
  void post();
private:
  int dataSize;
  Card *inputCards;
  Card* copyCards(const Card* pCard, const int size);
  void bubbleSort(Card* pCard, const int size);
  void selectionSort(Card* pCard, const int size);
  void swap(Card &c0, Card &c1);
  void printArray(const Card* pCard, const int size);
  bool isStable(const Card* p0, const Card* p1, const int size);
};

/* Run time: O(n)
 * Memory : O(2n)
 */
bool Solution::isStable(const Card* p0, const Card* p1, const int size) {
  // Card value ranges from 1 to 9
  const int start_val = 1;
  const int end_val = 9;
  vector< vector<char> > vv0(9), vv1(9);

  for (int i = 0; i < size; i++) {
    vv0[p0[i].value_ - start_val].push_back(p0[i].suit_);
    vv1[p1[i].value_ - start_val].push_back(p1[i].suit_);
  }

  // Assume each card sorted out already; just check its stability here
  for (int i = 0; i < end_val; i++) {
    if (vv0[i].size()) {
      for (int j = 0; j < vv0[i].size(); j++) {
        if (vv0[i][j] != vv1[i][j]) {
          //cout << "Not stable" << endl;
          cout << "Not stable";
          return false;
        }
      }
    }
  }
  cout << "Stable" << endl;
  return true;
}

Solution::Solution() {
  cin >> dataSize; cin.ignore();
  assert(dataSize > 0);

  inputCards = new Card[dataSize];
  for (int i=0; i < dataSize; i++)
    cin >> inputCards[i].suit_ >> inputCards[i].value_;

#ifdef DEBUG
  cout << "INPUT: "; printArray(inputCards, dataSize);
#endif
}

Solution::~Solution() {
  if (inputCards)   delete [] inputCards;
}

void Solution::pre() { }

void Solution::run() {
:set nonumber

Compiler output:
a.cc: In member function 'void Solution::run()':
a.cc:97:1: error: expected primary-expression before ':' token
   97 | :set nonumber
      | ^
a.cc:97:14: error: expected '}' at end of input
   97 | :set nonumber
      |              ^
a.cc:96:22: note: to match this '{'
   96 | void Solution::run() {
      |                      ^
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(strudt 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[min]; 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:58:11: warning: multi-character literal with 6 characters exceeds 'int' size of 4 bytes
   58 |   cout << 'stable' << endl;
      |           ^~~~~~~~
a.cc:16:6: error: variable or field 'selection' declared void
   16 | void selection(strudt Card A[], int N) {
      |      ^~~~~~~~~
a.cc:16:16: error: 'strudt' was not declared in this scope; did you mean 'struct'?
   16 | void selection(strudt Card A[], int N) {
      |                ^~~~~~
      |                struct
a.cc:16:33: error: expected primary-expression before 'int'
   16 | void selection(strudt Card A[], int N) {
      |                                 ^~~
a.cc: In function 'int main()':
a.cc:55:3: error: 'selection' was not declared in this scope; did you mean 'select'?
   55 |   selection(C2, N);
      |   ^~~~~~~~~
      |   select
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[min]; 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:58:11: warning: multi-character literal with 6 characters exceeds 'int' size of 4 bytes
   58 |   cout << 'stable' << endl;
      |           ^~~~~~~~
a.cc: In function 'void selection(Card*, int)':
a.cc:22:28: error: invalid types 'Card*[<unresolved overloaded function type>]' for array subscript
   22 |     Card t = A[i]; A[i] = A[min]; A[minj] = t;
      |                            ^
Language: C++

#include<iostream>
using namespace std;
 
struct Card { char suit; int 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(strudt 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[min]; 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:58:11: warning: multi-character literal with 6 characters exceeds 'int' size of 4 bytes
   58 |   cout << 'stable' << endl;
      |           ^~~~~~~~
a.cc:16:6: error: variable or field 'selection' declared void
   16 | void selection(strudt Card A[], int N) {
      |      ^~~~~~~~~
a.cc:16:16: error: 'strudt' was not declared in this scope; did you mean 'struct'?
   16 | void selection(strudt Card A[], int N) {
      |                ^~~~~~
      |                struct
a.cc:16:33: error: expected primary-expression before 'int'
   16 | void selection(strudt Card A[], int N) {
      |                                 ^~~
a.cc: In function 'int main()':
a.cc:55:3: error: 'selection' was not declared in this scope; did you mean 'select'?
   55 |   selection(C2, N);
      |   ^~~~~~~~~
      |   select
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(strudt 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[min]; 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:16:6: error: variable or field 'selection' declared void
   16 | void selection(strudt Card A[], int N) {
      |      ^~~~~~~~~
a.cc:16:16: error: 'strudt' was not declared in this scope; did you mean 'struct'?
   16 | void selection(strudt Card A[], int N) {
      |                ^~~~~~
      |                struct
a.cc:16:33: error: expected primary-expression before 'int'
   16 | void selection(strudt Card A[], int N) {
      |                                 ^~~
a.cc: In function 'int main()':
a.cc:55:3: error: 'selection' was not declared in this scope; did you mean 'select'?
   55 |   selection(C2, N);
      |   ^~~~~~~~~
      |   select
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[min]; 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:1:1: error: 'include' does not name a type
    1 | include<iostream>
      | ^~~~~~~
a.cc: In function 'void selection(Card*, int)':
a.cc:22:29: error: 'min' was not declared in this scope; did you mean 'minj'?
   22 |     Card t = A[i]; A[i] = A[min]; A[minj] = t;
      |                             ^~~
      |                             minj
a.cc: In function 'void print(Card*, int)':
a.cc:28:18: error: 'cout' was not declared in this scope
   28 |     if ( i > 0 ) cout << " ";
      |                  ^~~~
a.cc:29:5: error: 'cout' was not declared in this scope
   29 |     cout << A[i].suit << A[i].value;
      |     ^~~~
a.cc:31:3: error: 'cout' was not declared in this scope
   31 |   cout << endl;
      |   ^~~~
a.cc:31:11: error: 'endl' was not declared in this scope
   31 |   cout << endl;
      |           ^~~~
a.cc: In function 'int main()':
a.cc:47:3: error: 'cin' was not declared in this scope
   47 |   cin >> N;
      |   ^~~
a.cc:58:3: error: 'cout' was not declared in this scope
   58 |   cout << "Stable" << endl;
      |   ^~~~
a.cc:58:23: error: 'endl' was not declared in this scope
   58 |   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; 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[min]; 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 'void selection(Card*, int)':
a.cc:22:28: error: invalid types 'Card*[<unresolved overloaded function type>]' for array subscript
   22 |     Card t = A[i]; A[i] = A[min]; A[minj] = t;
      |                            ^
Language: C++

#include <iostream>
using namespace std;
const int MAX = 36;

struct Card {
  char suit;
  char value;
};

void Print(Card* C, int N) {
  for (int i = 0; i < N - 1; i++)
    cout << C[i].suit << C[i].value << " ";
  cout << C[N - 1].suit << C[N - 1].value << endl;
}

void BubbleSort(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)
        swap(C[j], C[j - 1]);
    }
  }
}

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].value < C[minj].value)
        minj = j;
    }
    swap(C[i], C[minj]);
  }
}

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

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

  memcpy(C2, C1, sizeof(Card) * MAX);

  BubbleSort(C1, N);
  Print(C1, N);
  cout << "Stable\n";

  SelectionSort(C2, 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:52:3: error: 'memcpy' was not declared in this scope
   52 |   memcpy(C2, C1, sizeof(Card) * MAX);
      |   ^~~~~~
a.cc:2:1: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include <iostream>
  +++ |+#include <cstring>
    2 | using namespace std;
Language: C++

#include <iostream>
#include <cassert>

struct Card {
  char suit;
  int value;
};


void bubble_sort(Card cards[], const int n) {
  bool sorted;

  while(!sorted) {
    sorted = true;
    for (int i = n - 1; i > 0; i--) {
      if (cards[i].value < cards[i - 1].value) {
        Card tmp = cards[i];
        cards[i] = cards[i - 1];
        cards[i - 1] = tmp;
        sorted = false;
      }
    }
  }
}

void selection_sort(Card cards[], int n) {
  for (int i = 0; i < n; i++) {
    int min_index = i;
    for (int j = i + 1; j < n; j++) {
      if (cards[j].value < cards[min_index].value) {
        min_index = j;
      }
    }
    if (cards[min_index].value < cards[i].value) {
      Card tmp = cards[i];
      cards[i] = cards[min_index];
      cards[min_index] = tmp;
    }
  }
}


bool is_stable(Card input[], Card sorted[], int n) {
  for (int i = 0; i < n - 1; i++) {
    if (sorted[i].value == sorted[i+1].value) {
      for (int j = 0; j < n; j++) {
        if (input[j].value == sorted[i].value) {
          if (input[j].suit == sorted[i].suit) {
            return true;
          } else if (input[j].suit == sorted[i+1].suit) {
            return false;
          }
        }
      }
    }
  }
  assert(true);
  return false;
}


int main() {
  const int BUF_SIZE = 36;
  Card input[BUF_SIZE];
  int n;
  Card sorted[BUF_SIZE];
  bool stable = false;

  std::cin >> n;
  for (int i = 0; i < n; i++) {
    std::cin >> input[i].suit >> input[i].value;
  }

  for (int i = 0; i < n; i++) {
    sorted[i] = input[i];
  }

  bubble_sort(sorted, n);

  for (int i = 0; i < n; i++) {
    if (i == n - 1) {
      std::cout << sorted[i].suit << sorted[i].value << std::endl;
    }
    else {
      std::cout << sorted[i].suit << sorted[i].value << " ";
    }
  }

  if (is_stable(input, sorted, n)) {
    std::cout << "Stable" << std::endl;
    sorted[i] = input[i];
  }

  bubble_sort(sorted, n);

  for (int i = 0; i < n; i++) {
    if (i == n - 1) {
      std::cout << sorted[i].suit << sorted[i].value << std::endl;
    }
    else {
      std::cout << sorted[i].suit << sorted[i].value << " ";
    }
  }

  if (is_stable(input, sorted, n)) {
    std::cout << "Stable" << std::endl;
  } else {
    std::cout << "Not Stable" << std::endl;
  }

  for (int i = 0; i < n; i++) {
    sorted[i] = input[i];
  }

  selection_sort(sorted, n);
  
  for (int i = 0; i < n; i++) {
    if (i == n - 1) {
      std::cout << sorted[i].suit << sorted[i].value << std::endl;
    }
    else {
      std::cout << sorted[i].suit << sorted[i].value << " ";
    }
  }

  if (is_stable(input, sorted, n)) {
    std::cout << "Stable" << std::endl;
  } else {
    std::cout << "Not Stable" << std::endl;
  }

  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:91:12: error: 'i' was not declared in this scope
   91 |     sorted[i] = input[i];
      |            ^
Language: C++

#include <iostream>
#include <vector>

using namespace std;

void show_vec(vector<string> &vec){
	int N = vec.size();
	for(int i=0; i<N; ++i){
		cout << vec[i];
		if(i < N-1){
			cout << " ";
		}
	}	
	cout << endl;
}

int main(){
	string temp; 
	int N;
	cin >> N;
	vector <string> data1(N), data2(N); 
	map<char, char> check;
	vector<int> keep_num;
	
	// Input
	for(int i=0; i<N; ++i){
		cin >> data1[i];
		data2[i] = data1[i];
	}

	// Bubble Sort
	for(int i=0; i<N; ++i){
		for(int j=N-1; i+1<=j; --j){
			if(data1[j][1] < data1[j-1][1]){
				temp = data1[j];
				data1[j] = data1[j-1]; 
				data1[j-1] = temp;
			}
		}
	}

	// Selection Sort
	int minj;
	for(int i=0; i<N; ++i){
		minj = i;
		for(int j=i; j<N; ++j){
			if(data2[j][1] < data2[minj][1]){
				minj = j;
			}
		}

		temp = data2[i];
		data2[i] = data2[minj];
		data2[minj] = temp;
	}

	// Judge
	show_vec(data1);	
	cout << "Stable" << endl; //bubble sort is stable
	show_vec(data2);

	for(int i=0; i<N; ++i){
		if(data1[i][0] != data2[i][0]){
			cout << "Not Stable" << endl;
			return 0;
		}
	}
	cout << "Stable" << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:9: error: 'map' was not declared in this scope
   22 |         map<char, char> check;
      |         ^~~
a.cc:3:1: note: 'std::map' is defined in header '<map>'; this is probably fixable by adding '#include <map>'
    2 | #include <vector>
  +++ |+#include <map>
    3 | 
a.cc:22:13: error: expected primary-expression before 'char'
   22 |         map<char, char> check;
      |             ^~~~
Language: C++

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

int main(){
    int a[3];

    scanf("%d %d %d",&a[0],&a[1],&a[2]);                   

    sort(a,a+3);

    printf("%d %d %d\n",a[0],a[1],a[2]);
}


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

#include <iostream>
#include <string>
using namespace std;
int main(){
 
  vector <string> a,b;
  string tmp;
  int n,i;
 
  cin>>n;
  for(i=0;i<n;i++){
    cin>>tmp;
    a.push_back(tmp);
  }
  b.assign(a.begin(),a.end());
  for(i=0;i<n-1;i++) for(int j=n-2;j!=i-1;j--) if(a[j][1]>a[j+1][1]) swap(a[j],a[j+1]);
  for(i=0;i<n-1;i++) cout<<a[i]<<" ";
  cout<<a[n-1]<<endl<<"Stable"<<endl;
 
  for(i=0;i<n-1;i++){
    int now,minnum=101;
    for(int j=i;j<n;j++) if(minnum>b[j].at(1)-'0'){
        now=j;
        minnum=b[j].at(1)-'0';
      }
    if(i!=now)  swap(b[i],b[now]);
  }
 
  for(i=0;i<n-1;i++) cout<<b[i]<<" ";
  cout<<b[n-1]<<endl;
  if(a==b) cout<<"Stable"<<endl;
  else cout<<"Not stable"<<endl;
 
  return 0;
 
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:3: error: 'vector' was not declared in this scope
    6 |   vector <string> a,b;
      |   ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include <iostream>
  +++ |+#include <vector>
    2 | #include <string>
a.cc:6:17: error: expected primary-expression before '>' token
    6 |   vector <string> a,b;
      |                 ^
a.cc:6:19: error: 'a' was not declared in this scope
    6 |   vector <string> a,b;
      |                   ^
a.cc:6:21: error: 'b' was not declared in this scope
    6 |   vector <string> a,b;
      |                     ^
Language: C++

#include <iostream>
#include <string>
using namespace std;
int main(){
 
  vector <string> a,b;
  string tmp;
  int n,i;
 
  cin>>n;
  for(i=0;i<n;i++){
    cin>>tmp;
    a.push_back(tmp);
  }
  b.assign(a.begin(),a.end());
  for(i=0;i<n-1;i++) for(int j=n-2;j!=i-1;j--) if(a[j][1]>a[j+1][1]) swap(a[j],a[j+1]);
  for(i=0;i<n-1;i++) cout<<a[i]<<" "
  cout<<a[n-1]<<endl<<"Stable"<<endl
 
  for(i=0;i<n-1;i++){
    int now,minnum=101;
    for(int j=i;j<n;j++) if(minnum>b[j].at(1)-'0'){
        now=j;
        minnum=b[j].at(1)-'0';
      }
    if(i!=now)  swap(b[i],b[now]);
  }
 
  for(i=0;i<n-1;i++) cout<<b[i]<<" ";
  cout<<b[n-1]<<endl;
  if(a==b) cout<<"Stable"<<endl;
  else cout<<"Not stable"<<endl;
 
  return 0;
 
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:3: error: 'vector' was not declared in this scope
    6 |   vector <string> a,b;
      |   ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include <iostream>
  +++ |+#include <vector>
    2 | #include <string>
a.cc:6:17: error: expected primary-expression before '>' token
    6 |   vector <string> a,b;
      |                 ^
a.cc:6:19: error: 'a' was not declared in this scope
    6 |   vector <string> a,b;
      |                   ^
a.cc:6:21: error: 'b' was not declared in this scope
    6 |   vector <string> a,b;
      |                     ^
a.cc:20:20: error: expected ';' before ')' token
   20 |   for(i=0;i<n-1;i++){
      |                    ^
      |                    ;
Language: C++

#include <iostream>
#include <string>
using namespace std;
int main(){
 
  vector <string> a,b;
  string tmp;
  int n,i;
 
  cin>>n;
  for(i=0;i<n;i++)
  {
    cin>>tmp;
    a.push_back(tmp);
  }

  b.assign(a.begin(),a.end());

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

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

  for(i=0;i<n-1;i++)
  {
    int now,minnum=101;
    for(int j=i;j<n;j++) if(minnum>b[j].at(1)-'0'){
        now=j;
        minnum=b[j].at(1)-'0';
      }
    if(i!=now)  
    {
      swap(b[i],b[now]);
    ]
  }
 
  for(i=0;i<n-1;i++)
  {
    cout<<b[i]<<" ";
    cout<<b[n-1]<<endl;

    if(a==b)
    {
     cout<<"Stable"<<endl;
    ]else
    { 
      cout<<"Not stable"<<endl;
    }
  }
  return 0;
 
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:3: error: 'vector' was not declared in this scope
    6 |   vector <string> a,b;
      |   ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include <iostream>
  +++ |+#include <vector>
    2 | #include <string>
a.cc:6:17: error: expected primary-expression before '>' token
    6 |   vector <string> a,b;
      |                 ^
a.cc:6:19: error: 'a' was not declared in this scope
    6 |   vector <string> a,b;
      |                   ^
a.cc:6:21: error: 'b' was not declared in this scope
    6 |   vector <string> a,b;
      |                     ^
a.cc:46:5: error: expected primary-expression before ']' token
   46 |     ]
      |     ^
a.cc:57:5: error: expected primary-expression before ']' token
   57 |     ]else
      |     ^
a.cc:64:2: error: expected '}' at end of input
   64 | }
      |  ^
a.cc:37:3: note: to match this '{'
   37 |   {
      |   ^
a.cc:64:2: error: expected '}' at end of input
   64 | }
      |  ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main(){
 
  vector <string> a,b;
  string tmp;
  int n,i;
 
  cin>>n;
  for(i=0;i<n;i++)
  {
    cin>>tmp;
    a.push_back(tmp);
  }

  b.assign(a.begin(),a.end());

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

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

  for(i=0;i<n-1;i++)
  {
    int now,minnum=101;
    for(int j=i;j<n;j++) if(minnum>b[j].at(1)-'0'){
        now=j;
        minnum=b[j].at(1)-'0';
      }
    if(i!=now)  
    {
      swap(b[i],b[now]);
    ]
  }
 
  for(i=0;i<n-1;i++)
  {
    cout<<b[i]<<" ";
    cout<<b[n-1]<<endl;

    if(a==b)
    {
     cout<<"Stable"<<endl;
    ]else
    { 
      cout<<"Not stable"<<endl;
    }
  }
  return 0;
 
}


Compiler output:
a.cc: In function 'int main()':
a.cc:33:19: error: expected ';' before 'cout'
   33 |    cout<<a[i]<<" "
      |                   ^
      |                   ;
   34 |    cout<<a[n-1]<<endl<<"Stable"<<endl
      |    ~~~~            
a.cc:47:5: error: expected primary-expression before ']' token
   47 |     ]
      |     ^
a.cc:58:5: error: expected primary-expression before ']' token
   58 |     ]else
      |     ^
a.cc:65:2: error: expected '}' at end of input
   65 | }
      |  ^
a.cc:38:3: note: to match this '{'
   38 |   {
      |   ^
a.cc:65:2: error: expected '}' at end of input
   65 | }
      |  ^
a.cc:5:11: note: to match this '{'
    5 | int main(){
      |           ^
Language: C++

#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main(){
 
  vector <string> a,b;
  string tmp;
  int n,i;
 
  cin>>n;
  for(i=0;i<n;i++)
  {
    cin>>tmp;
    a.push_back(tmp);
  }

  b.assign(a.begin(),a.end());

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

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

  for(i=0;i<n-1;i++)
  {
    int now,minnum=101;
    for(int j=i;j<n;j++) if(minnum>b[j].at(1)-'0'){
        now=j;
        minnum=b[j].at(1)-'0';
      }
    if(i!=now)  
    {
      swap(b[i],b[now]);
    }
  }
 
  for(i=0;i<n-1;i++)
  {
    cout<<b[i]<<" ";
    cout<<b[n-1]<<endl;

    if(a==b)
    {
     cout<<"Stable"<<endl;
    }
    else
    { 
      cout<<"Not stable"<<endl;
    }
  }
  return 0;
 
}


Compiler output:
a.cc: In function 'int main()':
a.cc:33:19: error: expected ';' before 'cout'
   33 |    cout<<a[i]<<" "
      |                   ^
      |                   ;
   34 |    cout<<a[n-1]<<endl<<"Stable"<<endl
      |    ~~~~
Language: C++

#include <iostream>
#include <algorithm>
#include <array>

using namespace std;

struct Card {
	char suit;
	int value;
  bool operator==(const Card& rhs) {
    return this->suit == rhs.suit && this->value == rhs.value;
  }
};

static void printCard(Card cards[], int N) {
  for (int i = 0; i < N; i++) {
    cout << (i != 0 ? " " : "") << cards[i].suit << cards[i].value;
  }
  cout << endl; 
}

static void inputCard(Card cards[], int N) {
  for (int i = 0; i < N; i++) {
    cin >> cards[i].suit >> cards[i].value;
   }
}

static int bubbleSort(Card cards[], int N) {
  bool flag = true;
  int count = 0;
  Card tmp;
  for (int i =0; flag; i++) {
    flag = false;
    for (int j = N - 1; j > i; j--) {
      if (cards[j].value < cards[j - 1].value) {
        swap(cards[j], cards[j - 1]);
	      flag = true;
      	count++;
      }
    }
  }
  return count;
}

static int selectionSort(Card cards[], int N) {
  int minj, count = 0;
  for (int i = 0; i < N; i++) {
    minj = i;
    for (int j = i; j < N; j++) {
      if (cards[j].value < cards[minj].value) {
      	minj = j;
      }
    }
    if (cards[i].value != cards[minj].value) {
        swap(cards[i], cards[minj]);
        count++;
    }
  }
  return count;
}

static bool isStable(Card in[], Card out[], int N) {
  for (int i = 0; i < N; i++) {
    for (int j = i + 1; j < N; j++) {
      for (int a = 0; a < N; a++) {
        for (int b = a + 1; b < N; b++) {
          if (in[i].value == in[j].value && in[i] == out[b] && in[j] == out[a]) {
            return false;
          }
        }
      }
    }
  }
  return true;
}

int main() {
  int N;
  cin >> N;

  array<Card, 36> A, B;
  inputCard(A.data(), N);

  B = A;
  bubbleSort(B.data(), N);
  printCard(B.data(), N);
  bool stable;
  stable = isStable(A.data(), B.data(), N);
  cout << (stable ? "Stable" : "NotStable") << endl;
  
  B = A;
å  selectionSort(B.data(), N);
  printCard(B.data(), N);
  stable = isStable(A.data(), B.data(), N);
  cout << (stable ? "Stable" : "NotStable") << endl;
  
  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:92:1: error: '\U000000e5' was not declared in this scope
   92 | å  selectionSort(B.data(), N);
      | ^
Language: C++

import copy

class Card(object):
    def __init__(self, card):
        self.suit = card[:1]
        self.value = int(card[1:])
    
    def __str__(self):
        return self.suit + str(self.value)

def is_stable(bs, ss):
    if bs == ss:
        return 'Stable'
    else:
        return 'Not stable'

def bubble_sort(c, n):
    for i in range(n-1):
        for j in range(n-1):
            if c[j].value > c[j+1].value:
                c[j], c[j+1] = c[j+1], c[j]
    return c

def selection_sort(c, n):
    for i in range(n):
        mink = i
        for v in range(i, n):
            if c[v].value < c[mink].value:
                mink = v
        if mink != i:
            c[i], c[mink] = c[mink], c[i]
    return c

n = input()
nums = input()
nums = nums.split()
nums1 = [Card(card) for card in nums]
nums2 = copy.deepcopy(nums1)

bs = bubble_sort(nums1, int(n))
bs_str = [str(card) for card in bs]
print(' '.join(bs_str))
print('Stable')

ss = selection_sort(nums2, int(n))
ss_str = [str(card) for card in ss]
print(' '.join(ss_str))
print(is_stable(bs_str, ss_str))


Compiler output:
a.cc:13:16: warning: multi-character literal with 6 characters exceeds 'int' size of 4 bytes
   13 |         return 'Stable'
      |                ^~~~~~~~
a.cc:15:16: warning: multi-character literal with 10 characters exceeds 'int' size of 4 bytes
   15 |         return 'Not stable'
      |                ^~~~~~~~~~~~
a.cc:43:7: warning: multi-character literal with 6 characters exceeds 'int' size of 4 bytes
   43 | print('Stable')
      |       ^~~~~~~~
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++

# coding: utf-8
# Stable Sort 2018/3/12

class Card(object):
    def __init__(self, card):
        self.value = int(card[1])
        self.card = card

    def __repr__(self):
        return self.card


def BubbleSort(C, N):
    for i in range(N):
        for j in reversed(range(i+1, N)):
            if C[j].value < C[j-1].value:
                C[j], C[j-1] = C[j-1], C[j]
    return C


def SelectionSort(C, N):
    for i in range(N):
        minj = i
        for j in range(i, N):
            if C[j].value < C[minj].value:
                minj = j
        C[i], C[minj] = C[minj], C[i]
    return C


def isStable(inl, out):
    n = len(inl)
    for i in range(n):
        for j in range(i+1, n):
            for a in range(n):
                for b in range(a+1, n):
                    if inl[i].value == inl[j].value and inl[i] == out[b] and inl[j] == out[a]:
                        return False
    return True


def print_stable(inl, out):
    if isStable(inl, out):
        print "Stable"
    else:
        print "Not stable"


if __name__ == "__main__":
    N = int(raw_input())
    inputs = raw_input().split()
    C = []
    for i in inputs:
        C.append(Card(i))
    Cb = BubbleSort(list(C), N)
    for i in Cb: print i,
    print ""
    print_stable(C, Cb)
    Cs = SelectionSort(list(C), N)
    for i in Cs: print i,
    print ""
    print_stable(C, Cs)


Compiler output:
a.cc:1:3: error: invalid preprocessing directive #coding
    1 | # coding: utf-8
      |   ^~~~~~
a.cc:2:3: error: invalid preprocessing directive #Stable
    2 | # Stable Sort 2018/3/12
      |   ^~~~~~
a.cc:4:19: error: expected initializer before ':' token
    4 | class Card(object):
      |                   ^
Language: C++

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

using namespace std;

struct Card
{
	char suit, value;
};

void printdata(Card C[], int N)
{
	for (int i = 0; i < N; i++)
	{
		if (i > 0)
		{
			cout << " ";
		}

		cout << C[i].suit << C[i].value;
	}
	cout << endl;
}

void bubbleSort(Card A[], int N)
{
	int flg = 1;
	int replace = 0;

	while (flg)
	{
		flg = 0;
		for (int i = N - 1; i>0; i--)
		{
			if (A[i].value < A[i - 1].value)
			{
				swap(A[i], A[i - 1]);
				replace++;
				flg = 1;
			}
		}
	}
}

void selectSort(Card A[], int N)
{
	int min;
	int replace = 0;


	for (int i = 0; i < N; i++)
	{
		min = i;
		for (int j = i; j < N; j++)
		{
			if (A[min].value > A[j].value) 
			{
				min = j;

			}
		}
		if (min != i) 
		{
			swap(A[min], A[i]);
			replace++;
		}
	}
}

int main()
{
	int N, flg = 0;
	Card A[100],B[100];

	cin >> N;

	for (int i = 0; i < N; i++)
	{
		cin >> A[i].suit >> A[i].value;
	}
	memcpy(B,A,sizeof(A));
	bubbleSort(A, N);
	selectSort(B, N);

	printdata(A, N);
	cout<< "Stable" << endl;
	printdata(B, N);

	for (int j = 0; j < N; j++)
	{
		if (A[j].suit != B[j].suit) 
		{
			flg = 1;
		}
	}

	if (flg) 
	{
		cout << "Not stable" << endl;
	}
	else
	{
		cout <<"Stable" << endl;
	}

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:81:9: error: 'memcpy' was not declared in this scope
   81 |         memcpy(B,A,sizeof(A));
      |         ^~~~~~
a.cc:3:1: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <iostream>
  +++ |+#include <cstring>
    3 |
Language: C++

n = int(input())
*bLst, = input().split()
iLst = bLst[:]

for i in range(n):
    for j in range(n-1,i,-1):
        if bLst[j][1] < bLst[j-1][1]:
            bLst[j],bLst[j-1] = bLst[j-1],bLst[j]

print(*bLst)
print("Stable")

for i in range(n):
    min = i
    for j in range(i,n):
        if iLst[j][1] < iLst[min][1]:
            min = j
    iLst[i],iLst[min] = iLst[min],iLst[i]

print(*iLst)
if bLst == iLst:
    print("Stable");
else:
    print("Not stable")


Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n = int(input())
      | ^
a.cc:23:1: error: expected unqualified-id before 'else'
   23 | else:
      | ^~~~
Language: C++

n = int(input())
*bLst, = input().split()
iLst = bLst[:]

for i in range(n):
    for j in range(n-1,i,-1):
        if bLst[j][1] < bLst[j-1][1]:
            bLst[j],bLst[j-1] = bLst[j-1],bLst[j]

print(*bLst)
print("Stable")

for i in range(n):
    min = i
    for j in range(i,n):
        if iLst[j][1] < iLst[min][1]:
            min = j
    iLst[i],iLst[min] = iLst[min],iLst[i]

print(*iLst)
if bLst == iLst:
    print("Stable")
else:
    print("Not stable")


Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n = int(input())
      | ^
Language: C++

#include <iostream>
using namespace std;
const int MAX = 36;

struct Card
{
	char suit;
	int num;
};

void swap(Card c1, Card c2)
{
	char char_temp;
	int int_temp;

	char_temp = c1.suit;
	int_temp = c1.num;

	c1.suit = c2.suit;
	c1.num = c2.num;
	c2.suit = char_temp;
	c2.num = int_temp;

}

bool isEqual(Card c1[], Card c2[], int n)
{
	for(int i = 0; i < n; i++)
	{
		if((c1[i].suit != c2[i].suit) || (c1[i].num != c2[i].num))
			return false;
	}
	return true;
}

int main()
{
	int n, mini;
	Card c1[n], c2[n]; 
	for(int i = 0; i < n; i++)
	{
		cin >> c1[i].suit >> c1[i].num;
		c2[i].suit = c1[i].suit;
		c2[i].num = c1[i].num;
	}

	for(int i = 0; i < n; i++)
	{
		for(int j = n-1; j >= i+1; j--)
		{
			if(c1[j-1].num > c1[j].num)
			{
				swap(c1[j-1], c1[j]);
			}
		}
	}

	for(int i = 0; i < n; i++)
	{
		mini = i;
		for(int j = i; j < n; j++)
		{
			if(c2[mini].num > c2[j].num)
			{
				mini = j;
			}
		}
		if(mini != i)
		{
			swap(c[mini], c[i]);
		}
	}

	for(int i = 0; i < n-1; i++)
	{
		cout << c1[i].suit << c1[i].num << ' ';
	}
	cout << c1[n-1].suit << c1[n-1].num << endl;
	cout << "Stable\n";

	for(int i = 0; i < n-1; i++)
	{
		cout << c2[i].suit << c2[i].num << ' ';
	}
	cout << c2[n-1].suit << c2[n-1].num << endl;

	if(isEqual(c1, c2, n))
	{
		cout << "Stable\n";
	}
	else
	{
		cout << "Not stable\n";
	}

}


Compiler output:
a.cc: In function 'int main()':
a.cc:70:30: error: 'c' was not declared in this scope
   70 |                         swap(c[mini], c[i]);
      |                              ^
Language: C++

#include <iostream>
#include <cmath>
#include <string>
#include <string.h>
#include <cstdlib>
#include <iomanip>
#include <stdio.h>
#include <climits>

using namespace std;

struct card {
  char suite;
  int num;
};

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) {
         struct card tmp;
         memcpy(&tmp,&C[j],sizeof(card));
         memcpy(&C[j],&C[j-1],sizeof(card));
         memcpy(&C[j-1],&tmp,sizeof(card));
       }
     }
  }
}

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].num < C[minj].num)
         minj = j;
    }
    if(minj != i){
    struct card tmp;
    memcpy(&tmp,&C[i],sizeof(card));
    memcpy(&C[i],&C[minj],sizeof(card));
    memcpy(&C[minj],&tmp,sizeof(card));
    }
  }
}

int main(){
  int n;
  struct card *bubble,*selection;

  scanf("%d\n",&n);

  bubble=(struct card*)malloc(n*sizeof(card));
  selection=(struct card*)malloc(n*sizeof(card));

  for(int i=0;i<n;i++){
    scanf("%c%d ",&bubble[i].suite,&bubble[i].num);
  }

  memcpy(selection,bubble,n*sizeof(card));
  BubbleSort(bubble,n);
  for(int i=0;i<n;i++){
    printf("%c%d",bubble[i].suite,bubble[i].num);
    if(i<n-1)
      putchar(' ');
  }
  puts("\nStable");

  SelectionSort(selection,n);
  for(int i=0;i<n;i++){
    printf("%c%d",selection[i].suite,selection[i].num);
    if(i<n-1)
      putchar(' ');
  }

  for(int i=0;i<n;i++){
    if(bubble[i].suite!=selection[i].suite || bubble[i].num != selection[i].num) {
      puts("\nNot stable");
      return 0;
    }
  }
  puts("Stable");


Compiler output:
a.cc: In function 'int main()':
a.cc:81:18: error: expected '}' at end of input
   81 |   puts("Stable");
      |                  ^
a.cc:46:11: note: to match this '{'
   46 | int main(){
      |           ^
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) {
	int 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 'void swap(card*, int, int)':
a.cc:22:22: error: cannot convert 'card' to 'int' in initialization
   22 |         int tmp = a[i];
      |                   ~~~^
      |                      |
      |                      card
a.cc:24:16: error: no match for 'operator=' (operand types are 'card' and 'int')
   24 |         a[j] = tmp;
      |                ^~~
a.cc:14:8: note: candidate: 'constexpr card& card::operator=(const card&)'
   14 | struct card {
      |        ^~~~
a.cc:14:8: note:   no known conversion for argument 1 from 'int' to 'const card&'
a.cc:14:8: note: candidate: 'constexpr card& card::operator=(card&&)'
a.cc:14:8: note:   no known conversion for argument 1 from 'int' to 'card&&'
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