Language: C

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
void printarray(long long int arr[], int n);
long long int partition(long long int arr[], long long int i, long long int j, long long int pivot)
{
    long long int l, r, k, t;
    l = i;
    r = j;
    while (l <= r)
    {
        while (l <= r && arr[l] <= pivot)
        {
            l++;
        }
        while (l <= r && arr[r] >= pivot)
        {
            r--;
        }
        if (l <= r)
        {
            t = arr[l];
            arr[l] = arr[r];
            arr[r] = t;
            l++;
            r--;
        }
    }
    k = l - 1;
    arr[i - 1] = arr[k];
    arr[k] = pivot;
    // printf("Pivot index : %d\n",k);
    // printarray(arr,n);
    return k;
}
void RQS(long long int arr[], long long int i, long long int j)
{
    long long int t, p, k;
    if (i < j)
    {
        srand(time(0));
        p = (rand() % (j - i + 1)) + i;
        // p = 1;
        t = arr[i];
        arr[i] = arr[p];
        arr[p] = t;
        k = partition(arr, i + 1, j, arr[i]);
        RQS(arr, i, k - 1);
        RQS(arr, k + 1, j);
        // printarray(arr,n);
    }
}
void printarray(long long int arr[], long long int n)
{
    long long int i;
    for (i = 0; i < n; i++)
    {
        printf("%d ", arr[i]);
    }
    printf("\n");
}
int main()
{
    long long int x, y, a, b, c, i, j, k, ans;
    scanf("%lld%lld%lld%lld%lld", &x, &y, &a, &b, &c);
    int *p = (int *)malloc(sizeof(int) * a);
    int *q = (int *)malloc(sizeof(int) * b);
    int *r = (int *)malloc(sizeof(int) * (c + a + b));
    for (i = 0; i < a; i++)
    {
        scanf("%lld", &p[i]);
    }
    for (i = 0; i < b; i++)
    {
        scanf("%lld", &q[i]);
    }
    for (i = 0; i < c; i++)
    {
        scanf("%lld", &r[i]);
    }
    RQS(p, 0, a - 1);
    RQS(q, 0, b - 1);
    // RQS(r, 0, c - 1);
    for (i = a - x; i < a; i++)
    {
        r[c] = p[i];
        c++;
    }
    for (i = b - y; i < b; i++)
    {
        r[c] = q[i];
        c++;
    }
    // printarray(r,c);
    RQS(r, 0, c - 1);
    // printarray(r,c);
    for (i = c - (x + y); i < c; i++)
    {
        ans += r[i];
    }
    printf("%lld", ans);
    return 0;
}


Compiler output:
main.c:54:6: error: conflicting types for 'printarray'; have 'void(long long int *, long long int)'
   54 | void printarray(long long int arr[], long long int n)
      |      ^~~~~~~~~~
main.c:5:6: note: previous declaration of 'printarray' with type 'void(long long int *, int)'
    5 | void printarray(long long int arr[], int n);
      |      ^~~~~~~~~~
main.c: In function 'main':
main.c:82:9: error: passing argument 1 of 'RQS' from incompatible pointer type [-Wincompatible-pointer-types]
   82 |     RQS(p, 0, a - 1);
      |         ^
      |         |
      |         int *
main.c:37:24: note: expected 'long long int *' but argument is of type 'int *'
   37 | void RQS(long long int arr[], long long int i, long long int j)
      |          ~~~~~~~~~~~~~~^~~~~
main.c:83:9: error: passing argument 1 of 'RQS' from incompatible pointer type [-Wincompatible-pointer-types]
   83 |     RQS(q, 0, b - 1);
      |         ^
      |         |
      |         int *
main.c:37:24: note: expected 'long long int *' but argument is of type 'int *'
   37 | void RQS(long long int arr[], long long int i, long long int j)
      |          ~~~~~~~~~~~~~~^~~~~
main.c:96:9: error: passing argument 1 of 'RQS' from incompatible pointer type [-Wincompatible-pointer-types]
   96 |     RQS(r, 0, c - 1);
      |         ^
      |         |
      |         int *
main.c:37:24: note: expected 'long long int *' but argument is of type 'int *'
   37 | void RQS(long long int arr[], long long int i, long long int j)
      |          ~~~~~~~~~~~~~~^~~~~