ZhenlongDai/ACPR huggingface dataset:
Problem: p04021
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def main():
    n = int(input())
    a = [int(input()) for _ in range(n)]
    b = sorted(a)
    c = b[::2]
    d = a[::2]
    set_c = set(c)
    set_d = set(d)
    print(len(set_c & set_d))

main()

Failing test case input:
4
2
4
20
1

Expected output:
2


Actual output:
0


Fixed submission (verdict: Accepted):
def main():
    n = int(input())
    a = [int(input()) for _ in range(n)]
    b = sorted(a)
    c = b[::2]
    d = a[::2]
    set_c = set(c)
    set_d = set(d)
    print(len(set_c - set_d))
main()

Problem: p04021
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n=int(input())
a =[int(input()) for i in range(n)]
res = [[a[i],i]for i in range(n)]
res.sort()
ret =0
for i in range(n):
    if res[i][1]%2 != i%2:ret+=1
print(ret)

Failing test case input:
5
10
8
5
0
2

Expected output:
1


Actual output:
2


Fixed submission (verdict: Accepted):
n=int(input())
a =[int(input()) for i in range(n)]
res = [[a[i],i]for i in range(n)]
res.sort()
ret =0
for i in range(n):
    if res[i][1]%2 != i%2:ret+=1
print(ret

Problem: p04021
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def main():
    n = int(input())
    a = [int(input()) for _ in range(n)]
    b = sorted(a)
    c = [a[i] for i in range(n) if a.index(b[i])%2 == 1]
    print(int(len(c)/2))
main()

Failing test case input:
4
2
4
20
1

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
def main():
    n = int(input())
    a = [int(input()) for _ in range(n)]
    b = sorted(a)
    c = b[::2]
    d = a[::2]
    set_c = set(c)
    set_d = set(d)
    print(len(set_c - set_d))
main()

Problem: p04021
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
s = [int(input()) for _ in range(n)]
ss = sorted(s)
d = {ss[i]: i for i in range(n)}
ans = 0
for i, j in enumerate(s):
    ans += i % 2 != d[j] % 2
print(ans)


Failing test case input:
5
4
8
10
9
2

Expected output:
1


Actual output:
2


Fixed submission (verdict: Accepted):
n = int(input())
a = [int(input()) for _ in range(n)]
b = {}
for i, j in enumerate(sorted(a)):
    b[j] = i
ans = 0
for i, j in enumerate(a):
    ans += (b[j] - i) % 2
print(ans

Problem: p04021
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n=int(input())
a =[int(input()) for i in range(n)]
res = [[a[i],i]for i in range(n)]
res.sort()
ret =0
for i in range(n):
    if res[i][1]%2 != i%2:ret+=1
print(ret/2)


Failing test case input:
4
0
13
11
1

Expected output:
0


Actual output:
0.0


Fixed submission (verdict: Accepted):
n=int(input())
a =[int(input()) for i in range(n)]
res = [[a[i],i]for i in range(n)]
res.sort()
ret =0
for i in range(n):
    if res[i][1]%2 != i%2:ret+=1
print(ret
Problem: p04021
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
A=[]
B=[]
for i in range(N):
	if i%2==0:
		A.append(int(input()))
	else:
		B.append(int(input()))
		
A=sorted(A)
B=sorted(B)
C=sorted(A+B)

c=0
for a in A:
	if C.index(a)%2==1:
		c+=1
for b in B:
	if C.index(b)%2==0:
		c+=1
print(c)

Failing test case input:
4
2
4
3
0

Expected output:
1


Actual output:
2


Fixed submission (verdict: Accepted):
N=int(input())
A=[]
B=[]
for i in range(N):
	if i%2==0:
		A.append(int(input()))
	else:
		B.append(int(input()))
		
A=sorted(A)
B=sorted(B)
C=sorted(A+B)

c=0
j=0
for i in range(N):
	if j>=len(A):
		break
	if A[j]==C[i]:
		if i%2==1:
			c+=1
		j+=1
print(c)

Problem: p04021
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = [int(input()) for i in range(n)]
b = sorted(a[::2])
a.sort()
now = 0
ans = 0
br = len(b)
for k,v in enumerate(a):
  if b[now] == v:
    if k % 2:
      ans += 1
      now += 1
  if now == br:
    break
print(ans)

Failing test case input:
4
0
4
22
2

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):
n = int(input())
a = [int(input()) for i in range(n)]
b = sorted(a[::2])
a.sort()
now = 0
ans = 0
br = len(b)
for k,v in enumerate(a):
  if b[now] == v:
    if k % 2:
      ans += 1
    now += 1
  if now == br:
    break
print(ans)

Problem: p04021
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a=sorted([[int(input()),i]for i in range(int(input()))]);print(sum([(a[i][1]-i)%2for i in range(len(a))]))

Failing test case input:
5
6
3
10
5
2

Expected output:
1


Actual output:
2


Fixed submission (verdict: Accepted):
a=sorted([[int(input()),i]for i in range(int(input()))]);print(sum([(a[i][1]-i)%2for i in range(len(a))])

Problem: p04021
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = [[int(input()),i] for i in range(n)]
a.sort()
ans = 0
for i,tmp in enumerate(a):
  x,j = tmp
  ans += abs(i-j) % 2
print(ans-1)



Failing test case input:
4
2
4
5
1

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):
n = int(input())
a = [[int(input()),i] for i in range(n)]
a.sort()
ans = 0
for i,tmp in enumerate(a):
  x,j = tmp
  ans += abs(i-j) % 2
print(ans

Problem: p04021
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")

n = int(input())
a = [None] * n
for i in range(n):
    a[i] = (i,int(input()))
    
a.sort()
ans = 0
for i in range(n):
    if a[i][0]%2 != i%2:
        ans += 1
print(ans)

Failing test case input:
4
2
4
5
1

Expected output:
2


Actual output:
0


Fixed submission (verdict: Accepted):
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n = int(input())
a = [None] * n
for i in range(n):
    a[i] = (i,int(input()))
    
a.sort(key=lambda x: x[1])
ans = 0
for i in range(n):
    if a[i][0]%2 != i%2:
        ans += 1
print(ans
Problem: p04021
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
nums = [int(input()) for _ in range(n)]
standard = nums[:]
standard.sort()
ans = 0

for i in range(n):
    p = nums[i]
    x = standard.index(p)
    if abs(x - i) % 2 == 1:
        ans += 1

print(ans)

Failing test case input:
4
2
4
16
1

Expected output:
2


Actual output:
4


Fixed submission (verdict: Accepted):
n = int(input())
nums = [[int(input()), i] for i in range(n)]
nums.sort()
ans = 0

for i in range(n):
    if abs (i - nums[i][1]) % 2 == 1:
        ans += 1

print(ans

Problem: p04021
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import copy
n = int(input())

nums = []
for i in range(n):
  nums.append(int(input()))
  
taiou = {}
reprica = copy.copy(nums)
reprica.sort()
for i, r in enumerate(reprica):
  taiou[r] = i 
ans = 0
for i, num in enumerate(nums):
  if i%2 != taiou[num]%2:
    ans += 1
    
print(ans/2)
  
  



Failing test case input:
4
0
10
6
1

Expected output:
0


Actual output:
0.0


Fixed submission (verdict: Accepted):
import copy

n = int(input())

nums = []
for i in range(n):
    nums.append(int(input()))

taiou = {}
reprica = copy.copy(nums)
reprica.sort()
for i, r in enumerate(reprica):
    taiou[r] = i
ans = 0
for i, num in enumerate(nums):
    if i % 2 != taiou[num] % 2:
        ans += 1

print(ans
Problem: p02319
Buggy submission (Python3, verdict: Wrong Answer):
INF = 10 ** 20

n, w = map(int, input().split())

value = []
weight = []

for _ in range(n):
  vi, wi = map(int, input().split())
  value.append(vi)
  weight.append(wi)

sum_value = sum(value)

dp = [INF for _ in range(sum_value + 1)]
dp[0] = 0

for i in range(n):
  for j in range(sum_value, value[i] - 1, -1):
    dp[j] = min(dp[j], dp[j - value[i]] + weight[i])

for j in range(sum_value + 1):
  if dp[j] != INF and dp[j] > w:
    print(j - 1)
    break
else:
  print(sum_value) 



Failing test case input:
2 1
5 2
3 14

Expected output:
0


Actual output:
2


Fixed submission (verdict: Accepted):
INF = 10 ** 20

n, w = map(int, input().split())

value = []
weight = []

for _ in range(n):
  vi, wi = map(int, input().split())
  value.append(vi)
  weight.append(wi)

sum_value = sum(value)

dp = [INF for _ in range(sum_value + 1)]
dp[0] = 0

for i in range(n):
  for j in range(sum_value, value[i] - 1, -1):
    dp[j] = min(dp[j], dp[j - value[i]] + weight[i])

for j in range(sum_value, -1, -1):
  if dp[j] <= w:
    print(j)
    break

Problem: p02319
Buggy submission (Python3, verdict: Wrong Answer):



N, W = map(int, input().split())
vs = []
ws = []
for i in range(N):
    v, w = map(int, input().split())
    vs.append(v)
    ws.append(w)

dp = dict()
dp[0] = 0
max_v = -1
for i in range(N):
    tmp = dp.copy()
    for k, v in tmp.items():
        dp.setdefault(k+vs[i], float('inf'))
        dp[k+vs[i]] = min(v + ws[i], dp[k+vs[i]])
        if dp[k+vs[i]] <= W:
            max_v = max(max_v, k+vs[i])


print(max_v)


Failing test case input:
0 13
4 1
1 2

Expected output:
0


Actual output:
-1


Fixed submission (verdict: Accepted):



N, W = map(int, input().split())
vs = []
ws = []
for i in range(N):
    v, w = map(int, input().split())
    vs.append(v)
    ws.append(w)

dp = dict()
dp[0] = 0
max_v = 0
for i in range(N):
    tmp = dp.copy()
    for k, v in tmp.items():
        dp.setdefault(k+vs[i], float('inf'))
        dp[k+vs[i]] = min(v + ws[i], dp[k+vs[i]])
        if dp[k+vs[i]] <= W:
            max_v = max(max_v, k+vs[i])


print(max_v)

Problem: p02319
Buggy submission (Python3, verdict: Wrong Answer):
N, W = map(int, input().split())
dp = [0] + [W+1] * (N*100)
for i in range(N):
    x, y = map(int, input().split())
    for j in range(i*100, -1, -1):
        if dp[j+y] > dp[j] + x:
            dp[j+y] = dp[j] + x

for v, w in zip(range(N*100, -1, -1), dp[::-1]):
    if w < W+1:
        print(v)
        break


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

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):
N, W = map(int, input().split())
dp = [0] + [W+1] * (N*100)
for i in range(N):
    v, w = map(int, input().split())
    for j in range(i*100, -1, -1):
        if dp[j+v] > dp[j] + w:
            dp[j+v] = dp[j] + w

for v, w in zip(range(N*100, -1, -1), dp[::-1]):
    if w < W+1:
        print(v)
        break
Problem: p02319
Buggy submission (Python3, verdict: Wrong Answer):
from math import isfinite
from itertools import dropwhile

n, knapsack = map(int, input().split())
dpn = n * 100  
dp = [float('inf')] * (dpn + 1)
dp[0] = 0
for i in range(n):
    value, weight = map(int, input().split())
    for j in range(dpn - value, 0, -1):
        if not isfinite(dp[j]):
            continue
        new_weight = dp[j] + weight
        if new_weight <= knapsack and dp[j + value] > new_weight:
            dp[j + value] = new_weight
    if dp[value] > weight:
        dp[value] = weight

print(next(dropwhile(lambda i: not isfinite(dp[i]), range(dpn, -1, -1))))

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

Expected output:
1


Actual output:
15


Fixed submission (verdict: Accepted):
from math import isfinite
from itertools import dropwhile

n, knapsack = map(int, input().split())
dpn = n * 100  
dp = [float('inf')] * (dpn + 1)
dp[0] = 0
for i in range(n):
    value, weight = map(int, input().split())
    for j in range(dpn - value, 0, -1):
        if not isfinite(dp[j]):
            continue
        new_weight = dp[j] + weight
        if new_weight <= knapsack and dp[j + value] > new_weight:
            dp[j + value] = new_weight
    if weight <= knapsack and dp[value] > weight:
        dp[value] = weight

print(next(dropwhile(lambda i: not isfinite(dp[i]), range(dpn, -1, -1))))
Problem: p03490
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = map(len, input().split("T"))
x, y = map(int, input().split())

X, Y = {next(S)}, {0}
XY = [X, Y]
for i, d in enumerate(S, 1):
    A = XY[i % 2]
    A |= {a + d for a in A} | {a - d for a in A}

if x in X and y in Y:
    print("Yes")
else:
    print("No")

Failing test case input:
FFTFTF
2 0

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
S = input()
x, y = map(int, input().split())

D = map(len, S.split("T"))
X, Y = {next(D)}, {0}
for i, d in enumerate(D, 1):
    if i % 2 == 0:
        X = {x + d for x in X} | {x - d for x in X}
    else:
        Y = {y + d for y in Y} | {y - d for y in Y}

if x in X and y in Y:
    print("Yes")
else:
    print("No")
Problem: p02890
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
import bisect
N = int(input())
count = {}
for x in map(int, input().split()):
    count[x] = count.get(x, 0) + 1

a = sorted(count.values())
sums = a[:]
n = len(a)
for i in range(1, n):
    sums[i] += sums[i-1]
    
def check(k, x):
    pos = bisect.bisect_right(a, x)
    return sums[pos-1] + x * (n - pos) >= k * x

x = 0
res = []
for k in range(N, 0, -1):
    while check(k, x+1):
        x += 1
    res.append(x)
    
for x in res[::-1]:
    print(x)

Failing test case input:
4
2 3 2 3

Expected output:
4
2
0
0


Actual output:
4
2
1
1


Fixed submission (verdict: Accepted):
import bisect
N = int(input())
count = {}
for x in map(int, input().split()):
    count[x] = count.get(x, 0) + 1

a = sorted(count.values())
sums = a[:]
n = len(a)
for i in range(1, n):
    sums[i] += sums[i-1]
    
def check(k, x):
    pos = bisect.bisect_right(a, x)
    if pos == 0:
        return x * n >= k * x
    return sums[pos-1]+ x * (n - pos) >= k * x

x = 0
res = []
for k in range(N, 0, -1):
    while check(k, x+1):
        x += 1
    res.append(x)
    
for x in res[::-1]:
    print(x)
Problem: p03863
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


import sys
input = sys.stdin.readline


def main():
    s = list(input())
    N = len(s)

    if (N % 2 == 0) ^ (s[0] == s[-1]):
        print('Second')
    else:
        print('First')


main()


Failing test case input:
a_dad

Expected output:
First


Actual output:
Second


Fixed submission (verdict: Accepted):


import sys
input = sys.stdin.readline().rstrip


def main():
    s = list(input())
    N = len(s)

    if (N % 2 == 0) ^ (s[0] == s[-1]):
        print('Second')
    else:
        print('First')


main()

Problem: p03863
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
if s[0] == s[-1]:
  if len(s) % 2 == 0:
    print("First")
  else:
    print("Secon")
else:
  if len(s) % 2 == 0:
    print("Second")
  else:
    print("First")

Failing test case input:
bceab

Expected output:
Second


Actual output:
Secon


Fixed submission (verdict: Accepted):
s = input()
if s[0] == s[-1]:
  if len(s) % 2 == 0:
    print("First")
  else:
    print("Second")
else:
  if len(s) % 2 == 0:
    print("Second")
  else:
    print("First")

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


s = input()

if (s[0] == s[-1]) ^ (len(s) % 2 == 0):
    print('First')
else:
    print('Second')

Failing test case input:
^`b

Expected output:
First


Actual output:
Second


Fixed submission (verdict: Accepted):


s = input()

if (s[0] == s[-1]) ^ (len(s) % 2 == 0):
    print('Second')
else:
    print('First')

Problem: p03863
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s=input()
N=len(s)
if s[0]==s[1]:
  if N%2:
    print('Second')
  else:
    print('First')
else:
  if N%2:
    print('First')
  else:
    print('Second')

Failing test case input:
b`b

Expected output:
Second


Actual output:
First


Fixed submission (verdict: Accepted):
s=input()
N=len(s)
if s[0]==s[-1]:
  if N%2:
    print('Second')
  else:
    print('First')
else:
  if N%2:
    print('First')
  else:
    print('Second')

Problem: p03863
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from copy import deepcopy
s = input()
t = deepcopy(s)
n = len(s)
flg = 1
while flg:
  flg = 0
  final = [s[0]]
  for i in range(1,n-1):
    if s[i-1] != s[i] != s[i+1] != s[i-1]:
      flg = 1
      continue
    final.append(s[i])
  final.append(s[-1])
  s = deepcopy(final)
  n = len(s)
if (len(t)-len(s))%2:
  print("First")
else:
  print("Second")


Failing test case input:
caa

Expected output:
First


Actual output:
Second


Fixed submission (verdict: Accepted):
from copy import deepcopy
s = input()
t = deepcopy(s)
n = len(s)
flg = 0
x = 2
if s[0] == s[n-1]:
  if n%2:
    print("Second")
  else:
    print("First")
  exit()
for i in range(1,n-1):
  if s[i] == s[0] and flg:
    x += 1
    flg = 0
  elif s[i] == s[n-1] and not flg:
    x += 1
    flg = 1
if (n-x+flg)%2:
  print("First")
else:
  print("Second")
Problem: p03863
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


import collections

s = input()

c = collections.Counter(s)
n = len(s)
n0 = s.count(s[0])
n1 = s.count(s[-1])

if s[0] == s[-1]:
    if (n-n0+1)%2 != 0:
        print('First')
    else:
        print('Second')
elif (n-2*min(n0,n1))%2 != 0:
    print('First')
else:
    print('Second')
    
    


Failing test case input:
aaa

Expected output:
Second


Actual output:
First


Fixed submission (verdict: Accepted):



s = input()

n = len(s)
n0 = s.count(s[0])
n1 = s.count(s[-1])

if s[0] == s[-1]:
    if (n-2*n0+1)%2 != 0:
        print('First')
    else:
        print('Second')
elif (n-2*min(n0,n1))%2 != 0:
    print('First')
else:
    print('Second')

Problem: p03863
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import collections

s = input()

c = collections.Counter(s)
n = len(s)
n0 = s.count(s[0])
n1 = s.count(s[-1])

if s[0] == s[-1]:
    if (n-n0+1)%2 != 0:
        print('First')
    else:
        print('Second')
elif (n-min(n0,n1))%2 != 0:
    print('First')
else:
    print('Second')

Failing test case input:
b`d

Expected output:
First


Actual output:
Second


Fixed submission (verdict: Accepted):



s = input()

n = len(s)
n0 = s.count(s[0])
n1 = s.count(s[-1])

if s[0] == s[-1]:
    if (n-2*n0+1)%2 != 0:
        print('First')
    else:
        print('Second')
elif (n-2*min(n0,n1))%2 != 0:
    print('First')
else:
    print('Second')

Problem: p03863
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = list(input())
p = 0 
f = 1 
h = {-1:"First", 1:"Second"}
for i in range(len(s)):
        if p+2 < len(s):
                if s[p] != s[p+2]:
                        del s[p+1]
                        f = -f
                else:
                        p += 1
if len(s) > 2 and s[0] != s[2]:
        del s[1]
        f = -f
print(h[f])

Failing test case input:
dadba

Expected output:
First


Actual output:
Second


Fixed submission (verdict: Accepted):
s = list(input())
f = 1 
h = {-1:"First", 1:"Second"}
r = True
while r:
        p = 0 
        r = False 
        for i in s:
                if p+2 < len(s):
                        if s[p] != s[p+2]:
                                del s[p+1]
                                r = True
                                f = -f
                        else:
                                p += 1
print(h[f])

Problem: p03863
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = str(input())
if ((len(s)%2) ^ (s[0] == s[-1])):
  print("Second")
else:
  print("First")

Failing test case input:
aca

Expected output:
Second


Actual output:
First


Fixed submission (verdict: Accepted):
s = str(input())
if ((len(s)%2) ^ (s[0] == s[-1])):print("First")
else:print("Second")
Problem: p03863
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
input = sys.stdin.readline

s=input()

first_c=s[0]
last_c=s[-1]

if first_c==last_c:
  if len(s)%2==0:
    print('First')
  else:
    print('Second')
else:
  if len(s)%2==0:
    print('Second')
  else:
    print('First')

Failing test case input:
b`d

Expected output:
First


Actual output:
Second


Fixed submission (verdict: Accepted):
s=input()

first_c=s[0]
last_c=s[-1]

if first_c==last_c:
  if len(s)%2==0:
    print('First')
  else:
    print('Second')
else:
  if len(s)%2==0:
    print('Second')
  else:
    print('First')

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





s = input()
iseven = len(s)&1==0
issame = s[0]==s[-1]
print('First' if iseven^issame else 'Second')

Failing test case input:
dae_a

Expected output:
First


Actual output:
Second


Fixed submission (verdict: Accepted):





s = input()
iseven = len(s)&1==0
issame = s[0]==s[-1]
print('Second' if iseven^issame else 'First')

Problem: p03863
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = input()
N = len(S)

x = S[0]
y = S[1]
for i in range(2, N):
    if i % 2 == 0:
        if S[i] != x:
            break
    else:
        if S[i] != y:
            break
else:
    print("Second")
    exit()

if N % 2 == 0:
    print("Second")
else:
    print("First")


Failing test case input:
bceab

Expected output:
Second


Actual output:
First


Fixed submission (verdict: Accepted):
S = input()
N = len(S)

x = S[0]
y = S[1]
for i in range(2, N):
    if i % 2 == 0:
        if S[i] != x:
            break
    else:
        if S[i] != y:
            break
else:
    print("Second")
    exit()

if S[0]==S[-1]:
    if N % 2 == 0:
        print("First")
    else:
        print("Second")
else:
    if N % 2 == 0:
        print("Second")
    else:
        print("First")

Problem: p03863
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=input()

if len(s)%2==0 and s[0]==s[-1]:
  print('Second')
else: 
  print('First')

Failing test case input:
aaa

Expected output:
Second


Actual output:
First


Fixed submission (verdict: Accepted):
s=input()

if (len(s)%2==0 and s[0]!=s[-1]) or (len(s)%2!=0 and s[0]==s[-1]):
  print('Second')
else: 
  print('First')

Problem: p03863
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
a = input()
n = len(a)
if a[0] != a[-1]:
  n += 1
if n % 2 == 0:
  print("Second")
else:
  print("First")

Failing test case input:
b`c

Expected output:
First


Actual output:
Second


Fixed submission (verdict: Accepted):
a = input()
n = len(a)
if a[0] != a[-1]:
  n += 1
if n % 2 == 0:
  print("First")
else:
  print("Second")
Problem: p03863
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=input()
if s==s[::-1]:
    opt=len(s)-3 
    if opt&1: 
        print('First')
    else:
        print('Second')
else: 
    opt=len(s)-2 
    if opt&1:
        print('First')
    else:
        print('Second')

Failing test case input:
bceab

Expected output:
Second


Actual output:
First


Fixed submission (verdict: Accepted):
s=input()
if s[0]==s[-1]:
    opt=len(s)-3 
    if opt&1: 
        print('First')
    else:
        print('Second')
else: 
    opt=len(s)-2 
    if opt&1:
        print('First')
    else:
        print('Second')

Problem: p03863
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = input()
N = len(S)

x = S[0]
y = S[1]
for i in range(2, N):
    if i % 2 == 0:
        if S[i] != x:
            break
    else:
        if S[i] != y:
            break
else:
    print("Second")
    exit()

if N % 2 == 0 and S[0]==S[-1]:
    print("First")
elif N % 2 == 0:
    print("Second")
else:
    print("First")


Failing test case input:
bceab

Expected output:
Second


Actual output:
First


Fixed submission (verdict: Accepted):
S = input()
N = len(S)

x = S[0]
y = S[1]
for i in range(2, N):
    if i % 2 == 0:
        if S[i] != x:
            break
    else:
        if S[i] != y:
            break
else:
    print("Second")
    exit()

if S[0]==S[-1]:
    if N % 2 == 0:
        print("First")
    else:
        print("Second")
else:
    if N % 2 == 0:
        print("Second")
    else:
        print("First")

Problem: p03863
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=input()
print('Second'if(len(s)%2==0)!=(s[1]==s[-1])else'First')

Failing test case input:
daa

Expected output:
First


Actual output:
Second


Fixed submission (verdict: Accepted):
s=input()
print('Second'if(len(s)%2==0)!=(s[0]==s[-1])else'First')

Problem: p03863
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s=input()
l=len(s)
if s[0]==s[-1]:
    if l%2==1:
        print("First")
    else:
        print("Second")
else:
    if l%2==0:
        print("First")
    else:
        print("Second")


Failing test case input:
aa`

Expected output:
First


Actual output:
Second


Fixed submission (verdict: Accepted):
s=input()
l=len(s)
if s[0]==s[-1]:
    if l%2==0:
        print("First")
    else:
        print("Second")
else:
    if l%2==1:
        print("First")
    else:
        print("Second")

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


import collections

s = input()

c = collections.Counter(s)
n = len(s)
n0 = s.count(s[0])
n1 = s.count(s[-1])

if s[0] == s[-1]:
    if (n-n0+1)%2 != 0:
        print('First')
    else:
        print('Second')
elif (n-n0-n1)%2 != 0:
    print('First')
else:
    print('Second')
    
    


Failing test case input:
`bb

Expected output:
First


Actual output:
Second


Fixed submission (verdict: Accepted):



s = input()

n = len(s)
n0 = s.count(s[0])
n1 = s.count(s[-1])

if s[0] == s[-1]:
    if (n-2*n0+1)%2 != 0:
        print('First')
    else:
        print('Second')
elif (n-2*min(n0,n1))%2 != 0:
    print('First')
else:
    print('Second')
Problem: p03863
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
n = len(s)
if n == 3 and s[0] == s[2]:
    print("Second")
elif n % 2 == 1:
    print("First")
else:
    print("Second")

Failing test case input:
bceab

Expected output:
Second


Actual output:
First


Fixed submission (verdict: Accepted):
s = input()
n = len(s)
if s[0] == s[-1]:
    if n % 2 == 1:
        print("Second")
    else:
        print("First")
else:
    if n % 2 == 0:
        print("Second")
    else:
        print("First")

Problem: p03863
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
if s[0] == s[-1]:
  if len(s) % 2 == 1:
    print("Second")
  else:
    print("First")
else:
  if len(s) % 2 == 0:
    print("First")
  else:
    print("Second")

Failing test case input:
ddaba

Expected output:
First


Actual output:
Second


Fixed submission (verdict: Accepted):
s = input()
if s[0] == s[-1]:
  if len(s) % 2 == 1:
    print("Second")
  else:
    print("First")
else:
  if len(s) % 2 == 1:
    print("First")
  else:
    print("Second")

Problem: p03863
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()

b1 = bool(len(s)%2)
b2 = ( s[0] == s[len(s)-1] )

if b1 ^ b2:
    print("Second")
else:
    print("First")


Failing test case input:
`bc

Expected output:
First


Actual output:
Second


Fixed submission (verdict: Accepted):
s = input()

b1 = bool(len(s)%2)
b2 = ( s[0] == s[len(s)-1] )

if b1 ^ b2:
    print("First")
else:
    print("Second")

Problem: p03863
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = input()
N = len(S)

x = S[0]
y = S[1]
for i in range(2, N):
    if i % 2 == 0:
        if S[i] != x:
            break
    else:
        if S[i] != y:
            break
else:
    print("Second")
    exit()

if N % 2 == 0 and S[0]==S[-1]:
    print("First")
elif N % 2 == 1 and S[0]==S[-1]:
    print("Second")
elif N % 2 == 0:
    print("First")
else:
    print("Second")


Failing test case input:
baa

Expected output:
First


Actual output:
Second


Fixed submission (verdict: Accepted):
S = input()
N = len(S)

x = S[0]
y = S[1]
for i in range(2, N):
    if i % 2 == 0:
        if S[i] != x:
            break
    else:
        if S[i] != y:
            break
else:
    print("Second")
    exit()

if S[0]==S[-1]:
    if N % 2 == 0:
        print("First")
    else:
        print("Second")
else:
    if N % 2 == 0:
        print("Second")
    else:
        print("First")
Problem: p03863
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from copy import deepcopy
s = input()
t = deepcopy(s)
n = len(s)
flg = 0
x = 2
if s[0] == s[n-1]:
  if n%2:
    print("Second")
  else:
    print("First")
  exit()
for i in range(1,n-1):
  if s[i] == s[0] and flg:
    x += 1
    flg = 0
  elif s[i] == s[n-1] and not flg:
    x += 1
    flg = 1
if (n-x)%2:
  print("First")
else:
  print("Second")


Failing test case input:
baa

Expected output:
First


Actual output:
Second


Fixed submission (verdict: Accepted):
from copy import deepcopy
s = input()
t = deepcopy(s)
n = len(s)
flg = 0
x = 2
if s[0] == s[n-1]:
  if n%2:
    print("Second")
  else:
    print("First")
  exit()
for i in range(1,n-1):
  if s[i] == s[0] and flg:
    x += 1
    flg = 0
  elif s[i] == s[n-1] and not flg:
    x += 1
    flg = 1
if (n-x+flg)%2:
  print("First")
else:
  print("Second")
Problem: p03142
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,m=map(int,input().split())
g=[[] for i in range(n)]
for i in range(n+m-1):
    a,b=map(int,input().split())
    g[a-1].append(b)
for i in range(n):
    if len(g[i])==0:
        r=i
ans=[0]*n
q=[i]
while len(q)>0:
    u=q.pop()
    for v in g[u]:
        ans[v-1]=u+1
        q.append(v-1)
for i in ans:
    print(i)

Failing test case input:
6 3
3 1
2 3
4 1
4 2
5 1
2 1
3 6
4 5

Expected output:
3
4
2
0
4
3


Actual output:
0
0
0
0
0
0


Fixed submission (verdict: Accepted):
from collections import deque
n,m=map(int,input().split())
g=[[] for i in range(n)]
ro=[0]*n
for i in range(n+m-1):
    a,b=map(int,input().split())
    g[a-1].append(b)
    ro[b-1]+=1
for i in range(n):
    if ro[i]==0:
        r=i
ans=[0]*n
q=deque([r])
while len(q)>0:
    u=q.popleft()
    for v in g[u]:
        ro[v-1]-=1
        if ro[v-1]==0:
            ans[v-1]=u+1
            q.append(v-1)
for i in ans:
    print(i)
Problem: p03312
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = [int(_) for _ in input().split()]
 
ans = []
t = []
c = 0
for i in range(N):
    c += A[i]
    t.append(c)
    
l = 0
r = 0

for _ in range(2, N-1):
    while t[_] > t[l]+t[l+1]:
        l += 1
    while t[-1]+t[_] > t[r]+t[r+1]:
        r += 1
    n = [t[l], t[_]-t[l], t[r]-t[_], t[-1]-t[r]]
    ans.append(max(n)-min(n))
    
print(min(ans))

Failing test case input:
7
1 1 3 1101000100 0 0 0

Expected output:
1101000099


Actual output:
1101000100


Fixed submission (verdict: Accepted):
N = int(input())
A = [int(_) for _ in input().split()]
 
ans = []
t = []
c = 0
for i in range(N):
    c += A[i]
    t.append(c)
    
l = 0
r = 0

for _ in range(1, N-1):
    while t[_] > t[l]+t[l+1]:
        l += 1
    while t[-1]+t[_] > t[r]+t[r+1]:
        r += 1
    n = [t[l], t[_]-t[l], t[r]-t[_], t[-1]-t[r]]
    ans.append(max(n)-min(n))
print(min(ans))
Problem: p03637
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input());A=input().split();v=[int(i)%4 for i in A];print('Yes' if (v.count(0)*2+v.count(2))>=N else 'No')

Failing test case input:
3
1 -4 -1

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
N=int(input());A=input().split();v=[int(i)%4 for i in A];print('Yes' if v.count(0)+v.count(2)

Problem: p03637
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
num = [ int(v) for v in input().split() ]
a, b, c = 0, 0, 0
for i in num:
	if i % 2 != 0:
		a += 1
	elif i % 4 != 0:
		b += 1
	else:
		c += 1

if c >= a - 1:
	print("Yes")
else:
	print("No")

Failing test case input:
6
4 7 0 -1 6 9

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
n = int(input())
num = [ int(v) for v in input().split() ]
a, b, c = 0, 0, 0
for i in num:
	if i % 2 != 0:
		a += 1
	elif i % 4 != 0:
		b += 1
	else:
		c += 1
if b == 0:
	if c >= a - 1:
		print("Yes")
	else:
		print("No")
else:
	if c >= a:
		print("Yes")
	else:
		print("No")

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









import os
import sys




def main():
    n = int(input())
    A = list(map(int, input().split()))
    A_4 = [x for x in A if x % 4 == 0]
    A_2 = [x for x in A if x % 4 != 0 and x % 2 == 0]
    A_0 = [x for x in A if x % 2 != 0]
    if len(A_2) == 0 and len(A_0) <= len(A_4) + 1:
        print("Yes")
    elif len(A_2) % 2 == 0 and len(A_0) <= len(A_4):
        print("Yes")
    else:
        print("No")

if __name__ == "__main__":
    main()


Failing test case input:
3
-1 -2 0

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):









import os
import sys




def main():
    n = int(input())
    A = list(map(int, input().split()))
    A_4 = [x for x in A if x % 4 == 0]
    A_2 = [x for x in A if x % 4 != 0 and x % 2 == 0]
    A_0 = [x for x in A if x % 2 != 0]
    if len(A_2) == 0 and len(A_0) <= len(A_4) + 1:
        print("Yes")
    elif len(A_0) <= len(A_4):
        print("Yes")
    else:
        print("No")

if __name__ == "__main__":
    main()

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


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

nodd = 0
neven = 0
n4 = 0

for i in range(0,n):
  if a[i]%4==0:
    n4=n4+1
  elif a[i]%2==0:
    neven=neven+1
  else:
    nodd=nodd+1

res = 'No'

if n4*2 >= (nodd+neven%2):
  res = 'Yes'

print(res)


Failing test case input:
6
4 7 0 -1 6 9

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):


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

nodd = 0
neven = 0
n4 = 0

for i in range(0,n):
  if a[i]%4==0:
    n4=n4+1
  elif a[i]%2==0:
    neven=neven+1
  else:
    nodd=nodd+1

res = 'No'

if neven==0 and n4+1 >= (nodd):
  res = 'Yes'
elif n4+1 >= (nodd+1):
  res = 'Yes'
elif nodd==0:
  res = 'Yes'

print(res)
Problem: p03637
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
arr = list(map(int, input().split()))
four_count = 0
two_count = 0
for i in arr:
    if i % 4 == 0:
        four_count += 1
        continue
    if i % 2 == 0:
        two_count += 1
if 0 < four_count:
    N -= four_count * 2 + 1
if N + 1 <= two_count and 2 <= two_count:
    print('Yes')
    exit()
if N <= 0:
    print('Yes')
else:
    print('No')

Failing test case input:
3
2 10 110

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
N = int(input())
arr = list(map(int, input().split()))
four_count = 0
two_count = 0
for i in arr:
    if i % 4 == 0:
        four_count += 1
        continue
    if i % 2 == 0:
        two_count += 1
if 0 < four_count:
    N -= four_count * 2
if N <= 1:
    print('Yes')
    exit()
if N <= two_count:
    print('Yes')
    exit()
print('No')

Problem: p03637
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
input_list = [int(i) for i in input().split()]
four_count = 0
two_count = 0

for i in input_list:
    if i % 4 == 0:
        four_count += 1
    elif i % 2 == 0:
        two_count += 1

const = N 

if const > four_count:
    if const - four_count < two_count:
        print("Yes")
    else:
        print("No")
elif const == four_count:
    print("Yes")

Failing test case input:
3
0 14 011

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
N = int(input())
input_list = [int(i) for i in input().split()]
four_count = 0
two_count = 0

for i in input_list:
    if i % 4 == 0:
        four_count += 1
    elif i % 2 == 0:
        two_count += 1

others_count = N - four_count - two_count

if two_count:
    if others_count <= four_count:
        print("Yes")
    else:
        print("No")
else:
    if others_count <= four_count + 1:
        print("Yes")
    else:
        print("No")

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

four = 0
two = 0
other = 0
for i in a:
    if i % 4 == 0:
        four += 1
    elif i % 2 == 0:
        two += 1
    else:
        other += 1

ans = 'No'
if four + 1 >= other+two:
    ans = 'Yes'
elif two != 0 and two % 2 == 0:
    ans = 'Yes'


print(ans)

Failing test case input:
6
2 7 2 12 2 8

Expected output:
Yes


Actual output:
No


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

four = 0
two = 0
other = 0
for i in a:
    if i % 4 == 0:
        four += 1
    elif i % 2 == 0:
        two += 1
    else:
        other += 1

ans = 'No'
other += two % 2
if four + 1 >= other:
    ans = 'Yes'

print(ans)
Problem: p03637
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
n=int(input())
a=list(map(int,input().split()))
cnt4=0
cnt2=0
for i in range(n):
  if a[i]%4==0:
    cnt4+=1
  elif a[i]%2==0:
    cnt2+=1
if n-(2*cnt4)<=cnt2:
    print('Yes')
    sys.exit()
else:
    print('No')
    sys.exit()


Failing test case input:
3
1 -16 1

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
import sys
n=int(input())
a=list(map(int,input().split()))
cnt4=0
cnt2=0
for i in range(n):
  if a[i]%4==0:
    cnt4+=1
  elif a[i]%2==0:
    cnt2+=1
if n%2==1:
  if (2*cnt4)+1==n:
    print('Yes')
    sys.exit()
if n-(2*cnt4)<=cnt2:
    print('Yes')
    sys.exit()
else:
    print('No')
    sys.exit()

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

four = 0
two = 0
ele = 0
for i in range(n):
    if a[i] % 4 == 0:
        four += 1
    elif a[i] % 2 == 0 and a[i] % 4 != 0:
        two += 1
    else:
        ele += 1

ele += two % 2
two = two
if ele <= (two+four) or (ele-(four+two) == 1):
    print("Yes")
else:
    print("No")


Failing test case input:
6
6 7 0 8 3 5

Expected output:
No


Actual output:
Yes


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

four = 0
two = 0
ele = 0
for i in range(n):
    if a[i] % 4 == 0:
        four += 1
    elif a[i] % 2 == 0 and a[i] % 4 != 0:
        two += 1
    else:
        ele += 1


if ele <= four:
    print("Yes")
elif ele-four == 1 and two == 0:
    print("Yes")
else:
    print("No")

Problem: p03637
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
import math
N = int(input())
A = list(map(int,input().split()))
l = list()
for i in range(len(A)):
  if A[i]%4 == 0:
    l.append(A[i])
four = len(l)

a = math.ceil(N/3)

if a <= four:
  print("Yes")
else:
  print("No")

Failing test case input:
6
6 7 0 8 3 5

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
import math
N = int(input())
A = list(map(int,input().split()))
l = list()
ll = list()
for i in range(len(A)):
  if A[i]%4 == 0:
    l.append(A[i])
  if A[i]%2 == 0:
    ll.append(A[i])
four = len(l)
two = len(ll)-four
zero = N-two
a = math.floor(N/2)
if a <= four:
  print("Yes")
elif a-two/2 <= four:
  print("Yes")
else:
  print("No")
Problem: p03637
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
A =list(map(int,input().split()))
num4 = []
num2 = []
num1 = []
for a in A:
    if a%4 == 0:
        num4.append(a)
    elif a%2 == 0:
        num2.append(a)
    else:
        num1.append(a)

if len(num1)-1 > len(num4):
    print("No")
elif len(num2)==1 and len(num4)<len(num1)+1:
    print("No")
else:
    print("Yes")


Failing test case input:
3
1 28 010

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
n = int(input())
A =list(map(int,input().split()))
num4 = 0
num2 = 0
num1 = 0
for a in A:
    if a%4 == 0:
        num4 += 1
    elif a%2 == 0:
        num2 += 1
    else:
        num1 += 1

if num2 == 0:
    if num4 >= num1-1:
        print("Yes")
    else:
        print("No")
else:
    if num4 >= num1:
        print("Yes")
    else:
        print("No")

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








N = int(input())
input_list = [int(i) for i in input().split()]
four_count = 0
two_count = 0

for i in input_list:
    if i % 4 == 0:
        four_count += 1
    elif i % 2 == 0:
        two_count += 1

const = N 

if const > four_count:
    if const - four_count < two_count:
        print("Yes")
    else:
        print("No")
elif const == four_count:
    print("Yes")
else:
    print("Yes")

Failing test case input:
3
0 14 010

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
N = int(input())
input_list = [int(i) for i in input().split()]
four_count = 0
two_count = 0

for i in input_list:
    if i % 4 == 0:
        four_count += 1
    elif i % 2 == 0:
        two_count += 1

others_count = N - four_count - two_count

if two_count:
    if others_count <= four_count:
        print("Yes")
    else:
        print("No")
else:
    if others_count <= four_count + 1:
        print("Yes")
    else:
        print("No")

Problem: p03637
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = list(map(int,input().split()))
odd = 0
even2 = 0
even4 = 0
for i in A :
    if not i % 4 :
        even4 += 1
    elif not i % 2 :
        even2 += 1
    else :
        odd += 1
print(odd,even2,even4)
if odd <= even4 :
    ans = "Yes"
else :
    ans = "No"

print(ans)


Failing test case input:
3
-1 -1 -1

Expected output:
No


Actual output:
3 0 0
No


Fixed submission (verdict: Accepted):
N = int(input())
A = list(map(int,input().split()))
odd = 0
even2 = 0
even4 = 0
for i in A :
    if not i % 4 :
        even4 += 1
    elif not i % 2 :
        even2 += 1
    else :
        odd += 1

if (odd <= even4) or (N
    ans = "Yes"
else :
    ans = "No"

print(ans)
Problem: p03637
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
a=list(map(int,input().split()))
b,c=[],[]
for i in range(n):
    if a[i]%4==0:
        b.append(1)
    elif a[i]%4!=0 and a[i]%2!=0:
        c.append(1)
b=sum(b)
c=sum(c)
if c<=b+1:
    print("Yes")
else:
    print("No")

Failing test case input:
6
6 7 0 8 3 9

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
n=int(input())
a=list(map(int,input().split()))
b,c=[],[]
d=0
for i in range(n):
    if a[i]%4==0:
        b.append(1)
    elif a[i]%4!=0 and a[i]%2!=0:
        c.append(1)
    elif a[i]%4!=0 and a[i]%2==0:
        d+=1
b=sum(b)
c=sum(c)
if d>=1 and c<=b:
    print("Yes")
elif c<=b+1 and d==0:
    print("Yes")
else:
    print("No")

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

four_count,two_count = 0,0
for i in range(N):
  if(A[i]%4 == 0): four_count += 1
  elif(A[i]%2 == 0): two_count += 1



count = 0
if(two_count>=2): count += two_count
count += four_count*3

if(count >= N): print('Yes')
else: print('No')

Failing test case input:
6
6 7 0 8 3 5

Expected output:
No


Actual output:
Yes


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

four_count,two_count = 0,0
for i in range(N):
  if(A[i]%4 == 0): four_count += 1
  elif(A[i]%2 == 0): two_count += 1







if(two_count <= 1): Need = N
else: Need = N - two_count + 1
  
count = 0
if(four_count>=1): count += 2*four_count + 1
if(count >= Need): judge = 1
else: judge = 0

if(judge == 0): 
 if(N == two_count): judge = 1

if(judge == 0): print('No')
else: print('Yes')

Problem: p03637
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
a_arr = input().split(' ')

for i in range(len(a_arr)):
    a_arr[i] = int(a_arr[i])

counter = {
        "twon": 0,
        "forn": 0,
        "n": 0
}

for j in range(len(a_arr)):
    if a_arr[j] % 4 == 0:
        counter['forn'] += 1
    elif a_arr[j] % 2 == 0:
        counter['twon'] += 1
    else:
        counter['n'] += 1

indicator = N - counter['twon']/2
if counter['n'] - counter['forn'] <= 1:
    print("Yes")
else:
    print("No")


Failing test case input:
6
5 7 0 0 6 9

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
N = int(input())
a_arr = input().split(' ')

for i in range(len(a_arr)):
    a_arr[i] = int(a_arr[i])

counter = {
        "two": 0,
        "for": 0,
        "one": 0
}

for j in range(len(a_arr)):
    if a_arr[j] % 4 == 0:
        counter['for'] += 1
    elif a_arr[j] % 2 == 0:
        counter['two'] += 1
    else:
        counter['one'] += 1

indicator = N - counter['two']/2

if counter['two'] % 2 != 0:
    counter['one'] += 1
    
if counter['one'] - counter['for'] <= 1:
    print("Yes")
else:
    print("No")
Problem: p03637
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
a=list(map(int,input().split()))
a.sort()

c4=0
c2=0

for i in range(n):
    if a[i]%4==0:
        c4+=1
for i in range(n):
    if a[i]%4!=0 and a[i]%2==0:
        c2+=1

if c4==0:
    if all(a[i]%2==0 for i in range(n)):
       print('Yes')
elif n<=2*c4 + c2:
    print('Yes')
else:
    print('No')


Failing test case input:
3
-1 -1 -1

Expected output:
No


Actual output:

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

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

if n<=(2*c4 + max(1,c2-c4)):
    print('Yes')
else:
    print('No')

Problem: p03637
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int,input().split()))
a2 = [i % 2 for i in a].count(0)
a4 = [i % 4 for i in a].count(0)
a0 = n - a2
a2 -= a4 
if a0 < a4+1:
    ans = "Yes"
else:
    if a0 <= a4:
        ans = "Yes"
    else:
        ans = "No"
print(ans)


Failing test case input:
3
1 -16 1

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int,input().split()))
a2 = [i % 2 for i in a].count(0)
a4 = [i % 4 for i in a].count(0)
a0 = n - a2
a2 -= a4
if a2 == 0:
    if a0 <= a4+1:
        ans = "Yes"
    else:
        ans = "No"
else:
    if a0 <= a4:
        ans = "Yes"
    else:
        ans = "No"
print(ans)

Problem: p03637
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = list(map(int, input().split()))
d = {1:0, 2:0, 4:0}
for i in a:
  if i % 4 == 0:
    d[4] += 1
  elif i % 2 == 0:
    d[2] += 1
  else:
    d[1] += 1
if (d[2] >= 1 and d[1] <= d[4]) or d[1]-1 <= d[4]:
  print("Yes")
else:
  print("No")


Failing test case input:
6
5 7 0 0 6 9

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
n = int(input())
a = list(map(int, input().split()))
d = {1:0, 2:0, 4:0}
for i in a:
  if i % 4 == 0:
    d[4] += 1
  elif i % 2 == 0:
    d[2] += 1
  else:
    d[1] += 1
if d.get(2, 0) >= 1:
  d[1] += 1
if d.get(1, 0) <= d.get(4, 0)+1:
  print("Yes")
else:
  print("No")

Problem: p03637
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
li = list(map(int, input().split()))
yon = 0
ni  = 0
ki = 0
for a in li:
    if a % 4 == 0:
        yon += 1
    if a % 2 == 0:
        ni += 1
    else:
        ki += 1

if yon >= ki:
    print('Yes')
else:
    print('No')

Failing test case input:
3
1 -1 0

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
n = int(input())
li = list(map(int, input().split()))
yon = 0
ni  = 0
ki = 0
for a in li:
    if a % 4 == 0:
        yon += 1
        continue
    if a % 2 == 0:
        ni += 1
    else:
        ki += 1

if ni > 0:
    if yon >= ki:
        print('Yes')
    else:
        print('No')
elif ni == 0:
    if yon >= ki-1:
        print('Yes')
    else:
        print('No')