ZhenlongDai/ACPR huggingface dataset:
Problem: p03494
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
l = list(input().split(" "))

d = [0]
count = 0
max_count = 0

for n in l:
    while int(n) % 2 == 0:
        n = int(n)/2
        count = count + 1
    if max_count < count:
        max_count = count
    count = 0

print(max_count)

Failing test case input:
4
10 5 43 27

Expected output:
0


Actual output:
2


Fixed submission (verdict: Accepted):
number = input()
l = list(input().split(" "))

loop_count = 0
count = 0
min_count = 0

for n in l:
    loop_count = loop_count + 1
    while int(n) % 2 == 0:
        n = int(n)/2
        count = count + 1
    if loop_count == 1:
        min_count = count
    elif min_count > count:
        min_count = count
    count = 0

print(min_count)

Problem: p03494
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
a=list(map(int,input().split()))
loop=True
cnt=0
while loop:
    for i in range(n):
        if a[i]%2==0:
            a[i]=a[i]/2
        else:
          loop=False
          break
    cnt=cnt+1
print(cnt)


Failing test case input:
6
382253568 723152896 32183854 379425024 590201381 471526144

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
n=int(input())
a=list(map(int,input().split()))
loop=True
cnt=0
while loop:
    for i in range(n):
        if a[i]%2==0:
            a[i]=a[i]/2
        else:
          loop=False
          break
    cnt=cnt+1
print(cnt-1)

Problem: p03494
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
num = int(input())
a = list(map(int, input().split()))

count = 0
for i in a:
  c = 0
  while i != 0 and i % 2 == 0:
    i /= 2
    c += 1
  if c >= count:
    count = c
print(count)

Failing test case input:
6
71148002 1320359906 59907007 21985869 236966 233525638

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
num = int(input())
a = list(map(int, input().split()))

carray = []
for i in a:
  c = 0
  while i != 0 and i % 2 == 0:
    i /= 2
    c += 1
  carray.append(c)
print(min(carray))

Problem: p03494
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
A=list(map(int,input().split()))

flag=0
count=0
ans=[]
for a in A:
  if a%2==0:
    count=a/2
  else:
    count=(a-1)/2
    flag=1
    ans.append(count)
if flag==1:
  print(int(min(ans)))
else:
  print(0)                                 

Failing test case input:
4
10 4 43 27

Expected output:
0


Actual output:
13


Fixed submission (verdict: Accepted):
N=int(input())
A=list(map(int,input().split()))

flag=0
ans=[]
for a in A:
  if a%2==0:
    count=0
    while a%2==0:
      a=a/2
      count=count+1
    ans.append(count)
  else:
    flag=1
    
if flag==0:
  print(int(min(ans)))
else:
  print(0)
Problem: p03494
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
count = 0
flg = 0
a = list(map(int,input().split()))

while True:
	for i in a:
		if i%2 != 0:
			flg = 1
	if flg == 0:
		a = list(map(lambda x: int(x/2), a))
		count += 1
	else:
		break
         
print(count)

Failing test case input:
6
586050932 1154626501 31409214 41028353 46444612 471526144

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
count = 0
flg = 0
n = input()
a = list(map(int,input().split()))

while True:
	for i in a:
		if i%2 != 0:
			flg = 1

	if flg == 0:
		a = list(map(lambda x: int(x/2), a))
		count += 1
	else:
		break
         
print(count)

Problem: p03494
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


numbers = list(map(int, input().split()))

count = 0
while(True):
	if sum(list(map(lambda x: x % 2, numbers))) == 0:
		numbers = list(map(lambda x: x / 2, numbers))
		count += 1
	else:
		break
print(count)

Failing test case input:
6
586050932 1154626501 32183854 379425024 590201381 471526144

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):

input()
numbers = list(map(int, input().split()))
 
count = 0
while(True):
	if sum(list(map(lambda x: x % 2, numbers))) == 0:
		numbers = list(map(lambda x: x / 2, numbers))
		count += 1
	else:
		break
print(count)

Problem: p03494
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
arr =  [int(i) for i in input().split()] 

count = 0
while(True):
    for i, j in enumerate(arr):
        if j % 2 == 0:
            arr[i] = j / 2
            if i == 2:
                count += 1
        else:
            break
    else:
        continue
    break
        
        

print(count)



Failing test case input:
3
8 12 40

Expected output:
2

Actual output:
0


Fixed submission (verdict: Accepted):
N = int(input())
arr =  [int(i) for i in input().split()] 

count = 0
while(True):
    exits_odd = False
    for i in range(N):
        if arr[i] % 2 != 0:
            exits_odd = True
        else:
            continue
    if exits_odd:
        break
    else:
        count += 1
        for i in range(N):
            arr[i] = arr[i] / 2


print(count)

Problem: p03494
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def count2(number):
    count = 0
    while True:
        if number % 2 == 0:
            count = count + 1
            number = number / 2
        else:
            break
    return count


A_list = list(map(int, input().split())) 

answer = min(list(map(count2, A_list)))
    
print(answer)

Failing test case input:
4
9 6 43 16

Expected output:
0


Actual output:
2


Fixed submission (verdict: Accepted):
def count2(number):
    count = 0
    while True:
        if number % 2 == 0:
            count = count + 1
            number = number / 2
        else:
            break
    return count

N = int(input())
A_list = list(map(int, input().split())) 

answer = min(list(map(count2, A_list)))
    
print(answer)
Problem: p03494
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
data = list(map(int, input().split()))

count = 0

while sum(data) % 2 == 0:
    for i in range(len(data)):
        data[i] = data[i] / 2

    count += 1

print(count)


Failing test case input:
4
9 6 43 16

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):

N = int(input())
data = list(map(int, input().split()))

def div(n):
    count = 0
    while n %2 == 0:
        n /= 2
        count += 1
    return count

ans = min(list(map(div, data)))
print(ans)

Problem: p03494
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
x = input().split()
count = 0
flg = 0
while True:
  for i in range(0, n):
    if int(x[i]) % 2 != 0:
      flg = 1
      break
  if flg == 0:
    count += 1
    x.insert(i, int(x[i]) /2)
  else:
    break
print(count)

Failing test case input:
3
10 12 40

Expected output:
1


Actual output:
3


Fixed submission (verdict: Accepted):
n = int(input())
x = input().split()
count = 0
flg = 0
while flg == 0:
  for i in range(0, n):
    if int(x[i]) % 2 != 0:
      flg = 1
  
  if flg == 0:
    count += 1
    for i in range(0, n):
      x[i] = int(x[i]) / 2
print(count)

Problem: p03494
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
a_list = map(int, input().split())
b_list = [int(a % 2) for a in a_list]
zero_list = [0 for a in a_list]
i = 0
if zero_list == b_list:
    print(i)
else:
    a_list = [int(a / 2) for a in a_list]
    b_list = [int(a % 2) for a in a_list]
    i += 1


Failing test case input:
6
105530884 1320359906 59907007 27068201 236966 136055793

Expected output:
0


Actual output:

Fixed submission (verdict: Accepted):
N = int(input())
a_list = list(map(int, input().split()))
b_list = [int(a % 2) for a in a_list]
zero_list = [0 for a in a_list]
i = 0
while zero_list == b_list:
    a_list = [int(a / 2) for a in a_list]
    b_list = [int(a % 2) for a in a_list]
    i += 1
print(i)

Problem: p03494
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = input()
x = [int(i) for i in input().split()]
min_n = 100
c = 0
for i in x:
    while i%2==0:
        i = i/2
        c+=1
    if c < min_n:
        min_n=c
        c=0
print(min_n)

Failing test case input:
3
4 12 31

Expected output:
0


Actual output:
2


Fixed submission (verdict: Accepted):
n = input()
x = [int(i) for i in input().split()]
min_n = 100
c = 0
for i in x:
    while i%2==0:
        i = i/2
        c+=1
    if c < min_n:
        min_n=c
    c=0
print(min_n)
Problem: p03494
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
input = sys.stdin.readline

n = int(input())
a = list(map(int,input().split()))
b = 0
c = 2
f = 0

r = 0

while True:
    for i in a:
        if i % c > 0:
            f = f +1
            break
    if f == 1:
        break

    b = b + 1
    c = c + 2

print(b)


Failing test case input:
6
382253568 723152896 37802240 379425024 404894720 471526144

Expected output:
8

Actual output:
2


Fixed submission (verdict: Accepted):
import sys
input = sys.stdin.readline

n = int(input())
a = list(map(int,input().split()))
b = 0
c = 2
f = 0


while True:
    for i in a:
        if i % c > 0:
            f = f +1
            break
    if f == 1:
        break

    b = b + 1
    c = c * 2



print(b)

Problem: p03494
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math

n=int(input())
a=list(map(int,input().split()))

count=0

while True:
  for i in range(n):
    ch = False
    if a[i]%2 == 0:
      ch = True
  if ch == True:
    a[i] = math.ceil(a[i]/2)
    count +=1
  else:
    break


    
print(count-1)

Failing test case input:
4
9 6 43 16

Expected output:
0


Actual output:
3


Fixed submission (verdict: Accepted):
import math

n=int(input())
a=list(map(int,input().split()))

count=0

while True:
  ch = 0
  for i in range(n):
    if a[i]%2 != 0:
      ch += 1
  if ch == 0:
    
    for j in range(n):
      a[j]= a[j]/2
    count +=1
  else:
    break


    
print(count)

Problem: p03494
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
array = list(map(int, input().split()))


def cal(value):
    return value / 2


def odd_even_cal(value):
    return value % 2


for i in range(n+1):
    if 0 not in list(map(odd_even_cal, array)):
        print(i)
        break
    array = list(map(cal, array))

else:
    print(i)


Failing test case input:
6
382253568 723152896 37802240 379425024 590201381 471526144

Expected output:
0


Actual output:
6


Fixed submission (verdict: Accepted):
n = int(input())
array = list(map(int, input().split()))


def cal(value):
    return value / 2


def odd_even_cal(value):
    return value % 2


flug, counter = -1, 0
while flug < 0:
    if 1 in list(map(odd_even_cal, array)) or 0 in array:
        flug = 1
        break
    counter += 1
    array = list(map(cal, array))

print(counter)

Problem: p03494
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
A=list(map(int,input().split()))
K=0
for i  in range(1,N):
    for j in A:
        if j%(2**i)!=0:
            break
    else:
        K+=1
        continue
    break

print(K)

Failing test case input:
6
382253568 723152896 37802240 379425024 404894720 471526144

Expected output:
8

Actual output:
5


Fixed submission (verdict: Accepted):
N=int(input())
A=list(map(int,input().split()))
K=0
for i  in range(1,10000000):
    for j in A:
        if j%(2**i)!=0:
            break
    else:
        K+=1
        continue
    break

print(K)
Problem: p03494
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = list(map(int, input().split()))

count = 0
while sum(a) % 2 == 0 :
	for i in range(n):
		a[i] = a[i] / 2

	count += 1

print(count)

Failing test case input:
6
71148002 1055849701 81412222 21985869 236966 734273188

Expected output:
0


Actual output:
2


Fixed submission (verdict: Accepted):
n = int(input())
a = list(map(int, input().split()))

count = 0
flag = 0

while flag == 0 :
	
	for i in range(n):
		flag += 0 if a[i] % 2 == 0 else + 1
		a[i] = a[i] / 2


	count += 1 if flag == 0 else +0

print(count)

Problem: p03494
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
a = input().split(' ')
c = 0


def check(a):
    global c


    for i in a:
        if int(i) % 2 == 1:
            return
        else:
            a[a.index(i)] = int(i)/2
            if int(i)/2 == 1:
                c += 1
                return
    c += 1
    check(a)


check(a)
print(c)

Failing test case input:
3
2 36 65

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
N = int(input())
a = input().split(' ')
c = 0


def check(a):
    global c

    for i in a:
        if int(i) % 2 == 1:
            return
    for i in a:
        a[a.index(i)] = int(i)/2
        if int(i)/2 == 1:
            c += 1
            return
    c += 1
    check(a)


check(a)
print(c)

Problem: p03494
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math

N = input()
if N == '0':
  print(0)

As = [int(a) for a in input().split()]
Fs = [math.floor(math.log2(a)) if a % 2 == 0 else 0 for a in As]

print(int(min(Fs)))

Failing test case input:
4
10 6 24 10

Expected output:
1


Actual output:
2


Fixed submission (verdict: Accepted):
N = input()
if N == '0':
  print(0)

  
def fac(num):
  if num % 2 == 0:
    return 1 + fac(num / 2)
  else:
    return 0

As = [int(a) for a in input().split()]


Fs = [fac(a) for a in As]

print(int(min(Fs)))

Problem: p03494
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
a = input().split(' ')
c = 0


def check(a):
    global c


    for i in a:
        if int(i) % 2 == 1:
            return
        else:
            a[a.index(i)] = int(i)/2
            if int(i)/2 == 1:
                return
    c += 1
    check(a)


check(a)
print(c)

Failing test case input:
3
2 36 114

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):
N = int(input())
a = input().split(' ')
c = 0


def check(a):
    global c

    for i in a:
        if int(i) % 2 == 1:
            return
    for i in a:
        a[a.index(i)] = int(i)/2
        if int(i)/2 == 1:
            c += 1
            return
    c += 1
    check(a)


check(a)
print(c)
Problem: p03494
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
x = input().split()
count = 0
flg = 0
while True:
  for i in range(0, n):
    if int(x[i]) % 2 != 0:
      flg = 1
  if flg == 0:
    count += 1
    x.insert(i, int(x[i]) /2)
  else:
    break
print(count)

Failing test case input:
3
10 12 40

Expected output:
1


Actual output:
3


Fixed submission (verdict: Accepted):
n = int(input())
x = input().split()
count = 0
flg = 0
while flg == 0:
  for i in range(0, n):
    if int(x[i]) % 2 != 0:
      flg = 1
  
  if flg == 0:
    count += 1
    for i in range(0, n):
      x[i] = int(x[i]) / 2
print(count)

Problem: p03494
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = input()
num = [int(i) for i in input().split()]

count = 0
end=False
while(True):
	div = []
	for i in num:
		if(i % 2 == 0):
			div.append(i/2)
		else:
			print(count)
			end = True
	if(end == True):
		break
	num = div
	count = count + 1


Failing test case input:
3
7 13 8

Expected output:
0


Actual output:
0
0


Fixed submission (verdict: Accepted):
n = input()
num = [int(i) for i in input().split()]
count = 0
end=False
while(True):
	div = []
	for i in num:
		if(i % 2 == 0):
			div.append(i/2)
		else:
			print(count)
			end = True
			break
	if(end == True):
		break
	num = div
	count = count + 1

Problem: p03494
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math

N = input()
A = list(map(int, input().split()))
n = 0
d = 0

while n >= 0:
    for a in A:
        if a%2 == 1:
            print(n)
            d += 1
    if d > 0:
        break
    A = [a/2 for a in A] 
    n += 1
    

Failing test case input:
6
105530884 1892549229 59907007 27068201 236966 136055793

Expected output:
0


Actual output:
0
0
0
0


Fixed submission (verdict: Accepted):
import math

N = input()
A = list(map(int, input().split()))
n = 0
d = 0

while n >= 0:
    for a in A:
        if a%2 == 1:
            print(n)
            d += 1
            break
    if d > 0:
        break
    A = [a/2 for a in A] 
    n += 1

Problem: p03494
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = list(map(int,input().split()))
b = 0
c = 0
while c == 0:
    for i in range(n):
        if a[i]%2 == 0:
            a[i] = a[i]/2
            b += 1
        else:
            c += 1

print(b)

Failing test case input:
3
1 36 65

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
n = int(input())
a = list(map(int,input().split()))
b = 0
c = 0
while c == 0:
    for i in range(n):
        if a[i]%2 == 0:
            a[i] = a[i]/2
            b += 1
        else:
            c += 1

print(int(b/n))
Problem: p03494
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
input()
num_list = list(map(int, input().split()))
min_cnt = 0
for num in num_list:
  num_cnt = 0
  while True:
    if num % 2 == 1:
      if num_cnt < min_cnt: min_cnt = num_cnt
      break
    else:
      num = num / 2
      min_cnt += 1
print(min_cnt)

Failing test case input:
3
2 36 114

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):
input()
num_list = list(map(int, input().split()))
min_cnt = 999
for num in num_list:
  num_cnt = 0
  while True:
    if num % 2 == 1:
      if num_cnt < min_cnt: min_cnt = num_cnt
      break
    else:
      num = num / 2
      num_cnt += 1
print(min_cnt)

Problem: p03494
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def check(a,cnt):
  b = [int(x)%2 for x in a]
  if 1 in b:
    return 0,cnt,a
  else :
    cnt +=1
    b = [int(x)/2 for x in a]
    return 1,cnt,b
 
N = input()
a = input().split()
cnt = 0
m = 1
while(m == 0):
  m,cnt,a = check(a,cnt)
  if m == 0:
    print(cnt)
  else :
    continue

Failing test case input:
3
7 7 52

Expected output:
0


Actual output:

Fixed submission (verdict: Accepted):
def check(a,cnt):
  c = [int(x)%2 for x in a]
  if 1 in c:
    return 0,cnt,a
  else :
    cnt +=1
    b = [int(x)/2 for x in a]
    return 1,cnt,b
 
N = input()
a = input().split()
cnt = 0
m = 1
while(m != 0):
  m,cnt,a = check(a,cnt)
  if m == 0:
    print(cnt)
  else :
    continue

Problem: p03494
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
P = list(map(int,input().split()))
S = []
a = 0
p = 0
s = 0
t = 1000000000000000000
for i in range(len(P)):
        while P[i] % 2 == 0:
            p = P[i] / 2
            P[i] = p
            a += 1
            s = max(s, a)
        a = 0    
        t = min(t, s)
if t > 1:
    t -= 1
print(t)

Failing test case input:
6
71148002 1800176736 24185535 5864889 179543 1171612875

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
N = int(input())
P = list(map(int,input().split()))
S = []
a = 0
p = 0
s = 0
while True:
    
    for i in range(N):
        if P[i] % 2 == 1:
            s = 1
        else:
            P[i] = P[i] / 2
    if s == 1:
        break
    a += 1

print(a)

Problem: p03494
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
_ = input()
l = list(map(int,input().split()))
mn = 99999
for i in l:
  count = 0
  if i %2 ==0:
    count +=1
    i /= 2
  else:
    continue
  if mn > count:
    count = mn
print(count)

Failing test case input:
6
586050932 1154626501 31409214 27068201 52438452 243833698

Expected output:
0


Actual output:
99999


Fixed submission (verdict: Accepted):
_ = input()
l = list(map(int,input().split()))
mn = 99999
for i in l:
  count = 0
  while True:
    if i %2 ==0:
      count +=1
      i = int(i/ 2)
    else:
      break
  if mn > count:
    mn = count
print(mn)
Problem: p03494
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = input().split()
A = [int(i) for i in A]

check1 = 0
count1 = 0
while check1 == 0:
    print("this is")
    for i in range(len(A)):
        if(A[i]%2 == 0):
            A[i] = A[i]/2
        else:
            check1 = 1
            break
    count1 += 1
        
count1 -= 1
print(count1)



Failing test case input:
6
71148002 1320359906 81412222 21985869 236966 400136429

Expected output:
0


Actual output:
this is
0


Fixed submission (verdict: Accepted):
N = int(input())
A = input().split()
A = [int(i) for i in A]

check1 = 0
count1 = 0
while check1 == 0:
    for i in range(len(A)):
        if(A[i]%2 == 0):
            A[i] = A[i]/2
        else:
            check1 = 1
            break
    count1 += 1
        
count1 -= 1
print(count1)

Problem: p03494
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n=int(input())
a=list(map(int,input().split()))
b=[]
cnt=0
for i in range(n):
    if a[i]%2==1:
        print('0')
        exit()
    else:
        while a[i]%2==0:
            cnt += 1
            a[i] /= 2
        b.append(cnt)
print(min(b))

Failing test case input:
3
16 36 16

Expected output:
2


Actual output:
4


Fixed submission (verdict: Accepted):
n=int(input())
a=list(map(int,input().split()))
b=[]
cnt=0
for i in range(n):
    if a[i]%2==1:
        print('0')
        exit()
    else:
        while a[i]%2==0:
            cnt += 1
            a[i] /=  2
        b.append(cnt)
        cnt = 0
print(min(b))

Problem: p03494
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n = int(input())
N = list(map(int,input().split()))
ans = 0
c = True
while c == True :
  for i in range(n):
    if N[i] % 2 == 1:
      c = False
    else:
      N[i] = int(N[i] / 2)
      c = True
  if c == True:
    ans += 1

print(ans)


Failing test case input:
6
71148002 1055849701 81412222 34292530 236966 734273188

Expected output:
0


Actual output:
2


Fixed submission (verdict: Accepted):
n = int(input())
N = list(map(int,input().split()))
ans = 0
c = True
while c == True :
  for i in range(n):
    if N[i] % 2 == 1:
      c = False
    else:
      N[i] = int(N[i] / 2)
      
  if c == True:
    ans += 1

print(ans)

Problem: p03494
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = list(map(int,input().split()))
flag = True
n = 0
while flag:
  for a in A:
    if a%2 == 1:
      flag = False
  A = [int(a/2) for a in A]
  n += 1
print(n)

Failing test case input:
6
382253568 723152896 32183854 379425024 590201381 471526144

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
N = int(input())
A = list(map(int,input().split()))
flag = True
n = -1
while flag:
  for a in A:
    if a%2 == 1:
      flag = False
  A = [int(a/2) for a in A]
  n += 1
print(n)
Problem: p03494
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a = list(map(int, input().split()))
ans = 0

while(True):
    t = True
    for i in a:
        if i%2:
            t = False
    if t:
            ans += 1
            a = [int(x/2) for x in a]
    else:
        break
print(str(ans))


Failing test case input:
6
586050932 1892549229 30334838 27068201 10685560 243833698

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
n = input()
a = list(map(int, input().split()))
ans = 0

while(True):
    t = True
    for i in a:
        if i%2:
            t = False
    if t:
            ans += 1
            a = [int(x/2) for x in a]
    else:
        break
print(str(ans))

Problem: p03494
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = input()
list_a = list(map(int,input().split()))

ans = 0

while all(a % 2 == 0 for a in list_a):
    list_a = [a / 2 for a in list_a]
    ans += 1

Failing test case input:
3
1 36 65

Expected output:
0


Actual output:

Fixed submission (verdict: Accepted):
n = input()
list_a = list(map(int,input().split()))

ans = 0

while all(a % 2 == 0 for a in list_a):
    list_a = [a / 2 for a in list_a]
    ans += 1

print(ans)

Problem: p03494
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = map(int,input().split())
ans = 0
count = 0
for i in a:
    while i%2 ==0:
        i /= 2
        count += 1
    if count > ans:
        ans = count
    count = 0
print(ans)

Failing test case input:
6
105530884 1892549229 59907007 27068201 236966 136055793

Expected output:
0


Actual output:
2


Fixed submission (verdict: Accepted):
n = int(input())
a = map(int,input().split())
ap = list()
count = 0
for i in a:
    while i%2 ==0:
        i /= 2
        count += 1
    ap.append(count)
    count = 0
print(min(ap))

Problem: p03494
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
array = list(map(int, input().split()))


def cal(value):
    return value / 2


def odd_even_cal(value):
    return value % 2


for i in range(n):
    if 0 not in list(map(odd_even_cal, array)):
        print(i)
        break
    array = list(map(cal, array))

else:
    print(i)


Failing test case input:
6
71148002 1055849701 81412222 21985869 236966 734273188

Expected output:
0


Actual output:
2


Fixed submission (verdict: Accepted):
n = int(input())
array = list(map(int, input().split()))


def cal(value):
    return value / 2


def odd_even_cal(value):
    return value % 2


flug, counter = -1, 0
while flug < 0:
    if 1 in list(map(odd_even_cal, array)) or 0 in array:
        flug = 1
        break
    counter += 1
    array = list(map(cal, array))

print(counter)
Problem: p03494
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = [int(x) for x in input().split()]
d=0
while True:
    c=0
    for i in range(n):
        if a[i]%2==0:
            a[i]=a[i]/2
            c+=1
    if c==0:
        break
    else:
        d+=1
print(d)

Failing test case input:
3
8 12 40

Expected output:
2

Actual output:
3


Fixed submission (verdict: Accepted):
N = int(input())
a = [int(x) for x in input().split()]
cnt=0
Flag=True
while(Flag):
    for i in range(N):
        if a[i]%2!=0:
            Flag=False
            break
        a[i]/=2
    cnt+=1
print(cnt-1)

Problem: p03494
Buggy submission (Python (3.8.2), verdict: Wrong Answer):

n = int(input())
a = sorted(list(map(int,input().split())))

cnt = 0

for _ in range(1000000):
    if sum(a) % 2 == 1:
        break

    for i in range(len(a)):
        a[i] /= 2

    cnt += 1

print(cnt)

Failing test case input:
4
10 5 43 24

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):

n = int(input())
a = list(map(int,input().split()))

cnt = 0
flg = True

while flg == True:
    for i in range(len(a)):
        if a[i] % 2 == 1:
            flg = False
        a[i] /= 2

    if flg:
        cnt += 1 

print(cnt)

Problem: p03494
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

import sys

n = input()
l = list(map(int, input().split()))

loop = 0

while (1):
  for i in l:
    if i % (2 ** loop + 1) != 0:
      print(loop)
      sys.exit(0)
  loop = loop + 1

Failing test case input:
6
382253568 723152896 37802240 379425024 404894720 471526144

Expected output:
8

Actual output:
1


Fixed submission (verdict: Accepted):
import sys

n = input()
l = list(map(int, input().split()))

loop = 0

while (1):
  for i in l:
    if i % (2 ** (loop + 1)) != 0:
      print(loop)
      sys.exit(0)
  loop = loop + 1

Problem: p03494
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def how_many_times_divisible(n):
    ans = 0
    while  n % 2 == 0:
        n = n / 2
        ans += 1
    return ans

n = input()
a = list(map(int,input().split()))

a_divided = list(map(how_many_times_divisible,a))

ans = max(a_divided)

print(ans)


Failing test case input:
6
71148002 1055849701 81412222 21985869 236966 734273188

Expected output:
0


Actual output:
2


Fixed submission (verdict: Accepted):
def how_many_times_divisible(n):
    ans = 0
    while  n % 2 == 0:
        n = n / 2
        ans += 1
    return ans

n = input()
a = list(map(int,input().split()))

a_divided = list(map(how_many_times_divisible,a))

ans = min(a_divided)

print(ans)
Problem: p03494
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
x = input().split()
a = int(x[0])
b = int(x[1])
c = int(x[2])
count = 0
for i in range(0, n):
  if a % 2 == 0 and b % 2 == 0 and c % 2 == 0:
    count += 1
    list = []
    a = a /2
    b = b /2
    c = c /2
  else:
    break
print(count)

Failing test case input:
4
12 2 26 9

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
n = int(input())
x = input().split()
count = 0
flg = 0
while flg == 0:
  for i in range(0, n):
    if int(x[i]) % 2 != 0:
      flg = 1
  
  if flg == 0:
    count += 1
    for i in range(0, n):
      x[i] = int(x[i]) / 2
print(count)

Problem: p03494
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
input()
A = list(map(int, input().split()))
count = 1

while all(a%2 == 0 for a in A):
  A = [a/2 for a in A]
  count += 1
print(count)

Failing test case input:
6
586050932 1154626501 31409214 41028353 590201381 471526144

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
input()
A = list(map(int, input().split()))
count = 0

while all(a%2==0 for a in A):
  A = [a/2 for a in A]
  count += 1
print(count)

Problem: p03494
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = list(map(int,input().split()))
b = 0
c = 0
while c == 0:
    for i in range(n):
        if a[i]%2 == 0:
            a[i] = a[i]/2
            b += 1
        else:
            c += 1

print(b/n)

Failing test case input:
4
10 6 11 15

Expected output:
0


Actual output:
0.5


Fixed submission (verdict: Accepted):
n = int(input())
a = list(map(int,input().split()))
b = 0
c = 0
while c == 0:
    for i in range(n):
        if a[i]%2 == 0:
            a[i] = a[i]/2
            b += 1
        else:
            c += 1

print(int(b/n))

Problem: p03494
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
As = [int(c) for c in input().split()]
counter = 0
w = 0


while w == 0:
    for i in range(N):
        if As[i] % 2 != 0:
            w = 1
        As[i] = int(As[i] / 2)
    counter += 1

print(counter)

Failing test case input:
4
14 6 15 19

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
N = int(input())
As = [int(c) for c in input().split()]
counter = 0


while True:
    for i in range(N):
        if As[i] % 2 != 0:
            break
        As[i] = int(As[i] / 2)
    else:
        counter += 1
        continue
    break

print(counter)
Problem: p03494
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())                                                            
         
a = []
a = list(map(int, input().split()))
         
product = 1
counter = 0
for i in range(n):
  product *= a[i]
         
while product % 2 == 0:
  for i in range(n):
    a[i] = a[i]/2
  for i in range(n):
    product = 1
    product *= a[i]
  counter += 1
print(counter-1)

Failing test case input:
3
9 25 16

Expected output:
0


Actual output:
3


Fixed submission (verdict: Accepted):
n = int(input())

a = []
a = list(map(int, input().split()))

counter = 0
check = 0

for i in range(n):
    if a[i] % 2 == 0:
        check += 1



while check == n:
    check = 0
    for i in range(n):
        a[i] = a[i]/2
    for i in range(n):
        if a[i] % 2 == 0:
            check += 1
    counter += 1
print(counter)

Problem: p03494
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n=int(input())
a=list(map(int,input().split()))
b=[]
for i in range(n):
    cnt = 0
    while a[i]%2==0:
       a[i] /= 2
       cnt += 1
    b.append(cnt)

if min(b)!=0:
    print(min(b)-1)
else:
    print('0')

Failing test case input:
4
10 6 24 10

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):
n=int(input())
a=list(map(int,input().split()))
b=[]
cnt=0
for i in range(n):
    if a[i]%2==1:
        print('0')
        exit()
    else:
        while a[i]%2==0:
            cnt += 1
            a[i] /=  2
        b.append(cnt)
        cnt = 0
print(min(b))

Problem: p03494
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
iter_num = input()
variables = input()

raw_variables = variables.split(' ')
variables = list()

for raw_variable in raw_variables:
    variables.append(int(raw_variable))


def calc(variable):
    process_count = 0
    while (variable % 2 == 0):
        process_count += 1
        variable = variable / 2
    return process_count


min_count = 0

for variable in variables:
    process_count = calc(variable)
    if min_count is None:
        min_count = process_count
    if process_count < min_count:
        min_count = process_count

print(min_count)


Failing test case input:
6
382253568 723152896 37802240 379425024 404894720 471526144

Expected output:
8

Actual output:
0


Fixed submission (verdict: Accepted):
iter_num = input()
variables = input()

raw_variables = variables.split(' ')
variables = list()

for raw_variable in raw_variables:
    variables.append(int(raw_variable))


def calc(variable):
    process_count = 0
    while (variable % 2 == 0):
        process_count += 1
        variable = variable / 2
    return process_count


min_count = None

for variable in variables:
    process_count = calc(variable)
    if min_count is None:
        min_count = process_count
    if process_count < min_count:
        min_count = process_count

print(min_count)
Problem: p02732
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
from collections import Counter

def cmb(n,r):
    if n < r:
        return 0
    return math.factorial(n)

def main():
    N = int(input())
    A = list(map(int, input().split()))
    count = Counter(A)
    sum_ = sum([cmb(v,2) for v in count.values()])

    for i in range(len(A)):
        remain = A[:i] + A[i+1:]
        took_count = count[A[i]]
        sub = took_count - 1
        print(int(sum_ - sub))

if __name__ == '__main__':
    main()

Failing test case input:
8
1 2 1 4 2 2 7 1

Expected output:
4
4
4
6
4
4
6
4


Actual output:
10
10
10
12
10
10
12
10


Fixed submission (verdict: Accepted):
from collections import Counter

def main():
    N = int(input())
    A = list(map(int, input().split()))
    count = Counter(A)
    sum_ = sum([v*(v-1)/2 for v in count.values()])

    for i in range(len(A)):
        took_count = count[A[i]]
        sub = took_count - 1
        print(int(sum_ - sub))

if __name__ == '__main__':
    main()

Problem: p02732
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = list(map(int, input().split()))

count = [0] * (n + 1)
total = 0

for v in a:
    count[v] += 1

for i in range(1, n):
    total += int(count[i] * (count[i] - 1) / 2)

for v in a:
    print(total - count[v] + 1)


Failing test case input:
8
0 3 1 3 0 0 4 1

Expected output:
3
4
4
4
3
3
5
4


Actual output:
0
1
1
1
0
0
2
1


Fixed submission (verdict: Accepted):
import collections

n = int(input())
a = list(map(int, input().split()))

count = collections.Counter(a)
total = 0

for i in count.keys():
    total += int(count[i] * (count[i] - 1) / 2)

for v in a:
    print(total - count[v] + 1)

Problem: p02732
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a_list = [int(x) for x in input().split()]
a_dict = {}

for a in a_list:
  if a in a_dict.keys():
    a_dict[a] += 1
  else:
    a_dict[a] = 0

for a in a_list:
  print(a_dict[a])

Failing test case input:
5
0 1 2 1 2

Expected output:
2
1
1
1
1


Actual output:
0
1
1
1
1


Fixed submission (verdict: Accepted):
n = int(input())
a_list = [int(x) for x in input().split()]
a_dict = {}

for a in a_list:
  if a in a_dict.keys():
    a_dict[a] += 1
  else:
    a_dict[a] = 1


sum_value = sum([int((v*(v-1))/2)for v in a_dict.values()])

for a in a_list:
  print(sum_value-a_dict[a]+1)
Problem: p02732
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def f(n):
    if n==0:
        return 0
    return n*(n-1)/2
N=int(input())
A=list(map(int,input().split()))
if len(set(A))==N:
    print(0)
    exit()
d=dict()
for i in range(N):
    if A[i] not in d:
        d[A[i]]=0
    d[A[i]]+=1
for i in range(N):
    ans=0
    for j in d:
        if j==A[i]:
            ans+=f(d[j]-1)
            continue
        ans+=f(d[j])
    print(int(ans))

Failing test case input:
5
1 4 0 3 2

Expected output:
0
0
0
0
0


Actual output:
0


Fixed submission (verdict: Accepted):
def f(n):
    if n==0:
        return 0
    return n*(n-1)/2
N=int(input())
A=list(map(int,input().split()))
d=dict()
e=dict()
ans=0
for i in range(N):
    if A[i] not in d:
        d[A[i]]=0
    d[A[i]]+=1

for j in d:
    e[j]=f(d[j])
    ans+=e[j]

for i in A:
    print(int(ans-d[i]+1))

Problem: p02732
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N = int(input())
A = list(map(int,input().split()))
num = [0 for i in range(N)]
ans = []
for i in A:
    num[i-1]+=1
sums = 0
for i in A:
    num[i-1]-=1
    for j in range(N):
        if num[j] > 1:
            sums += 1/2*num[j]*(num[j]-1)
    ans.append(int(sums))
    sums = 0
    num[i-1]+=1

print(ans)

Failing test case input:
8
2 0 0 1 1 -1 0 1

Expected output:
6
4
4
4
4
6
4
4


Actual output:
[6, 4, 4, 4, 4, 6, 4, 4]


Fixed submission (verdict: Accepted):
N = int(input())
A = list(map(int,input().split()))
num = [0 for i in range(N)]
zu = 0
ans = []
for i in A:
    num[i-1]+=1
for i in range(N):
    temp = 1/2*num[i]*(num[i]-1)
    zu += temp
for i in A:
    kawari =zu
    temp1 = 1/2*num[i-1]*(num[i-1]-1)
    num[i-1] -= 1
    temp2 = 1/2*num[i-1]*(num[i-1]-1)
    kawari += -temp1+temp2
    num[i-1] += 1
    print(int(kawari))

Problem: p02732
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
l = list(map(int, input().split()))

ans = 0

k = [0 for _ in range(n+1)]

for i in range(n):
    k[l[i]] += 1
    
ll = len(k)
for i in range(ll):
    a = k[i]
    if a <= 1:
        pass
    else:
        ans += (a * (a - 1))/2
        
for i in range(n):
    a = k[l[i]]
    b = (a * (a - 1))/2
    c = a - 1
    if c <= 1:
        print(ans)
    else:
        pans = ans - b
        c = (c * (c - 1))/2
        pans = pans + c
        print(pans)

Failing test case input:
8
1 1 0 1 1 1 6 1

Expected output:
10
10
15
10
10
10
15
10


Actual output:
10.0
10.0
15.0
10.0
10.0
10.0
15.0
10.0


Fixed submission (verdict: Accepted):
n = int(input())
l = list(map(int, input().split()))

ans = 0

k = [0 for _ in range(n+1)]

for i in range(n):
    k[l[i]] += 1
    
ll = len(k)
for i in range(ll):
    a = k[i]
    if a <= 1:
        pass
    else:
        ans += (a * (a - 1))/2
        
for i in range(n):
    a = k[l[i]]
    b = (a * (a - 1))/2
    c = a - 1
    if a < 1:
        print(int(ans))
    else:
        pans = ans - b
        c = (c * (c - 1))/2
        pans = pans + c
        print(int(pans))
Problem: p02732
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = list(map(int,input().split()))
import collections
c = collections.Counter(A)

for i in A:
    temp = c.copy()
    temp[i] = temp[i]-1
    counter = 0
    for j in c.keys():
        n = temp[j]
        if n >= 2:
            counter += n*(n-1)/2
    print(counter)

Failing test case input:
8
2 0 1 6 0 0 3 1

Expected output:
4
2
3
4
2
2
4
3


Actual output:
4.0
2.0
3.0
4.0
2.0
2.0
4.0
3.0


Fixed submission (verdict: Accepted):
N = int(input())
A = list(map(int,input().split()))
import collections
c = collections.Counter(A)
counter = 0
for j in c.keys():
    if c[j]>=2:
        counter+=c[j]*(c[j]-1)/2



for i in A:
    print(int(counter-c[i]+1))

Problem: p02732
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import collections
from sys import stdin
n = int(stdin.readline().rstrip())
ass = list(map(int, stdin.readline().rstrip().split()))

c = collections.Counter(ass)

cnum =[0]*len(c)
keys = c.keys()

cs = {}
for i in keys:
    key = c[i]
    combi = key *(key-1) / 2
    cs[i] = combi

sum = sum(cs.values())

for i in range(n):
    add = c[ass[i]]-1
    adds = add *(add-1) / 2
    ans = sum - cs[ass[i]] + adds
    print(ans)


Failing test case input:
8
2 0 0 5 0 0 0 1

Expected output:
10
6
6
10
6
6
6
10


Actual output:
10.0
6.0
6.0
10.0
6.0
6.0
6.0
10.0


Fixed submission (verdict: Accepted):
import collections
from sys import stdin
n = int(stdin.readline().rstrip())
ass = list(map(int, stdin.readline().rstrip().split()))

c = collections.Counter(ass)

cnum =[0]*len(c)
keys = c.keys()

cs = {}
for i in keys:
    key = c[i]
    combi = key *(key-1) / 2
    cs[i] = combi

sum = sum(cs.values())

for i in range(n):
    add = c[ass[i]]-1
    adds = add *(add-1) / 2
    ans = sum - cs[ass[i]] + adds
    print(int(ans))

Problem: p02732
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
n = int(input())
a = list(map(int,input().split()))

a_2 = [0 for i in range(n)]
for i in range(n):
    a_2[a[i]-1] += 1

al = [0 for i in range(n)]
c = 0
for i in a_2:
    if i > 1:
        al[c] += i * (i-1) / 2
    c += 1

for i in range(n):
    f = a[i]
    t = a_2[f-1] - 1
    
    


Failing test case input:
5
3 3 3 3 3

Expected output:
6
6
6
6
6

Actual output:

Fixed submission (verdict: Accepted):
n = int(input())
a = list(map(int,input().split()))

a_2 = [0 for i in range(n)]
for i in range(n):
    a_2[a[i]-1] += 1

al = [0 for i in range(n)]
c = 0
for i in a_2:
    if i > 1:
        al[c] += i * (i-1) / 2
    c += 1

sine = sum(al)
for i in range(n):
    f = a[i]
    t = a_2[f-1] - 1
    print(int(sine-(al[f-1]-t*(t-1)/2)))
Problem: p02732
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
input=sys.stdin.readline
N = int(input())
A = list(map(int,input().split()))
nCr = {}
def cmb(n):
    if n == 1:
        return 0
    else:
        return n * n-1 /2
mydict = {}
for i in range(N):
    a = A[i]
    if a in mydict.keys():
        mydict[a] += 1
    else:
        mydict[a] = 1
s = 0
for i in range(N):
    a = A[i]
    s += cmb(a)
for i in range(N):
    a = A[i]
    x = mydict[a] - 1
    print(s-x)

Failing test case input:
8
2 0 0 5 0 0 4 1

Expected output:
6
3
3
6
3
3
6
6


Actual output:
41.5
38.5
38.5
41.5
38.5
38.5
41.5
41.5


Fixed submission (verdict: Accepted):
import sys
input=sys.stdin.readline
N = int(input())
A = list(map(int,input().split()))
def cmb(n):
    if n == 1:
        return 0
    else:
        return n * (n-1) /2
mydict = {}
for i in range(N):
    a = A[i]
    if a in mydict.keys():
        mydict[a] += 1
    else:
        mydict[a] = 1
s = 0
for i in mydict.values():
	s += cmb(i)
for i in range(N):
    a = A[i]
    x = mydict[a] - 1
    print(int(s-x))

Problem: p02732
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import collections
n=int(input())
a=list(map(int,input().split()))
c = collections.Counter(a)

a1=len(list(set(a)))

total=0
for j in range(a1):
    x=c.most_common()[j][1]
    total+=x*(x-1)/2
    print('total',total)

for i in range(n):
    ans=total-a.count(a[i])+1
    print(int(ans))

Failing test case input:
8
2 0 2 6 0 0 1 1

Expected output:
4
3
4
5
3
3
4
4


Actual output:
total 3.0
total 4.0
total 5.0
total 5.0
4
3
4
5
3
3
4
4


Fixed submission (verdict: Accepted):
import collections 
from collections import defaultdict
n=int(input())
a=list(map(int,input().split()))
c=defaultdict(int)
for s in a:
    c[s]+=1

a1=list(set(a))

total=0
for j in range(len(a1)):
    x=c[a1[j]]
    total+=x*(x-1)/2

for i in range(n):
    ans=total-c[a[i]]+1
    print(int(ans))

Problem: p02732
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
from collections import Counter

n = int(input())
a = list(map(int, input().split()))
ans = 0
c = Counter(a)  
print(c)


for m in c.values():  
    ans += int((m*(m-1))/2)  


for k in range(n):
    print(c[a[k]])
    print(ans - (c[a[k]] - 1))
    

Failing test case input:
8
2 2 1 5 1 0 4 1

Expected output:
3
3
2
4
2
4
4
2


Actual output:
Counter({1: 3, 2: 2, 5: 1, 0: 1, 4: 1})
2
3
2
3
3
2
1
4
3
2
1
4
1
4
3
2


Fixed submission (verdict: Accepted):
from collections import Counter

n = int(input())
a = list(map(int, input().split()))
ans = 0
c = Counter(a)  



for m in c.values():  
    ans += int((m*(m-1))/2)  


for k in range(n):
    
    print(ans - (c[a[k]] - 1))
Problem: p02732
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
K = list(map(int,input().split()))
A = [0]*N
print(A)
for i in range(N):
    A[K[i]-1] += 1
r = 0
for k in range(N):
    r += 0.5*(A[k]*(A[k]-1))
An =[]
for j in range(N):
    D = A[K[j]-1]-1
    An.append(int(r-(0.5*(D+1)*(D))+(0.5*D*(D-1))))
for i in range(len(An)):
    print(An[i])

Failing test case input:
8
2 2 0 3 1 -1 5 1

Expected output:
1
1
2
2
1
2
2
1


Actual output:
[0, 0, 0, 0, 0, 0, 0, 0]
1
1
2
2
1
2
2
1


Fixed submission (verdict: Accepted):
N = int(input())
K = list(map(int,input().split()))
A = [0]*N
for i in range(N):
    A[K[i]-1] += 1
r = 0
for k in range(N):
    r += 0.5*(A[k]*(A[k]-1))
An =[]
for j in range(N):
    D = A[K[j]-1]-1
    An.append(int(r-(0.5*(D+1)*(D))+(0.5*D*(D-1))))
for i in range(len(An)):
    print(An[i])

Problem: p02732
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import Counter
N = int(input())
B = [int(x) for x in input().split()]
A=Counter(B)
V, C = zip(*A.most_common())
count=0
for x in C:
  if x==0:
    break
  count+=x*(x-1)/2
for x in A:
  ans=count-C[V.index(x)]+1
  print(int(ans))

Failing test case input:
8
1 2 1 7 3 1 3 1

Expected output:
4
7
4
7
6
4
6
4


Actual output:
4
7
7
6


Fixed submission (verdict: Accepted):
from collections import Counter
N = int(input())
B = [int(x) for x in input().split()]
A=Counter(B)
V, C = zip(*A.most_common())
count=0
i=0
dict={}
for x in C:
  count+=x*(x-1)/2
  dict[V[i]]=x
  i+=1
for x in B:
  ans=count-dict[x]+1
  print(int(ans))

Problem: p02732
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
As = input().split()

dic = {}
for a in As:
  if a not in dic:
    dic[a] = 0
  dic[a] += 1

tmp = 0
for k, v in dic.items():
  if v > 1:
    tmp += v * (v-1)/2

ans = []
for a in As:
  if dic[a] > 1:
    div = dic[a] * (dic[a] - 1) / 2
    kakeru = (dic[a]-1) * (dic[a]-2)/2
    ans.append(int(tmp - div + kakeru))
  else:
    ans.append(tmp)
for a in ans:
  print(a)

Failing test case input:
8
1 0 1 3 2 0 4 1

Expected output:
2
3
2
4
4
3
4
2


Actual output:
2
3
2
4.0
4.0
3
4.0
2


Fixed submission (verdict: Accepted):
n=int(input())
As = input().split()

dic = {}
for a in As:
  if a not in dic:
    dic[a] = 0
  dic[a] += 1

tmp = 0
for k, v in dic.items():
  if v > 1:
    tmp += v * (v-1)/2

ans = []
for a in As:
  if dic[a] > 1:
    div = dic[a] * (dic[a] - 1) / 2
    kakeru = (dic[a]-1) * (dic[a]-2)/2
    ans.append(int(tmp - div + kakeru))
  else:
    ans.append(int(tmp))
for a in ans:
  print(a)