/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package hackerrank;

import java.util.Scanner;
/**
 *
 * @author mukul goyal
 */
public class acmicpc {
        public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int max=0;
        int count;
        int team=0;
        boolean b[] = new boolean[m];
        boolean a[][] = new boolean[n][m];
        for(int i=0;i<n;i++){
            String s = sc.next();
            for(int j=0;j<m;j++){
                a[i][j] = s.charAt(j) == '1';
            }
        }
        for(int i=0;i<n-1;i++){
            for(int j=i+1;j<n;j++){
                count=0;
                for(int k=0;k<m;k++){
                    b[k] = a[i][k] || a[j][k];
                    if(b[k])
                        count++;
                }
                if(count==max)
                    team++;
                if(count>max){
                    team = 1;
                    max = count;
                }
            }
        }
        System.out.println(max);
        System.out.println(team);
    }
}

@@ -1,194 +1,4 @@
-/*%0D%0A * To change this license header, choose License Headers in Project Properties.%0D%0A * To change this template file, choose Tools %7C Templates%0D%0A * and open the template in the editor.%0D%0A */%0D%0A
 pack
@@ -47,44 +47,8 @@
 r;%0D%0A
-/**%0D%0A *%0D%0A * @author mukul goyal%0D%0A */
 %0D%0Apu

Update acmicpc.java