def sol s,e,a,k,d if k == 0 if d == 0 return a else return nil end else if d < (s * 2 + k - 1) * k / 2 || d > (e * 2 - k + 1) * k / 2 return nil else s.upto(e){|i| a.push(i) tmp = sol(i + 1,e,a,k - 1,d - i) if tmp return tmp end a.pop } return nil end end end n,d,k = gets.split.map(&:to_i) if d < k * (k + 1) / 2 || d > (n * 2 - k + 1) * k / 2 p -1 else tmp = sol(1,n,[],k,d) if tmp puts tmp.join(' ') else p -1 end end