object Solution {

  def main(args: Array[String]) {
    val Array(n, m) = readLine.split(" ").map(_.toInt)
    val nums = (1 to n).map(_ => BigInt(readLine, 2))
    nums.combinations(2).map( { case Array(x, y) =>
      (x ^ y).bitCount
    } )
  }
}

object Solution {

  def main(args: Array[String]) {
    val Array(n, m) = readLine.split(" ").map(_.toInt)
    val nums = (1 to n).map(_ => BigInt(readLine, 2))
    val counts = nums.combinations(2).map( { case Vector(x, y) =>
      (x | y).bitCount
    } ).toList
    val maxCount = counts.max
    val maxCountC = counts.filter(_ == maxCount).size
    println(maxCount)
    println(maxCountC)
  }
}

Add solution to problem ACM ICPC Team. It uses combinations, and the running time is about 2.5xS, which is not good, consider the input n is less than or equal 500.
Add solution to problem ACM ICPC Team. It uses combinations, and the running
time is about 2.5xS, which is not good, consider the input n is less than or
equal 500.
