Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<stack>
#include<queue>
#include<list>
#include<set>
#include<cmath>

#define REP(i,n) for(int (i) = 0;(i) < (n);(i)++)
using namespace std;
int cnt = 0, n;
int A[500000];

__int64 merge(int f, int l);

int main() {
	cin >> n;
	REP(i, n) cin >> A[i];
	cout << merge(0, n - 1) << endl;
	return 0;
}

__int64 merge(int f, int l) {
	if (f == l)return 0;
	__int64 mid = (f + l) / 2,T1,T2,T=0;
	T1=merge(f, mid);T2=merge(mid + 1, l);
	int lptr = f, rptr = mid + 1;
	int  i = 0;
	vector<int> B;
	while (lptr != mid + 1 || rptr != l+1) {
		if (lptr != mid + 1 && rptr != l + 1) {
			if (A[lptr] > A[rptr]) {
				B.push_back(A[rptr]);
				rptr++; T += mid + 1 - lptr;
			}
			else {
				B.push_back(A[lptr]);
				lptr++;
			}
		}
		else if (lptr == mid + 1) {
			B.push_back(A[rptr]);
			rptr++;
		}
		else {
			B.push_back(A[lptr]);
			lptr++;
		}
	}
	for (int i = f;i <= l;i++) A[i] = B[i-f];
	return T1+T+T2;
}

Compiler output:
a.cc:16:1: error: '__int64' does not name a type; did you mean '__int64_t'?
   16 | __int64 merge(int f, int l);
      | ^~~~~~~
      | __int64_t
a.cc: In function 'int main()':
a.cc:21:22: error: no matching function for call to 'merge(int, int)'
   21 |         cout << merge(0, n - 1) << endl;
      |                 ~~~~~^~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_algo.h:4857:5: note: candidate: 'template<class _IIter1, class _IIter2, class _OIter> _OIter std::merge(_IIter1, _IIter1, _IIter2, _IIter2, _OIter)'
 4857 |     merge(_InputIterator1 __first1, _InputIterator1 __last1,
      |     ^~~~~
/usr/include/c++/14/bits/stl_algo.h:4857:5: note:   candidate expects 5 arguments, 2 provided
/usr/include/c++/14/bits/stl_algo.h:4908:5: note: candidate: 'template<class _IIter1, class _IIter2, class _OIter, class _Compare> _OIter std::merge(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare)'
 4908 |     merge(_InputIterator1 __first1, _InputIterator1 __last1,
      |     ^~~~~
/usr/include/c++/14/bits/stl_algo.h:4908:5: note:   candidate expects 6 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:412:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _ForwardIterator, class _Compare> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator2> std::merge(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, _ForwardIterator, _Compare)'
  412 | merge(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2,
      | ^~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:412:1: note:   candidate expects 7 arguments, 2 provided
/usr/include/c++/14/pstl/glue_algorithm_defs.h:417:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _ForwardIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator2> std::merge(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, _ForwardIterator)'
  417 | merge(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2,
      | ^~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:417:1: note:   candidate expects 6 arguments, 2 provided
a.cc: At global scope:
a.cc:25:1: error: '__int64' does not name a type; did you mean '__int64_t'?
   25 | __int64 merge(int f, int l) {
      | ^~~~~~~
      | __int64_t