Language: C++

#include <vector>
#include <iostream>
using namespace std;
vector<vector<char>> Sdata;
int H, W, K;

int MaxVerticalBar (int offset, vector<int> RegionEdge, int BarNumber)
{
	int MAX = offset;
	vector<int> Chocolates (BarNumber+1, 0);
	int ChocoEnd = 0;		

	for (MAX = offset; MAX < W; MAX++)
	{
		for (int i = 0; i <= BarNumber; i++)
			for (int i2 = RegionEdge[i]; i2 < RegionEdge [i+1]; i2++)
			{	
				Chocolates [i] += (int) (Sdata [i2] [MAX] - '0');
				if (Chocolates [i] > K)
				{
					if (MAX != 0)
						return MAX-1;
					else
						return 0;
				}
			}
	}
	return MAX;
};

int main(void)
{
    cin >> H >> W >> K;
    Sdata.resize (H);
    for (auto &e: Sdata)
    	e.resize (W);


	for (int i = 0; i < H; i++)
	{
		Sdata [i] = new char [W];
		for (int j = 0; j < W; j++)
			cin >> Sdata[i][j];
	}
	int BarNumber = 0;
	vector<int> RegionEdge (H+1, 0);
	int WorldRecord = H + W;
	for (int UnderBar = 0; UnderBar < (1 << (H-1)); UnderBar++)
	{
		BarNumber = 0;
		for (int i = 0; i < H; i++)
		{
			if (((UnderBar >> i) & 1) != 0)
			{
				RegionEdge [BarNumber+1] = i+1;
				BarNumber++;
			}
		}
		RegionEdge [BarNumber+1] = H;

		if (BarNumber < WorldRecord)
        {
          int answer = BarNumber;
		  for (int offset = 0; offset < W; offset++)
		  {
			  int VerticalBar;
			  VerticalBar = MaxVerticalBar (offset, RegionEdge, BarNumber);
			  if (VerticalBar != W)
			    answer++;
			  if (WorldRecord <= answer)
			    break;
			  offset = VerticalBar;
		  }
		  WorldRecord = answer;
		}
	}
	
	cout << WorldRecord << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:41:40: error: no match for 'operator=' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::vector<char> >, std::vector<char> >::value_type' {aka 'std::vector<char>'} and 'char*')
   41 |                 Sdata [i] = new char [W];
      |                                        ^
In file included from /usr/include/c++/14/vector:72,
                 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 = char; _Alloc = std::allocator<char>]'
  210 |     vector<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/vector.tcc:211:42: note:   no known conversion for argument 1 from 'char*' to 'const std::vector<char>&'
  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 = char; _Alloc = std::allocator<char>]'
  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 'char*' to 'std::vector<char>&&'
  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 = char; _Alloc = std::allocator<char>]'
  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 'char*' to 'std::initializer_list<char>'
  788 |       operator=(initializer_list<value_type> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~