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

#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <string>
static const int MAX = 200000;
using namespace std;

struct Card {char suit, value;};

void trace(Card a[], int n){
  for(int i = 0; i < n; i++){
    if(i) cout << " ";
    cout << a[i].suit << a[i].value;
  }
  cout << endl;
}

void sSort(Card a[], int n){
  for(int i=0; i < n; i++){
    int mini = i;
    for(int j=i+1; j<n; j++){
      if(a[mini].value > a[j].value){
        mini = j;
      }
    }
    if(mini != i){
      swap(a[mini], a[i]);
    }
  }
}

void bSort(Card b[], int n){
  for(int i=0; i<n; i++){
    for(int j = n-1; j >= i+1; j--){
      if(b[j-1].value > b[j].value){
        swap(b[j-1], b[j]);
      }
    }
  }
}

bool isStable(Card a[], Card b[],int n){
  for(int i=0; i<n; i++){
    if(a[i].suit != b[i].suit) return false;
  }
  return true;
}


int main(int argc, const char * argv[]) {
  int n;
  Card a[MAX], b[MAX];
  
  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> a[i].suit >> a[i].value;
  }
  
  memcpy(b, a, sizeof(a));
  
  sSort(a, n);
  bSort(b, n);
  
  trace(b, n);
  cout << "Stable" << endl;
  trace(a, n);
  if(isStable(a,b,n)){
    cout << "Stable" << endl;
  } else{
    cout << "Not Stable" << endl;
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:59:3: error: 'memcpy' was not declared in this scope
   59 |   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 <algorithm>
  +++ |+#include <cstring>
    3 | #include <stdio.h>
Language: C++

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

static const int MAX = 200000;
using namespace std;

struct Card {char suit, value;};

void trace(Card a[], int n){
  for(int i = 0; i < n; i++){
    if(i) cout << " ";
    cout << a[i].suit << a[i].value;
  }
  cout << endl;
}

void sSort(Card a[], int n){
  for(int i=0; i < n; i++){
    int mini = i;
    for(int j=i+1; j<n; j++){
      if(a[mini].value > a[j].value){
        mini = j;
      }
    }
    if(mini != i){
      swap(a[mini], a[i]);
    }
  }
}

void bSort(Card b[], int n){
  for(int i=0; i<n; i++){
    for(int j = n-1; j >= i+1; j--){
      if(b[j-1].value > b[j].value){
        swap(b[j-1], b[j]);
      }
    }
  }
}

bool isStable(Card a[], Card b[],int n){
  for(int i=0; i<n; i++){
    if(a[i].suit != b[i].suit) return false;
  }
  return true;
}


int main(int argc, const char * argv[]) {
  int n;
  Card a[MAX], b[MAX];
  
  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> a[i].suit >> a[i].value;
  }
  
  memcpy(b, a, sizeof(a));
  
  sSort(a, n);
  bSort(b, n);
  
  trace(b, n);
  cout << "Stable" << endl;
  trace(a, n);
  if(isStable(a,b,n)){
    cout << "Stable" << endl;
  } else{
    cout << "Not Stable" << endl;
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:60:3: error: 'memcpy' was not declared in this scope
   60 |   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 <algorithm>
  +++ |+#include <cstring>
    3 | #include <stdio.h>
Language: C++

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

static const int MAX = 200000;
using namespace std;

struct Card {char suit, value;};

void trace(Card a[], int n){
  for(int i = 0; i < n; i++){
    if(i) cout << " ";
    cout << a[i].suit << a[i].value;
  }
  cout << endl;
}

void sSort(Card a[], int n){
  for(int i=0; i < n; i++){
    int mini = i;
    for(int j=i+1; j<n; j++){
      if(a[mini].value > a[j].value){
        mini = j;
      }
    }
    if(mini != i){
      swap(a[mini], a[i]);
    }
  }
}

void bSort(Card b[], int n){
  for(int i=0; i<n; i++){
    for(int j = n-1; j >= i+1; j--){
      if(b[j-1].value > b[j].value){
        swap(b[j-1], b[j]);
      }
    }
  }
}

bool isStable(Card a[], Card b[],int n){
  for(int i=0; i<n; i++){
    if(a[i].suit != b[i].suit) return false;
  }
  return true;
}


int main(int argc, const char * argv[]) {
  int n;
  Card a[MAX], b[MAX];
  
  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> a[i].suit >> a[i].value;
  }
  
  std::memcpy(b, a, sizeof(a));
  
  sSort(a, n);
  bSort(b, n);
  
  trace(b, n);
  cout << "Stable" << endl;
  trace(a, n);
  if(isStable(a,b,n)){
    cout << "Stable" << endl;
  } else{
    cout << "Not Stable" << endl;
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:60:8: error: 'memcpy' is not a member of 'std'; did you mean 'wmemcpy'?
   60 |   std::memcpy(b, a, sizeof(a));
      |        ^~~~~~
      |        wmemcpy
Language: C++

#include <stdio.h>
#include <algorithm>

using namespace std;

struct TRAMP{
    char mark;
    int number;
};

int main()
{
  int n,min;
  char buf[3];
  scanf("%d",&n);

  TRAMP selectArray[n],bubbleArray[n];

  for(int i=0;i<n;i++){
    scanf("%s",buf);
    selectArray[i].mark=buf[0];
    selectArray[i].number=buf[1]-'0';
    selectArray[i]=selectArray[i];
  }

  for(int i=n-1;i>=0;i--){
    for(int j=0;j<i;j++){
      if(bubbleArray[j].number>bubbleArray[j+1].number) swap(bubbleArray[j],bubbleArray[j+1]);
    }
  }
  for(int i = 0; i < n-1; i++){
        min = i;
        for(int j = i+1; j < n; j++){
            if(selectArray[j].number < selectArray[min].number){
                min = j;
            }
        }
        if(i != min){
            swap(selectArray[i],selectArray[min]);
        }
    }

    for(int i=0;i<n-1;i++) printf("%c%d ",bubbleArray[i].mark,bubbleArray[i].number);
    printf("%c%d\n",bubbleArray[n-1].mark,bubbleArray[n-1].number);
    printf("Stable\n");
    for(int i=0;i<n-1;i++) printf("%c%d "selectArray[i].mark,selectArray[i].number);
    printf("%c%d\n",selectArray[n-1].mark,selectArray[n-1].number);

    int p;
    for(p=0;p<n;p++){
      if(selectArray[p].number!=bubbleArray[p].number||selectArray[p].mark!=bubbleArray[p].mark)
        break;
    }
    if(p==n){
      printf("Stable\n");
    }else{
      printf("Not stable\n");
    }
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:46:35: error: unable to find string literal operator 'operator""selectArray' with 'const char [6]', 'long unsigned int' arguments
   46 |     for(int i=0;i<n-1;i++) printf("%c%d "selectArray[i].mark,selectArray[i].number);
      |                                   ^~~~~~~~~~~~~~~~~~
Language: C++

def bubble(A):
    flag=True;
    n=len(A)
    i=0
    while flag:
        for j in range(n-1,i,-1):
            if A[j][1]<A[j-1][1]:
                A[j],A[j-1]=A[j-1],A[j]
                flag=True
        i+=1

def selection(A):
    n=len(A)
    for i in range(n):
        minj=i
        for j in range(i,n):
            if A[j][1]<A[minj][1]:
        if i!=minj:
            A[i],A[minj]=A[minj],A[i]


n=int(input())
ss=[x for x in input().split()]
ss2=ss.copy()

bubble(ss)
for i in range(len(ss)-1):
    print(ss[i],end=' ')
print(ss[-1])
print('Stable')

selection(ss2)
for i in range(len(ss2)-1):
    print(ss2[i],end=' ')
print(ss2[-1])
if ss=ss2:
    print('Stable')
else:
    print('Not stable')


Compiler output:
a.cc:30:7: warning: multi-character literal with 6 characters exceeds 'int' size of 4 bytes
   30 | print('Stable')
      |       ^~~~~~~~
a.cc:37:11: warning: multi-character literal with 6 characters exceeds 'int' size of 4 bytes
   37 |     print('Stable')
      |           ^~~~~~~~
a.cc:39:11: warning: multi-character literal with 10 characters exceeds 'int' size of 4 bytes
   39 |     print('Not stable')
      |           ^~~~~~~~~~~~
a.cc:1:1: error: 'def' does not name a type
    1 | def bubble(A):
      | ^~~
a.cc:3:5: error: 'n' does not name a type
    3 |     n=len(A)
      |     ^
Language: C++

#include <iostream>
#include <algorithm>

using namespace std;

Struct Card {
	unsigned int c;
	unsigned int n;
} card;
// unsigned int e[101];
// unsigned int d[101];
unsigned char e[101][2];
unsigned char d[101][2];

bublesort(unsigned char d[][2], unsigned int n)
{
	unsigned int num = 0;

	bool flag = true;
	while (flag) {
		flag = false;
		for (unsigned int i = n-1; i > 0; --i) {
			if (d[i][1] < d[i-1][1]) {
				char x = d[i-1][1];
				char y = d[i-1][0];
				d[i-1][0] = d[i][0];
				d[i-1][1] = d[i][1];
				d[i][0] = y;
				d[i][1] = x;
				flag = true;
				++num;
			}
		}
	}

	return num;
}

unsigned int selectionsort(unsigned char d[][2], unsigned int n)
{
	unsigned int num = 0;
	for (unsigned int i = 0; i < n; ++i) {
		unsigned int minj = i;
		for (unsigned int j = i+1; j < n; ++j) {
			if (d[j][1] < d[minj][1]) {
				minj = j;
			}
		}
		if (i != minj) {
			char s = d[i][0];
			char t = d[i][1];
			d[i][0] = d[minj][0];
			d[i][1] = d[minj][1];
			d[minj][0] = s;
			d[minj][1] = t;
			++num;
		}
	}

	return num;
}

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

	num = bublesort(e, n);
	for (unsigned int i = 0; i < n - 1; ++i)
		cout << e[i] << " ";
	cout << e[n-1] << "\n" << num << "\n";
	cout << "Stable"<< endl;

	num = selectionsort(d, n);
	for (unsigned int i = 0; i < n - 1; ++i)
		cout << d[i] << " ";
	cout << d[n-1] << "\n" << num << endl;
	bool bStable = true;
	for (unsigned int i = 0; i < n - 1; ++i)
		if (d[i] != e[i])
			eStable = false;

	if (eStable)
		cout << "Stable"<< endl;
	else
		cout << "Not stable"<< endl;

		
	return 0;
}



Compiler output:
a.cc:6:1: error: 'Struct' does not name a type; did you mean 'struct'?
    6 | Struct Card {
      | ^~~~~~
      | struct
a.cc:9:3: error: 'card' does not name a type
    9 | } card;
      |   ^~~~
a.cc:15:1: error: ISO C++ forbids declaration of 'bublesort' with no type [-fpermissive]
   15 | bublesort(unsigned char d[][2], unsigned int n)
      | ^~~~~~~~~
a.cc: In function 'int main()':
a.cc:69:29: error: expected primary-expression before ']' token
   69 |                 cin >> e[i][];
      |                             ^
a.cc:87:25: error: 'eStable' was not declared in this scope; did you mean 'bStable'?
   87 |                         eStable = false;
      |                         ^~~~~~~
      |                         bStable
a.cc:89:13: error: 'eStable' was not declared in this scope; did you mean 'bStable'?
   89 |         if (eStable)
      |             ^~~~~~~
      |             bStable
Language: C++

#include <iostream>
#include <algorithm>

using namespace std;

Struct Card {
	unsigned int c;
	unsigned int n;
} card;
// unsigned int e[101];
// unsigned int d[101];
unsigned char e[101][2];
unsigned char d[101][2];

bublesort(unsigned char d[][2], unsigned int n)
{
	unsigned int num = 0;

	bool flag = true;
	while (flag) {
		flag = false;
		for (unsigned int i = n-1; i > 0; --i) {
			if (d[i][1] < d[i-1][1]) {
				char x = d[i-1][1];
				char y = d[i-1][0];
				d[i-1][0] = d[i][0];
				d[i-1][1] = d[i][1];
				d[i][0] = y;
				d[i][1] = x;
				flag = true;
				++num;
			}
		}
	}

	return num;
}

unsigned int selectionsort(unsigned char d[][2], unsigned int n)
{
	unsigned int num = 0;
	for (unsigned int i = 0; i < n; ++i) {
		unsigned int minj = i;
		for (unsigned int j = i+1; j < n; ++j) {
			if (d[j][1] < d[minj][1]) {
				minj = j;
			}
		}
		if (i != minj) {
			char s = d[i][0];
			char t = d[i][1];
			d[i][0] = d[minj][0];
			d[i][1] = d[minj][1];
			d[minj][0] = s;
			d[minj][1] = t;
			++num;
		}
	}

	return num;
}

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

	num = bublesort(e, n);
	for (unsigned int i = 0; i < n - 1; ++i)
		cout << e[i] << " ";
	cout << e[n-1] << "\n" << num << "\n";
	cout << "Stable"<< endl;

	num = selectionsort(d, n);
	for (unsigned int i = 0; i < n - 1; ++i)
		cout << d[i] << " ";
	cout << d[n-1] << "\n" << num << endl;
	bool bStable = true;
	for (unsigned int i = 0; i < n - 1; ++i)
		if (d[i] != e[i])
			bStable = false;

	if (bStable)
		cout << "Stable"<< endl;
	else
		cout << "Not stable"<< endl;

		
	return 0;
}



Compiler output:
a.cc:6:1: error: 'Struct' does not name a type; did you mean 'struct'?
    6 | Struct Card {
      | ^~~~~~
      | struct
a.cc:9:3: error: 'card' does not name a type
    9 | } card;
      |   ^~~~
a.cc:15:1: error: ISO C++ forbids declaration of 'bublesort' with no type [-fpermissive]
   15 | bublesort(unsigned char d[][2], unsigned int n)
      | ^~~~~~~~~
a.cc: In function 'int main()':
a.cc:69:29: error: expected primary-expression before ']' token
   69 |                 cin >> e[i][];
      |                             ^
Language: C++

#include <iostream>
#include <algorithm>

using namespace std;


// unsigned int e[101];
// unsigned int d[101];
unsigned char e[101][2];
unsigned char d[101][2];

bublesort(unsigned char d[][2], unsigned int n)
{
	unsigned int num = 0;

	bool flag = true;
	while (flag) {
		flag = false;
		for (unsigned int i = n-1; i > 0; --i) {
			if (d[i][1] < d[i-1][1]) {
				char x = d[i-1][1];
				char y = d[i-1][0];
				d[i-1][0] = d[i][0];
				d[i-1][1] = d[i][1];
				d[i][0] = y;
				d[i][1] = x;
				flag = true;
				++num;
			}
		}
	}

	return num;
}

unsigned int selectionsort(unsigned char d[][2], unsigned int n)
{
	unsigned int num = 0;
	for (unsigned int i = 0; i < n; ++i) {
		unsigned int minj = i;
		for (unsigned int j = i+1; j < n; ++j) {
			if (d[j][1] < d[minj][1]) {
				minj = j;
			}
		}
		if (i != minj) {
			char s = d[i][0];
			char t = d[i][1];
			d[i][0] = d[minj][0];
			d[i][1] = d[minj][1];
			d[minj][0] = s;
			d[minj][1] = t;
			++num;
		}
	}

	return num;
}

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

	num = bublesort(e, n);
	for (unsigned int i = 0; i < n - 1; ++i)
		cout << e[i] << " ";
	cout << e[n-1] << "\n" << num << "\n";
	cout << "Stable"<< endl;

	num = selectionsort(d, n);
	for (unsigned int i = 0; i < n - 1; ++i)
		cout << d[i] << " ";
	cout << d[n-1] << "\n" << num << endl;
	bool bStable = true;
	for (unsigned int i = 0; i < n - 1; ++i)
		if (d[i] != e[i])
			bStable = false;

	if (bStable)
		cout << "Stable"<< endl;
	else
		cout << "Not stable"<< endl;

		
	return 0;
}



Compiler output:
a.cc:12:1: error: ISO C++ forbids declaration of 'bublesort' with no type [-fpermissive]
   12 | bublesort(unsigned char d[][2], unsigned int n)
      | ^~~~~~~~~
a.cc: In function 'int main()':
a.cc:66:29: error: expected primary-expression before ']' token
   66 |                 cin >> e[i][];
      |                             ^
Language: C++

#include <iostream>
#include <algorithm>

using namespace std;

// unsigned int e[101];
// unsigned int d[101];
unsigned char e[101][2];
unsigned char d[101][2];

bublesort(unsigned int n)
{
	unsigned int num = 0;

	bool flag = true;
	while (flag) {
		flag = false;
		for (unsigned int i = n-1; i > 0; --i) {
			if (e[i][1] < e[i-1][1]) {
				char x = e[i-1][1];
				char y = e[i-1][0];
				e[i-1][0] = e[i][0];
				e[i-1][1] = e[i][1];
				e[i][0] = y;
				e[i][1] = x;
				flag = true;
				++num;
			}
		}
	}

	return num;
}

unsigned int selectionsort(unsigned int n)
{
	unsigned int num = 0;
	for (unsigned int i = 0; i < n; ++i) {
		unsigned int minj = i;
		for (unsigned int j = i+1; j < n; ++j) {
			if (d[j][1] < d[minj][1]) {
				minj = j;
			}
		}
		if (i != minj) {
			char s = d[i][0];
			char t = d[i][1];
			d[i][0] = d[minj][0];
			d[i][1] = d[minj][1];
			d[minj][0] = s;
			d[minj][1] = t;
			++num;
		}
	}

	return num;
}

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

	num = bublesort(e, n);
	for (unsigned int i = 0; i < n - 1; ++i)
		cout << e[i] << " ";
	cout << e[n-1] << "\n" << num << "\n";
	cout << "Stable"<< endl;

	num = selectionsort(d, n);
	for (unsigned int i = 0; i < n - 1; ++i)
		cout << d[i] << " ";
	cout << d[n-1] << "\n" << num << endl;
	bool bStable = true;
	for (unsigned int i = 0; i < n - 1; ++i)
		if (d[i] != e[i])
			bStable = false;

	if (bStable)
		cout << "Stable"<< endl;
	else
		cout << "Not stable"<< endl;

		
	return 0;
}



Compiler output:
a.cc:11:1: error: ISO C++ forbids declaration of 'bublesort' with no type [-fpermissive]
   11 | bublesort(unsigned int n)
      | ^~~~~~~~~
a.cc: In function 'int main()':
a.cc:65:29: error: expected primary-expression before ']' token
   65 |                 cin >> e[i][];
      |                             ^
a.cc:70:25: error: invalid conversion from 'unsigned char (*)[2]' to 'unsigned int' [-fpermissive]
   70 |         num = bublesort(e, n);
      |                         ^
      |                         |
      |                         unsigned char (*)[2]
a.cc:70:24: error: too many arguments to function 'int bublesort(unsigned int)'
   70 |         num = bublesort(e, n);
      |               ~~~~~~~~~^~~~~~
a.cc:11:1: note: declared here
   11 | bublesort(unsigned int n)
      | ^~~~~~~~~
a.cc:76:29: error: invalid conversion from 'unsigned char (*)[2]' to 'unsigned int' [-fpermissive]
   76 |         num = selectionsort(d, n);
      |                             ^
      |                             |
      |                             unsigned char (*)[2]
a.cc:76:28: error: too many arguments to function 'unsigned int selectionsort(unsigned int)'
   76 |         num = selectionsort(d, n);
      |               ~~~~~~~~~~~~~^~~~~~
a.cc:35:14: note: declared here
   35 | unsigned int selectionsort(unsigned int n)
      |              ^~~~~~~~~~~~~
Language: C++

#include <iostream>
#include <algorithm>

using namespace std;

// unsigned int e[101];
// unsigned int d[101];
unsigned char e[101][2];
unsigned char d[101][2];

unsigned int bublesort(unsigned int n)
{
	unsigned int num = 0;

	bool flag = true;
	while (flag) {
		flag = false;
		for (unsigned int i = n-1; i > 0; --i) {
			if (e[i][1] < e[i-1][1]) {
				char x = e[i-1][1];
				char y = e[i-1][0];
				e[i-1][0] = e[i][0];
				e[i-1][1] = e[i][1];
				e[i][0] = y;
				e[i][1] = x;
				flag = true;
				++num;
			}
		}
	}

	return num;
}

unsigned int selectionsort(unsigned int n)
{
	unsigned int num = 0;
	for (unsigned int i = 0; i < n; ++i) {
		unsigned int minj = i;
		for (unsigned int j = i+1; j < n; ++j) {
			if (d[j][1] < d[minj][1]) {
				minj = j;
			}
		}
		if (i != minj) {
			char s = d[i][0];
			char t = d[i][1];
			d[i][0] = d[minj][0];
			d[i][1] = d[minj][1];
			d[minj][0] = s;
			d[minj][1] = t;
			++num;
		}
	}

	return num;
}

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

	num = bublesort(e, n);
	for (unsigned int i = 0; i < n - 1; ++i)
		cout << e[i] << " ";
	cout << e[n-1] << "\n" << num << "\n";
	cout << "Stable"<< endl;

	num = selectionsort(d, n);
	for (unsigned int i = 0; i < n - 1; ++i)
		cout << d[i] << " ";
	cout << d[n-1] << "\n" << num << endl;
	bool bStable = true;
	for (unsigned int i = 0; i < n - 1; ++i)
		if (d[i] != e[i])
			bStable = false;

	if (bStable)
		cout << "Stable"<< endl;
	else
		cout << "Not stable"<< endl;

		
	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:65:29: error: expected primary-expression before ']' token
   65 |                 cin >> e[i][];
      |                             ^
a.cc:70:25: error: invalid conversion from 'unsigned char (*)[2]' to 'unsigned int' [-fpermissive]
   70 |         num = bublesort(e, n);
      |                         ^
      |                         |
      |                         unsigned char (*)[2]
a.cc:70:24: error: too many arguments to function 'unsigned int bublesort(unsigned int)'
   70 |         num = bublesort(e, n);
      |               ~~~~~~~~~^~~~~~
a.cc:11:14: note: declared here
   11 | unsigned int bublesort(unsigned int n)
      |              ^~~~~~~~~
a.cc:76:29: error: invalid conversion from 'unsigned char (*)[2]' to 'unsigned int' [-fpermissive]
   76 |         num = selectionsort(d, n);
      |                             ^
      |                             |
      |                             unsigned char (*)[2]
a.cc:76:28: error: too many arguments to function 'unsigned int selectionsort(unsigned int)'
   76 |         num = selectionsort(d, n);
      |               ~~~~~~~~~~~~~^~~~~~
a.cc:35:14: note: declared here
   35 | unsigned int selectionsort(unsigned int n)
      |              ^~~~~~~~~~~~~
Language: C++

#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

// unsigned int e[101];
// unsigned int d[101];
unsigned char e[101][2];
unsigned char d[101][2];

unsigned int bublesort(unsigned int n)
{
	unsigned int num = 0;

	bool flag = true;
	while (flag) {
		flag = false;
		for (unsigned int i = n-1; i > 0; --i) {
			if (e[i][1] < e[i-1][1]) {
				char x = e[i-1][1];
				char y = e[i-1][0];
				e[i-1][0] = e[i][0];
				e[i-1][1] = e[i][1];
				e[i][0] = y;
				e[i][1] = x;
				flag = true;
				++num;
			}
		}
	}

	return num;
}

unsigned int selectionsort(unsigned int n)
{
	unsigned int num = 0;
	for (unsigned int i = 0; i < n; ++i) {
		unsigned int minj = i;
		for (unsigned int j = i+1; j < n; ++j) {
			if (d[j][1] < d[minj][1]) {
				minj = j;
			}
		}
		if (i != minj) {
			char s = d[i][0];
			char t = d[i][1];
			d[i][0] = d[minj][0];
			d[i][1] = d[minj][1];
			d[minj][0] = s;
			d[minj][1] = t;
			++num;
		}
	}

	return num;
}

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

	num = bublesort(e, n);
	for (unsigned int i = 0; i < n - 1; ++i)
		cout << e[i] << " ";
	cout << e[n-1] << "\n" << num << "\n";
	cout << "Stable"<< endl;

	num = selectionsort(d, n);
	for (unsigned int i = 0; i < n - 1; ++i)
		cout << d[i] << " ";
	cout << d[n-1] << "\n" << num << endl;
	bool bStable = true;
	for (unsigned int i = 0; i < n - 1; ++i)
		if (d[i] != e[i])
			bStable = false;

	if (bStable)
		cout << "Stable"<< endl;
	else
		cout << "Not stable"<< endl;

		
	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:72:25: error: invalid conversion from 'unsigned char (*)[2]' to 'unsigned int' [-fpermissive]
   72 |         num = bublesort(e, n);
      |                         ^
      |                         |
      |                         unsigned char (*)[2]
a.cc:72:24: error: too many arguments to function 'unsigned int bublesort(unsigned int)'
   72 |         num = bublesort(e, n);
      |               ~~~~~~~~~^~~~~~
a.cc:12:14: note: declared here
   12 | unsigned int bublesort(unsigned int n)
      |              ^~~~~~~~~
a.cc:78:29: error: invalid conversion from 'unsigned char (*)[2]' to 'unsigned int' [-fpermissive]
   78 |         num = selectionsort(d, n);
      |                             ^
      |                             |
      |                             unsigned char (*)[2]
a.cc:78:28: error: too many arguments to function 'unsigned int selectionsort(unsigned int)'
   78 |         num = selectionsort(d, n);
      |               ~~~~~~~~~~~~~^~~~~~
a.cc:36:14: note: declared here
   36 | unsigned int selectionsort(unsigned int n)
      |              ^~~~~~~~~~~~~
Language: C++

def show(array):
    for i in range(len(array)):
        if (i+1) >= len(array):
            print(array[i])
        else:
            print(array[i], end=' ')


def bubble_sort(c, n):
    for i in range(0, n):
        for j in range(n-1, i, -1):
            if c[j][1:] < c[j-1][1:]:
                c[j], c[j-1] = c[j-1], c[j]

    return c

def selection_sort(c, n):
    for i in range(0, n):
        
        minj = i
        for j in range(i+1, n):
            if c[j][1:] < c[minj][1:]:
                minj = j
        # if i != minj:
        c[i], c[minj] = c[minj], c[i]
    return c


def main():
    N = int(input())
    cards = list(input().split(' '))
    cards2 = cards.copy()

    # value_sorted = sorted(cards, key=lambda x: x[1:])
    bubble_result = bubble_sort(cards, N)
    selection_result = selection_sort(cards2, N)

    show(bubble_result)
    print('Stable')
    show(selection_result)
    if bubble_result == selection_result:
        print('Stable')
    else:
        print('Not stable')


main()


Compiler output:
a.cc:24:23: error:  ':' without preceding '?'
   24 |         # if i != minj:
      |                       ^
a.cc:24: error: unterminated #if
   24 |         # if i != minj:
a.cc:1:1: error: 'def' does not name a type
    1 | def show(array):
      | ^~~
Language: C++

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

string bubbleSort(vector<char> &Mb,vector<int> &Nb, int A);
string selectionSort(vector<char> &Ms,vector<int> &Ns, int A);

int main(void) {
	
	int A;
	cin >> A;

	vector<char> M(A), Mb(A), Ms(A);
	vector<int> N(A), Nb(A), Ns(A);
	for (int i = 0; i < A; i++) cin >> M.at(i) >> N.at(i);

	for (int i = 0; i < A; i++)
	{
		Mb.at(i) = M.at(i);
		Ms.at(i) = M.at(i);
		Nb.at(i) = N.at(i);
		Ns.at(i) = N.at(i);
	}

//	string YN = bubbleSort(Mb, Nb, A);
	for (int i = 0; i < A; i++)
	{
		if (i) cout << " ";
		cout << Mb.at(i) << Nb.at(i);
	}
	cout << endl;
	cout << YN << endl;

//	YN = selectionSort(Ms, Ns, A);
	for (int i = 0; i < A; i++)
	{
		if (i) cout << " ";
		cout << Ms.at(i) << Ns.at(i);
	}
	cout << endl;
	cout << YN << endl;

	return 0;
}


string bubbleSort(vector<char> &Mb, vector<int> &Nb, int A) 
{
	vector<int> Ib(A);
	for (int i = 0; i < A; i++) Ib.at(i) = i;

	for (int i = 0; i < A-1; i++)
	{
		for (int j = A-1; i <= j; j--)
		{
			if (Nb.at(j) < Nb.at(j - 1)) {
				swap(Nb.at(j), Nb.at(j - 1));
				swap(Mb.at(j), Mb.at(j - 1));
				swap(Ib.at(j), Ib.at(j - 1));
			}
		}
	}

	for (int i = 0; i < A; i++)
	{
		if (Nb.at(i) == Nb.at(i + 1))
		{
			if (Ib.at(i) > Ib.at(i + 1))
			{
				return "Not stable";
			}
		}
	}

	return "Stable";
}

string selectionSort(vector<char>& Ms, vector<int>& Ns, int A)
{
	vector<int> Is(A);
	for (int i = 0; i < A; i++) Is.at(i) = i;

	for (int i = 0; i < A - 1; i++)
	{
		int minN = i;
		for (int j = i + 1; j < A; j++)
		{
			if (Ns.at(j) < Ns.at(minN))
			{
				minN = j;
			}
		}

		if (minN != i)
		{
			swap(Ms.at(i), Ms.at(minN));
			swap(Ns.at(i), Ns.at(minN));
			swap(Is.at(i), Is.at(minN));
		}
	}

	for (int i = 0; i < A; i++)
	{
		if (Ns.at(i) == Ns.at(i + 1))
		{
			if (Is.at(i) > Is.at(i + 1))
			{
				return "Not stable";
			}
		}
	}

	return "Stable";

}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:17: error: 'YN' was not declared in this scope; did you mean 'N'?
   31 |         cout << YN << endl;
      |                 ^~
      |                 N
Language: C++

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

string bubbleSort(vector<char> &Mb,vector<int> &Nb, int A);
string selectionSort(vector<char> &Ms,vector<int> &Ns, int A);

int main(void) {
	
	int A;
	cin >> A;

	vector<char> M(A), Mb(A), Ms(A);
	vector<int> N(A), Nb(A), Ns(A);
	for (int i = 0; i < A; i++) cin >> M.at(i) >> N.at(i);

	for (int i = 0; i < A; i++)
	{
		Mb.at(i) = M.at(i);
		Ms.at(i) = M.at(i);
		Nb.at(i) = N.at(i);
		Ns.at(i) = N.at(i);
	}

//	string YN = bubbleSort(Mb, Nb, A);
	for (int i = 0; i < A; i++)
	{
		if (i) cout << " ";
		cout << Mb.at(i) << Nb.at(i);
	}
	cout << endl;
	cout << YN << endl;

//	YN = selectionSort(Ms, Ns, A);
	for (int i = 0; i < A; i++)
	{
		if (i) cout << " ";
		cout << Ms.at(i) << Ns.at(i);
	}
	cout << endl;
//	cout << YN << endl;

	return 0;
}


string bubbleSort(vector<char> &Mb, vector<int> &Nb, int A) 
{
	vector<int> Ib(A);
	for (int i = 0; i < A; i++) Ib.at(i) = i;

	for (int i = 0; i < A-1; i++)
	{
		for (int j = A-1; i <= j; j--)
		{
			if (Nb.at(j) < Nb.at(j - 1)) {
				swap(Nb.at(j), Nb.at(j - 1));
				swap(Mb.at(j), Mb.at(j - 1));
				swap(Ib.at(j), Ib.at(j - 1));
			}
		}
	}

	for (int i = 0; i < A; i++)
	{
		if (Nb.at(i) == Nb.at(i + 1))
		{
			if (Ib.at(i) > Ib.at(i + 1))
			{
				return "Not stable";
			}
		}
	}

	return "Stable";
}

string selectionSort(vector<char>& Ms, vector<int>& Ns, int A)
{
	vector<int> Is(A);
	for (int i = 0; i < A; i++) Is.at(i) = i;

	for (int i = 0; i < A - 1; i++)
	{
		int minN = i;
		for (int j = i + 1; j < A; j++)
		{
			if (Ns.at(j) < Ns.at(minN))
			{
				minN = j;
			}
		}

		if (minN != i)
		{
			swap(Ms.at(i), Ms.at(minN));
			swap(Ns.at(i), Ns.at(minN));
			swap(Is.at(i), Is.at(minN));
		}
	}

	for (int i = 0; i < A; i++)
	{
		if (Ns.at(i) == Ns.at(i + 1))
		{
			if (Is.at(i) > Is.at(i + 1))
			{
				return "Not stable";
			}
		}
	}

	return "Stable";

}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:17: error: 'YN' was not declared in this scope; did you mean 'N'?
   31 |         cout << YN << endl;
      |                 ^~
      |                 N
Language: C++

#include <iostream>
#include <algorithm>

using namespace std;

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

void bubbleSort(string r[], int n) {
    for (int i = 0; i < n - 1; i++) {
        for (int j = n - 1; j >= i + 1; j--) {
            if (r[j][1] < r[j - 1][1]) {
                swap(r[j], r[j - 1]);
            }
        }
    }
}

void selectionSort(string r[], int n) {
    for (int i = 0; i < n - 1; i++) {
        int minj = i;
        for (int j = i; j < n; j++) {
            if (r[minj][1] > r[j][1]) minj = j;
        }
        swap(r[minj], r[i]);
    }
}

void stableOrNot(string in[], string out[], int n) {
    for (int i = 0; i < n - 1; i++) {
        for (int j = 1; j < n - 1; j++) {
            for (int a = 0; a < n - 1; a++) {
                for (int b = a + 1; b < n - 1; b++) {
                    if (in[i][1] == in[j][1]) {
                        if (in[i] == out[b] && in[j] == out[a]) {
                            cout << "Not stable" << endl;
                            return;
                        }
                    }
                }
            }
        }
    }
    cout << "Stable" << endl;
    return;
}

// stable sort
int main() {
    int n;
    cin >> n;
    string r[n], r1[n], r2[n];
    for (int i = 0; i < n; i++) cin >> r[i];

    memcpy(r1, r, sizeof(r));
    bubbleSort(r1, n); // stable
    trace(r1, n);
    stableOrNot(r, r1, n);

    memcpy(r2, r, sizeof(r));
    selectionSort(r2, n); // not stable
    trace(r2, n);
    stableOrNot(r, r2, n);
    return 0;
}



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

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

using namespace std;

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

void bubbleSort(string r[], int n) {
    for (int i = 0; i < n - 1; i++) {
        for (int j = n - 1; j >= i + 1; j--) {
            if (r[j][1] < r[j - 1][1]) {
                swap(r[j], r[j - 1]);
            }
        }
    }
}

void selectionSort(string r[], int n) {
    for (int i = 0; i < n - 1; i++) {
        int minj = i;
        for (int j = i; j < n; j++) {
            if (r[minj][1] > r[j][1]) minj = j;
        }
        swap(r[minj], r[i]);
    }
}

void stableOrNot(string in[], string out[], int n) {
    for (int i = 0; i < n - 1; i++) {
        for (int j = 1; j < n - 1; j++) {
            for (int a = 0; a < n - 1; a++) {
                for (int b = a + 1; b < n - 1; b++) {
                    if (in[i][1] == in[j][1]) {
                        if (in[i] == out[b] && in[j] == out[a]) {
                            cout << "Not stable" << endl;
                            return;
                        }
                    }
                }
            }
        }
    }
    cout << "Stable" << endl;
    return;
}

// stable sort
int main() {
    int n;
    cin >> n;
    string r[n], r1[n], r2[n];
    for (int i = 0; i < n; i++) cin >> r[i];

    memcpy(r1, r, sizeof(r));
    bubbleSort(r1, n); // stable
    trace(r1, n);
    stableOrNot(r, r1, n);

    memcpy(r2, r, sizeof(r));
    selectionSort(r2, n); // not stable
    trace(r2, n);
    stableOrNot(r, r2, n);
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:61:5: error: 'memcpy' was not declared in this scope
   61 |     memcpy(r1, r, sizeof(r));
      |     ^~~~~~
a.cc:4:1: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <array>
  +++ |+#include <cstring>
    4 |
Language: C++

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

using namespace std;
static const int MAX = 36;

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

void bubbleSort(string r[], int n) {
    for (int i = 0; i < n - 1; i++) {
        for (int j = n - 1; j >= i + 1; j--) {
            if (r[j][1] < r[j - 1][1]) {
                swap(r[j], r[j - 1]);
            }
        }
    }
}

void selectionSort(string r[], int n) {
    for (int i = 0; i < n - 1; i++) {
        int minj = i;
        for (int j = i; j < n; j++) {
            if (r[minj][1] > r[j][1]) minj = j;
        }
        swap(r[minj], r[i]);
    }
}

bool isStable(string in[], string out[], int n) {
    for (int i = 0; i < n - 1; i++) {
        for (int j = 1; j < n - 1; j++) {
            for (int a = 0; a < n - 1; a++) {
                for (int b = a + 1; b < n - 1; b++) {
                    if (in[i][1] == in[j][1]) {
                        if (in[i] == out[b] && in[j] == out[a]) return false;
                    }
                }
            }
        }
    }
    return true;
}

// stable sort
int main() {
    int n;
    cin >> n;
    string r[MAX];
    for (int i = 0; i < n; i++) cin >> r[i];

    memcpy(r1, r, sizeof(r));
    memcpy(r2, r, sizeof(r));

    bubbleSort(r1, n); // stable
    trace(r1, n);
    if (isStable(r, r1, n)) {
        cout << "Stable" << endl;
    } else {
        cout << "Not stable" << endl;
    }

    selectionSort(r2, n); // not stable
    trace(r2, n);
    if (isStable(r, r2, n)) {
        cout << "Stable" << endl;
    } else {
        cout << "Not stable" << endl;
    }

    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:58:12: error: 'r1' was not declared in this scope; did you mean 'r'?
   58 |     memcpy(r1, r, sizeof(r));
      |            ^~
      |            r
a.cc:59:12: error: 'r2' was not declared in this scope; did you mean 'r'?
   59 |     memcpy(r2, r, sizeof(r));
      |            ^~
      |            r
Language: C++

#include<iostream>
using namespace std;
struct{
	char suit;
	int num;
}typedef Card;

bool isStable(Card* a1,Card* a2,int n){
	for(int i = 0;i < n;i++){
		if(a1[i].suit != a2[i].suit)
			return false;
	}
	return true;
}

void printArray(Card* a,int n){
	for(int i = 0;i < n;i++){
		cout << a[i].suit << a[i].num << flush;
		if(i != n - 1){
			cout << " " << flush;
		}else{
			cout << endl;
		}
	}
}

void selectionSort(Card* a,int n){
	int minI;
	Card v;
	for(int i = 0;i < n;i++){
		minI = i;
		for(int j = i;j < n;j++){
			if(a[minI].num > a[j].num){
				minI = j;
			}
		}
		v = a[i];
		a[i] = a[minI];
		a[minI] = v;
	}
	printArray(a,n);
}

void bubbleSort(Card* a,int n){
	bool isTraded = true;
	Card v;
	for(int j = 0; j < n; j++){
		for(int i = n - 1;i >= j + 1;i--){
			if(a[i].num < a[i - 1].num){
				v = a[i];
				a[i] = a[i - 1];
				a[i - 1] = v;
			}
		}
	}
	printArray(a,n);
}

int main(){
	int n;
	cin >> n;
	Card* a1 = new Card[n];
	for(int i = 0; i < n;i++){
		cin >> a1[i].suit >> a1[i].num;
	}
	Card* a2 = new Card[n];
	memcpy(a2,a1,n * sizeof(a1[0]));

	bubbleSort(a1,n);
	cout << "Stable" << endl;
	selectionSort(a2,n);
	if(isStable(a1,a2,n)){
		cout << "Stable" << endl;
	}else{
		cout << "Not Stable" << endl;
	}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:67:9: error: 'memcpy' was not declared in this scope
   67 |         memcpy(a2,a1,n * sizeof(a1[0]));
      |         ^~~~~~
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<stdc++.h>
using namespace std;
struct{
	char suit;
	int num;
}typedef Card;

bool isStable(Card* a1,Card* a2,int n){
	for(int i = 0;i < n;i++){
		if(a1[i].suit != a2[i].suit)
			return false;
	}
	return true;
}

void printArray(Card* a,int n){
	for(int i = 0;i < n;i++){
		cout << a[i].suit << a[i].num << flush;
		if(i != n - 1){
			cout << " " << flush;
		}else{
			cout << endl;
		}
	}
}

void selectionSort(Card* a,int n){
	int minI;
	Card v;
	for(int i = 0;i < n;i++){
		minI = i;
		for(int j = i;j < n;j++){
			if(a[minI].num > a[j].num){
				minI = j;
			}
		}
		v = a[i];
		a[i] = a[minI];
		a[minI] = v;
	}
	printArray(a,n);
}

void bubbleSort(Card* a,int n){
	bool isTraded = true;
	Card v;
	for(int j = 0; j < n; j++){
		for(int i = n - 1;i >= j + 1;i--){
			if(a[i].num < a[i - 1].num){
				v = a[i];
				a[i] = a[i - 1];
				a[i - 1] = v;
			}
		}
	}
	printArray(a,n);
}

int main(){
	int n;
	cin >> n;
	Card* a1 = new Card[n];
	for(int i = 0; i < n;i++){
		cin >> a1[i].suit >> a1[i].num;
	}
	Card* a2 = new Card[n];
	memcpy(a2,a1,n * sizeof(a1[0]));

	bubbleSort(a1,n);
	cout << "Stable" << endl;
	selectionSort(a2,n);
	if(isStable(a1,a2,n)){
		cout << "Stable" << endl;
	}else{
		cout << "Not Stable" << endl;
	}
}


Compiler output:
a.cc:1:9: fatal error: stdc++.h: No such file or directory
    1 | #include<stdc++.h>
      |         ^~~~~~~~~~
compilation terminated.
Language: C++

#include<iostream>
#include<string>
using namespace std;
int main(){
    int n, minj;
    bool flag = false;
    cin >> n;
    string a[n], b[n], esc;
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    for(int i=0;i<n;i++){
        b[i] = a[i];
    }
    
    for(int i=0;i<n;i++){
        for(int j=n-1;j>i;j--){
            if(a[j].value < a[j-1].value){
                esc = a[j];
                a[j] = a[j-1];
                a[j-1] = esc;
            }
        }
    }
    
    for(int i=0;i<n;i++){
       minj = i;
       for(int j=i;j<n;j++){
           if(b[j].value < C[minj].value){
               minj = j;
           }
           esc = b[i];
           b[i] = b[minj];
           b[minj] = esc;
       }
    }
    
    for(int i=0;i<n;i++){
        cout << a[i];
        if(i != n-1){
            cout << " ";
        }else{
            cout << endl;
        }
    }
    cout << "Stable" << endl;;
    
    for(int i=0;i<n;i++){
        if(a[i] != b[i]){
            flag = true;
            break;
        }
    }
    
    for(int i=0;i<n;i++){
        cout << b[i];
        if(i != n-1){
            cout << " ";
        }else{
            cout << endl;
        }
        if(flag == true){
            cout << "Not stable" << endl:
        }else{
            cout << "Stable" << ensl;
        }
    }
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:21: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'value'
   18 |             if(a[j].value < a[j-1].value){
      |                     ^~~~~
a.cc:18:36: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'value'
   18 |             if(a[j].value < a[j-1].value){
      |                                    ^~~~~
a.cc:29:20: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'value'
   29 |            if(b[j].value < C[minj].value){
      |                    ^~~~~
a.cc:29:28: error: 'C' was not declared in this scope
   29 |            if(b[j].value < C[minj].value){
      |                            ^
a.cc:63:41: error: expected ';' before ':' token
   63 |             cout << "Not stable" << endl:
      |                                         ^
      |                                         ;
a.cc:65:33: error: 'ensl' was not declared in this scope
   65 |             cout << "Stable" << ensl;
      |                                 ^~~~
Language: C++

#include<iostream>
#include<string>
using namespace std;
int main(){
    int n, minj;
    bool flag = false;
    cin >> n;
    string a[n], b[n], esc;
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    for(int i=0;i<n;i++){
        b[i] = a[i];
    }
    
    for(int i=0;i<n;i++){
        for(int j=n-1;j>i;j--){
            if(a[j].value < a[j-1].value){
                esc = a[j];
                a[j] = a[j-1];
                a[j-1] = esc;
            }
        }
    }
    
    for(int i=0;i<n;i++){
       minj = i;
       for(int j=i;j<n;j++){
           if(b[j].value < b[minj].value){
               minj = j;
           }
           esc = b[i];
           b[i] = b[minj];
           b[minj] = esc;
       }
    }
    
    for(int i=0;i<n;i++){
        cout << a[i];
        if(i != n-1){
            cout << " ";
        }else{
            cout << endl;
        }
    }
    cout << "Stable" << endl;;
    
    for(int i=0;i<n;i++){
        if(a[i] != b[i]){
            flag = true;
            break;
        }
    }
    
    for(int i=0;i<n;i++){
        cout << b[i];
        if(i != n-1){
            cout << " ";
        }else{
            cout << endl;
        }
        if(flag == true){
            cout << "Not stable" << endl:
        }else{
            cout << "Stable" << ensl;
        }
    }
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:21: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'value'
   18 |             if(a[j].value < a[j-1].value){
      |                     ^~~~~
a.cc:18:36: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'value'
   18 |             if(a[j].value < a[j-1].value){
      |                                    ^~~~~
a.cc:29:20: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'value'
   29 |            if(b[j].value < b[minj].value){
      |                    ^~~~~
a.cc:29:36: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'value'
   29 |            if(b[j].value < b[minj].value){
      |                                    ^~~~~
a.cc:63:41: error: expected ';' before ':' token
   63 |             cout << "Not stable" << endl:
      |                                         ^
      |                                         ;
a.cc:65:33: error: 'ensl' was not declared in this scope
   65 |             cout << "Stable" << ensl;
      |                                 ^~~~
Language: C++

#include<iostream>
#include<string>
using namespace std;
int main(){
    int n, minj;
    bool flag = false;
    cin >> n;
    string a[n], b[n], esc;
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    for(int i=0;i<n;i++){
        b[i] = a[i];
    }
    
    for(int i=0;i<n;i++){
        for(int j=n-1;j>i;j--){
            if(a[j].value < a[j-1].value){
                esc = a[j];
                a[j] = a[j-1];
                a[j-1] = esc;
            }
        }
    }
    
    for(int i=0;i<n;i++){
       minj = i;
       for(int j=i;j<n;j++){
           if(b[j].value < b[minj].value){
               minj = j;
           }
           esc = b[i];
           b[i] = b[minj];
           b[minj] = esc;
       }
    }
    
    for(int i=0;i<n;i++){
        cout << a[i];
        if(i != n-1){
            cout << " ";
        }else{
            cout << endl;
        }
    }
    cout << "Stable" << endl;;
    
    for(int i=0;i<n;i++){
        if(a[i] != b[i]){
            flag = true;
            break;
        }
    }
    
    for(int i=0;i<n;i++){
        cout << b[i];
        if(i != n-1){
            cout << " ";
        }else{
            cout << endl;
        }
        if(flag == true){
            cout << "Not stable" << endl;
        }else{
            cout << "Stable" << ensl;
        }
    }
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:21: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'value'
   18 |             if(a[j].value < a[j-1].value){
      |                     ^~~~~
a.cc:18:36: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'value'
   18 |             if(a[j].value < a[j-1].value){
      |                                    ^~~~~
a.cc:29:20: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'value'
   29 |            if(b[j].value < b[minj].value){
      |                    ^~~~~
a.cc:29:36: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'value'
   29 |            if(b[j].value < b[minj].value){
      |                                    ^~~~~
a.cc:65:33: error: 'ensl' was not declared in this scope
   65 |             cout << "Stable" << ensl;
      |                                 ^~~~
Language: C++

#include <iostream>
#include <string>
#define N 100
using namespace std;
void BubbleSort(string s[N],int n)
{
   cout<<
}
void SelectSort(string cs[N],int n,string s[N])
{
    int i,j;
    string temp[N];
    for(i=0;i<n;i++)
    {
        temp[i]=cs[i];
    }
    for(i=0;i<n-1;i++)
    {
        int k=i;
        for(j=i+1;j<n;j++)
        {
            if(cs[j][1]<cs[k][1])
            {
                k=j;
            }

        }
        if(k!=i)
        {
            char temp1,temp2;
            temp2=cs[i][0];
            cs[i][0]=cs[k][0];
            cs[k][0]=temp2;
            temp1=cs[i][1];
            cs[i][1]=cs[k][1];
            cs[k][1]=temp1;
        }
    }
    for(i=0;i<n;i++)
    {
        cout<<cs[i][0]<<cs[i][1];
        if(i!=n-1)
        {
            cout<<" ";
        }
    }
    cout<<endl;
    bool flag=false;
    for(i=0;i<n;i++)
    {
        if(s[i][0]!=cs[i][0])
        {
            flag=true;
        }
    }
    if(flag)
    {
        cout<<"Not stable"<<endl;
    }
    else
    {
        cout<<"Stable"<<endl;
    }
}
int main()
{
    int n;
    string s[N],cs[N];
    int d=0;
    while(cin>>n)
    {
        int i;
        for(i=0;i<n;i++)
        {
            cin>>s[i][0]>>s[i][1];
            cs[i][0]=s[i][0];
            cs[i][1]=s[i][1];
        }
        BubbleSort(s,n);
        SelectSort(cs,n,s);
    }
    return 0;
}

Compiler output:
a.cc: In function 'void BubbleSort(std::string*, int)':
a.cc:8:1: error: expected primary-expression before '}' token
    8 | }
      | ^
Language: C++

struct Ca{char suit,value};

void BubbleSort(C, N){
int tmp;
   for(int i = 0 t;i< N;i++){
     for(int j = N-1;j>=0;j++){
       if( C[j]< C[j-1]){
         tmp=C[j];C[j]=C[j-1];C[j-1]=tmp;}
}
        

void SelectionSort(C, N)
int j,i,tmp,minj;  
 for(i = 0 t;i< N;i++){
     minj = i
    for( j = i ;j< N-1;j++){
      if (C[j] < C[minj]){
       minj = j
tmp=C[i];C[i]=C[minj];C[minj]=tmp;}
}}
    
bool isStable(struct Ca c1[],struct Ca c1[],int N)
for(int i=0;i<N;i++){
if(c1[i].suit!=c2[i].suit)return false;
return true;
}
int main(){
Ca ca[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];
bublle(c1,N);
select(c2,N);

for(int i=0;i<N;i++){
if(i>0)cout<<" ";
cout<<c1[i].suit<<c1[i].value;
}
cout<<endl;
cout<<"Stable"<<endl;

for(int i=0;i<N;i++){
if(i>0)cout<<" ";
cout<<c2[i].suit<<c2[i].value;
}
cout<<endl;
if(isStable(c1,c2,N){
cout<<"Stable"<<endl;
}else{
cout<<"Not stable"<<endl;
}
return 0;
}

Compiler output:
a.cc:1:21: error: expected ';' at end of member declaration
    1 | struct Ca{char suit,value};
      |                     ^~~~~
      |                          ;
a.cc:3:6: error: variable or field 'BubbleSort' declared void
    3 | void BubbleSort(C, N){
      |      ^~~~~~~~~~
a.cc:3:17: error: 'C' was not declared in this scope; did you mean 'Ca'?
    3 | void BubbleSort(C, N){
      |                 ^
      |                 Ca
a.cc:3:20: error: 'N' was not declared in this scope
    3 | void BubbleSort(C, N){
      |                    ^