package no357; import java.util.ArrayList; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int[][] score = new int[n][n]; for(int i=0;i> j & 1) == 1) continue; for(int k=0;k> k & 1) == 0) continue; sum += score[j][k]; } } int max1 = max(n,i,0,score); int max2 = max(n,i,1,score); max = Math.max(max, sum + max1 + max2); } System.out.println(max); } static int max(int n,int mask,int use,int[][] score) { ArrayList al = new ArrayList<>(); for(int i=0;i> i & 1) == use) { al.add(i); } } int n1 = al.size(); int[] p = new int[n1]; for(int i=0;i=0;--a) { if(p[a]p[a]) { int t = p[a]; p[a] = p[b]; p[b] = t; for(++a, b=p.length-1;a