Language: C++

using System;
class _0525
{
    static int h, w, count, maxCount;
    static int[,] Osenbei;
    static int[] power2 = { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512 };
    public static void Main()
    {
        string str = Console.ReadLine();
        string[] data;
        while (str != "0 0")
        {
            h = 0; w = 0; maxCount = 0;
            data = str.Split();
            h = int.Parse(data[0]); w = int.Parse(data[1]);
            Osenbei = new int[h, w];
            for (int i = 0; i < h; i++)
            {
                str = Console.ReadLine();
                for (int j = 0; j < w; j++) Osenbei[i, j] = int.Parse(str.Split()[j]);
            }
            Judge();
            Console.WriteLine(maxCount);
            str = Console.ReadLine();
        }
    }
    public static void Judge()
    {
        int[] countBlack = new int[w];
        for (int i = 0; i < power2[h]; i++)
        {
            count = 0;
            for (int j = 0; j < w; j++) countBlack[j] = 0;
            for (int j = 0; j < h; j++)
            {
                if ((i & power2[j]) == power2[j]) for (int k = 0; k < w; k++) countBlack[k] += Osenbei[j, k] == 0 ? 1 : 0;
                else for (int k = 0; k < w; k++) countBlack[k] += Osenbei[j, k] == 1 ? 1 : 0;
            }
            for (int j = 0; j < w; j++)
            {
                if (countBlack[j] > h / 2) count += countBlack[j];
                else count += h - countBlack[j];
            }
            if (maxCount < count) maxCount = count;
            if (maxCount == h * w) return;
        }
    }
}

Compiler output:
a.cc:1:7: error: expected nested-name-specifier before 'System'
    1 | using System;
      |       ^~~~~~
a.cc:5:15: error: expected unqualified-id before '[' token
    5 |     static int[,] Osenbei;
      |               ^
a.cc:6:15: error: expected unqualified-id before '[' token
    6 |     static int[] power2 = { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512 };
      |               ^
a.cc:7:11: error: expected ':' before 'static'
    7 |     public static void Main()
      |           ^~~~~~~
      |           :
a.cc:27:11: error: expected ':' before 'static'
   27 |     public static void Judge()
      |           ^~~~~~~
      |           :
a.cc:48:2: error: expected ';' after class definition
   48 | }
      |  ^
      |  ;
a.cc: In static member function 'static void _0525::Main()':
a.cc:9:9: error: 'string' was not declared in this scope
    9 |         string str = Console.ReadLine();
      |         ^~~~~~
a.cc:10:16: error: expected primary-expression before ']' token
   10 |         string[] data;
      |                ^
a.cc:11:16: error: 'str' was not declared in this scope; did you mean 'std'?
   11 |         while (str != "0 0")
      |                ^~~
      |                std
a.cc:14:13: error: 'data' was not declared in this scope
   14 |             data = str.Split();
      |             ^~~~
a.cc:15:17: error: expected primary-expression before 'int'
   15 |             h = int.Parse(data[0]); w = int.Parse(data[1]);
      |                 ^~~
a.cc:15:41: error: expected primary-expression before 'int'
   15 |             h = int.Parse(data[0]); w = int.Parse(data[1]);
      |                                         ^~~
a.cc:16:13: error: 'Osenbei' was not declared in this scope
   16 |             Osenbei = new int[h, w];
      |             ^~~~~~~
a.cc:19:23: error: 'Console' was not declared in this scope
   19 |                 str = Console.ReadLine();
      |                       ^~~~~~~
a.cc:20:61: error: expected primary-expression before 'int'
   20 |                 for (int j = 0; j < w; j++) Osenbei[i, j] = int.Parse(str.Split()[j]);
      |                                                             ^~~
a.cc:23:13: error: 'Console' was not declared in this scope
   23 |             Console.WriteLine(maxCount);
      |             ^~~~~~~
a.cc: In static member function 'static void _0525::Judge()':
a.cc:29:12: error: structured binding declaration cannot have type 'int'
   29 |         int[] countBlack = new int[w];
      |            ^~
a.cc:29:12: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:29:12: error: empty structured binding declaration
a.cc:29:15: error: expected initializer before 'countBlack'
   29 |         int[] countBlack = new int[w];
      |               ^~~~~~~~~~
a.cc:30:29: error: 'power2' was not declared in this scope
   30 |         for (int i = 0; i < power2[h]; i++)
      |                             ^~~~~~
a.cc:33:41: error: 'countBlack' was not declared in this scope
   33 |             for (int j = 0; j < w; j++) countBlack[j] = 0;
      |                                         ^~~~~~~~~~
a.cc:36:79: error: 'countBlack' was not declared in this scope
   36 |                 if ((i & power2[j]) == power2[j]) for (int k = 0; k < w; k++) countBlack[k] += Osenbei[j, k] == 0 ? 1 : 0;
      |                                                                               ^~~~~~~~~~
a.cc:36:96: error: 'Osenbei' was not declared in this scope
   36 |                 if ((i & power2[j]) == power2[j]) for (int k = 0; k < w; k++) countBlack[k] += Osenbei[j, k] == 0 ? 1 : 0;
      |                                                                                                ^~~~~~~
a.cc:37:50: error: 'countBlack' was not declared in this scope
   37 |                 else for (int k = 0; k < w; k++) countBlack[k] += Osenbei[j, k] == 1 ? 1 : 0;
      |                                                  ^~~~~~~~~~
a.cc:37:67: error: 'Osenbei' was not declared in this scope
   37 |                 else for (int k = 0; k < w; k++) countBlack[k] += Osenbei[j, k] == 1 ? 1 : 0;
      |                                                                   ^~~~~~~
a.cc:41:21: error: 'countBlack' was not declared in this scope
   41 |                 if (countBlack[j] > h / 2) count += countBlack[j];
      |                     ^~~~~~~~~~