Language: C++

#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
const int maxn=200005;

struct node
{
    ll index,value;
}a[maxn];
ll C[maxn],n,k;

//离散化排序；
int cmp1(node a,node b)
{
    if(a.value!=b.value)
        return a.value<b.value;
    return a.index<b.index;
}

int cmp2(node a,node b)
{
    if(a.index!=b.index)
        return a.index<b.index;
    return a.value<b.value;
}

ll lowbit(ll x)
{
    return x&(-x);
}

void add(ll x,ll d)
{
    while(x<maxn)
    {
        C[x]+=d;
        x+=lowbit(x);
    }
}

ll sum(ll x)
{
    ll ret=0;
    while(x>0)
    {
        ret+=C[x];
        x-=lowbit(x);
    }
    return ret;
}

int main()
{
    ll ans=0;
    scanf("%lld%lld",&n,&k);
    for(int i=1;i<=n;i++)
    {
        scanf("%lld",&a[i].value);
        a[i].index=i;
        a[i].value-=k;
    }
    for(int i=2;i<=n;i++)
        a[i].value=a[i-1].value+a[i].value;
    for(int i=1;i<=n;i++)
        if(a[i].value>=0)
            ans+=1;
//printf("%d\n",ans);
    sort(a+1,a+1+n,cmp1);
    for(int i=1;i<=n;i++)
        a[i].value=i;
    sort(a+1,a+1+n,cmp2);
//for(int i=1;i<=n;i++)
//    printf("%d ",a[i].value);

//    printf("\n");
    for(int i=1;i<=n;i++)
    {
        ll x=a[i].value;
        ans+=sum(x);
        add(x,1);
    }
    printf("%lld\n",ans);

    return 0;
}

/*
10 7
4 6 8 13 11 3 2 6 12 14
*/


Compiler output:
a.cc:10:5: error: 'll' does not name a type
   10 |     ll index,value;
      |     ^~
a.cc:12:1: error: 'll' does not name a type
   12 | ll C[maxn],n,k;
      | ^~
a.cc: In function 'int cmp1(node, node)':
a.cc:17:10: error: 'struct node' has no member named 'value'
   17 |     if(a.value!=b.value)
      |          ^~~~~
a.cc:17:19: error: 'struct node' has no member named 'value'
   17 |     if(a.value!=b.value)
      |                   ^~~~~
a.cc:18:18: error: 'struct node' has no member named 'value'
   18 |         return a.value<b.value;
      |                  ^~~~~
a.cc:18:26: error: 'struct node' has no member named 'value'
   18 |         return a.value<b.value;
      |                          ^~~~~
a.cc:19:14: error: 'struct node' has no member named 'index'
   19 |     return a.index<b.index;
      |              ^~~~~
a.cc:19:22: error: 'struct node' has no member named 'index'
   19 |     return a.index<b.index;
      |                      ^~~~~
a.cc: In function 'int cmp2(node, node)':
a.cc:24:10: error: 'struct node' has no member named 'index'
   24 |     if(a.index!=b.index)
      |          ^~~~~
a.cc:24:19: error: 'struct node' has no member named 'index'
   24 |     if(a.index!=b.index)
      |                   ^~~~~
a.cc:25:18: error: 'struct node' has no member named 'index'
   25 |         return a.index<b.index;
      |                  ^~~~~
a.cc:25:26: error: 'struct node' has no member named 'index'
   25 |         return a.index<b.index;
      |                          ^~~~~
a.cc:26:14: error: 'struct node' has no member named 'value'
   26 |     return a.value<b.value;
      |              ^~~~~
a.cc:26:22: error: 'struct node' has no member named 'value'
   26 |     return a.value<b.value;
      |                      ^~~~~
a.cc: At global scope:
a.cc:29:1: error: 'll' does not name a type
   29 | ll lowbit(ll x)
      | ^~
a.cc:34:6: error: variable or field 'add' declared void
   34 | void add(ll x,ll d)
      |      ^~~
a.cc:34:10: error: 'll' was not declared in this scope
   34 | void add(ll x,ll d)
      |          ^~
a.cc:34:15: error: 'll' was not declared in this scope
   34 | void add(ll x,ll d)
      |               ^~
a.cc:43:1: error: 'll' does not name a type
   43 | ll sum(ll x)
      | ^~
a.cc: In function 'int main()':
a.cc:56:5: error: 'll' was not declared in this scope
   56 |     ll ans=0;
      |     ^~
a.cc:57:23: error: 'n' was not declared in this scope; did you mean 'yn'?
   57 |     scanf("%lld%lld",&n,&k);
      |                       ^
      |                       yn
a.cc:57:26: error: 'k' was not declared in this scope
   57 |     scanf("%lld%lld",&n,&k);
      |                          ^
a.cc:60:28: error: 'struct node' has no member named 'value'
   60 |         scanf("%lld",&a[i].value);
      |                            ^~~~~
a.cc:61:14: error: 'struct node' has no member named 'index'
   61 |         a[i].index=i;
      |              ^~~~~
a.cc:62:14: error: 'struct node' has no member named 'value'
   62 |         a[i].value-=k;
      |              ^~~~~
a.cc:65:14: error: 'struct node' has no member named 'value'
   65 |         a[i].value=a[i-1].value+a[i].value;
      |              ^~~~~
a.cc:65:27: error: 'struct node' has no member named 'value'
   65 |         a[i].value=a[i-1].value+a[i].value;
      |                           ^~~~~
a.cc:65:38: error: 'struct node' has no member named 'value'
   65 |         a[i].value=a[i-1].value+a[i].value;
      |                                      ^~~~~
a.cc:67:17: error: 'struct node' has no member named 'value'
   67 |         if(a[i].value>=0)
      |                 ^~~~~
a.cc:68:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   68 |             ans+=1;
      |             ^~~
      |             abs
a.cc:72:14: error: 'struct node' has no member named 'value'
   72 |         a[i].value=i;
      |              ^~~~~
a.cc:80:11: error: expected ';' before 'x'
   80 |         ll x=a[i].value;
      |           ^~
      |           ;
a.cc:81:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   81 |         ans+=sum(x);
      |         ^~~
      |         abs
a.cc:81:18: error: 'x' was not declared in this scope
   81 |         ans+=sum(x);
      |                  ^
a.cc:81:14: error: 'sum' was not declared in this scope
   81 |         ans+=sum(x);
      |              ^~~
a.cc:82:9: error: 'add' was not declared in this scope; did you mean 'fadd'?
   82 |         add(x,1);
      |         ^~~
      |         fadd
a.cc:84:21: error: 'ans' was not declared in this scope; did you mean 'abs'?
   84 |     printf("%lld\n",ans);
      |                     ^~~
      |                     abs