• + 0 comments

    Python3 Solution

    import math import os import random import re import sys

    if name == 'main':

    arr = []
    
    for _ in range(6):
        arr.append(list(map(int, input().rstrip().split())))
    # print(arr)
    
    max_hg =  curr_hg = float('-inf')
    
    for i in range(4):
        for j in range(4):
            first_row = arr[i][j] + arr[i][j+1] + arr[i][j+2]
            second_row = arr[i+1][j+1]
            third_row = arr[i+2][j] + arr[i+2][j+1] + arr[i+2][j+2]
            curr_hg = first_row + second_row + third_row
    
            if curr_hg > max_hg:
                max_hg = curr_hg
    
    print(max_hg)