#[allow(unused_imports)] use { itertools::Itertools, proconio::{fastout, input, marker::Chars}, std::{ cmp::Reverse, collections::{BinaryHeap, HashMap, HashSet, VecDeque}, convert::TryInto, io::{self, stdout, BufWriter, Write}, }, }; #[fastout] fn main() { let out = stdout(); let mut out = BufWriter::new(out.lock()); input! {h: usize, w: usize, mtx: [[u32; w];h]} let mut max = 0; for bit in 1..(1 << h) { let mut hvec: Vec = Vec::new(); for hh in 0..h as u32 { let mask = 1 << hh; if mask & bit != 0 { hvec.push(hh); } } let mut fst = 0; let mut tmp = 0; for wid in 0..w { let mut flg = true; for (i, v) in hvec.iter().enumerate() { if wid == 0 && i == 0 { fst = mtx[*v as usize][wid]; continue; } if fst != mtx[*v as usize][wid] { flg = false; } } if flg { tmp += hvec.len(); } } println!("max: {}, hvec: {:?}, fst: {}", max, hvec, fst); max = max.max(tmp); } //let max = if max > 0 { max } else { 1 }; writeln!(out, "{}", max).unwrap(); }