Language: C++

#include <iostream>
#include <fstream>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <list>
#include <utility>
#include <cmath>
#include <sstream>
#include <map>
#define F first
#define S second
#define FOR(i,n) for(int i=0;i<(int)n;i++)
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define FORI(i,k,n) for(int i=k;i<(int)n;i++)
#define repp(i,k,n) for(int i=k;i<(int)n;i++)
using namespace std;
typedef pair<double, double> pdd;
typedef pair<short,short> pii;
const double EPS = 10e-6;
vector<int> a;
map<pii,short> memo;
short dp(short now,short p)
{
	if(now==a.size())return 0;
	if(memo.count(pii(now,p)))return memo[pii(now,p)];
	int ans =0;
	if(a[now]>a[p])
	{
		ans=max(dp(now+1,now)+1,dp(now+1,p));
	}else ans=dp(now+1,p);

	return memo[pii(now,p)]=ans;

}

int main ()
{
	int n;
	cin>>n;
	a.push_back(-1);
	rep(i,n)
	{
		int x;
		cin>>x;
		a.push_back(x);
	}
	cout<<dp(0,0)<<endl;



}

Compiler output:
a.cc: In function 'short int dp(short int, short int)':
a.cc:34:24: error: no matching function for call to 'max(int, short int)'
   34 |                 ans=max(dp(now+1,now)+1,dp(now+1,p));
      |                     ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:34:24: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'short int')
   34 |                 ans=max(dp(now+1,now)+1,dp(now+1,p));
      |                     ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:7:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:34:24: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   34 |                 ans=max(dp(now+1,now)+1,dp(now+1,p));
      |                     ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~