Problem:


Score : 300 points

Problem Statement

There are N integers written on a blackboard. The i-th integer is A_i.

Takahashi will repeatedly perform the following operation on these numbers:

Select a pair of integers, A_i and A_j, that have the same parity (that is, both are even or both are odd) and erase them.

Then, write a new integer on the blackboard that is equal to the sum of those integers, A_i+A_j.

Determine whether it is possible to have only one integer on the blackboard.

Constraints

2 ≦ N ≦ 10^5

1 ≦ A_i ≦ 10^9

A_i is an integer.

Input

The input is given from Standard Input in the following format:

N
A_1 A_2 … A_N

Output

If it is possible to have only one integer on the blackboard, print YES. Otherwise, print NO.

Sample Input 1

3
1 2 3

Sample Output 1

YES

It is possible to have only one integer on the blackboard, as follows:

Erase 1 and 3 from the blackboard, then write 4. Now, there are two integers on the blackboard: 2 and 4.

Erase 2 and 4 from the blackboard, then write 6. Now, there is only one integer on the blackboard: 6.

Sample Input 2

5
1 2 3 4 5

Sample Output 2

NO



Sample input:
3
1 2 3


Sample output:
YES

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))

odd = len(list(filter(lambda x: x % 2 != 0, A)))
even = N - odd

ans = "YES"


if odd == 1:
    odd = odd
elif odd % 2 != 0:
    ans = "NO"
else:
    even += odd//2
    while even > 1:
        if even % 2 != 0:
            break
        even /= 2
    if even != 1:
        ans = "NO"
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))

odd = len(list(filter(lambda x: x % 2 != 0, A)))
even = N - odd

ans = "YES"

if odd % 2 != 0:
    ans = "NO"
else:
    even += odd//2
    while even > 1:
        if even % 2 != 0:
            break
        even /= 2
    if even != 1:
        ans = "NO"
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))

odd = len(list(filter(lambda x: x % 2 != 0, A)))
even = N - odd

ans = "YES"

if odd % 2 != 0:
    ans = "NO"
else:
    even += odd//2
    while even > 1:
        even /= 2
    if even != 1:
        ans = "NO"
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))

odd = len(list(filter(lambda x: x % 2 != 0, A)))
even = N - odd

ans = "YES"

if odd % 2 != 0:
    ans = "NO"
else:
    while even > 1:
        even /= 2
    if even != 1:
        ans = "NO"
print(ans)

Submission status: Wrong Answer

Solution code:
f=lambda x:int(x)%2
n=int(input())
a=list(map(f,input().split())).count(1)
print(['YNEOS'][n>1 and a%2>0::2])

Submission status: Wrong Answer

Solution code:
N = int(input())

odd = 0
even = 0

for i in input().split():
    if int(i) % 2 == 0:
        odd += 1
    else:
        even += 1

if even % 2 == 1:
    print('NO')
elif (odd + even // 2) % 2 == 0:
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
N=int(input())
A=list(map(int,input().split()))
 
cnt=0
for i in range(N):
    if A[i]%2==1:
        cnt+=1
        
if cnt%2==1:
    print("NO")
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
N=int(input())
A=list(map(int,input().split()))

cnt=0
for i in range(N):
    if A[i]%2==1:
        cnt+=1
        
if cnt%2==1:
    print("NO")
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
count = [0, 0]
for _ in input().split():
    count[int(_) % 2] += 1
count[1] %= 2
if bool(count[0]) ^ bool(count[1]):
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
n = int(input())
a = list(map(int, input().split()))

o = 0
e = 0
for x in a:
    if x%2==0:
        e += 1
    else:
        o += 1

e += (o//2)
if o%2==0 and e%2==0:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
n = int(input())
l = list(map(int,input().split()))
m = [i%2 for i in l]
print("YNEOS"[l.count(1)%2==0::2])

Submission status: Wrong Answer

Solution code:
n = int(input())
l = list(map(int,input().split()))
m = [i%2 for i in l]
print("YNeos"[l.count(1)%2==0::2])

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(filter(lambda x: int(x) % 2 == 1, input().split()))
print('Yes' if len(a) % 2 == 0 else 'No')

Submission status: Wrong Answer

Solution code:
N=int(input())
A=[int(i) for i in input().split(' ')]
count=0
for a in A:
  if a%2!=0:
    count+=1
  print(count)
print('YES' if count%2==0 else 'NO')

Submission status: Wrong Answer

Solution code:
N=int(input())
A=[int(i) for i in input().split(' ')]
count=0
for a in A:
  if a%2!=1:
    count+=1
print('YES' if count%2==0 else 'NO')

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int, input().split()))
a=[i%2 for i in a]
b=a.count(1)
an,b=a.count(0)+b//2,b-b//2
if an%2+b%2==1:print('YES')
else:print('NO')

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int, input().split()))
a=[i%2 for i in a]
b=a.count(1)
an,b=a.count(0)+b//2,b+b//2
if an%2+b%2==1:print('YES')
else:print('NO')

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int, input().split()))
a=[i%2 for i in a]
b=a.count(1)
an=a.count(0)+b//2
if an%2+b%2==1:print('YES')
else:print('NO')

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int, input().split()))
a=[i%2 for i in a]
b=a.count(1)
an=n-b//2
an=(an-(an-b%1)//2+b%2)%2
if an==1:print('YES')
else:print('NO')

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int, input().split()))
a=[i%2 for i in a]
b=a.count(1)
an=n-b//2
an=an-(an-b%1)//2+b%2
if an==1:print('YES')
else:print('NO')

Submission status: Wrong Answer

Solution code:
n=int(input())
s=input().split()
i=0
count=0
while i<n:
  if int(s[i])%2!=0:
    count+=1
  i+=1
if count%2==0:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())

values = [int(i) for i in input('Enter some values: ').split()]

if int(len(values) /2) % 2 == 1:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
n=int(input())
s=input().split()
i=0
count=0
while i<0:
  if s[i]%2!=0:
    count+=1
if count%2==0:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())

values = [int(i) for i in input('Enter some values: ').split()]

if int(len(values) /2) % 2 == 1:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N = int(raw_input())
A = map(int, raw_input().split())
e_cnt = 0
for a in A:
  if a % 2 == 0:
    e_cnt += 1
o_cnt = N - e_cnt
if o_cnt % 2 == 1:
  print "NO"
elif (o_cnt/2+e_cnt) % 2 == 0:
  print "YES"
else:
  print "NO"

Submission status: Wrong Answer

Solution code:
input();print('YNeos'[sum(int(i)%2for i in input().split())%2::2])

Submission status: Wrong Answer

Solution code:
n = int(input())
a = map(int,input().split())

count = 0

for num in a:
    if num % 2 == 1:
        count += 1

if count % 2 == 0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
a = list(map(int, input().split()))

if len(list(filter(lambda x: x % 2 == 1, a))) % 2 == 0:
  print('YES')
else:
  print('NO')

Submission status: Wrong Answer

Solution code:
input()
a = list(map(int, input().split()))
if 1 & len([i for i in a if i&1]):
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [int(i) for i in input().split()]

odd = 0 #奇数
even = 0 #偶数

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

if abs(odd - even)%2 == 0:
    print("YES")
elif odd > even:
    print("NO")
else:
    print("YES")

Submission status: Wrong Answer

Solution code:
import sys

n = input()
v = map(int, raw_input().split(' '))

if sum(v) % ((n * (n + 1)) / 2) != 0:
	print "NO"
	sys.exit()

operations = sum(v) / ((n * (n + 1)) / 2)
operationsFound = 0


for i in range(n):
	diff = v[(i + 1) % n] - v[i]

	operationsFound += (operations - diff) % n
	if (operations - diff) % n != 0:
		print "NO"
		sys.exit()

if operationsFound == operations:
	print "YES"
else:
	print "NO"

Submission status: Wrong Answer

Solution code:
import sys

n = input()
v = map(int, raw_input().split(' '))

if sum(v) % ((n * (n + 1)) / 2) != 0:
	print "NO"
	sys.exit()

while sum(v) > 0:
	biggest, second_biggest = 0, 0
	for i in range(n):
		if v[i] > biggest:
			second_biggest = biggest
			biggest = i
		elif v[i] > second_biggest:
			second_biggest = i

	times = (v[biggest] - v[second_biggest] + n - 1) / n

	for i in range(biggest, -1, -1):
		v[i] -= n - (biggest - i)
		if v[i] < 0:
			print "NO"
			sys.exit()
	for i in range(biggest + 1, n):
		v[i] -= i - biggest
		if v[i] < 0:
			print "NO"
			sys.exit()

if sum(v) == 0:
	print "YES"
else:
	print "NO"

Submission status: Wrong Answer

Solution code:
N = int(input())
src = list(map(int,input().split()))

odd = len([a for a in src if a%2])
even = N - odd
if odd%2:
    print('NO')
else:
    even += odd//2
    print('NO' if even < 2 else 'YES')

Submission status: Wrong Answer

Solution code:
N = int(input())
src = list(map(int,input().split()))

odd = len([a for a in src if a%2])
even = N - odd
if odd%2:
    print('NO')
else:
    even += odd//2
    print('NO' if even%2 else 'YES')

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

# AtCoder Grand Contest
# Problem A


if __name__ == '__main__':
    n = int(input())
    a = list(map(int, input().split()))
    odd_count = 0

    for ai in a:
        if ai % 2 == 1:
            odd_count + 1

    even_count = n - odd_count

    if odd_count % 2 == 1:
        if even_count > 0:
            print('NO')
            exit()
        elif even_count == 0 and odd_count == 1:
            print('NO')
            exit()
    else:
        print('YES')
        exit()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

# AtCoder Grand Contest
# Problem A


if __name__ == '__main__':
    n = int(input())
    a = list(map(int, input().split()))
    odd_count = 0

    for ai in a:
        if ai % 2 == 1:
            odd_count + 1

    even_count = n - odd_count

    if odd_count % 2 == 1:
        if even_count > 0:
            print('NO')
            exit()
        elif even_count == 0 and odd_count == 1:
            print('NO')
            exit()
        else:
            print('YES')
            exit()
    else:
        print('YES')
        exit()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

# AtCoder Grand Contest
# Problem A


if __name__ == '__main__':
    n = int(input())
    a = list(map(int, input().split()))
    odd_count = 0

    for ai in a:
        if ai % 2 == 1:
            odd_count + 1

    even_count = n - odd_count

    if odd_count % 2 == 1:
        if even_count > 0:
            print('NO')
        elif even_count == 0 and odd_count == 1:
            print('NO')
        else:
            print('YES')
    else:
        print('YES')

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys

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

num_even = 0
num_odd = 0

for i in range(N):
    if A[i] % 2 == 0:
        num_even += 1
    else:
        num_odd += 1

if (num_even == 0) and (num_odd == 0):
    print("NO")
    sys.exit(0)
if (num_even == 1) and (num_odd == 0):
    print("YES")
    sys.exit(0)
if num_odd == 1 and num_even == 0:
    print("YES")
    sys.exit(0)

if num_odd % 2 == 1:
    print("NO")
    sys.exit(0)

num = (num_odd // 2 + num_even)
# if (num_odd // 2 + num_even) % 2 == 0:
#     print("YES")
# else:
#     print("NO")

def is_power(n):
    if n==1:
        print("YES")
        sys.exit(0)
    if n%2 == 1:
        print("NO")
        sys.exit(0)
    else:
        is_power(n//2)

is_power(num)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys

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

num_even = 0
num_odd = 0

for i in range(N):
    if A[i] % 2 == 0:
        num_even += 1
    else:
        num_odd += 1

if (num_even == 0) and (num_odd == 0):
    print("NO")
    sys.exit(0)
if (num_even == 1) and (num_odd == 0):
    print("YES")
    sys.exit(0)
if num_odd == 1 and num_even == 0:
    print("YES")
    sys.exit(0)

if num_odd % 2 == 1:
    print("NO")
    sys.exit(0)
if (num_odd // 2 + num_even) % 2 == 0:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys

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

num_even = 0
num_odd = 0

for i in range(N):
    if A[i] % 2 == 0:
        num_even += 1
    else:
        num_odd += 1

if num_odd % 2 == 1:
    if num_odd == 1 and num_even == 0:
        print("YES")
        sys.exit(0)
    print("NO")
    sys.exit(0)
if (num_odd // 2 + num_even) % 2 == 0:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys

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

num_even = 0
num_odd = 0

for i in range(N):
    if A[i] % 2 == 0:
        num_even += 1
    else:
        num_odd += 1

if num_odd % 2 == 1:
    print("NO")
    sys.exit(0)
if (num_odd // 2 + num_even) % 2 == 0:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
def read():
    return [int(x) for x in str.split(raw_input())]

n = read()[0]
a = read()
odd, even = 0, 0

for i in a:
    if (i%2 == 0):
        even = even+1
    else:
        odd = odd+1

if (odd%2 == 0 and (even+odd/2)%2 == 0):
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
from collections import Counter
n=input()
a=[int(i) % 2 for i in input().split()]
c=Counter(a)

if c[1] % 2 ==1:
  print("No")
else:
  print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())

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

if len(list(filter(lambda x:x%2==1,A)))%2==1:
    print("No")
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
print(['NO', 'YES'][sum([1 if i % 2 == 1 else 0 for i in [int(input()) % 1] + list(map(int, input().split(' ')))]) % 2])

Submission status: Wrong Answer

Solution code:
print(sum([1 if i % 2 == 1 else 0 for i in [int(input()) % 1] + list(map(int, input().split(' ')))]))

Submission status: Wrong Answer

Solution code:
print(sum([1 if i % 2 == 1 else 0 for i in list(map(int, input().split(' ')))]))

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))
odd = len(list(filter(lambda x: x % 2 == 1, A)))
if odd % 2 == 0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
#! /usr/bin/python3

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

even_count = 0
odd_count = 0

for i in range(N):
    if A[i] % 2 == 0:
        even_count += 1
    else:
        odd_count += 1
    
if odd_count % 2 == 1:
    if (even_count + odd_count // 2) % 2 == 0:
        print("YES")
    else:
        print("NO")

else:
    even_count += odd_count // 2
    if even_count % 2 == 1:
        print("NO")
    else:
        print("YES")

Submission status: Wrong Answer

Solution code:
#! /usr/bin/python3

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

even_count = 0
odd_count = 0

for i in range(N):
    if A[i] % 2 == 0:
        even_count += 1
    else:
        odd_count += 1
    
if odd_count % 2 == 1:
    if even_count % 2 == 0:
        print("YES")
    else:
        print("NO")

else:
    even_count += odd_count // 2
    if even_count % 2 == 1:
        print("NO")
    else:
        print("YES")

Submission status: Wrong Answer

Solution code:
#! /usr/bin/python3

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

even_count = 0
odd_count = 0

for i in range(N):
    if A[i] % 2 == 0:
        even_count += 1
    else:
        odd_count += 1
    
if odd_count % 2 == 1:
    print("NO")

else:
    even_count += odd_count // 2
    if even_count % 2 == 1:
        print("NO")
    else:
        print("YES")

Submission status: Wrong Answer

Solution code:
n = int(input())
num = list(map(int,input().split()))
odd,even = 0,0
for i in range(n):
  if num[i]%2 == 0:
    even += 1
  else:
    odd += 1
if odd%2 == 1:
  print('NO')
else:
  if 1 <= even and 0 < odd:
    print('YES')
  else:
    print('NO')

Submission status: Wrong Answer

Solution code:
n = int(input())
num = list(map(int,input().split()))
odd,even = 0,0
for i in range(n):
  if num[i]%2 == 0:
    even += 1
  else:
    odd += 1
if odd%2 == 1:
  print('NO')
else:
  if 1 <= even:
    print('YES')
  else:
    print('NO')

Submission status: Wrong Answer

Solution code:
N = int(input())
P = list(map(int, input().split()))
x = 0
for i in range(N):
    if P[i]%2==1:
        x+=1
if x%2==0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
def possible(a):
    cntOdd = 0
    for i in a:
        if (i&1)==1:
            cntOdd += 1
    if (cntOdd&1)==0:
        return True
    else:
        return False

def main():
    n = (raw_input().strip())
    a = [int(i) for i in raw_input().strip().split()]
    if possible(a):
        print 'Yes'
    else:
        print 'No'

if __name__=='__main__':
    main()

Submission status: Wrong Answer

Solution code:
N = int(input().rstrip())
arr = [int(item) for item in input().rstrip().split(" ")]
gusu = 0
kisu = 0

for i in arr:
  if i % 2 == 0:
    gusu += 1
  else:
    kisu += 1

if kisu % 2 == 0 and (gusu + kisu // 2 ) % 2 == 0:
  print("YES")
else:
  print("NO")

Submission status: Wrong Answer

Solution code:
N = int(input().rstrip())
arr = [int(item) for item in input().rstrip().split(" ")]
gusu = 0
kisu = 0

for i in arr:
  if i % 2 == 0:
    gusu += 1
  else:
    kisu += 1

if kisu % 2 == 0 and (gusu + kisu // 2 ) % 2 == 0:
  print("YES")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
od=int(0);ev=int(0)
for i in range(n):
    if a[i]%2==0:
        od+=1
    else:
        ev+=1
if od%2==0 and ev%2!=0:
    print('NO')
elif od%2!=0 and ev%2==0:
    print('NO')
else:
    print('YES')

Submission status: Wrong Answer

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

neven = 0
nodd = 0

for a_ in a:
    if a_ % 2 == 0:
        neven += 1
    else:
        nodd += 1

if nodd % 2 == 1:
    print("NO")
else:
    if (nodd / 2 + neven) % 2 == 0:
        print("YES")
    else:
        print("NO")

Submission status: Wrong Answer

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

neven = 0
nodd = 0

for a_ in a:
    if a_ % 2 == 0:
        neven += 1
    else:
        nodd += 1

if nodd % 2 == 1:
    print("No")
else:
    if (nodd / 2 + neven) % 2 == 0:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
print("YES" if [int(a) % 2 for a in input().split()].count('1') % 2 == 0 else "NO")

Submission status: Wrong Answer

Solution code:
import sys
N=int(input())
A=list(map(int,input().split()))
total=0
for i in range(N):
  total+=A[i]
if total*2/((N+1)*N)%1!=0:
  print("NO")
  sys.exit()
times=int(total*2/((N+1)*N))
if (times-A[0]+A[N-1])/N%1!=0:
  print("NO")
  sys.exit()
B=(times-A[0]+A[N-1])/N
for i in range(N-1):
  B+=(times-A[i+1]+A[i])/N
  if (times-A[i+1]+A[i])/N%1!=0:
    print("NO")
    sys.exit()
if B==times:
  print("YES")
else:
  print("NO")

Submission status: Wrong Answer

Solution code:
N = int(input())
L = list(map(int,input().split()))
k = 0
if sum(L) % ((N * (N + 1)) // 2) == 0:
	k = sum(L)//((N*(N+1))//2)
else:
	print("NO")

L.append(L[0])
L.append(L[1])
A = []
B = []
if k != 0:
	for l in range(N):
		b = (L[l + 1] - L[l])
		a = (L[l+1] - L[l]) - (L[l+2] - L[l + 1])
		if b > k or b < -k*N:
			l = -1
			print("NO")
			break
		if abs(a)%N == 0:
			pass
		else:
			print("NO")
			l = -1
			break
	if l == N-1:
		print("YES")

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-


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

on = len([a for a in A if a%2 == 1])
en = len([a for a in A if a%2 == 0])
en += on//2
en %= 2
on %= 2

print('NO' if (en + on) % 2 ==0 else 'YES')

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))
start = 0
divide = 2
printStr = 'N0'

for i in range(N):
    for j in range(N - 1):
        index = start + j if start + j < N else start + j - N
        if  A[index] % divide == 0:
            divide += 1
        else:
            start += 1
            divide = 2
            break
    if divide == N + 1:
        printStr = 'YES'
        break

print(printStr)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import traceback


def main():
    def _even_or_odd(_list):
        even = [a for a in _list if a % 2 == 0]
        odd = [a for a in _list if a % 2 == 1]
        if len(even) >= 2:
            even.append(even.pop() + even.pop())
        elif len(odd) >= 2:
            odd.append(odd.pop() + odd.pop())

        ret_list = even + odd
        return ret_list

    try:
        N = raw_input()
        A = map(int,raw_input().split())

        while True:
            bef_len = len(A)
            A = _even_or_odd(A)
            aft_len = len(A)
            if bef_len <= aft_len:
                raise

            if len(A) == 1:
                return 'YES'

    except:
        #traceback.print_exc()
        return

print main()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import traceback


def main():
    def _even_or_odd(_list):
        even = [a for a in _list if a % 2 == 0]
        odd = [a for a in _list if a % 2 == 1]
        if len(even) >= 2:
            even.append(even.pop() + even.pop())
        elif len(odd) >= 2:
            odd.append(odd.pop() + odd.pop())

        ret_list = even + odd
        return ret_list

    try:
        N = raw_input()
        A = map(int,raw_input().split())

        if int(N) < 2 or int(N) > 10**5:
            raise
        for a in A:
            if a < 1 or a > 10**9:
                raise

        while True:
            bef_len = len(A)
            A = _even_or_odd(A)
            aft_len = len(A)
            if bef_len <= aft_len:
                raise

            if len(A) == 1:
                return 'YES'

    except:
        #traceback.print_exc()
        return

print main()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
N = int(input())
A = [int(n) for n in input().split()]
stones = sum(A)
step = stones / (N*(1+N) /2 )
if step % 1 != 0:
    print("NO")
    exit()

D = [(A[(n+1)%N] - A[n%N]) - step for n in range(N)]

ng = [1 for d in D if -d % N != 0]

if len(ng):
    print("NO")
else:
    print("YES")

Submission status: Wrong Answer

Solution code:
def odd(test):
    odd = [x for x in test if x % 2 == 0]
    even = [x for x in test if x % 2 == 1]
    while len(even) > 1:
        a = even.pop()
        b = even.pop()
        test.remove(a)
        test.remove(b)
        test.append(a+b)
        odd.append(a+b)
    while len(odd) > 1:
        a = odd.pop()
        b = odd.pop()
        test.remove(a)
        test.remove(b)
        test.append(a+b)
        odd.append(a+b)
    if len(test) == 1:
        return 1
    else:
        return 0


def main():
    num = int(input())
    a = input()
    a = a.split(' ')
    test = list(map(int, a))
    if odd(test) == 0:
        print('No')
    else:
        print('YES')


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
numInput = int(input())
numOdd = int(numInput / 2) + (numInput % 2)
if numOdd % 2 == 0:
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
numInput = int(input())

amount = numInput
numOdd = int(numInput / 2) + (numInput % 2)
numEven = int(numInput / 2)

while True:

    if amount >= 3:
        if numOdd >= 2:
            numOdd -= 2
            numEven += 1
            amount -= 1
        else:
            numEven -= 1
            amount -= 1
    else:
        if amount == 2 and numOdd == 1 and numEven == 1:
            break
        else:
            amount = 1

        if amount < 2:
            break

if amount == 1:
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
numInput = int(input())

amount = numInput
numOdd = int(numInput / 2) + (numInput % 2)
numEven = int(numInput / 2)

while True:

    if amount >= 3:
        if numOdd >= 2:
            numOdd -= 2
            numEven += 1
            amount -= 1
        else:
            numEven -= 1
            amount -= 1
    else:
        if amount == 2 and numOdd == 1 and numEven == 1:
            break
        if amount < 2:
            break

if amount == 1:
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
_ = int(input())
even = 0
odd = 0
for a in map(int, input().split()):
    if a % 2 == 0:
        even += 1
    else:
        odd += 1
ans = odd % 2 == 0 or odd == 1
print(['NO', 'YES'][ans])

Submission status: Wrong Answer

Solution code:
N = int(raw_input())
inList = map(int, raw_input().split())
def checkList(inList, N):
    maxId = inList.index(max(inList))
    for i in range(N):
        inList[(maxId-i)%N] -= N - i
    if(max(inList) == 0 and min(inList) == 0):
        return "Yes"
    if(min(inList) < 0):
        return "No"
    return checkList(inList, N)
print checkList(inList, N)

Submission status: Wrong Answer

Solution code:
N = input().split()
K = int(N[0])
NN = input().split()
odd = [n for n in [int(N) for N in NN] if n % 2 != 0]
if K == 2:
    print("No")
else:
    if len(odd) % 2 != 0:
        print("NO")
    else:
        print("YES")

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
odd = 0
even = 0
for i in a:
    if i % 2 == 0:
        even += 1
    else:
        odd += 1

if odd % 2 == 1:
    print('NO')
elif (odd/2 + even) % 2 == 1:
    print('NO')
else:
    print('YES')

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))
flag=0
while N>1:
    n = N
    for i in range(N):
        try:
            if A[i]%2 == 0:
                for j in range(N):
                    if A[j]%2 == 0:
                        a=A[i]+A[j]
                        A.pop(i)
                        A.pop(j-1)
                        A.append(a)
                        N = N - 1
            elif A[i]%2 == 1:
                for j in range(N):
                    if A[j] % 2 == 1:
                        a = A[i] + A[j]
                        A.pop(i)
                        A.pop(j-1)
                        A.append(a)
                        N = N - 1
        except IndexError:
            pass

    if n==N:
        print("NO")
        flag=1
        break

if flag!=1:
    print("YES")

Submission status: Wrong Answer

Solution code:
N = input().split()
K = int(N[0])
NN = input().split()
odd = [n for n in [int(N) for N in NN] if n % 2 != 0]
if K % 2 == 0 and K > 2:
    print("YES")
else:
    if len(odd) % 2 != 0:
        print("NO")
    else:
        print("YES")

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Odd = 0
Even = 0

for i in a:
    if i%2 == 1:
        Odd +=1
    elif i%2 ==0:
        Even +=1

if Odd%2 ==0 and Even%2 == 1:
    print("YES")
else: 
    print("NO")

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import math
import sys

def main():
    N = int(raw_input())
    A = map(int, raw_input().split())
    n_odd = sum(1 for i in A if i%2 == 1)
    if n_odd % 2 != 0:
        print('NO')
        return 0
    x = N - n_odd / 2

    while x != 1:
    	if x % 2 == 1:
    		print('NO')
    		return 0
    	x /= 2
    print('YES')

    return 0


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import math
import sys

def main():
    N = int(raw_input())
    A = map(int, raw_input().split())
    n_odd = sum(1 for i in A if i%2 == 1)
    if n_odd % 2 != 0:
        print('NO')
        return 0
    x = N - n_odd / 2
    while x != 1:
    	if x % 2 != 1:
    		print('NO')
    		return 0
    	x /= 2
    print('YES')

    return 0


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

def readln(ch):
    _res = list(map(int,str(input()).split(ch)))
    return _res

n = int(input())
a = readln(' ')
ans = 0
for x in a:
    if x % 2 == 1:
        ans = ans + 1
if ans % 2 == 1:
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
N = input().split()
K = int(N[0])
NN = input().split()
even = [int(n) for n in NN if int(n) % 2 == 0]
odd = [int(n) for n in NN if int(n) % 2 != 0]
if K % 2 == 0 and K > 2:
    print("YES")
else:
    if len(odd) % 2 != 0:
        print("NO")
    else:
        print("YES")

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import math
import sys

def main():
    N = int(raw_input())
    A = map(int, raw_input().split())
    n_odd = sum(1 for i in A if i%2 == 1)
    if n_odd % 2 != 0:
        print('NO')
        return 0
    x = math.log(N - n_odd, 2)
    if x == int(x):
        print('YES')
        return 0
    print('NO')

    return 0


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N = input().split()
K = int(N[0])
NN = input().split()
even = [int(n) for n in NN if int(n) % 2 == 0]
odd = [int(n) for n in NN if int(n) % 2 != 0]
if K % 2 == 0:
    print("YES")
else:
    if len(even) < len(odd):
        print("NO")
    else:
        print("YES")

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3


def judge(n, xs):
    num_odds = sum(x % 2 for x in xs)
    num_evens = n - num_odds
    d, m = divmod(num_odds, 2)
    num_odds = m
    num_evens += d
    num_evens //= 2
    num_evens %= 2
    rest = num_odds + num_evens
    return rest == 1


def main():
    n = int(input())
    xs = [int(x) for x in input().split()]
    print("YES" if judge(n, xs) else "NO")


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))

odds = []
evens = []
for a in A:
    if a%2 == 0:
        evens.append(a)
    else:
        odds.append(a)

num_evens = len(evens)
num_odds = len(odds)

if num_odds%2 == 0:
    num_evens += num_odds/2
    num_odds = 0
    print('Yes')
else:
    num_evens += (num_odds-1)/2
    num_odds = 1
    print('No')

Submission status: Wrong Answer

Solution code:
import sys

ns = list(map(int, next(sys.stdin).split()))

if len(ns) == 1:
    print('YES')
    exit()

if sum(1 for n in ns if n % 2 == 1) % 2 == 0:
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
import sys

if sum(1 for n in map(int, next(sys.stdin).split()) if n % 2 == 1) % 2 == 0:
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
length = int(input())
target = [int(n) for n in input().split(" ")]
even,odd = 0,0
for l in range(length):
    if target[l] % 2 == 0:
        even += 1
    else:
        odd += 1
if even % 2 == 0:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
if __name__=="__main__":
    raw_input()
    A=map(int,raw_input().split())

    if len(filter(lambda a:a%2==1,A))%2==0:
        print "Yes"
    else:
        print "No"