Main.cc: In function ‘int main()’: Main.cc:19:39: error: no matching function for call to ‘max_element(int*, int&)’ int maxn = *max_element(sum + 1, a); ^ In file included from /usr/include/c++/7/algorithm:62:0, from Main.cc:1: /usr/include/c++/7/bits/stl_algo.h:5668:5: note: candidate: template _FIter std::max_element(_FIter, _FIter) max_element(_ForwardIterator __first, _ForwardIterator __last) ^~~~~~~~~~~ /usr/include/c++/7/bits/stl_algo.h:5668:5: note: template argument deduction/substitution failed: Main.cc:19:39: note: deduced conflicting types for parameter ‘_FIter’ (‘int*’ and ‘int’) int maxn = *max_element(sum + 1, a); ^ In file included from /usr/include/c++/7/algorithm:62:0, from Main.cc:1: /usr/include/c++/7/bits/stl_algo.h:5693:5: note: candidate: template _FIter std::max_element(_FIter, _FIter, _Compare) max_element(_ForwardIterator __first, _ForwardIterator __last, ^~~~~~~~~~~ /usr/include/c++/7/bits/stl_algo.h:5693:5: note: template argument deduction/substitution failed: Main.cc:19:39: note: deduced conflicting types for parameter ‘_FIter’ (‘int*’ and ‘int’) int maxn = *max_element(sum + 1, a); ^