ZhenlongDai/ACPR huggingface dataset:
Problem: p03818
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = list(map(int, input().split()))
a.sort()
c = 0
e = 0
i = 0
while True:
    c += 1
    cai = 1
    while i != n - 1 and a[i] == a[i + 1]:
        cai += 1
        print(i)
        if i != n - 1:
            i += 1
        else:
            break
    if cai % 2 == 0:
        e += 1
    if i != n - 1:
        i += 1
    else:
        break
ans = c - (e % 2)
print(ans)


Failing test case input:
5
1 2 1 3 7

Expected output:
3

Actual output:
0
3


Fixed submission (verdict: Accepted):
n = int(input())
a = list(map(int, input().split()))
a.sort()
c = 0
e = 0
i = 0
while True:
    c += 1
    cai = 1
    while i != n - 1 and a[i] == a[i + 1]:
        cai += 1
        if i != n - 1:
            i += 1
        else:
            break
    if cai % 2 == 0:
        e += 1
    if i != n - 1:
        i += 1
    else:
        break
ans = c - (e % 2)
print(ans)

Problem: p03818
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
input()
a = [0] * (100000 + 1)

for i in map(int, input().split()):
    a[i] += 1
    if a[i] == 3:
        a[i] >>= 1

c = [0, a.count(1), a.count(2)]

ans = 0
ans += (c[2] >> 1) << 1
ans += c[1]
ans -= c[2] & 1

print(ans)


Failing test case input:
5
1 2 1 3 7

Expected output:
3

Actual output:
2


Fixed submission (verdict: Accepted):
input()
a = [0] * (100000 + 1)

for i in map(int, input().split()):
    a[i] += 1
    if a[i] == 3:
        a[i] >>= 1

c = [0, a.count(1), a.count(2)]

ans = 0
ans += (c[2] >> 1) << 1
ans += c[1]

print(ans)

Problem: p03818
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
al = list(map(int, input().split())) 
al = set(al)
if len(al)%2 == 0:
    print(len(al))
else:
    print(len(al)-1)


Failing test case input:
5
1 2 1 3 7

Expected output:
3

Actual output:
4


Fixed submission (verdict: Accepted):
n = int(input())
al = list(map(int, input().split())) 
al = set(al)
if len(al)%2 == 0:
    print(len(al)-1)
else:
    print(len(al))
Problem: p03818
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N = I()
    A = LI()

    cnt = collections.Counter(A)
    
    
    
    
    
    
    
    
    
    print(len(cnt))

if __name__ == '__main__':
    resolve()


Failing test case input:
5
1 2 1 3 7

Expected output:
3

Actual output:
4


Fixed submission (verdict: Accepted):
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N = I()
    A = LI()

    cnt = collections.Counter(A)
    
    
    for i in cnt.keys():
        if cnt[i] % 2 == 0:
            cnt[i] = 2
        else:
            cnt[i] = 1

    ans = 0
    even_num = [i for i in cnt.keys() if cnt[i] == 2]
    
    
    if len(even_num) % 2 == 0:
        ans = len(cnt)
    else:
        ans = len(cnt) - 1

    print(ans)

if __name__ == '__main__':
    resolve()

Problem: p03818
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import Counter

input()
c = Counter(map(int, input().split()))
print(len(c))


Failing test case input:
5
1 2 1 3 7

Expected output:
3

Actual output:
4


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

input()
c = Counter(map(int, input().split()))
print((len(c) - 1)

Problem: p03818
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import Counter
N=int(input())
A = list(map(int,input().split()))
Ac = Counter(A)
dupsum = 0
dupnum = 0
for v in Ac.values():
    if v > 1:
        dupsum += v-1
        dupnum += 1
if dupnum == 1:
    print(dupsum)
else:
    print(dupsum-1)

Failing test case input:
5
1 2 1 3 7

Expected output:
3

Actual output:
1


Fixed submission (verdict: Accepted):
from collections import Counter
N=int(input())
A = list(map(int,input().split()))
Ac = Counter(A)
kind = len(Ac)
Av = sum(i-1 for i in Ac.values() if i != 1)
if Av%2 == 0:
    print(kind)
else:
    print(kind-1)
Problem: p03818
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

def LI(): return list(map(int, input().split()))
def II(): return int(input())
def LS(): return input().split()
def S(): return input()


def main():
    n = II()
    s = set(LI())
    return len(s) | 1


print(main())


Failing test case input:
5
1 2 1 3 7

Expected output:
3

Actual output:
5


Fixed submission (verdict: Accepted):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

def LI(): return list(map(int, input().split()))
def II(): return int(input())
def LS(): return input().split()
def S(): return input()


def main():
    n = II()
    s = set(LI())
    l = len(s)
    if l % 2 == 1:
        return l
    return l - 1


print(main())

Problem: p03818
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import Counter
import heapq

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

x = []
for k in a:
    if a[k] > 1:
        x.append(-(a[k] - 1))

heapq.heapify(x)

while len(x) > 1:
    u = - heapq.heappop(x)
    v = - heapq.heappop(x)
    n -= v * 2
    d = u - v
    if d > 0:
        heapq.heappush(x, -d)

if len(x) > 0:
    n -= heapq.heappop(x) * 2
    pass

print(n)



Failing test case input:
5
1 2 1 3 7

Expected output:
3

Actual output:
7


Fixed submission (verdict: Accepted):
from collections import Counter
import heapq
 
n = int(input())
a = Counter(map(int, input().split()))
 
x = []
for k in a:
    if a[k] > 1:
        x.append(-(a[k] - 1))
 
heapq.heapify(x)
 
while len(x) > 1:
    u = abs(heapq.heappop(x))
    v = abs(heapq.heappop(x))
    n -= min(v, u) * 2
    d = abs(u - v)
    if d > 0:
        heapq.heappush(x, -d)
 
if len(x) > 0:
    p = abs(heapq.heappop(x))
    n -= p + p % 2
 
print(n)
Problem: p00008
Buggy submission (Python3, verdict: Wrong Answer):
num = int(input())
count = 0
for a in range(10):
	for b in range(10):
		for c in range(10):
			for d in range(10):
				if a+b+c+d==num:
					count+=1
print(int(count))

Failing test case input:
35
34

Expected output:
4
10


Actual output:
4


Fixed submission (verdict: Accepted):
while True:
	try:
		num = int(input())
		count = 0
		for a in range(10):
			for b in range(10):
				for c in range(10):
					for d in range(10):
						if a+b+c+d==num:
							count+=1
		print(int(count))
	except:
		break

Problem: p00008
Buggy submission (Python3, verdict: Wrong Answer):
s = int(input())
results=set()
for a in range(10):
    for b in range(10):
        for c in range(10):
            d = s-a-b-c
            if d<0:break
            if d<=9: results.add((a,b,c,d))
print(len(results))

Failing test case input:
35
25

Expected output:
4
348


Actual output:
4


Fixed submission (verdict: Accepted):
import sys



def solve():
    for s in map(int,sys.stdin):
        results=set()
        for a in range(10):
            for b in range(10):
                for c in range(10):
                    d = s-a-b-c
                    if d<0:break
                    if d<=9: results.add((a,b,c,d))
        print(len(results))
solve()

Problem: p00008
Buggy submission (Python3, verdict: Wrong Answer):
n = int(input())
cnt = 0
for i in range(10):
    for j in range(10):
        for k in range(10):
            for l in range(10):
                if i+j+k+l == n:
                    cnt += 1
print(cnt)

Failing test case input:
35
38

Expected output:
4
0


Actual output:
4


Fixed submission (verdict: Accepted):
while True:
    try:
        n = int(input())
        cnt = 0
        for i in range(10):
            for j in range(10):
                for k in range(10):
                    for l in range(10):
                        if i+j+k+l == n:
                            cnt += 1
        print(cnt)
    except:
        break

Problem: p00008
Buggy submission (Python3, verdict: Wrong Answer):
n = int(input())

def rec(j,s):
    if s > n:
        return 0
    if s == n:
        return 1
    if j == 0:
        return 0
    v = 0
    for i in range(10):
        v += rec(j-1, s + i)
    return v

print(rec(4,0))

Failing test case input:
35
50

Expected output:
4
0


Actual output:
4


Fixed submission (verdict: Accepted):
import sys


def rec(j,s):
    if s > n:
        return 0
    if s == n:
        return 1
    if j == 0:
        return 0
    v = 0
    for i in range(10):
        v += rec(j-1, s + i)
    return v

n = sys.stdin.readline()
while n:
    n = int(n)
    print(rec(4,0))
    n = sys.stdin.readline()
Problem: p00008
Buggy submission (Python3, verdict: Wrong Answer):
import itertools
def combination(n):
 c=0
 for i in itertools.product(range(10),repeat=4):
  (a,b,c,d)=i
  if a+b+c+d==n:
   c+=1
 return c

while True:
 try:
  n=int(input())
  combination(n)
 except EOFError:
  break

Failing test case input:
35
21

Expected output:
4
592


Actual output:

Fixed submission (verdict: Accepted):
import itertools
def combination(n):
 m=0
 for i in itertools.product(range(10),repeat=4):
  (a,b,c,d)=i
  if a+b+c+d==n:
   m+=1
 return m

while True:
 try:
  n=int(input())
  print(combination(n))
 except EOFError:
  break

Problem: p00008
Buggy submission (Python3, verdict: Wrong Answer):
user = input()
n = int(user)
num = 0
for a in range(10):
    for b in range(10):
        for c in range(10):
            for d in range(10):
                if(n == a + b + c + d):
                    num += 1

print(num)

Failing test case input:
35
15

Expected output:
4
592


Actual output:
4


Fixed submission (verdict: Accepted):
import sys

for user in sys.stdin:
    n = int(user)
    num = 0
    for a in range(10):
        for b in range(10):
            for c in range(10):
                for d in range(10):
                    if(n == a + b + c + d):
                        num += 1

    print(num)

Problem: p00008
Buggy submission (Python3, verdict: Wrong Answer):
n = int(input())
ans = 0
table = [[a,b,c,d] for a in range(10) for b in range(10) for c in range(10) for d in range(10)]
for abcd in table:
    ans += sum(abcd) == n
print(ans)


Failing test case input:
35
-6

Expected output:
4
0


Actual output:
4


Fixed submission (verdict: Accepted):
while True:
    try:
        n = int(input())
    except:
        break
    ans = 0
    table = [[a,b,c,d] for a in range(10) for b in range(10) for c in range(10) for d in range(10)]
    for abcd in table:
        ans += sum(abcd) == n
    print(ans)

Problem: p00008
Buggy submission (Python3, verdict: Wrong Answer):
n = int(input())
count = 0
for i in range(10):
    for j in range(10):
        for k in range(10):
            for l in range(10):
                if i + j + k + l == n:
                    count += 1
print(count)

Failing test case input:
35
47

Expected output:
4
0


Actual output:
4


Fixed submission (verdict: Accepted):
import sys
for line in sys.stdin:
    n = int(line)
    count = 0
    for i in range(10):
        for j in range(10):
            for k in range(10):
                for l in range(10):
                    if i + j + k + l == n:
                        count += 1
    print(count)
Problem: p00008
Buggy submission (Python3, verdict: Wrong Answer):
lst=[0 for i in range(50)]
for a in range(10):
    for b in range(10):
        for c in range(10):
            for d in range(10):
                lst[a+b+c+d] += 1
while 1:
    try:
        print(lst[int(input())])
    except:
        break


Failing test case input:
35
-14

Expected output:
4
0


Actual output:
4
1


Fixed submission (verdict: Accepted):
lst=[0 for i in range(51)]
for a in range(10):
    for b in range(10):
        for c in range(10):
            for d in range(10):
                lst[a+b+c+d] += 1
while 1:
    try:
        print(lst[int(input())])
    except:
        break

Problem: p00008
Buggy submission (Python3, verdict: Wrong Answer):
import itertools
def combination(n):
 m=0
 for i in itertools.product(range(10),repeat=4):
  (a,b,c,d)=i
  if a+b+c+d==n:
   m+=1
 return m

while True:
 try:
  n=int(input())
  combination(n)
 except EOFError:
  break

Failing test case input:
35
4

Expected output:
4
35


Actual output:

Fixed submission (verdict: Accepted):
import itertools
def combination(n):
 m=0
 for i in itertools.product(range(10),repeat=4):
  (a,b,c,d)=i
  if a+b+c+d==n:
   m+=1
 return m

while True:
 try:
  n=int(input())
  print(combination(n))
 except EOFError:
  break

Problem: p00008
Buggy submission (Python3, verdict: Wrong Answer):
import sys
import math as mas

n=int(input())
out=0
for i in range(10):
	for j in range(10):
		for k in range(10):
			for l in range(10):
				if(i+j+k+l==n):out+=1
print(out)





Failing test case input:
35
6

Expected output:
4
84


Actual output:
4


Fixed submission (verdict: Accepted):
import sys
import math as mas

x=[0]*60
for i in range(10):
	for j in range(10):
		for k in range(10):
			for l in range(10):
				x[i+j+k+l]+=1
for i in sys.stdin:
	print(x[int(i)])

Problem: p00008
Buggy submission (Python3, verdict: Wrong Answer):
n = int(input())
cnt = 0
for i in range(10):
    for j in range(10):
        for k in range(10):
            for l in range(10):
                if i+j+k+l == n:
                    cnt += 1
                    print(i,j,k,l)
print(cnt)

Failing test case input:
35
13

Expected output:
4
480


Actual output:
8 9 9 9
9 8 9 9
9 9 8 9
9 9 9 8
4


Fixed submission (verdict: Accepted):
while True:
    try:
        n = int(input())
        cnt = 0
        for i in range(10):
            for j in range(10):
                for k in range(10):
                    for l in range(10):
                        if i+j+k+l == n:
                            cnt += 1
        print(cnt)
    except:
        break
Problem: p00008
Buggy submission (Python3, verdict: Wrong Answer):
n=int(input())
d=0
ans=0
for i in range(10):
    c=0
    for j in range(10):
        b=0
        for f in range(10):
            a=0
            for e in range(10):
                if a+b+c+d==n:
                    ans+=1
                a+=1
            b+=1
        c+=1
    d+=1
print(ans)



Failing test case input:
35
5

Expected output:
4
56


Actual output:
4


Fixed submission (verdict: Accepted):
while True:
    try:n=int(input())
    except:break
    ans=0
    for i in range(10):
        for j in range(10):
           for f in range(10):
                for e in range(10):
                    if i+j+f+e==n:
                        ans+=1

    print(ans)

Problem: p00008
Buggy submission (Python3, verdict: Wrong Answer):
n=int(input())
print(len([[a,b,c,d]for a in range(10)for b in range(10)for c in range(10)for d in range(10)if a+b+c+d==n]))

Failing test case input:
35
26

Expected output:
4
282


Actual output:
4


Fixed submission (verdict: Accepted):
import sys
r = range(10)
for l in sys.stdin: print(len([[a,b,c,d]for a in r for b in r for c in r for d in r if a+b+c+d==int(l)]))

Problem: p00008
Buggy submission (Python3, verdict: Wrong Answer):
import sys
def count(number) :
    result = 0
    for a in range(10) :
        for b in range(10) :
            for c in range(10) :
                for d in range(10) :
                    if a + b + c + d == 35 : result += 1
    return result

for make in sys.stdin : print(count(make))

Failing test case input:
35
9

Expected output:
4
220


Actual output:
4
4


Fixed submission (verdict: Accepted):
import sys
def count(number) :
    Ranges = [(a, b, c, d) for a in range(10) for b in range(10) for c in range(10) for d in range(10) if a + b + c + d == number]
    return len(Ranges)

for make in sys.stdin : print(count(int(make)))

Problem: p00008
Buggy submission (Python3, verdict: Wrong Answer):
ans=[0]*51
for a in range(10):
	for b in range(10):
		for c in range(10):
			for d in range(10):
				ans[sum([a,b,c,d])] += 1 
while True:
	try:print(sum[int(imput())])
	except:break


Failing test case input:
35
41

Expected output:
4
0


Actual output:

Fixed submission (verdict: Accepted):
ans=[0]*51
for a in range(10):
	for b in range(10):
		for c in range(10):
			for d in range(10):
				ans[sum([a,b,c,d])] += 1 
while True:
	try:print(ans[int(input())])
	except:break

Problem: p00008
Buggy submission (Python3, verdict: Wrong Answer):
n=int(input())
cnt=0
for i in range(10):
    for j in range(10):
        for k in range(10):
            for l in range(10):
                if i+j+k+l==n:
                    cnt=cnt+1

print(cnt)

Failing test case input:
35
-1

Expected output:
4
0


Actual output:
4


Fixed submission (verdict: Accepted):
import sys
for line in sys.stdin:
    n=int(line)
    cnt=0
    for i in range(10):
        for j in range(10):
            for k in range(10):
                for l in range(10):
                    if i+j+k+l==n:
                        cnt=cnt+1
    print(cnt)
Problem: p00008
Buggy submission (Python3, verdict: Wrong Answer):
n=int(input())
a,b,c,d=0,0,0,0
ans=0
for i in range(10):
    c=0
    for j in range(10):
        b=0
        for f in range(10):
            a=0
            for e in range(10):
                if a+b+c+d==n:
                    ans+=1
                a+=1
            b+=1
        c+=1
    d+=1
print(ans)


Failing test case input:
35
48

Expected output:
4
0


Actual output:
4


Fixed submission (verdict: Accepted):
while True:
    try:n=int(input())
    except:break
    ans=0
    for i in range(10):
        for j in range(10):
           for f in range(10):
                for e in range(10):
                    if i+j+f+e==n:
                        ans+=1

    print(ans)

Problem: p00008
Buggy submission (Python3, verdict: Wrong Answer):
n = int(input().rstrip())
cnt = 0

for a in range(10):
    for b in range(10):
        for c in range(10):
            for d in range(10):
                if a + b + c + d == n:
                    cnt = cnt + 1

print(str(cnt))

Failing test case input:
35
10

Expected output:
4
282


Actual output:
4


Fixed submission (verdict: Accepted):
while True:
    try:
        cnt = 0
        n = int(input())
        for a in range(10):
            for b in range(10):
                for c in range(10):
                    for d in range(10):
                        if a + b + c + d == n:
                            cnt = cnt + 1

        print(str(cnt))
    except:
        break

Problem: p00008
Buggy submission (Python3, verdict: Wrong Answer):
num=int(input())
sum=0
Range=10
for a in range(Range):
    for b in range(Range):
        for c in range(Range):
            for d in range(Range):
                if num==a+b+c+d:
                    sum+=1
print(sum)

Failing test case input:
35
-8

Expected output:
4
0


Actual output:
4


Fixed submission (verdict: Accepted):
while True:
    try:
        num=int(input())
    except:
        break
    sum=0
    Range=10
    for a in range(Range):
        for b in range(Range):
            for c in range(Range):
                for d in range(Range):
                    if num==a+b+c+d:
                        sum+=1
    print(sum)

Problem: p00008
Buggy submission (Python3, verdict: Wrong Answer):
from itertools import product

while True:
    try:
        n = int(input)
    except:
        break
    count = sum(a + b + c + d == n for a, b, c, d in product(range(10), repeat=4))
    print(count)

Failing test case input:
35
-13

Expected output:
4
0


Actual output:

Fixed submission (verdict: Accepted):
from itertools import product

while True:
    try:
        n = int(input())
    except:
        break
    count = sum(a + b + c + d == n for a, b, c, d in product(range(10), repeat=4))
    print(count)
Problem: p00008
Buggy submission (Python3, verdict: Wrong Answer):
n=int(input())
cnt=0
for i in range(10):
    for j in range(10):
        for k in range(10):
            for l in range(10):
                if i+j+k+l==n:
                    cnt=cnt+1
                    print(i,j,k,l)

print(cnt)

Failing test case input:
35
44

Expected output:
4
0


Actual output:
8 9 9 9
9 8 9 9
9 9 8 9
9 9 9 8
4


Fixed submission (verdict: Accepted):
import sys
for line in sys.stdin:
    n=int(line)
    cnt=0
    for i in range(10):
        for j in range(10):
            for k in range(10):
                for l in range(10):
                    if i+j+k+l==n:
                        cnt=cnt+1
    print(cnt)

Problem: p00008
Buggy submission (Python3, verdict: Wrong Answer):
n=int(input())
count=0
for a in range(10):
	for b in range(10):
		for c in range(10):
			for d in range(10):
				ans = a + b + c + d 
				if(n == ans):
					count += 1 
print(count)


Failing test case input:
35
18

Expected output:
4
670


Actual output:
4


Fixed submission (verdict: Accepted):
ans=[0]*51
for a in range(10):
	for b in range(10):
		for c in range(10):
			for d in range(10):
				ans[sum([a,b,c,d])] += 1 
while True:
	try:print(ans[int(input())])
	except:break
Problem: p03665
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n,p = map(int,input().split())
a = [int(i) for i in input().split()]
odd = 0
evil = 0
for i in range(n):
    if i % 2== 0:
        evil += 1
    else:
        odd += 1
if p==1 and odd ==0:
    print(0)
elif evil ==n:
    print(pow(2,n))
else:
    print(pow(2,n-1))

Failing test case input:
1 1
67

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):
n,p = map(int,input().split())
a = [int(i) for i in input().split()]
odd = 0
evil = 0
for i in a:
    if i % 2== 0:
        evil += 1
    else:
        odd += 1
if p==1 and odd ==0:
    print(0)
elif evil ==n:
    print(pow(2,n))
else:
    print(pow(2,n-1))

Problem: p03665
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,P = map(int,input().split())
A = [int(x) for x in input().split()]

odd = sum(x&1 for x in A)

if odd:
  
  answer = 2**(N-1)
else:
  answer = (2 ** N) * P

print(answer)

Failing test case input:
1 1
50

Expected output:
0

Actual output:
2


Fixed submission (verdict: Accepted):
N,P = map(int,input().split())
A = [int(x) for x in input().split()]

odd = sum(x&1 for x in A)

if odd:
  
  answer = 2**(N-1)
else:
  answer = (2 ** N) * (1-P)

print(answer)

Problem: p03665
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, P = map(int,input().split())
A = list(map(int,input().split()))
odd = len(list(filter(lambda x:x%2==1 ,A)))
even = N-odd
if odd == 0:
    print(2**(N))
else:
    print(2**(N-1))


Failing test case input:
1 1
42

Expected output:
0


Actual output:
2


Fixed submission (verdict: Accepted):
N, P = map(int,input().split())
A = list(map(int,input().split()))
odd = len(list(filter(lambda x:x%2==1 ,A)))
even = N-odd
if odd == 0:
    if P == 0:print(2**(N))
    else:print(0)
else:
    print(2**(N-1))

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

even_num=0
odd_num=0

for a in A:
    if a%2==0:
        even_num+=1
    else:
        odd_num+=1

ev_case = 2**even_num


from math import factorial

res=0
for i in range(P,odd_num+1,2):                                                                   res += factorial(odd_num) / factorial(i) / factorial(odd_num - i)

print(ev_case*res)

Failing test case input:
45 1
17 55 85 55 74 20 90 67 40 121 39 89 91 50 16 38 14 43 5 68 25 9 89 71 41 16 53 11 61 15 85 72 62 13 42 26 36 66 4 87 59 91 4 24 26

Expected output:
17592186044416


Actual output:
17592186044416.0


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

even_num=0
odd_num=0

for a in A:
    if a%2==0:
        even_num+=1
    else:
        odd_num+=1

ev_case = 2**even_num


from math import factorial

res=0
for i in range(P,odd_num+1,2):                                                                   res += factorial(odd_num) / factorial(i) / factorial(odd_num - i)

print(int(ev_case*res))
Problem: p03665
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, P = map(int, input().split())
A = map(int, input().split())

n_even = len(list(filter(lambda x: x % 2 == 0, A)))
n_odd = N - n_even
ans = 2 ** max(0, n_odd - 1) * 2 ** n_even
if P == 0 and n_odd == 0:
    print(0)
else:
    print(ans)


Failing test case input:
1 1
42

Expected output:
0


Actual output:
2


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

n_even = len(list(filter(lambda x: x % 2 == 0, A)))
n_odd = N - n_even
ans = (2 ** max(0, n_odd - 1)) * (2 ** n_even)
if P == 1 and n_odd == 0:
    print(0)
else:
    print(ans)

Problem: p03665
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
def main():
    n,p = map(int,input().split())
    ls = [int(x) for x in range(n)]
    flg = False
    for i in range(n):
        if ls[i]%2==1:
            flg = True
            break
    if flg :
        print(2**(n-1))

    else:
        if p == 0:
            print(0)
        else:
            print(2**n)
if __name__ == "__main__":
    main()

Failing test case input:
1 1
42

Expected output:
0


Actual output:
2


Fixed submission (verdict: Accepted):
def main():
    n,p = map(int,input().split())
    ls = [int(x) for x in input().split()]
    flg = False

    for i in range(n):
        if ls[i]%2==1:
            flg = True
            break
    if flg :
        print(2**(n-1))

    else:
        if p == 0:
            print(2**n)
        else:
            print(0)
if __name__ == "__main__":
    main()

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

e = sum(x % 2 == 0 for x in a)
o = sum(x % 2 == 1 for x in a)

if n == 1:
    ans = int(a[0] % 2 == p)
else:
    ans = (2 ** o) 

print(ans)


Failing test case input:
45 1
6 55 85 55 138 20 90 67 40 70 39 89 91 50 16 24 14 43 24 8 25 9 89 15 66 16 6 11 61 8 167 72 62 67 42 26 36 66 4 140 59 37 4 24 4

Expected output:
17592186044416


Actual output:
262144


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

e = sum(x % 2 == 0 for x in a)
o = sum(x % 2 == 1 for x in a)

if n == 1:
    ans = int(a[0] % 2 == p)
elif p == 1 and o == 0:
    ans = 0
else:
    ans = max((2 ** o) 

print(ans)

Problem: p03665
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,p=map(int, input().split())
A=[int(i)%2 for i in input().split()]
t=sum(A)

if t==0:
    if p==1:
        sum=0
    else:
        print(2**n)
else:
    print(2**(n-1))


Failing test case input:
1 1
50

Expected output:
0

Actual output:

Fixed submission (verdict: Accepted):
n,p=map(int, input().split())
A=[int(i)%2 for i in input().split()]
t=sum(A)

if t==0:
    if p==1:
        print(0)
    else:
        print(2**n)
else:
    print(2**(n-1))
Problem: p03665
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
odd = len([a for a in A if a %2 == 1])

if K == 0 and odd == 0:
  print(2**N)
elif K == 1 and odd == N:
  print(0)
else:
  print(2**(N-1))

Failing test case input:
1 1
42

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
odd = len([a for a in A if a %2 == 1])
 
if K == 0 and odd == 0:
  print(2**N)
elif K == 1 and odd == 0:
  print(0)
else:
  print(2**(N-1))

Problem: p03665
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,P = map(int,input().split())
A = list(map(int,input().split()))
cnt = 0
for i in range(N):
    cnt += A[i]%2
if cnt>0:
    print(2**(cnt-1))
else:
    print(0)

Failing test case input:
45 1
17 55 85 55 74 20 90 67 40 121 39 178 91 50 16 38 14 43 24 68 25 9 89 71 41 16 53 11 94 15 85 72 62 67 42 26 36 66 4 87 59 91 4 24 26

Expected output:
17592186044416


Actual output:
2097152


Fixed submission (verdict: Accepted):
N,P = map(int,input().split())
A = list(map(int,input().split()))
cnt = 0
for i in range(N):
    cnt += A[i]%2
if cnt>0:
    print(2**(N-1))
elif P==1:
    print(0)
else:
    print(2**N)

Problem: p03665
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
import math

n,p = iim()
A = iil()

if n > 1:
    even = 0
    odd = 0
    for i in A:
        if i%2 == 0:
            even += 1
        else:
            odd += 1

    p0 = 2**(odd-1)
    print(2**even*p0)
else:
    print(2 if A[0]%2 == p else 0)

Failing test case input:
1 1
67

Expected output:
1


Actual output:
2


Fixed submission (verdict: Accepted):
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
import math

n,p = iim()
A = iil()

if n > 1:
    even = 0
    odd = 0
    for i in A:
        if i%2 == 0:
            even += 1
        else:
            odd += 1
    if odd > 0:
        p0 = 2**(odd-1)
        print(2**even*p0)
    else:
        print(2**even if p == 0 else 0)
else:
    if p == 0:
        print(2 if A[0]%2 == p else 0)
    else:
        print(1 if A[0]%2 == p else 0)

Problem: p03665
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,P=map(int,input().split())
A=list(map(int,input().split()))
odd=0
for i in range(N):
  if A[i]%2==1: odd+=1
  break
if odd:
  print(2**(N-1))
elif P==1:
  print(0)
else: print(2**N)

Failing test case input:
45 1
6 55 85 55 74 20 90 67 40 70 39 89 91 50 16 24 14 43 24 8 25 9 89 45 41 16 3 11 61 15 167 72 62 67 42 26 36 66 4 87 59 91 4 24 4

Expected output:
17592186044416


Actual output:
0


Fixed submission (verdict: Accepted):
N,P=map(int,input().split())
A=list(map(int,input().split()))
odd=0
for i in range(N):
  if A[i]%2==1: odd+=1
if odd==0:
  if P==1: print(0)
  else: print(2**N)
else:
  print(2**(N-1))
Problem: p03665
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, P = map(int, input().split()) 
A = [0 if a % 2 == 0 else 1 for a in list(map(int, input().split()))]
odd = A.count(1)
even = A.count(0)

if (P == 1 and odd == 0 ):
    ans = 0
else:
    ans = 2**(len(A)) 

print(ans)

Failing test case input:
45 1
7 68 85 77 74 20 90 67 40 70 39 89 91 50 16 24 14 43 24 68 25 9 89 71 41 16 61 13 61 15 85 72 62 67 42 26 36 66 4 87 59 132 4 25 26

Expected output:
17592186044416


Actual output:
35184372088832


Fixed submission (verdict: Accepted):
N, P = map(int, input().split()) 
A = [0 if a % 2 == 0 else 1 for a in list(map(int, input().split()))]
odd = A.count(1)
even = A.count(0)

if (P == 1 and odd == 0 ):
    ans = 0
elif odd == 0:
    ans = 2**(len(A))
else:
    ans = 2**(len(A)-1)

print(ans)

Problem: p03665
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,P = [int(i) for i in input().split()]
A = [int(i)%2 for i in input().split()]

k = A.count(1)
l = A.count(0)

if P == 0:
    if k == 0:
        print(2**l)
    ans = 1
    ans = 2**(k-1+l)
else:
    if k == 0:
        print(0)
        exit()
    else:
        ans = 1
        ans = 2**(k-1+l)

print(A)


Failing test case input:
45 1
17 55 85 55 74 20 90 67 40 121 39 89 91 50 16 24 14 43 24 77 25 9 125 8 41 21 53 11 65 2 44 72 62 67 42 26 36 66 4 60 59 14 1 24 26

Expected output:
17592186044416


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


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

k = A.count(1)
l = A.count(0)

if P == 0:
    if k == 0:
        print(2**l)
        exit()
    ans = 1
    ans = 2**(k-1+l)
else:
    if k == 0:
        print(0)
        exit()
    else:
        ans = 1
        ans = 2**(k-1+l)

print(ans)

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

odd=0
even=0
for i in range(0,N):
    if A[i]%2==1:
        odd=odd+1
    else:
        even=even+1

print((2**(odd-1))*(2**(even)))

Failing test case input:
1 1
42

Expected output:
0


Actual output:
1.0


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

odd=0
even=0
for i in range(0,N):
    if A[i]%2==1:
        odd=odd+1
    else:
        even=even+1
if odd==0:
    if P==0:
        print(2**(even))
    else:
        print(0)
else:
    print((2**(odd-1))*(2**(even)))
Problem: p03665
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
N, P = sys.stdin.readline().strip().split()
As = sys.stdin.readline().strip().split()
n_even = 0
n_odd = 0
for a in As:
  if int(a)/2 == 0:
    n_even += 1
  else:
    n_odd +=1
v = 2**n_even
if n_odd == 0:
  v *= (0 if P == 1 else 1)
else:
  v *= 2**(n_odd -1)
print(v)

Failing test case input:
1 1
42

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
import sys

def biscuit(N, P, As):
    n_even = 0
    n_odd = 0
    for a in As:
      if int(a) % 2 == 0:
        n_even += 1
      else:
        n_odd +=1
    v = 2**n_even
    
    if n_odd == 0:
      v *= (0 if int(P) == 1 else 1)
    else:
      v *= 2**(n_odd -1)
    return v

N, P = sys.stdin.readline().strip().split()
As = sys.stdin.readline().strip().split()
print(biscuit(N, P, As))

Problem: p03665
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys


def input():
    return sys.stdin.readline().strip()


N, P = map(int, input().split())
A = list(map(int, input().split()))

odd = sum([a % 2 for a in A])
even = len(A) - odd

ans = (2 ** even) * (2 ** (odd - 1))

print(ans)


Failing test case input:
1 1
42

Expected output:
0


Actual output:
1.0


Fixed submission (verdict: Accepted):
import sys


def input():
    return sys.stdin.readline().strip()


N, P = map(int, input().split())
A = list(map(int, input().split()))

odd = sum([a % 2 for a in A])
even = len(A) - odd

if odd == 0 and P == 1:
    print(0)
elif odd == 0 and P == 0:
    print(2 ** even)
else:
    ans = (2 ** even) * (2 ** (odd - 1))
    print(ans)

Problem: p03665
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
def main():
    n,p = map(int,input().split())
    ls = [int(x) for x in range(n)]
    flg = False
    for i in range(n):
        if ls[i]%2==1:
            flg = True
            break
    if flg :
        print(2**(n-1))

    else:
        if p == 0:
            print(2**n)
        else:
            print(0)
if __name__ == "__main__":
    main()

Failing test case input:
1 1
67

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):
def main():
    n,p = map(int,input().split())
    ls = [int(x) for x in input().split()]
    flg = False

    for i in range(n):
        if ls[i]%2==1:
            flg = True
            break
    if flg :
        print(2**(n-1))

    else:
        if p == 0:
            print(2**n)
        else:
            print(0)
if __name__ == "__main__":
    main()

Problem: p03665
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,p=map(int, input().split())
a=list(map(int, input().split()))
total=sum( n%2 for i in a )

if total==0:
    if p==0:
        print(2**n)
    else:
        print(0)
else:
    print(2**(n-1))

Failing test case input:
1 1
42

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
n,p=map(int, input().split())
a=list(map(int, input().split()))
total=sum( i%2 for i in a )

if total==0:
    if p==0:
        print(2**n)
    else:
        print(0)
else:
    print(2**(n-1))
Problem: p03665
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
def resolve():
    
    N, P = [int(item) for item in input().split()]
    As = [int(item)%2 for item in input().split()]

    is_all_even = True
    for item in As:
        if item == 1:
            is_all_even = False
    res = 0
    if is_all_even:
        if P == 0:
            res = 2 ** N
        else:
            res = 0
    else:
        print(2**(N-1))

if __name__ == "__main__":
    resolve()


Failing test case input:
1 1
42

Expected output:
0


Actual output:

Fixed submission (verdict: Accepted):
def resolve():
    
    N, P = [int(item) for item in input().split()]
    As = [int(item)%2 for item in input().split()]

    is_all_even = True
    for item in As:
        if item == 1:
            is_all_even = False
    
    res = 0
    if is_all_even:
        if P == 0:
            res = 2 ** N
        else:
            res = 0
    else:
        res = 2**(N-1)
    
    print(res)

if __name__ == "__main__":
    resolve()

Problem: p03665
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,p = map(int,input().split())
a = list(map(lambda x:int(x)%2,input().split()))
cnt0 = a.count(0)
cnt1 = n-cnt0
if cnt0==n and p==0:
    print(2**n)
elif cnt0==0 and p==1:
    print(0)
else:
    print(2**(n-1))

Failing test case input:
1 1
50

Expected output:
0

Actual output:
1


Fixed submission (verdict: Accepted):
n,p = map(int,input().split())
a = list(map(lambda x:int(x)%2,input().split()))
cnt0 = a.count(0)
cnt1 = n-cnt0
if cnt0==n and p==0:
    print(2**n)
elif cnt0==n and p==1:
    print(0)
else:
    print(2**(n-1))

Problem: p03665
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N,P = map(int, input().split())
A = list(map(int, input().split()))
in_odd = False
for i in range(N):
    if A[i]%2:
        in_odd = True
        break
if not in_odd:
    if P == 0:
        print(0)
else:
    print(2**(N-1))

Failing test case input:
1 1
42

Expected output:
0


Actual output:

Fixed submission (verdict: Accepted):
N,P = map(int, input().split())
A = list(map(int, input().split()))
in_odd = False
for i in range(N):
    if A[i]%2:
        in_odd = True
        break
if not in_odd:
    if P:
        print(0)
    else:
        print(2**N)
else:
    print(2**(N-1))

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

import sys
input = sys.stdin.readline

def main():
    N, P = map(int, input().split())
    A = list(map(int, input().split()))

    A = list(map(lambda x: x % 2, A))
    if A.count(1):
        ans = pow(2,N-1)
    else:
        if P == 0:
            ans = pow(2,N)
        else:
            ans = pow(2,N-1)

    print(ans)

if __name__ == '__main__':
    main()


Failing test case input:
1 1
50

Expected output:
0

Actual output:
1


Fixed submission (verdict: Accepted):

import sys
input = sys.stdin.readline

def main():
    N, P = map(int, input().split())
    A = list(map(int, input().split()))

    A = list(map(lambda x: x % 2, A))
    if A.count(1):
        ans = pow(2,N-1)
    else:
        if P == 0:
            ans = pow(2,N)
        else:
            ans = 0

    print(ans)

if __name__ == '__main__':
    main()
Problem: p03665
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,p = map(int,input().split())
a = list(map(int,input().split()))
if all(a[i]%2==0 for i in range(n)):
    print(2**n)
else:
    print(2**(n-1))

Failing test case input:
1 1
42

Expected output:
0


Actual output:
2


Fixed submission (verdict: Accepted):
n,p = map(int,input().split())
a = list(map(int,input().split()))
if all(a[i]%2==0 for i in range(n)):
    if p == 0:
        print(2**n)
    else:
        print(0)
else:
    print(2**(n-1))

Problem: p03665
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,p=map(int,input().split());a=list(map(int,input().split()));b=[0,0]
for i in a:b[i%2]+=1
print(2**b[p]-p)

Failing test case input:
45 1
17 57 10 55 74 20 90 132 2 121 39 178 91 50 16 38 9 43 24 68 25 9 89 71 41 16 53 11 150 4 85 72 62 93 42 26 36 47 4 87 59 91 4 14 26

Expected output:
17592186044416


Actual output:
2097151


Fixed submission (verdict: Accepted):
n,p=map(int,input().split());a=list(map(int,input().split()));b=[0,0]
for i in a:b[i%2]+=1
if 0==b[1]:print(2**n*((p+1)%2))
else:print(2**(n-1))

Problem: p03665
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, p = map(int, input().split())

a = list(input())

if p == 1:
    print(0)

elif p == 0:
    print(2 ** n)

else:
    print(2 ** (n - 1))


Failing test case input:
45 1
7 68 85 77 74 20 90 67 40 70 39 89 91 50 16 24 14 43 24 68 45 9 89 71 41 16 61 13 61 15 85 72 62 71 42 26 36 66 4 87 59 132 4 25 26

Expected output:
17592186044416


Actual output:
0


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

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



for i in a:
    if i % 2 == 1:
        print(2 ** (n - 1))
        exit(0)

if p == 0:
    print(2 ** n)

else:
    print(0)

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

jug = True
for i in range(n):
    a[i] % 2 == 1
    jug = False
    break

if jug:
    if p == 0:
        print(2 ** n)
    else:
        print(0)

else:
    print(2 ** (n - 1))

Failing test case input:
1 1
42

Expected output:
0


Actual output:
1


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

jug = True
for i in range(n):
    if a[i] % 2 == 1:
        jug = False
        break

if jug:
    if p == 0:
        print(2 ** n)
    else:
        print(0)
else:
    print(2 ** (n - 1))

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

odd = len([a for a in A if a % 2 == 1])

if P == 1 and odd == 0:
    print(0)
if P == 0 and odd == 0 :
    print(2 ** N)
else:
    print(2 ** (N - 1))


Failing test case input:
1 1
50

Expected output:
0

Actual output:
0
1


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

odd = len([a for a in A if a % 2 == 1])

if P == 1 and odd == 0:
    print(0)
elif P == 0 and odd == 0 :
    print(2 ** N)
else:
    print(2 ** (N - 1))
Problem: p03665
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,p=map(int,input().split())
A=list(map(int,input().split()))

for i in range(n):
    A[i]%=2
one=A.count(1)
if one==n:
    print(2**n)
else:
    print(2**(n-1))

Failing test case input:
1 1
50

Expected output:
0

Actual output:
1


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

for i in range(n):
    A[i]%=2
zero=A.count(0)
if zero==n and p==0:
    print(2**n)
elif zero==n and p==1:
    print(0)
else:
    print(2**(n-1))

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

gu=0
ki=0

for aa in a:
    if aa%2==0:
        gu+=1
    else:
        ki+=1

gusu=2**gu
if ki>0:
    kisu=2**(ki-1)
else:
    kisu=1

print(gusu*kisu)














Failing test case input:
1 1
42

Expected output:
0


Actual output:
2


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

gu=0
ki=0

for aa in a:
    if aa%2==0:
        gu+=1
    else:
        ki+=1

gusu=2**gu
if ki>0:
    kisu=2**(ki-1)
else:
    kisu=1

if p==1 and ki==0:
    print(0)
    exit()

print(gusu*kisu)

Problem: p03665
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys

def biscuit(N, P, As):
    n_even = 0
    n_odd = 0
    for a in As:
      if int(a)/2 == 0:
        n_even += 1
      else:
        n_odd +=1
    v = 2**n_even
    if n_odd == 0:
      v *= (0 if int(P) == 1 else 1)
    else:
      v *= 2**(n_odd -1)
    return v

N, P = sys.stdin.readline().strip().split()
As = sys.stdin.readline().strip().split()
print(biscuit(N, P, As))

Failing test case input:
1 1
42

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
import sys

def biscuit(N, P, As):
    n_even = 0
    n_odd = 0
    for a in As:
      if int(a) % 2 == 0:
        n_even += 1
      else:
        n_odd +=1
    v = 2**n_even
    
    if n_odd == 0:
      v *= (0 if int(P) == 1 else 1)
    else:
      v *= 2**(n_odd -1)
    return v

N, P = sys.stdin.readline().strip().split()
As = sys.stdin.readline().strip().split()
print(biscuit(N, P, As))

Problem: p03665
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
input1s = input()
input2s = input()

input1 = [int(i) for i in input1s.split(' ')]
N = input1[0]
P = input1[1]
array = [int(i) for i in input2s.split(' ')]

count = 0
if(P == 0): count += 1 

for i in range(len(array)):
  for j in range(1,len(array)-i):
    
    if((array[i]+array[i+j])%2 == P):
      count += 1
      


print (count)


Failing test case input:
45 1
17 55 85 55 74 20 90 67 40 70 39 89 91 50 16 9 14 43 24 66 25 9 89 71 41 16 53 13 61 15 85 72 62 67 42 26 36 66 4 87 59 91 4 25 26

Expected output:
17592186044416


Actual output:
500


Fixed submission (verdict: Accepted):

input1s = input()
input2s = input()

input1 = [int(i) for i in input1s.split(' ')]
N = input1[0]
P = input1[1]
array = [int(i) for i in input2s.split(' ')]

count = 0

for i in range(len(array)):
  if(array[i]%2 == 1):
    count = 1

if(count == 0):
  if(P == 0): print (2**N)
  else: print(0)
else:
  print (2**(N-1))
Problem: p03665
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
def main():
    n,p = map(int,input().split())
    ls = [int(x) for x in range(n)]
    flg = False
    for i in range(n):
        if ls[i]%2==1:
            flg = True
            break
    if flg :
        print(2**(n-1))

    else:
        if p == 0:
            print(0)
        else:
            print(2**(n-1))
if __name__ == "__main__":
    main()

Failing test case input:
1 1
42

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
def main():
    n,p = map(int,input().split())
    ls = [int(x) for x in input().split()]
    flg = False

    for i in range(n):
        if ls[i]%2==1:
            flg = True
            break
    if flg :
        print(2**(n-1))

    else:
        if p == 0:
            print(2**n)
        else:
            print(0)
if __name__ == "__main__":
    main()

Problem: p03665
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,r=map(int,input().split())
c=[i%2for i in list(map(int,input().split()))]
p=sum(c)
print((2**(n-1))if p==0 else(0if r!=1else 2**n))

Failing test case input:
45 1
17 55 85 55 74 20 90 67 40 121 39 178 91 50 16 38 14 43 24 68 25 9 89 71 41 16 53 11 94 4 85 72 62 67 42 26 36 66 4 87 59 91 4 24 26

Expected output:
17592186044416


Actual output:
35184372088832


Fixed submission (verdict: Accepted):
n,r=map(int,input().split())
c=[i%2for i in list(map(int,input().split()))]
p=sum(c)
print(0if p==0 and r!=0else(2**n if p==0 and r!=1else (2**(n-1))))

Problem: p03665
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n,p = map(int,input().split())
l = [0,0]
for i in map(int,input().split()):
  l[i%2] += 1
if p:
  
  print(2**l[0]*2**(l[1]-1))
else:
  if l[1] == 0:
    print(2**l[0])
  else:
    
    print(2**l[0]*2**(l[1]-1))

Failing test case input:
1 1
50

Expected output:
0

Actual output:
1.0


Fixed submission (verdict: Accepted):
n,p = map(int,input().split())
l = [0,0]
for i in map(int,input().split()):
  l[i%2] += 1
if p:
  if l[1] == 0:
    print(0)
  else:
    
    print(2**l[0]*2**(l[1]-1))
else:
  if l[1] == 0:
    print(2**l[0])
  else:
    
    print(2**l[0]*2**(l[1]-1))

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

even = 0
odd  = 0
for a in A:
    if a % 2 == 0:
        even += 1
    else:
        odd += 1

ans = 2 ** (even + odd - 1)
if odd == 0:
    if P == 0: ans = 0
    else: ans = 2 ** even
    
print(ans)


Failing test case input:
1 1
42

Expected output:
0


Actual output:
2


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

even = 0
odd  = 0
for a in A:
    if a % 2 == 0:
        even += 1
    else:
        odd += 1

ans = 2 ** (even + odd - 1)
if odd == 0:
    if P == 1: ans = 0
    else: ans = 2 ** even
    
print(ans)