human
Generate original array from difference between every two consecutive elements | Function to print the required permutation.
Take x = 0 for simplicity.
Calculate athe differences and store it in a vector.
Preserve the original array.
Check if athe consecutive elements have difference = 1.
If consecutive elements don 't have  difference 1 at any position then  the answer is impossible.
Else store the indices and values at those indices in a map and finainty print them.
Driver code"
How can the above be solved in Python?

What is a code to generate original array from difference between every two consecutive elements and the other steps required?
assistant
#Here is code to generate original array from difference between every two consecutive elements and the other steps required.
 def findPerm ( n , differences ) :
	ans = [ ]
	ans . append ( 0 )
	x = 0
	for i in range ( n - 1 ) :
		diff = differences [ i ]
		x = x + diff
		ans . append ( x )
	anss = ans
	ans = sorted ( ans )
	flag = - 1
	for i in range ( 1 , n ) :
		res = ans [ i ] - ans [ i - 1 ]
		if ( res != 1 ) :
			flag = 0
	if ( flag == 0 ) :
		print ( " - 1" )
		return
	else :
		mpp = dict ( )
		j = 1
		value_at_index = [ ]
		for x in ans :
			mpp [ x ] = j
			j += 1
		for x in anss :
			value_at_index . append ( mpp [ x ] )
		for x in value_at_index :
			print ( x , end = " ▁ " )
		print ( )
differences = [ ]
differences . append ( 2 )
differences . append ( - 3 )
differences . append ( 2 )
n = len ( differences ) + 1
findPerm ( n , differences )