Language: C

#include <stdio.h>
??
typedef struct _card {
????????int number;
????????char suit;
} CARD;
??
CARD A[100000], I[100000];
char inputs[1000000];
char *ptr = inputs;
??
void exchange(CARD *a, CARD *b);
int Partition(CARD A[], int p, int r);
void Quicksort(CARD A[], int p, int r);
??
int nextInt(void) {
????????int v = 0;
????????while (*ptr < '0' || *ptr > '9') ++ptr;
????????while (*ptr >= '0' && *ptr <= '9') {
????????????????v = v * 10 + (int)(*ptr - '0');
????????????????++ptr;
????????}
????????return v;
}
??
char nextSuit(void) {
????????while (*ptr < 'A' || *ptr > 'Z') ++ptr;
????????return *ptr;
}
??
int main(void) {
????????int n;
????????int stable = 1;
????????int i, j, c, d;
??????????
????????fread(inputs, sizeof(char), 1000000, stdin);
??????????
????????n = nextInt();
??????????
????????for (i = 0; i < n; ++i) {
????????????????A[i].suit = nextSuit();
????????????????A[i].number = nextInt();
????????????????I[i] = A[i];
????????}
??????????
????????Quicksort(A, 0, n - 1);
??????????
????????for (i = 0; i < n; ++i) {
????????????????if (i == 0) {
????????????????????????c = 0;
????????????????} else if (A[i].number != A[i - 1].number) {
????????????????????????c = 0;
????????????????} else {
????????????????????????++c;
????????????????}
????????????????d = 0;
????????????????for (j = 0; j < n; ++j) {
????????????????????????if (I[j].number == A[i].number) {
????????????????????????????????if (c == d) {
????????????????????????????????????????if (I[j].suit != A[i].suit) {
????????????????????????????????????????????????stable = 0;
????????????????????????????????????????}
????????????????????????????????????????break;
????????????????????????????????}
????????????????????????????????++d;
????????????????????????}
????????????????}
????????????????if (stable == 0) {
????????????????????????break;
????????????????}
????????}
??????????
????????if (stable == 1) {
????????????????puts("Stable");
????????} else {
????????????????puts("Not stable");
????????}
??????????
????????for (i = 0; i < n; ++i) {
????????????????printf("%c %d\n", A[i].suit, A[i].number);
????????}
??????????
????????return 0;
}
??
void exchange(CARD *a, CARD *b) {
????????CARD t = *a;
????????*a = *b;
????????*b = t;
}
??
int Partition(CARD A[], int p, int r) {
????????CARD x = A[r];
????????int i = p - 1;
????????int j;
????????for (j = p; j < r; ++j) {
????????????????if (A[j].number <= x.number) {
????????????????????????++i;
????????????????????????exchange(&A[i], &A[j]);
????????????????}
????????}
????????exchange(&A[i + 1], &A[r]);
????????return i + 1;
}
??
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);
????????}
}

Compiler output:
main.c:2:1: error: expected identifier or '(' before '?' token
    2 | ??
      | ^
main.c:6:3: warning: data definition has no type or storage class
    6 | } CARD;
      |   ^~~~
main.c:6:3: error: type defaults to 'int' in declaration of 'CARD' [-Wimplicit-int]
main.c:7:1: error: expected identifier or '(' before '?' token
    7 | ??
      | ^
main.c:11:1: error: expected identifier or '(' before '?' token
   11 | ??
      | ^
main.c:13:15: error: expected declaration specifiers or '...' before 'CARD'
   13 | int Partition(CARD A[], int p, int r);
      |               ^~~~
main.c:14:16: error: expected declaration specifiers or '...' before 'CARD'
   14 | void Quicksort(CARD A[], int p, int r);
      |                ^~~~
main.c:15:1: error: expected identifier or '(' before '?' token
   15 | ??
      | ^
main.c:25:1: error: expected identifier or '(' before '?' token
   25 | ??
      | ^
main.c:30:1: error: expected identifier or '(' before '?' token
   30 | ??
      | ^
main.c:85:1: error: expected identifier or '(' before '?' token
   85 | ??
      | ^
main.c:91:1: error: expected identifier or '(' before '?' token
   91 | ??
      | ^
main.c:105:1: error: expected identifier or '(' before '?' token
  105 | ??
      | ^