Language: C

#include<stdio.h>
#define MAX 100001
#define INI 2000000000

 struct Card{
           gara;
           value;
           };

 struct Card card1[MAX];

 struct Card card2[MAX];

 int merge(struct Card card1[],int n,int left,int right,int mid){
          int i,n1,n2,j,k;
          struct card L[MAX/2+2],R[MAX/2+2];
          n1=(mid-left);
          n2=(right-mid);
          for(i=0;i<n1;i++){L[i]=card1[left+i];}
          for(j=0;j<n2;j++){R[j]=card1[mid+j];}
          L[n1].value=INI;
          R[n2].value=INI;
          
          i=0;j=0;
          for(k=left;k<right;k++){
                      if(L[i].value<=R[j].value){card[k]=L[i];i++;}
                      else {card[k]=R[j];j++;}
                      }
          }
          

 int mergesort(struct Card card1[],int n,int left,int right){
          int mid;
          if(right-left>1){
                    mid=(left+right)/2;
                    mergesort(card1,n,left,mid);
                    mergesort(card1,n,mid,right);
                    merge(card1,n,left,right,mid);
                    }
           }

 int part(struct Card card1[],int n,int left,int right){
      struct card tmp,key;
      key=card2[right];
      int i,j;
      
      i=left-1;
      for(j=left;j<right;j++){
               if(card2[j].value<=key.value){
                                i++;
                                tmp=card2[i];card2[i]=card2[j];card2[j]=tmp;
                                }
               }
       i++;
       tmp=card2[i];card2[i]=card2[right];card2[right]=tmp;
       return i;
       }
   

 int quick(struct Card card2[],int n,int left,int right){
      int q;
      if(left<right){
          q=part(card2,n,left,right);
          quick(card2,n,left,q-1);
          quick(card2,n,q+1,right);
          }
       }

 int main(){
        int n,v,flag=1;
        char c[10];
        scanf("%d",&n);
        for(i=0;i<n;i++){
                  scanf("%s%d",c,v);
                  card2[i].gara=card1[i].gara=c[0];
                  card2[i].value=card1[i].value=v;
                  }

        mergesort(card1,n,0,n);
        quick(card2,n,0,n-1);

        for(i=0;i<n;i++){
                  if(card1[i].gara!=card2[i].gara)flag=0;
                  }
        if(flag==1){printf("Stable\n");
        else {printf("Not stable\n");

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






Compiler output:
main.c:6:12: error: expected specifier-qualifier-list before 'gara'
    6 |            gara;
      |            ^~~~
main.c: In function 'merge':
main.c:16:23: error: array type has incomplete element type 'struct card'
   16 |           struct card L[MAX/2+2],R[MAX/2+2];
      |                       ^
main.c:16:34: error: array type has incomplete element type 'struct card'
   16 |           struct card L[MAX/2+2],R[MAX/2+2];
      |                                  ^
main.c:26:50: error: 'card' undeclared (first use in this function)
   26 |                       if(L[i].value<=R[j].value){card[k]=L[i];i++;}
      |                                                  ^~~~
main.c:26:50: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'part':
main.c:43:19: error: storage size of 'tmp' isn't known
   43 |       struct card tmp,key;
      |                   ^~~
main.c:43:23: error: storage size of 'key' isn't known
   43 |       struct card tmp,key;
      |                       ^~~
main.c:49:27: error: 'struct Card' has no member named 'value'
   49 |                if(card2[j].value<=key.value){
      |                           ^
main.c: In function 'main':
main.c:73:13: error: 'i' undeclared (first use in this function)
   73 |         for(i=0;i<n;i++){
      |             ^
main.c:86:9: error: expected '}' before 'else'
   86 |         else {printf("Not stable\n");
      |         ^~~~
main.c:90:9: error: expected declaration or statement at end of input
   90 |         }
      |         ^