Language: C++

#include <bits/stdc++.h>
#define pb push_back
#define tam 310000
#define se second
#define fi first
#define forr(i,p,n) for(ll i=p;i<n;i++)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;
ll mult(ll a,ll b, ll p=MOD){return ((a%p)*(b%p))%p;}
ll add(ll a, ll b, ll p=MOD){return (a%p + b%p)%p;}
typedef pair<ll,ll> ii;
int val[tam];
int main()
{
    map<int,int> mp;
    int n,a;
    cin>>n>>a;
    ll tot=0,sum=0;
    forr(i,0,n)
    {
        cin>>val[i];
        val[i]-=a;
    }   
    int n1;
    n1=n/2;
    int n2=n-n1;
    unordered_map<int,ll> mask1,mask2;
    forr(i,1,(1<<n1))
    {
        tot=0;
        forr(j,0,n1)
        {
            if ((i&(1<<j)))
                tot+=val[j];
        }
        mask1[tot]++;
    }
    forr(i,1,(1<<n2))
    {
        tot=0;
        forr(j,0,(n2))
        {
            if ((i&(1<<j)))
                tot+=val[j+n/2];
        }
        mask2[tot]++;
    }
    sum=mask1[0]+mask2[0];
    //cout<<sum<<" ";
    for(map<int,ll>::iterator ite=mask1.begin();ite!=mask1.end();ite++)
    {
        sum+=(ite->se)*(mask2[-ite->first]);
    }
    cout<<sum<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:51:46: error: conversion from 'std::unordered_map<int, long long int>::iterator' {aka 'std::__detail::_Insert_base<int, std::pair<const int, long long int>, std::allocator<std::pair<const int, long long int> >, std::__detail::_Select1st, std::equal_to<int>, std::hash<int>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true> >::iterator'} to non-scalar type 'std::map<int, long long int>::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, long long int>, std::_Select1st<std::pair<const int, long long int> >, std::less<int>, std::allocator<std::pair<const int, long long int> > >::iterator'} requested
   51 |     for(map<int,ll>::iterator ite=mask1.begin();ite!=mask1.end();ite++)
      |                                   ~~~~~~~~~~~^~
a.cc:51:52: error: no match for 'operator!=' (operand types are 'std::map<int, long long int>::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, long long int>, std::_Select1st<std::pair<const int, long long int> >, std::less<int>, std::allocator<std::pair<const int, long long int> > >::iterator'} and 'std::unordered_map<int, long long int>::iterator' {aka 'std::__detail::_Insert_base<int, std::pair<const int, long long int>, std::allocator<std::pair<const int, long long int> >, std::__detail::_Select1st, std::equal_to<int>, std::hash<int>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true> >::iterator'})
   51 |     for(map<int,ll>::iterator ite=mask1.begin();ite!=mask1.end();ite++)
      |                                                 ~~~^~~~~~~~~~~~~
      |                                                 |             |
      |                                                 |             std::unordered_map<int, long long int>::iterator {aka std::__detail::_Insert_base<int, std::pair<const int, long long int>, std::allocator<std::pair<const int, long long int> >, std::__detail::_Select1st, std::equal_to<int>, std::hash<int>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true> >::iterator}
      |                                                 std::map<int, long long int>::iterator {aka std::_Rb_tree<int, std::pair<const int, long long int>, std::_Select1st<std::pair<const int, long long int> >, std::less<int>, std::allocator<std::pair<const int, long long int> > >::iterator}
In file included from /usr/include/c++/14/regex:68,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181,
                 from a.cc:1:
/usr/include/c++/14/bits/regex.h:1132:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator!=(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
 1132 |     operator!=(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
      |     ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1132:5: note:   template argument deduction/substitution failed:
a.cc:51:64: note:   'std::map<int, long long int>::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, long long int>, std::_Select1st<std::pair<const int, long long int> >, std::less<int>, std::allocator<std::pair<const int, long long int> > >::iterator'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
   51 |     for(map<int,ll>::iterator ite=mask1.begin();ite!=mask1.end();ite++)
      |                                                                ^
/usr/include/c++/14/bits/regex.h:1212:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator!=(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)'
 1212 |     operator!=(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1212:5: note:   template argument deduction/substitution failed:
a.cc:51:64: note:   'std::map<int, long long int>::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, long long int>, std::_Select1st<std::pair<const int, long long int> >, std::less<int>, std::allocator<std::pair<const int, long long int> > >::iterator'} is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>'
   51 |     for(map<int,ll>::iterator ite=mask1.begin();ite!=mask1.end();ite++)
      |                                                                ^
/usr/include/c++/14/bits/regex.h:1305:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator!=(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)'
 1305 |     operator!=(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1305:5: note:   template argument deduction/substitution failed:
a.cc:51:64: note:   'std::map<int, long long int>::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, long long int>, std::_Select1st<std::pair<const int, long long int> >, std::less<int>, std::allocator<std::pair<const int, long long int> > >::iterator'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
   51 |     for(map<int,ll>::iterator ite=mask1.begin();ite!=mask1.end();ite++)
      |                                                                ^
/usr/include/c++/14/bits/regex.h:1379:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator!=(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
 1379 |     operator!=(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
      |     ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1379:5: note:   template argument deduction/substitution failed:
a.cc:51:64: note:   'std::unordered_map<int, long long int>::iterator' {aka 'std::__detail::_Insert_base<int, std::pair<const int, long long int>, std::allocator<std::pair<const int, long long int> >, std::__detail::_Select1st, std::equal_to<int>, std::hash<int>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true> >::iterator'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
   51 |     for(map<int,ll>::iterator ite=mask1.begin();ite!=mask1.end();ite++)
      |                                                                ^
/usr/include/c++/14/bits/regex.h:1473:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator!=(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
 1473 |     operator!=(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1473:5: note:   template argument deduction/substitution failed:
a.cc:51:64: note:   'std::map<int, long long int>::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, long long int>, std::_Select1st<std::pair<const int, long long int> >, std::less<int>, std::allocator<std::pair<const int, long long int> > >::iterator'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
   51 |     for(map<int,ll>::iterator ite=mask1.begin();ite!=mask1.end();ite++)
      |                                                                ^
/usr/include/c++/14/bits/regex.h:1547:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator!=(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)'
 1547 |     operator!=(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
      |     ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1547:5: note:   template argument deduction/substitution failed:
a.cc:51:64: note:   'std::unordered_map<int, long long int>::iterator' {aka 'std::__detail::_Insert_base<int, std::pair<const int, long long int>, std::allocator<std::pair<const int, long long int> >, std::__detail::_Select1st, std::equal_to<int>, std::hash<int>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true> >::iterator'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
   51 |     for(map<int,ll>::iterator ite=mask1.begin();ite!=mask1.end();ite++)
      |                                                                ^
/usr/include/c++/14/bits/regex.h:1647:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator!=(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
 1647 |     operator!=(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1647:5: note:   template argument deduction/substitution failed:
a.cc:51:64: note:   'std::map<int, long long int>::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, long long int>, std::_Select1st<std::pair<const int, long long int> >, std::less<int>, std::allocator<std::pair<const int, long long int> > >::iterator'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
   51 |     for(map<int,ll>::iterator ite=mask1.begin();ite!=mask1.end();ite++)
      |                                                                ^
/usr/include/c++/14/bits/regex.h:2213:5: note: candidate: 'template<class _Bi_iter, class _Alloc> bool std::__cxx11::operator!=(const match_results<_BiIter, _Alloc>&, const match_results<_BiIter, _Alloc>&)'
 2213 |     operator!=(const match_results<_Bi_iter, _Alloc>& __m1,
      |     ^~~~~~~~
/usr/include/c++/14/bits/regex.h:2213:5: note:   template argument deduction/substitution failed:
a.cc:51:64: note:   'std::map<int, long long int>::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, long long int>, std::_Select1st<std::pair<const int, long long int> >, std::less<int>, std::allocator<std::pair<const int, long long int> > >::iterator'} is not derived from 'const std::__cxx11::match_results<_BiIter, _Alloc>'
   51 |     for(map<int,ll>::iterator ite=mask1.begin();ite!=mask1.end();ite++)
      |                                                                ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from