Language: C++

#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;
int main() {
    string S; cin>>S;
    long long counter=0;
    int counter1=0;
    int counter2=0;
    long long answer=0;
    if(S.at(0)=='<'){
    counter++;}
    else
    counter1++;
    for(long long 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),0LL);
    counter++;
    counter2=0;
    counter1=0;
    continue;}}}
    answer+=counter*(counter+1)/2;
    answer+=counter1*(counter1-1)/2+max((counter1-counter2),0LL);
    cout<<answer<<endl;}
    
      
    
    


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