We use a unordered_set to store how many kinds of candies.

If the kind of canids is greater or equal half of candies size. return half of candies size.

Otherwise, return kinds of candies.

```
class Solution {
public:
int distributeCandies(vector<int>& candies) {
unordered_set<int> candy_kinds(candies.begin(), candies.end());
return candy_kinds.size() >= (candies.size() / 2) ? candies.size() / 2 : candy_kinds.size();
}
};
```