Language: C++

#include<bits/stdc++.h>
using namespace std;
long long aa;bool bb;char ch;
long long scan()
{
	while(ch=getchar(),(ch<'0'||ch>'9')&&ch!='-');
	ch=='-'?(bb=1,aa=0):(bb=0,aa=ch-48);
	while(ch=getchar(),(ch>='0'&&ch<='9'))
		aa=aa*10+ch-48;
	return (bb?(-aa):(aa));
} 
//用树状数组求逆序数  
long long Length;
struct Node  
{  
    long long data;  
    long long pos;  
};  
Node seq[200010];  
long long TreeArray[200010]; 

long long LowBit(long long num)  
{  
    return num&(num^(num-1));  
}  
long long cmp(Node num1,Node num2)  
{  
	if(num2.data==num1.data)
		return num1.pos<num2.pos;
    return num1.data>num2.data;  
}  
long long sum(long long pos)  
{  
    long long result=0;  
    while (pos)  
    {  
        result+=TreeArray[pos];  
        pos-=LowBit(pos);  
    }  
    return result;  
}  
void INC(long long pos)  
{  
    while(pos<=Length)  
    {  
        TreeArray[pos]++;  
        pos+=LowBit(pos);  
    }  
}  
void insertNum(long long &reverseNum)  
{  
    for (long long i=1;i<=Length;i++)  
    {  
        reverseNum+=sum(seq[i].pos); 
        //cout<<i<<" "<<seq[i].data<<"\t"<<seq[i].pos<<"\t"<<reverseNum<<endl;
        INC(seq[i].pos);   
    }  
}  
long long n,k;
long long array[200010];
int main()  
{  
	scanf("%lld%lld",&n,&k);
	Length=n+1;
	for(int i=1;i<=n;++i)
		array[i]=scan()-k;
	for(int i=2;i<=n;++i)
		array[i]=array[i-1]+array[i]; 
	seq[1].data=0;
	seq[1].pos=1;
    for(int i=1;i<=n;i++)  
    {  
        seq[i+1].data=-array[i];  
    	
        seq[i+1].pos=i+1; 
    }  
    
    //从大到小排序
    sort(seq+1,seq+Length+1,cmp);
    
    //for(int i=1;i<=Length;i++)  
	//	cout<<seq[i].data<<" "<<seq[i].pos<<endl;
	//cout<<endl;
    long long reverseNum=0;  
    insertNum(reverseNum); 
    cout<<reverseNum<<endl;
    return 0;  
}  


Compiler output:
a.cc: In function 'int main()':
a.cc:66:17: error: reference to 'array' is ambiguous
   66 |                 array[i]=scan()-k;
      |                 ^~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array'
   99 |     struct array;
      |            ^~~~~
a.cc:60:11: note:                 'long long int array [200010]'
   60 | long long array[200010];
      |           ^~~~~
a.cc:68:17: error: reference to 'array' is ambiguous
   68 |                 array[i]=array[i-1]+array[i];
      |                 ^~~~~
/usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array'
   99 |     struct array;
      |            ^~~~~
a.cc:60:11: note:                 'long long int array [200010]'
   60 | long long array[200010];
      |           ^~~~~
a.cc:68:26: error: reference to 'array' is ambiguous
   68 |                 array[i]=array[i-1]+array[i];
      |                          ^~~~~
/usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array'
   99 |     struct array;
      |            ^~~~~
a.cc:60:11: note:                 'long long int array [200010]'
   60 | long long array[200010];
      |           ^~~~~
a.cc:68:37: error: reference to 'array' is ambiguous
   68 |                 array[i]=array[i-1]+array[i];
      |                                     ^~~~~
/usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array'
   99 |     struct array;
      |            ^~~~~
a.cc:60:11: note:                 'long long int array [200010]'
   60 | long long array[200010];
      |           ^~~~~
a.cc:73:24: error: reference to 'array' is ambiguous
   73 |         seq[i+1].data=-array[i];
      |                        ^~~~~
/usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array'
   99 |     struct array;
      |            ^~~~~
a.cc:60:11: note:                 'long long int array [200010]'
   60 | long long array[200010];
      |           ^~~~~