Input Format
Four integers  and  each on four separate lines, respectively.
Print the list in lexicographic increasing order.
Hackerrank list comprehensions problem solution in python

Problem solution in python 2 programming language.

a, b, c, n = [int(raw_input()) for _ in xrange(4)]
print [[x,y,z] for x in xrange(a + 1) for y in xrange(b + 1) for z in xrange(c + 1) if x + y + z != n]

Problem solution in python 3 programming language

print(list([i,j,k] for i in range(x+1for j in range(y+1for k in range(z+1)  if i+j+k !=n))