TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: You are given an undirected connected weighted graph with N vertices and M edges that contains neither self-loops nor double edges.   The i-th (1≤i≤M) edge connects vertex a_i and vertex b_i with a distance of c_i.   Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M).   A _connected graph_ is a graph where there is a path between every pair of different vertices.   Find the number of the edges that are not contained in any shortest path between any pair of different vertices.

Submission attempts (in order):
N,M=map(int,input().split())
d=[[9999 for _ in range(N)]for _ in range(N)]

for _ in range(M):
    a,b,c=map(int,input().split())
    d[0][1]=c
    d[1][0]=c

ans=0
for k in range(N):
    for i in range(N):
        if i == k:
            continue
        for j in range(N):
            if j == k or j == i:
                continue
            print(d[i][j],d[i][k]+d[k][j])
            if d[i][j]>d[i][k]+d[k][j]:
                d[i][j]=d[i][k]+d[k][j]
                d[j][i]=d[i][k]+d[k][j]
                ans+=1

print(ans)


N,M=map(int,input().split())
d=[[9999 for _ in range(N)]for _ in range(N)]

for _ in range(M):
    a,b,c=map(int,input().split())
    d[0][1]=c
    d[1][0]=c

ans=0
for k in range(N):
    for i in range(N):
        if i == k:
            continue
        for j in range(N):
            if j == k or j == i:
                continue
            if d[i][j]>d[i][k]+d[k][j]:
                d[i][j]=d[i][k]+d[k][j]
                d[j][i]=d[i][k]+d[k][j]
                ans+=1

print(ans)


N,M=map(int,input().split())
dist=[[9999 for _ in range(N)]for _ in range(N)]
cost=[[9999 for _ in range(N)]for _ in range(N)]
for _ in range(M):
    a,b,c=map(int,input().split())
    cost[a-1][b-1]=c
    cost[b-1][a-1]=c
    dist[a-1][b-1]=c
    dist[b-1][a-1]=c

for k in range(N):
    for i in range(N):
        if i == k:
            continue
        for j in range(N):
            if j == k or j == i:
                continue
            if i <= j:
                continue
            if dist[i][j]>dist[i][k]+dist[k][j]:
                dist[i][j]=dist[i][k]+dist[k][j]
                dist[j][i]=dist[i][k]+dist[k][j]

ans =0
for i in range(N):
    for j in range(N):
        if i <= j:
            continue
        if cost[i][j] ==9999:
            continue
        if cost[i][j] != dist[i][j]:
            ans +=1

print(ans)


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: You are given an undirected connected weighted graph with N vertices and M edges that contains neither self-loops nor double edges.   The i-th (1≤i≤M) edge connects vertex a_i and vertex b_i with a distance of c_i.   Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M).   A _connected graph_ is a graph where there is a path between every pair of different vertices.   Find the number of the edges that are not contained in any shortest path between any pair of different vertices.

Submission attempts (in order):
from scipy.sparse.csgraph import dijkstra

n,m = map(int,input().split())
edges = [[int(x) for x in input().split()] for i in range(m)]
graph = [[None]*n for i in range(n)]
for a, b, c in edges :
    graph[a-1][b-1] = c

#graph = csgraph_from_dense(graph)
dist = dijkstra(graph, directed=True).astype(int)

used = [0]*m
for s in range(n-1) :
    for t in range(s+1, n) :
        for i in range(len(edges)) :
            a, b, c = edges[i]
            a -= 1
            b -= 1
            if dist[s][a] + c + dist[b][t] == dist[s][t] :
                used[i] = 1
ans = m - sum(used)
print(ans)


from scipy.sparse.csgraph import dijkstra

n,m = map(int,input().split())
edges = [[int(x) for x in input().split()] for i in range(m)]
graph = [[0]*n for i in range(n)]
for a, b, c in edges :
    graph[a-1][b-1] = c

#graph = csgraph_from_dense(graph)
dist = dijkstra(graph, directed=True).astype(int)

used = [0]*m
for s in range(n-1) :
    for t in range(s+1, n) :
        for i in range(len(edges)) :
            a, b, c = edges[i]
            a -= 1
            b -= 1
            if dist[s][a] + c + dist[b][t] == dist[s][t] :
                used[i] = 1
ans = m - sum(used)
print(ans)


import sys
input = sys.stdin.readline
from scipy.sparse.csgraph import csgraph_from_dense, dijkstra

n,m = map(int,input().split())
A = [0]*m
B = [0]*m
C = [0]*m
for i in range(m) :
    a, b, c = map(int,input().split())
    A[i] = a-1
    B[i] = b-1
    C[i] = c

graph = [[0]*n for i in range(n)]

for i in range(m) :
    graph[A[i]][B[i]] = C[i]
    graph[B[i]][A[i]] = C[i]

graph = csgraph_from_dense(graph)
dist = dijkstra(graph)

ans = 0
for i in range(m) :
    if dist[A[i]][B[i]] != C[i] :
        ans += 1

print(ans)


Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: You are given an undirected connected weighted graph with N vertices and M edges that contains neither self-loops nor double edges.   The i-th (1≤i≤M) edge connects vertex a_i and vertex b_i with a distance of c_i.   Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M).   A _connected graph_ is a graph where there is a path between every pair of different vertices.   Find the number of the edges that are not contained in any shortest path between any pair of different vertices.

Submission attempts (in order):
ans = 0
n,m = map(int,input().split())
dis = [[float('inf') for i in range(n)] for j in range(n)] 
abt = []
for i in range(m):
    abt.append(list(map(int,input().split()))) 
for a,b,t in abt:
    dis[a-1][b-1] = t 
    dis[b-1][a-1] = t 
for i in range(n):
    for j in range(n):
        for k in range(n):
            dis[i][j] = min(dis[k][j], dis[k][i] + dis[i][j])
for a,b,t in abt:
    if t > dis[a-1][b-1]:
        ans +=1
print(ans)

ans = 0
n,m = map(int,input().split())
dis = [[float('inf') for i in range(n)] for j in range(n)] 
abt = []
for i in range(m):
    abt.append(list(map(int,input().split()))) 
for a,b,t in abt:
    dis[a-1][b-1] = t 
    dis[b-1][a-1] = t 
for i in range(n):
    for j in range(n):
        for k in range(n):
            dis[k][j] = min(dis[k][j], dis[k][i] + dis[i][j])
for a,b,t in abt:
    if t > dis[a-1][b-1]:
        ans +=1
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: You are given an undirected connected weighted graph with N vertices and M edges that contains neither self-loops nor double edges.   The i-th (1≤i≤M) edge connects vertex a_i and vertex b_i with a distance of c_i.   Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M).   A _connected graph_ is a graph where there is a path between every pair of different vertices.   Find the number of the edges that are not contained in any shortest path between any pair of different vertices.

Submission attempts (in order):
import heapq

def dijkstra(graph, node, start):
  INF = float("inf")
  dist = [INF] * node
  dist[start] = 0
  que = [(0, start)]
  while que:
    cost, one_node = heapq.heappop(heap)
    for next_c, next_n in graph[one_node]:
      dist_candi = dist[one_node] + next_c
      if dist_candi < dist[next_n]:
        dist[next_node] = dist_candi
        heapq.heappush(heap, (dist[next_n], next_n))
  return dist

class SetGraph:
  def __init__(self, node_num):
    self.graph = [[] for _ in range(node_num)]

  def add_one_edge(self, start, end, cost):
    self.graph[start].append((cost, end))
    self.graph[end].append((cost, start))

  def get_graph(self):
    return self.graph 
  

n, m = map(int, input().split(" "))
graph = SetGraph(n)
add_process = SetGraph.add_one_edge
for i in range(m):
  a, b, c = map(int, input().split(" "))
  add_process(a - 1, b - 1, c)
graph = Graph.get_graph()

cost = []
for i in range(n):
  temp_cost = dijkstra(graph, n, i)
  cost.append(temp_cost)

result = 0
for i in range(n):
  for c, node in graph[i]:
    if cost[i][node] != c:
      result += 1

print(result // 2)

import heapq

def dijkstra(graph, node, target):
  INF = float("inf")
  dist = [INF] * node
  dist[target] = 0
  que = [(0, target)]
  while que:
    co, one_node = heapq.heappop(que)
    for next_c, next_n in graph[one_node]:
      dist_candi = dist[one_node] + next_c
      if dist_candi < dist[next_n]:
        dist[next_n] = dist_candi
        heapq.heappush(que, (dist[next_n], next_n))
  return dist


class SetGraph:
  def __init__(self, node_num):
    self.n = node_num
    self.graph = [[] for _ in range(self.n)]

  def add_one_edge(self, start, end, cost):
    self.graph[start].append((cost, end))
    self.graph[end].append((cost, start))

  def get_graph(self):
    return self.graph 
  

n, m = map(int, input().split(" "))
graph_set = SetGraph(n)
for i in range(m):
  a, b, c = map(int, input().split(" "))
  graph_set.add_one_edge(a - 1, b - 1, c)
graph = graph_set.get_graph()

cost = []
for i in range(n):
  temp_cost = dijkstra(graph, n, i)
  cost.append(temp_cost)

result = 0
for i in range(n):
  for c, node in graph[i]:
    if cost[i][node] != c:
      result += 1

print(result // 2)

Verdicts: Runtime Error

Accepted
Problem: You are given an undirected connected weighted graph with N vertices and M edges that contains neither self-loops nor double edges.   The i-th (1≤i≤M) edge connects vertex a_i and vertex b_i with a distance of c_i.   Here, a _self-loop_ is an edge where a_i = b_i (1≤i≤M), and _double edges_ are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i<j≤M).   A _connected graph_ is a graph where there is a path between every pair of different vertices.   Find the number of the edges that are not contained in any shortest path between any pair of different vertices.

Submission attempts (in order):
# -*- coding: utf-8 -*-
import sys
import copy

def main():
	N, M = map(int, input().split(" "))
	
	graph = []
	maps = [[9999999 for _ in range(N)] for _ in range(N)]
	for i in range(N):
		maps[i][i] = 0
	
	for _ in range(M):
		a, b, c = map(int, input().split(" "))
		a, b = a-1, b-1
		maps[a][b] = c
		maps[b][a] = c
	
	ans = 0
	org = copy.deepcopy(maps)
	for k in range(N):
		for i in range(N):
			for j in range(N):
				if maps[i][j] == 9999999:
					continue
				if i <= j:
					continue
				maps[i][j] = min(maps[i][j], maps[i][k] + maps[k][j])
			
	for i in range(N):
		for j in range(N):
			if i <= j:
				continue
			if org[i][j] != maps[i][j]:
				ans += 1
		
	print(ans // 2)
	
if __name__ == "__main__":
	main()
	

# -*- coding: utf-8 -*-
import sys
import copy

def main():
	N, M = map(int, input().split(" "))
	
	graph = []
	maps = [[9999999 for _ in range(N)] for _ in range(N)]
	for i in range(N):
		maps[i][i] = 0
	
	for _ in range(M):
		a, b, c = map(int, input().split(" "))
		a, b = a-1, b-1
		maps[a][b] = c
		maps[b][a] = c
	
	ans = 0
	org = copy.deepcopy(maps)
	for k in range(N):
		for i in range(N):
			for j in range(N):
				maps[i][j] = min(maps[i][j], maps[i][k] + maps[k][j])
				maps[j][i] = min(maps[i][j], maps[i][k] + maps[k][j])
			
	for i in range(N):
		for j in range(N):
			if i <= j:
				continue
			if org[i][j] == 9999999:
				continue
			if org[i][j] != maps[i][j]:
				ans += 1
		
	print(ans)
	
if __name__ == "__main__":
	main()
	

Verdicts: Wrong Answer

Accepted
Problem: There are N squares aligned in a row. The i-th square from the left contains an integer a_i.  Initially, all the squares are white. Snuke will perform the following operation some number of times:    * Select K consecutive squares. Then, paint all of them white, or paint all of them black. Here, the colors of the squares are overwritten.  After Snuke finishes performing the operation, the score will be calculated as the sum of the integers contained in the black squares. Find the maximum possible score.

Submission attempts (in order):
import numpy as np
n,k=map(int, input().split())
a=np.array(list(map(int, input().split())))
b=np.maximum(a,0)
sm=sum(a[:k])
at=sum(b[k:])
ans=max(sm,0)+at
for i in range(k,n):
    sm+=a[i]-a[i-k]
    at+=b[i-k]-b[i]
    ans=max(max(0,sm)+at,ans)
    print(sm,at)
print(ans)

import numpy as np
n,k=map(int, input().split())
a=np.array(list(map(int, input().split())))
b=np.maximum(a,0)
sm=sum(a[:k])
at=sum(b[k:])
ans=max(sm,0)+at
for i in range(k,n):
    sm+=a[i]-a[i-k]
    at+=b[i-k]-b[i]
    ans=max(max(0,sm)+at,ans)
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: There are N squares aligned in a row. The i-th square from the left contains an integer a_i.  Initially, all the squares are white. Snuke will perform the following operation some number of times:    * Select K consecutive squares. Then, paint all of them white, or paint all of them black. Here, the colors of the squares are overwritten.  After Snuke finishes performing the operation, the score will be calculated as the sum of the integers contained in the black squares. Find the maximum possible score.

Submission attempts (in order):
from itertools import accumulate as acc
N, K, *A = map(int, open('0').read().split())
B = [0]+list(acc(A))
M = list(acc(a if a>0 else 0 for a in A))
ans = -10**30
s = sum(A)
for i in range(N-K+1):
  mi = B[i+K]-B[i]
  c = M[N-1] - M[i+K-1]
  if i>0:
    c += M[i-1]
  ans = max(ans,mi+c,c)
print(ans)

N,K,*A = map(int, open(0).read().split())
m = sum(A[:K])
n = sum(c if c>0 else 0 for c in A[K:])
ans = max(m+n,n)
for i in range(N-K):
  m -= A[i]
  m += A[i+K]
  if A[i]>0:
    n += A[i]
  if A[i+K]>0:
    n -= A[i+K]
  ans = max(ans,n+m,n)
print(ans)

Verdicts: Runtime Error

Accepted
Problem: There are N squares aligned in a row. The i-th square from the left contains an integer a_i.  Initially, all the squares are white. Snuke will perform the following operation some number of times:    * Select K consecutive squares. Then, paint all of them white, or paint all of them black. Here, the colors of the squares are overwritten.  After Snuke finishes performing the operation, the score will be calculated as the sum of the integers contained in the black squares. Find the maximum possible score.

Submission attempts (in order):
n,k=map(int,input().split())
a=list(map(int,input().split()))
sum_a=[0]*n
b=[max(0,a[i]) for i in range(n)]
sum_b=[0]*n
sum_a[0]=a[0]
sum_b[0]=a[0]
for i in range(1,n):
  sum_a[i]=sum_a[i-1]+a[i]
  sum_b[i]=sum_b[i-1]+b[i]
ans=sum_a[k-1]+sum_b[n-1]-sum_b[k-1]
ans=max(ans,0)
for i in range(k,n):
  ans=max(ans,sum_a[i]-sum_a[i-k]+sum_b[n-1]-sum_b[i]+sum_b[i-k])
  ans=max(ans,sum_b[n-1]-sum_b[i]+sum_b[i-k])
print(ans)

n,k=map(int,input().split())
a=list(map(int,input().split()))
sum_a=[0]*(n+1)
b=[max(0,a[i]) for i in range(n)]
sum_b=[0]*(n+1)
sum_a[1]=a[0]
sum_b[1]=b[0]
for i in range(1,n):
  sum_a[i+1]=sum_a[i]+a[i]
  sum_b[i+1]=sum_b[i]+b[i]
ans=-10**18
for i in range(n-k+1):
  l,r=i,i+k
  cnt=sum_b[l]-sum_b[0]
  cnt+=max(0,sum_a[r]-sum_a[l])
  cnt+=sum_b[n]-sum_b[r]
  ans=max(ans,cnt)
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: There are N squares aligned in a row. The i-th square from the left contains an integer a_i.  Initially, all the squares are white. Snuke will perform the following operation some number of times:    * Select K consecutive squares. Then, paint all of them white, or paint all of them black. Here, the colors of the squares are overwritten.  After Snuke finishes performing the operation, the score will be calculated as the sum of the integers contained in the black squares. Find the maximum possible score.

Submission attempts (in order):
N,K=map(int,input().split())
a=list(map(int,input().split()))
ans=0
tmp=0
for i in range(N):
  if i < K:
    tmp+=a[i]
  else:
    if a[i]>0:
      ans+=a[i]
ans+=max(0,tmp)

ans2=0
tmp=0
for i in range(N-1,-1,-1):
  if ans < N-K:
    if a[i]>0:
      ans2+=a[i]
  else:
    tmp+=a[i]
ans2+=max(0,tmp)
print(max(ams2,ans))

N,K=map(int,input().split())
a=list(map(int,input().split()))
ans=0
tmp=0
sa=[0]*(N+1)
A=[0]*(N+1)
for i in range(N):
  sa[i+1]=sa[i]+a[i]
  if a[i]>0:
    A[i+1]=A[i]+a[i]
  else:
    A[i+1]=A[i]
for i in range(N-K+1):
  tmp=sa[i+K]-sa[i]
  tmp2=A[i]+(A[-1]-A[i+K])
  #print(max(0,tmp),tmp2)
  if max(0,tmp)+tmp2>ans:
    ans=max(0,tmp)+tmp2
print(ans)

Verdicts: Runtime Error

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

Submission attempts (in order):
## coding: UTF-8

#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]

J = p[3]
L = p[4] 



answer = 0

answer += 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)


## coding: UTF-8

#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]

J = p[3]
L = p[4] 



answer = 0

answer += O 


if(I % 2 == J % 2 and I % 2 == L % 2):
    #[odd,odd,odd] or [even,even,even]
    #[0,0,0],[0,0,even],[0,even,even]
    answer += I+J+L
elif( (I + J + L) % 2 == 1):
    #[even,even,odd]
    #[0,0,odd],[0,even,odd]
    answer += I+J+L-1
elif( (I == 0 and J % 2 == 1 and L % 2 == 1)  or (J == 0 and I % 2 == 1 and L % 2 == 1)  or  (L == 0 and J % 2 == 1 and I % 2 == 1)  ):
    answer += I+J+L-2
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)


Verdicts: Wrong Answer

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

Submission attempts (in order):
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)


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)


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)


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 not sum([i%2 for i in B[1:]])%3:
		ans += sum(B[1:])
	else:
		ans += sum(B[1:])-1
	print(ans)


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)


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)


Verdicts: Wrong Answer

Wrong Answer

Runtime Error

Wrong Answer

Wrong Answer

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

Submission attempts (in order):
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))


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


Verdicts: Runtime Error

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

Submission attempts (in order):
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)

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

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)

Verdicts: Runtime Error

Wrong Answer

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

Submission attempts (in order):
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)


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)


Verdicts: Wrong Answer

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

Submission attempts (in order):
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)

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)

Verdicts: Wrong Answer

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

Submission attempts (in order):
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)


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

if i>0 and j>0 and l>0:
    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)
else:
    ans = (i // 2) * 2 + o + (j // 2) * 2 + (l // 2) * 2
print(ans)

Verdicts: Wrong Answer

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

Submission attempts (in order):
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)) 


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

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

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


Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

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

Submission attempts (in order):
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))

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

Verdicts: Runtime Error

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

Submission attempts (in order):
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))


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
if i>=1 and j>=1 and l>=1:
    print(max(ansl))
else:
    print(ansl[1])

Verdicts: Wrong Answer

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

Submission attempts (in order):
import math

a = list(map(int, input().split()))
ans = 0
i = 2 * math.floor(0.5 * a[0])

if a[5] or a[2] or a[6]:
    pass
else:
    if a[3] == a[4]:
        ans = ans + a[3]
        
    ans = ans + i + a[1]

print(ans)

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)

import math

a = list(map(int, input().split()))
ans = 0
i = 2 * math.floor(0.5 * a[0])

if a[5] or a[2] or a[6]:
    pass
else:
    if a[3] == a[4]:
        ans = ans + a[3] * 2
        
    ans = ans + i + a[1]

print(ans)


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

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

Verdicts: Wrong Answer

Runtime Error

Wrong Answer

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

Submission attempts (in order):
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))

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)

Verdicts: Wrong Answer

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

Submission attempts (in order):
aI, aO, aT, aJ, aL, aS, aZ = map(int, input().split())

t = min([aJ, aL, aI])
s = min([aJ - 1, aL - 1])
print(3 * t + 2 * s + (aI - t) // 2 * 2 + aO)


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)

Verdicts: Wrong Answer

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

Submission attempts (in order):
a=list(map(int,input().split()))
ans=min(a[0],a[3],a[4])
a[0]-=ans
a[3]-=ans
a[4]-=ans
ans*=6
ans+=(a[0]//2*4)+(a[3]//2*4)+(a[4]//2*4)+a[1]*2
print(ans)

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)


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)


Verdicts: Wrong Answer

Runtime Error

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

Submission attempts (in order):
#!/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))))


#!/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))))


Verdicts: Wrong Answer

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

Submission attempts (in order):
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)

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)

Verdicts: Runtime Error

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

Submission attempts (in order):
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)


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)


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)


Verdicts: Wrong Answer

Wrong Answer

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

Submission attempts (in order):
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)

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


A = list(map(int, input().split()))
S = A[1]
S += (A[0] // 2) * 2 + (A[3] // 2) * 2 + (A[4] // 2) * 2
if A[3] % 2 == 1 and A[4] % 2 == 1 and A[0] % 2 == 1:
  S += 3
elif A[3] % 2 == 1 and A[4] % 2 == 1 and A[0] % 2 == 0 and A[0] != 0:
  S += 1
elif A[3] % 2 == 0 and A[4] % 2 == 1 and A[0] % 2 == 1 and A[3] != 0:
  S += 1
elif A[3] % 2 == 1 and A[4] % 2 == 0 and A[0] % 2 == 1 and A[4] != 0:
  S += 1
print(S)


Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: There are N people, conveniently numbered 1 through N. They were standing in a row yesterday, but now they are unsure of the order in which they were standing. However, each person remembered the following fact: the absolute difference of the number of the people who were standing to the left of that person, and the number of the people who were standing to the right of that person. According to their reports, the difference above for person i is A_i.  Based on these reports, find the number of the possible orders in which they were standing. Since it can be extremely large, print the answer modulo 10^9+7. Note that the reports may be incorrect and thus there may be no consistent order. In such a case, print 0.

Submission attempts (in order):
import numpy as np
n = int(input())
a = np.array([int(x) for x in input().split()])
np.sort(a)
key = True
if n%2:
  key = False
ans = True
for i in range(n):
  if key:
    if a[i] != (i//2)*2+1:
      ans = False
      break
  else:
    if a[i] != ((i+1)//2)*2:
      ans = False
      break

if ans:
  print(pow(2, n//2))
else:
  print(0)

n = int(input())
a = [int(x) for x in input().split()]

a.sort()
ans = True
if n%2:
  key=0
  if a[0] != key:
    ans = False
  p = 1
else:
  key=1
  if a[0] != key or a[1] != key:
    ans = False
  p = 2

for i in range(p, n):
  if i%2 == n%2:
    key += 2
  if a[i] != key:
    ans = False
    break

if ans:
  print(pow(2, n//2, 10**9+7))
else:
  print(0)


Verdicts: Wrong Answer

Accepted
Problem: There are N people, conveniently numbered 1 through N. They were standing in a row yesterday, but now they are unsure of the order in which they were standing. However, each person remembered the following fact: the absolute difference of the number of the people who were standing to the left of that person, and the number of the people who were standing to the right of that person. According to their reports, the difference above for person i is A_i.  Based on these reports, find the number of the possible orders in which they were standing. Since it can be extremely large, print the answer modulo 10^9+7. Note that the reports may be incorrect and thus there may be no consistent order. In such a case, print 0.

Submission attempts (in order):
import sys
def input(): return sys.stdin.readline().strip()
n=int(input())
a=sorted(list(map(int,input().split())))
if n%2==0:
    l=[]
    for i in range(n//2):
        l.append(i*2+1)
        l.append(i*2+1)
else:
    l=[0]
    for i in range(n//2):
        l.append((i+1)*2)
        l.append((i+1)*2)

print(l)

if a==l:
    print(2**(n//2))
else:
    print(0)

import sys
def input(): return sys.stdin.readline().strip()
n=int(input())
a=sorted(list(map(int,input().split())))
if n%2==0:
    l=[]
    for i in range(n//2):
        l.append(i*2+1)
        l.append(i*2+1)
else:
    l=[0]
    for i in range(n//2):
        l.append((i+1)*2)
        l.append((i+1)*2)

if a==l:
    print(pow(2,n//2,1000000007))
else:
    print(0)

Verdicts: Wrong Answer

Accepted