Problem p03846 (python)

Fixed submission:
N=int(input())
l=list(map(int,input().split()))
a=1
if N%2==0:
    if len(l)!=len(set(l))*2:
        a=0
else:
    if l.count(0) == 1:
        l.remove(0)
        if len(l) != 2*len(set(l)):
            a = 0
    else:
        a=0
if a:
      print((2**(N//2))%(10**9+7))
else:
      print(0)

Buggy submission (verdict: Runtime Error):
import math
n=int(input())
arr=list(map(int,input().split()))
ans=True

if n%2!=0:
    zero=0
    [zero+=1 for c in arr if c==0]
    if zero[0]!=1:
    	ans=False
    elif len(set(arr))!=int(n/2)+1:
        ans=False
else:
    if 0 in arr:
        ans=False
    elif len(set(arr))!=int(n/2):
        ans=False

if ans:
    print(2**math.floor(n/2)%((10**9)+7))
else:
    print(0)

Buggy submission (verdict: Runtime Error):
import math
n=int(input())
arr=list(map(int,input().split()))
ans=True

if n%2!=0:
    zero=0
    [zero+=1 for c in arr if c==0]
    if zero!=1:
    	ans=False
    elif len(set(arr))!=int(n/2)+1:
        ans=False
else:
    if 0 in arr:
        ans=False
    elif len(set(arr))!=int(n/2):
        ans=False

if ans:
    print(2**math.floor(n/2)%((10**9)+7))
else:
    print(0)

Buggy submission (verdict: Runtime Error):
import math
n=int(input())
arr=list(map(int,input().split()))
ans=True

if n!=0:
    if len(set(arr))!=int(n/2)+1
    ans=False
else:
    if len(set(arr))!=n/2:
    ans=False

if ans and n!=0:
    print(2**math.floor(n/2)%((10**9)+7))
else:
    print(0)

Buggy submission (verdict: Runtime Error):
import math
n=int(input())
arr=list(map(int,input().split()))
dic={}
for c in arr:
    dic.setdefault(c,0)
    dic[c]+=1
ans=True
#n is odd 5(4 2 0 2 4)
if n%2!=0:
    for c in range(0,n-1,2):
        if c==0 and dic[c]!=1:
            ans=False
        if dic[c]!=2:
            ans=False
            break
#n is even 8 (7 5 1 1 7 3 5 3)        
else:
    for c in range(1,n-1,2):
        if dic[c]!=2:
            ans=False
if ans and n!=0:
    print(2**math.floor(n/2)%((10**9)+7))
else:
    print(0)

Buggy submission (verdict: Runtime Error):
import math
n=int(input())
arr=list(map(int,input().split()))
dic={}
for c in arr:
    dic.setdefault(c,0)
    dic[c]+=1
ans=True
#n is odd 5(4 2 0 2 4)
if n%2!=0:
    for c in range(2,n-1,2):
        if dic[c]!=2:
            ans=False
            break
    if dic[0]!=1:
        ans=False
#n is even 8 (7 5 1 1 7 3 5 3)        
else:
    for c in range(1,n-1,2):
        if dic[c]!=2:
            ans=False
if ans and n!=0:
    print(2**math.floor(n/2)%((10**9)+7))
else:
    print(0)

Buggy submission (verdict: Runtime Error):
import math
n=int(input())
arr=list(map(int,input().split()))
dic={}
for c in arr:
    dic.setdefault(c,0)
    dic[c]+=1
ans=True
#n is odd 5(4 2 0 2 4)
if n%2!=0:
    if dic[0]!=1:
        ans=False
        print(0)
    for c in range(2,n-1,2):
        if dic[c]!=2:
            ans=False
            break
#n is even 8 (7 5 1 1 7 3 5 3)        
else:
    for c in range(1,n-1,2):
        if dic[c]!=2:
            ans=False
if ans and n!=0:
    print(2**math.floor(n/2)%((10**9)+7))
else:
    print(0)

Buggy submission (verdict: Runtime Error):
import math
n=int(input())
arr=list(map(int,input().split()))
dic={}
for c in arr:
    dic.setdefault(c,0)
    dic[c]+=1
ans=True
#n is odd 5(4 2 0 2 4)
if n%2!=0:
    if dic[0]!=1:
        ans=False
        print(0)
    for c in range(2,n-1,2):
        if dic[c]!=2:
            ans=False
            break
#n is even 8 (7 5 1 1 7 3 5 3)        
else:
    for c in range(1,n-1,2):
        if dic[c]!=2:
            ans=False
if ans:
    print(2**math.floor(n/2)%((10**9)+7))
else:
    print(0)

Buggy submission (verdict: Runtime Error):
n=int(input())
arr=list(map(int,input().split()))
n=len(arr)
dic={}
for c in arr:
    dic.setdefault(c,0)
    dic[c]+=1
ans=True
print(dic)
#n is odd 5(4 2 0 2 4)
if n%2!=0:
    if dic[0]!=1:
        ans=False
    for c in range(2,n-1,2):
        if dic[c]!=2:
            ans=False
            break
#n is even 8 (7 5 1 1 7 3 5 3)        
else:
    for c in range(1,n-1,2):
        if dic[c]!=2:
            ans=False
if ans:
    print(2**int(n/2)%(10**9+7))
else:
    print(0)

Buggy submission (verdict: Runtime Error):
n=int(input())
arr=list(map(int,input().split()))
n=len(arr)
dic={}
for c in arr:
  dic.setdefault(c,0)
  c+=1
ans=True
#n is odd 5(4 2 0 2 4)
if n%2!=0:
  if dic[0]!=1:
    ans=False
  for c in range(2,n-1,2):
      if dic[c]!=2:
        ans=False
        break
#n is even 8 (7 5 1 1 7 3 5 3)        
else:
  for c in range(1,n-1,2):
    if dic[c]!=2:
      ans=False
if ans:
  print(2**int(n/2)/10**9+7)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
N=int(input())
l=list(map(int,input().split()))
a=1
if N%2==0:
  if N!=set(l)*2:
    a=0
else:
  if l.count(0)!=1 or N!=2*len(set(l))+1:
    ans=0
  else:
    ans=0
if a:
  print((2**(N//2))%(10**9+7))
else:
  print(0)

Buggy submission (verdict: Runtime Error):
N=int(input())
l=map(int,input().split())
a=1
if N%2==0:
  if int(N/2)!=set(l):
    a=0
else:
  if l.count(0)!=1 or N!=2*len(set(l))+1:
    ans=0
if ans:
  print(2**(N//2)%(10**9+7))

Buggy submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split()))

for i,x in enumerate(l.sort()):
  if n%2 and x!=int((i+1)/2):
    print(0)
  else:
    if i%2 and i+1!=x:
      print(0)
    elif i!=x:
      print(0)
      
else:
  print(int((n/2)**2)%(10**9+7))

Buggy submission (verdict: Runtime Error):
import math
n=int(input())
l=list(map(int,input().split())).sort()
for i,x in enumerate(l):
  if n%2 and x!=int((i+1)/2):
    print(0)
  else:
    if i%2 and i+1!=x:
      print(0)
    elif i!=x:
      print(0)
      
else:
  print(((n/2)**2)%10**9+7)