func_code_string: #include <bits/stdc++.h>   using namespace std;   long long const M = 1000000007;   double const pi = acos(-1);   long long const inf = 2e18;   long long const N = 200001;   long long comb(long long n) {     if (n <= 0) return 0;     return (n * (n - 1)) / 2;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     long long i, j, t, n, d, ans = 0, curr, prev = 0;     cin >> n >> d;     vector<long long> a(n);     for (i = 0; i < n; i++) cin >> a[i];     for (curr = 2; curr < n;) {       while (curr < n && a[curr] - a[prev] <= d) {         ans += comb(curr - prev);         curr++;       }       if (a[curr] - a[prev] > d) prev++;     }     cout << ans <<   n ;     return 0;   }   