1 2 3 4 5 6 7 8 9 10 11 12
#!/usr/bin/env ruby W = 25 T = 6 input = $stdin.readlines[0].strip.chars.map(&:to_i) layers = input.each_slice(W * T).to_a zeroest = layers.sort{ |a,b| a.count(0) <=> b.count(0) }.first puts zeroest.count(1) * zeroest.count(2)