Language: C++

#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
const ll mod = 1000000007;
const int max = 510000;

ll fact[max],fact_inv[max];

ll power(ll a, ll b){
  ll res = 1;
  while(b>0){
    if(b&1) res=res*a%mod;
    a = a*a %mod;
    b>>=1;
  }
  return res;
}

ll combo(ll n, ll r){
    return (fact(n)*fact_inv(r))%mod * fact_inv(n-r) %mod;
}

int main(){
  ll N,M,K;cin>>N>>M>>K;
  ll i,j,k,l;
  fact[0]=1;
  repn(i,N*M){
    fact[i] = fact[i-1] * i %mod;
  }
  fact_inv[N*M]=power(fact[n],p-2);
  for(i=N*M-1;i>=0;i--){
    fact_inv[i]=fact_inv[i+1]*(i+1) %mod;
  }
  ll ans=0;
  repn(i,N){
    ans+=(N-i)*M*M;
    ans%=mod;
  }
  repn(i,M){
    ans+=(M-i)*N*N;
    ans%=mod;
  }
  ans*=combo(N*M-2,K-2);
  ans%=mod;
  cout<<ans<<endl;
}


Compiler output:
a.cc:27:9: error: reference to 'max' is ambiguous
   27 | ll fact[max],fact_inv[max];
      |         ^~~
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidates are: '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:5706:5: note:                 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
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:303:5: note:                 '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:257:5: note:                 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
a.cc:25:11: note:                 'const int max'
   25 | const int max = 510000;
      |           ^~~
a.cc:27:23: error: reference to 'max' is ambiguous
   27 | ll fact[max],fact_inv[max];
      |                       ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidates are: '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:5706:5: note:                 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:                 '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:257:5: note:                 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
a.cc:25:11: note:                 'const int max'
   25 | const int max = 510000;
      |           ^~~
a.cc: In function 'll combo(ll, ll)':
a.cc:40:13: error: 'fact' was not declared in this scope
   40 |     return (fact(n)*fact_inv(r))%mod * fact_inv(n-r) %mod;
      |             ^~~~
a.cc:40:21: error: 'fact_inv' was not declared in this scope
   40 |     return (fact(n)*fact_inv(r))%mod * fact_inv(n-r) %mod;
      |                     ^~~~~~~~
a.cc: In function 'int main()':
a.cc:46:3: error: 'fact' was not declared in this scope
   46 |   fact[0]=1;
      |   ^~~~
a.cc:50:3: error: 'fact_inv' was not declared in this scope
   50 |   fact_inv[N*M]=power(fact[n],p-2);
      |   ^~~~~~~~
a.cc:50:28: error: 'n' was not declared in this scope
   50 |   fact_inv[N*M]=power(fact[n],p-2);
      |                            ^
a.cc:50:31: error: 'p' was not declared in this scope
   50 |   fact_inv[N*M]=power(fact[n],p-2);
      |                               ^