for(int col = 0; col < cells.shape()[0]; col++) {
int max_w = 0;
for(int row = 0; row < cells.shape()[1]; row++) {
...
for(int col = 0; col < cells.shape()[0]; col++) {
int max_w = 0;
for(int row = 0; row < cells.shape()[1]; row++) {
...
maybe can use std algos lik...