Tetris by Magnus Jonsson

import List
main=interact$unlines.c.x.f.x.lines
x=transpose
f n=p(snd.m(minimum$p(fst.m 0)n))n
m s n|l b>3=(99,n)|1<2=(l f,take s e++b++d++drop s e)where(b,c)=k '#'n;(d,e)=k ' 'c;(f,g)=k '#'e
l=length
k=span.(/=)
r=filter
e=elem ' '
p=map
c l=p(\_->' ')`p`r(not.e)l++e`r`l

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return top