Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
const int INF =1001001001;

int main(void) 
{
    int h, w, k;
    cin >> h >> w >> k;
    vector<string> s(h);
    rep(i, h) cin >> s[i];
    int ans = INF;
    //最大数配列確保
    int c[10][1005];

    // 1 << h-1 = 2^(h-1)
    //線を引くor引かないの２通り
    rep(div, 1 << h-1)
    {
         //2進数でビットが立っているところで分ける(div)
        int group =0;
        vector<int> id[h];
        rep(i,h)
        {
            id[i] = group;
            //シフトして１(線を引く)なら次からのグループをインクリする
            if(div >> i&1) group++;
        }
        //グループ数を表す為にインクリ
        group++;

        //縦グループ数分、横全て初期化
        rep(i,group)rep(j,w) c[i][j] = 0;
        rep(i,h)rep(j,w) c[id[i]][j] += (s[i][j] -'0');
        bool ok = true;
        rep(i,group)rep(j,w) if(c[i][j] > k) ok = false;
        if(!ok) continue;
        
        //縦に切っていく
        int num = group - 1;
        vector<int> now(group);
        auto add = [&](int j)
        {
            rep(i,group) now[i] += c[i][j];
            rep(i,group) if(now[i] > k) return false;
            
            return true;
        };
        rep(j,w)
        {
            if(!add(j))
            {
                num++;
                now = vector<int>(group);
                add(j);                
            }         
        }
        ans = min(ans, num);
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:21: error: no match for 'operator=' (operand types are 'std::vector<int>' and 'int')
   26 |             id[i] = group;
      |                     ^~~~~
In file included from /usr/include/c++/14/vector:72,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/vector.tcc:210:5: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>]'
  210 |     vector<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/vector.tcc:211:42: note:   no known conversion for argument 1 from 'int' to 'const std::vector<int>&'
  211 |     operator=(const vector<_Tp, _Alloc>& __x)
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/14/vector:66:
/usr/include/c++/14/bits/stl_vector.h:766:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = int; _Alloc = std::allocator<int>]'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:766:26: note:   no known conversion for argument 1 from 'int' to 'std::vector<int>&&'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |                 ~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:788:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = int; _Alloc = std::allocator<int>]'
  788 |       operator=(initializer_list<value_type> __l)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:788:46: note:   no known conversion for argument 1 from 'int' to 'std::initializer_list<int>'
  788 |       operator=(initializer_list<value_type> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
a.cc:35:27: error: no match for 'operator[]' (operand types are 'int [10][1005]' and 'std::vector<int>')
   35 |         rep(i,h)rep(j,w) c[id[i]][j] += (s[i][j] -'0');
      |                           ^