링크 : https://www.acmicpc.net/problem/1269
#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
using namespace std;
int main() {
int A, B;
cin >> A >> B;
vector<int> v;
map<int, bool> m;
map<int, bool> m1;
for(int i = 0; i < A; i++){
int tmp;
cin >> tmp;
m.insert(make_pair(tmp, true));
v.push_back(tmp);
}
int cnt1 = 0;
for(int i = 0; i < B; i++){
int tmp;
cin >> tmp;
if(m[tmp] == true) cnt1++;
m1.insert(make_pair(tmp, true));
}
int cnt2 = 0;
for(int i = 0; i < A; i++){
if(m1[v[i]] == true) cnt2++;
}
int sum1 = A - cnt1;
int sum2 = B - cnt2;
cout << sum1 + sum2;
}