Language: C++

using namespace std;
#include <bits/stdc++.h>
#define rep(i, s) for (int i = 0; i < s; ++i)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define all(v) (v.begin(), v.end())
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define VEC(a, n) vector<int>a(n)
#define VECV(a,n,m) vector<vector<int>> a(n, vector<int>(m));
#define PQ(a) priority_queue<int>a
#define PQmin(a) priority_queue< int, :vector<int>, greater<int> >a
#define PAIR pair<int, int>
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
#define EPS (1e-7)
#define INF (1e10)
#define PI (acos(-1))
const ll mod = 1000000007;
bool f(string s){
  bool ans=true;
  rep(i,s.size()/2){
    if(s[i]!=s[s.size()/2+i]){
      ans=false;
      break;
    }
  }
  return ans;
}

int gcd(int a, int b) {
  int v0 = a, v1 = b, v2 = a % b;
  while (v2 != 0) {
    v0 = v1;
    v1 = v2;
    v2 = v0 % v1;
  };
  return v1;
}

int gcd3(int a, int b,int c){
  return gcd(gcd(a,b),c);
}

int mid(int a, int b, int c){
  if(max(max(a,b),c)==a && min(min(a,b),c)==b)
    return c;
  if(max(max(a,b),c)==a && min(min(a,b),c)==c)
    return b;
  if(max(max(a,b),c)==b && min(min(a,b),c)==a)
    return c;
  if(max(max(a,b),c)==b && min(min(a,b),c)==c)
    return a;
  if(max(max(a,b),c)==c && min(min(a,b),c)==a)
    return b;
  if(max(max(a,b),c)==c && min(min(a,b),c)==b)
    return a;
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll A,B,N;
  cin>>A>>B>>N;
  ll M=N%B;
  ll maxa=A*M/B-A*(M/B);
  ll maxb=A*N/B-A*(N/B);
  ll maxc=A*(N-1)/B-A*((N-1)/B);
  ll ans=max(max(maxa,maxb),max(maxc,0));
  cout<<ans<<endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:69:32: error: no matching function for call to 'max(ll&, int)'
   69 |   ll ans=max(max(maxa,maxb),max(maxc,0));
      |                             ~~~^~~~~~~~
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:2:
/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:69:32: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   69 |   ll ans=max(max(maxa,maxb),max(maxc,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
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:69:32: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   69 |   ll ans=max(max(maxa,maxb),max(maxc,0));
      |                             ~~~^~~~~~~~
a.cc: In function 'int mid(int, int, int)':
a.cc:58:1: warning: control reaches end of non-void function [-Wreturn-type]
   58 | }
      | ^