Language: C++

#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll=long long;
using vec=vector<ll>;
using Graph = vector<vector<ll>>;
#define loop(i,n) for(ll i=0;i<n;i++)
#define Loop(i, m, n) for(ll i = m;i < n;i++)
#define pool(i,n) for(ll i=n;i>=0;i--)
#define Pool(i, m, n) for(ll i=n;i>=m;i--)
#define MAX 999999999ll
#define MIN -999999999ll
#define setbit bitset<8>
#define flagcount __builtin_popcount
#define flag(x) (1<<x)
#define flagadd(bit,x) bit|=flag(x)
#define flagpop(bit,x) bit&=~flag(x) 
#define flagon(bit,i) bit&flag(i)
#define flagoff(bit,i) !(bit & (1<<i))
#define all(v) v.begin(),v.end()
#define low2way(v,x) lower_bound(all(v),x)
#define high2way(v,x) upper_bound(all(v),x)
#define count2way(v,x) high2way(v,x)-low2way(v,x)
#define lower(v,x) low2way(v,x)-v.begin() //1番左が0、もし見つから無いならｎを出力
#define higher(v,x) high2way(v,x)-v.begin()-1 //1番左が0、もし見つからないならn-1を出力（注意）
#define putout(x) cout<<x<<endl
#define gcd(x,y) __gcd(x,y) 
#define Gput(a,b) G[a].push_back(b)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
ll lcm(ll x,ll y){
  ll z=gcd(x,y);
  return x*(y/z);
}
ll ctoi(char c){
	if(c>='0'&&c<='9'){
		return c-'0';
	}
	return 0;
}
vector<bool> seen;
void dfs(const Graph &G,ll v){
    seen[v]=true;
    for(auto nextv:G[v]){ 
        if(seen[nextv])continue;
        dfs(G,nextv);
    }
}
ll fact(ll n){
ll sum=0;
Loop(i,1,n+1){
sum+=i;
}
return sum;

}
int main() {
  cout << fixed << setprecision(16);
string s;
  cin>>s;
  ll n=s.size();
  ll gcount=0;
  ll pcount=0;
  
  ll ans=-1;
  loop(i,n){
if(s[i]=='g'&&pcount>0){
gcount++;
  ans-=pcount-1;
  pcount=0;
}
if(s[i]=='p'&&gcount>0){
pcount++;
  ans+=gcount-1;
  gcount=0;
}
if(s[i]=='g'&&pcount==0){
gcount++;
}
if(s[i]=='p'&&gcount==0){
pcount++;
}
  }
if(pcount>0)ans+=pcount-1;
    if(gcount>0)ans+=gcount-1;
  putout(max(ans,0));
}


Compiler output:
a.cc: In function 'int main()':
a.cc:86:13: error: no matching function for call to 'max(ll&, int)'
   86 |   putout(max(ans,0));
      |          ~~~^~~~~~~
a.cc:26:25: note: in definition of macro 'putout'
   26 | #define putout(x) cout<<x<<endl
      |                         ^
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 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:86:13: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   86 |   putout(max(ans,0));
      |          ~~~^~~~~~~
a.cc:26:25: note: in definition of macro 'putout'
   26 | #define putout(x) cout<<x<<endl
      |                         ^
/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:
/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:86:13: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   86 |   putout(max(ans,0));
      |          ~~~^~~~~~~
a.cc:26:25: note: in definition of macro 'putout'
   26 | #define putout(x) cout<<x<<endl
      |                         ^