func_code_string: #include <bits/stdc++.h>   using namespace std;   map<long long, long long> f;   long long n, mm, ret, cur;   long long a[200005], sum[200005];   long long calc(long long m) {     f.clear();     ret = cur = 0;     for (long long i = 0; i < n; i++) {       sum[i + 1] = sum[i] + (a[i] < m ? -1 : 1);       f[sum[i + 1]]++;     }     for (auto it : f)       if (it.first > 0) cur += it.second;     for (long long i = 0; i < n; i++) {       ret += cur;       f[sum[i + 1]]--;       if (sum[i + 1] > sum[i]) cur--;       if (sum[i + 1] > sum[i])         cur -= f[sum[i + 1]];       else         cur += f[sum[i]];     }     return ret;   }   int main() {     ios::sync_with_stdio(false);     vector<long long> v;     cin >> n >> mm;     for (long long i = 0; i < n; i++) cin >> a[i];     cout << calc(mm) - calc(mm + 1);     return 0;   }   