Language: C++

#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

// 入力
int N;
long long a[110][3]={{0}}; // a[i], b[i], c[i] をそれぞれまとめて a[i][0], a[i][1], a[i][2] にしてしまう

// DP テーブル
long long dp[110][6]={{0}};

int main() {
    string S; cin>>S;
    long long counter=0;
    long long counter1=0;
    long long counter2=0;
    long long answer=0;
    if(S.at(0)=='<'){
    counter++;}
    else
    counter1++;
    for( int i=1; i<S.size(); i++){
    if(counter>0&&counter2==0){
    if(S.at(i)=='<'){
    counter++;
    continue;}
    else{
    answer+=counter*(counter+1)/2;
    counter1++;
    counter2=counter;
    counter=0;
    continue;}}
    else {
    if(S.at(i)=='>'){
    counter1++;
    continue;}
    else{
    answer+=counter1*(counter1-1)/2+max((counter1-counter2),0);
    counter++;
    counter2=0;
    counter1=0;
    continue;}}}
    answer+=counter*(counter+1)/2;
    answer+=counter1*(counter1-1)/2+max((counter1-counter2),0);
    cout<<answer<<endl;}
    
      
    
    


Compiler output:
a.cc: In function 'int main()':
a.cc:41:40: error: no matching function for call to 'max(long long int, int)'
   41 |     answer+=counter1*(counter1-1)/2+max((counter1-counter2),0);
      |                                     ~~~^~~~~~~~~~~~~~~~~~~~~~~
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:41:40: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   41 |     answer+=counter1*(counter1-1)/2+max((counter1-counter2),0);
      |                                     ~~~^~~~~~~~~~~~~~~~~~~~~~~
/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
a.cc:47:40: error: no matching function for call to 'max(long long int, int)'
   47 |     answer+=counter1*(counter1-1)/2+max((counter1-counter2),0);
      |                                     ~~~^~~~~~~~~~~~~~~~~~~~~~~
/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:47:40: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   47 |     answer+=counter1*(counter1-1)/2+max((counter1-counter2),0);
      |                                     ~~~^~~~~~~~~~~~~~~~~~~~~~~
/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