Language: C++

#include <cstdio>
#include <algorithm>
using namespace std;

int n, m;
long long int x[100000];
long long int y[100000];

long long int a, b;
long long int mod = 1e9+7;
long long int ans;

int main(){
	scanf("%d %d", &n, &m);
	for(int i=0; i<n; ++i){
		scanf("%lld", &x[i]);
		x[i] -= x[0];
	}
	for(int i=0; i<m; ++i){
		scanf("%lld", &y[i]);
		y[i] -= y[0];
	}

	for(int i=1; i<n; ++i){
		a += x[i] * min((((n-i-1)*n-(n-i-1)+n-1-(n-i-1)*(n-i-1)-(n-i-1)), (i-1)*n-(i-1)+n-1-(i-1)*(i-1)-(i-1)));
		a %= mod;
	}
	for(int i=1; i<m; ++i){
		b += y[i] * min((((m-i-1)*m-(m-i-1)+m-1-(m-i-1)*(m-i-1)-(m-i-1)), (i-1)*m-(i-1)+m-1-(i-1)*(i-1)-(i-1)));
		b %= mod;
	}

	ans = a * b;
	ans %= mod;

	printf("%lld\n", ans);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:32: error: no matching function for call to 'min(int)'
   25 |                 a += x[i] * min((((n-i-1)*n-(n-i-1)+n-1-(n-i-1)*(n-i-1)-(n-i-1)), (i-1)*n-(i-1)+n-1-(i-1)*(i-1)-(i-1)));
      |                             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   template argument deduction/substitution failed:
a.cc:25:32: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   25 |                 a += x[i] * min((((n-i-1)*n-(n-i-1)+n-1-(n-i-1)*(n-i-1)-(n-i-1)), (i-1)*n-(i-1)+n-1-(i-1)*(i-1)-(i-1)));
      |                             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   candidate expects 2 arguments, 1 provided
a.cc:29:32: error: no matching function for call to 'min(int)'
   29 |                 b += y[i] * min((((m-i-1)*m-(m-i-1)+m-1-(m-i-1)*(m-i-1)-(m-i-1)), (i-1)*m-(i-1)+m-1-(i-1)*(i-1)-(i-1)));
      |                             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 1 provided
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   template argument deduction/substitution failed:
a.cc:29:32: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   29 |                 b += y[i] * min((((m-i-1)*m-(m-i-1)+m-1-(m-i-1)*(m-i-1)-(m-i-1)), (i-1)*m-(i-1)+m-1-(i-1)*(i-1)-(i-1)));
      |                             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   candidate expects 2 arguments, 1 provided