• + 18 comments

    What time complexity is that? Is it better than mine?

    n,k = (int(x) for x in input().split())
    lst = list(map(int, input().split()))
    
    count = 0
    for i in range(len(lst)-1):
        for x in range(1+i, len(lst)):     
            if (lst[i] + lst[x]) % k == 0:
                count += 1
            
    print(count)