output_description: Print the number of minimum times the bar needs to be cut so that every block
  after the cuts has K or less white squares.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      H W K
      S_{1,1}S_{1,2}...S_{1,W}
      :
      S_{H,1}S_{H,2}...S_{H,W}
attempt: import numpy as np
  
  
  def str_to_array(rows):
      array = []
      for row in rows:
          col_array = []
          array.append(col_array)
          for column in row:
              col_array.append(int(column))
      return np.array(array)
  
  
  H, W, K = (int(n) for n in input().split(" "))
  rows = []
  for i in range(H):
      rows.append(input())
  choco = str_to_array(rows)
  
  cuts = 0
  
  while np.sum(choco) > K:
      cuts += 1
      min_diff = H * W
      choco_left = None
      for i in range(1, H - 1):
          top = choco[:i]
          bot = choco[i:]
          top_sum = np.sum(top)
          bot_sum = np.sum(bot)
          diff = np.abs(top_sum - bot_sum)
          if diff < min_diff:
              if top_sum <= K:
                  choco_left = bot
                  min_diff = diff
              elif bot_sum <= K:
                  choco_left = top
                  min_diff = diff
      for i in range(1, W - 1):
          left = choco[:, :i]
          right = choco[:, i:]
          left_sum = np.sum(left)
          right_sum = np.sum(right)
          diff = np.abs(left_sum - right_sum)
          if diff < min_diff:
              if left_sum <= K:
                  choco_left = right
                  min_diff = diff
              elif right_sum <= K:
                  choco_left = left
                  min_diff = diff
      choco = choco_left
  
  print(cuts)
  
problem_description: Statement
  
  We have a chocolate bar partitioned into H horizontal rows and W vertical
  columns of squares.
  
  The square (i, j) at the i-th row from the top and the j-th column from the
  left is dark if S_{i,j} is `0`, and white if S_{i,j} is `1`.
  
  We will cut the bar some number of times to divide it into some number of
  blocks. In each cut, we cut the whole bar by a line running along some
  boundaries of squares from end to end of the bar.
  
  How many times do we need to cut the bar so that every block after the cuts
  has K or less white squares?
samples: [{"input": "3 5 4\n    11100\n    10001\n    00111", "output": "2\n    \n\nFor example, cutting between the 1-st and 2-nd rows and between the 3-rd and\n4-th columns - as shown in the figure to the left - works.\n\nNote that we cannot cut the bar in the ways shown in the two figures to the\nright.\n\n![Figure](https://img.atcoder.jp/ghi/ac90dd542639c04402125403b1c319d7.png)\n\n* * *"}, {"input": "3 5 8\n    11100\n    10001\n    00111", "output": "0\n    \n\nNo cut is needed.\n\n* * *"}, {"input": "4 10 4\n    1110010010\n    1000101110\n    0011101001\n    1101000111", "output": "3"}]