• + 1 comment

    Haskell recursive solution

    f :: Int -> [Int] -> [Int]
    f n [] = []
    f n (x:arr) 
        | x<n = x : f n arr
        | otherwise = f n arr
    
    -- The Input/Output section. You do not need to change or modify this part
    main = do 
        n <- readLn :: IO Int 
        inputdata <- getContents 
        let 
            numbers = map read (lines inputdata) :: [Int] 
        putStrLn . unlines $ (map show . f n) numbers