stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



int main(){

	ios::sync_with_stdio(false);

	cin.tie(0);

	int mx = 55556;

	vector<bool> a(mx);

	fill(a.begin(), a.end(), true);

	a[0] = a[1] = false;

	for(int i = 2; i < mx; i++) {

		if(a[i]) {

			for(int j = i * 2; j < mx; j += i) {

				a[j] = false;

			}

		}

	}

	vector<int> p;

	for(int i = 0; i < a.size(); i++) {

		if(a[i]) {

			p.push_back(i);

		}

	}

	int n;

	cin >> n;

	int cnt = 0;

	for(int i = 0; i < p.size(); i++) {

		if(p[i] % 5 == 1) {

			cout << p[i] << " ";

			cnt++;

		}

		if(cnt == n) {

			cout << endl;

			return 0;

		}

	}

	return 0;	

}


// Faster C++ solution for the same problem (measured speedup: 1.1465527022362698x):
#define _USE_MATH_DEFINES

#include <bits/stdc++.h>

using namespace std;



int main() {

	ios::sync_with_stdio(false);

	cin.tie(0);

	const int max_num = 55556;

	bool prime[max_num];

	fill(prime, prime + max_num, true);

	prime[0] = prime[1] = false;

	for(int i = 0; i < max_num; i++) {

		if(prime[i]) {

			for(int j = i * 2; j < max_num; j += i) {

				prime[j] = false;

			}

		}

	}

	int n;

	cin >> n;

	for(int i = 0; i < max_num; i++) {

		if(prime[i] && i % 5 == 1) {

			if(i != 11) cout << " ";

			cout << i;

			n--;

		}

		if(n == 0) {

			cout << endl;

			return 0;

		}

	}

	return 0;	

}
// Slower C++ solution:
#include<bits/stdc++.h>

#define MAXN 95555

using namespace std;



vector<int> Prime;

int flag[MAXN];

void siv() {

  Prime.push_back(2);

  for(int i = 4 ; i <= MAXN ; i += 2) flag[i] = 1;

  for(int i = 3 ; i * i <= MAXN ; i += 2) {

    if(!flag[i]) {

      for(int j = i * i , k = (i * 2) ; j <= MAXN ; j += k) {

        flag[j] = 1;

      }

    }

  }

  for(int i = 3 ; i < MAXN ; i += 2) {

    if(!flag[i]) {

      Prime.push_back(i);

    }

  }

}



int main()

{

  siv();

  int n;

  cin >> n;

  for(int i = 0 , ans = 0 ; i < Prime.size() && ans != n ; i++) {

    if(Prime[i] % 5 == 1) ans++ , printf("%d ", Prime[i]);

    //if(Prime[i] % 5 == 2) ans++ , printf("%d ", Prime[i]);

    //if(Prime[i] % 5 == 3) ans++ , printf("%d ", Prime[i]);

    //if(Prime[i] % 5 == 4) ans++ , printf("%d ", Prime[i]);

  }

}


// Faster C++ solution for the same problem (measured speedup: 2.5725563474588604x):
#include<stdio.h>

#include<algorithm>

#define maxn 200005

#define inf 0x3f3f3f3f

using namespace std;

typedef long int ll;

bool prime[60000];

int ans[60000], p;

int main()

{

    for (int i = 2; i < 60000; ++i){

        if (!prime[i]) for (int j = 2; j * i < 60000; ++j) prime[j * i] = 1;

    }

    int n;

    scanf("%d", &n);

    for (int i = 2; i <= 55555; ++i) if (!prime[i] && i % 5 == 1) ans[++p] = i;

    for (int i = 1; i < n; ++i) printf("%d ", ans[i]);

    printf("%d\n", ans[n]);

    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

#define MAXN 95555

using namespace std;



vector<int> Prime;

int flag[MAXN];

void siv() {

  Prime.push_back(2);

  for(int i = 4 ; i <= MAXN ; i += 2) flag[i] = 1;

  for(int i = 3 ; i * i <= MAXN ; i += 2) {

    if(!flag[i]) {

      for(int j = i * i , k = (i * 2) ; j <= MAXN ; j += k) {

        flag[j] = 1;

      }

    }

  }

  for(int i = 3 ; i < MAXN ; i += 2) {

    if(!flag[i]) {

      Prime.push_back(i);

    }

  }

}



int main()

{

  siv();

  int n;

  cin >> n;

  for(int i = 0 , ans = 0 ; i < Prime.size() && ans != n ; i++) {

    if(Prime[i] % 5 == 1) ans++ , printf("%d ", Prime[i]);

    //if(Prime[i] % 5 == 2) ans++ , printf("%d ", Prime[i]);

    //if(Prime[i] % 5 == 3) ans++ , printf("%d ", Prime[i]);

    //if(Prime[i] % 5 == 4) ans++ , printf("%d ", Prime[i]);

  }

}


// Faster C++ solution for the same problem (measured speedup: 1.9447541219309201x):
#include<iostream>

#include<algorithm>

#include <cstring>

using namespace std;

bool judge(int n)

{

    for (int i=2;i*i<=n;i++)

        if (n%i==0) return false;

        return true;

}

int main ()

{    int n;

     cin>>n;

    for (int i=11;;i=i+10)

    {

        if (judge(i))

        {

            cout<<i<<" ";

            n--;

        }

        if (n==0) {cout<<endl;break;}

    }

    return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

typedef pair<int, int> P;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

#define all(x) (x).begin(),(x).end()

template <class T> inline bool chmin(T &a, T b) {if (a > b){a = b;return true;}return false;}

template <class T> inline bool chmax(T &a, T b) {if (a < b){a = b;return true;}return false;}



vector<int> sieve(int n){

    vector<bool> is_prime(n+1, true);

    vector<int> p;

    for(int i=2; i<=n; i++){

        if(is_prime[i]) {

            for(int j=2*i; j<=n; j+=i){

                is_prime[j] = false;

            }

            p.emplace_back(i);

        }

    }

    return p;

}



int main(){

    cin.tie(0);

    ios::sync_with_stdio(false);

    int n; cin>>n;

    vector<int> p = sieve(55555);

    int cnt = 0;

    for(auto a : p){

        if(a % 5 == 1){

            cout<<a<<" ";

            cnt++;

        }

        if(cnt == n) break;

    }

    cout<<endl;

    return 0;

}

// abc096_d

// Faster C++ solution for the same problem (measured speedup: 1.4218905754540865x):
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

typedef pair<int, int> P;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

#define all(x) (x).begin(),(x).end()

template <class T> inline bool chmin(T &a, T b) {if (a > b){a = b;return true;}return false;}

template <class T> inline bool chmax(T &a, T b) {if (a < b){a = b;return true;}return false;}



bool isPrime(int x){

    int i;

    if(x < 2)return 0;

    else if(x == 2) return 1;

    if(x%2 == 0) return 0;

    for(i = 3; i*i <= x; i += 2) if(x%i == 0) return 0;

    return 1;

}



int main(){

    cin.tie(0);

    ios::sync_with_stdio(false);

    int n; cin>>n;

    int cnt = 0;

    for(int i=1; i<= 55555; i++){

        if(isPrime(i) && i%5==1){

            cout<<i<<" ";

            cnt++;

        } 

        if(cnt==n) break;

    }

    cout<<endl;

    return 0;

}

// abc096_d
// Slower C++ solution:
#include<cstdio>

#include<cstring>

#include<algorithm>

#include<map>

using namespace std;



const int MAXN=200005;



int n,k;

long long a[MAXN],s[MAXN],b[MAXN];

map<long long,int> mp;



int lowbit(int x)

{

    return (x&-x);

}



void modify(int x,int num)

{

    while(x<=n+1){

        a[x]+=(long long)num;

        x+=lowbit(x);

    }

}



long long sum(int x)

{

    long long ans=0;

    while(x>0){

        ans+=a[x];

        x-=lowbit(x);

    }

    return ans;

}



int main()

{

    scanf("%d %d",&n,&k);

    s[0]=0;b[0]=0;

    for(int i=1;i<=n;i++){

        int x;

        scanf("%d",&x);

        s[i]=s[i-1]+(long long)(x-k);

        b[i]=s[i];

    }

    sort(b,b+1+n);

    int tot=0;

    for(int i=0;i<=n;i++)

        if(!mp.count(b[i]))mp[b[i]]=++tot;

    long long cnt=0;

    memset(a,0,sizeof(a));

    for(int i=0;i<=n;i++){

        cnt+=sum(mp[s[i]]);

        modify(mp[s[i]],1);

    }

    printf("%lld\n",cnt);

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 2.51856443052015x):
#include <bits/stdc++.h>



using namespace std;



const int maxn = 2e5 + 10;



typedef long long ll;



ll p[maxn];

ll a[maxn],b[maxn];

map<ll,int> m;

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



ll sum(ll x) {

    ll res = 0;

    while (x > 0) {

        res += p[x];

        x -= lowbit(x);

    }

    return res;

}



void add(ll x) {

    while (x < maxn) {

        p[x]++;

        x += lowbit(x);

    }

}



int main() {

    int n,k; cin>>n>>k;

    for (int i = 1; i <= n; i++) {

        cin>>a[i];

        a[i] += a[i - 1] - k;

        b[i] = a[i];

    }

    sort(b, b + n + 1);

    int len = 1;

    for (int i = 0; i <= n; i++) {

        if (m[b[i]]) continue;

        m[b[i]] = len++;

    }

    ll res = 0;

    for (int i = 0; i <= n; i++) {

        ll t = m[a[i]];

        res += sum(t);

        add(t);

    }

    cout<<res<<endl;





    return 0;

}
// Slower C++ solution:
#include <iostream>

#include<stdio.h>

#include<string.h>

#include<math.h>

#include<queue>

#include<algorithm>

#define N 200500

#define LL long long

#define mem(a,b) memset(a,b,sizeof(a));

using namespace std;

LL sum[N],t[N];

LL tree[N];

int n,k,a,m,nn;

void add(int x)

{

    while(x<=nn)

    {

        tree[x]++;

        x+=x&-x;

    }

}

LL query(int x)

{

    LL num=0;

    while(x)

    {

        num+=tree[x];

        x-=x&-x;

    }

    return num;

}

int main()

{

    mem(t,0);

    mem(tree,0);

    mem(sum,0);

    scanf("%d%d",&n,&k);

    nn=n+10;

    for(int i=1; i<=n; i++)

    {

        scanf("%d",&a);

        t[i]=sum[i]=sum[i-1]+a-k;

    }

    sort(t,t+n+1);

    m=unique(t,t+n+1)-t;

    for(int i=0; i<=n; i++)

        sum[i]=lower_bound(t,t+m+1,sum[i])-t+1;

    LL ans=0;

    for(int i=0;i<=n;i++)

    {

        ans+=query(sum[i]);

        add(sum[i]);

    }

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

}


// Faster C++ solution for the same problem (measured speedup: 5.884345232379747x):
#include <bits/stdc++.h>



using namespace std;



const int maxn = 2e5 + 10;



typedef long long ll;



ll p[maxn];

ll a[maxn],b[maxn];

map<ll,int> m;

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



ll sum(ll x) {

    ll res = 0;

    while (x > 0) {

        res += p[x];

        x -= lowbit(x);

    }

    return res;

}



void add(ll x) {

    while (x < maxn) {

        p[x]++;

        x += lowbit(x);

    }

}



int main() {

    int n,k; cin>>n>>k;

    for (int i = 1; i <= n; i++) {

        cin>>a[i];

        a[i] += a[i - 1] - k;

        b[i] = a[i];

    }

    sort(b, b + n + 1);

    int len = 1;

    for (int i = 0; i <= n; i++) {

        if (m[b[i]]) continue;

        m[b[i]] = len++;

    }

    ll res = 0;

    for (int i = 0; i <= n; i++) {

        ll t = m[a[i]];

        res += sum(t);

        add(t);

    }

    cout<<res<<endl;





    return 0;

}
// Slower C++ solution:
#include<cstdio>

#include<cstring>

#include<algorithm>

#include<map>

using namespace std;



const int MAXN=200005;



int n,k;

long long a[MAXN],s[MAXN],b[MAXN];

map<long long,int> mp;



int lowbit(int x)

{

    return (x&-x);

}



void modify(int x,int num)

{

    while(x<=n+1){

        a[x]+=(long long)num;

        x+=lowbit(x);

    }

}



long long sum(int x)

{

    long long ans=0;

    while(x>0){

        ans+=a[x];

        x-=lowbit(x);

    }

    return ans;

}



int main()

{

    scanf("%d %d",&n,&k);

    s[0]=0;b[0]=0;

    for(int i=1;i<=n;i++){

        int x;

        scanf("%d",&x);

        s[i]=s[i-1]+(long long)(x-k);

        b[i]=s[i];

    }

    sort(b,b+1+n);

    int tot=0;

    for(int i=0;i<=n;i++)

        if(!mp.count(b[i]))mp[b[i]]=++tot;

    long long cnt=0;

    memset(a,0,sizeof(a));

    for(int i=0;i<=n;i++){

        cnt+=sum(mp[s[i]]);

        modify(mp[s[i]],1);

    }

    printf("%lld\n",cnt);

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 2.4996360825460773x):
    #include<bits/stdc++.h>



    using namespace std;



    const int maxn = 2e5+111;



    long long c[maxn];

    long long s[maxn];

    long long lowbit(long long x)

    {

        return x & -x;

    }



    long long sum(long long x)

    {

        long long res = 0;

        while(x>0)

        {

            res += c[x];

            x -= lowbit(x);

        }

        return res;

    }



    void add(long long x,long long v)

    {

        while(x<maxn)

        {

            c[x] += v;

            x += lowbit(x);

        }

    }



    int main()

    {

        long long n,k;

        cin>>n>>k;

        long long x;

        vector<long long> v;

        for(int i =1;i<=n;i++)

        {

            scanf("%lld",&x);

            x -= k;

            s[i] = s[i-1] + x;

            //v.push_back(s[i]);

        }

        for(int i =0;i<=n;i++)

        v.push_back(s[i]);

        sort(v.begin(),v.end());

        v.resize(unique(v.begin(),v.end()) - v.begin());

        for(int i = 0;i<=n;i++)

            s[i] = lower_bound(v.begin(),v.end(),s[i])-v.begin()+1;

        long long ans = 0;

        for(int i = 0;i<=n;i++)

            {ans += sum(s[i]);

            add(s[i],1);}

        cout<<ans<<endl;

    }
// Slower C++ solution:
#include <iostream>

#include<stdio.h>

#include<string.h>

#include<math.h>

#include<queue>

#include<algorithm>

#define N 200500

#define LL long long

#define mem(a,b) memset(a,b,sizeof(a));

using namespace std;

LL sum[N],t[N];

LL tree[N];

int n,k,a,m,nn;

void add(int x)

{

    while(x<=nn)

    {

        tree[x]++;

        x+=x&-x;

    }

}

LL query(int x)

{

    LL num=0;

    while(x)

    {

        num+=tree[x];

        x-=x&-x;

    }

    return num;

}

int main()

{

    mem(t,0);

    mem(tree,0);

    mem(sum,0);

    scanf("%d%d",&n,&k);

    nn=n+10;

    for(int i=1; i<=n; i++)

    {

        scanf("%d",&a);

        t[i]=sum[i]=sum[i-1]+a-k;

    }

    sort(t,t+n+1);

    m=unique(t,t+n+1)-t;

    for(int i=0; i<=n; i++)

        sum[i]=lower_bound(t,t+m+1,sum[i])-t+1;

    LL ans=0;

    for(int i=0;i<=n;i++)

    {

        ans+=query(sum[i]);

        add(sum[i]);

    }

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

}


// Faster C++ solution for the same problem (measured speedup: 5.840121255892056x):
    #include<bits/stdc++.h>



    using namespace std;



    const int maxn = 2e5+111;



    long long c[maxn];

    long long s[maxn];

    long long lowbit(long long x)

    {

        return x & -x;

    }



    long long sum(long long x)

    {

        long long res = 0;

        while(x>0)

        {

            res += c[x];

            x -= lowbit(x);

        }

        return res;

    }



    void add(long long x,long long v)

    {

        while(x<maxn)

        {

            c[x] += v;

            x += lowbit(x);

        }

    }



    int main()

    {

        long long n,k;

        cin>>n>>k;

        long long x;

        vector<long long> v;

        for(int i =1;i<=n;i++)

        {

            scanf("%lld",&x);

            x -= k;

            s[i] = s[i-1] + x;

            //v.push_back(s[i]);

        }

        for(int i =0;i<=n;i++)

        v.push_back(s[i]);

        sort(v.begin(),v.end());

        v.resize(unique(v.begin(),v.end()) - v.begin());

        for(int i = 0;i<=n;i++)

            s[i] = lower_bound(v.begin(),v.end(),s[i])-v.begin()+1;

        long long ans = 0;

        for(int i = 0;i<=n;i++)

            {ans += sum(s[i]);

            add(s[i],1);}

        cout<<ans<<endl;

    }
// Slower C++ solution:
#include<cstdio>

#include<cstring>

#include<algorithm>

#include<map>

using namespace std;



const int MAXN=200005;



int n,k;

long long a[MAXN],s[MAXN],b[MAXN];

map<long long,int> mp;



int lowbit(int x)

{

    return (x&-x);

}



void modify(int x,int num)

{

    while(x<=n+1){

        a[x]+=(long long)num;

        x+=lowbit(x);

    }

}



long long sum(int x)

{

    long long ans=0;

    while(x>0){

        ans+=a[x];

        x-=lowbit(x);

    }

    return ans;

}



int main()

{

    scanf("%d %d",&n,&k);

    s[0]=0;b[0]=0;

    for(int i=1;i<=n;i++){

        int x;

        scanf("%d",&x);

        s[i]=s[i-1]+(long long)(x-k);

        b[i]=s[i];

    }

    sort(b,b+1+n);

    int tot=0;

    for(int i=0;i<=n;i++)

        if(!mp.count(b[i]))mp[b[i]]=++tot;

    long long cnt=0;

    memset(a,0,sizeof(a));

    for(int i=0;i<=n;i++){

        cnt+=sum(mp[s[i]]);

        modify(mp[s[i]],1);

    }

    printf("%lld\n",cnt);

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 2.4706372288446308x):
#include <bits/stdc++.h>

#define N 200001

using namespace std;



typedef unsigned ui;

typedef long long ll;

typedef unsigned long long ul;



ll a[N], s[N];



ui st[1 << 19], m;

void modify(ui w) {

	w += m;

	do st[w]++; while (w >>= 1);

}



ui query(ui l, ui r) {

	ui res = 0;

	for (l += m - 1, r += m + 1; l ^ r ^ 1; l >>= 1, r >>= 1) {

		if (~l & 1) res += st[l ^ 1];

		if (r & 1) res += st[r ^ 1];

	}

	return res;

}



int main(void) {

	ios::sync_with_stdio(0); cin.tie(0);

#ifdef _DEBUG

	ifstream cin("1.in");

#endif

	ui n; ll k; cin >> n >> k;

	for (ui i = 1; i <= n; ++i) cin >> a[i];

	for (ui i = 1; i <= n; ++i) s[i] = a[i] + s[i - 1];

	for (ui i = 1; i <= n; ++i) a[i] = s[i] - k * i;

	vector<ll> sv; sv.push_back(0);

	for (ui i = 1; i <= n; ++i) sv.push_back(a[i]);

	sort(sv.begin(), sv.end()); sv.erase(unique(sv.begin(), sv.end()), sv.end());

	for (m = 1; m <= sv.size() + 2; m <<= 1);

	ul ans = 0;

	modify(lower_bound(sv.begin(), sv.end(), 0) - sv.begin() + 1);

	for (ui i = 1; i <= n; ++i) {

		ui w = lower_bound(sv.begin(), sv.end(), a[i]) - sv.begin() + 1;

		ans += query(1, w);

		modify(w);

	}

	cout << ans << endl;

	return 0;

}
// Slower C++ solution:
#include <iostream>

#include<stdio.h>

#include<string.h>

#include<math.h>

#include<queue>

#include<algorithm>

#define N 200500

#define LL long long

#define mem(a,b) memset(a,b,sizeof(a));

using namespace std;

LL sum[N],t[N];

LL tree[N];

int n,k,a,m,nn;

void add(int x)

{

    while(x<=nn)

    {

        tree[x]++;

        x+=x&-x;

    }

}

LL query(int x)

{

    LL num=0;

    while(x)

    {

        num+=tree[x];

        x-=x&-x;

    }

    return num;

}

int main()

{

    mem(t,0);

    mem(tree,0);

    mem(sum,0);

    scanf("%d%d",&n,&k);

    nn=n+10;

    for(int i=1; i<=n; i++)

    {

        scanf("%d",&a);

        t[i]=sum[i]=sum[i-1]+a-k;

    }

    sort(t,t+n+1);

    m=unique(t,t+n+1)-t;

    for(int i=0; i<=n; i++)

        sum[i]=lower_bound(t,t+m+1,sum[i])-t+1;

    LL ans=0;

    for(int i=0;i<=n;i++)

    {

        ans+=query(sum[i]);

        add(sum[i]);

    }

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

}


// Faster C++ solution for the same problem (measured speedup: 5.772368664592517x):
#include <bits/stdc++.h>

#define N 200001

using namespace std;



typedef unsigned ui;

typedef long long ll;

typedef unsigned long long ul;



ll a[N], s[N];



ui st[1 << 19], m;

void modify(ui w) {

	w += m;

	do st[w]++; while (w >>= 1);

}



ui query(ui l, ui r) {

	ui res = 0;

	for (l += m - 1, r += m + 1; l ^ r ^ 1; l >>= 1, r >>= 1) {

		if (~l & 1) res += st[l ^ 1];

		if (r & 1) res += st[r ^ 1];

	}

	return res;

}



int main(void) {

	ios::sync_with_stdio(0); cin.tie(0);

#ifdef _DEBUG

	ifstream cin("1.in");

#endif

	ui n; ll k; cin >> n >> k;

	for (ui i = 1; i <= n; ++i) cin >> a[i];

	for (ui i = 1; i <= n; ++i) s[i] = a[i] + s[i - 1];

	for (ui i = 1; i <= n; ++i) a[i] = s[i] - k * i;

	vector<ll> sv; sv.push_back(0);

	for (ui i = 1; i <= n; ++i) sv.push_back(a[i]);

	sort(sv.begin(), sv.end()); sv.erase(unique(sv.begin(), sv.end()), sv.end());

	for (m = 1; m <= sv.size() + 2; m <<= 1);

	ul ans = 0;

	modify(lower_bound(sv.begin(), sv.end(), 0) - sv.begin() + 1);

	for (ui i = 1; i <= n; ++i) {

		ui w = lower_bound(sv.begin(), sv.end(), a[i]) - sv.begin() + 1;

		ans += query(1, w);

		modify(w);

	}

	cout << ans << endl;

	return 0;

}
// Slower C++ solution:
#include<cstdio>

#include<cstring>

#include<algorithm>

#include<map>

using namespace std;



const int MAXN=200005;



int n,k;

long long a[MAXN],s[MAXN],b[MAXN];

map<long long,int> mp;



int lowbit(int x)

{

    return (x&-x);

}



void modify(int x,int num)

{

    while(x<=n+1){

        a[x]+=(long long)num;

        x+=lowbit(x);

    }

}



long long sum(int x)

{

    long long ans=0;

    while(x>0){

        ans+=a[x];

        x-=lowbit(x);

    }

    return ans;

}



int main()

{

    scanf("%d %d",&n,&k);

    s[0]=0;b[0]=0;

    for(int i=1;i<=n;i++){

        int x;

        scanf("%d",&x);

        s[i]=s[i-1]+(long long)(x-k);

        b[i]=s[i];

    }

    sort(b,b+1+n);

    int tot=0;

    for(int i=0;i<=n;i++)

        if(!mp.count(b[i]))mp[b[i]]=++tot;

    long long cnt=0;

    memset(a,0,sizeof(a));

    for(int i=0;i<=n;i++){

        cnt+=sum(mp[s[i]]);

        modify(mp[s[i]],1);

    }

    printf("%lld\n",cnt);

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 2.531914811431824x):
#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 arr[200010];

int main()  

{  

	scanf("%lld%lld",&n,&k);

	Length=n+1;

	for(int i=1;i<=n;++i)

		arr[i]=scan()-k;

	for(int i=2;i<=n;++i)

		arr[i]=arr[i-1]+arr[i]; 

	seq[1].data=0;

	seq[1].pos=1;

    for(int i=1;i<=n;i++)  

    {  

        seq[i+1].data=-arr[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;  

}