Question: 
Write a python function to count the number of pairs whose sum is equal to ‘sum’.


Model's Code:
def get_Pairs_Count(arr, target_sum, pair_count):
    from collections import Counter
    count = 0
    num_count = Counter(arr)
    
    for num in arr:
        complement = target_sum - num
        if complement in num_count:
            count += num_count[complement]
            if complement == num:
                count -= 1
    
    return count // pair_count



Sample Correct Code:
def get_Pairs_Count(arr,n,sum):
    count = 0  
    for i in range(0,n):
        for j in range(i + 1,n):
            if arr[i] + arr[j] == sum:
                count += 1
    return count


Asserts:
assert get_Pairs_Count([1,1,1,1],4,2) == 6
assert get_Pairs_Count([1,5,7,-1,5],5,6) == 3
assert get_Pairs_Count([1,-2,3],3,1) == 1


Tests:
Test 1 of 3: FAIL: AssertionError()

Test 767 of 974: 579/767 (75.48891786179922%): failed