• + 1 comment

    whats wrong in this code:

    from itertools import combinations
    import math
    def nCr(n,r):
        f=math.factorial
        return f(n)//f(r)//f(n-r)
    
    N,K=map(int,input().split(" "))
    A=list(map(int,input().split(" ")))
    B=list(combinations(A,K))
    
    suma=[]
    
    for x in range(len(B)):
        s=1
        for y in range(K):
            if(B[x][y]<4):
               c=1
            else:
               c=nCr(B[x][y],4)+1
            s=s*c     
        suma.append(s)
    print(sum(suma)%(10**9 + 7))
    

    shows memory error