Problem:


Score : 600 points

Problem Statement

A tetromino is a figure formed by joining four squares edge to edge.
We will refer to the following seven kinds of tetromino as I-, O-, T-, J-, L-, S- and Z-tetrominos, respectively:

Snuke has many tetrominos. The number of I-, O-, T-, J-, L-, S- and Z-tetrominos in his possession are a_I, a_O, a_T, a_J, a_L, a_S and a_Z, respectively.
Snuke will join K of his tetrominos to form a rectangle that is two squares tall and 2K squares wide.
Here, the following rules must be followed:

When placing each tetromino, rotation is allowed, but reflection is not.

Each square in the rectangle must be covered by exactly one tetromino.

No part of each tetromino may be outside the rectangle.

Snuke wants to form as large a rectangle as possible.
Find the maximum possible value of K.

Constraints

0≤a_I,a_O,a_T,a_J,a_L,a_S,a_Z≤10^9

a_I+a_O+a_T+a_J+a_L+a_S+a_Z≥1

Input

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

a_I a_O a_T a_J a_L a_S a_Z

Output

Print the maximum possible value of K. If no rectangle can be formed, print 0.

Sample Input 1

2 1 1 0 0 0 0

Sample Output 1

3

One possible way to form the largest rectangle is shown in the following figure:

Sample Input 2

0 0 10 0 0 0 0

Sample Output 2

0

No rectangle can be formed.



Sample input:
2 1 1 0 0 0 0


Sample output:
3

Submission status: Wrong Answer

Solution code:
l=list(map(int,input().split()))
if l[0]==0 or l[3]==0 or l[4]==0:
  print((l[0]//2)*2+(l[3]//2+l[4]//2)*2+l[1])
else:
  print(max((l[0]//2)*2+(l[3]//2+l[4]//2)*2+l[1],((l[0]-1)//2)*2+((l[3]-1)//2+(l[4]-1)//2)*2+l[1]+1))

Submission status: Wrong Answer

Solution code:
i,o,_,j,l,_,_ = map(int, input().split())

evencnt= i%2 + j%2 + l%2
ans=o+i+j+l
if evencnt==1 or evencnt==2:
    ans-=1

print(ans)

Submission status: Wrong Answer

Solution code:
a = [int(x) for x in input().split()]

ans = 2*(a[0]/2 + a[3]/2 + a[4]/2) + 3*(1 & a[0] & a[3] & a[4])
if a[0] and a[3] and a[4]:
    ans = max(ans, 2*((a[0]-1)/2 + (a[3]-1)/2 + (a[4]-1)/2) + 3)

print(int(ans + a[1]))

Submission status: Wrong Answer

Solution code:
I, O, T, J, L, S, Z = map(int,input().split())
ans = (I // 2) * 2 + (J // 2) * 2 + (L // 2) * 2 + O
if I > 0 and J > 0 and L > 0:
    ans = max(ans, ((I - 1) // 2) * 2 + ((J - 1) // 2) * 2 + ((L - 1) // 2) * 2 + O)
print(ans)

Submission status: Wrong Answer

Solution code:
I, O, T, J, L, S, Z = map(int,input().split())
print(I + O + J + L)

Submission status: Wrong Answer

Solution code:
I, O, T, J, L, S, Z = map(int,input().split())
print(I + 2 * min(J, L) + O)

Submission status: Wrong Answer

Solution code:
ai,ao,at,aj,al,As,az = map(int,input().split())

ans = (ai//2)*4 + ao*2 + (aj//2)*4 + (al//2)*4
if(ai>0)&(aj>0)&(al>0):
    ai -= 1
    aj -= 1
    al -= 1
    tmp = 6 + (ai//2)*4 + ao*2 + (aj//2)*4 + (al//2)*4
    ans = max(ans,tmp)
print(ans)

Submission status: Wrong Answer

Solution code:
ni,no,nt,nj,nl,ns,nz=map(int,input().split())
ans=0
ans+=no
if ni%2==nl%2 and nl%2==nj%2:
  ans+=ni+nj+nl
else:
  ans+=ni+nj+nl-1
print(ans)

Submission status: Wrong Answer

Solution code:
ni,no,nt,nj,nl,ns,nz=map(int,input().split())
ans=0
ans+=no
c=0
c+=ni%2
c+=nl%2
c+=nj%2
# c:奇数の個数
if c==3 or c==0:
  ans+=ni+nj+nl
elif c==1:
  ans+=ni+nj+nl-1
elif ni>0 and nj>0 and nl>0:
  ans+=ni+nj+nl-1
else:
  ans+=ni+nj+nl-2
print(ans if ans else -1)

Submission status: Wrong Answer

Solution code:
ni,no,nt,nj,nl,ns,nz=map(int,input().split())
ans=0
ans+=no
c=0
c+=ni%2
c+=nl%2
c+=nj%2
if c==3 or c==0:
  ans+=ni+nj+nl
elif c==1:
  ans+=ni+nj+nl-1
elif ni and nj and nl:
  ans+=ni+nj+nl-1
else:
  ans+=ni+nj+nl-2
print(ans if ans else -1)

Submission status: Wrong Answer

Solution code:
ni,no,nt,nj,nl,ns,nz=map(int,input().split())
ans=0
ans+=no
if ni%2==nl%2 and nl%2==nj%2:
  ans+=ni+nj+nl
else:
  ans+=ni+nj+nl-1
print(ans if ans else -1)

Submission status: Wrong Answer

Solution code:
ni,no,nt,nj,nl,ns,nz=map(int,input().split())
ans=0
ans+=no
no=0
tmp=min(ni,nj,nl)
ans+=tmp*3
ni-=tmp
nj-=tmp
nl-=tmp
ans+=2*(ni//2)
ans+=2*(nj//2)
ans+=2*(nl//2)
print(ans if ans else -1)

Submission status: Wrong Answer

Solution code:
A = list(map(int, input().split()))
res = 0
if A[0]%2 + A[3]%2 + A[4]%2 >=2:
    A[0] -= 1
    A[3] -= 1
    A[4] -= 1
    res += 3
res += A[0]//2*2
res += A[1]
res += A[4]//2*2
res += A[3]//2*2
print(res)

Submission status: Wrong Answer

Solution code:
A = list(map(int, input().split()))
res = 0
if A[0]%2 and A[3]%2 and A[4]%2:
    A[0] -= 1
    A[3] -= 1
    A[4] -= 1
    res += 3
res += A[0]//2*2
res += A[1]
res += A[4]//2*2
res += A[3]//2*2
print(res)

Submission status: Wrong Answer

Solution code:
A = list(map(int, input().split()))
res = 0
if A[0]%2 and (A[0]%2 and A[3]%2 and A[4]%2):
    A[0] -= 1
    A[3] -= 1
    A[4] -= 1
    res += 3
res += A[0]//2*2
res += A[1]
res += A[4]//2*2
res += A[3]//2*2
print(res)

Submission status: Wrong Answer

Solution code:
A = list(map(int, input().split()))
if A[0]%2 or A[3]%2 or A[4]%2:
    if not (A[0]%2 and A[3]%2 and A[4]%2):
        print(0)
        exit()
res = 0
if A[0]%2:
    A[0] -= 1
    A[3] -= 1
    A[4] -= 1
    res += 3
res += A[0]
res += A[1]
res += A[4]
res += A[3]
print(res)

Submission status: Wrong Answer

Solution code:
A = list(map(int, input().split()))
res = 0
if A[0]%2:
    A[0] -= 1
    A[3] -= 1
    A[4] -= 1
    res += 3
res += A[0]
res += A[1]
res += A[4]
res += A[3]
print(res)

Submission status: Wrong Answer

Solution code:
A = list(map(int, input().split()))
res = 0
if A[0]%2:
    A[0] -= 1
    A[3] -= 1
    A[4] -= 1
    res += 3
res += A[0]
res += A[1]
res += A[4]
print(res)

Submission status: Wrong Answer

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

print(A[1] + (A[0]//2+A[3]//2+A[4]//2)*2 + 3*int(A[0]%2 and A[3]%2 and A[4]%2))

Submission status: Wrong Answer

Solution code:
I, O, T, J, L, S, Z = map(int, input().split())

width = 0


if  L % 2 + J % 2 + I % 2 >= 2:
    width += 6
    L -= 1
    J -= 1
    I -= 1

width += O * 2

width += I // 2 * 4
I %= 2

width += L // 2 * 4
L %= 2

width += J // 2 * 4
J %= 2


print(width // 2)

Submission status: Wrong Answer

Solution code:
I, O, T, J, L, S, Z = map(int, input().split())

width = 0

width += I // 2 * 4
I %= 2

width += O * 2

width += L // 2 * 4
L %= 2

width += J // 2 * 4
J %= 2

if L == J == I == 1:
    width += 6

print(width // 2)

Submission status: Wrong Answer

Solution code:
'''
研究室PCでの解答
'''
import math
#import numpy as np
import queue
import bisect
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)
mod = 10**9+7 #998244353
dir = [(-1,0),(1,0),(0,-1),(0,1)]
alp = "abcdefghijklmnopqrstuvwxyz"


def main():
    a,b,c,d,e,f,g = map(int,ipt().split())
    ans = (a//2*2+b+d//2*2+e//2*2)
    if a*d*e%2:
        ans += 3
    elif d*e%2 or a*d%2 or a*e%2:
        ans += 1
    print(ans)

    return None

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
'''
研究室PCでの解答
'''
import math
#import numpy as np
import queue
import bisect
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)
mod = 10**9+7 #998244353
dir = [(-1,0),(1,0),(0,-1),(0,1)]
alp = "abcdefghijklmnopqrstuvwxyz"


def main():
    a,b,c,d,e,f,g = map(int,ipt().split())
    ans = (a//2*2+b+d//2*2+e//2*2)
    if a*d*e%2:
        ans += 3
    elif d*e%2:
        ans += 1
    print(ans)

    return None

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
'''
研究室PCでの解答
'''
import math
#import numpy as np
import queue
import bisect
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)
mod = 10**9+7 #998244353
dir = [(-1,0),(1,0),(0,-1),(0,1)]
alp = "abcdefghijklmnopqrstuvwxyz"


def main():
    a,b,c,d,e,f,g = map(int,ipt().split())
    ans = (a//2*2+b+d//2*2+e//2*2)
    if a*d*e%2:
        ans += 3
    print(ans)

    return None

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
ai,ao,at,aj,al,aS,az=map(int,input().split())
ans = ao
if aj > 0 and al > 0 and aj > 0:
    print(ao + max(2 * (ai // 2 + al // 2 + aj // 2), 3 + 2 * ((ai - 1) // 2 + (al - 1) // 2 + (aj - 1) // 2)))
else:
    print(ao + 2 * (ai // 2 + al // 2 + aj // 2))

Submission status: Wrong Answer

Solution code:
ai,ao,at,aj,al,aS,az=map(int,input().split())
if aj > 0 and al > 0 and aj > 0:
    print(ao + min(2 * (ai // 2 + al // 2 + aj // 2), 3 + 2 * ((ai - 1) // 2 + (al - 1) // 2 + (aj - 1) // 2)))
else:
    print(ao + 2 * (ai // 2 + al // 2 + aj // 2))

Submission status: Wrong Answer

Solution code:
ai,ao,at,aj,al,aS,az=map(int,input().split())
if aj > 0 and al > 0 and ai > 0:
    print(ao + min(2 * (ai // 2 + al // 2 + aj // 2), 3 + 2 * ((ai - 1) // 2 + (al - 1) // 2 + (aj - 1) // 2)))
else:
    print(ao + 2 * (ai // 2 + al // 2 + aj // 2))

Submission status: Wrong Answer

Solution code:
ai,ao,at,aj,al,aS,az=map(int,input().split())
if aj > 0 and al > 0 and ai > 0:
    print(ao + min(ai // 2 + al // 2 + aj // 2, 3 + (ai - 1) // 2 + (al - 1) // 2 + (aj - 1) // 2))
else:
    print(ao + ai // 2 + al // 2 + aj // 2)

Submission status: Wrong Answer

Solution code:
ai,ao,at,aj,al,aS,az=map(int,input().split())
if aj > 0 and al > 0 and ai > 0:
    print(ao + min(ai // 2 + al // 2 + ai // 2, 3 + (ai - 1) // 2 + (al - 1) // 2 + (ai - 1) // 2))
else:
    print(ao + ai // 2 + al // 2 + ai // 2)

Submission status: Wrong Answer

Solution code:
ai,ao,at,aj,al,aS,az=map(int,input().split())
ans=ao
a=min(ai,aj,al)
ans+=3*a
ai-=a
aj-=a
al-=a
ans+=ai//2*2+aj//2*2+al//2*2
print(ans)

Submission status: Wrong Answer

Solution code:
i, o, t, j, l, s, z = map(int, input().split())
ans = o + (i // 2) * 2 + (j // 2) * 2 + (l // 2) * 2
if l * i * j == 0:
    pass
else:
    ll = l % 2
    ii = i % 2
    jj = j % 2
    if ll ++ ii + jj == 3:
        ans += 3
    elif ll + ii + jj == 1:
        pass
    else:
        ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
i, o, t, j, l, s, z = map(int, input().split())
ans = o
if l == 0:
    ans += (i // 2) * 2 + (j // 2) * 2
elif j == 0:
    ans += (i // 2) * 2 + (l // 2) * 2
elif l % 2 == 0 and j % 2 == 0:
    ans += l + j + (i // 2) * 2
else:
    ans += i + ((l - 1) // 2) * 2 + ((j - 1) // 2) * 2 + 2
print(ans)

Submission status: Wrong Answer

Solution code:
i, o, t, j, l, s, z = map(int, input().split())
ans = o
if l == 0:
    ans += (i // 2) * 2 + (j // 2) * 2
elif j == 0:
    ans += (i // 2) * 2 + (j // 2) * 2
elif l % 2 == 0 and j % 2 == 0:
    ans += l + j + (i // 2) * 2
else:
    ans += i + ((l - 1) // 2) * 2 + ((j - 1) // 2) * 2 + 2
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

I, O, T, J, L, S, Z = mapint()

three = 0
ans = O*2+(I//2+J//2+L//2)*4+three*6

three = 1
I -= 1
J -= 1
L -= 1
ans = max(ans, O*2+(I//2+J//2+L//2)*4+three*6)

print(ans//2)

Submission status: Wrong Answer

Solution code:
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

I, O, T, J, L, S, Z = mapint()
if I%2+J%2+L%2>=2:
    three = 1
    I -= 1
    J -= 1
    L -= 1
else:
    three = 0

ans = O*2+(I//2+J//2+L//2)*4+three*6
print(ans//2)

Submission status: Wrong Answer

Solution code:
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

I, O, T, J, L, S, Z = mapint()
if I%2==1 and J%2==1 and L%2==1:
    three = 1
else:
    if I%2+J%2+L%2==2:
        three = 1
        I -= 1
        J -= 1
        L -= 1
    else:
        three = 0

ans = O*2+(I//2+J//2+L//2)*4+three*6
print(ans//2)

Submission status: Wrong Answer

Solution code:
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

I, O, T, J, L, S, Z = mapint()
if I%2==1 and J%2==1 and L%2==1:
    three = 1
else:
    three = 0

ans = O*2+(I//2+J//2+L//2)*4+three*6
print(ans//2)

Submission status: Wrong Answer

Solution code:
aI, aO, aT, aJ, aL, aS, aZ = map(int, input().split())

K = aO + aI // 2 * 2 + aJ // 2 * 2 + aL // 2 * 2

if aI > 0 and aJ > 0 and aL > 0:
  K = min(aO + 3 + (aI - 1) // 2 * 2 + (aJ - 1) // 2 * 2 + (aL - 1) // 2 * 2, K)

print(K)

Submission status: Wrong Answer

Solution code:
aI, aO, aT, aJ, aL, aS, aZ = map(int, input().split())

K = aO
t = min(aI, aJ, aL)
K += max(aI // 2 * 2 + aJ // 2 * 2 + aL // 2 * 2, t * 3 + (aI - t) // 2 * 2 + (aJ - t) // 2 * 2 + (aL - t) // 2 * 2)

print(K)

Submission status: Wrong Answer

Solution code:
A=list(map(int,input().split()))
print(A[1]+(A[0]//2+A[3]//2+A[4]//2)*2+(A[0]%2+A[3]%2+A[4]%2)//3*3)

Submission status: Wrong Answer

Solution code:
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

I, O, T, J, L, S, Z = map(int, read().split())

x = O
y = 3 + 2 * ((L - 1) // 2 + (I - 1) // 2 + (J - 1) // 2)  # LIJ あり
z = 2 * (L // 2 + I // 2 + J // 2)  # LIJ なし
x += max(y, z)
print(x)

Submission status: Wrong Answer

Solution code:
aI, aO, _, aJ, aL, _, _ = map(int, input().split())


def f(i, j, l):
    return aO + 2 * (i // 2 + j // 2 + l // 2)


ans = f(aI, aJ, aL)
if aI % 2 == 1 and aJ % 2 == 1 and aL % 2 == 1:
    ans = max(ans, 3 + f(aI - 1, aJ - 1, aL - 1))
print(ans)

Submission status: Wrong Answer

Solution code:
def f(i, j, l):
    return aO + 2 * (i // 2 + j // 2 + l // 2)


aI, aO, _, aJ, aL, _, _ = map(int, input().split())
ans = f(aI, aJ, aL)
if aI % 2 == 1 and aJ % 2 == 1 and aL % 2 == 1:
    ans = max(ans, 3 + f(aI - 1, aJ - 1, aL - 1))
print(ans)

Submission status: Wrong Answer

Solution code:
aI, aO, _, aJ, aL, _, _ = map(int, input().split())
ans = aO + 2 * (aI // 2 + aJ // 2 + aL // 2)
if aI % 2 and aJ % 2 and aL % 2:
    ans += 3
print(ans)

Submission status: Wrong Answer

Solution code:
i,o,t,j,l,s,z = map(int,input().split())
if i > 0 and j > 0 and i > 0:
  print(max(o + i//2*2 + j//2*2 + l//2*2,o + (i-1)//2*2 + (j-1)//2*2 + (l-1)//2*2 + 3))
else:
  print(o + i//2*2 + j//2*2 + l//2*2)

Submission status: Wrong Answer

Solution code:
i,o,t,j,l,s,z = map(int,input().split())
print(max(o + i//2*2 + j//2*2 + l//2*2,o + (i-1)//2*2 + (j-1)//2*2 + (l-1)//2*2 + 3))

Submission status: Wrong Answer

Solution code:
i,o,t,j,l,s,z = map(int,input().split())
print(max(o + i//2*2 + j//2*2 + l//2*2,o + (i-1)//2*2 + (j-1)//2*2 + (l-1)/2*2 + 3))

Submission status: Wrong Answer

Solution code:
i,o,t,j,l,s,z = map(int,input().split())
print(o + i//2*2 + j//2*2 + l//2*2 + (i%2)*(j%2)*(l%2)*3)

Submission status: Wrong Answer

Solution code:
i,o,t,j,l,s,z = map(int,input().split())
print(o + (i//2)*2 + (j//2)*2 + (l//2)*2)

Submission status: Wrong Answer

Solution code:
i,o,t,j,l,s,z = map(int,input().split())
print(o + i//2*2 + j//2*2 + l//2*2)

Submission status: Wrong Answer

Solution code:
i,o,t,j,l,s,z=map(int,input().split())
ans=o
ans+=i-(i%2)
ans+=l-(l%2)
ans+=j-(j%2)
if i%2+j%2+l%2==3:
  ans+=3
elif i%2+j%2+l%2==2:
  if l>0:
    ans+=1
print(ans)

Submission status: Wrong Answer

Solution code:
a = list(map(int,input().split()))
ans = a[1]
if a[0]%2*a[3]%2*a[4]%2 == 1:
  ans += a[0]+a[3]+a[4]
else:
  ans += a[0]//2*2+a[3]//2*2+a[4]//2*2
print(ans)

Submission status: Wrong Answer

Solution code:
i, o, _, j, l, _, _ = map(int, input().split())
print((max(0, 6 + ((i - 1) // 2 + (j - 1) // 2 + (l - 1) // 2) * 4, (i // 2 + j // 2 + l // 2) * 4) + 2 * o) // 2)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
from collections import *

ai, ao, _, aj, al, _, _ = map(int, input().split())
ans = ao+ai//2*2+aj//2*2+al//2*2

if aj>=1 and al>=1:
    ans_ = ao+(ai-1)//2*2+3
    ans_ += (aj-1)//2*2+(al-1)//2*2
    ans = max(ans, ans_)

print(ans)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
from collections import *

ai, ao, _, aj, al, _, _ = map(int, input().split())
ans = ao+ai//2*2+aj//2*2+al//2*2

if ai%2==1 and aj>=1 and al>=1:
    ans_ = ao+ai//2*2+3
    aj -= 1
    al -= 1
    ans_ += aj//2*2+al//2*2
    ans = max(ans, ans_)

print(ans)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
from collections import *

ai, ao, _, aj, al, _, _ = map(int, input().split())
ans = ao+ai//2*2
ai %= 2

if ai==1 and aj>=1 and al>=1:
    ans += 3
    aj -= 1
    al -= 1

ans += 2*min(aj, al)
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
from collections import *

ai, ao, _, aj, al, _, _ = map(int, input().split())
m = min(ai, aj, al)
ans = ao+3*m
ans += (ai-m)//2*2
ans += 2*min(aj-m, al-m)
print(ans)

Submission status: Wrong Answer

Solution code:
i, o, t, j, l, s, z = map(int, input().split())

k = 0
k += (i // 2) * 2
k += o
k += (j // 2) * 2
k += (l // 2) * 2
if i%2 == 1 and j%2 == 1 and l%2 == 1:
    k += 3
print(k)

Submission status: Wrong Answer

Solution code:
Ai, Ao, Ar, Aj, Al, As, Az = map(int, input().split())

n_1 = Ao
n_2 = Ai // 2
n_4 = Aj // 2 + Al // 2

ans = n_1 + 2 * n_2 + 4 * n_4
print(ans)

Submission status: Wrong Answer

Solution code:
i, o, t, j, l, s, z = map(int, input().split())

k = 0
k += (i // 2) * 2
k += o
k += (j // 2) * 2
k += (l // 2) * 2
print(k)

Submission status: Wrong Answer

Solution code:
import sys

def solve():
    input = sys.stdin.readline
    I, O, T, J, L, S, Z = map(int, input().split())
    Ans = O
    six = min([I, J, L])
    Ans += 3 * six
    I -= six
    J -= six
    L -= six
    Ans += 2 * (I // 2 + J // 2 + L // 2)
    print(Ans)
    
    return 0

if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

Solution code:
I, O, _, J, L, _, _ = map(int, input().split())

ans = O * 2

if sum([a % 2 for a in (I, J, L)]) == 2 and min(I, J, L) >= 1:
    I -= 1
    J -= 1
    L -= 1
    ans += 6

ans += sum([(a // 2) * 4 for a in (I, J, L)])
print(ans // 2)

Submission status: Wrong Answer

Solution code:
aI, aO, _, aJ, aL, _, _ = map(int, input().split())

ans = 0

ans += 2 * (aI // 2)
ans += 2 * (aL // 2)
ans += 2 * (aJ // 2)

JIL = min(aI % 2, aJ % 2, aL % 2)
ans += 3 * JIL

ans += 1 * aO

print(ans)

Submission status: Wrong Answer

Solution code:
aI, aO, _, aJ, aL, _, _ = map(int, input().split())

ans = 0

JIL = min(aI, aJ, aL)
ans += 3 * JIL
aI -= JIL
aJ -= JIL
aL -= JIL

ans += 2 * (aI // 2)
ans += 2 * (aL // 2)
ans += 2 * (aJ // 2)
ans += 1 * aO

print(ans)

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f,g=map(int,input().split())
if a%2==d%2==e%2:
    print(a+b+d+e)
else:
    print(a+b+d+e-1)

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f,g=map(int,input().split())
if a%2==d%2==e%2==1:
    print(2*(a//2+d//2+e//2)+b+3)
else:
    print(2*(a//2+d//2+e//2)+b)

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f,g=map(int,input().split())
if a%2==d%2==e%2==1:
    print(2*(a//2+d//2+e//2)+b+2)
else:
    print(2*(a//2+d//2+e//2)+b)

Submission status: Wrong Answer

Solution code:
a,b,_,c,d,_,_=map(int,input().split())
e=0
if a%2+c%2+d%2>=2:
    e=3
    a-=1
    c-=1
    d-=1
print((a//2)*2+b+(c//2)*2+(d//2)*2+e)

Submission status: Wrong Answer

Solution code:
a,b,_,c,d,_,_=map(int,input().split())
print((a//2)*2+b+(c//2)*2+(d//2)*2)

Submission status: Wrong Answer

Solution code:
i,o,t,j,l,s,z=map(int,input().split())
ans=0
ans+=o
if j==1 and l==1 and i==1:
    ans+=3
elif j<2 or l<2 or i<2:
    ans+=0
elif j%2==1 and l%2==1 and i%2==1:
    ans+=j+i+l
elif j%2==1 and l%2==1 and i%2==0:
    ans+=j+i+l-1
elif j%2==1 and l%2==0 and i%2==1:
    ans+=j+i+l-1
elif j%2==1 and l%2==0 and i%2==0:
    ans+=j+i+l-1
elif j%2==0 and l%2==1 and i%2==1:
    ans+=j+i+l-1
elif j%2==0 and l%2==1 and i%2==0:
    ans+=j+i+l-1
elif j%2==0 and l%2==0 and i%2==1:
    ans+=j+i+l-1
elif j%2==0 and l%2==0 and i%2==0:
    ans+=j+i+l
print(ans)

Submission status: Wrong Answer

Solution code:
i,o,t,j,l,s,z=map(int,input().split())
ans=0
ans+=o
if j%2==1 and l%2==1 and i%2==1:
    ans+=j+i+l
if j%2==1 and l%2==1 and i%2==0:
    ans+=j+i+l-1
if j%2==1 and l%2==0 and i%2==1:
    ans+=j+i+l-1
if j%2==1 and l%2==0 and i%2==0:
    ans+=j+i+l-1
if j%2==0 and l%2==1 and i%2==1:
    ans+=j+i+l-1
if j%2==0 and l%2==1 and i%2==0:
    ans+=j+i+l-1
if j%2==0 and l%2==0 and i%2==1:
    ans+=j+i+l-1
if j%2==0 and l%2==0 and i%2==0:
    ans+=j+i+l
print(ans)

Submission status: Wrong Answer

Solution code:
i,o,t,j,l,s,z=map(int,input().split())
ans=0
ans+=o
if j%2==1 and l%2==1:
    j-=1
    l-=1
    i-=1
    ans+=3
ans+=(j//2)*2
ans+=(l//2)*2
ans+=(i//2)*2
print(ans)

Submission status: Wrong Answer

Solution code:
i,o,t,j,l,s,z=[int(i) for i in input().split()]

ans=o*2+4*(i//2)+4*(l//2)+4*(j//2)
ans=max(ans,o*2+4*((~-i)//2)+4*((~-l)//2)+4*((~-j)//2)+6)

print(ans//2)

Submission status: Wrong Answer

Solution code:
i,o,t,j,l,s,z=[int(i) for i in input().split()]

ans=o*2+4*(i//2)+4*(l//2)+4*(j//2)
ans=max(ans,o*2+4*(~-i//2)+4*(~-l//2)+4*(~-j//2)+6)

print(ans//2)

Submission status: Wrong Answer

Solution code:
i,o,t,j,l,s,z=map(int,input().split())
ansl=[o,o]
ansl[0]+=3+(max(0,(i-1)//2))*2+(max(0,(j-1)//2))*2+(max(0,(l-1)//2))*2
ansl[1]+=(i//2)*2+(j//2)*2+(l//2)*2
print(max(ansl))

Submission status: Wrong Answer

Solution code:
i,o,t,j,l,s,z=map(int,input().split())
ansl=[o,o]
ansl[0]+=3+((i-1)//2)*2+((j-1)//2)*2+((l-1)//2)*2
ansl[1]+=(i//2)*2+(j//2)*2+(l//2)*2
print(max(ansl))

Submission status: Wrong Answer

Solution code:
i,o,t,j,l,s,z=map(int,input().split())
ans=0
ans+=o
if (i%2)+(j%2)+(l%2)>=2:
    ans+=i+j+l
else:
    ans+=i-(i%2)+j-(j%2)+l-(l%2)
print(ans)

Submission status: Wrong Answer

Solution code:
a,b,q,c,d,w,f=map(int,input().split())
k=0
k+=a-(a%2)
k+=b
k+=c-(c%2)
k+=d-(d%2)
if a%2==1 and c%2==1 and d%2==1:
  k+=3
print(k)

Submission status: Wrong Answer

Solution code:
## coding: UTF-8
#最後の方のテストケースでREになってしまう。時間切れ。
#from decimal import *
#from itertools import permutations, combinations,combinations_with_replacement,product

#N = int(input())

s = input().split()
p = [int(w) for w in s]

#print(p)

I = p[0]
O = p[1]
#T = p[2] #使わない
J = p[3]
L = p[4] 
#S = p[5] #使わない
#Z = p[6] #使わない

answer = 0

answer += O #O型は最初に全部使います。


if(I % 2 == J % 2 and I % 2 == L % 2):
    #[odd,odd,odd] or [even,even,even]
    #[0,0,0],[0,0,even]
    answer += I+J+L
elif( (I + J + L) % 2 == 1):
    #[even,even,odd]
    #[0,0,odd]
    answer += I+J+L-1
else:
    #[even,odd,odd]
    #if(min(I,J,L) % 2 == 0):
        #answer += I+J+L - 2
    #else:
        #answer += I+J+L - 1
    answer += I+J+L-1

print(answer)

Submission status: Wrong Answer

Solution code:
## coding: UTF-8
#最後の方のテストケースでREになってしまう。時間切れ。
#from decimal import *
#from itertools import permutations, combinations,combinations_with_replacement,product

#N = int(input())

s = input().split()
p = [int(w) for w in s]

#print(p)

I = p[0]
O = p[1]
#T = p[2] #使わない
J = p[3]
L = p[4] 
#S = p[5] #使わない
#Z = p[6] #使わない

answer = 0

answer += O #O型は最初に全部使います。

if(I % 2 == J % 2 and I % 2 == L % 2):
    #[odd,odd,odd] or [even,even,even]
    answer += I+J+L
elif( (I + J + L) % 2 == 1):
    #[even,even,odd]
    answer += I+J+L-1
else:
    if(min(I,J,L) % 2 == 0):
        answer += I+J+L - 2
    else:
        answer += I+J+L - 1

print(answer)

Submission status: Wrong Answer

Solution code:
## coding: UTF-8
#最後の方のテストケースでREになってしまう。時間切れ。
#from decimal import *
#from itertools import permutations, combinations,combinations_with_replacement,product

#N = int(input())

s = input().split()
p = [int(w) for w in s]

print(p)

I = p[0]
O = p[1]
#T = p[2] #使わない
J = p[3]
L = p[4] 
#S = p[5] #使わない
#Z = p[6] #使わない

answer = 0

answer += O #O型は最初に全部使います。

if(I % 2 == J % 2 and I % 2 == L % 2):
    #[odd,odd,odd] or [even,even,even]
    answer += I+J+L
elif( (I + J + L) % 2 == 1):
    #[even,even,odd]
    answer += I+J+L-1
else:
    if(min(I,J,L) % 2 == 0):
        answer += I+J+L - 2
    else:
        answer += I+J+L - 1

print(answer)

Submission status: Wrong Answer

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

cnt = (a[0] // 2) * 4
cnt += a[1] * 2
cnt += (a[3] // 2) * 4
cnt += (a[4] // 2) * 4

IJL = (a[0] % 2 + a[3] % 2 + a[4] % 2)
if IJL == 2:
    cnt += 2
elif IJL == 3:
    cnt += 6

print(cnt // 2)

Submission status: Wrong Answer

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

cnt = (a[0] // 2) * 4
cnt += a[1] * 2
cnt += (a[3] // 2) * 4
cnt += (a[4] // 2) * 4
cnt += (a[0] % 2 + a[3] % 2 + a[4] % 2) // 3 * 6

print(cnt // 2)

Submission status: Wrong Answer

Solution code:
i,o,t,j,l,s,z = map(int,input().split())

ans = 0

ans += i // 2 * 2
ans += o
ans += j // 2 * 2
ans += l // 2 * 2

print(ans)

Submission status: Wrong Answer

Solution code:
i,o,t,j,l,s,z = map(int, input().split())
k = o*2
p = (i//2 + j//2 + l//2)*4
q = 0
if i*j*l:
  q = ((i-1)//2 + (j-1)//2 + (l-1)//2)*4 + 6
print(k + max(p, q))

Submission status: Wrong Answer

Solution code:
i,o,t,j,l,s,z = map(int, input().split())
k = o
p = (i//2 + j//2 + l//2)*2
q = 0
if i*j*k:
  q = ((i-1)//2 + (j-1)//2 + (l-1)//2)*2 + 3
print(k + max(p, q))

Submission status: Wrong Answer

Solution code:
i,o,t,j,l,s,z = map(int, input().split())
k = o*2
p = (i//2 + j//2 + l//2)*4
q = 0
if i*j*k:
  q = ((i-1)//2 + (j-1)//2 + (l-1)//2)*4 + 6
print(k + max(p, q))

Submission status: Wrong Answer

Solution code:
i,o,t,j,l,s,z = map(int, input().split())
k = o*2
p = (i//2 + j//2 + l//2)*4
q = ((i-1)//2 + (j-1)//2 + (l-1)//2)*4 + 6
print(k + max(p, q))

Submission status: Wrong Answer

Solution code:
aI, aO, _, aJ, aL, _, _ = map(int, input().split())
ans = max(aI//2*2+aO+aJ//2*2+aL//2*2, 3+(aI-1)//2*2+aO+(aJ-1)//2*2+(aL-1)//2*2)

print(ans)

Submission status: Wrong Answer

Solution code:
aI, aO, _, aJ, aL, _, _ = map(int, input().split())
ans = aI//2*2+aO+aJ//2*2+aL//2*2

if aI%2==1 and aJ%2==1 and aL%2==1:
    ans += 3

print(ans)

Submission status: Wrong Answer

Solution code:
#c
#ignore t,s,z
a = [int(i) for i in input().split()]
ans = a[1]
b = [a[0],a[3],a[4]] #select

for i,v in enumerate(b):
    if v%2==1: #odd
        ans += v-1
        b[i] = 1
    else:
        ans += v-2
        b[i] = 2

s = sum(b)
if s==6:
    ans += 6
elif s==5:
    ans += 4
elif s==4:
    if min(b)==0:
        ans += 4
    else:
        ans += 3
elif s==3:
    if max(b)==2:
        ans += 2
    else:
        ans += 3
elif s==2:
    if max(b)==2:
        ans += 2

print(ans)

Submission status: Wrong Answer

Solution code:
import sys
def main():
    input = sys.stdin.readline
    i,o,t,j,l,s,z = map(int, input().split())

    ans = 0
    ans += o
    ans += i&(~1)
    ans += j&(~1)
    ans += l&(~1)
    ans += (i&j&l&1)*3
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
def main():
    input = sys.stdin.readline
    i,o,t,j,l,s,z = map(int, input().split())

    ans = 0
    ans += i&(~1)
    ans += o
    ans += j&(~1)
    ans += l&(~1)
    ans += i&j&l&1
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
I, O, T, J, L, S, Z = map(int, input().split())
ans = 0

ans += O * 2

if sum([i % 2 for i in [I, J, L]]) >= 2:
    mi = min(I, J, L)
    ans += mi * 6
    I -= mi
    J -= mi
    L -= mi

ans += (I // 2) * 4
ans += (J // 2) * 4
ans += (L // 2) * 4

print(ans // 2)

Submission status: Wrong Answer

Solution code:
I, O, T, J, L, S, Z = map(int, input().split())
ans = 0

ans += O * 2

if sum([i % 2 for i in [I, J, L]]) > 2:
    mi = min(I, J, L)
    ans += mi * 6
    I -= mi
    J -= mi
    L -= mi

ans += (I // 2) * 4
ans += (J // 2) * 4
ans += (L // 2) * 4

print(ans // 2)

Submission status: Wrong Answer

Solution code:
import sys
def main():
    input = sys.stdin.readline
    i,o,t,j,l,s,z = map(int, input().split())

    ans = 0
    ans += i&(~1)
    ans += o
    ans += j&(~1)
    ans += l&(~1)
    ans += i&1 & (j&1&j)
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
I, O, T, J, L, S, Z = map(int, input().split())
ans = 0

ans += O * 2
mi = min(I, J, L)
ans += mi * 6
I -= mi
J -= mi
L -= mi
ans += (I // 2) * 4
ans += (J // 2) * 4
ans += (L // 2) * 4

print(ans // 2)

Submission status: Wrong Answer

Solution code:
import sys
def main():
    input = sys.stdin.readline
    i,o,t,j,l,s,z = map(int, input().split())

    ans = 0
    ans += i&(~1)
    ans += o
    ans += j&(~1)
    ans += l&(~1)
    ans += i&1 & (j&1|l&1)
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
I,O,_,J,L,_,_ = map(int,input().split())
ans1 = O + I-I%2 + J-J%2 + L-L%2
m = min(I,J,L)
ans2 = 3*m
I,J,L = I-m,J-m,L-m
ans2 += O + I-I%2 + J-J%2 + L-L%2
if I==0 and J%2 and L%2:
    ans2 += 1
print(max(ans1,ans2))

Submission status: Wrong Answer

Solution code:
I, O, T, J, L, S, Z = map(int, input().split())
ans = 0

ans += O * 2
ans += (I // 2) * 4
ans += (J // 2) * 4
ans += (L // 2) * 4

if I % 2 and J % 2 and L % 2:
    ans += 6

print(ans // 2)

Submission status: Wrong Answer

Solution code:
I, O, T, J, L, S, Z = map(int, input().split())
ans = 0

ans += O * 2
ans += (I // 2) * 4
ans += (J // 2) * 4
ans += (L // 2) * 4

print(ans // 2)

Submission status: Wrong Answer

Solution code:
import sys
def main():
    input = sys.stdin.readline
    i,o,t,j,l,s,z = map(int, input().split())

    ans = 0
    ans += i&(~1)
    ans += o
    ans += j&(~1)
    ans += l&(~1)
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
I, O, T, J, L, S, Z = map(int, input().split())

k = 0
if I >= 1 and J >= 1 and L >= 1:
    temp = min([I, J, L])
    k += temp*3
    I -= temp
    J -= temp
    L -= temp

k += O
k += (I//2)*2
k += (J//2)*2
k += (L//2)*2
print(k)

Submission status: Wrong Answer

Solution code:
I,O,_,J,L,_,_ = map(int,input().split())
ans1 = O + I-I%2 + J-J%2 + L-L%2
m = min(I,J,L)
ans2 = 3*m
I,J,L = I-m,J-m,L-m
ans2 += O + I-I%2 + J-J%2 + L-L%2
print(max(ans1,ans2))

Submission status: Wrong Answer

Solution code:
I, O, T, J, L, S, Z = map(int, input().split())

k = 0
if I >= 1 and J >= 1 and L >= 1:
    temp = min([I, J, L])
    k += temp
    I -= temp
    J -= temp
    L -= temp

k += O
k += (I//2)*2
k += (J//2)*2
k += (L//2)*2
print(k)

Submission status: Wrong Answer

Solution code:
I,O,_,J,L,_,_ = map(int,input().split())
m = min(I,J,L)
ans = 3*m
I,J,L = I-m,J-m,L-m
if m >= 2:
    ans += I
    I = 0
ans += O + I-I%2 + J-J%2 + L-L%2
print(ans)

Submission status: Wrong Answer

Solution code:
I,O,_,J,L,_,_ = map(int,input().split())
m = min(I,J,L)
ans = 3*m
I,J,L = I-m,J-m,L-m
ans += O + I-I%2 + J-J%2 + L-L%2
print(ans)

Submission status: Wrong Answer

Solution code:
I,O,_,J,L,_,_ = map(int,input().split())
ans = O + I-I%2 + J-J%2 + L-L%2
if I%2 and J%2 and L%2:
    ans += 3
print(ans)

Submission status: Wrong Answer

Solution code:
I,O,_,J,L,_,_ = map(int,input().split())
ans = O + I-I%2 + J-J%2 + L-L%2
print(ans)

Submission status: Wrong Answer

Solution code:
I,O,_,J,L,_,_ = map(int,input().split())
ans = O + I-I%2 + min(J,L)
print(ans)