Language: C

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

void swap(int* a, int* b) 
{ 
	int t = *a; 
	*a = *b; 
	*b = t; 
} 

int partition (int arr[], int low, int high) 
{ 
	int pivot = arr[high]; // pivot 
	int i = (low - 1); // Index of smaller element 

	for (int j = low; j <= high- 1; j++) 
	{ 
		// If current element is smaller than the pivot 
		if (arr[j] < pivot) 
		{ 
			i++; // increment index of smaller element 
			swap(&arr[i], &arr[j]); 
		} 
	} 
	swap(&arr[i + 1], &arr[high]); 
	return (i + 1); 
} 

void quickSort(int arr[], int low, int high) 
{ 
	if (low < high) 
	{ 
		int pi = partition(arr, low, high); 

		quickSort(arr, low, pi - 1); 
		quickSort(arr, pi + 1, high); 
	} 
} 

void main()
{
    unsigned int i , numOfMons, numOfSpecMoves, *monsHealth; 
    long long accHealth = 0;
    
    scanf("%u %u", &numOfMons, &numOfSpecMoves);

    monsHealth = (int*) calloc (numOfMons, sizeof(int));
    
    for (i=0; i<numOfMons ; i++)
    {
        scanf("%u", &monsHealth[i]);
        accHealth += monsHealth[i];
    }
    
    if (numOfSpecMoves > numOfMons) 
     printf("%u",0);
     
    else
    {
        quickSort(monsHealth, 0, numOfMons-1); 
        for (i=numOfMons-1; numOfSpecMoves>0 ; numOfSpecMoves--,i--)
        {
            accHealth -= monsHealth[i];
        }
        printf("%lli",accHealth);
    }
}
#include <stdio.h>
#include <stdlib.h>

void swap(int* a, int* b) 
{ 
	int t = *a; 
	*a = *b; 
	*b = t; 
} 

int partition (int arr[], int low, int high) 
{ 
	int pivot = arr[high]; // pivot 
	int i = (low - 1); // Index of smaller element 

	for (int j = low; j <= high- 1; j++) 
	{ 
		// If current element is smaller than the pivot 
		if (arr[j] < pivot) 
		{ 
			i++; // increment index of smaller element 
			swap(&arr[i], &arr[j]); 
		} 
	} 
	swap(&arr[i + 1], &arr[high]); 
	return (i + 1); 
} 

void quickSort(int arr[], int low, int high) 
{ 
	if (low < high) 
	{ 
		int pi = partition(arr, low, high); 

		quickSort(arr, low, pi - 1); 
		quickSort(arr, pi + 1, high); 
	} 
} 

void main()
{
    unsigned int i , numOfMons, numOfSpecMoves, *monsHealth; 
    long long accHealth = 0;
    
    scanf("%u %u", &numOfMons, &numOfSpecMoves);

    monsHealth = (int*) calloc (numOfMons, sizeof(int));
    
    for (i=0; i<numOfMons ; i++)
    {
        scanf("%u", &monsHealth[i]);
        accHealth += monsHealth[i];
    }
    
    if (numOfSpecMoves > numOfMons) 
     printf("%u",0);
     
    else
    {
        quickSort(monsHealth, 0, numOfMons-1); 
        for (i=numOfMons-1; numOfSpecMoves>0 ; numOfSpecMoves--,i--)
        {
            accHealth -= monsHealth[i];
        }
        printf("%lli",accHealth);
    }
}


Compiler output:
main.c:71:6: error: redefinition of 'swap'
   71 | void swap(int* a, int* b)
      |      ^~~~
main.c:4:6: note: previous definition of 'swap' with type 'void(int *, int *)'
    4 | void swap(int* a, int* b)
      |      ^~~~
main.c:78:5: error: redefinition of 'partition'
   78 | int partition (int arr[], int low, int high)
      |     ^~~~~~~~~
main.c:11:5: note: previous definition of 'partition' with type 'int(int *, int,  int)'
   11 | int partition (int arr[], int low, int high)
      |     ^~~~~~~~~
main.c:96:6: error: redefinition of 'quickSort'
   96 | void quickSort(int arr[], int low, int high)
      |      ^~~~~~~~~
main.c:29:6: note: previous definition of 'quickSort' with type 'void(int *, int,  int)'
   29 | void quickSort(int arr[], int low, int high)
      |      ^~~~~~~~~
main.c:107:6: error: redefinition of 'main'
  107 | void main()
      |      ^~~~
main.c:40:6: note: previous definition of 'main' with type 'void()'
   40 | void main()
      |      ^~~~