func_code_string: #include <bits/stdc++.h>   #pragma comment(linker,  /STACK:667772160 )   using namespace std;   struct __isoff {     __isoff() {       if (0) freopen( input.txt ,  r , stdin), freopen( output.txt ,  w , stdout);       srand(time(0));     }     ~__isoff() {}   } __osafwf;   const unsigned long long p1 = 31;   const unsigned long long p2 = 29;   const double eps = 1e-8;   const double pi = acos(-1.0);   const long long inf = 1e18 + 7;   const int infi = 1e9 + 7;   const long long dd = 1e6 + 70;   const long long mod = 1e9 + 7;   int n, k;   vector<int> P[dd];   vector<int> T(1);   vector<pair<int, int> > Z;   bool Bs[dd];   int get(int l, int r, int x) {     return upper_bound(P[x].begin(), P[x].end(), r) -            lower_bound(P[x].begin(), P[x].end(), l);   }   set<int> Q, W;   int main() {     cin >> n >> k;     long long s = 0;     P[0].push_back(0);     for (long long i = 0; i < (long long)n; i++) {       int t;       scanf( %d , &t);       Z.push_back(make_pair(-t, i));       s = (s + t) % k;       T.push_back(s);       P[s].push_back(i + 1);     }     sort(Z.begin(), Z.end());     Bs[0] = Bs[n] = 1;     long long res = 0;     Q.insert(-1);     Q.insert(n);     W.insert(1);     W.insert(-n);     for (long long i = 0; i < (long long)n; i++) {       int t = Z[i].second;       int r = *Q.lower_bound(t);       int l = -(*W.lower_bound(-t));       if (t - l < r - t) {         for (int j = l + 1; j <= t; j++) {           int z = max(j + 2, t + 1);           int ts = (T[j] - Z[i].first) % k;           int tt = get(z, r, ts);           res += tt;         }       } else {         for (int j = t + 1; j <= r; j++) {           int z = min(j - 2, t);           int ts = ((T[j] + Z[i].first) % k + k) % k;           int tt = get(l + 1, z, ts);           res += tt;         }       }       Q.insert(t);       W.insert(-t);     }     cout << res;   }   