```
class TwoSum {
public:
unordered_map<int,int>m;
/** Add the number to an internal data structure.. */
void add(int number) {
m[number]++;
}
/** Find if there exists any pair of numbers which sum is equal to the value. */
bool find(int value) {
for(auto c:m) if(m.count(value-c.first)&&(value!=c.first*2||c.second>1)) return true;
return false;
}
};
```