You can clone with
-- Should be in some library
blockBy _  = 
blockBy n xs = ys : blockBy n zs where (ys, zs) = splitAt n xs
main = interact $
zipWith (printf "Case #%d: %.0f") [1::Int ..] .
map (\ [[r,k,_], xs] -> solve r k xs) .
blockBy 2 .
map (map read . words) .
solve rounds seats xs = loop 0 rounds maxGroup seats (cycle xs)
where maxGroup = length xs
loop :: Double -> Int -> Int -> Int -> [Int] -> Double
loop t 0 _ _ _ = t
loop t r 0 _ q = loop t (r-1) maxGroup seats q
loop !t !r !g !k (x:q) | x <= k = loop (t+fromIntegral x) r (g-1) (k-x) q
| otherwise = loop t (r-1) maxGroup seats (x:q)