class Solution {
public:
    int MoreThanHalfNum_Solution(vector<int> numbers) {
        int cnt = 0, num = 0;
        for (size_t i = 0; i < numbers.size(); ++ i) {
            if (cnt == 0) ++cnt,num=numbers[i];
            else if (num != numbers[i]) --cnt;
            else ++cnt;
        }
        return count(numbers.begin(),numbers.end(), num) > numbers.size()/2 ? num : 0;
    }
};