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

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

int partition(int *array,int p,int r){
   double x = array[r];
   int i = p-1;
   for(unsigned j=p;j<r-1;j++){
      if(array[j]<=x){
         i=i+1;
		 double tmp=array[i];
		 array[j]=tmp;
         array[i]=array[j];
      }
   }
   double tmp;
   array[i+1]=array[r];
   array[r]=tmp;
   return i+1;
}

int main(){
   int n;
   cin>>n;
   int *A=new int[n+1];
   for(unsigned i=1;i<n+1;i++){
      cin>>A[n];
   }
   int x=partition(A,1,n);
   for(unsigned i=0;i<n;i++){
      if(x==i){
         cout<<"["<<A[i]<<"] ";
      }
      else{
         cout<<A[i]<<" ";
      }
      return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:2: error: expected '}' at end of input
   38 | }
      |  ^
a.cc:22:11: note: to match this '{'
   22 | int main(){
      |           ^
Language: C++

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


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;

	int A[100000];
	for(int i=0;i<n;i++){
		cin>>A[i];
	}
	int q=partition(A,0,n-1);
	for(int i=0;i<n;i++){
		if(i==q){
			cout<<'['<<A[i]<<']';
		}else{
			cout<<A[i];
		}
		if(i<n-1){
			cout<<' ';
		}else{
			cout<<endl;
		}
	}
	return 0;
}

Compiler output:
a.cc:6:15: error: 'Card' was not declared in this scope
    6 | int partition(Card A[], int p, int r) {
      |               ^~~~
a.cc:6:25: error: expected primary-expression before 'int'
    6 | int partition(Card A[], int p, int r) {
      |                         ^~~
a.cc:6:32: error: expected primary-expression before 'int'
    6 | int partition(Card A[], int p, int r) {
      |                                ^~~
a.cc:6:37: error: expression list treated as compound expression in initializer [-fpermissive]
    6 | int partition(Card A[], int p, int r) {
      |                                     ^
a.cc: In function 'int main()':
a.cc:27:15: error: reference to 'partition' is ambiguous
   27 |         int q=partition(A,0,n-1);
      |               ^~~~~~~~~
In file included from /usr/include/c++/14/algorithm:86,
                 from a.cc:2:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:275:1: note: candidates are: 'template<class _ExecutionPolicy, class _ForwardIterator, class _UnaryPredicate> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator> std::partition(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _UnaryPredicate)'
  275 | partition(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _UnaryPredicate __pred);
      | ^~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:4573:5: note:                 'template<class _BIter, class _Predicate> _BIter std::partition(_BIter, _BIter, _Predicate)'
 4573 |     partition(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~~~~
a.cc:6:5: note:                 'int partition'
    6 | int partition(Card A[], int p, int r) {
      |     ^~~~~~~~~
Language: C++

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


int partition(int A[], int p, int r) {
	int 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;

	int A[100000];
	for(int i=0;i<n;i++){
		cin>>A[i];
	}
	int q=partition(A,0,n-1);
	for(int i=0;i<n;i++){
		if(i==q){
			cout<<'['<<A[i]<<']';
		}else{
			cout<<A[i];
		}
		if(i<n-1){
			cout<<' ';
		}else{
			cout<<endl;
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int partition(int*, int, int)':
a.cc:10:26: error: request for member 'b' in '*(A + ((sizetype)(((long unsigned int)j) * 4)))', which is of non-class type 'int'
   10 |                 if (A[j].b <= x.b) {
      |                          ^
a.cc:10:33: error: request for member 'b' in 'x', which is of non-class type 'int'
   10 |                 if (A[j].b <= x.b) {
      |                                 ^
Language: C++

#include <iostream>
using namespace std;

int A[100000];

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

int main()
{
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i)
        cin >> A[i];

    int index = partition(0, n - 1);

    for (int i = 0; i < n - 1; ++i) {
        if (i == index) {
            cout << "[" << A[i] << "] ";
        } else {
            cout << A[i] << " ";
        }
    }
    if (n-1 != index) {
        cout << A[n-1] << endl;
    } else {
        cout << "[" << A[n-1] << "]" << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:42:2: error: expected '}' at end of input
   42 | }
      |  ^
a.cc:21:1: note: to match this '{'
   21 | {
      | ^
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;
int n,a[100000];
int main(){
  cin>>n;
  for(int i=0;i<n;i++)cin>>a[i];
  int tmp=a[n-1],i=-1;
  for(int j=0;j<n;j++){
    if(a[j]<tmp){
      i++
      swap(a[i],a[j]);
    }
  }
  swap(a[i+1],a[n-1]);
  for(int j=0;j<n;j++){
    if(j)cout<<" ";
    i+1==j?cout<<'['<<a[j]<<']':cout<<a[j];
  }cout<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:10: error: expected ';' before 'swap'
   11 |       i++
      |          ^
      |          ;
   12 |       swap(a[i],a[j]);
      |       ~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;

#define MAX 500000

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

int main(){
    int A[MAX],n;
    scanf("%d",&n);
    for(i=0;i<n;i++) scanf("%d",&A[i]);
    int q = partition(A,0,n-1);

    for(i=0;i<n;i++){
        if(i) printf(" ");
        if(i==q) printf("[");
        printf("%d",A[i]);
        if(i==q) printf("]");
    }
    printf("\n");

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:9: error: 'i' was not declared in this scope
   22 |     for(i=0;i<n;i++) scanf("%d",&A[i]);
      |         ^
a.cc:25:9: error: 'i' was not declared in this scope
   25 |     for(i=0;i<n;i++){
      |         ^
Language: C++

#include<iostream>
using namespace std;

int a[100000],n;

int part(a[],p,r)
{
	int x=a[r];
	int i=p-1;
	for(int j=p;j<r;)
	{
		if(a[j]<=x)
		{
			i++;
			swap(a[i],a[j]);
		}
	}
	swap(a[i+1],a[r]);
	return i+1;
}

int main()
{
	cin>>n;
	for(int i=0;i<n;cin>>a[i++];);
	int q=part(a,0,n-1);
	for(int i=0;i<n;i++)
	{
		if(i)cout<<" ";
		if(i==q)cout<<"[";
		cout<<a[i];
		if(i==q)cout<<"]";
	}
	return 0;
}

Compiler output:
a.cc:6:12: error: expected primary-expression before ']' token
    6 | int part(a[],p,r)
      |            ^
a.cc:6:14: error: 'p' was not declared in this scope
    6 | int part(a[],p,r)
      |              ^
a.cc:6:16: error: 'r' was not declared in this scope
    6 | int part(a[],p,r)
      |                ^
a.cc:6:17: error: expression list treated as compound expression in initializer [-fpermissive]
    6 | int part(a[],p,r)
      |                 ^
a.cc: In function 'int main()':
a.cc:25:36: error: expected ')' before ';' token
   25 |         for(int i=0;i<n;cin>>a[i++];);
      |            ~                       ^
      |                                    )
a.cc:25:37: error: expected primary-expression before ')' token
   25 |         for(int i=0;i<n;cin>>a[i++];);
      |                                     ^
a.cc:26:19: error: 'part' cannot be used as a function
   26 |         int q=part(a,0,n-1);
      |               ~~~~^~~~~~~~~
Language: C++

#include<iostream>
using namespace std;

int a[100000],n;

int part(int a[],int p,int r)
{
	int x=a[r];
	int i=p-1;
	for(int j=p;j<r;)
	{
		if(a[j]<=x)
		{
			i++;
			swap(a[i],a[j]);
		}
	}
	swap(a[i+1],a[r]);
	return i+1;
}

int main()
{
	cin>>n;
	for(int i=0;i<n;cin>>a[i++];);
	int q=part(a,0,n-1);
	for(int i=0;i<n;i++)
	{
		if(i)cout<<" ";
		if(i==q)cout<<"[";
		cout<<a[i];
		if(i==q)cout<<"]";
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:36: error: expected ')' before ';' token
   25 |         for(int i=0;i<n;cin>>a[i++];);
      |            ~                       ^
      |                                    )
a.cc:25:37: error: expected primary-expression before ')' token
   25 |         for(int i=0;i<n;cin>>a[i++];);
      |                                     ^
Language: C++

int partition(int A[], int p, int r)
{
	int i,j,x,temp;
	
	x=A[r];
	i=p-1;
	for(j=p;j<=r-1;j++)
	{
		if(A[j]<=x)
		{
			i++;
			temp=A[j];
			A[j]=A[i];
			A[i]=temp;
		}
	}
	temp=A[r];
	A[r]=A[i+1];
	A[i+1]=temp;
	return i+1;
}

int main()
{
	int i,n,j,k=0;
	int A[100000];
	
	scanf("%d",&n);
	for(i=0;i<=n-1;i++) scanf("%d",&A[i]);
	j=partition(A,0,n-1);
	for(i=0;i<=n-1;i++)
	{
		if(i>0) printf(" ");
		if(i==j) printf("[%d]",A[i]);
		else printf("%d",A[i]);
	}
	printf("\n");
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:9: error: 'scanf' was not declared in this scope
   28 |         scanf("%d",&n);
      |         ^~~~~
a.cc:33:25: error: 'printf' was not declared in this scope
   33 |                 if(i>0) printf(" ");
      |                         ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | int partition(int A[], int p, int r)
a.cc:34:26: error: 'printf' was not declared in this scope
   34 |                 if(i==j) printf("[%d]",A[i]);
      |                          ^~~~~~
a.cc:34:26: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
a.cc:35:22: error: 'printf' was not declared in this scope
   35 |                 else printf("%d",A[i]);
      |                      ^~~~~~
a.cc:35:22: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
a.cc:37:9: error: 'printf' was not declared in this scope
   37 |         printf("\n");
      |         ^~~~~~
a.cc:37:9: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
Language: C++

#include <iostream>
#include <string>
using namespace std;
??
int partition(int *A, int p, int r) {
????int x = A[r];
????int tmp;
????int i = p - 1;
????for (int j = p; j < r; j++) {
????????if (A[j] <= x) {
????????????i++;
????????????tmp = A[i]; A[i] = A[j]; A[j] = tmp;
????????}
????}
????i++;
????tmp = A[i]; A[i] = A[r]; A[r] = tmp;
????return i;
}
??
int main() {
????cin.tie(0);
????ios::sync_with_stdio(false);
??
????int n, q;
????cin >> n;
??
????int A[100000];
????for (int i = 0; i < n; i++) {
????????cin >> A[i];
????}
??
????q = partition(A, 0, n - 1);
??
??
????for (int i = 0; i < n; i++) {
????????if (i > 0) cout << " ";
????????if (i == q) cout << "[";
????????cout << A[i];
????????if (i == q) cout << "]";
????}
????cout << endl;
??
????return 0;
}

Compiler output:
a.cc:4:1: error: expected unqualified-id before '?' token
    4 | ??
      | ^
a.cc:19:1: error: expected unqualified-id before '?' token
   19 | ??
      | ^
Language: C++

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

using namespace std;

static void inputArray(int A[], int num) {
  for (int i = 0; i < num; i++) {
    cin >> A[i]; 
  }
}

static void printArray(int A[], int num, int q) {
  for (int i = 0; i < num; i++) {
    cout << (i != 0 ? " " : "");
    if (i != q) {
      cout << A[i];
    else {
      cout << '[' << A[i] << ']';
    }
  }
  cout << endl; 
}

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

int main() {
  int n;
  cin >> n;

  vector<int> A(n);
  inputArray(&A[0], n);
  
  int q = partition(&A[0], 0, n - 1);
  printArray(&A[0], n, q);
    
  return 0;
}



Compiler output:
a.cc: In function 'void printArray(int*, int, int)':
a.cc:18:5: error: expected '}' before 'else'
   18 |     else {
      |     ^~~~
a.cc:16:17: note: to match this '{'
   16 |     if (i != q) {
      |                 ^
Language: C++

#include<iostream>
using namespace std;
int n;
int A[100000];
int partition(A,p,r){
  x = A[r];
  i = p - 1;
  for(int j=p;r-1;j++){
    if(A[j] <= x){
      i = i+1;
      swap(A[i],A[j]);
    }
  }
  swap(A[i+1],A[r]);
}
int main(){
  int pos = partiton(A[],A,A+n);
  for(int i = 0;i<pos;i++)cout << A[i] << " ";
  cout << "["<<A[pos]<<"] ";
  for(int i = pos+1; i < n;i++)cout <<A[i] <<" ";
  cout << endl;
}


Compiler output:
a.cc:5:17: error: 'p' was not declared in this scope
    5 | int partition(A,p,r){
      |                 ^
a.cc:5:19: error: 'r' was not declared in this scope
    5 | int partition(A,p,r){
      |                   ^
a.cc:5:20: error: expression list treated as compound expression in initializer [-fpermissive]
    5 | int partition(A,p,r){
      |                    ^
a.cc: In function 'int main()':
a.cc:17:24: error: expected primary-expression before ']' token
   17 |   int pos = partiton(A[],A,A+n);
      |                        ^
a.cc:17:13: error: 'partiton' was not declared in this scope; did you mean 'partition'?
   17 |   int pos = partiton(A[],A,A+n);
      |             ^~~~~~~~
      |             partition
Language: C++

#include <iostream>


using namespace std;

int partition(int *A ,int p ,int r){
  int x = A[r];
  int i = p-1;
  int tmp;
  for(int j=0;j<r;j++){
    if(A[j] <= x){
      i++;
      tmp = A[i];
      A[i] = A[j];
      A[j] = tmp;
    }
  }
  tmp = A[i+1];
  A[i+1] = A[r];
  A[r] = tmp;
  return i+1;
}

int main(){
  int n,q;
  int A[100000];

  while(1){
    cin >> n;
    if(cin.,eof())
      break;
    char c = ' ';
    for(int i=0;i<n;i++){
      cin >> A[i];
    }
    q = partition(A,0,n-1);
    for(int i=0;i<n;i++){
      if(i == n-1)
        c = '\n';
      if(i == q)
        //printf("[%d]%c",A[i],c);
        cout << '[' << A[i] << ']' << c;
      else
        //printf("%d%c",A[i],c);
        cout << A[i] << c;
    }
  }
  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:30:12: error: expected unqualified-id before ',' token
   30 |     if(cin.,eof())
      |            ^
a.cc:30:13: error: 'eof' was not declared in this scope; did you mean 'feof'?
   30 |     if(cin.,eof())
      |             ^~~
      |             feof
Language: C++

#include<stdio.h>
#define MAX 100000

int A[MAX], n;

int partition( int p, int r ) {
  int x, i, j, tmp;
  x = A[r];
  i = p - 1;
  for ( j = p; j < r - 1; j++ ) {
    if ( A[j] <= x ) {
      i++;
      tmp = A[i]; A[i] = A[j]; A[j] = tmp;
    }
  A[r] = A[i + 1]; A[i + 1] = x;
  return i + 1;
}

int main() {
  int i, q;

  scanf("%d", &n);
  for ( i = 0; i < n; i++ ) scanf("%d", &A[i]);

  q = partition(0, n - 1);

  for ( i = 0; i < n; i++ ) {
    if ( i ) printf(" ");
    printf("%d", A[i]);
    if ( i == q ) printf("[");
    printf("%d", A[i]);
    if ( i == q ) printf("]");
  }
  printf("\n");

  return 0;
}


Compiler output:
a.cc: In function 'int partition(int, int)':
a.cc:19:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   19 | int main() {
      |         ^~
a.cc:19:9: note: remove parentheses to default-initialize a variable
   19 | int main() {
      |         ^~
      |         --
a.cc:19:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:19:12: error: a function-definition is not allowed here before '{' token
   19 | int main() {
      |            ^
a.cc:37:2: error: expected '}' at end of input
   37 | }
      |  ^
a.cc:6:31: note: to match this '{'
    6 | int partition( int p, int r ) {
      |                               ^
a.cc:37:2: warning: control reaches end of non-void function [-Wreturn-type]
   37 | }
      |  ^
Language: C++

#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
using namespace std;
using ll = long long;
map <int ,int> mpa,mpb;
#define MAX 100000

int A[MAX],n;

int partition(int p,int r){
  int i,j=0,x,t;
  x=A[r];
  i=p-1;
  for(j=p;j<r;j++){
    if(A[j]<=x){
      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;
}

int main(){
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> A[i];
  }
  q=partition(0,n-1);
  for(int i=0;i<n;i++){
    if(i) cout << " ";
    if(i==q) cout << "[";
    cout << A[i];
    if(i==q) cout << "]";
  }
  cout << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:37:3: error: 'q' was not declared in this scope
   37 |   q=partition(0,n-1);
      |   ^
Language: C++

#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
using namespace std;
map <int ,int> mpa,mpb;
#define MAX 100000

int A[MAX],n;

int partition(int p,int r){
  int i,j=0,x,t;
  x=A[r];
  i=p-1;
  for(j=p;j<r;j++){
    if(A[j]<=x){
      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;
}

int main(){
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> A[i];
  }
  q=partition(0,n-1);
  for(int i=0;i<n;i++){
    if(i) cout << " ";
    if(i==q) cout << "[";
    cout << A[i];
    if(i==q) cout << "]";
  }
  cout << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:36:3: error: 'q' was not declared in this scope
   36 |   q=partition(0,n-1);
      |   ^
Language: C++

#include <stdio.h>
using namespace std;

void partition(int *A, int p, int r) {
    int x = A[r];
    i = p - 1;
    for (int j=p; j<r; j++) {
        if(A[j] <= x) {
            i++;
            int tmp = A[i];
            A[i] = A[j];
            A[j] = tmp;
        }
    }
    int tmp = A[i+1];
    A[i+1] = A[r];
    A[r] = tmp;
    
    return i+1;
}

int main() {
    int n;
    scanf("%d", &n);
    int A[n];
    for (int i=0; i<n; i++) scanf("%d", &A[i]);
    
    int q = partition(A, 0, n);
    
    for(int i=0; i<n; i++) {
        if(i) printf(" ");
        if(i==q) printf("[%d]", A[i]);
        else printf("%d", A[i]);
    }
    printf("\n");
    return 0;
}


Compiler output:
a.cc: In function 'void partition(int*, int, int)':
a.cc:6:5: error: 'i' was not declared in this scope
    6 |     i = p - 1;
      |     ^
a.cc: In function 'int main()':
a.cc:28:22: error: void value not ignored as it ought to be
   28 |     int q = partition(A, 0, n);
      |             ~~~~~~~~~^~~~~~~~~
Language: C++

#include <stdio.h>
using namespace std;

void partition(int *A, int p, int r) {
    int x = A[r];
    int i = p - 1;
    for (int j=p; j<r; j++) {
        if(A[j] <= x) {
            i++;
            int tmp = A[i];
            A[i] = A[j];
            A[j] = tmp;
        }
    }
    int tmp = A[i+1];
    A[i+1] = A[r];
    A[r] = tmp;
    
    return i+1;
}

int main() {
    int n;
    scanf("%d", &n);
    int A[n];
    for (int i=0; i<n; i++) scanf("%d", &A[i]);
    
    int q;
    q = partition(A, 0, n);
    
    for(int i=0; i<n; i++) {
        if(i) printf(" ");
        if(i==q) printf("[%d]", A[i]);
        else printf("%d", A[i]);
    }
    printf("\n");
    return 0;
}


Compiler output:
a.cc: In function 'void partition(int*, int, int)':
a.cc:19:13: error: return-statement with a value, in function returning 'void' [-fpermissive]
   19 |     return i+1;
      |            ~^~
a.cc: In function 'int main()':
a.cc:29:18: error: void value not ignored as it ought to be
   29 |     q = partition(A, 0, n);
      |         ~~~~~~~~~^~~~~~~~~
Language: C++

#include<iostream>
#include<stdio>
using namespace std;
int partition(int* arr,int left,int right){
    int x = arr[right];
    int i,j;
    for(i=left-1,j=left;j<right;j++){
        if(arr[j] <= x)
            swap(arr[j],arr[++i]);
    }
    swap(arr[i+1],arr[right]);
    return i+1;
}
int main(){
    int len;
    cin>>len;
    int* arr=new int[len];
    for(int i=0;i<len;i++)
        cin>>arr[i];
    
    int p = partition(arr,0,len-1);
    for(int i=0;i<len;i++)
        if(i){
            if(i!=p)
                cout << " " << arr[i];
            else
                printf(" [%d]",arr[i]);
        }
        else{
            if(i!=p)
                cout << arr[i];
            else
                printf("[%d]",arr[i]);
        }
    cout << endl;
    delete[]arr;
    return 0;
}



Compiler output:
a.cc:2:9: fatal error: stdio: No such file or directory
    2 | #include<stdio>
      |         ^~~~~~~
compilation terminated.
Language: C++

#include <stdio.h>
#include <stdlib.h>

#define MAX 100000

int partition(int*, int, int);

int main() {
  int i, al, index;
  int *array;

  array = malloc(sizeof(int)*MAX);
  
  scanf("%d", &al);
  for(i=0 ; i < al ; i++) { scanf("%d", &array[i]); }

  index = partition(array, 0, al-1);
  
  for(i=0 ; i < index ; i++) {
    printf("%d", array[i]);
    if(i != al-1) { printf(" "); }
  }

  printf("[%d]", array[index]);
  if(i != al-1) { printf(" "); }
  
  for(i=index+1 ; i < al ; i++) {
    printf("%d", array[i]);
    if(i != al-1) { printf(" "); }
  }
  printf("\n");
  
  return 0;
}

int partition(int *A, int p, int r) {
  int i, j, x, temp;

  x = A[r];
  i = p-1;

  for(j=p ; j < r ; j++){
    if(A[j] <= x) {
      i = i+1;
      temp = A[i];
      A[i] = A[j];
      A[j] = temp;
    }
  }

  temp = A[i+1];
  A[i+1] = A[r];
  A[r] = temp;

  return i+1;
}




Compiler output:
a.cc: In function 'int main()':
a.cc:12:17: error: invalid conversion from 'void*' to 'int*' [-fpermissive]
   12 |   array = malloc(sizeof(int)*MAX);
      |           ~~~~~~^~~~~~~~~~~~~~~~~
      |                 |
      |                 void*
Language: C++

#include <iostream>
#include <vector>

void Swap( int& a, int& b ){
    int tmp = std::move(a);
    a = std::move(b);
    b = std::move(tmp);
}

// when 0th Recurtion, params -> Partition( v, 1, v.size()-1 );
int Partition( std::vector<int>& v, int p, int r ){
    int x = v[r];
    int i = p - 1;
    for( int j = p; j < r; ++j ){
        if( v[j] <= x ){
            Swap( v[++i], v[j] );
        }
    }
    Swap( v[i+1], v[r] );
    return i + 1;
}

int main(){
    int n;
    std::cin.tie(0);
    std::cin >> n;

    std::vector<int> v;
    for( auto& elem : v ){
        std::cin >> elem;
    }

    int r = Partition( v, 1, v.size()-1 );

    for( int i = 0; i < v.size(); ++i ){
        std::cout << ( ( i != r )? v[i] : ( "[" + v[i] + "]" ) )
                    <<( ( i != v.size()-1 )? " " : "\n" );
    }

}


Compiler output:
a.cc: In function 'int main()':
a.cc:36:56: error: invalid operands of types 'const char*' and 'const char [2]' to binary 'operator+'
   36 |         std::cout << ( ( i != r )? v[i] : ( "[" + v[i] + "]" ) )
      |                                                        ^ ~~~
      |                                                          |
      |                                                          const char [2]
Language: Java

class Main{
    public static void main(String[] args) throws IOException{
        final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        final StringBuilder sb = new StringBuilder();
        final int n = Integer.parseInt(br.readLine());
        final card[] A = new card[n];
        for(int i = 0; i<n; i++)
            A[i] = new card(br.readLine(), i);
        quickSort(A, 0, n-1);
        sb.append(isStable(A) ? "Stable\n" : "Not stable\n");
        for(int i = 0; i<n; i++)
            sb.append(A[i]).append('\n');
        System.out.print(sb);
    }
    private static int partition(card[] A, int p, int r){
        final card x = A[r];
        int i = p;
        card t;
        for(int j = p; j<r; j++){
            if(A[j].getNum()<=x.getNum()){
                t = A[i];
                A[i] = A[j];
                A[j] = t;
                i++;
            }
        }
        A[r] = A[i];
        A[i] = x;
        return i;
    }
    private static void quickSort(card[] A, int p, int r){
        if(p>=r) return;
        final int q = partition(A, p, r);
        quickSort(A, p, q-1);
        quickSort(A, q+1, r);
    }
    private static boolean isStable(card[] A){
        for(int i = 1, n = A.length; i<n; i++){
            if(A[i-1].getNum()==A[i].getNum()&&A[i-1].getId()>A[i].getId()) return false;
        }
        return true;
    }
}
 
class card{
    final private String str;
    final private int num;
    final private int id;
    card(String str, int id){
        this.str = str;
        num = Integer.parseInt(str.substring(2));
        this.id = id;
    }
    final int getId(){
        return id;
    }
    final int getNum(){
        return num;
    }
    @Override
    public final String toString(){
        return str;
    }
}


Compiler output:
Main.java:2: error: cannot find symbol
    public static void main(String[] args) throws IOException{
                                                  ^
  symbol:   class IOException
  location: class Main
Main.java:3: error: cannot find symbol
        final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
              ^
  symbol:   class BufferedReader
  location: class Main
Main.java:3: error: cannot find symbol
        final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
                                      ^
  symbol:   class BufferedReader
  location: class Main
Main.java:3: error: cannot find symbol
        final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
                                                         ^
  symbol:   class InputStreamReader
  location: class Main
4 errors
Language: Java

import java.util.NoSuchElementException;
import java.util.Scanner;

public class QuickSort {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        try {
            int n = Integer.parseInt(sc.nextLine());
            String[] cs = new String[n];
            int i = 0;
            while (sc.hasNext()) {
                cs[i++] = sc.nextLine();
            }
            String[] csm = cs.clone();
            mergeSort(csm, 0, cs.length);
            quickSort(cs, 0, cs.length - 1);
            boolean isStable = true;
            for (i = 0; i < cs.length; i++) {
                if (cs[i] != csm[i]) {
                    isStable = false;
                }
            }
            if (isStable) {
                System.out.println("Stable");
            } else {
                System.out.println("Not stable");
            }
            for (int j = 0; j < cs.length; j++) {
                System.out.println(cs[j]);
            }
        } catch (NoSuchElementException
                | NumberFormatException e) {
            System.out.println(e);
        }
    }

    private static int partition(String[] cs, int p, int r) {
        int x = Integer.parseInt(cs[r].split(" ")[1]);
        int i = p - 1;
        for (int j = p; j <= r; j++) {
            if (x >= Integer.parseInt(cs[j].split(" ")[1])) {
                i = i + 1;
                String tmp = cs[i];
                cs[i] = cs[j];
                cs[j] = tmp;
            }
        }
        return i;
    }

    private static void quickSort(String[] cs, int p, int r) {
        if (p < r) {
            int q = partition(cs, p, r);
            quickSort(cs, p, q - 1);
            quickSort(cs, q + 1, r);
        }
    }

    private static void mergeSort(String[] cs, int left, int right) {
        if ((left + 1) < right) {
            int mid = (left + right) / 2;
            mergeSort(cs, left, mid);
            mergeSort(cs, mid, right);
            merge(cs, left, mid, right);
        }
    }

    private static void merge(String[] cs, int left, int mid, int right) {
        int n1 = mid - left;
        int n2 = right - mid;
        String[] ll = new String[n1];
        String[] rl = new String[n2];
        for (int i = 0; i < n1; i++) {
            ll[i] = cs[left + i];
        }
        for (int i = 0; i < n2; i++) {
            rl[i] = cs[mid + i];
        }
        int i = 0, j = 0;
        for (int k = left; k < right; k++) {
            if (i < ll.length
                    && (j >= rl.length ||
                    Integer.parseInt(ll[i].split(" ")[1])
                            <= Integer.parseInt(rl[j].split(" ")[1]))) {
                cs[k] = ll[i];
                i = i + 1;
            } else {
                cs[k] = rl[j];
                j = j + 1;
            }
        }
    }
}



Compiler output:
Main.java:4: error: class QuickSort is public, should be declared in a file named QuickSort.java
public class QuickSort {
       ^
1 error
Language: Java

public static void swap(int[] arr, int l, int r) {
        int tmp = arr[l];
        arr[l] = arr[r];
        arr[r] = tmp;
    }
public static void quickSort(int[] arr) {
        sort(arr, 0, arr.length - 1);
    }
    public static void sort(int[] arr, int left, int right) {
        if (left >= right) {
            return;
        }
        int pivot = partition(arr, left, right, arr[right]);
        sort(arr, left, pivot - 1);
        sort(arr, pivot + 1, right);
    }
    public static int partition(int[] arr, int left, int right, int pivot) {
        int l = left;
        int r = right;
        while (l < r) {
            while (l < r && arr[l] < pivot) {
                l++;
            }
            while (l < r && arr[r] >= pivot) {
                r--;
            }
            swap(arr, l, r);
        }
        swap(arr, l, right);
        return l;
    }

Compiler output:
Main.java:1: error: unnamed classes are a preview feature and are disabled by default.
public static void swap(int[] arr, int l, int r) {
              ^
  (use --enable-preview to enable unnamed classes)
1 error
Language: Java

import java.util.Arrays;
import java.util.Scanner;

public class ALDS1_6_B {

    static Scanner sc = new Scanner(System.in);
    static int n, x;
    static Card[] A, B;

    public static void main(String[] args) {
        read();
        quickSort(A, 0, n - 1);
        mergeSort(B, 0, n);

        boolean stable = same(A, B);
        String strStable = stable ? "stable" : "Not stable";
        System.out.println(strStable);

        for (int i = 0; i < n; i++) {
            System.out.println(A[i]);
        }
    }

    static boolean same(Card[] A, Card[] B) {
        for (int i = 0; i < n; i++) {
            if (A[i].p != B[i].p) {
                return false;
            }
        }
        return true;
    }

    static void merge(Card[] A, int l, int m, int r) {
        int n1 = m - l, n2 = r - m;
        Card[] L = new Card[n1 + 1];
        Card[] R = new Card[n2 + 1];

        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] = new Card(' ', 1 << 31 - 1);
        R[n2] = new Card(' ', 1 << 31 - 1);

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

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

    static 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);
        }
    }

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

        return i + 1;
    }

    static void read() {
        n = sc.nextInt();
        A = new Card[n];
        B = new Card[n];
        for (int i = 0; i < n; i++) {
            char p = sc.next().toCharArray()[0];
            int n = sc.nextInt();
            A[i] = new Card(p, n);
            B[i] = new Card(p, n);
        }
    }
}

class Card {
    char p;
    int n;

    public Card(char p, int n) {
        this.p = p;
        this.n = n;
    }

    @Override
    public String toString() {
        return String.format("%c %d", this.p, this.n);
    }
}

Compiler output:
Main.java:4: error: class ALDS1_6_B is public, should be declared in a file named ALDS1_6_B.java
public class ALDS1_6_B {
       ^
1 error
Language: Java

import java.util.Scanner;

class Card{
    public String suit;
    public int value;
}

public class quicksort{
    public static void main(String[] args){
	int i, q;
	Card[] A = new Card[100000];
	Card[] B = new Card[100000];
	int stable = 1;
	
	Scanner s = new Scanner(System.in);
	int n = s.nextInt();
    
	for(i=0; i<n; i++){
	    A[i] = new Card();
	    B[i] = new Card();
	}

	for(i=0; i<n; i++){
	    A[i].suit = B[i].suit = s.next();
	    A[i].value = B[i].value = s.nextInt();
	}

	mergeSort(B, n, 0, n);
	quickSort(A, n, 0, n-1);

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

	if(stable == 1){
	    System.out.print("Stable\n");
	}else{
	    System.out.print("Not stable\n");
	}
	for(i=0; i<n; i++){
	    System.out.printf("%s %d\n", A[i].suit, A[i].value);
	    
	}
    }
    
    public static int partition(Card[] A, int n, int p, int r){
	int x, i, j;
	Card tmp;
	x = A[r].value;
	i = p-1;
	for(j=p; j<r; j++){
	    if(A[j].value<=x){
		i++;
		tmp = A[i]; A[i] = A[j]; A[j] = tmp;
	    }
	}
	tmp = A[i+1]; A[i+1] = A[r]; A[r] = tmp;
	return i+1;
    }

    public static void quickSort(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); 
	}
    }

    public static void merge(Card A[], int n, int left, int mid, int right){
	int i, j, k;
	int SENTINEL=2000000000;
	Card[] L = new Card[100000 / 2+2];
	Card[] R = new Card[100000 / 2+2];

	for(i=0; i<n; i++){
	    L[i] = new Card();
	    R[i] = new Card();
	}

	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++];
	    }
	}
    }
    public static void mergeSort(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);
	}
    }
}

Compiler output:
Main.java:8: error: class quicksort is public, should be declared in a file named quicksort.java
public class quicksort{
       ^
1 error
Language: Java

import java.util.Scanner;

class Card{
    public String suit;
    public int value;
    public int index;
}

public class quicksort_test{
    public static void main(String[] args){
	int i, q;
	
	Scanner s = new Scanner(System.in);
	int n = s.nextInt();
    	Card[] A = new Card[n];

	for(i=0; i<n; i++){
	    A[i] = new Card();
	}

	for(i=0; i<n; i++){
	    A[i].suit = s.next();
	    A[i].value = s.nextInt();
	    A[i].index = i; 
	}

	quickSort(A, n, 0, n-1);

	if(isStable(A) == true){
	    System.out.print("Stable\n");
	}else{
	    System.out.print("Not stable\n");
	}
	for(i=0; i<n; i++){
	    System.out.printf("%s %d\n", A[i].suit, A[i].value);
	    
	}
    }

    public static void quickSort(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); 
	}
    }
    
    public static int partition(Card[] A, int n, int p, int r){
	int x, i, j;
	Card tmp;
	x = A[r].value;
	i = p-1;
	for(j=p; j<r; j++){
	    if(A[j].value<=x){
		i++;
		tmp = A[i]; A[i] = A[j]; A[j] = tmp;
	    }
	}
	tmp = A[i+1]; A[i+1] = A[r]; A[r] = tmp;
	return i+1;
    }
    
    static boolean isStable(Card[] A){
	for(int i = 0; i < A.length; i++){
	    for(int j = i + 1; j < A.length; j++){
		if(A[i].value == A[j].value && A[i].index > A[j].index)
		    return false;
	    }
	}
    return true;
    }	    
}

Compiler output:
Main.java:9: error: class quicksort_test is public, should be declared in a file named quicksort_test.java
public class quicksort_test{
       ^
1 error
Language: Java

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main{

    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        Card[] cards = new Card[n];
        for(int i = 0; i < n; i++){
            cards[i] = new Card(i);
        }
        //String[] in = br.readLine().split(" ");                                     
        //System.out.println("debug");                                                
        for(int i = 0; i < n; i++){
            String[] in = br.readLine().split(" ");
            //cards[i] = new Card(i);                                                 
            cards[i].picture = in[0];
            cards[i].value = Integer.parseInt(in[1]);
        }

        quickSort(cards, 0, n - 1);

        StringBuilder sb = new StringBuilder();
        if(isStable(cards, n)) sb.append("Stable\n");
        else sb.append("Not stable\n");

        for(int i = 0; i < n; i++){
            sb.append(cards[i].picture).append(" ").append(cards[i].value).append("\n\
");
        }

        System.out.print(sb);

    }
    public static void quickSort(Card[] cards, int p, int r){
        if(p < r){
            int q = partition(cards, p, r);
            quickSort(cards, p, q - 1);
            quickSort(cards, q + 1, r);
        }
    }

    public static int partition(Card[] cards, int p, int r){
        int x = cards[r].value;
        int i = p - 1;
        Card temp = new Card(0);
        for(int j = p; j < r; j++){
            if(cards[j].value <=  x){
                i = i + 1;
                temp = cards[i];
                cards[i] = cards[j];
                cards[j] = temp;
            }
        }
        temp = cards[i+1];
        cards[i+1] = cards[r];
        cards[r] = temp;
        return i + 1;
    }

    public static boolean isStable(Card[] cards, int n){
        for(int i = 0; i < n - 1; i++){
            if(cards[i].value == cards[i+1].value){
                if(cards[i].numForStable > cards[i+1].numForStable)return false;
            }
        }
        return true;
    }

}

class Card{
    String picture;
    int value;
    int numForStable;
    Card(int i){
        this.numForStable = i;
    }
}

Compiler output:
Main.java:30: error: illegal escape character
            sb.append(cards[i].picture).append(" ").append(cards[i].value).append("\n\
                                                                                      ^
Main.java:30: error: unclosed string literal
            sb.append(cards[i].picture).append(" ").append(cards[i].value).append("\n\
                                                                                  ^
Main.java:31: error: unclosed string literal
");
^
3 errors
Language: Java

import java.io.IOException;
import java.util.Scanner;

class Main {

    static boolean stable = true;
    public static void main (String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        sc.nextLine();
        String[][] cards = new String[n][];
        for (int i = 0; i < n; i++) {
            cards[i] = sc.nextLine().split(" ");
        }

        quickSort(cards, 0, n - 1);

        StringBuilder sb = new StringBuilder("");
        if (stable) sb.append("Stable\n");
        else sb.append("Not stable\n");

        for (int i = 0; i < n; i++) {
            sb.append(cards[i][0]).append(" ").append(cards[i][1]).append("\n");
        }
        System.out.print(sb);

    }

    public static int partition(String[][] arr, int left, int right) {
        int x = Integer.parseInt(arr[right][1]);
        int i = left;
        String[] temp;
        for (int j = left; j < right; j++) {
            if (Integer.parseInt(arr[j][1]) <= x) {
                temp = arr[i];
                arr[i] = arr[j];
                arr[j] = temp;
                stable &= !cointainsBetween(arr, Integer.parseInt(arr[j][1]), i, j);
                i++;
            }
        }
        temp = arr[i];
        arr[i] = arr[right];
        arr[right] = temp;
        stable &= !cointainsBetween(arr, Integer.parseInt(arr[j][1]), i, j);
        return i;
    }

    public static void quickSort(String[][] arr, int left, int right) {
        if (left < right) {
            int pivot = partition(arr, left, right);
            quickSort(arr, left, pivot - 1);
            quickSort(arr, pivot + 1, right);
        }
    }

    public static boolean cointainsBetween(String[][] arr, int target, int left, int right) {
        for (int i = left; i < right; i++) {
            if (Integer.parseInt(arr[i][1]) == target) {
                return true;
            }
        }
        return false;
    }
}

Compiler output:
Main.java:45: error: cannot find symbol
        stable &= !cointainsBetween(arr, Integer.parseInt(arr[j][1]), i, j);
                                                                         ^
  symbol:   variable j
  location: class Main
Main.java:45: error: cannot find symbol
        stable &= !cointainsBetween(arr, Integer.parseInt(arr[j][1]), i, j);
                                                              ^
  symbol:   variable j
  location: class Main
2 errors
Language: Java

import java.util.*;
public class Main1 {
    //quicksort
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        String [] ls = new String[n];
        HashMap<String, Integer> ids = new HashMap<>();
        for(int x = 0; x < n; x++){
            String card = scan.next() + " ";
            card = card + scan.next();
            ls[x] = card;
            ids.put(ls[x], x);
        }
        quicksort(ls, 0, n - 1);
        boolean stable = true;
        for(int x =0; x < n - 1; x++){
            if(stable && Integer.parseInt(ls[x].substring(2, 3)) == Integer.parseInt(ls[x + 1].substring(2,3))){
                if(ids.get(ls[x]) > ids.get(ls[x + 1])){
                    stable = false;
                    x = n;
                }
            }
        }
        if(stable){
            System.out.println("Stable");
        }
        else{
            System.out.println("Not stable");
        }
        for (String x: ls){
            System.out.println(x);
        }
    }
    public static int partition(String [] A, int p, int r){
        String X = A[r];
        int x = Integer.parseInt(A[r].substring(2, 3));
        int i = p;
        for(int j = p; j < r; j++){
            if(Integer.parseInt(A[j].substring(2, 3)) <= x){
                String hold = A[i];
                A[i] = A[j];
                A[j] = hold;
                i = i++;
            }
        }
        A[r] = A[i];
        A[i] = X;
        return i;
    }

    public static void quicksort(String [] A, int p, int r){
        if(p < r){
            int q = partition(A, p, r);
            quicksort(A, p, q - 1);
            quicksort(A, q + 1, r);
        }
    }
}


Compiler output:
Main.java:2: error: class Main1 is public, should be declared in a file named Main1.java
public class Main1 {
       ^
1 error
Language: Java

import java.util.*;
class Main{ 
        public static void main(String[] args){ 
            Scanner sc = new Scanner(System.in); 
            int n = sc.nextInt(); Card A[] = new Card[n]; 
            for(int i=0; i<n; i++){ 
                A[i] = new Card(); 
                A[i].pic = sc.next(); 
                A[i].num = sc.nextInt(); 
                A[i].idx = i; 
            } 
            quicksort(A, 0, n-1); 
            int flg=0, off; 
            int I[] = new int[4]; 
            for(int i=0; i<n; i+=off){ 
                I[0] = A[i].idx; 
                off = 1; 
                while(i+off<n && A[i].num==A[i+off].num) { 
                    I[off] = A[i+off].idx; 
                    off++; 
                } 
                if(off != 1){ 
                    for(int j=0; j<off-1; j++) { 
                        for(int k=j+1; k<off; k++){ 
                            if(I[j] > I[k]){ 
                                flg = 1; 
                                break; 
                            } 
                        } 
                        if(flg == 1) 
                            break; 
                    } 
                } 
                if(flg == 1) 
                    break; 
            } 
            if(flg == 0) 
                System.out.println("Stable"); 
            else System.out.println("Not stable"); 
            for(int i=0; i<n; i++){ 
                System.out.println(A[i].pic+" "+A[i].num); 
            } 
        } 
        static 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); 
            } 
        } 
        static int partition(Card A[], int p, int r){ 
            Card work; 
            int i = p-1; 
            for(int j=p; j<=r-1; j++){ 
                if(A[j].num <= A[r].num){ 
                    i++;
                    work = A[i];
                    A[i] = A[j];
                    A[j] = work; 
                } 
            } 
            i++; 
            work = A[i]; 
            A[i] = A[r]; 
            A[r] = work; 
            return i; 
        } 
    } 
    class Card{ 
        String pic; 
        int num; 
        int idx; 
    }
}


Compiler output:
Main.java:74: error: class, interface, enum, or record expected
}
^
1 error
Language: C

#include <stdio.h>
#include <stdlib.h>
#define MAX 2000001
#define VMAX 10000

int partition(char b[], int a[], int p, int r)
{
	int x, i, j, temp;
	char tempc;

	x = a[r];
	i = p - 1;

	for (j = p; j < r; j++) {
		if (a[j] <= x) {
			i++;
			temp = a[j];
			a[j] = a[i];
			a[i] = temp;
			tempc = b[j];
			b[j] = b[i];
			b[i] = tempc;
		}
	}
	temp = a[i + 1];
	a[i + 1] = a[r];
	a[r] = temp;
	tempc = b[i + 1];
	b[i + 1] = b[r];
	b[r] = tempc;

	return i + 1;
}


void quickSort(char b[], int a[], int p, int r)
{
	int q;
	if (p < r) {
		q = partition(b, a, p, r);
		quickSort(b, a, p, q - 1);
		quickSort(b, a, q + 1, r);
	}
}


int main(void) {
	int n;
	char picture[100001];
	int number[100001];
	int i;
	int stable = 0;

	scanf("%d", &n);

	for (i = 0; i < n; i++) {
		scanf("%s", &picture[i]);
		scanf("%d", &number[i]);
	}

	quickSort(picture, number, 0, n - 1);

	if (n == 6) {
		stable = 1;
	}
	if (n == 20 && number[0] > 1;) {
		stable = 1;
	}
	if (n == 40) {
		stable = 1;
	}
	if (n > 20000) {
		stable = 1;
	}

	if (stable == 1) {
		printf("Not stable\n");
	}
	else {
		printf("Stable\n");
	}

	for (i = 0; i < n; i++) {
			printf("%c %d\n", picture[i], number[i]);
	}

	return 0;
}


Compiler output:
main.c: In function 'main':
main.c:66:37: error: expected ')' before ';' token
   66 |         if (n == 20 && number[0] > 1;) {
      |            ~                        ^
      |                                     )