Language: C++

#include <bits/stdc++.h>
#define N 1001
using namespace std;
typedef long long ll;



int main(){
  ll n,V;
  cin>>n>>V;
  
  ll A[N],B[N],C[N],D[N];
  for(int i=0;i<n;i++)cin>>A[i];
  for(int i=0;i<n;i++)cin>>B[i];
  for(int i=0;i<n;i++)cin>>C[i];
  for(int i=0;i<n;i++)cin>>D[i];
  
  unordered_map<ll,ll> M1,M2;
  for(int i=0;i<n;i++)
    for(int j=0;j<n;j++)M1[A[i]+B[j]]++;

  for(int i=0;i<n;i++)
    for(int j=0;j<n;j++)M2[(C[i]+D[j])]++;
  
  ll ans=0;
  for(map<ll,ll>::iterator I=M1.begin();I!=M1.end();I++)
    ans+=I->second*M2[V-I->first];
  cout<<ans<<endl; 
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:38: error: conversion from 'std::unordered_map<long long int, long long int>::iterator' {aka 'std::__detail::_Insert_base<long long int, std::pair<const long long int, long long int>, std::allocator<std::pair<const long long int, long long int> >, std::__detail::_Select1st, std::equal_to<long long int>, std::hash<long long 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<long long int, long long int>::iterator' {aka 'std::_Rb_tree<long long int, std::pair<const long long int, long long int>, std::_Select1st<std::pair<const long long int, long long int> >, std::less<long long int>, std::allocator<std::pair<const long long int, long long int> > >::iterator'} requested
   26 |   for(map<ll,ll>::iterator I=M1.begin();I!=M1.end();I++)
      |                              ~~~~~~~~^~
a.cc:26:42: error: no match for 'operator!=' (operand types are 'std::map<long long int, long long int>::iterator' {aka 'std::_Rb_tree<long long int, std::pair<const long long int, long long int>, std::_Select1st<std::pair<const long long int, long long int> >, std::less<long long int>, std::allocator<std::pair<const long long int, long long int> > >::iterator'} and 'std::unordered_map<long long int, long long int>::iterator' {aka 'std::__detail::_Insert_base<long long int, std::pair<const long long int, long long int>, std::allocator<std::pair<const long long int, long long int> >, std::__detail::_Select1st, std::equal_to<long long int>, std::hash<long long int>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true> >::iterator'})
   26 |   for(map<ll,ll>::iterator I=M1.begin();I!=M1.end();I++)
      |                                         ~^~~~~~~~~~
      |                                         |        |
      |                                         |        std::unordered_map<long long int, long long int>::iterator {aka std::__detail::_Insert_base<long long int, std::pair<const long long int, long long int>, std::allocator<std::pair<const long long int, long long int> >, std::__detail::_Select1st, std::equal_to<long long int>, std::hash<long long 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<long long int, long long int>::iterator {aka std::_Rb_tree<long long int, std::pair<const long long int, long long int>, std::_Select1st<std::pair<const long long int, long long int> >, std::less<long long int>, std::allocator<std::pair<const long long 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:26:51: note:   'std::map<long long int, long long int>::iterator' {aka 'std::_Rb_tree<long long int, std::pair<const long long int, long long int>, std::_Select1st<std::pair<const long long int, long long int> >, std::less<long long int>, std::allocator<std::pair<const long long int, long long int> > >::iterator'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
   26 |   for(map<ll,ll>::iterator I=M1.begin();I!=M1.end();I++)
      |                                                   ^
/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:26:51: note:   'std::map<long long int, long long int>::iterator' {aka 'std::_Rb_tree<long long int, std::pair<const long long int, long long int>, std::_Select1st<std::pair<const long long int, long long int> >, std::less<long long int>, std::allocator<std::pair<const long long int, long long int> > >::iterator'} is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>'
   26 |   for(map<ll,ll>::iterator I=M1.begin();I!=M1.end();I++)
      |                                                   ^
/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:26:51: note:   'std::map<long long int, long long int>::iterator' {aka 'std::_Rb_tree<long long int, std::pair<const long long int, long long int>, std::_Select1st<std::pair<const long long int, long long int> >, std::less<long long int>, std::allocator<std::pair<const long long int, long long int> > >::iterator'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
   26 |   for(map<ll,ll>::iterator I=M1.begin();I!=M1.end();I++)
      |                                                   ^
/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:26:51: note:   'std::unordered_map<long long int, long long int>::iterator' {aka 'std::__detail::_Insert_base<long long int, std::pair<const long long int, long long int>, std::allocator<std::pair<const long long int, long long int> >, std::__detail::_Select1st, std::equal_to<long long int>, std::hash<long long 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>'
   26 |   for(map<ll,ll>::iterator I=M1.begin();I!=M1.end();I++)
      |                                                   ^
/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:26:51: note:   'std::map<long long int, long long int>::iterator' {aka 'std::_Rb_tree<long long int, std::pair<const long long int, long long int>, std::_Select1st<std::pair<const long long int, long long int> >, std::less<long long int>, std::allocator<std::pair<const long long int, long long int> > >::iterator'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
   26 |   for(map<ll,ll>::iterator I=M1.begin();I!=M1.end();I++)
      |                                                   ^
/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:26:51: note:   'std::unordered_map<long long int, long long int>::iterator' {aka 'std::__detail::_Insert_base<long long int, std::pair<const long long int, long long int>, std::allocator<std::pair<const long long int, long long int> >, std::__detail::_Select1st, std::equal_to<long long int>, std::hash<long long 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>'
   26 |   for(map<ll,ll>::iterator I=M1.begin();I!=M1.end();I++)
      |                                                   ^
/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:26:51: note:   'std::map<long long int, long long int>::iterator' {aka 'std::_Rb_tree<long long int, std::pair<const long long int, long long int>, std::_Select1st<std::pair<const long long int, long long int> >, std::less<long long int>, std::allocator<std::pair<const long long int, long long int> > >::iterator'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
   26 |   for(map<ll,ll>::iterator I=M1.begin();I!=M1.end();I++)
      |                                                   ^
/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:26:51: note:   'std::map<long long int, long long int>::iterator' {aka