Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

template<class T>
class segTree{
    vector<T> tree;             // 木を示す配列
    int N;                      // 木で保持しているノード数
    T def_val;                  // 範囲外などの時に返却する値
    function<T(T,T)> selector;  // 選択関数(max, min, sum etc...)

    public: 
        // 初期化
        segTree(vector<T> &v, function<T(T,T)> f, T default_val){
            int n = v.size();
            N = pow(2, ceil(log2(n))); 
            tree.resize(2*N-1);
            selector = f;
            def_val = default_val;

            for(int i=0;i<N;i++) tree[N-1+i] = (i>=n?def_val:v[i]);
            for(int i=N-2;i>=0;i--) tree[i] = selector(tree[2*i+1], tree[2*i+2]);
        };

        // 値の更新
        void update(int ind, T val){
            ind += N - 1;
            tree[ind] = val;
            while(ind > 0){
                ind = (ind - 1) / 2;
                tree[ind] = selector(tree[2*ind+1], tree[2*ind+2]);
            }
        };

        // 値の取得(半閉区間[a,b)の範囲)
        T query(int a, int b, int ind = 0, int l = 0, int r = -1){
            if(r < 0) r = N;
            if(r <= a || b <= l) return def_val;
            if(a <= l && r <= b) return tree[ind];
            else return selector(query(a, b, 2*ind+1, l, (l+r)/2), 
                                 query(a, b, 2*ind+2, (l+r)/2, r));
        };
};

int main(){
    ll n, k;
    cin >> n >> k;
    vector<ll> a(n);
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    ll ans = 0;
    segTree<ll> st(a, [](ll x, ll y){return x+y;}, 0);
    for(int i = 0; i < min(a.size(), k); i++){
        for(int j = i+1; j <= min(a.size(), i+k); j++){
            if(j - i == (st.query(i,j)%k))ans ++;
        }
    }
    cout << ans << endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:54:27: error: no matching function for call to 'min(std::vector<long long int>::size_type, ll&)'
   54 |     for(int i = 0; i < min(a.size(), k); i++){
      |                        ~~~^~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:54:27: note:   deduced conflicting types for parameter 'const _Tp' ('long unsigned int' and 'll' {aka 'long long int'})
   54 |     for(int i = 0; i < min(a.size(), k); i++){
      |                        ~~~^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:54:27: note:   mismatched types 'std::initializer_list<_Tp>' and 'long unsigned int'
   54 |     for(int i = 0; i < min(a.size(), k); i++){
      |                        ~~~^~~~~~~~~~~~~
a.cc:55:34: error: no matching function for call to 'min(std::vector<long long int>::size_type, ll)'
   55 |         for(int j = i+1; j <= min(a.size(), i+k); j++){
      |                               ~~~^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:55:34: note:   deduced conflicting types for parameter 'const _Tp' ('long unsigned int' and 'll' {aka 'long long int'})
   55 |         for(int j = i+1; j <= min(a.size(), i+k); j++){
      |                               ~~~^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:55:34: note:   mismatched types 'std::initializer_list<_Tp>' and 'long unsigned int'
   55 |         for(int j = i+1; j <= min(a.size(), i+k); j++){
      |                               ~~~^~~~~~~~~~~~~~~