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

#include<iostream>
#define INF 2000000000
typedef struct{
  char c;
  long long n;
}data;
int partition(data*,int,int);
void quickSort(data*,int,int);
void merge(long long*,int,int,int);
void mergeSort(data*,int,int);
int main(){
  int n;
  std::cin>>n;
  data A[n],B[n];
  for(int i=0;i<n;i++){
    std::cin>>A[i].c>>A[i].n;
    B[i]=A[i];
  }
  quickSort(A,0,n);
  mergeSort(B,0,n);
  bool stable=true;
  for(int i=0;i<n;i++){
    if(A[i].c!=B[i].c){
      stable=false;
      break;
    }
  }
  std::cout<<(stable?"Stable\n":"Not stable\n");
  for(int i=0;i<n;i++) std::cout<<A[i].c<<" "<<A[i].n<<"\n";
  return 0;
}
int partition(data *A,int p,int r){
  long long x=A[r].n,i=p-1;
  data tmp;
  for(int j=p;j<=r-1;j++){
    if(A[j].n<=x){
      i=i+1;
      tmp=A[i];
      A[i]=A[j];
      A[j]=tmp;
    }
  }
  tmp=A[i+1];
  A[i+1]=A[r];
  A[r]=tmp;
  return i+1;
}
void quickSort(data *A, int p, long long r){
  long long q;
  if(p < r){
    q = partition(A, p, r);
    quickSort(A, p, q-1);
    quickSort(A, q+1, r);
  }
}
void merge(data *A,int l,int m,int r){
  int n1=m-l,n2=r-m, i, j;
  data L[n1+1],R[n2+1];
  for(i=0;i<n1;i++) L[i]=A[l+i];
  for(i=0;i<n2;i++) R[i]=A[m+i];
  L[n1].n=R[n2].n=INF;
  i=j=0;
  for(int k=l;k<r;k++){
    if(L[i].n<=R[j].n){
      A[k]=L[i];
      i++;
    }
    else{
      A[k]=R[j];
      j++;
    }
  }
}
void mergeSort(data *A,int l,int r){
  int m;
  if(l+1<r){
    m=(l+r)/2;
    mergeSort(A,l,m);
    mergeSort(A,m,r);
    merge(A,l,m,r);
  }
}

Compiler output:
/usr/bin/ld: /tmp/ccFQIEah.o: in function `main':
a.cc:(.text+0x15d): undefined reference to `quickSort(data*, int, int)'
collect2: error: ld returned 1 exit status
Language: C++

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

struct Card{
	char a;
	char b;
};

bool compare_as_ints(Card i,Card j){
	return (i,b<j.b);
}

int partition(Card A[],int p,int r){
	Card x=A[r];
	int i=p-1;
	
	for(int j=p;j<=r-1;j++){
		if(A[j].b<=x.b){
			i++;	
			swap(A[i],A[j]);
		}
	}

	swap(A[i+1],A[r]);

	return i+1;
}

void quickSort(Card A[],int p,int r){
	if(p<r){
		int q=partition(A,p,r);
		quickSort(A,p,q-1);
		quickSort(A,q+1,r);
	}
}

int main(){
	int n;
	cin>>n;
	
	Card A[100000],B[100000];
	for(int i=0;i<n;i++){
		cin>>A[i].a>>A[i].b;
		B[i]=A[i];
	}
	
	quickSort(A,0,n-1);
	stable_sort(B,B+n,compare_as_ints);

	for(int i=0;i<n;i++){
		if(A[i].a!=B[i].a){
			cout<<"Not stable"<<endl;
			break;
		}
		if(i==n-1){
			cout<<"Stable"<<endl;
		}
	}
	
	for(int i=0;i<n;i++){
		cout<<A[i].a<<' '<<A[i].b<<endl;
	}
	
	return 0;
}

Compiler output:
a.cc: In function 'bool compare_as_ints(Card, Card)':
a.cc:11:19: error: 'b' was not declared in this scope
   11 |         return (i,b<j.b);
      |                   ^
Language: C++

#include<stdio.h>
#define N 100001
 
typedef struct{
  char mark;
  int num,id;
}Cards;
 
Cards A[N];
 
 
void QuickSort(int p, int r){
  int q;
  if (p<r){
    q = Partition(p,r);
    QuickSort(p,q-1);
    QuickSort(q+1,r);
  }
}
 
int Partition(int p, int r){
  int x,i,j;
  Cards temp;
  x = A[r].num;
  i = p-1;
  for (j=p;j<=r-1;j++){
    if (A[j].num<=x){
      i++;
      temp=A[i];
      A[i]=A[j];
      A[j]=temp;
    }
  }
  temp=A[i+1];
  A[i+1]=A[r];
  A[r]=temp;
  return i+1;
}
 
int main(){
  int n,i,key,flag=0;
  char temp;
  scanf("%d%c",&n,&temp);
  for (i=0;i<n;i++){
    scanf("%c%d%c",&A[i].mark,&A[i].num,&temp);
    A[i].id=i;
  }
  QuickSort(0,n-1);
  for (i=1;i<n;i++){
    if ((A[i].num==A[i-1].num) && (A[i].id<=A[i-1].id)){
      printf("Not stable\n");
      flag=1;
      break;
    }
  }
  if (flag==0){
    printf("Stable\n");
  }
 
  for (i=0;i<n;i++){
    printf("%c %d\n",A[i].mark,A[i].num);
  }
  
  return 0;
}

Compiler output:
a.cc: In function 'void QuickSort(int, int)':
a.cc:15:9: error: 'Partition' was not declared in this scope
   15 |     q = Partition(p,r);
      |         ^~~~~~~~~
Language: C++

#include<stdio.h>
#define MAX 100000
#define SENTINEL 2000000000
struct Card{
	char suit;
	int value;
};

int A[MAX], n;
struct Card L[MAX / 2 + 2], R[MAX / 2 + 2];

void merge(struct Card A[],int n, int left, int mid, int right){
	int n1 = mid - left;
	int n2 = right - mid;
	int i,j,k;
	for (i = 0; i < n1; i++){
		L[i] = A[left + i];
	}
	for (i = 0; i < n2; i++){
		R[i] = A[mid + i];
	}
	L[n1].value = SENTINEL;
	R[n2].value = SENTINEL;
	i = 0;
	j = 0;
	for (k = left; k < right; k++){
		if (L[i].value <= R[j].value){
			A[k] = L[i];
			i = i + 1;
		}
		else{
			A[k] = R[j];
			j = j + 1;
		}
	}
}

void mergeSort(struct Card A[], int n, int left, int right){
	int mid;
	if (left + 1 < right){
		mid = (left + right) / 2;
		mergeSort(A, n, left, mid);
		mergeSort(A, n, mid, right);
		merge(A, n, left, mid, right);
	}
}

int partition(struct Card A[],int p, int r){
	struct Card tmp,x = A[r];
	int j,i = p - 1;
	for (j = p; j < r; j++){
		if (A[j].value <= x.value){
			i = i + 1;
			tmp = A[i];
			A[i] = A[j];
			A[j] = tmp;
		}
	}
	tmp = A[i+1];
	A[i+1] = A[r];
	A[r] = tmp;
	return i + 1;
}

void quickSort(struct Card A[], int n, int p, int r){
	int q;
	if (p < r){
		q = partition(A, n, p, r);
		quickSort(A, n, p, q - 1);
		quickSort(A, n, q + 1, r);
	}
}

int main(){
	int i,j,v;
	char S[10];
	struct Card A[MAX],B[MAX];
	scanf("%d", &n);
	for (i = 0; i < n; i++){
		scanf("%s %d", S, &v);
		A[i].suit = B[i].suit = S[0];
		A[i].value = B[i].value = v;
	}
	quickSort(A, n, 0, n);
	mergeSort(B, n, 0, n - 1);
	for (i = 0; i < n; i++){
		if (A[i].suit != B[i].suit){
			stable = 0;
			break;
		}
	}
	if (stable == 1){
		printf("Stable\n");
	}
	else{
		parintf("Not Stable\n");
	}
	for (i = 0; i < n; i++){
		printf("%c %d\n", B[i].suit, B[i].value);
	}
	return 0;
}

Compiler output:
a.cc: In function 'void quickSort(Card*, int, int, int)':
a.cc:68:30: error: too many arguments to function 'int partition(Card*, int, int)'
   68 |                 q = partition(A, n, p, r);
      |                     ~~~~~~~~~^~~~~~~~~~~~
a.cc:48:5: note: declared here
   48 | int partition(struct Card A[],int p, int r){
      |     ^~~~~~~~~
a.cc: In function 'int main()':
a.cc:88:25: error: 'stable' was not declared in this scope; did you mean 'mutable'?
   88 |                         stable = 0;
      |                         ^~~~~~
      |                         mutable
a.cc:92:13: error: 'stable' was not declared in this scope; did you mean 'mutable'?
   92 |         if (stable == 1){
      |             ^~~~~~
      |             mutable
a.cc:96:17: error: 'parintf' was not declared in this scope; did you mean 'printf'?
   96 |                 parintf("Not Stable\n");
      |                 ^~~~~~~
      |                 printf
Language: C++

#include<stdio.h>
#define MAX 100000
#define SENTINEL 2000000000
struct Card{
	char suit;
	int value;
};

int A[MAX], n;
struct Card L[MAX / 2 + 2], R[MAX / 2 + 2];

void merge(struct Card A[],int n, int left, int mid, int right){
	int n1 = mid - left;
	int n2 = right - mid;
	int i,j,k;
	for (i = 0; i < n1; i++){
		L[i] = A[left + i];
	}
	for (i = 0; i < n2; i++){
		R[i] = A[mid + i];
	}
	L[n1].value = SENTINEL;
	R[n2].value = SENTINEL;
	i = 0;
	j = 0;
	for (k = left; k < right; k++){
		if (L[i].value <= R[j].value){
			A[k] = L[i];
			i = i + 1;
		}
		else{
			A[k] = R[j];
			j = j + 1;
		}
	}
}

void mergeSort(struct Card A[], int n, int left, int right){
	int mid;
	if (left + 1 < right){
		mid = (left + right) / 2;
		mergeSort(A, n, left, mid);
		mergeSort(A, n, mid, right);
		merge(A, n, left, mid, right);
	}
}

int partition(struct Card A[],int n,int p, int r){
	struct Card tmp,x = A[r];
	int j,i = p - 1;
	for (j = p; j < r; j++){
		if (A[j].value <= x.value){
			i = i + 1;
			tmp = A[i];
			A[i] = A[j];
			A[j] = tmp;
		}
	}
	tmp = A[i+1];
	A[i+1] = A[r];
	A[r] = tmp;
	return i + 1;
}

void quickSort(struct Card A[], int n, int p, int r){
	int q;
	if (p < r){
		q = partition(A, n, p, r);
		quickSort(A, n, p, q - 1);
		quickSort(A, n, q + 1, r);
	}
}

int main(){
	int i,j,v;
	char S[10];
	struct Card A[MAX],B[MAX];
	scanf("%d", &n);
	for (i = 0; i < n; i++){
		scanf("%s %d", S, &v);
		A[i].suit = B[i].suit = S[0];
		A[i].value = B[i].value = v;
	}
	quickSort(A, n, 0, n);
	mergeSort(B, n, 0, n - 1);
	for (i = 0; i < n; i++){
		if (A[i].suit != B[i].suit){
			stable = 0;
			break;
		}
	}
	if (stable == 1){
		printf("Stable\n");
	}
	else{
		parintf("Not Stable\n");
	}
	for (i = 0; i < n; i++){
		printf("%c %d\n", B[i].suit, B[i].value);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:88:25: error: 'stable' was not declared in this scope; did you mean 'mutable'?
   88 |                         stable = 0;
      |                         ^~~~~~
      |                         mutable
a.cc:92:13: error: 'stable' was not declared in this scope; did you mean 'mutable'?
   92 |         if (stable == 1){
      |             ^~~~~~
      |             mutable
a.cc:96:17: error: 'parintf' was not declared in this scope; did you mean 'printf'?
   96 |                 parintf("Not Stable\n");
      |                 ^~~~~~~
      |                 printf
Language: C++

#include<stdio.h>
#define MAX 100000
#define SENTINEL 2000000000
struct Card{
	char suit;
	int value;
};

int A[MAX], n;
struct Card L[MAX / 2 + 2], R[MAX / 2 + 2];

void merge(struct Card A[],int n, int left, int mid, int right){
	int n1 = mid - left;
	int n2 = right - mid;
	int i,j,k;
	for (i = 0; i < n1; i++){
		L[i] = A[left + i];
	}
	for (i = 0; i < n2; i++){
		R[i] = A[mid + i];
	}
	L[n1].value = SENTINEL;
	R[n2].value = SENTINEL;
	i = 0;
	j = 0;
	for (k = left; k < right; k++){
		if (L[i].value <= R[j].value){
			A[k] = L[i];
			i = i + 1;
		}
		else{
			A[k] = R[j];
			j = j + 1;
		}
	}
}

void mergeSort(struct Card A[], int n, int left, int right){
	int mid;
	if (left + 1 < right){
		mid = (left + right) / 2;
		mergeSort(A, n, left, mid);
		mergeSort(A, n, mid, right);
		merge(A, n, left, mid, right);
	}
}

int partition(struct Card A[],int n,int p, int r){
	struct Card tmp,x = A[r];
	int j,i = p - 1;
	for (j = p; j < r; j++){
		if (A[j].value <= x.value){
			i = i + 1;
			tmp = A[i];
			A[i] = A[j];
			A[j] = tmp;
		}
	}
	tmp = A[i+1];
	A[i+1] = A[r];
	A[r] = tmp;
	return i + 1;
}

void quickSort(struct Card A[], int n, int p, int r){
	int q;
	if (p < r){
		q = partition(A, n, p, r);
		quickSort(A, n, p, q - 1);
		quickSort(A, n, q + 1, r);
	}
}

int main(){
	int i, j, v, stable = 0;
	char S[10];
	struct Card A[MAX],B[MAX];
	scanf("%d", &n);
	for (i = 0; i < n; i++){
		scanf("%s %d", S, &v);
		A[i].suit = B[i].suit = S[0];
		A[i].value = B[i].value = v;
	}
	quickSort(A, n, 0, n);
	mergeSort(B, n, 0, n - 1);
	for (i = 0; i < n; i++){
		if (A[i].suit != B[i].suit){
			stable = 0;
			break;
		}
	}
	if (stable == 1){
		printf("Stable\n");
	}
	else{
		parintf("Not Stable\n");
	}
	for (i = 0; i < n; i++){
		printf("%c %d\n", B[i].suit, B[i].value);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:96:17: error: 'parintf' was not declared in this scope; did you mean 'printf'?
   96 |                 parintf("Not Stable\n");
      |                 ^~~~~~~
      |                 printf
Language: C++

#include<stdio.h>
#define MAX 100000
#define SENTINEL 2000000000

struct Card{
	char suit;
	int value;
};

struct Card L[MAX / 2 + 2], R[MAX / 2 + 2];

void merge(struct Card A[], int left, int mid, int right){
	int i, j, k;
	int n1 = mid - left;
	int n2 = right - mid;
	for (i = 0; i < n1; i++){
		L[i] = A[left + i];
	}
	for (i = 0; i < n2; i++){
		R[i] = A[mid + 1];
	}
	L[n1].value = R[n2].value = SENTINEL;
	i = j = 0;
	for (k = left; k < right; k++){
		if (L[i].value <= R[j].value){
			A[k] = L[i++];
		}
		else{
			A[k] = R[j++];
		}
	}
}

void mergeSort(struct Card A[], int left, int right){
	int mid;
	if (left + 1 < right){
		mid = (left + right) / 2;
		mergeSort(A, left, mid);
		mergeSort(A, mid, right);
		merge(A, left, mid, right);
	}
}

int partiton(struct Card A[], int p, int r){
	int i, j;
	struct Card tmp, x=A[r];
	i = p - 1;
	for (j = p; j < r; j++){
		if (A[j].value <= x.value){
			i++;
			tmp = A[i];
			A[i] = A[j];
			A[j] = tmp;
		}
	}
	tmp = A[i + 1];
	A[i + 1] = A[r];
	A[r] = tmp;
	return i + 1;
}

void quickSort(struct Card A[], int p, int r){
	int q;
	if (p < r){
		q = partition(A, p, r);
		quickSort(A, p, q - 1);
		qucikSort(A, q, r);
	}
}

int main(){
	int n, i, v;
	struct Card A[MAX], B[MAX];
	char S[10];
	int stable = 1;
	scanf("%d", &n);
	for (i = 0; i < n; i++){
		scanf("%s %d", S, &v);
		A[i].suit = B[i].suit = S[0];
		A[i].value = B[i].value = v;
	}
	mergeSort(A, 0, n);
	quickSort(B, 0, n - 1);
	for (i = 0; i < n; i++){
		if (A[i].suit != B[i].suit){
			stable = 0;
		}
	}
	if (stable == 1){
		printf("Stable\n");
	}
	else{
		printf("Not stable\n");
	}
	for (i = 0; i < n; i++){
		printf("%c %d\n", A[i].suit, A[i].value);
	}
	return 0;
}

Compiler output:
a.cc: In function 'void quickSort(Card*, int, int)':
a.cc:65:21: error: 'partition' was not declared in this scope; did you mean 'partiton'?
   65 |                 q = partition(A, p, r);
      |                     ^~~~~~~~~
      |                     partiton
a.cc:67:17: error: 'qucikSort' was not declared in this scope; did you mean 'quickSort'?
   67 |                 qucikSort(A, q, r);
      |                 ^~~~~~~~~
      |                 quickSort
Language: C++

#include<stdio.h>
#define MAX 100000
#define SENTINEL 2000000000

struct Card{
	char suit;
	int value;
};

struct Card L[MAX / 2 + 2], R[MAX / 2 + 2];

void merge(struct Card A[], int left, int mid, int right){
	int i, j, k;
	int n1 = mid - left;
	int n2 = right - mid;
	for (i = 0; i < n1; i++){
		L[i] = A[left + i];
	}
	for (i = 0; i < n2; i++){
		R[i] = A[mid + 1];
	}
	L[n1].value = R[n2].value = SENTINEL;
	i = j = 0;
	for (k = left; k < right; k++){
		if (L[i].value <= R[j].value){
			A[k] = L[i++];
		}
		else{
			A[k] = R[j++];
		}
	}
}

void mergeSort(struct Card A[], int left, int right){
	int mid;
	if (left + 1 < right){
		mid = (left + right) / 2;
		mergeSort(A, left, mid);
		mergeSort(A, mid, right);
		merge(A, left, mid, right);
	}
}

int partition(struct Card A[], int p, int r){
	int i, j;
	struct Card tmp, x=A[r];
	i = p - 1;
	for (j = p; j < r; j++){
		if (A[j].value <= x.value){
			i++;
			tmp = A[i];
			A[i] = A[j];
			A[j] = tmp;
		}
	}
	tmp = A[i + 1];
	A[i + 1] = A[r];
	A[r] = tmp;
	return i + 1;
}

void quickSort(struct Card A[], int p, int r){
	int q;
	if (p < r){
		q = partition(A, p, r);
		quickSort(A, p, q - 1);
		qucikSort(A, q, r);
	}
}

int main(){
	int n, i, v;
	struct Card A[MAX], B[MAX];
	char S[10];
	int stable = 1;
	scanf("%d", &n);
	for (i = 0; i < n; i++){
		scanf("%s %d", S, &v);
		A[i].suit = B[i].suit = S[0];
		A[i].value = B[i].value = v;
	}
	mergeSort(A, 0, n);
	quickSort(B, 0, n - 1);
	for (i = 0; i < n; i++){
		if (A[i].suit != B[i].suit){
			stable = 0;
		}
	}
	if (stable == 1){
		printf("Stable\n");
	}
	else{
		printf("Not stable\n");
	}
	for (i = 0; i < n; i++){
		printf("%c %d\n", A[i].suit, A[i].value);
	}
	return 0;
}

Compiler output:
a.cc: In function 'void quickSort(Card*, int, int)':
a.cc:67:17: error: 'qucikSort' was not declared in this scope; did you mean 'quickSort'?
   67 |                 qucikSort(A, q, r);
      |                 ^~~~~~~~~
      |                 quickSort
Language: C++

#include<iostream>
using namespace std;
int a[100000];
char b[1000000];
struct card
{
	char qian;
	int hou;
};
struct card l[10000000],r[10000000];
partition(struct card a[],int n,int r)
{
	int j,i;
	struct card t,x;
	x=a[r];
	i=n-1;
	for(j=n;j<r;j++)
	{
		if(a[j].hou<=x.hou)
		{
			i++;
			t=a[i];
			a[i]=a[j];
			a[j]=t;
		}
	}
	t=a[i+1];
	a[i+1]=a[r];
	a[r]=t;
	return i+1;
}
void quick(struct card a[],int n,int r)
{
	int q;
	if(n<r)
	{
		int q=partition(a,n,r);
	    quick(a,n,q-1);
	    quick(a,q+1,r);
	}
	
}
void merge(struct card a[],int left,int mid,int right)
{
	int i,j,k;
	int n1;
	int n2;
	n1=mid-left;
	n2=right-mid;
	for(i=0;i<n1;i++)
	{
		l[i]=a[i];
	}
	for(i=0;i<n2;i++)
	{
		r[i]=a[mid+i];
	}
	l[n1].hou=r[n2].hou=2000000000;
	i=j=0;
	for(k=left;k<right;k++)
	{
		if(l[i].hou<=r[j].hou)
		{
			a[k]=l[i++];
		}
		else
		{
			a[k]=r[j++];
		}
	}
}
void mergesort(struct card a[],int left,int right)
{
	int mid;
	if(left+1<right)
	{
	mid=(left+right)/2;
	mergesort(a,left,mid);
	mergesort(a,mid,right);
	merge(a,left,mid,right);
	}
}
int main()
{
	int n,i,v;
	struct card a[100000],b[100000];
	char s[10];
	int stable=1;
	cin>>n;
	for(i=0;i<n;i++)
	{
		cin>>s>>v;
		a[i].qian=b[i].qian=s[0];
		a[i].hou=b[i].hou=v;
	}
	mergesort(a,0,n);
	quick(b,0,n-1);
	for(i=0;i<n;i++)
	{
		if(a[i].qian!=b[i].qian)
		stable=0;
	}
	if(stable==1)
	cout<<"Stable"<<endl;
	else cout<<"Not stable"<<endl;
	for(i=0;i<n;i++)
	{
		cout<<b[i].qian<<b[i].hou<<endl;
	}
	return 0;
}

Compiler output:
a.cc:11:1: error: ISO C++ forbids declaration of 'partition' with no type [-fpermissive]
   11 | partition(struct card a[],int n,int r)
      | ^~~~~~~~~
Language: C++

//
//  main.cpp
//  quick_sort
//
//  Created by ???????????? on 2017/10/08.
//  Copyright ?? 2017 ????????????. All rights reserved.
//

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

using namespace std;

struct Card{
    char suit;
    int num;
};

void swap(Card *a, Card *b){
    Card temp = *a;
    *a = *b;
    *b = temp;
}

int partition(Card cards[], int p, int r){
    int x = cards[r].num;
    int i = p - 1;
    for(int j = p; j < r; j ++){
        if(cards[j].num <= x){
            i++;
            swap(cards[i], cards[j]);
        }
    }
    swap(cards[i+1], cards[r]);
    return i+1;
}

void quick_sort(Card cards[], int p, int r){
    if (p < r){
        int q = partition(cards, p, r);
        quick_sort(cards, p, q-1);
        quick_sort(cards, q+1, r);
    }
}

void merge(Card S[], int left, int mid, int right){
    int i, j, k, n1, n2;
    n1 = mid - left;
    n2 = right - mid;
    Card L[n1+1], R[n2+1];
    for (i = 0; i < n1; i++){
        L[i] = S[left+i];
        
    }
    for (i = 0; i < n2; i++){
        R[i] = S[mid+i];
    }
    L[n1].num = INT_MAX;
    R[n2].num = INT_MAX;
    
    
    i = 0;
    j = 0;
    
    for( k = left; k < right; k++ ){
        if(L[i].num <= R[j].num){
            
            S[k] = L[i];
            i++;
        }
        else{
            S[k] = R[j];
            j++;
        }
    }
}


void merge_sort(Card S[], int left, int right){
    if (left+1 < right){
        int mid = (left + right)/2;
        merge_sort(S, left, mid);
        merge_sort(S, mid, right);
        merge(S, left, mid, right);
    }
}

int main(int argc, const char * argv[]) {
    int n, i;
    scanf("%d", &n);
    Card cards[n], copy[n];
    for(i = 0; i < n; i++){
        scanf("%s %d", &cards[i].suit, &cards[i].num);
        copy[i] = cards[i];
    }
    quick_sort(cards, 0, n);
    merge_sort(copy,  0, n);
    
    int is_stable = 1;
    for(i = 0; i < n; i++){
        if(copy[i].suit!=cards[i].suit)is_stable = 0;
    }
    if(is_stable)cout << "Stable" <<endl;
    else cout << "Not stable" << endl;
    
    
    for(i = 0; i < n; i++){
        cout << cards[i].suit << " " << cards[i].num << endl;
    }
    
    return 0;
}

Compiler output:
a.cc: In function 'void merge(Card*, int, int, int)':
a.cc:58:17: error: 'INT_MAX' was not declared in this scope
   58 |     L[n1].num = INT_MAX;
      |                 ^~~~~~~
a.cc:10:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    9 | #include <iostream>
  +++ |+#include <climits>
   10 | #include <stdio.h>
Language: C++

#include <cstdio>
#include <utility>

#define MAX 100000
#define SENTINEL 200000000

struct Card {
  char suit;
  int value;
}

struct Card L[MAX / 2 + 2], R[MAX / 2 + 2];

void Merge(struct Card A[], int n, int left, int mid, int right) {
  int i, j, k;
  int n1 = mid - left;
  int n2 = right - mid;
  for (i = 0; i < n1; ++i) { L[i] = A[left + i]; }
  for (i = 0; i < n2; ++i) { R[i] = A[mid + i]; }
  L[n1].value = R[n2].value = SENTINEL;
  i = j = 0;
  for (k = left; k < right; ++k) {
    if (L[i].value <= R[j].value) {
      A[k] = L[i++];
    } else {
      A[k] = R[i++];
    }
  }
}

void MergeSort(struct Card A[], int n, int left, int right) {
  int mid;
  if (left + 1 < right) {
    mid = (left + right) / 2;
    MergeSort(A, n, left, mid);
    MergeSort(A, n, mid, right);
    Merge(A, n, left, mid, right);
  }
}

int Partition(struct Card A[], int p, int r) {
  int i, j;
  struct Card x;
  x = A[r];
  i = p - 1;
  for (j = p; j < r; ++j) {
    if (A[j].value <= x.value) {
      ++i;
      std::swap(A[i], A[j]);
    }
  }
  std::swap(A[i + 1], A[r]);
  return i + 1;
}

void QuickSort(struct Card A[], int p, int r) {
  int q;
  if (p < r) {
    q = Partition(A, p, r);
    QuickSort(A, p, q - 1);
    QuickSort(A, q + 1, r);
  }
}

int main() {
  int n, i, v;
  struct Card A[MAX], B[MAX];
  char S[10];
  int stable = 1;

  scanf("%d", &n);

  for (i = 0; i < n; ++i) {
    scanf("%s %d", S, &v);
    A[i].suit = B[i].suit = S[0];
    A[i].value = B[i].value = v;
  }

  MergeSort(A, n, 0, n);
  QuickSort(B, n, 0, n - 1);

  for (i = 0; i < n; ++i) {
    if (A[i].suit != B[i].suit) { stable = 0; }
  }

  if (stable == 1) {
    std::printf("Stable\n");
  } else {
    std::printf("Not stable\n");
  }
  for (i = 0; i < n; ++i) { printf("%c %d\n", B[i].suit, B[i].value); }

  return 0;
}

Compiler output:
a.cc:10:2: error: expected ';' after struct definition
   10 | }
      |  ^
      |  ;
a.cc: In function 'int main()':
a.cc:80:12: error: too many arguments to function 'void QuickSort(Card*, int, int)'
   80 |   QuickSort(B, n, 0, n - 1);
      |   ~~~~~~~~~^~~~~~~~~~~~~~~~
a.cc:56:6: note: declared here
   56 | void QuickSort(struct Card A[], int p, int r) {
      |      ^~~~~~~~~
Language: C++

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

struct Card {
  char suit;
  int val;
};

int partition(vector<Card>& A, int p, int r) {
  int x = A[r].val;
  int i = p - 1;
  for (int j = p; j < r; ++j) {
    if (A[j].val <= x) {
      ++i;
      swap(A[i], A[j]);
    }
  }
  swap(A[i + 1], A[r]);
  return i + 1;
}

void quickSort(vector<Card>& A, int p, int r) {
  if (p < r) {
    int q = partition(A, p, r);
    quickSort(A, p, q - 1);
    quickSort(A, q + 1, r);
  }
}

void merge(vector<Card>& A, int left, int mid, int right) {
  int n1 = mid - left;
  int n2 = right - mid;
  vector<Card> L(n1 + 1);
  vector<Card> R(n2 + 1);
  for (int i = 0; i < n1; ++i) L[i] = A[left + i];
  for (int i = 0; i < n2; ++i) R[i] = A[mid + i];
  L[n1].val = R[n2].val = INT_MAX;
  int i = 0, j = 0;
  for (int k = left; k < right; ++k) {
    if (L[i].val <= R[j].val) {
      A[k] = L[i];
      ++i;
    } else {
      A[k] = R[j];
      ++j;
    }
  }
}

void mergeSort(vector<Card>& A, int left, int right) {
  if (left + 1 < right) {
    int mid = (left + right) / 2;
    mergeSort(A, left, mid);
    mergeSort(A, mid, right);
    merge(A, left, mid, right);
  }
}

bool is_stable(const vector<Card>& c1, const vector<Card>& c2) {
  for (size_t i = 0; i < c1.size(); ++i) {
    if (c1[i].suit == c2[i].suit) return false;
  }
  return true;
}

int main() {
  int n;
  cin >> n;
  vector<Card> c(n);
  for (int i = 0; i < n; ++i) cin >> c[i].suit >> c[i].val;
  vector<Card> c1, c2;
  c1 = c2 = c;
  quickSort(c1, 0, n - 1);
  mergeSort(c2, 0, n);
  if (is_stable(c1, c2)) cout << "Stable" << endl;
  else cout << "Not Stable" << endl;
  for (int i = 0; i < n; ++i) {
    cout << c1[i].suit << " " << c1[i].val << endl;
  }
}



Compiler output:
a.cc: In function 'void merge(std::vector<Card>&, int, int, int)':
a.cc:38:27: error: 'INT_MAX' was not declared in this scope
   38 |   L[n1].val = R[n2].val = INT_MAX;
      |                           ^~~~~~~
a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include <vector>
  +++ |+#include <climits>
    3 | using namespace std;
Language: C++

#include<stdio.h>
#include<algorithm>
using namespace std;

struct Card { char suit[2]; int value; };

#define INFTY 2000000000

void merge(Card A[], int left, int mid, int right) {
  int n1 = mid - left;
  int n2 = right - mid;
  Card L[n1+1], R[n2+1];
  for (int i = 0; i < n1; i++) L[i].value = A[left + i].value;
  for (int i = 0; i < n2; i++) R[i].value = A[mid + i].value;
  L[n1].value = INFTY;
  R[n2].value = INFTY;
  int i = 0, j = 0;
  for (int k = left; k < right; k++) {
    if (L[i].value <= R[j].value) {
      A[k] = L[i];
      i++;
    } else {
      A[k] = R[j];
      j++;
    }
  }
}

void mergeSort(Card A[], int left, int right) {
  if (left+1 < right) {
    int mid = (left + right)/2;
    mergeSort(A, left, mid);
    mergeSort(A, mid, right);
    merge(A, left, mid, right);
  }
}

int partition(Card A[], int p, int r) {
  int x = A[r].value;
  int i = p-1;
  for (int j = p; j < r; j++) {
    if (A[j].value <= x) {
      i = i+1;
      swap(A[i], A[j]);
    }
  }
  swap(A[i+1], A[r]);
  return i+1;
}

void quickSort(Card A[], int p, int r) {
  if (p < r) {
    int q = partition(A, p, r);
    quickSort(A, p, q-1);
    quickSort(A, q+1, r);
  }
}

int main() {
	int n;
  scanf("%d", &n);
  Card A[n], B[n];
  for ( int i = 0; i < n; i++ ) scanf("%s %d", &A[i].suit, &A[i].value);
  for ( int i = 0; i < n; i++ ) B[i] = A[i];

  quickSort(A, 0, n-1);
  mergeSort(B, 0, n);
  bool b = true;
  for ( int i = 0; i < n; i++ ) {
    if (strcmp(A[i].suit, B[i].suit) == 0) b = false;
  }
  if (b) {
    printf("Stable\n");
  } else {
    printf("Not stable\n");
  }
  for ( int i = 0; i < n; i++ ) printf("%s %d\n", A[i].suit, A[i].value);

  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:70:9: error: 'strcmp' was not declared in this scope
   70 |     if (strcmp(A[i].suit, B[i].suit) == 0) b = false;
      |         ^~~~~~
a.cc:3:1: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include<algorithm>
  +++ |+#include <cstring>
    3 | using namespace std;
Language: C++

#include <iostream>
#include <cstdio>
using namespace std;
const int MAX=100000;
const int SENTNEL=2000000000;

struct Card {
  char suit;
  int value;
};

Card L[MAX/2+2], R[MAX/2+2];

void merge(Card A[],int n,int left,int mid, int right) {
  int n1=mid-left;
  int n2=right-mid;
  for (int i=0; i<n1; i++) {
    L[i]=A[left+i];
  }
  for (int i=0; i<n; i++) {
    R[i]=A[mid+i];
  }
  L[n1].value=R[n2].value=SENTNEL;
  int i=0, j=0;
  for (int k=left; k<right; k++) {
    if (L[i].value<=R[j].value) {
      A[k]=L[i++];
    } else {
      A[k]=R[j++];
    }
  }
}
void mergeSort(Card A[],int n,int left,int right) {
  int mid;
  if(left+1<right) {
    mid=(left+right)/2;
    mergeSort(A,n,left,mid);
    mergeSort(A,n,mid,right);
    merge(A,n,left,mid,right);
  }
}
int partition(Card A[],int n,int p,int r) {
  Card t, x;
  x=A[r];
  int i=p-1;
  for (int j=p; j<r; j++) {
    if (A[j].value<=x.value) {
      i++;
      int t=A[i];
      A[i]=A[j];
      A[j]=t;
    }
  }
  int t=A[i+1];
  A[i+1]=A[r];
  A[r]=t;
  return i+1;
}
void quickSort(Card A[],int n,int p,int r) {
  if (p<r) {
    int q=partition(A,n,p,r);
    quickSort(A,n,p,q-1);
    quickSort(A,n,q+1,r);
  }
}
int main() {
  int n;
  scanf("%d",&n);
  Card A[MAX], B[MAX];
  char S[10];
  int v;
  for (int i=0; i<n; i++) {
    scanf("%s %d",S,&v);
    A[i].suit=B[i].suit=S[0];
    A[i].value=B[i].value=v;
  }
  mergeSort(A,n,0,n);
  quickSort(B,n,0,n-1);
  bool stable=true;
  for (int i=0; i<n; i++) {
    if (A[i].suit!=B[i].suit) {
      stable=false;
    }
  }
  if (stable) {
    cout<<"Stable"<<endl;
  } else {
    cout<<"Not stable"<<endl;
  }
  for (int i=0; i<n; i++) {
    cout<<B[i].suit<<" "<<B[i].value<<endl;
  }
  return 0;
}



Compiler output:
a.cc: In function 'int partition(Card*, int, int, int)':
a.cc:49:16: error: cannot convert 'Card' to 'int' in initialization
   49 |       int t=A[i];
      |             ~~~^
      |                |
      |                Card
a.cc:51:12: error: no match for 'operator=' (operand types are 'Card' and 'int')
   51 |       A[j]=t;
      |            ^
a.cc:7:8: note: candidate: 'constexpr Card& Card::operator=(const Card&)'
    7 | struct Card {
      |        ^~~~
a.cc:7:8: note:   no known conversion for argument 1 from 'int' to 'const Card&'
a.cc:7:8: note: candidate: 'constexpr Card& Card::operator=(Card&&)'
a.cc:7:8: note:   no known conversion for argument 1 from 'int' to 'Card&&'
a.cc:54:7: error: conflicting declaration 'int t'
   54 |   int t=A[i+1];
      |       ^
a.cc:43:8: note: previous declaration as 'Card t'
   43 |   Card t, x;
      |        ^
Language: C++

#include<iostream>
#define MAX 100001
#define INF 2000000000

using namespace std;



struct Card
{
	char suit;
	int value;
};

Card L[MAX/2+1];
Card R[MAX/2+1];

void merge(Card* A,int l,int mid,int r)
{
	int n1=mid-l;
	int n2=r-mid;
	int i,j;

	for (i = 0; i < n1; ++i)
	{
		L[i]=A[l+i];

	}

	for (i = 0; i < n2; ++i)
	{
		R[i]=A[mid+i];
	}

	L[n1].value=INF;
	R[n2].value=INF;

	i=0;
	j=0;

	for (int k= l; k < r; ++k)
	{
		
		if (L[i].value>=R[j].value)
		{
			A[k]=R[j++];
		}
		else
		{
			A[k]=L[i++];
		}
	}
}

void mergeSort(Card* A,int l,int r)
{
	if (l+1==r)
		return;

	int mid=(l+r)/2;
	mergeSort(A,l,mid);
	mergeSort(A,mid,r);
	merge(A,l,mid,r);
}

int partition(Card *A,int p,int r)
{
	int j=p;
	Card t;
	for (int i = p; i < r-1; ++i)
	{
		if (A[i].value<=A[r-1].value)
		{
			t=A[i];
			A[i]=A[j];
			A[j++]=t;
		}
	}
	t=A[j];
	A[j]=A[r-1];
	A[r-1]=t;
	return j;
}

void quickSort(Card *A,int p,int r)
{
	if (r<=p)
	{
		return;
	}

	int pivot=partition(A,p,r);
	quickSort(A,p,pivot);
	quickSort(A,pivot+1,r);
}

int main()
{
	int n,i,v;
	Card A[MAX],B[MAX];

	int stable=1;
	char s;

	cin>>n;

	for (i = 0; i < n; ++i)
	{
		cin>>s>>v;
		A[i].suit=B[i].suit=s;
		A[i].value=B[i].value=v;
	}

	mergeSort(A,0,n);
	quickSort(B,0,n);

	for (int i = 0; i < n; ++i)
	{
		if (A[i].suit!=B[i].suit)
		{
			stable=0;
		}
	}
	if (stable)
	{
		cout<<"Stable\n"<<endl;
	}
	else
		cout<<"Not stable"<<endl;

	for (i = 0; i < n; ++i)
	{
		cout<<B[i].suit<<" "<<B[i].value<<endl;
	}
	return 1;6
}


Compiler output:
a.cc: In function 'int main()':
a.cc:135:19: error: expected ';' before '}' token
  135 |         return 1;6
      |                   ^
      |                   ;
  136 | }
      | ~
Language: C++

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

using namespace std;

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

static bool isStable(Card in[], Card out[], int num) {
  for (int i = 0; i < num; i++) {
    if (in[i] != out[i]z) {
      return false;
    }
  }
  return true;
}

static void inputArray(Card A[], int num) {
  for (int i = 0; i < num; i++) {
    cin >> A[i].suit >> A[i].value;
   }
}

static void printArray(Card A[], int num) {
  for (int i = 0; i < num; i++) {
    cout << A[i].suit << ' ' << A[i].value << endl;
  }
}

static vector<Card> L(50000 + 1);
static vector<Card> R(50000 + 1);

static inline void merge(Card A[], int left, int mid, int right) {
  int n1 = mid - left;
  int n2 = right - mid;

  L.assign(&A[left], &A[left + n1]);
  R.assign(&A[mid], &A[mid + n2]);
  L[n1].value = R[n2].value = INT32_MAX;

  for (int i = 0, j = 0, k = left; k < right; k++) {
    if (L[i].value <= R[j].value) {
      A[k] = L[i];
      i++;
    } else {
      A[k] = R[j];
      j++;
    }
  } 
}

static inline void mergeSort(Card A[], int left, int right) {
  if (left + 1 < right) {
    int mid = (left + right) / 2;
    mergeSort(A, left, mid);
    mergeSort(A, mid, right);
    merge(A, left, mid, right);
  } 
}

static int partition(Card A[], int p, int r) {
  int x = A[r].value;
  int i = p - 1;
  for (int j = p; j < r; j++) {
    if (A[j].value <= x) {
      i++;
      swap(A[i], A[j]);
    }
  }
  swap(A[i + 1], A[r]);
  return i + 1; 
}

static inline void quickSort(Card A[], int p, int r) {
  if (p < r) {
    int q = partition(A, p, r);
    quickSort(A, p, q - 1);
    quickSort(A, q + 1, r);
  }
}

static vector<Card> A(100000);
static vector<Card> B(100000);

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

  inputArray(&A[0], n);
  B = A;

  quickSort(&A[0], 0, n - 1);
  mergeSort(&B[0], 0, n);
  
  bool stable = isStable(&A[0], &B[0], n);
  cout << (stable ? "Stable" : "Not stable") << endl;
  
  printArray(&A[0], n);
    
  return 0;
}



Compiler output:
a.cc: In function 'bool isStable(Card*, Card*, int)':
a.cc:22:24: error: expected ')' before 'z'
   22 |     if (in[i] != out[i]z) {
      |        ~               ^
      |                        )
Language: C++

// クイックソート
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<stack>
#include<algorithm>
#include<iostream>
#include<cmath>
#include<vector>

using namespace std;

#define MAX_N 100000
//const int INFTY = 2147483647;

typedef struct card
{
    char picture;
    int number;
}CARD;

int partition(CARD A[], int p, int r);
void quickSort(CARD A[], int p, int r);

int main(void)
{

    int n;
    CARD st_card[MAX_N], st_card_copy[MAX_N];

    cin >> n;

    for(int i = 0; i < n; i++)
    {
        cin >> st_card[i].picture >> st_card[i].number;

        st_card_copy[i].picture = st_card[i].picture;
        st_card_copy[i].number = st_card[i].number;
    }

    quickSort(&st_card[0], 0, n - 1);

    // -----▼▼▼▼▼ 安定なソートなのかを確認 ▼▼▼▼▼-----

    int num_1, num_2;
    char stable[] = "Stable\n";
    char not_stable[] = "Not stable\n";
    char *str = &stable[0];

    for(int i = 0; i < n; i++)
    {
        if( st_card[i].number == st_card[i + 1].number )
        {
            for(int j = 0; j < n; j++)
            {
                if( ( st_card[i].picture == st_card_copy[j].picture )
                    && ( st_card[i].number == st_card_copy[j].number ) )
                {
                    num_1 = j;
                }

                if( ( st_card[i + 1].picture == st_card_copy[j].picture )
                    && ( st_card[i + 1].number == st_card_copy[j].number ) )
                {
                    num_2 = j;
                }
            }

            if( num_1 > num_2 )
            {
                str = &not_stable[0];
                // 処理終了
                break;
            }
        }
    }

    // -----▲▲▲▲▲ 安定なソートなのかを確認 ▲▲▲▲▲-----

    printf("%s", str);

    for(int i = 0; i < n; i++)
    {
        printf("%c %d\n", st_card[i].picture, st_card[i].number);
    }

    return 0;
}

// クイックソートを実施する関数
// p : 範囲の先頭
// q : 範囲の最後尾
void quickSort(CARD A[], int p, int r)
{
    int q;

    if( p < r )
    {
        // パーティション ソート で, インデックスを求める
        q = partition(A, p, r);
        // 前半の部分配列に対して, クイックソートする
        quickSort(A, p, q - 1);
        // 後半の部分配列に対して, クイックソートする
        quickSort(A, q + 1, r);
    }

    return;
}

// パーティション ソート の実施
// A[r]を基準として, 小さい要素は左側, 大きい要素は右側に並ぶ
// p : 範囲の先頭
// q : 範囲の最後尾
int partition(CARD A[], int p, int r)
{
    int x = 0, i = 0;
    CARD tmp;

    x = A[r];
    i = p - 1;

    for(int j = p; j < r; j++)
    {
        if( A[j].number <= x.number )
        {
            i++;

            // A[i] と A[j]を交換
            tmp = A[i];
            A[i] = A[j];
            A[j] = tmp;
        }
    }

    // A[i + 1] と A[r]を交換
    tmp = A[i + 1];
    A[i + 1] = A[r];
    A[r] = tmp;

    return i + 1;
}



Compiler output:
a.cc: In function 'int partition(CARD*, int, int)':
a.cc:119:12: error: cannot convert 'CARD' {aka 'card'} to 'int' in assignment
  119 |     x = A[r];
      |         ~~~^
      |            |
      |            CARD {aka card}
a.cc:124:30: error: request for member 'number' in 'x', which is of non-class type 'int'
  124 |         if( A[j].number <= x.number )
      |                              ^~~~~~
Language: C++

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

struct Card{
  char a;
  int b;
};

bool compare_as_ints(Card i, Card j){
  return (i.b<j.b);
}

int partition(Card A[], int p, int r){
  Card x = A[r];
  int i = p-1;
  for(int j=p; j<=r-1; j++){
    if(A[j].b<=x.b){
      i++;
      swap(A[i],A[j]);
    }
  }
  swap(A[i+1],A[r]);
  return i+1;
}

void quickSort(Card A[], int p, int r){
  if(p<r){
    int q = partition(A,p,r);
    quickSort(A,p,q-1);
    quickSort(A,q+1,r);
  }
}

int main(){
  int n;
  cin >> n;
  Card A[100000],B[100000];
  for(int i=0; i<n; i++){
    cin >> A[i].a >> A[i].b;
    B[i] = A[i];
  }
  quickSort(A,0,n-1);
  stable_sort(B,B+n,compare_as_ints(A,B));

  int cnt=0;
  for(int i=0; i<n; i++){
    if(A[i].b==B[i].b){
      cnt++;
      /*if(i==n-1)
        cout << "Stable" << endl;
    }
    else{
      cout << "Not stable" << endl;
      break;*/
    }
  }
  if(cnt==n)
    cout << "Stable" << endl;
  else
    cout << "Not stable" << endl;

  for(int i=0; i<n; i++)
    cout << A[i].a << ' ' << A[i].b << endl;

  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:44:37: error: could not convert '(Card*)(& A)' from 'Card*' to 'Card'
   44 |   stable_sort(B,B+n,compare_as_ints(A,B));
      |                                     ^
      |                                     |
      |                                     Card*
Language: C++

/*
 * ALDS1_6_C.cpp
 *
 *  Created on: Apr 30, 2018
 *      Author: 13743
 */

#include<cstdio>
#include<algorithm>

struct Card {
	char c;
	int x;
};

void merge(Card* A, int l, int mid, int r) {
	int n1 = mid - l;
	int n2 = r - mid;
	Card L[n1+1];
	Card R[n2+1];
	for(int i=0; i<n1; i++) {
		L[i] = A[l + i];
	}
	for(int i=0; i<n2; i++) {
		R[i] = A[mid + i];
	}
	L[n1].x = 1000000001;
	R[n2].x = 1000000001;
	int lj = 0;
	int rj = 0;
	for(int i=0; l+i<r; i++) {
		if(L[lj] <= R[rj]) {
			A[l+i] = L[lj];
			lj++;
		}
		else {
			A[l+i] = R[rj];
			rj++;
		}
	}
}

void mergeSort(Card* A, int l, int r) {
	if(l+1 < r) {
		int mid = (l + r) / 2;
		mergeSort(A, l, mid);
		mergeSort(A, mid, r);
		merge(A, l, mid, r);
	}
}

int partition(Card* A, int l, int r) {
	int x = A[r].x;
	int i = l - 1;
	for(int j=l; j<r; j++) {
		if(A[j].x <= x) {
			i++;
			std::swap(A[i], A[j]);
		}
	}
	std::swap(A[i+1], A[r]);
	return i+1;
}

void quickSort(Card* A, int p, int r) {
	if(p < r) {
		int q = partition(A, p, r);
		quickSort(A, p, q-1);
		quickSort(A, q+1, r);
	}
}

int main() {
	int n;
	Card A[100000];
	Card B[100000];

	scanf("%d", &n);
	for(int i=0; i<n; i++) {
		scanf("%c %d", &A[i].c, &A[i].x);
		B[i] = A[i];
	}

	mergeSort(A, 0, n);
	quickSort(B, 0, n-1);
	
	for(int i=0; i<n; i++) {
		if(A[i].c != B[i].c) {
			printf("Not stable\n");
			break;
		}
		if(i == n-1) {
			printf("Stable\n");
		}
	}
	for(int i=0; i<n; i++) {
		printf("%c %d\n", A[i].c, A[i].x);
	}
}





Compiler output:
a.cc: In function 'void merge(Card*, int, int, int)':
a.cc:32:26: error: no match for 'operator<=' (operand types are 'Card' and 'Card')
   32 |                 if(L[lj] <= R[rj]) {
      |                    ~~~~~ ^~ ~~~~~
      |                        |        |
      |                        Card     Card
Language: C++

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

struct Card{
	char c;
	int a;
};
int partition(int *A,int p,int r){
  int x=A[r];
  int i=p-1;

  for(int j=p;j<=r-1;j++){
    if(A[j]<=x){
      i++;
      swap(A[i],A[j]);
      swap(c[i],c[j]);
    }
  }
  swap(A[i+1],A[r]);
  return i+1;

}
void quicksort(int* A,int p,int r){
	int q;
	if(p<r){
		q=partition(A,p,r);
	}
	quicksort(A,p,q-1);
	quicksort(A,q+1,r);
}

bool judge(Card a[],Card b[]){
	for(int i=0;i<n;i++){
		if(m[i]!=l[i]){
			cout<<"Not stable"<<endl;
			return false;
		}
	}
	return true;

}
int main(){
	int n;
	cin>>n;
	Card m[n];
	Card l[n];

	
	for(int i=0;i<n;i++){
		cin>>m[i].c>>m[i].a;
		l[i]=m[i];
	}

	quicksort(m,0,n-1);
	stable_sort(l.l+n);

	if(judge(m,l)){
		cout<<"Stable"<<endl;
	}else{
		cout<<"Not Stable"<<endl;
	}

	for(int i=0;i<n;i++){
		cout<<m[i].c<<' '<<m[i].a<<endl;
	}

	return 0;

}


Compiler output:
a.cc: In function 'int partition(int*, int, int)':
a.cc:17:12: error: 'c' was not declared in this scope
   17 |       swap(c[i],c[j]);
      |            ^
a.cc: In function 'bool judge(Card*, Card*)':
a.cc:34:23: error: 'n' was not declared in this scope
   34 |         for(int i=0;i<n;i++){
      |                       ^
a.cc:35:20: error: 'm' was not declared in this scope
   35 |                 if(m[i]!=l[i]){
      |                    ^
a.cc:35:26: error: 'l' was not declared in this scope
   35 |                 if(m[i]!=l[i]){
      |                          ^
a.cc: In function 'int main()':
a.cc:55:19: error: cannot convert 'Card*' to 'int*'
   55 |         quicksort(m,0,n-1);
      |                   ^
      |                   |
      |                   Card*
a.cc:24:21: note:   initializing argument 1 of 'void quicksort(int*, int, int)'
   24 | void quicksort(int* A,int p,int r){
      |                ~~~~~^
a.cc:56:23: error: request for member 'l' in 'l', which is of non-class type 'Card [n]'
   56 |         stable_sort(l.l+n);
      |                       ^
Language: C++

package Main;

import java.util.Scanner;

class Card{
	String mark;
	int num;
	public Card(String str,int n){
		mark=str;
		num=n;
	}
	public void Show(){
		System.out.println(mark+" "+num);
	}
}

public class Main{
	public static int[] A=new int[10001];
	
    public static int partation(int p,int r){
        int x=A[r];
        int i=p-1;
        int swap;
        for(int j=p;j<r;j++){
            if(A[j]<=x){
                i=i+1;
                swap=A[i];
                A[i]=A[j];
                A[j]=swap;
            }
        }
        swap=A[i+1];
        A[i+1]=A[r];
        A[r]=swap;
        return i+1;
    }
    
    public static void quicksort(int p,int r){
    	int q;
    	if(p<r){
    		q=partation(p,r);
    		quicksort(p,q-1);
    		quicksort(p+1,r);
    	}
    }
    
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int i ,n,r;
        n=scan.nextInt();
        Card[] card=new Card[10001];
        for(i=0;i<n;i++){
            card[i]=new Card(scan.next(),scan.nextInt());
        }
        r=A[n-1];
        quicksort(0,n-1);
        
        for(i=0;i<n;i++){
        	System.out.print(A[i]+" ");
        }

        scan.close();
    }
}


Compiler output:
a.cc:1:1: error: 'package' does not name a type
    1 | package Main;
      | ^~~~~~~
a.cc:3:1: error: 'import' does not name a type
    3 | import java.util.Scanner;
      | ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:6:9: error: 'String' does not name a type
    6 |         String mark;
      |         ^~~~~~
a.cc:8:15: error: expected ':' before 'Card'
    8 |         public Card(String str,int n){
      |               ^~~~~
      |               :
a.cc:8:27: error: expected ')' before 'str'
    8 |         public Card(String str,int n){
      |                    ~      ^~~~
      |                           )
a.cc:12:15: error: expected ':' before 'void'
   12 |         public void Show(){
      |               ^~~~~
      |               :
a.cc:15:2: error: expected ';' after class definition
   15 | }
      |  ^
      |  ;
a.cc: In member function 'void Card::Show()':
a.cc:13:17: error: 'System' was not declared in this scope
   13 |                 System.out.println(mark+" "+num);
      |                 ^~~~~~
a.cc:13:36: error: 'mark' was not declared in this scope
   13 |                 System.out.println(mark+" "+num);
      |                                    ^~~~
a.cc: At global scope:
a.cc:17:1: error: expected unqualified-id before 'public'
   17 | public class Main{
      | ^~~~~~
Language: C++

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

using namespace std;
struct Card {
  int rank;
  char suit;
};

vector<Card> ns;
bool stable = true;

int partition(int p, int r)
{
  auto x = ns[r];
  int i = p-1;
  for (int j=p; j<r; ++j) {
    if (ns[j].rank <= x.rank) {
      if(ns[j].rank == x.rank and j!=(i+1)) stable=false;
      ++i;
      swap(ns[i], ns[j]);
    }
  }
  swap(ns[i+1], ns[r]);
  return i+1;
}

void sort(int p, int r) {
  if(p<r) {
    int q = partition(p, r);
    sort(p, q-1);
    sort(q+1, r);
  }
}

int main()
{
  int n; cin >> n;
  for(int i=0; i<n;++i) {
    Card c;
    cin >> c.suit;
    cin >> c.rank;
    ns.push_back(c);
  }
  sort(0, n-1);
  if(stable) cout << "Stable" << endl;
  else cout << "Not stable" << endl;
  for(int i=0; i<n; ++i) {
    cout << ns[i].suit << ' ' << ns[i].rank << endl;
  }



Compiler output:
a.cc: In function 'int main()':
a.cc:52:4: error: expected '}' at end of input
   52 |   }
      |    ^
a.cc:39:1: note: to match this '{'
   39 | {
      | ^
Language: C++

#include<iostream>

using namespace std;

#define MAX 100000
#define SENTINEL 2000000000

struct Card {
  char suit;
  int value;
};

struct Card L[MAX / 2 + 2], R[MAX / 2 + 2];

void merge(struct Card A[], int left, int mid, int right) {
  int n1 = mid - left;
  int n2 = right - mid;
  for (int i = 0; i < n1; i++) {
    L[i] = A[left + i];
  }
  for (int i = 0; i < n2; i++) {
    R[i] = A[mid + i];
  }
  L[n1].value = R[n2].value = SENTINEL;
  int i = 0;
  int j = 0;
  for (int k = left; k < right; k++) {
    cnt++;
    if (L[i].value <= R[j].value) {
      A[k] = L[i++];
    } else {
      A[k] = R[j++];
    }
  }
}
   
void mergeSort(struct Card A[], int left, int right){
  if (left + 1 < right) {
    int mid = (left + right) / 2;
    mergeSort(A, left, mid);
    mergeSort(A, mid, right);
    merge(A, left, mid, right);
  }
}

int partition(struct Card A[], int p, int r) {
  struct Card x = A[r];
  int i = p - 1;
  for (int j = p; j < r; j++) {
    if (A[j].value <= x.value) {
      i++;
      swap(A[i], A[j]);
    }
  }
  swap(A[i+1], A[r]);
  return i + 1;
}

void quickSort(struct Card A[], int p, int t){
  int q;
  if (p < r) {
    q = partition(A, p, r);
    quickSort(A, p, q - 1);
    quickSort(A, q + 1, r)
  }
}

int main() {
  struct Card A[MAX], B[MAX];

  int N;
  cin >> N;

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

  mergeSort(A, 0, N);
  quickSort(A, 0, N - 1);

  bool stable = true;

  for (int i = 0; i < N; i++) {
    if (A[i].suit != B[i].suit) {
      stable = false;
    }
  }

  if (stable) {
    cout << "Stable" << endl;
  } else {
    cout << "Not Stable" << endl;
  }
  for (int i = 0; i < N; i++) {
    cout << B[i].suit << " " << B[i].value << endl;
  }

  return 0;
}



Compiler output:
a.cc: In function 'void merge(Card*, int, int, int)':
a.cc:28:5: error: 'cnt' was not declared in this scope; did you mean 'int'?
   28 |     cnt++;
      |     ^~~
      |     int
a.cc: In function 'void quickSort(Card*, int, int)':
a.cc:61:11: error: 'r' was not declared in this scope
   61 |   if (p < r) {
      |           ^
a.cc: In function 'int main()':
a.cc:74:7: error: conflicting declaration 'int A [N]'
   74 |   int A[N];
      |       ^
a.cc:69:15: note: previous declaration as 'Card A [100000]'
   69 |   struct Card A[MAX], B[MAX];
      |               ^