Score: 600 points
Problem Statement:
A tetromino is a figure formed by joining four squares edge to edge. There are seven kinds of tetromino: I-, O-, T-, J-, L-, S-, and Z-tetrominos. Snuke has a certain number of each type of tetromino. He wants to join K of his tetrominos to form a rectangle that is two squares tall and 2K squares wide. Each tetromino can be rotated but not reflected. The goal is to 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, and a_I + a_O + a_T + a_J + a_L + a_S + a_Z ≥ 1. Input: 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. Sample Input 2: 0 0 10 0 0 0 0. Sample Output 2: 0.

# Buggy version:
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)

# Fixed version:
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//2)

# Buggy version:
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)

# Fixed version:
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)

# Buggy version:
A = list(map(int, input().split()))
S = A[1] * 2
S += (A[0] // 2) * 4
if A[4] > 0 and A[5] > 0 and A[0] % 2 == 1:
  A[4] -= 1
  A[5] -= 1
  S += 3
S += (A[4] // 2) * 4 + (A[5] // 2) * 4
print(S)

# Fixed version:
A = list(map(int, input().split()))
res = 0
if A[0]%2 + A[3]%2 + A[4]%2 >=2 and A[0]*A[3]*A[4]>0:
    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)

# Buggy version:
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)


# Fixed version:
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 and l<2 and 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)

# Buggy version:
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)) 

# Fixed version:
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*l:
  q = ((i-1)//2 + (j-1)//2 + (l-1)//2)*2 + 3
print(k + max(p, q))

# Buggy version:
a=list(map(int,input().split()))
ans=min(a[0],a[3],a[4])
a[0]-=ans
a[3]-=ans
a[4]-=ans
ans*=3
if(ans>0&&(a[0]%2+a[3]%2+a[4]%2==2)):
  ans+=1
ans+=(a[0]//2*2)+(a[3]//2*2)+(a[4]//2*2)+a[1]
print(ans)


# Fixed version:
a=list(map(int,input().split()))
ans=min(a[0],a[3],a[4])
a[0]-=ans
a[3]-=ans
a[4]-=ans
ans*=3
if(ans>0 and (a[0]%2+a[3]%2+a[4]%2==2)):
  ans+=1
ans+=(a[0]//2*2)+(a[3]//2*2)+(a[4]//2*2)+a[1]
print(ans)

# Buggy version:
I,O,R,J,L,S,Z=map(int,input().split())
a=(I//2+J//2+L//2)*2
b=0
if I*J*L!=0:b=(2*((I-1)//2+(J-1)//2+(L-1)//2)+3)
print(max(a,b))

# Fixed version:
I,O,R,J,L,S,Z=map(int,input().split())
a=(I//2+J//2+L//2)*2
b=0
if I*J*L!=0:b=(2*((I-1)//2+(J-1)//2+(L-1)//2)+3)
print(max(a,b)+O)

# Buggy version:
i,o,t,j,l,s,z=map(int,input().split())
ans=0
if i==0 or j==0 or l==0:
  ans+=o+(i//2)*2+min(j,l)*2
else:
  ans+=o+(i//2)*2+min(j,l)*2
  ans1=o+((i-1)//2)*2+max(0,min(j-1.l-1))*2
print(ans)

# Fixed version:
i,o,t,j,l,s,z=map(int,input().split())
ans=0
if i==0 or j==0 or l==0:
  ans+=o+(i//2)*2+(j//2)*2+(l//2)*2
else:
  ans+=o+(i//2)*2+(j//2)*2+(l//2)*2
  ans1=o+((i-1)//2)*2+((j-1)//2)*2+((l-1)//2)*2+3
  ans=max(ans,ans1)
print(ans)

# Buggy version:
A = {k:a for k,a in zip(list("IOTJLSZ"),map(int,input().split()))}
m = min(A["I"],A["J"],A["L"])
ans = 0
for i in (0,1,m-1,m):
    ans = max(ans, 3*i + A["O"] + (A["I"]-i)//2 + (A["J"]-i)//2 + (A["L"]-i)//2)
print(ans)

# Fixed version:
A = {k:a for k,a in zip(list("IOTJLSZ"),map(int,input().split()))}
m = min(A["I"],A["J"],A["L"])
ans = 0
for i in range(min(2,m+1)):
    ans = max(ans, 3*i + A["O"] + (A["I"]-i)//2*2 + (A["J"]-i)//2*2 + (A["L"]-i)//2*2)
print(ans)

# Buggy version:
a=list(map(int,input().split()))
k,h=b,b
k+=a[0]-a[0]%2
k+=a[3]-a[3]%2
k+=a[4]-a[4]%2
if min(a[0],a[3],a[4])>0:
    h+=3
    a[0],a[3],a[4]=a[0]-1,a[3]-1,a[4]-1
    h+=a[0]-a[0]%2
    h+=a[3]-a[3]%2
    h+=a[4]-a[4]%2
print(max(k,h))

# Fixed version:
a=list(map(int,input().split()))
k,h=a[1],a[1]
k+=a[0]-a[0]%2
k+=a[3]-a[3]%2
k+=a[4]-a[4]%2
if min(a[0],a[3],a[4])>0:
    h+=3
    a[0],a[3],a[4]=a[0]-1,a[3]-1,a[4]-1
    h+=a[0]-a[0]%2
    h+=a[3]-a[3]%2
    h+=a[4]-a[4]%2
print(max(k,h))

# Buggy version:
I,O,T,J,L,S,Z = map(int,input().split())
print(max(((I-1)//2+(J-1)//2+(L-1)//2)*2+O+3*(I>0*❨L>0❩*❨J>0❩,(I//2+J//2+L//2)*2+O))


# Fixed version:
I,O,T,J,L,S,Z = map(int,input().split())
print(max(((I-1)//2+(J-1)//2+(L-1)//2)*2+O+3*(I>0)*(L>0)*(J>0),(I//2+J//2+L//2)*2+O))

# Buggy version:
a = [int(i) for i in input().split()]
f = lambda x: max(0,x-x%2)
print(max(a[1]+f(a[0])+f(a[3])+f(a[4]),a[1]+f(a[0]-1)+f(a[3]-1)+f(a[4]-1)+3))

# Fixed version:
a = [int(i) for i in input().split()]
f = lambda x: x-x%2
ans = a[1]+f(a[0])+f(a[3])+f(a[4])
if a[0] and a[3] and a[4]: ans = max(ans, a[1]+f(a[0]-1)+f(a[3]-1)+f(a[4]-1)+3)
print(ans)

# Buggy version:
I,O,T,J,L,S,Z = map(int,input().split())
if I==1 and J==1 and L==1:                                                     
    print(3) 
elif ((I-1)//2+(J-1)//2+(L-1)//2)*2+O==0 and (I//2+J//2+L//2)*2+O)==0:
    print(0)
else:
    print(max(((I-1)//2+(J-1)//2+(L-1)//2)*2+O+3,(I//2+J//2+L//2)*2+O))


# Fixed version:
I, O, T, J, L, S, Z = map(int, input().split())
if I>0 and J>0 and L>0:
    print(O + max(2*(I//2+J//2+L//2), 3+2*((I-1)//2+(J-1)//2+(L-1)//2)))
else:
    print(O+2*(I//2+J//2+L//2))

# Buggy version:
A = [int(i) for i in input().split()]
B = [A[1],A[0],A[3],A[4]]
ans = 0
ans += B[0]
if min(B[1:]) == 0:
	for b in B[1:]:
		if b%2 == 0:
			ans += 2
elif not sum([i%2 for i in B[1:]])%3:
	ans += sum(B[1:])
else:
	ans += sum(B[1:])-1
print(ans)


# Fixed version:
A = [int(i) for i in input().split()]
B = [A[1],A[0],A[3],A[4]]
ans = 0
ans += B[0]
if min(B[1:]) == 0:
	for b in B[1:]:
		ans += b//2*2
elif not sum([i%2 for i in B[1:]])%3:
	ans += sum(B[1:])
else:
	ans += sum(B[1:])-1
print(ans)