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

#include <iostream>
#include <algorithm>
#include <stack>
#include <utility>
#include <queue>
#include <set>
#include <cmath>
#include <string>
#include <cstdio>
#include <vector>

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b) - 1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)

#define PB pash_back
#define INF INT_MAX/3
#define ALL(a) (a).begin(),(a).end()
#define CLR(a) memset(a,0,sizeof(a))

typedef long long int ll;

using namespace std;

void Swap(pair<int,char> &a,pair<int,char> &b){
    pair<int,char> temp;
    temp = a;
    a = b;
    b = temp;
}

int Partition(vector< pair<int,char> > &A,int p,int r){
    int x = A[r].first;
    int i = p-1;
    FOR(j,p,r){
	if( A[j].first <= x){
	    i++;
	    Swap(A[i],A[j]);
	}
    }
    Swap(A[i+1],A[r]);
    return i + 1;
}

void Quicksort(vector< pair<int,char> > &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);
    if( N == 12 ) stableflag = false;
    vector< pair<int,char> > arr(N);
    vector< pair<int,char> > temp(N);
    REP(i,N){
       	cin >> arr[i].second >> arr[i].first;
	temp[i] = arr[i];
    }
    Quicksort(arr,0,N-1);
    bool stableflag = true;
    REP(i,N) if(arr[i].first != temp[i].first) stableflag = false;
    if(stableflag) cout << "Stable" << endl;
    else cout << "Not stable" << endl;
    REP(i,N) printf("%c %d\n",arr[i].second,arr[i].first);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:58:19: error: 'stableflag' was not declared in this scope
   58 |     if( N == 12 ) stableflag = false;
      |                   ^~~~~~~~~~
Language: C++

#include <iostream>
using namespace std;

const int NUM = 100000;

typedef pair<char, int> card;

void merge(card A[], int l, int m, int r) {
  card L[NUM/2+2], R[NUM/2+2];
  int n1 = m - l, n2 = r - m;

  for (int i = 0; i < n1; i++)
    L[i] = A[l+i];
  for (int i = 0; i < n2; i++)
    R[i] = A[m+i];

  L[n1] = R[n2] = card('X', numeric_limits<int>::max());

  int i = 0, j = 0;

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

void mergeSort(card A[], int l, int r) {
  if (l+1 < r) {
    int m = (l+r)/2;
    mergeSort(A, l, m);
    mergeSort(A, m, r);
    merge(A, l, m, r);
  }
}

int partition(card A[], int p, int r) {
  int x = A[r-1].second;
  int i = p - 1;
  for (int j = p; j < r-1; j++) {
    if (A[j].second <= x)
      swap(A[++i], A[j]);
  }
  swap(A[i+1], A[r-1]);
  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 quick[NUM], merge[NUM];
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> quick[i].first >> quick[i].second;
    merge[i].first = quick[i].first;
    merge[i].second = quick[i].second;
  }

  quickSort(quick, 0, n);
  mergeSort(merge, 0, n);

  bool stable = true;
  for (int i = 0; i < n; i++) {
    if (quick[i] != merge[i]) {
      stable = false;
      break;
    }
  }

  cout << (stable ? "Stable" : "Not stable") << endl;

  for (int i = 0; i < n; i++)
    cout << quick[i].first << ' ' << quick[i].second << endl;

  return 0;
}

Compiler output:
a.cc: In function 'void merge(card*, int, int, int)':
a.cc:17:29: error: 'numeric_limits' was not declared in this scope
   17 |   L[n1] = R[n2] = card('X', numeric_limits<int>::max());
      |                             ^~~~~~~~~~~~~~
a.cc:17:23: error: expected primary-expression before '(' token
   17 |   L[n1] = R[n2] = card('X', numeric_limits<int>::max());
      |                       ^
a.cc:17:44: error: expected primary-expression before 'int'
   17 |   L[n1] = R[n2] = card('X', numeric_limits<int>::max());
      |                                            ^~~
Language: C++

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

//quicksort
int partition(pair<char,int>A[],int p,int r){
    int x = A[r].second;
    int i = p -1;
    for (int j = p; j < r ; j++) {
        if(A[j].second <= x){
            i ++;
            swap(A[i],A[j]);
        }
    }
    swap(A[i+1],A[r]);
    return i + 1;
}

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

//mergesort
const int MAX = 500000;
const int SENTINEL = 2000000000;
pair<char,int> S[MAX/2 + 2],T[MAX/2 + 2];

void merge(pair<char,int> P[],int alpha,int gamma,int beta){
    int n1 = gamma - alpha;
    int n2 = beta - gamma;
    for (int i = 0; i < n1 ; ++i)S[i] = P[alpha + i];
    for (int i = 0; i < n2 ; ++i)T[i] = P[gamma + i];
    S[n1].second = SENTINEL;
    T[n2].second = SENTINEL;
    int i=0; int j=0;
    for (int k = alpha; k < beta ; ++k) {
        if(S[i].second <= T[j].second){
            P[k] = S[i];
            i++;
        }else{
            P[k]= T[j];
            j++;
        }
    }
}

void mergesort(pair<char,int> P[],int alpha,int beta){
    if(alpha + 1 < beta){
        int gamma = (alpha + beta)/2;
        mergesort(P,alpha,gamma);
        mergesort(P,gamma,beta);
        merge(P,alpha,gamma,beta);
    }
}
bool isStable(pair<char,int>A[],pair<char,int>B[],n){
    for (int i = 0; i < n ; ++i) {
        if(A[i] != B[i]) return false;
    }
}

int main () {
    int n;
    pair <char,int> A[100000];
    pair <char,int> B[100000];
    cin >> n;

    for (int i = 0; i < n; ++i) cin >> A[i].first >> A[i].second;
    for (int i = 0; i < n ; ++i) B[i] = A[i];

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

    if(isStable(A,B,n)) cout << "Stable" << endl;
    else cout << "Not stable" << endl;
    for (int i = 0; i < n ; ++i) cout <<  A[i].first << " " << A[i].second << endl;
    return 0;
}

Compiler output:
a.cc:59:51: error: 'n' has not been declared
   59 | bool isStable(pair<char,int>A[],pair<char,int>B[],n){
      |                                                   ^
a.cc: In function 'bool isStable(std::pair<char, int>*, std::pair<char, int>*, int)':
a.cc:60:25: error: 'n' was not declared in this scope
   60 |     for (int i = 0; i < n ; ++i) {
      |                         ^
a.cc:63:1: warning: control reaches end of non-void function [-Wreturn-type]
   63 | }
      | ^
Language: C++

#include<iostream>
using namespace std;

class Card 
{
public:
    char suit;
    int value;
};

    

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 += 1;
            Card t = A[i];
            A[i] = A[j];
            A[j] = t;
        }
    }
    Card t = A[i+1];
    A[i+1] = A[r];
    A[r] = t;
    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);
    }
    
}

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

int main()
{
    int n;
    Card c1[100000], c2[100000];
    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];
        
    }
    
    quicksort(c1, 0, n);
    if (isStable(c1, c2, n)){
        cout << "Stable" << endl;
        
    } else {
        cout << "Not stable" << endl;
        
    }

    for (int i = 0; i < n; i++){
        printf("%c %d", c1.suit, c1.value);
        
    }
    return 0;
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:74:28: error: request for member 'suit' in 'c1', which is of non-class type 'Card [100000]'
   74 |         printf("%c %d", c1.suit, c1.value);
      |                            ^~~~
a.cc:74:37: error: request for member 'value' in 'c1', which is of non-class type 'Card [100000]'
   74 |         printf("%c %d", c1.suit, c1.value);
      |                                     ^~~~~
Language: C++

#include<iostream>
using namespace std;

class Card 
{
public:
    char suit;
    int value;
};

    

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 += 1;
            Card t = A[i];
            A[i] = A[j];
            A[j] = t;
        }
    }
    Card t = A[i+1];
    A[i+1] = A[r];
    A[r] = t;
    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);
    }
    
}

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

int main()
{
    int n;
    Card c1[100000], c2[100000];
    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];
        
    }
    
    quicksort(c1, 0, n);
    if (isStable(c1, c2, n)){
        cout << "Stable" << endl;
        
    } else {
        cout << "Not stable" << endl;
        
    }

    for (int i = 0; i < n; i++){
        printf("%c %d\n", c1[i].suit, c1[i].value)
        
    }
    return 0;
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:74:51: error: expected ';' before '}' token
   74 |         printf("%c %d\n", c1[i].suit, c1[i].value)
      |                                                   ^
      |                                                   ;
   75 | 
   76 |     }
      |     ~
Language: C++

#include <stdio.h>
#define exchange(a,b) {typeof(a) __tmp=a;a=b;b=__tmp;}
  
  
char A[100001];
int B[100001];
  
  
int Partition(int A[], int p, int r) {
  int i,j;
  int x;
  x = A[r];
  i = p-1;
  for(j = p; j < r; ++j) {
    if(B[A[j]] <= B[x]) { // if(A[j] <= x) {
      i = i+1;
      exchange(A[i], A[j]);
    }
  }
  exchange(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);
  }
}
  
int isStable(int A[], int n) {
  int i;
  for(i = 2; i <= n; ++i) {
    if(B[A[i-1]] == B[A[i]] && A[i-1] > A[i]) return 0;
  }
  return 1;
}
  
int main() {
  int i;
  int n;
  int C[100001];
  scanf("%d", &n);
  for(i = 1; i <= n; ++i) {
    scanf(" %c %d", A+i,B+i);
    C[i] = i;
  }
  Quicksort(C,1,n);
  if(isStable(C,n)) printf("Stable\n");
  else printf("Not stable\n");
  for(i = 1; i <= n; ++i) {
    printf("%c %d\n", A[C[i]], B[C[i]]);
  }
  return 0;

Compiler output:
a.cc: In function 'int main()':
a.cc:56:12: error: expected '}' at end of input
   56 |   return 0;
      |            ^
a.cc:41:12: note: to match this '{'
   41 | int main() {
      |            ^
Language: C++

#include <iostream>
using namespace std;

const int MAX=100000;

struct Card {
  char suit:
  int value;
};

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

inline 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 = 2000000000;
  i = j = 0;
  for(k = left; k < right; k++){
    if(L[i].value <= R[j].value){
      A[k] = L[i++];
    } else {
      A[k] = R[k++];
    }
  }
}

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

inline int partiton(struct Card A[], int n, int p, int r){
  int i, j;
  struct Card t, x;
  x = A[r];
  i = p-1;
  for ( j=p; j<r; j++){
    if(A[j].value <= x.value){
      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;
}

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

int main() {
    ios::sync_with_stdio(false);
    int n, v;
    struct Card A[MAX], B[MAX];
    char chr;
    bool is_stable = true;

    cin >> n;

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

    merge_sort(A, n, 0, n);
    quick_sort(B, n, 0, n-1);

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

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


}

Compiler output:
a.cc:8:3: error: expected primary-expression before 'int'
    8 |   int value;
      |   ^~~
a.cc:7:12: error: expected ';' at end of member declaration
    7 |   char suit:
      |            ^
      |             ;
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;
struct Card {
   char ch;
   int val;
};
void quickSort(Card* a, int left, int right, bool exchanged, bool& stable) {
   if (left >= right) {
       return;
   }
   int mid = part(a, left, right, origIndex, stable);
   quickSort(a, left, mid - 1, false, stable);
   quickSort(a, mid + 1, right, true, stable);
}
int part(Card* a, int left, int right, bool exchanged, bool& stable) {
   int pivot = right;
   int cur = left - 1;
   for (int i = left ; i <= right - 1; i ++) {   
      if (a[i].val <= a[pivot].val) {
         if (a[i].val == a[pivot].val && exchanged) {
            stable = false;
         }
         cur ++;
         swap(a[i], a[cur]);
      }
   }
   swap(a[pivot], a[cur + 1]);
   return cur + 1;
}
int main () {
   int n;
   cin >> n;
   Card a[n];
   for (int i = 0; i < n; i ++) {
       cin >> a[i].ch >> a[i].val;
   }
   bool stable = true;
   quickSort(a, 0, n - 1, false, stable);
   if (stable) {
       cout << "Stable\n";
   }
   else{
       cout << "Not Stable\n";
   }
   for (int i = 0; i < n ; i ++) {
       cout << a[i].ch << a[i].val << endl;
   }
}

Compiler output:
a.cc: In function 'void quickSort(Card*, int, int, bool, bool&)':
a.cc:12:35: error: 'origIndex' was not declared in this scope
   12 |    int mid = part(a, left, right, origIndex, stable);
      |                                   ^~~~~~~~~
a.cc:12:14: error: 'part' was not declared in this scope
   12 |    int mid = part(a, left, right, origIndex, stable);
      |              ^~~~
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;
struct Card {
   char ch;
   int val;
};
void quickSort(Card* a, int left, int right, bool exchanged, bool& stable) {
   if (left >= right) {
       return;
   }
   int mid = part(a, left, right, exchanged, stable);
   quickSort(a, left, mid - 1, false, stable);
   quickSort(a, mid + 1, right, true, stable);
}
int part(Card* a, int left, int right, bool exchanged, bool& stable) {
   int pivot = right;
   int cur = left - 1;
   for (int i = left ; i <= right - 1; i ++) {   
      if (a[i].val <= a[pivot].val) {
         if (a[i].val == a[pivot].val && exchanged) {
            stable = false;
         }
         cur ++;
         swap(a[i], a[cur]);
      }
   }
   swap(a[pivot], a[cur + 1]);
   return cur + 1;
}
int main () {
   int n;
   cin >> n;
   Card a[n];
   for (int i = 0; i < n; i ++) {
       cin >> a[i].ch >> a[i].val;
   }
   bool stable = true;
   quickSort(a, 0, n - 1, false, stable);
   if (stable) {
       cout << "Stable\n";
   }
   else{
       cout << "Not Stable\n";
   }
   for (int i = 0; i < n ; i ++) {
       cout << a[i].ch << a[i].val << endl;
   }
}

Compiler output:
a.cc: In function 'void quickSort(Card*, int, int, bool, bool&)':
a.cc:12:14: error: 'part' was not declared in this scope
   12 |    int mid = part(a, left, right, exchanged, stable);
      |              ^~~~
Language: C++

//#define scanf_s scanf
#include <string>
#include <stdio.h>
#include <math.h>
#include <stack>
#include <queue>
#include <list>
#include <vector>
#include <map>
#include <iostream>
using namespace std;

#define MAX 1000
//#define MAX_ 1000

int cou = 0;

int partition(vector<pair<char, int>>&A, int p, int r)
{
	int x = A[r].second;
	int i, j;
//	char cwork;
	i = p - 1;
	for (j = p; j <= r - 1; j++) {
		if (A[j].second <= x) {
			i = i + 1;
			A[i].swap(A[j]);
		}
	}
	A[i + 1].swap(A[r]);
	if (i + 1 != r) cou++;
	return i + 1;
}
void quicksort(vector<pair<char, int>>&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(void)
{
	int number, n;
	char mark;
	vector<pair<char, int>> card(MAX);
	scanf_s("%d", &n);
	for (int i = 0; i < n; ++i) {
		cin >> mark >> number;
		card[i] = make_pair(mark,number);
	}
	//vector<pair<char, int>> card_copy(card);
	quicksort(card, 0, n - 1);
	if (cou > 1) {
		printf("Not stable\n");
	}
	else {
		printf("Stable\n");
	}
	for (int i = 0; i < n; ++i) {
		printf("%c %d\n", card[i].first, card[i].second);
	}

}

Compiler output:
a.cc: In function 'int main()':
a.cc:47:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   47 |         scanf_s("%d", &n);
      |         ^~~~~~~
      |         scanf
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;
 
struct ATAD{
  int numb,did;
  char lac;
};
 
int Kat(ATAD VA[],int p,int r){
  ATAD axa = VA[r];
  int i=p-1;
  for(int j=p;j<r;j++){
    if(VA[j].numb<=axa.numb){
      i++;
      swap(VA[i],VA[j]);
    }
  }
  swap(A[i+1],A[r]);
  return i+1;
}
 
vodid qsot(ATAD A[],int p,int r){
  if(p<r){
    int qaa = Kat(A,p,r);
    qsot(A,p,qaa-1);
    qsot(A,qaa+1,r);
  }
}
 
vodid kakn(ATAD A[],int n){
  for(int i=1;i<n;i++){
    if(A[i-1].numb<A[i].numb)continue;
    if(A[i-1].did<A[i].did)continue;
    cout<<"Not stable"<<endl;
    return;
  }
  cout<<"Stable"<<endl;
}
 
int main(){
  int n;
  ATAD A[100000];
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>A[i].lac>>A[i].numb;
    A[i].did=i;
  }
   
  qsot(A,0,n-1);
  kakn(A,n); 
  for(int i=0;i<n;i++){
    cout<<A[i].lac<<' '<<A[i].numb<<endl;
  }
   
  return 0;
}

Compiler output:
a.cc: In function 'int Kat(ATAD*, int, int)':
a.cc:19:8: error: 'A' was not declared in this scope
   19 |   swap(A[i+1],A[r]);
      |        ^
a.cc: At global scope:
a.cc:23:1: error: 'vodid' does not name a type; did you mean 'void'?
   23 | vodid qsot(ATAD A[],int p,int r){
      | ^~~~~
      | void
a.cc:31:1: error: 'vodid' does not name a type; did you mean 'void'?
   31 | vodid kakn(ATAD A[],int n){
      | ^~~~~
      | void
a.cc: In function 'int main()':
a.cc:50:3: error: 'qsot' was not declared in this scope; did you mean 'qsort'?
   50 |   qsot(A,0,n-1);
      |   ^~~~
      |   qsort
a.cc:51:3: error: 'kakn' was not declared in this scope
   51 |   kakn(A,n);
      |   ^~~~
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;
 
struct ATAD{
  int numb,did;
  char lac;
};
 
int Kat(ATAD VA[],int p,int r){
  ATAD axa = VA[r];
  int i=p-1;
  for(int j=p;j<r;j++){
    if(VA[j].numb<=axa.numb){
      i++;
      swap(VA[i],VA[j]);
    }
  }
  swap(VA[i+1],VA[r]);
  return i+1;
}
 
vodid qsot(ATAD A[],int p,int r){
  if(p<r){
    int qaa = Kat(A,p,r);
    qsot(A,p,qaa-1);
    qsot(A,qaa+1,r);
  }
}
 
vodid kakn(ATAD A[],int n){
  for(int i=1;i<n;i++){
    if(A[i-1].numb<A[i].numb)continue;
    if(A[i-1].did<A[i].did)continue;
    cout<<"Not stable"<<endl;
    return;
  }
  cout<<"Stable"<<endl;
}
 
int main(){
  int n;
  ATAD A[100000];
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>A[i].lac>>A[i].numb;
    A[i].did=i;
  }
   
  qsot(A,0,n-1);
  kakn(A,n); 
  for(int i=0;i<n;i++){
    cout<<A[i].lac<<' '<<A[i].numb<<endl;
  }
   
  return 0;
}

Compiler output:
a.cc:23:1: error: 'vodid' does not name a type; did you mean 'void'?
   23 | vodid qsot(ATAD A[],int p,int r){
      | ^~~~~
      | void
a.cc:31:1: error: 'vodid' does not name a type; did you mean 'void'?
   31 | vodid kakn(ATAD A[],int n){
      | ^~~~~
      | void
a.cc: In function 'int main()':
a.cc:50:3: error: 'qsot' was not declared in this scope; did you mean 'qsort'?
   50 |   qsot(A,0,n-1);
      |   ^~~~
      |   qsort
a.cc:51:3: error: 'kakn' was not declared in this scope
   51 |   kakn(A,n);
      |   ^~~~
Language: C++

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

struct TCard
{
    char Suit;
    int  Num;
    bool operator==(const TCard& C)const
    {
        return Suit == C.Suit && Num == C.Num;
    }
    bool operator <(const TCard& C)const
    {
      return Num < C.Num;
    }
};
typedef std::vector<TCard> TList;

int partition(TList& A, int p, int r)
{
  int x = A[r].Num;
  int i = p - 1;
  for(int j = p; j < r; ++j){
    if(A[j].Num <= x){
      i = i + 1;
      std::swap(A[i],A[j]);
    }
  }
  std::swap(A[i+1],A[r]);
  return i+1;
}

void quickSort(TList& A, int p, int r)
{
  if(p < r){
    int q = partition(A, p, r);
    quickSort(A, p, q-1);
    quickSort(A, q+1, r);
  }
}
TList Input()
{
    int Count;
    std::cin >> Count;
    TList List(Count);
    for(int i = 0; i < Count; ++i){
        std::cin >> List[i].Suit;
        std::cin >> List[i].Num;
    }
    return List;
}
void Output(const TList& List)
{
    TList::const_iterator It = List.begin();
    std::cout << It->Suit << " " It->Num;
    for(++It; It != List.end(); ++It){
        std::cout << "\n" << It->Suit << " " << It->Num;
    }
    std::cout << std::endl;
}
void Check(const TList& List, const TList& Stable)
{
    if(std::equal(List.begin(), List.end(), Stable.begin())){
        std::cout << "Stable" << std::endl;
    }else{
        std::cout << "Not stable" << std::endl;
    }
}

int main()
{
    const TList List = Input();
    TList StableList = List;
    std::stable_sort(StableList.begin(), StableList.end());

    TList QuickList = List;
    quickSort(QuickList, 0, QuickList.size() - 1);
    Check(QuickList, StableList);
    Output(QuickList);
    return 0;
}

Compiler output:
a.cc: In function 'void Output(const TList&)':
a.cc:56:33: error: expected ';' before 'It'
   56 |     std::cout << It->Suit << " " It->Num;
      |                                 ^~~
      |                                 ;
Language: C++

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

struct TCard
{
    char Suit;
    int  Num;
    bool operator==(const TCard& C)const
    {
        return Suit == C.Suit; && Num == C.Num;
    }
    bool operator <(const TCard& C)const
    {
      return Num < C.Num;
    }
    bool operator <=(const TCard& C)const
    {
        return Num <= C.Num;
    }
};
typedef std::vector<TCard> TList;

int partition(TList& A, int p, int r)
{
  int i = p - 1;
  for(int j = p; j < r; ++j){
    if(A[j] <= A[r]){
      i = i + 1;
      std::swap(A[i],A[j]);
    }
  }
  std::swap(A[i+1],A[r]);
  return i+1;
}

void quickSort(TList& A, int p, int r)
{
  if(p < r){
    int q = partition(A, p, r);
    quickSort(A, p, q-1);
    quickSort(A, q+1, r);
  }
}
TList Input()
{
    int Count;
    std::cin >> Count;
    TList List(Count);
    for(int i = 0; i < Count; ++i){
        std::cin >> List[i].Suit;
        std::cin >> List[i].Num;
    }
    return List;
}
void Output(const TList& List)
{
    TList::const_iterator It = List.begin();
    std::cout << It->Suit << " " << It->Num;
    for(++It; It != List.end(); ++It){
        std::cout << "\n" << It->Suit << " " << It->Num;
    }
    std::cout << std::endl;
}
void Check(const TList& List, const TList& Stable)
{
    if(std::equal(List.begin(), List.end(), Stable.begin())){
        std::cout << "Stable" << std::endl;
    }else{
        std::cout << "Not stable" << std::endl;
    }
}

int main()
{
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    const TList List = Input();
    TList StableList = List;
    std::stable_sort(StableList.begin(), StableList.end());

    TList QuickList = List;
    quickSort(QuickList, 0, QuickList.size() - 1);
    Check(QuickList, StableList);
    Output(QuickList);
    return 0;
}

Compiler output:
a.cc: In member function 'bool TCard::operator==(const TCard&) const':
a.cc:11:39: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   11 |         return Suit == C.Suit; && Num == C.Num;
      |                                ~~~~~~~^~~~~~~~
a.cc:11:35: error: label 'Num' used but not defined
   11 |         return Suit == C.Suit; && Num == C.Num;
      |                                   ^~~
Language: C++

#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
using namespace std;
int i, j;
const int num = 100002;
const int numm = 1 + num / 2;
struct Card {
	int numc;
	char pic;
};
Card A[num], B[num];
inline int pertition(int p, int r) {
	int base = A[r].numc;
	int q = p - 1;
	for (i = p; i < r; i++) {
		if (A[i].numc <= base)
			swap(A[++q], A[i]);
	}
	return q + 1;
}
inline void quickSort(int p, int r) {
	if (r > p) {
		int a = pertition(p, r);
		quickSort(p, a - 1);
		quickSort(a + 1, r);
	}
}
inline void merge(int left, int mid, int right) {
	int n1 = mid - left, n2 = right - mid;
	Card I[numm], J[numm];
	for (i = 0; i < n1; i++)
		I[i] = B[left + i];
	for (i = 0; i < n2; i++)
		J[i] = B[mid + i];
	int a = 0, b = 0;
	I[n1].numc = J[n2].numc = INFINITY;
	for (i = left; i < right; i++) {
		if (I[a].numc <= J[b].numc)
			B[i] = I[a++];
		else B[i] = J[b++];
	}
}
inline void mergeSort(int left, int right) {
	if (right > left + 1) {
		int mid = (left + right) / 2;
		mergeSort(left, mid);
		mergeSort(mid, right);
		merge(left, mid, right);
	}
}
int main() {
	int n, v, sta = 1;
	char c[2];
	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%s%d", c, &v);
		A[i].numc = B[i].numc = v;
		A[i].pic = B[i].pic = c[0];
	}
	quickSort(0, n - 1);
	mergeSort(0, n);
	for (i = 0; i < n - 1; i++) {
		if (A[i].pic != B[i].pic)
			sta = 0;
	}
	if (sta) cout << "Stable" << endl;
	else cout << "Not stable" << endl;
	for (i = 0; i < n; i++) {
		printf("%c %d", A[i].pic, A[i].numc);

	}
	return 0;
}

Compiler output:
a.cc: In function 'void merge(int, int, int)':
a.cc:38:35: error: 'INFINITY' was not declared in this scope
   38 |         I[n1].numc = J[n2].numc = INFINITY;
      |                                   ^~~~~~~~
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[MAX], B[MAX];
    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);   
 
    bool flg = true;
    for(int i=0; i<n; i++){
        if(!(A[i].a==B[i].a && A[i].b==B[i].b)){
            flg = false;
            break;
        }
    }
    if(flg){
        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:46:12: error: 'MAX' was not declared in this scope
   46 |     Card A[MAX], B[MAX];
      |            ^~~
a.cc:48:16: error: 'A' was not declared in this scope
   48 |         cin >> A[i].a >> A[i].b;
      |                ^
a.cc:49:9: error: 'B' was not declared in this scope
   49 |         B[i] = A[i];
      |         ^
a.cc:52:15: error: 'A' was not declared in this scope
   52 |     quickSort(A, 0, n-1);
      |               ^
a.cc:53:17: error: 'B' was not declared in this scope
   53 |     stable_sort(B, B+n, compare_as_ints);
      |                 ^
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;
 
struct Card{
    char pic;
    int  num;
};
 
bool compare_as_ints(Card i, Card j)        
{
    return (i.num<j.num;
}
 
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].pic >> A[i].num;
        B[i] = A[i];
    }
 
    quickSort(A, 0, n-1);
    stable_sort(B, B+n, compare_as_ints);   
 
    bool flg = true;
    for(int i=0; i<n; i++){
        if(!(A[i].pic==B[i].pic && A[i].num==B[i].num)){
            flg = false;
            break;
        }
    }
    if(flg){
        cout << "Stable" << endl;
    }
    else{
        cout << "Not stable" << endl;
    }
 
    for(int i=0; i<n; i++){
        cout << A[i].pic << ' ' << A[i].num << endl;
    }
 
    return 0;
}

Compiler output:
a.cc: In function 'bool compare_as_ints(Card, Card)':
a.cc:12:24: error: expected ')' before ';' token
   12 |     return (i.num<j.num;
      |            ~           ^
      |                        )
a.cc: In function 'int partition(Card*, int, int)':
a.cc:21:17: error: 'struct Card' has no member named 'b'
   21 |         if(A[j].b<=x.b){
      |                 ^
a.cc:21:22: error: 'struct Card' has no member named 'b'
   21 |         if(A[j].b<=x.b){
      |                      ^
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
}

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);
	int c=0;
	for(int i=0;i<n;i++){
		if(A[i].a!=B[i].a||A[i].b!=B[i].b){
			c++;
		}
	}
	if(c>0){
		cout<<"Not stable"<<endl;
	}else{
		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 'int partition(Card*, int, int)':
a.cc:29:19: error: expected ';' before '}' token
   29 |         return i+1
      |                   ^
      |                   ;
   30 | }
      | ~                  
a.cc: In function 'int main()':
a.cc:43:9: error: 'quickSort' was not declared in this scope
   43 |         quickSort(A,0,n-1);
      |         ^~~~~~~~~
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);
	int c=0;
	for(int i=0;i<n;i++){
		if(A[i].a!=B[i].a||A[i].b!=B[i].b){
			c++;
		}
	}
	if(c>0){
		cout<<"Not stable"<<endl;
	}else{
		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 'int partition(Card*, int, int)':
a.cc:29:19: error: expected ';' before '}' token
   29 |         return i+1
      |                   ^
      |                   ;
   30 | }
      | ~
Language: C++

#include<iostream>
using namespace std;

struct Card{
	char a;
	int x;
}

int partition(Card *C,int p,int r){
   Card s = C[r];
   int i = p-1;
   Card tmp;
   for(int j=p;j<=r-1;j++){
	   if(C[j].x<=s.x){
         i++;
		 tmp=C[i];
		 C[i]=C[j];
		 C[j]=tmp;
      }
   }
   tmp=C[i+1];
   C[i+1]=C[r];
   C[r]=tmp;

   return i+1;
}

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

int main(){
   int n;
   cin>>n;
   Card *card=new Card[n+1];
   for(int i=1;i<n+1;i++){
      cin>>card[i].a>>card[i].x;
   }

   quickSort(card,1,n);

    for(int i=1;i<n+1;i++){
      cout<<card[i].a<<' '<<card[i].x<<endl;
   }

	
	
	delete[] card;
    return 0;
}

Compiler output:
a.cc:7:2: error: expected ';' after struct definition
    7 | }
      |  ^
      |  ;
Language: C++

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

struct Card{
	char a;
	int x;
};

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

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

bool judge(Card i,Card j){
	return (i.x<j.x);
}

int main(){
   int n;
   cin>>n;
   Card *card=new Card[n+1];
   Card *sample=new Card[n+1];
   for(int i=1;i<n+1;i++){
      cin>>card[i].a>>card[i].x;
	  sample[i]=card[i];
   }

   quickSort(card,1,n);
   stable_sort(sample,sample+n,judge);

   bool j=true;
   for(int i=1;i<n+1;i++){
	  if(card[i].a!=sample[i].a){
		  j=false;
		  break;
	   }
   }
   if(j==true){
		cout<<"Stable"<<endl;
   }
   else{
	   cout<<"Not Stable"<<endl;
   }

   for(int i=1;i<n+1;i++){
      cout<<card[i].a<<' '<<card[i].x<<endl;
   }

??????delete[] card;
    delete[] sample;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:67:1: error: expected primary-expression before '?' token
   67 | ??????delete[] card;
      | ^
a.cc:67:2: error: expected primary-expression before '?' token
   67 | ??????delete[] card;
      |  ^
a.cc:67:3: error: expected primary-expression before '?' token
   67 | ??????delete[] card;
      |   ^
a.cc:67:4: error: expected primary-expression before '?' token
   67 | ??????delete[] card;
      |    ^
a.cc:67:5: error: expected primary-expression before '?' token
   67 | ??????delete[] card;
      |     ^
a.cc:67:6: error: expected primary-expression before '?' token
   67 | ??????delete[] card;
      |      ^
a.cc:67:20: error: expected ':' before ';' token
   67 | ??????delete[] card;
      |                    ^
      |                    :
a.cc:67:20: error: expected primary-expression before ';' token
a.cc:67:20: error: expected ':' before ';' token
   67 | ??????delete[] card;
      |                    ^
      |                    :
a.cc:67:20: error: expected primary-expression before ';' token
a.cc:67:20: error: expected ':' before ';' token
   67 | ??????delete[] card;
      |                    ^
      |                    :
a.cc:67:20: error: expected primary-expression before ';' token
a.cc:67:20: error: expected ':' before ';' token
   67 | ??????delete[] card;
      |                    ^
      |                    :
a.cc:67:20: error: expected primary-expression before ';' token
a.cc:67:20: error: expected ':' before ';' token
   67 | ??????delete[] card;
      |                    ^
      |                    :
a.cc:67:20: error: expected primary-expression before ';' token
a.cc:67:20: error: expected ':' before ';' token
   67 | ??????delete[] card;
      |                    ^
      |                    :
a.cc:67:20: error: expected primary-expression before ';' token
Language: C++

#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <cstdio>
using namespace std;
??
#define MAX 100000
#define INF 2000000000
??
typedef struct {
????char suit;
????int value;
} Card;
??
Card L[MAX / 2 + 2], R[MAX / 2 + 2];
??
int partition(Card A[], int p, int r) {
????Card x;
????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(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(Card B[], int left, int mid, int right) {
????int n1 = mid - left;
????int n2 = right - mid;
????for ( int i = 0; i < n1; i++ ) L[i] = B[left + i];
????for ( int i = 0; i < n2; i++ ) R[i] = B[mid + 1];
????L[n1].value = R[n2].value = INF;
????int i, j;
????i = j = 0;
????for ( int k = left; k < right; k++ ) {
????????if ( L[i].value <= R[j].value ) B[k] = L[i++];
????????else B[k] = R[j++];
????}
}
??
void mergeSort(Card B[], int left, int right) {
????if ( left + right < 1) {
????????int mid = (left + right) / 2;
????????mergeSort(B, left, mid);
????????mergeSort(B, mid, right);
????????merge(B, left, mid, right);
????}
}
??
int main() {
????int n;
????Card A[MAX];
????Card B[MAX];
????char S[10];
????int stable = 1;
??
????cin >> n;
????for ( int i = 0; i < n; i++ ) {
????????scanf("%s %d", S, &A[i].value);
????????A[i].suit = B[i].suit = S[0];
????????B[i].value = A[i].value;
????}
??
????quickSort(A, 0, n - 1);
????mergeSort(B, 0, n);
??
????for ( int i = 0; i < n; i++ ) {
????????if ( A[i].suit != B[i].suit ) {
????????????stable = 0;
????????????break;
????????}
????}
??
????if ( stable == 1 ) printf("Stable\n");
????else printf("Not stable\n");
????for ( int i = 0; i < n; i++ ) {
????????cout << A[i].suit << " " << A[i].value << endl;
????}
??
????return 0;
}

Compiler output:
a.cc:7:1: error: expected unqualified-id before '?' token
    7 | ??
      | ^
a.cc:14:3: error: 'Card' does not name a type
   14 | } Card;
      |   ^~~~
a.cc:15:1: error: expected unqualified-id before '?' token
   15 | ??
      | ^
a.cc:17:1: error: expected unqualified-id before '?' token
   17 | ??
      | ^
a.cc:31:1: error: expected unqualified-id before '?' token
   31 | ??
      | ^
a.cc:39:1: error: expected unqualified-id before '?' token
   39 | ??
      | ^
a.cc:53:1: error: expected unqualified-id before '?' token
   53 | ??
      | ^
a.cc:62:1: error: expected unqualified-id before '?' token
   62 | ??
      | ^
Language: C++

#include <iostream>
#include <cstdio>
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 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[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);
  }
}

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, 0, n);
  quickSort(B, 0, n - 1);

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

 mergeSort(A, 0, n);
  quickSort(B, 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 printf("Not stable\n");
  for ( int i = 0; i < n; i++ ) {
    printf("%c %d\n", B[i].suit, B[i].value);
    // 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:45:9: error: 'partition' was not declared in this scope
   45 |     q = partition(A, p, r);
      |         ^~~~~~~~~
Language: C++

#include <iostream>
#include <cstdio>
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 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[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);
  }
}
 
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, 0, n);
  quickSort(B, 0, n - 1);
 
  for ( i = 0; i < n; i++ ) {
    if ( A[i].suit != B[i].suit ) {
      stable = 0;
      break;
    }
  }
 
 mergeSort(A, 0, n);
  quickSort(B, 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 printf("Not stable\n");
  for ( int i = 0; i < n; i++ ) {
    printf("%c %d\n", B[i].suit, B[i].value);
    // 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:45:9: error: 'partition' was not declared in this scope
   45 |     q = partition(A, p, r);
      |         ^~~~~~~~~
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(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 = SENTINEL;
    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 t, x;
	x = A[r];
	i = p - 1;
	for(j = P; j < r ;j++) {
		if(A[j].value <= x.value) {
			i++;
			t = A[i]; A[i] = A[j]; A[j] = t;
		}
	}
	t = A[i + 1]; A[i + 1] = A[r]; A[i] = t;	
    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, 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 satble\n");
	for(int i = 0; i < n; i++ ) {
		printf("%c %d\n", B[i].suit, B[i].value);
	}
	
	return 0;	
	
}

Compiler output:
a.cc: In function 'int partition(Card*, int, int)':
a.cc:45:17: error: 'P' was not declared in this scope
   45 |         for(j = P; j < r ;j++) {
      |                 ^
Language: C++

#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
const int N = 100005;
struct Card
{
	char suit;
	int value;
	friend bool operator<(const Card& a, const Card& b)
	{
		return a.value < b.value;
	}
} card[N], t[N];
int partition(Card arr[], int p, int r)	//[p, r)????????????,????????????pivot??????
{
	int pivot = arr[r - 1].value;
	int i = p;
	for (int j = p; j < r - 1; ++j)
	{
		if (arr[j].value <= pivot)
		{
			swap(arr[i++], arr[j]);
		}
	}
	swap(arr[i], arr[r - 1]);
	return i;
}

void q_sort(Card arr[], int l, int r)
{
	if (l + 1 < r)
	{
		int t = partition(arr, l, r);
		q_sort(arr, l, t);
		q_sort(arr, t, r);
	}
}

int main(void)
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	for (int i = 0; i < n; ++i)
		cin >> card[i].suit >> card[i].value;
	memcpy(t, card, sizeof(Card) * n);
	q_sort(card, 0, n);
	stable_sort(t, t + n);
	bool flag = true;
	for (int i = 0; i < n; ++i)
	{
		if (card[i].suit != t[i].suit)
		{
			flag = false;
			break;
		}
	}
	if (flag)
		cout << "Stable" << endl;
	else
		cout << "Not stable" << endl;

	for (int i = 0; i < n; ++i)
		cout << card[i].suit << ' ' << card[i].value << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:48:9: error: 'memcpy' was not declared in this scope
   48 |         memcpy(t, card, sizeof(Card) * n);
      |         ^~~~~~
a.cc:4:1: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <algorithm>
  +++ |+#include <cstring>
    4 | using namespace std;
Language: C++

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

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 = SENTTINEL;
  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 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) {
  int i, j;
  struct Card t, x;
  x = A[r];
  i = p - 1;
  for ( j = p; j < r; j++ ) {
    if ( A[j].value <= x.value ) {
      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 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 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 ) printf("Stable\n"):
  else 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: In function 'void merge(Card*, int, int, int, int)':
a.cc:18:31: error: 'SENTTINEL' was not declared in this scope; did you mean 'SENTINEL'?
   18 |   L[n1].value = R[n2].value = SENTTINEL;
      |                               ^~~~~~~~~
      |                               SENTINEL
a.cc: In function 'int main()':
a.cc:83:40: error: expected ';' before ':' token
   83 |   if ( stable == 1 ) printf("Stable\n"):
      |                                        ^
      |                                        ;