/in/foo.cc: In function 'int main()':
/in/foo.cc:32:11: error: reference to 'next' is ambiguous
next=1+i1*1+i2*2+i3*3+i4*4;
^~~~
/in/foo.cc:8:23: note: candidates are: int next
int n,m,x,p1,p2,p3,p4,next;
^~~~
In file included from /usr/include/c++/6/bits/stl_algobase.h:66:0,
from /usr/include/c++/6/bits/char_traits.h:39,
from /usr/include/c++/6/ios:40,
from /usr/include/c++/6/ostream:38,
from /usr/include/c++/6/iostream:39,
from /in/foo.cc:1:
/usr/include/c++/6/bits/stl_iterator_base_funcs.h:205:5: note: template<class _ForwardIterator> _ForwardIterator std::next(_ForwardIterator, typename std::iterator_traits<_Iter>::difference_type)
next(_ForwardIterator __x, typename
^~~~
/in/foo.cc:33:82: error: reference to 'next' is ambiguous
if(i1)dp[i1][i2][i3][i4]=max(dp[i1][i2][i3][i4],dp[i1-1][i2][i3][i4]+a[next]);
^~~~
/in/foo.cc:8:23: note: candidates are: int next
int n,m,x,p1,p2,p3,p4,next;
^~~~
In file included from /usr/include/c++/6/bits/stl_algobase.h:66:0,
from /usr/include/c++/6/bits/char_traits.h:39,
from /usr/include/c++/6/ios:40,
from /usr/include/c++/6/ostream:38,
from /usr/include/c++/6/iostream:39,
from /in/foo.cc:1:
/usr/include/c++/6/bits/stl_iterator_base_funcs.h:205:5: note: template<class _ForwardIterator> _ForwardIterator std::next(_ForwardIterator, typename std::iterator_traits<_Iter>::difference_type)
next(_ForwardIterator __x, typename
^~~~
/in/foo.cc:34:82: error: reference to 'next' is ambiguous
if(i2)dp[i1][i2][i3][i4]=max(dp[i1][i2][i3][i4],dp[i1][i2-1][i3][i4]+a[next]);
^~~~
/in/foo.cc:8:23: note: candidates are: int next
int n,m,x,p1,p2,p3,p4,next;
^~~~
In file included from /usr/include/c++/6/bits/stl_algobase.h:66:0,
from /usr/include/c++/6/bits/char_traits.h:39,
from /usr/include/c++/6/ios:40,
from /usr/include/c++/6/ostream:38,
from /usr/include/c++/6/iostream:39,
from /in/foo.cc:1:
/usr/include/c++/6/bits/stl_iterator_base_funcs.h:205:5: note: template<class _ForwardIterator> _ForwardIterator std::next(_ForwardIterator, typename std::iterator_traits<_Iter>::difference_type)
next(_ForwardIterator __x, typename
^~~~
/in/foo.cc:35:82: error: reference to 'next' is ambiguous
if(i3)dp[i1][i2][i3][i4]=max(dp[i1][i2][i3][i4],dp[i1][i2][i3-1][i4]+a[next]);
^~~~
/in/foo.cc:8:23: note: candidates are: int next
int n,m,x,p1,p2,p3,p4,next;
^~~~
In file included from /usr/include/c++/6/bits/stl_algobase.h:66:0,
from /usr/include/c++/6/bits/char_traits.h:39,
from /usr/include/c++/6/ios:40,
from /usr/include/c++/6/ostream:38,
from /usr/include/c++/6/iostream:39,
from /in/foo.cc:1:
/usr/include/c++/6/bits/stl_iterator_base_funcs.h:205:5: note: template<class _ForwardIterator> _ForwardIterator std::next(_ForwardIterator, typename std::iterator_traits<_Iter>::difference_type)
next(_ForwardIterator __x, typename
^~~~
/in/foo.cc:36:82: error: reference to 'next' is ambiguous
if(i4)dp[i1][i2][i3][i4]=max(dp[i1][i2][i3][i4],dp[i1][i2][i3][i4-1]+a[next]);
^~~~
/in/foo.cc:8:23: note: candidates are: int next
int n,m,x,p1,p2,p3,p4,next;
^~~~
In file included from /usr/include/c++/6/bits/stl_algobase.h:66:0,
from /usr/include/c++/6/bits/char_traits.h:39,
from /usr/include/c++/6/ios:40,
from /usr/include/c++/6/ostream:38,
from /usr/include/c++/6/iostream:39,
from /in/foo.cc:1:
/usr/include/c++/6/bits/stl_iterator_base_funcs.h:205:5: note: template<class _ForwardIterator> _ForwardIterator std::next(_ForwardIterator, typename std::iterator_traits<_Iter>::difference_type)
next(_ForwardIterator __x, typename
^~~~