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:
from statistics import mean, median,variance,stdev
import numpy as np
import sys
import math
import fractions
import itertools
import copy
from operator import itemgetter
#以下てんぷら
def j(q):
    if q==1: print("YES")
    else:print("NO")
    exit(0)


def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")

def ip():
    return int(input())
#n = ip()                                     #入力整数1つ
#a,b,c= (int(i) for i in input().split())       #入力整数横2つ以上
a = [int(i) for i in input().split()]        #入力整数配列
#a = input()                                  #入力文字列
#a = input().split()                          #入力文字配列
#n = ip()                      #入力セット(整数改行あり)(1/2)
#a=[ip() for i in range(n)]    #入力セット(整数改行あり)(2/2)

#jの変数はしようできないので注意
#全足しにsum変数使用はsum関数使用できないので注意
#こっから本文
a.pop(6)
a.pop(5)
a.pop(2)
s = a[1]
for i in range(4):
    if i!=1:
        if a[i]%2:
            s+=a[i]-1
            a[i] = 1
        else:
            s+=a[i]
            a[i] = 0
if a[0] and a[2] and a[3]:s+=3
print(s)

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

Solution code:
i,o,t,j,l,s,z = (int(i) for i in input().split())  
ijl=min(i,j,l)
io=min(i/2,o)
print(int(3*max(ijl,io)))

Submission status: Wrong Answer

Solution code:
# coding:utf-8

import sys

INF = float('inf')
MOD = 10 ** 9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()


def main():
    ai, ao, at, aj, al, a_s, az = LI()
    aijl = min(ai, aj, al)
    ai -= aijl
    aj -= aijl
    al -= aijl
    ai //= 2
    aj //= 2
    al //= 2

    return 2 * (ai + aj + al) + ao + aijl * 3


print(main())

Submission status: Wrong Answer

Solution code:
# coding:utf-8

import sys
# from collections import Counter, defaultdict

INF = float('inf')
MOD = 10 ** 9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()


def main():
    A = LI()
    ai, modi = divmod(A[0], 2)
    ao = A[1]
    aj, modj = divmod(A[3], 2)
    al, modl = divmod(A[4], 2)

    return 2 * (ai + aj + al) + ao + all([modi, modj, modl]) * 3


print(main())

Submission status: Wrong Answer

Solution code:
# coding:utf-8

import sys
# from collections import Counter, defaultdict

INF = float('inf')
MOD = 10 ** 9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()


def main():
    A = LI()
    ai = A[0] // 2
    ao = A[1]
    aj = A[3] // 2
    al = A[4] // 2

    return 2 * (ai + aj + al) + ao


print(main())

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f,g = map(int,input().split())
res = []
res.append(b + (a//2)*2+ d//2*2 + e//2*2)
if a >= 1 and d >= 1 and e >= 1:
    res.append(3 + b + (a-1)//2*2 + (d-1)//2*2 + (e-1)//2)
print(max(res))

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f,g = map(int,input().split())

k = b
k += (a//2)*2
if d >= 2 or e >= 2:
    k += a%2
k += d//2*2+e//2*2
print(k)

Submission status: Wrong Answer

Solution code:
a,b,c,d,e,f,g = map(int,input().split())

k = b
k += (a//2)*2
if d >= 1 and e >= 1:
    k += a%2
k += min(d,e)*2
print(k)

Submission status: Wrong Answer

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

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

b = 3 + o + (i-1)//2*2 + (j-1)//2*2 + (l-1)//2*2

print(max(a,b))

Submission status: Wrong Answer

Solution code:
i, o, t, j, l, s, z = (int(i) for i in input().split())
ma = o + j + l + i
i = i%2; j = j%2; l = l%2
if i + j + l == 3 or i + j + l == 0:
    print(ma)
else:
    print(ma-(i+j+l))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
I, O, T, J, L, S, Z = map(int, input().split())
res = O
res += sum(map(lambda x: x//2*2, [I, J, L]))
res += 3*min(map(lambda x: x%2, [I, J, L]))
print(res)

Submission status: Wrong Answer

Solution code:
I,O,T,J,L,S,Z=map(int,input().split())
A=((I-1)//2)*2+O+((J-1)//2)*2+((L-1)//2)*2+3
B=(I//2)*2+O+(J//2)*2+(L//2)*2
print(max(A,B))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
t=[int(i) for i in input().split()]
if t[0]%2==t[3]%2==t[4]%2==1:
  print(2*(t[0]//2)+2*(t[3]//2)+2*(t[4]//2)+t[1]+3)
else:
  print(2*(t[0]//2)+2*(t[3]//2)+2*(t[4]//2)+t[1])

Submission status: Wrong Answer

Solution code:
t=[int(i) for i in input().split()]
print(2*(t[0]//2)+2*(t[3]//2)+2*(t[4]//2)+t[1])

Submission status: Wrong Answer

Solution code:
t=[int(i) for i in input().split()]
print(2*(t[0]//2)+2*min(t[3],t[4])+t[1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans = Ao + 2*(Ai//2 + Aj//2 + Al//2)
if Ai%2 == 1 and Aj%2 == 1 and Al%2 == 1:
  ans += 3
  
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans = max((i//2)*2 + o + (j//2)*2 + (l//2)*2,
          ((i-1)//2)*2 + o + ((j-1)//2)*2 + ((l-1)//2)*2 +3)
print(ans)

Submission status: Wrong Answer

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

ans = (i//2)*2 + o + (j//2)*2 + (l//2)*2
if i&1 and j&1 and l&1: ans += 3
print(ans)

Submission status: Wrong Answer

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

ans = (i//2)*4 + o*2 + (j//2)*4 + (l//2)*4
if i&1 and j&1 and l&1: ans += 6
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
stdin = sys.stdin

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())


aI, aO, aT, aJ, aL, aS, aZ = li()

ans = (aI//2)*2 + (aJ//2)*2 + (aL//2)*2 + aO + 3*min(aI%2, aJ%2, aL%2)
if ans > 0:
    print(ans)
else:
    print('0')

Submission status: Wrong Answer

Solution code:
import sys
stdin = sys.stdin

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())


aI, aO, aT, aJ, aL, aS, aZ = li()

ans = (aI//2)*2 + (aJ//2)*2 + (aL//2)*2 + aO + 3*min(aI%2, aJ%2, aL%2)
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
stdin = sys.stdin

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())


aI, aO, aT, aJ, aL, aS, aZ = li()

# aIとaL,aJをできるだけ独立させる
ans1 = (aI//2)*2 + min(aL,aJ)*2 + aO

# aI,aL,aJをできるだけ組み合わせる
mn = min(aI,aL,aJ)
ans2 = 3*mn
ans2 += (((aI-mn)//2)*2 + 2*min((aL-mn), (aJ-mn)) + aO)

print(max(ans1, ans2))

Submission status: Wrong Answer

Solution code:
import sys
stdin = sys.stdin

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())


aI, aO, aT, aJ, aL, aS, aZ = li()
base = min(aI, aJ, aL)
aI = aI - base

if base > 0:
    ans = 2*base + 2 + aO + (aI//2)*2
else:
    ans = aO + (aI//2)*2

print(ans)

Submission status: Wrong Answer

Solution code:
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))

Submission status: Wrong Answer

Solution code:
a = [int(i) for i in input().split()]
f = lambda x: 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))

Submission status: Wrong Answer

Solution code:
a = [int(i) for i in input().split()]
ans = (a[0]//2)*2+a[1]+(a[3]//2)*2+(a[4]//2)*2
if a[0]%2 and a[3]%2 and a[4]%2: ans+=3
print(ans)

Submission status: Wrong Answer

Solution code:
a = [int(i) for i in input().split()]
ans = (a[0]//2)*2+a[1]+(a[3]//2)*2+(a[4]//2)*2
if a[0]%2 and a[3]%2 and a[4]%2: ans+=1
print(ans)

Submission status: Wrong Answer

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

ans1 = 0
# IJL
if X[0] > 0 and X[3] > 0 and X[4] > 0:
    i, j, l = X[0] - 1, X[3] - 1, X[4] - 1
    ans1 += 6
    ans1 += 4 * (i // 2) + 6 * (j // 2) + 6 * (l // 2)
    ans1 += 2 * X[1]

i, j, l = X[0], X[3], X[4]
ans2 = 4 * (i // 2) + 6 * (j // 2) + 6 * (l // 2) + 2 * X[1]

print(max(ans1, ans2) // 2)

Submission status: Wrong Answer

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

ans = 0
JL = False

# O
ans += 2 * O

# JLがつくれるか
if J > 0 and L > 0:
    J, L = J-1, L-1
    JL = True
    ans += 4

# JLをたくさん作る
ans += min(J, L) * 4
if J > L:
    J -= L
    L = 0
else:
    L -= J
    J = 0

# JかLの残り
X = max(J, L)

# JLとIIを組み合わせる
ans += 8 * min(I // 2, X // 2)
I = max(0, I - 2 * (X // 2))

# IとJL
if I % 2 == 0 and JL:
    ans += 2
    I = 0

# 残ったI
ans += 4 * (I // 2)

print(ans // 2)

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpl_s(): return list(input().split())

I,O,T,J,L,S,Z = inpl()
ans1 = ans2 = O
ans1 += 3 + (I-1)//2*2 + (J-1)//2*2 + (L-1)//2*2
ans2 += I//2*2 + J//2*2 + L//2*2
print(max(ans1,ans2))

Submission status: Wrong Answer

Solution code:
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpl_s(): return list(input().split())

I,O,T,J,L,S,Z = inpl()
ans = O

I,J,L
odd = 0
if I%2 == 1: odd += 1
if J%2 == 1: odd += 1
if L%2 == 1: odd += 1

if odd >= 2:
	ans += 3
	I,J,L = I-1,J-1,L-1

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

Submission status: Wrong Answer

Solution code:
from sys import exit, setrecursionlimit, stderr
from functools import reduce
from itertools import *
from collections import *
from bisect import bisect
 
def read():
  return int(input())
 
def reads():
  return [int(x) for x in input().split()]

def f(*xs):
  return sum(x // 2 * 2 for x in xs)

def solve(I, J, L):
  ans = f(I, J, L)
  if min(I, J, L) >= 1:
    ans = max(ans, 1 + f(I-1, J-1, L-1))
  return ans

I, O, _, J, L, _, _ = reads()
ans = O + solve(I, J, L)
print(ans)

Submission status: Wrong Answer

Solution code:
from sys import exit, setrecursionlimit, stderr
from functools import reduce
from itertools import *
from collections import *
from bisect import bisect
 
def read():
  return int(input())
 
def reads():
  return [int(x) for x in input().split()]

def f(*xs):
  return sum(x // 2 * 2 for x in xs)

def solve(I, J, L):
  m = min(I, J, L) // 2 * 2
  ans = 3 * m
  I -= m
  J -= m
  L -= m
  if min(I, J, L) == 1:
    return ans + max(f(I-1, J-1, L-1) + 3, f(I, J, L))
  else:
    return ans + f(I, J, L)

I, O, _, J, L, _, _ = reads()
ans = O + solve(I, J, L)
print(ans)

Submission status: Wrong Answer

Solution code:
from sys import exit, setrecursionlimit, stderr
from functools import reduce
from itertools import *
from collections import *
from bisect import bisect
 
def read():
  return int(input())
 
def reads():
  return [int(x) for x in input().split()]

I, O, _, J, L, _, _ = reads()

ans = 0
ans += O

m = min(I, L, J)
ans += 3 * m
I -= m
J -= m
L -= m
if I <= 1:
  ans += L // 2 * 2
  ans += J // 2 * 2
else:
  # assert L <= 1 or J <= 1
  ans += I // 2 * 2

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,b=input().split()[:2]
print(int(a)//2*2+int(b))

Submission status: Wrong Answer

Solution code:
I, O, T, J, L, S, Z = map(int, input().split())
A = (I//2)*2+(J//2)*2+(L//2)*2
B = ((I-1)//2)*2+((J-1)//2)*2+((L-1)//2)*2+3
print(max(A, B)+O)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
I,O,T,J,L,S,Z=[int(i) for i in input().split()]
ans=O

if (I%2)+(J%2)+(L%2)>=2:
	ans+=3
	I-=1
	J-=1
	L-=1

ans+=int(J/2)*2
ans+=int(L/2)*2
ans+=int(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

ans+=int(J/2)*2
J%=2

ans+=int(L/2)*2
L%=2

if J==1 and L==1 and I>=1:
	I-=1
	J-=1
	L-=1
	ans+=3

ans+=int(I/2)*2
I%=2
print(ans)

Submission status: Wrong Answer

Solution code:
a=[int(i) for i in input().split()] 
l=min(a[0],a[3],a[4])
a0=(a[0]-l)//2
a3=(a[3]-l)//2
a4=(a[4]-l)//2

l1=l-1
a10=(a[0]-l1)//2
a13=(a[3]-l1)//2
a14=(a[4]-l1)//2


print(a[1]+max(l*3+a0*2+a3*2+a4*2,l1*3+a10*2+a13*2+a14*2))

Submission status: Wrong Answer

Solution code:
a=[int(i) for i in input().split()] 
l=min(a[0],a[3],a[4])
a0=(a[0]-l)//2
a3=(a[3]-l)//2
a4=(a[4]-l)//2

print(a[1]+max(l*3+a0*2+a3*2+a4*2,a[0]//2*2+a[3]//2*2+a[4]//2*2))

Submission status: Wrong Answer

Solution code:
a=[int(i) for i in input().split()] 
l=min(a[0],a[3],a[4])
a0=(a[0]-l)//2
a3=(a[3]-l)//2
a4=(a[4]-l)//2

print(a[1]+max(l*3+a0*2+a3*2+a4*2,a[0]//2+a[3]//2+a[4]//2))

Submission status: Wrong Answer

Solution code:
a=[int(i) for i in input().split()] 
l=min(a[0],a[3],a[4])
a0=(a[0]-l)//2
a3=(a[3]-l)//2
a4=(a[4]-l)//2

print(a[1]+l*3+a0*2+a3*2+a4*2)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

K = 2*o

K+=4*(i//2)
i = i%2

K+=4*(j//2)
j = j%2

K+=4*(l//2)
l = l%2

if i and j and l: K+=6

print(K//2)

Submission status: Wrong Answer

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

K = 2*o

K+=4*i//2
i = i%2

K+=4*j//2
j = j%2

K+=4*l//2
l = l%2

if i and j and l: K+=6

print(K//2)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
print(sum(map(lambda x: int(x)//2*4, input().split()))//2)

Submission status: Wrong Answer

Solution code:
if __name__ == "__main__":
    AI,AO,AT,AJ,AL,AS,AZ = map(int, input().split())
    result = 0
    resAI = AI // 2

    result +=  6 * resAI // 3
    resAI -= resAI // 3

    resAJAL = min(AJ, AL)
    result +=  6 * resAJAL // 3
    resAJAL -= resAJAL // 3

    result += 3 * min(resAI, AO)
    tmp = min(resAI, AO)
    resAI -= tmp
    AO -= tmp

    result += 3 * min(resAJAL, AO)
    tmp = min(resAJAL, AO)
    resAJAL -= tmp
    AO -= tmp







    print (result)

Submission status: Wrong Answer

Solution code:
if __name__ == "__main__":
    AI,AO,AT,AJ,AL,AS,AZ = map(int, input().split())
    result = 0
    resAI = AI // 2

    result +=  6 * resAI // 3
    resAI -= resAI // 3

    result += 3 * min(resAI, AO)
    tmp = min(resAI, AO)
    resAI -= tmp
    AO -= tmp
    



    resAJAL = min(AJ, AL)
    result +=  6 * resAJAL // 3
    resAJAL -= resAJAL // 3





    print (result)

Submission status: Wrong Answer

Solution code:
a, b, c, d, e, f, g = map(int, raw_input().split())
ade = min(a, d, e)
ans = ade * 3
a -= ade
d -= ade
e -= ade
ans += b
ans += a / 2 * 2 + d / 2 * 2 + e / 2 * 2
print ans

Submission status: Wrong Answer

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

def f(s):
    _res = s[1]
    x,y,z = s[0],s[3],s[4]
    if ((x%2) + (y%2) + (z%2) > 1) and (x > 0 and y > 0 and z > 0):
        x = x - 1
        y = y - 1
        z = z - 1
        _res = res + 3
    _res = _res +  x//2 + y//2 + z//2;
    return _res


s = input().split(' ')
print(f(list(map(lambda x:int(x),s))))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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:
i,o,t,j,l,s,z=map(int,input().split())
k=0
k+=(i//2)*2
k+=o
k+=min(j,l)*4
print(k)

Submission status: Wrong Answer

Solution code:
A = map(int, raw_input().split())
K = 0
K = K+A[1]
if A[0]%2==0 and A[3]%2==0 and A[4]%2==0:
	K = K+A[0]+A[3]+A[4]
elif A[0]%2!=0 and A[3]%2!=0 and A[4]%2!=0:
	K = K+A[0]+A[3]+A[4]
else:
	K = K+A[0]+A[3]+A[4]-1
print K

Submission status: Wrong Answer

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

if aL%2 and aJ%2:
    print(int((aI-1)/2)*2+aO+int(aJ/2)*2+int(aL/2)*2+3)
elif aI%2 and (aL%2 or aJ%2):
    print(int(aI/2)*2+aO+int((aJ-1)/2)*2+int((aL-1)/2)*2+3)
else:
    print(int(aI/2)*2+aO+int(aJ/2)*2+int(aL/2)*2)

Submission status: Wrong Answer

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

count = 0

count += o

count += (i//2)*2
count += (j//2)*2
count += (l//2)*2
if i%2 and j%2 and l%2:
	count += 3

print(count)

Submission status: Wrong Answer

Solution code:
def solve():
    ia, oa, ta, ja, la, sa, za = map(int, input().split())
    ans = 0
    ans += oa
    ans += ia // 2 * 2
    minjl = min(ja, la)
    ans += minjl * 2
    if ia % 2 == 1 and minjl > 0:
        ans += 1
    print(ans)

if __name__=="__main__":
    solve()

Submission status: Wrong Answer

Solution code:
def solve():
    ia, oa, ta, ja, la, sa, za = map(int, input().split())
    ans = 0
    ans += oa
    ans += ia // 2 * 2
    ans += min(ja, la) // 2 * 2
    print(ans)

if __name__=="__main__":
    solve()

Submission status: Wrong Answer

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

count = 0

count += o*2

count += (i//2)*4
count += (j//2)*4
count += (l//2)*4
if i%2 and j%2 and l%2:
	count += 6

Submission status: Wrong Answer

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

if aL%2 and aJ%2:
    print(int((aI-1)/2)*2+aO+int(aJ/2)*2+int(aL/2)*2+3)
else:
    print(int(aI/2)*2+aO+int(aJ/2)*2+int(aL/2)*2)

Submission status: Wrong Answer

Solution code:
def solve():
    ia, oa, ta, ja, la, sa, za = map(int, input().split())
    ans = 0
    ans += oa
    ans += ia // 2 * 2
    ans += min(ja, la) // 2 * 2
    if ia % 2 == 1 and ja % 2 == 1 and la % 2 == 1:
        ans += 3
    print(ans)

if __name__=="__main__":
    solve()

Submission status: Wrong Answer

Solution code:
ai, ao, at, aj, al, as_, az = map(int, input().split())
gattai = min(ai, aj, al)
ans = gattai * 3
ai -= gattai
aj -= gattai
al -= gattai
ans += (ai // 2) * 2 + ao + (aj // 2) * 2 + (al // 2) * 2
if gattai & aj & al & 1:
    ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
ai, ao, at, aj, al, as_, az = map(int, input().split())
gattai = min(ai, aj, al)
ans = gattai * 3
ai -= gattai
aj -= gattai
al -= gattai
ans += (ai // 2) * 2 + ao + (aj // 2) * 2 + (al // 2) * 2
if gattai and (aj & al & 1):
    ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
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)

Submission status: Wrong Answer

Solution code:
ai, ao, at, aj, al, as_, az = map(int, input().split())
gattai = min(ai, aj, al)
ans = gattai * 3
ai -= gattai
aj -= gattai
al -= gattai
ans += (ai // 2) * 2 + ao + (aj // 2) * 2 + (al // 2) * 2
if gattai and aj & al & 1:
    ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
ai, ao, at, aj, al, as_, az = map(int, input().split())
gattai = min(ai, aj, al)
ans = gattai * 3
ai -= gattai
aj -= gattai
al -= gattai
ans += (ai // 2) * 2 + ao + (aj // 2) * 2 + (al // 2) * 2
if aj & al & 1:
    ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
A = [int(i) for i in input().split()]
B = [A[1],A[0],A[3],A[4]]
if max(B) == 1 and B[0] == 0:
	print(0)
else:
	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)

Submission status: Wrong Answer

Solution code:
I,O,T,J,L,S,Z=map(int,raw_input().split())
ans=0
ans+=2*O
JL=min(J,L)
ans+=6*min(JL,I)
if I>=JL:
    J=max(J-JL,0)
    L=max(L-JL,0)
    I-=JL
    ans+=4*(I/2)
    ans+=4*(J/2)
    ans+=4*(L/2)
else:
    J=max(J-I,0)
    L=max(L-I,0)
    ans+=4*(J/2)
    ans+=4*(L/2)
print(ans/2)

Submission status: Wrong Answer

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

ans = o
a = min(j, l, i)
ans += 3 * a
j -= a
l -= a
i -= a

if j % 2 == 0:
    ans += j
    j = 0
else:
    ans += j-1
    j = 1

if l % 2 == 0:
    ans += l
    l = 0
else:
    ans += l-1
    l = 1

if i % 2 == 0:
    ans += i
else:
    ans += i-1

print ans

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a = list(map(int, input().split()))
b = a[:]
c = a[:]

def aa(a):
    total = a[1]
    i6 = min(a[0],a[3],a[4])
    a[0] -= i6
    a[3] -= i6
    a[4] -= i6
    total += i6 * 3
    total += a[0]//2*2
    total += a[3]//2 *2
    total += a[4]//2 *2
    return total

def bb(a):
    total = a[1]
    if a[0] > 0 and a[3]%2 ==  a[4]%2 == 1:
        a[0] -= 1
        a[3] -= 1
        a[4] -= 1
        total += 3
    total += a[0]//2 * 2
    total += a[3]//2 * 2
    total += a[4]//2 * 2
    return total

def cc(a):
    total = a[1]
    total += a[0]//2 * 2
    total += a[3]//2 * 2
    total += a[4]//2 * 2
    if a[0]%2 == a[3]%2 ==  a[4]%2 == 1:
        a[0] -= 1
        a[3] -= 1
        a[4] -= 1
        total += 3
    return total
print(max(aa(a),bb(b), cc(c)))

Submission status: Wrong Answer

Solution code:
I,O,T,J,L,S,Z=map(int,raw_input().split())
ans=0
ans+=2*O
JL=min(J,L)
ans+=6*min(JL,I)
I-=JL
if I>=0:
    J-=JL
    I-=JL
    ans+=4*(I/2)
    ans+=4*(J/2)
    ans+=4*(L/2)
else:
    J-=I
    L-=I
    ans+=4*(J/2)
    ans+=4*(L/2)
print(ans/2)

Submission status: Wrong Answer

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

ans = o
while (j % 2 != 0 or l % 2 != 0) and i > 0:
    j -= 1
    l -= 1
    i -= 1
    ans += 3

if j % 2 == 0:
    ans += j
    j = 0
else:
    ans += j-1
    j = 1

if l % 2 == 0:
    ans += l
    l = 0
else:
    ans += l-1
    l = 1

if i % 2 == 0:
    ans += i
else:
    ans += i-1

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:
I,O,T,J,L,S,Z=map(int,raw_input().split())
ans=0
ans+=2*O
JL=min(J,L)
ans+=6*min(JL,I)
I-=JL
if I>=0:
    J-=JL
    I-=JL
    ans+=4*(I/2)
    ans+=4*(J/2)
    ans+=4*(L/2)
else:
    J-=I
    L=-I
    ans+=4*(J/2)
    ans+=4*(L/2)
print(ans/2)

Submission status: Wrong Answer

Solution code:
A = [int(i) for i in input().split()]
B = [A[1],A[0],A[3],A[4]]
if max(B) == 1 and B[0] == 0:
	print(0)
else:
	print(B)
	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)

Submission status: Wrong Answer

Solution code:
ai, ao, at, aj, al, as_, az = map(int, input().split())
ans = (ai // 2) * 2 + ao + (aj // 2) * 2 + (al // 2) * 2
if ai & aj & al & 1:
    ans += 3
print(ans)

Submission status: Wrong Answer

Solution code:
I,O,T,J,L,S,Z=map(int,raw_input().split())
ans=0
ans+=2*O
JL=abs(J-L)
ans+=6*min(JL,I)
I-=JL
if I>=0:
    J-=JL
    I-=JL
    ans+=4*(I/2)
    ans+=4*(J/2)
    ans+=4*(L/2)
else:
    J-=I
    L=-I
    ans+=4*(J/2)
    ans+=4*(L/2)
print(ans/2)

Submission status: Wrong Answer

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

def aa(a):
    total = a[1]
    i6 = max(min(a[0],a[3],a[4]) - 1, 0)
    a[0] -= i6
    a[3] -= i6
    a[4] -= i6
    if a[3]%2 == 0 and a[4]%2 == 0:
        pass
    else:
        i6 += 1
        a[0] -= 1
        a[3] -= 1
        a[4] -= 1
    total += i6 * 3
    total += a[0] //2*2
    total += a[3]//2 *2
    total += a[4]//2 *2
    return total

def bb(a):
    total = a[1]
    if a[0] > 0 and a[3]%2 ==  a[4]%2 == 1:
        a[0] -= 1
        a[3] -= 1
        a[4] -= 1
        total += 3
    total += a[0]//2 * 2
    total += a[3]//2 * 2
    total += a[4]//2 * 2
    return total

print(max(aa(a),bb(b)))

Submission status: Wrong Answer

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

ans = o
if (j % 2 != 0 or l % 2 != 0) and i > 0:
    j -= 1
    l -= 1
    i -= 1
    ans += 3

if j % 2 == 0:
    ans += j
    j = 0
else:
    ans += j-1
    j = 1

if l % 2 == 0:
    ans += l
    l = 0
else:
    ans += l-1
    l = 1

if i % 2 == 0:
    ans += i
else:
    ans += i-1

print ans

Submission status: Wrong Answer

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

def aa(a):
    total = a[1]
    i6 = max(min(a[0],a[3],a[4]) - 1, 0)
    a[0] -= i6
    a[3] -= i6
    a[4] -= i6
    if a[3]%2 == 0 and a[4]%2 == 0:
        pass
    else:
        i6 += 1
        a[0] -= 1
        a[3] -= 1
        a[4] -= 1
    total += i6 * 3
    total += a[0] //2*2
    total += a[3]//2 *2
    total += a[4]//2 *2
    return total

def bb(a):
    total = a[1]
    if a[0] > 0 and a[3]%2 ==  a[4]%2 == 1:
        a[0] -= 1
        a[3] -= 1
        a[4] -= 1
        total += 3
    total += a[0]//2 * 2
    total += a[3]//2 * 2
    total += a[4]//2 * 2
    if a[0] % 2 == 1 and a[3]%2 ==  a[4]%2:
        total += 3
    return total

print(max(aa(a),bb(b)))