Language: C++

#include <bits/stdc++.h>
#define lowbit(x) x & -x

using namespace std;

const int N = 1e5 + 10;

typedef long long LL:

LL n, k;
LL a[N], sum[N], c[N];

inline void insert(LL x) {
	for(; x <= n; x += lowbit(x))
		c[x] += 1;
}

inline LL query(LL x) {
	int ans = 0;
	for(; x; x -= lowbit(x)) 
		ans += c[x];
	return ans;
}

inline LL find(LL x) {
	LL mid, l = 1, r = n + 1;
	while(l <= r) {
		mid = l + ((r - l) >> 1);
		if(sum[mid] == x) return mid;
		else if(sum[mid] < x) l = mid + 1;
		else if(sum[mid] > x) r = mid - 1;
	}
	return mid;
}

int main() {
	cin >> n >> k;
	for(LL i = 1; i <= n; ++i) {
		cin >> a[i], a[i] -= k;
		sum[i] = sum[i - 1] + a[i];//记录前缀和 
		a[i] = sum[i];
	} 
	sum[n + 1] = 0;
	sort(sum + 1, sum + n + 2);
	LL ans = 0;
	for(LL i = 0; i <= n; ++i) {
		LL rk = find(a[i]);
		ans += query(rk);	
//		printf("rk = %d %d\n", a[i], query(rk));
		insert(rk);//更新要放在查询的后面 
	}
	printf("%lld", ans);
	return 0;
}

Compiler output:
a.cc:8:21: error: found ':' in nested-name-specifier, expected '::'
    8 | typedef long long LL:
      |                     ^
      |                     ::
a.cc:8:19: error: 'LL' has not been declared
    8 | typedef long long LL:
      |                   ^~
a.cc:10:4: error: expected initializer before 'n'
   10 | LL n, k;
      |    ^
a.cc:11:1: error: 'LL' does not name a type
   11 | LL a[N], sum[N], c[N];
      | ^~
a.cc:13:13: error: variable or field 'insert' declared void
   13 | inline void insert(LL x) {
      |             ^~~~~~
a.cc:13:20: error: 'LL' was not declared in this scope
   13 | inline void insert(LL x) {
      |                    ^~
a.cc:18:8: error: 'LL' does not name a type
   18 | inline LL query(LL x) {
      |        ^~
a.cc:25:8: error: 'LL' does not name a type
   25 | inline LL find(LL x) {
      |        ^~
a.cc: In function 'int main()':
a.cc:37:16: error: 'n' was not declared in this scope
   37 |         cin >> n >> k;
      |                ^
a.cc:37:21: error: 'k' was not declared in this scope
   37 |         cin >> n >> k;
      |                     ^
a.cc:38:13: error: 'LL' was not declared in this scope
   38 |         for(LL i = 1; i <= n; ++i) {
      |             ^~
a.cc:38:23: error: 'i' was not declared in this scope
   38 |         for(LL i = 1; i <= n; ++i) {
      |                       ^
a.cc:39:24: error: 'a' was not declared in this scope
   39 |                 cin >> a[i], a[i] -= k;
      |                        ^
a.cc:40:17: error: 'sum' was not declared in this scope
   40 |                 sum[i] = sum[i - 1] + a[i];//记录前缀和
      |                 ^~~
a.cc:43:9: error: 'sum' was not declared in this scope
   43 |         sum[n + 1] = 0;
      |         ^~~
a.cc:45:9: error: 'LL' was not declared in this scope
   45 |         LL ans = 0;
      |         ^~
a.cc:46:15: error: expected ';' before 'i'
   46 |         for(LL i = 0; i <= n; ++i) {
      |               ^~
      |               ;
a.cc:46:23: error: 'i' was not declared in this scope
   46 |         for(LL i = 0; i <= n; ++i) {
      |                       ^
a.cc:47:19: error: expected ';' before 'rk'
   47 |                 LL rk = find(a[i]);
      |                   ^~~
      |                   ;
a.cc:48:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   48 |                 ans += query(rk);
      |                 ^~~
      |                 abs
a.cc:48:30: error: 'rk' was not declared in this scope; did you mean 'brk'?
   48 |                 ans += query(rk);
      |                              ^~
      |                              brk
a.cc:48:24: error: 'query' was not declared in this scope
   48 |                 ans += query(rk);
      |                        ^~~~~
a.cc:50:17: error: 'insert' was not declared in this scope; did you mean 'assert'?
   50 |                 insert(rk);//更新要放在查询的后面
      |                 ^~~~~~
      |                 assert
a.cc:52:24: error: 'ans' was not declared in this scope; did you mean 'abs'?
   52 |         printf("%lld", ans);
      |                        ^~~
      |                        abs