Code
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
int compare(int* a, int* b);
int main(void) {
int sizeA, sizeB;
scanf("%d %d", &sizeA, &sizeB);
int sum = sizeA + sizeB;
int* arr = (int*)malloc(sizeof(int) * sum);
for (int i = 0; i < sum; i++) {
scanf("%d", &arr[i]);
}
qsort(arr, sum, sizeof(int), compare);
int count = 0;
for (int i = 1; i < sum; i++) {
if (arr[i] == arr[i - 1]) {
count += 2;
}
}
printf("%d", (sum - count));
return 0;
}
int compare(int* a, int* b) {
return *((int*)a) - *((int*)b);
}