human
Find Sum of all unique sub | function for finding grandSum.
calculate cumulative sum of array cArray [ 0 ] will store sum of zero elements.
store all subarray sum in vector.
sort the vector.
mark all duplicate sub - array sum to zero.
calculate total sum.
return totalSum.
Drivers code"
How can the above be solved in Python?

What is a code to find Sum of all unique sub and the other steps required?
assistant
#Here is code to find Sum of all unique sub and the other steps required.
 def findSubarraySum ( arr , n ) :
	cArray = [ 0 for i in range ( n + 1 ) ]
	for i in range ( 0 , n , 1 ) :
		cArray [ i + 1 ] = cArray [ i ] + arr [ i ]
	subArrSum = [ ]
	for i in range ( 1 , n + 1 , 1 ) :
		for j in range ( i , n + 1 , 1 ) :
			subArrSum . append ( cArray [ j ] - cArray [ i - 1 ] )
	subArrSum . sort ( reverse = False )
	totalSum = 0
	for i in range ( 0 , len ( subArrSum ) - 1 , 1 ) :
		if ( subArrSum [ i ] == subArrSum [ i + 1 ] ) :
			j = i + 1
			while ( subArrSum [ j ] == subArrSum [ i ] and j < len ( subArrSum ) ) :
				subArrSum [ j ] = 0
				j += 1
			subArrSum [ i ] = 0
	for i in range ( 0 , len ( subArrSum ) , 1 ) :
		totalSum += subArrSum [ i ]
	return totalSum
if __name__ == ' _ _ main _ _ ' :
	arr = [ 3 , 2 , 3 , 1 , 4 ]
	n = len ( arr )
	print ( findSubarraySum ( arr , n ) )