Language: C

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

 struct Card{
           gara;
           value;
           };



 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;
        struct Card card1[MAX];

        struct Card card2[MAX];
        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:19:16: error: 'struct Card' has no member named 'value'
   19 |           L[n1].value=INI;
      |                ^
main.c:20:16: error: 'struct Card' has no member named 'value'
   20 |           R[n2].value=INI;
      |                ^
main.c:24:30: error: 'struct Card' has no member named 'value'
   24 |                       if(L[i].value<=R[j].value){card[k]=L[i];i++;}
      |                              ^
main.c:24:42: error: 'struct Card' has no member named 'value'
   24 |                       if(L[i].value<=R[j].value){card[k]=L[i];i++;}
      |                                          ^
main.c:24:50: error: 'card' undeclared (first use in this function); did you mean 'Card'?
   24 |                       if(L[i].value<=R[j].value){card[k]=L[i];i++;}
      |                                                  ^~~~
      |                                                  Card
main.c:24:50: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'part':
main.c:42:11: error: 'card2' undeclared (first use in this function); did you mean 'card1'?
   42 |       key=card2[right];
      |           ^~~~~
      |           card1
main.c:47:38: error: 'struct Card' has no member named 'value'
   47 |                if(card2[j].value<=key.value){
      |                                      ^
main.c: In function 'main':
main.c:74:13: error: 'i' undeclared (first use in this function)
   74 |         for(i=0;i<n;i++){
      |             ^
main.c:87:9: error: expected '}' before 'else'
   87 |         else {printf("Not stable\n");
      |         ^~~~
main.c:91:9: error: expected declaration or statement at end of input
   91 |         }
      |         ^