Problem p03848 (python)

Fixed submission:
from collections import Counter

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

c_al = Counter(al)

if n % 2 == 0:
    for k,v in c_al.items():
        if v != 2:
            print(0)
            exit()
    print(pow(2, n // 2, 10 ** 9 + 7))

elif n % 2 != 0:
    for k, v in c_al.items():
        if k == 0:
            if v != 1:
                print(0)
                exit()
        elif v != 2:
            print(0)
            exit()
    print(pow(2, n // 2, 10 ** 9 + 7))

Buggy submission (verdict: Runtime Error):
from collections import Counter

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

c_al = Counter(al)
print(c_al)
mod = int(10**9 + 7)

if n % 2 == 0:
    for k,v in c_al.items():
        if v != 2:
            print(0)
            exit()
    print((2 ** (n / 2)) % mod)
elif n % 2 != 0:
    for k, v in c_al.items():
        if k == 0:
            if v != 1:
                print(0)
                exit()
        elif v != 2:
            print(0)
            exit()
    print((2 ** (n // 2)) % mod)

Buggy submission (verdict: Runtime Error):
from collections import Counter

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

c_al = Counter(al)
mod = 10**9 + 7

if n % 2 == 0:
    for k,v in c_al.items():
        if v != 2:
            print(0)
            exit()
    print(int((2 ** (n / 2)) % mod))
elif n % 2 != 0:
    for k, v in c_al.items():
        if k == 0:
            if v != 1:
                print(0)
                exit()
        elif v != 2:
            print(0)
            exit()
    print(int((2 ** (n // 2)) % mod))

Buggy submission (verdict: Runtime Error):
from collections import defaultdict, Counter

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

c_al = Counter(al)
mod = 10**9 + 7

if n % 2 == 0 and 0 not in c_al.values():
    print(int((2 ** (n / 2)) % mod))
elif n % 2 != 0 and c_al[0] == 1:
    print(int((2 ** (n // 2)) % mod))
else:
    print(0)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict, Counter

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

c_al = Counter(al)
mod = 10**9 + 7

if n % 2 == 0 and 0 not in c_al.values():
    print((2 ** (n / 2)) % mod)
elif n % 2 != 0 and c_al[0] == 1:
    print((2 ** (n // 2)) % mod)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict,Counter
n = int(input())
al = list(map(int, input().split()))

c_al  = Counter(al)

if n % 2 == 0 and 0 not in c_al.values():
    print(int(2**(n/2))%((10**9) + 7))
elif n % 2 != 0 and c_al[0] == 1:
    print(int(2 ** (n // 2))%((10**9) + 7))
else:
    print(0)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict,Counter
n = int(input())
al = list(map(int, input().split()))

c_al  = Counter(al)

if n % 2 == 0 and 0 not in c_al.values():
    print(int(2**(n/2))%(10**9) + 7)
elif n % 2 != 0 and c_al[0] == 1:
    print(int(2 ** (n // 2))%(10**9) + 7)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict,Counter
n = int(input())
al = list(map(int, input().split()))

c_al  = Counter(al)

if n % 2 == 0 and 0 not in c_al.values():
    print(int(2**(n/2)))
elif n % 2 != 0 and c_al[0] == 1:
    print(int(2 ** (n // 2)))
else:
    print(0)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict,Counter
n = int(input())
al = list(map(int, input().split()))

c_al  = Counter(al)

if n % 2 == 0 and 0 not in c_al.values():
    print(int(2**(n/2)))
elif n % 2 != 0 and c_al[0] == 1:
    print(int(2 ** ((n // 2))))
else:
    print(0)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict,Counter
n = int(input())
al = list(map(int, input().split()))

c_al  = Counter(al)

if n % 2 == 0 and 0 not in c_al.values():
    print(int(2**(n/2)))
elif n % 2 != 0 and c_al[0] == 1:
    print(int(2 ** ((n // 2))))

Buggy submission (verdict: Runtime Error):
from collections import Counter, defaultdict, deque


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

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

if n == 1 and al[0] == 0:
    print(1)
elif n == 2:
    if 0 not in al:
        print(2)
    else:
        print(0)

if n % 2 == 0:
    lst = [0] * n
    for i in range(1, n):
        x = (al[i - 1] + n - 1) / 2
        y = x - al[i - 1]
        # print(x,y)
        # print(n-x-1,x)
        lst[int(n - x - 1)] += 1
        lst[int(x)] += 1
        if (lst[int(n - x - 1)] or lst[int(x)]) >= 3:
            print(0)
            exit()
    # print(lst)
    if 0 not in lst:
        print(int(2 ** (n / 2)) % ((10 ** 9) + 7))
    else:
        print(0)
else:
    lst = [0] * n
    for i in range(1, n):
        x = (al[i - 1] + n - 1) / 2
        y = x - al[i - 1]
        # print(x,y)
        # print(n - x - 1, x)
        if x == y:
            lst[int(x)] += 1
        else:
            lst[int(n - x - 1)] += 1
            lst[int(x)] += 1
        if (lst[int(n - x - 1)] or lst[int(x)]) >= 3:
            print(0)
            exit()
    # print(lst)
    if 0 not in lst:
        print(int(2 ** ((n - 1) / 2)) % ((10 ** 9) + 7))
    else:
        print(0)

Buggy submission (verdict: Runtime Error):
from collections import Counter, defaultdict, deque


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

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

if n == 1 and al[0] == 0:
    print(1)
elif n == 2:
    if 0 not in al:
        print(2)
    else:
        print(0)

if n % 2 == 0:
    lst = [0] * n
    for i in range(1, n):
        x = (al[i - 1] + n - 1) / 2
        y = x - al[i - 1]
        # print(x,y)
        # print(n-x-1,x)
        lst[int(n - x - 1)] += 1
        lst[int(x)] += 1
        if (lst[int(n - x - 1)] or lst[int(x)]) >= 3:
            print(0)
            exit()
    # print(lst)
    if 0 not in lst:
        print(int(2 ** (n / 2)) % ((10 ** 9) + 7))
    else:
        print(0)
else:
    lst = [0] * n
    for i in range(1, n):
        x = (al[i - 1] + n - 1) / 2
        y = x - al[i - 1]
        # print(x,y)
        # print(n - x - 1, x)
        lst[int(n - x - 1)] += 1
        lst[int(x)] += 1
        if (lst[int(n - x - 1)] or lst[int(x)]) >= 3:
            print(0)
            exit()
    # print(lst)
    if 0 not in lst:
        print(int(2 ** ((n - 1) / 2)) % ((10 ** 9) + 7))
    else:
        print(0)

Buggy submission (verdict: Runtime Error):
from collections import Counter, defaultdict, deque

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

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

if n % 2 == 0:
    lst = [0] * n
    for i in range(1, n):
        x = (al[i - 1] + n - 1) / 2
        y = x - al[i - 1]
        # print(x,y)
        # print(n-x-1,x)
        lst[int(n - x - 1)] += 1
        lst[int(x)] += 1
        if (lst[int(n - x - 1)] or lst[int(x)]) >= 3:
            print(0)
            exit()
    # print(lst)
    if 0 not in lst:
        print(int(2 ** (n / 2)) % ((10 ** 9) + 7))
    else:
        print(0)
else:
    lst = [0] * n
    for i in range(1, n):
        x = (al[i - 1] + n - 1) / 2
        y = x - al[i - 1]
        # print(x,y)
        # print(n - x - 1, x)
        lst[int(n - x - 1)] += 1
        lst[int(x)] += 1
        if (lst[int(n - x - 1)] or lst[int(x)]) >= 3:
            print(0)
            exit()
    # print(lst)
    if 0 not in lst:
        print(int(2 ** ((n - 1) / 2)) % ((10 ** 9) + 7))
    else:
        print(0)

Buggy submission (verdict: Runtime Error):
from collections import Counter, defaultdict, deque
n = int(input())
#n,a,b = map(int,input().split())
# al = list(map(int,input().split()))

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

if n % 2 == 0:
    lst = [0]*n
    for i in range(1,n):
        x = (al[i-1]+n-1)/2
        y = x -al[i-1]
        #print(x,y)
        #print(n-x-1,x)
        lst[int(n-x-1)] += 1
        lst[int(x)] += 1
        if (lst[int(n - x - 1)] or lst[int(x)]) >= 3:
            print(0)
            exit()
    #print(lst)
    if not 0 in lst:
        print(int(2**(n/2))%((10**9)+7))
    else:
        print(0)
else:
    lst = [0] * n
    for i in range(1, n):
        x = (al[i - 1] + n - 1) / 2
        y = x - al[i - 1]
        # print(x,y)
        #print(n - x - 1, x)
        lst[int(n - x - 1)] += 1
        lst[int(x)] += 1
        if (lst[int(n - x - 1)] or lst[int(x)]) >= 3:
            print(0)
            exit()
    #print(lst)
    if not 0 in lst:
        print(int(2 ** ((n-1) / 2))%((10**9)+7))
    else:
        print(0)