Giving runtime error on submission


#1

<
int cal(int x,int y){

int n= (x | y) - (x & y);
	int c=0;

 while (n) { 
        n &= (n - 1); 
        c++; 
    } 
    return c;

}

int Solution::hammingDistance(const vector &A) {

int n = A.size();
int aa[n][n];
int sum= 0 ;
for(int i=1;i<n;i++){
    for(int j=0;j<n-i;j++){
        int k= j+i;
       sum+= cal(A[j],A[k]);
    }
}

// cout<<sum;
sum+=sum;
return (sum)%(1000000007);

}