human
Find Sum of all unique sub | function for finding grandSum.
Go through all subarrays , compute sums and count occurrences of sums ..
Print all those Sums that appear once ..
Driver code"
Solution in Python:
 ... Can you provide 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 ) :
	res = 0
	m = dict ( )
	for i in range ( n ) :
		Sum = 0
		for j in range ( i , n ) :
			Sum += arr [ j ]
			m [ Sum ] = m . get ( Sum , 0 ) + 1
	for x in m :
		if m [ x ] == 1 :
			res += x
	return res
arr = [ 3 , 2 , 3 , 1 , 4 ]
n = len ( arr )
print ( findSubarraySum ( arr , n ) )