text: /* Copyright (C) 2019 Albert Farres - All Rights Reserved
   * You may use, distribute and modify this code under the terms of the MIT
   * license, which unfortunately won't be written for another century.
   *
   * You should have received a copy of the MIT license with this file. If not,
   * please write to: albertfc@gmail.com.
   */
  #include <bits/stdc++.h>
  using namespace std;
  
  #include <stdio.h>
  #ifndef SOURCE_PATH_SIZE
  #define SOURCE_PATH_SIZE 0
  #endif
  #define __FILENAME__ (__FILE__ + SOURCE_PATH_SIZE)
  
  #ifndef NDEBUG
  #define DBG(msg, args...) \
  	do { \
  		fprintf( stdout, "DEBUG %s:%d -- " msg, __FILENAME__, __LINE__, ##args ); \
  		fflush( stdout ); \
  	} while( 0 );
  #else
  #define DBG(msg, args...)
  #endif
  
  // Complete the hourglassSum function below.
  int hourglassSum(vector<vector<int>> arr) {
  
  	int max_sum = numeric_limits<int>::min();
  	for (int i = 0; i < 4; ++i) {
  		for (int j = 0; j < 4; ++j) {
  			max_sum = max( max_sum,
  					  arr[i][j] + arr[i][j+1] + arr[i][j+2] 
  					+ arr[i+1][j+1]
  					+ arr[i+2][j] + arr[i+2][j+1] + arr[i+2][j+2] );
  		}
  	}
  	return max_sum;
  }
  
  // dup2 & open
  #include <fcntl.h>
  #include <unistd.h>
  int main( int argc, char *argv[] ) {
  	if( argc > 1 )
  		dup2(open(argv[1], 0), 0);
  
      vector<vector<int>> arr(6);
      for (int i = 0; i < 6; i++) {
          arr[i].resize(6);
  
          for (int j = 0; j < 6; j++) {
              cin >> arr[i][j];
          }
  
          cin.ignore(numeric_limits<streamsize>::max(), '\n');
      }
  
      int result = hourglassSum(arr);
  
      cout << result << "\n";
  
      return 0;
  }
  