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