Language: C++

//### In The Name Of GOD ###

//%% Remember; (((He))) is The (((Accepter))) %%

// GOD IS GREATER ...

#include <bits/stdc++.h>

using namespace std;

typedef long long ll ;
typedef long double ld ;

//#define int ll
#define pb push_back
#define bp pop_back
#define pf push_front
#define fp pop_front
#define X first
#define Y second
#define sz(a) (int)(a.size())
#define sg(a, b) (a + b - 1) / b

const int MOD = 1000 * 1000 * 1000 + 7;
const int INF = 1000 * 1000 * 1000 + 10 ;
const int MAXN = 10000 + 10;
const int MLOG = 17;
const int NMAX = 20;

signed main() {
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	int m, n;
	cin >> n >> m;
	int A[MAXN], B[MAXN];
	for(int i = 0; i < n; i++) cin >> A[i];
	for(int i = 0; i < m; i++) cin >> B[i];
	sort(A, A + n, greater<int>());
	sort(B, B + n, greater<int>());
	int x = 0, y = 0, ans = 1;
	for(int i = n * m; i >= 1; i--) {
		if(A[x] == i && B[y] == i) {
			x++;
		   	y++;
			//cerr << 1 << ' ' << ans << endl;
		}else if(A[x] == i) {
			x++;
			ans = (ll)ans * y % MOD;
			//cerr << 2 << ' ' << ans << endl;
		}else if(B[y] == i) {
			y++;
			ans = (ll)ans * x % MOD;
			//cerr << 3 << ' ' << ans << endl;
		}else {
			ans = (ll)ans * max(0, (ll)x * y - (ll)n * m + i) % MOD;
			//cerr << 4 << ' ' << ans << endl;
		}
	}
	//ans *= (x == n);
	//ans *= (y == m);
	cout << ans;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:54:44: error: no matching function for call to 'max(int, ll)'
   54 |                         ans = (ll)ans * max(0, (ll)x * y - (ll)n * m + i) % MOD;
      |                                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:7:
/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:54:44: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   54 |                         ans = (ll)ans * max(0, (ll)x * y - (ll)n * m + i) % MOD;
      |                                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:54:44: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   54 |                         ans = (ll)ans * max(0, (ll)x * y - (ll)n * m + i) % MOD;
      |                                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~