<garvit244>18_1.py
def fourSum( nums, target):
    sumMapping = {}
    for index_i in range(len(nums)-1):
        for index_j in range(index_i+1, len(nums)):
            currSum = nums[index_i] + nums[index_j]
            if currSum in sumMapping:
                sumMapping[currSum].append((index_i, index_j))
            else:
                sumMapping[currSum] = [(index_i, index_j)]
    
    result = set()
    for key, value in sumMapping.iteritems():
        diff = target - key
        if diff in sumMapping:
            firstSet = value
            secondSet = sumMapping[diff]
    
            for (i, j) in firstSet:
                for (k, l) in secondSet:
                    fourlet = [i, j, k, l]
                    if len(set(fourlet)) != len(fourlet):
                        continue
                    fourlist = [nums[i], nums[j], nums[k], nums[l]]
                    fourlist.sort()
                    result.add(tuple(fourlist))
    
    return list(result)
def sample_funcname ( var_0 , var_1 ) :
    var_2 = { }
    for var_6 in range ( len ( var_0 ) - 1 ) :
        for var_7 in range ( var_6 + 1 , len ( var_0 ) ) :
            var_8 = var_0 [ var_6 ] + var_0 [ var_7 ]
            if var_8 in var_2 :
                var_2 [ var_8 ].append ( ( var_6 , var_7 ) )
            else :
                var_2 [ var_8 ] = [ ( var_6 , var_7 ) ]
    var_11 = set ( )
    for var_13 , var_14 in var_2.iteritems ( ) :
        var_15 = var_1 - var_13
        if var_15 in var_2 :
            var_16 = var_14
            var_17 = var_2 [ var_15 ]
            for ( var_18 , var_19 ) in var_16 :
                for ( var_20 , var_21 ) in var_17 :
                    var_22 = [ var_18 , var_19 , var_20 , var_21 ]
                    if len ( set ( var_22 ) ) != len ( var_22 ) :
                        continue
                    var_23 = [ var_0 [ var_18 ] , var_0 [ var_19 ] , var_0 [ var_20 ] , var_0 [ var_21 ] ]
                    var_23.sort ( )
                    var_11.add ( tuple ( var_23 ) )
    return list ( var_11 )
