Language: C

int main(){
	int X,Y,A,B,C,*red,*green,*less;
  	int i,j,k,sum=0;
  	scanf("%d%d%d%d%d",&X,&Y,&A,&B,&C);
  
  	red=(int*)malloc(sizeof(int)*A);
  	green=(int*)malloc(sizeof(int)*B);
    less=(int*)malloc(sizeof(int)*C);
  
  	for(i=0;i<A;i++)
      scanf("%d",&red[i]);
  	
  	for(i=0;i<B;i++)
      scanf("%d",&green[i]);
   	
  	for(i=0;i<C;i++)
      scanf("%d",&less[i]);

  	sort(red,A);
  	sort(green,B);
  	sort(less,C);
  
  	j=0;k=0;i=0;
  	for(i<X && k<C){
    	if(red[j]>less[k]){
        	sum+=red[j];
          	j++;
        }
      	else{
        	sum+=less[k];
          	k++;
        }
      i++;
    }
  
  	for(;i<X;i++){
    	sum+=red[j];
      	j++;
    }
  i=0;j=0;
  for(i<Y && k<C){
  	if(green[j]>less[k]){
    	sum+=green[j];
      	j++;
    }
    else{
    	sum+=less[k];
      	k++;
    }
  }
  
  for(;i<Y;i++){
  	sum+=green[j];
    j++;
  }
  
  printf("%d",sum);

}
void sort(int* d,int n){
	int i,j,temp;
  	for(i=0;i<n;i++){
    	for(j=0;j<n-1-i;j++){
        	if(d[j]<d[j+1]){
            	temp=d[j];
              	d[j]=d[j+1];
              	d[j+1]=temp;
            }
        }
    }
}

Compiler output:
main.c: In function 'main':
main.c:4:9: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    4 |         scanf("%d%d%d%d%d",&X,&Y,&A,&B,&C);
      |         ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | int main(){
main.c:4:9: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    4 |         scanf("%d%d%d%d%d",&X,&Y,&A,&B,&C);
      |         ^~~~~
main.c:4:9: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:6:19: error: implicit declaration of function 'malloc' [-Wimplicit-function-declaration]
    6 |         red=(int*)malloc(sizeof(int)*A);
      |                   ^~~~~~
main.c:1:1: note: include '<stdlib.h>' or provide a declaration of 'malloc'
  +++ |+#include <stdlib.h>
    1 | int main(){
main.c:6:19: warning: incompatible implicit declaration of built-in function 'malloc' [-Wbuiltin-declaration-mismatch]
    6 |         red=(int*)malloc(sizeof(int)*A);
      |                   ^~~~~~
main.c:6:19: note: include '<stdlib.h>' or provide a declaration of 'malloc'
main.c:19:9: error: implicit declaration of function 'sort' [-Wimplicit-function-declaration]
   19 |         sort(red,A);
      |         ^~~~
main.c:24:23: error: expected ';' before ')' token
   24 |         for(i<X && k<C){
      |                       ^
      |                       ;
main.c:24:23: error: expected expression before ')' token
main.c:41:17: error: expected ';' before ')' token
   41 |   for(i<Y && k<C){
      |                 ^
      |                 ;
main.c:41:17: error: expected expression before ')' token
main.c:57:3: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   57 |   printf("%d",sum);
      |   ^~~~~~
main.c:57:3: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:57:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:57:3: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c: At top level:
main.c:60:6: warning: conflicting types for 'sort'; have 'void(int *, int)'
   60 | void sort(int* d,int n){
      |      ^~~~
main.c:19:9: note: previous implicit declaration of 'sort' with type 'void(int *, int)'
   19 |         sort(red,A);
      |         ^~~~