Language: C

#include <stdio.h>
#define N 100000
#define S 200000000

typedef struct {
  char m;
  int v;
}Card;

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

int partition(Card A[], int p, int r){
  int i, j, x, temp1, temp2;

  x = A[r];
  i = p-1;
  for(j=p; j<r; j++){
    if(A[j]<=x){
      i = i+1;
      temp1 = A[i];
      A[i] = A[j];
      A[j] = temp1;
    }
  }
  temp2 = A[i+1];
  A[i+1] = A[r];
  A[r] = temp2;
  return i+1;
}

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

void merge(Card A[], int l, int r, int m){
  int i, j, k;
  int n1 = m-l, n2 = r-m;

  for(i=0; i<n1; i++) L[i] = A[l+i];
  for(i=0; i<n2; i++) R[i] = A[m+i];
  L[n1].v = R[n2].v = S;
  i = j = 0;
  for(k=l; k<r; k++){
    if(L[i].v <= R[j].v){
      A[k] = L[i++];
    } else {
      A[k] = R[j++];
    }
  }
}
    
void mergeSort(Card 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);
      }
}

int main(){

  int i, n, stable=1;
  char S[10];
  Card A[N], B[N];
  
  scanf("%d", &n);
  for(i=0; i<n; i++){
    scanf("%c %d", &A[i].m, &A[i].v);  
  }

  for(i=0; i<n; i++){
    B[i].m = A[i].m;
    B[i].v = B[i].v;
  }

  mergesort(A, 0, n);
  quicksort(B, 0, n-1);

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

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

Compiler output:
main.c: In function 'partition':
main.c:15:7: error: incompatible types when assigning to type 'int' from type 'Card'
   15 |   x = A[r];
      |       ^
main.c:18:12: error: invalid operands to binary <= (have 'Card' and 'int')
   18 |     if(A[j]<=x){
      |        ~~~~^~
      |         |
      |         Card
main.c:20:15: error: incompatible types when assigning to type 'int' from type 'Card'
   20 |       temp1 = A[i];
      |               ^
main.c:22:14: error: incompatible types when assigning to type 'Card' from type 'int'
   22 |       A[j] = temp1;
      |              ^~~~~
main.c:25:11: error: incompatible types when assigning to type 'int' from type 'Card'
   25 |   temp2 = A[i+1];
      |           ^
main.c:27:10: error: incompatible types when assigning to type 'Card' from type 'int'
   27 |   A[r] = temp2;
      |          ^~~~~
main.c: In function 'quicksort':
main.c:33:5: error: 'q' undeclared (first use in this function)
   33 |     q = partition(A, p, r);
      |     ^
main.c:33:5: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'mergeSort':
main.c:60:7: error: implicit declaration of function 'mergesort'; did you mean 'mergeSort'? [-Wimplicit-function-declaration]
   60 |       mergesort(A, l, m);
      |       ^~~~~~~~~
      |       mergeSort
main.c: In function 'main':
main.c:3:11: error: expected identifier or '(' before numeric constant
    3 | #define S 200000000
      |           ^~~~~~~~~
main.c:69:8: note: in expansion of macro 'S'
   69 |   char S[10];
      |        ^
main.c:86:14: error: expected ')' before '!' token
   86 |     if(A[i].m !- B[i].m) stable = 0;
      |       ~      ^~
      |              )