#include <iostream>
#include <vector>
#include <cinttypes>
#include <algorithm>
using std::vector;
class Set {
private:
vector<int64_t> data;
public:
Set() = default;
explicit Set(const vector<int64_t> &data) {
for (auto elem : data) {
if (find(this->data.begin(), this->data.end(), elem)
== this->data.end()) {
this->data.push_back(elem);
}
}
}
void Add(int64_t element) {
if (find(this->data.begin(), this->data.end(), element)
== this->data.end()) {
this->data.push_back(element);
}
}
void Remove(int64_t element) {
auto iter = find(this->data.begin(), this->data.end(), element);
if (iter != this->data.end()) {
this->data.erase(iter);
}
}
[[nodiscard]] bool Contains(int64_t element) const {
return find(this->data.begin(), this->data.end(), element)
!= this->data.end();
}
[[nodiscard]] vector<int64_t> Data() const {
return data;
}
[[nodiscard]] Set Union(const Set &set) const {
Set newSet(Data());
for (auto elem : set.Data()) {
newSet.Add(elem);
}
return newSet;
}
[[nodiscard]] Set Intersection(const Set &set) const {
Set newSet;
for (auto elem : set.Data()) {
if (Contains(elem)) {
newSet.Add(elem);
}
}
return newSet;
}
[[nodiscard]] Set Difference(const Set &set) const {
Set newSet;
for (auto elem : Data()) {
if (!set.Contains(elem)) {
newSet.Add(elem);
}
}
return newSet;
}
[[nodiscard]] Set SymmetricDifference(const Set &set) const {
Set newSet = Difference(set);
for (auto elem : set.Data()) {
if (!Contains(elem)) {
newSet.Add(elem);
}
}
return newSet;
}
};