Language: C++

#include <iostream>
#include<algorithm>
unsigned 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);

     for(int i=;i<n;i++){
       cout << A[i].a << ' '<< A[i].b << endl;
     }
#include <iostream>
#include<algorithm>
unsigned 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);

     for(int i=;i<n;i++){
       cout << A[i].a << ' '<< A[i].b << endl;
     }

     return 0;
   }
     return 0;
   }


Compiler output:
a.cc:3:10: error: expected unqualified-id before 'namespace'
    3 | unsigned namespace std;
      |          ^~~~~~~~~
a.cc: In function 'int partition(Card*, int, int)':
a.cc:22:9: error: 'swap' was not declared in this scope
   22 |         swap(A[i],A[j]);
      |         ^~~~
a.cc:22:9: note: suggested alternatives:
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
                 from /usr/include/c++/14/string:68,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/tuple:2823:5: note:   'std::swap'
 2823 |     swap(tuple<_Elements...>&, tuple<_Elements...>&) = delete;
      |     ^~~~
In file included from /usr/include/c++/14/bits/exception_ptr.h:41,
                 from /usr/include/c++/14/exception:166,
                 from /usr/include/c++/14/ios:41:
/usr/include/c++/14/bits/move.h:226:5: note:   'std::swap'
  226 |     swap(_Tp& __a, _Tp& __b)
      |     ^~~~
/usr/include/c++/14/bits/move.h:226:5: note:   'std::swap'
/usr/include/c++/14/bits/exception_ptr.h:229:5: note:   'std::__exception_ptr::swap'
  229 |     swap(exception_ptr& __lhs, exception_ptr& __rhs)
      |     ^~~~
a.cc:25:5: error: 'swap' was not declared in this scope
   25 |     swap(A[i+1],A[r]);
      |     ^~~~
a.cc:25:5: note: suggested alternatives:
/usr/include/c++/14/tuple:2823:5: note:   'std::swap'
 2823 |     swap(tuple<_Elements...>&, tuple<_Elements...>&) = delete;
      |     ^~~~
/usr/include/c++/14/bits/move.h:226:5: note:   'std::swap'
  226 |     swap(_Tp& __a, _Tp& __b)
      |     ^~~~
/usr/include/c++/14/bits/move.h:226:5: note:   'std::swap'
/usr/include/c++/14/bits/exception_ptr.h:229:5: note:   'std::__exception_ptr::swap'
  229 |     swap(exception_ptr& __lhs, exception_ptr& __rhs)
      |     ^~~~
a.cc: In function 'int main()':
a.cc:42:6: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   42 |      cin>>n;
      |      ^~~
      |      std::cin
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:51:6: error: 'stable_sort' was not declared in this scope; did you mean 'std::stable_sort'?
   51 |      stable_sort(B,B+n,compare_as_ints);
      |      ^~~~~~~~~~~
      |      std::stable_sort
In file included from /usr/include/c++/14/algorithm:86,
                 from a.cc:2:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:306:1: note: 'std::stable_sort' declared here
  306 | stable_sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~~~~~~~~
a.cc:53:16: error: expected primary-expression before ';' token
   53 |      for(int i=;i<n;i++){
      |                ^
a.cc:54:8: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   54 |        cout << A[i].a << ' '<< A[i].b << endl;
      |        ^~~~
      |        std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:54:42: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   54 |        cout << A[i].a << ' '<< A[i].b << endl;
      |                                          ^~~~
      |                                          std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
a.cc:58:10: error: expected unqualified-id before 'namespace'
   58 | unsigned namespace std;
      |          ^~~~~~~~~
a.cc:66:3: error: a function-definition is not allowed here before '{' token
   66 |   {
      |   ^
a.cc:70:3: error: a function-definition is not allowed here before '{' token
   70 |   {
      |   ^
a.cc:86:3: error: a function-definition is not allowed here before '{' token
   86 |   {
      |   ^
a.cc:94:12: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   94 |    int main()
      |            ^~
a.cc:94:12: note: remove parentheses to default-initialize a variable
   94 |    int main()
      |            ^~
      |            --
a.cc:94:12: note: or replace parentheses with braces to value-initialize a variable
a.cc:95:4: error: a function-definition is not allowed here before '{' token
   95 |    {
      |    ^