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: Accepted

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

#oは加えるしか使い道がないので加算。
ans+=o

#j,lは２つずつ使って２を作るかi,j,lを１つずつ使って３を作るか
#最適戦略は3種の偶奇について、２種類以上が偶数個になるまで３を作ること(最大試行1回）。
#その後、各種２N個ずつ消費していけば、無駄になる個数を最小化できる。

if i>0 and j>0 and l>0:
  evn=0
  if j%2==0:
    evn+=1
  if l%2==0:
    evn+=1
  if i%2==0:
    evn+=1
#奇数個の種類が多いのならば１度だけ３を作る。
  if evn<2:
    ans+=3
    i-=1
    j-=1
    l-=1
    
#あとは全て２つずつ組み合わせていくのが最適。
ans+=(i//2)*2
ans+=(j//2)*2
ans+=(l//2)*2

#その他のピースでは長方形は作れない。
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

if I>0 and J>0 and L>0 and (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: Accepted

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

if l>0:
  l1=l-1
else:
  l1=0
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: Accepted

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

Submission status: Accepted

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

ans1, ans2 = 2*o, 2*o

ans1+=4*((i//2)+ (j//2)+(l//2))

if i and j and l:
  ans2+=6
  ans2+=4*(((i-1)//2)+ ((j-1)//2)+((l-1)//2))

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

Submission status: Accepted

Solution code:
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
INF = float("inf")


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

    ans = o * 2 + (i // 2) * 4 + (j // 2) * 4 + (l // 2) * 4
    if i >= 1 and j >= 1 and l >= 1:
        i -= 1
        j -= 1
        l -= 1
        ans = max(ans, 6 + o * 2 + (i // 2) * 4 + (j // 2) * 4 + (l // 2) * 4)

    print(ans // 2)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
INF = float("inf")


def ok(a, i, j, l, o):
    if a > min(i, j, l):
        return 0
    i -= a
    j -= a
    l -= a
    return 6 * a + (i // 2) * 4 + (j // 2) * 4 + (l // 2) * 4 + o * 2


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

    low, high, ans = -1, int(1e14) - 1, 0
    while high - low > 1:
        middle = (low + high) // 2
        if ok(middle, i, j, l, o) > ans:
            ans = ok(middle, i, j, l, o)
            low = middle
        else:
            high = middle

    print(ans // 2)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def solve(A):
    # I + J + L
    res = 0
    I = A[0]
    J = A[3]
    L = A[4]

    O = A[1]
    if (I >= 1 and J >= 1 and L >= 1):
        tmp = 3 + ((I - 1) // 2 + (J - 1) // 2 + (L - 1) // 2) * 2 + O
        res = max(res, tmp)
    tmp = (I // 2 + J // 2 + L // 2) * 2 + O
    res = max(res, tmp)
    print (res)


if __name__ == "__main__":
    A = list(map(int, input().split()))
    solve(A)

Submission status: Accepted

Solution code:
a, b, c, d, e, f, g = map(int, raw_input().split())
if a > 0 and d > 0 and e > 0:
    ans1 = b + a / 2 * 2 + d / 2 * 2 + e / 2 * 2
    ans2 = b + 3 + (a-1) / 2 * 2 + (d-1) / 2 * 2 + (e-1) / 2 * 2
    print max(ans1, ans2)
else:
    print b + a / 2 * 2 + d / 2 * 2 + e / 2 * 2

Submission status: Accepted

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

from functools import reduce

def f(s):
    _res = s[1]
    a = [s[0],s[3],s[4]]
    if reduce(lambda x,y: x + y, list(map(lambda x: x%2,a))) > 1 and a[0] > 0 and a[1] > 0 and a[2] > 0 :
        _res = _res + 3
        a = list(map(lambda x: x - 1,a))
    a = list(map(lambda x: x - x % 2,a))
    _res = _res + a[0] + a[1] + a[2]
    return _res


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

Submission status: Accepted

Solution code:
A = list(map(int, 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]
elif A[0]+A[3]+A[4]<=2:
	pass
else:
	K = K+A[0]+A[3]+A[4]-1
print(K)

Submission status: Accepted

Solution code:
def greedy(J, L, I):
    ans = 0
    ans += (J // 2) * 2
    ans += (L // 2) * 2
    ans += (I // 2) * 2
    return ans


def solve(I, O, T, J, L, S, Z):
    ans = O
    tmp1 = greedy(J, L, I)
    if J * L * I > 0:
        tmp1 = max(tmp1, 3 + greedy(J - 1, L - 1, I - 1))
    ans += tmp1
    return ans


I, O, T, J, L, S, Z = map(int, input().split())
print(solve(I, O, T, J, L, S, Z))

Submission status: Accepted

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

Submission status: Accepted

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

if aL%2 and aJ%2 and aI > 0:
    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) and aL > 0 and aJ > 0:
    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: Accepted

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
elif (i % 2 + j % 2 + l % 2 == 2) and i > 0 and j > 0 and l > 0:
	k += 1
print(k)

Submission status: Accepted

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) or (ai & aj & 1) or (ai & al & 1)):
    ans += 1
print(ans)

Submission status: Accepted

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

if aI * aJ * aL == 0:
    K = (aI // 2 + aJ // 2 + aL // 2) * 2 + aO
else:
    K1 = ((aI - 1) // 2 + (aJ - 1) // 2 + (aL - 1) // 2) * 2 + aO + 3
    K2 = (aI // 2 + aJ // 2 + aL // 2) * 2 + aO
    K = max([K1, K2])

print(K)

Submission status: Accepted

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:]:
		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)

Submission status: Accepted

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]
    if (a[0]%2 == a[3]%2 == 1 and a[4]>0) or (a[0]%2 == a[4]%2 == 1 and a[3]>0) or(a[4]%2 == a[3]%2 == 1 and a[0]>0):
        total += 3
        a[0] -= 1
        a[3] -= 1
        a[4] -= 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: Accepted

Solution code:
# coding: utf-8

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

K = (I//2)*2 + O + (J//2)*2 + (L//2)*2
if I % 2 == 1 and J % 2 == 1 and L % 2 ==1:
    K += 3
elif (I % 2 + J % 2 + L % 2 == 2) and (I * J * L > 0):
    K += 1
print(K)

Submission status: Accepted

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

def greedy(J,L,I):
    ans = 0
    ans += (J // 2) * 2
    ans += (L // 2) * 2
    J -= (J // 2) * 2
    L -= (L // 2) * 2
    if J * L * I > 0:
        ans += 3
        I -= 1
    ans += (I // 2) * 2
    return ans

def solve(I,O,T,J,L,S,Z):
    ans = O
    tmp1 = greedy(J,L,I)
    if J * L * I > 0:
        tmp1 = max(tmp1, 3 + greedy(J-1,L-1,I-1))
    ans += tmp1
    return ans
    
I,O,T,J,L,S,Z = map(int,input().split())
print(solve(I,O,T,J,L,S,Z))

# assert(solve(0,0,0,0,0,0,0) == 0)
# assert(solve(2,0,0,0,0,0,0) == 2)
# assert(solve(3,0,0,0,0,0,0) == 2)
# assert(solve(4,0,0,1,1,0,0) == 5)
# assert(solve(4,0,0,2,1,0,0) == 6)

Submission status: Accepted

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

K = 0

# square
K += a[1] * 1


if a[0] >= 1 and a[3] >= 1 and a[4] >= 1:
	oddn = 0
	for e in [0, 3, 4]:
		if a[e] % 2 == 1:
			oddn += 1

	if oddn >= 2:
		K += 3
		for e in [0, 3, 4]:
			a[e] -= 1

for e in [0, 3, 4]:
	K += (a[e] // 2) * 2

print(K)

Submission status: Accepted

Solution code:
aI, aO, aT, aJ, aL, aS, aZ = map(int, input().split())
ans = aO
p = [aI, aJ, aL]
for i in range(3):
    if p[i] >= 2:
        if p[i] % 2 == 0:
            ans += (p[i] - 2) // 2 * 2
            p[i] = 2
        else:
            ans += p[i] // 2 * 2
            p[i] = 1
p.sort()
if sum(p) >= 5:
    ans += sum(p) // 2 * 2
elif sum(p) == 4:
    if p == [1, 1, 2]:
        ans += 3
    elif p == [0, 2, 2]:
        ans += 4
    else:
        assert(False)
elif sum(p) == 3:
    if p == [0, 1, 2]:
        ans += 2
    elif p == [1, 1, 1]:
        ans += 3
    else:
        assert(False)
elif sum(p) == 2:
    if p == [0, 0, 2]:
        ans += 2
    elif p == [0, 1, 1]:
        pass
    else:
        assert(False)
else:
    assert(sum(p) <= 1)
print(ans)

Submission status: Accepted

Solution code:
#import string,itertools,fractions,heapq,re,array,bisect
#from math import *
#from collections import Counter
def rl(s): return xrange(len(s))

INF = 2147483647


import sys
stdin = sys.stdin

ai, ao, at, aj, al, aS, az = map(int, stdin.readline().strip().split())


rr = 0

triples = min([ai, aj, al])
for t in range(max(0, triples-1), triples+1):
    here = ao + 3*t
    here += (2*((ai - t) // 2)
          +2*((aj - t) // 2)
          +2*((al - t) // 2))
    rr = max(rr, here)

print rr

Submission status: Accepted

Solution code:
i, o, t, j, l, s, z = map(int, raw_input().split())
def f(x, y, z):
    if x >= 0 and y >= 0 and z >= 0 and x % 2 == y % 2 == z % 2:
        return x + y + z
    else:
        return 0
print o + max(f(i, j, l), f(i - 1, j, l), f(i, j - 1, l), f(i, j, l - 1), f(i - 1, j - 1, l), f(i - 1, j, l - 1), f(i, j - 1, l - 1))

Submission status: Accepted

Solution code:
aI, aO, aT, aJ, aL, aS, aZ = map(int, raw_input().split())
ans = 0
for i in range(2):
    if aI>=i and aJ>=i and aL>=i:
        ans = max(ans, (aI-i)/2*2+aO+(aJ-i)/2*2+(aL-i)/2*2+3*i)
print ans

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7


def main():
    a = list(map(int, input().split()))
    t = min(a[0], a[3], a[4])
    r = t * 3
    a[0] -= t
    a[3] -= t
    a[4] -= t
    for i in [0,3,4]:
        r += a[i] // 2 * 2
    if t > 0:
        rr = (t-1) * 3
        for i in [0,3,4]:
            rr += (a[i]+1) // 2 * 2
        if rr > r:
            r = rr
    return a[1] + r


print(main())

Submission status: Runtime Error

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

Submission status: Runtime Error

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

k1 = 0
if I >= 1 and J >= 1 and L >= 1:
    k1 = 0
    k += 3
    I -= 1
    J -= 1
    L -= 1
    k1 += (I//2)*2
    k1 += (J//2)*2
    k1 += (L//2)*2

k = max(k0, k1)
k += O
print(k)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
#define INF (1<<30)
#define MOD 1000000007
#define l_ength size
using ll = long long;
using namespace std;

int main(){
	ll i, o, t, j, l, s, z;
	cin >> i >> o >> t >> j >> l >> s >> z;
	ll ans1 = o + (i-i%2)+(j-j%2)+(l-l%2);
	ll cnt = i%2 + j%2 + l%2;
	if( cnt == 2 ){
		ans1 += 1;
	} else if( cnt == 3 ){
		ans1 += 3;
	}
	
	ll ans2 = 0;
	ans2 += (j-j%2) + (l-l%2) + o;
	j %= 2; l %= 2;
	if( j == 1 && l == 1 && i > 0 ){
		--i;
		ans2 += 3;
	}
	ans2 += (i-i%2);
	
	cout << max(ans1, ans2) << endl;
	return 0;
}

Submission status: Runtime Error

Solution code:
import math

def xv(num):
    return 2 * math.floor(0.5 * num)

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

Que = xv(a[0]) + xv(a[3]) + xv(a[4])

if (a[3] or a[4]) == 0:
    pass
else:
    a[0] = a[0] - 1
    a[3] = a[3] - 1
    a[4] = a[4] - 1

    Qae = 3 + xv(a[0]) + xv(a[3]) + xv(a[4])

ans = ans + a[1] + max(Que,Qae)
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n=int(raw_input())
x=map(int,raw_input().split())
ans=[-1]*(n**2+1)
for i in xrange(n):
    if ans[x[i]]!=-1:
        print("No")
        exit()
    ans[x[i]]=i+1
    cnt=n-1
    for j in xrange(1,n**2+1):
        if cnt==0:break
        if ans[j]==-1:
            cnt-=1
            ans[j]=i+1
    if cnt>0:
        print("No")
        exit()
print("Yes")
print(" ".join(map(str,ans[1:])))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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)