n = 1
cases = 0
num = 0
arr = [0 for i in range(0,30)]
ans = 0
#print('Enter the test cases')
cases = int(input())
while cases:
num = int(input())
for i in range(0,30):
if num % 2 == 1:
arr[i] = arr[i] + 1
num = num // 2
if num == 0:
break
cases-=1
#print('Arr: ',arr)
for i in range(0,30):
if arr[i]:
ans = ans + (n * arr[i] * (arr[i] - 1))//2
n = n*2
print(int(ans))

Can some one tell me why am i getting NZEC… This runs fine in idle

the error is in the way u r taking input…the “n” numbers are space-separated integers…u need to take string as input ans split them and then convert to int…hope this helps…

t=raw_input();
t=int(t);
arr=[2,3,5];
ans =[];
for v in range (0,t):
n = raw_input();
n = int(n);
if(n<=len(arr)):
ans = ans + [arr[n-1]];
else:
prime(arr,n);print arr;print"arr was printed"
ans= ans + [arr[n-1]];