(use util.match)

(define (list-init n func)
  (let loop ([i n])
    (if (zero? i)
      ()
      (cons (func) (loop (- i 1))))))

(define (vector-init n func)
  (define vec (make-vector n))
  (dotimes (i n)
    (vector-set! vec i (func)))
  vec)

(define (collection-init collection size func)
  (cond [(eq? collection <vector>) (vector-init size func)]
        [(eq? collection <list>) (list-init size func)]
        [else "Error"]))

(define-syntax input!
  (syntax-rules (as)
    ((_ (p))
      (define p (input-inner)))
    ((_ (p [as expr-x size-x] [as expr-y size-y]))
      (define p (input-inner [as expr-x size-x] [as expr-y size-y])))
    ((_ (p [as expr size]))
      (define p (input-inner [as expr size])))
    ((_ (p1 ...) (p2 ...) ...)
      (begin 
        (input! (p1 ...))
        (input! (p2 ...) ...)))))

(define-syntax input-inner
  (syntax-rules (as)
    ((_)
     (read))
    ((_ [as expr-x size-x] [as expr-y size-y])
      (collection-init expr-y size-y (lambda () (input-inner [as expr-x size-x]))))
    ((_ [as expr size])
      (collection-init expr size read))))

(define vr vector-ref)
(define vset! vector-set!)
(define (vsetw! vec i v func) (vset! vec i (func (vr vec i) v)))

; -----------------------------------------------

(input! (n) (k) (s))

(define a (make-list k s))

(let loop ([rest (- n k)])
  (if (= 1 rest)
      (display (format "~a " 1))
      (begin 
        (display (format "~a " 0))
        (loop (- rest 1)))))

(let loop ([items a])
  (if (null? items)
      ()
      (begin
        (display (format "~a " (car items)))
        (loop (cdr items)))))