a little clearer than previous one.

  hash = Hash[*hash.inject([]){|arr, (k, v)|
                               arr += Array === k ? k.zip([v]* k.size)
: [k, v]
                             }.flatten]