Language: C++

#include <stdio.h>
#include <map>

int main(){
    int n;
    scanf("%d", &n);
    int a[n];
    for(int i = 0; i < n; i++){
        scanf("%d", &a[i]);
    }
    
    bool can = true;
    
    //is all 0?
    bool all0 = true;
    for(int i = 0; i < n; i++){
        if(a[i] != 0){
            all0 = false;
        }
    }

    if(all0){
        printf("Yes\n");
        return 0;
    }

    std::map<int, int> count;
    for(int i = 0; i < n; i++){
        count[a[i]]++;
    }

    if(count.size() > 3){
        printf("No\n");
        return 0;
    }else if(count.size() == 2){
        int set[2], num[2];
        auto itr = count.begin();
        set[0] = itr->first, num[0] = itr->second;
        itr++;
        set[1] = itr->first, num[1] = itr->second;
        if((num[0] * 2 == num[1] && set[0] == 0) || (num[1] * 2 == num[0] && set[1] == 0)){
            printf("Yes\n");
            return 0;
        }else{
            printf("No\n");
            return 0;
        }
    }else if(count.size() == 3){
        int set[3], num[3];
        auto itr = count.begin();
        set[0] = itr->first;
        num[0] = itr->second;
        itr++;
        set[1] = itr->first;
        num[1] = itr->second;
        itr++;
        set[2] = itr->first;
        num[2] = itr->second;
        if(num[0] == num[1] && num[1] == num[2]){
            if(set[0] == set[1] ^ set[2] && set[1] == set[2] ^ set[0] && set[2] == set[0] ^ set[1]){
                printf("Yes\n");
                return 0;
            }else{
                printf("No\n");
                return 0;
            }
        }else{
            printf("No\n");
            return 0;
        }
    }else if(count.size() == 1){
        if(*(count.begin()) != 0){
        printf("No\n");
        }else{
            printf("Yes\n");
        }
        return 0;
    }else{
        printf("No\n");
        return 0;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:72:29: error: no match for 'operator!=' (operand types are 'std::pair<const int, int>' and 'int')
   72 |         if(*(count.begin()) != 0){
      |            ~~~~~~~~~~~~~~~~ ^~ ~
      |            |                   |
      |            |                   int
      |            std::pair<const int, int>
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/bits/stl_tree.h:63,
                 from /usr/include/c++/14/map:62,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_pair.h:1052:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator!=(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
 1052 |     operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1052:5: note:   template argument deduction/substitution failed:
a.cc:72:32: note:   mismatched types 'const std::pair<_T1, _T2>' and 'int'
   72 |         if(*(count.begin()) != 0){
      |                                ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:455:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator!=(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
  455 |     operator!=(const reverse_iterator<_Iterator>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:455:5: note:   template argument deduction/substitution failed:
a.cc:72:32: note:   'std::pair<const int, int>' is not derived from 'const std::reverse_iterator<_Iterator>'
   72 |         if(*(count.begin()) != 0){
      |                                ^
/usr/include/c++/14/bits/stl_iterator.h:500:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator!=(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
  500 |     operator!=(const reverse_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:500:5: note:   template argument deduction/substitution failed:
a.cc:72:32: note:   'std::pair<const int, int>' is not derived from 'const std::reverse_iterator<_Iterator>'
   72 |         if(*(count.begin()) != 0){
      |                                ^
/usr/include/c++/14/bits/stl_iterator.h:1686:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator!=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
 1686 |     operator!=(const move_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1686:5: note:   template argument deduction/substitution failed:
a.cc:72:32: note:   'std::pair<const int, int>' is not derived from 'const std::move_iterator<_IteratorL>'
   72 |         if(*(count.begin()) != 0){
      |                                ^
/usr/include/c++/14/bits/stl_iterator.h:1753:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator!=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
 1753 |     operator!=(const move_iterator<_Iterator>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1753:5: note:   template argument deduction/substitution failed:
a.cc:72:32: note:   'std::pair<const int, int>' is not derived from 'const std::move_iterator<_IteratorL>'
   72 |         if(*(count.begin()) != 0){
      |                                ^
In file included from /usr/include/c++/14/bits/stl_tree.h:64:
/usr/include/c++/14/bits/allocator.h:243:5: note: candidate: 'template<class _T1, class _T2> bool std::operator!=(const allocator<_Tp1>&, const allocator<_T2>&)'
  243 |     operator!=(const allocator<_T1>&, const allocator<_T2>&)
      |     ^~~~~~~~
/usr/include/c++/14/bits/allocator.h:243:5: note:   template argument deduction/substitution failed:
a.cc:72:32: note:   'std::pair<const int, int>' is not derived from 'const std::allocator<_Tp1>'
   72 |         if(*(count.begin()) != 0){
      |                                ^
In file included from /usr/include/c++/14/bits/stl_map.h:63,
                 from /usr/include/c++/14/map:63:
/usr/include/c++/14/tuple:2613:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator!=(const tuple<_Args1 ...>&, const tuple<_Elements ...>&)'
 2613 |     operator!=(const tuple<_TElements...>& __t,
      |     ^~~~~~~~
/usr/include/c++/14/tuple:2613:5: note:   template argument deduction/substitution failed:
a.cc:72:32: note:   'std::pair<const int, int>' is not derived from 'const std::tuple<_Args1 ...>'
   72 |         if(*(count.begin()) != 0){
      |                                ^
/usr/include/c++/14/bits/stl_map.h:1557:5: note: candidate: 'template<class _Key, class _Tp, class _Compare, class _Alloc> bool std::operator!=(const map<_Key, _Tp, _Compare, _Allocator>&, const map<_Key, _Tp, _Compare, _Allocator>&)'
 1557 |     operator!=(const map<_Key, _Tp, _Compare, _Alloc>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_map.h:1557:5: note:   template argument deduction/substitution failed:
a.cc:72:32: note:   'std::pair<const int, int>' is not derived from 'const std::map<_Key, _Tp, _Compare, _Allocator>'
   72 |         if(*(count.begin()) != 0){
      |                                ^
In file included from /usr/include/c++/14/map:64:
/usr/include/c++/14/bits/stl_multimap.h:1179:5: note: candidate: 'template<class _Key, class _Tp, class _Compare, class _Alloc> bool std::operator!=(const multimap<_Key, _Tp, _Compare, _Allocator>&, const multimap<_Key, _Tp, _Compare, _Allocator>&)'
 1179 |     operator!=(const multimap<_Key, _Tp, _Compare, _Alloc>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_multimap.h:1179:5: note:   template argument deduction/substitution failed:
a.cc:72:32: note:   'std::pair<const int, int>' is not derived from 'const std::multimap<_Key, _Tp, _Compare, _Allocator>'
   72 |         if(*(count.begin()) != 0){
      |                                ^