# frozen_string_literal: true 3.times.map { gets } in [_, a, b] [a, b].map { _1.split.map(&:to_i) } in [a, b] [a.sort, b.sort { _2 <=> _1 }].transpose.group_by { _1 > _2 ? :win : :lose } in results puts results.key?(:win) ? (results[:win].map(&:first).permutation.to_a.length * results[:lose].map(&:first).permutation.to_a.length) : results[:lose].map(&:first).permutation.to_a.length