criyle/codenet-compile-errors huggingface dataset:
Language: C

#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
#include<string>
#include<cstring>
#include<iomanip>
#include<iostream>
#include<stack>
#include<cmath>
#include<map>
#include<vector>
#define ll long long
#define inf 0x3f3f3f3f
#define INF 1000000000
#define bug1 cout<<"bug1"<<endl;
#define bug2 cout<<"bug2"<<endl;
#define bug3 cout<<"bug3"<<endl;
using namespace std;
#define sf scanf
#define pf printf
#define mem(a,b) memset(a,b,sizeof(a));
#define maxn 12
int r,c;

bool mat[11][10005];
int anslast;
void dfs(int x){
    if(x==r+1){
        int ans=0;
        for(int j=1;j<=c;++j){
            int num1=0;
            for(int i=1;i<=r;++i){
                if(mat[i][j])++num1;
            }
            if(num1>r-num1)ans+=num1;
            else ans+=(r-num1);
        }
        anslast=max(anslast,ans);
        return;
    }
    dfs(x+1);
    for(int j=1;j<=c;++j){
        mat[x][j]=!mat[x][j];
    }
    dfs(x+1);
}
int main(){
    while(~sf("%d%d",&r,&c)&&r+c){
            anslast=0;
        for(int i=1;i<=r;++i){
            for(int j=1;j<=c;++j){
                sf("%d",&mat[i][j]);
            }
        }
        dfs(1);
        pf("%d\n",anslast);
    }
}

Compiler output:
main.c:1:9: fatal error: cstdio: No such file or directory
    1 | #include<cstdio>
      |         ^~~~~~~~
compilation terminated.
Language: C

#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int r,c,ans;
bool pan[12][10002];
bool dis[10002];
void dfs(int x)
{
    if(x>r)
    {
        int cnt=0;
        for(int j=1;j<=c;j++)
        {
            int sum=0;
            for(int i=1;i<=r;i++)
                if(dis[i]!=pan[i][j]) sum++;
            cnt+=max(sum,r-sum);
        }
        ans=max(ans,cnt);
        return;
    }
    dis[x]=0;
    dfs(x+1);
    dis[x]=1;
    dfs(x+1);
}
int main()
{
    while(scanf("%d %d",&r,&c)&&r&&c)
    {
        ans=0;
        memset(dis,0,sizeof(dis));
        for(int i=1;i<=r;i++)
            for(int j=1;j<=c;j++)
                cin>>pan[i][j];
        dfs(1);
        printf("%d\n",ans);
    }
}

Compiler output:
main.c:1:9: fatal error: cstdio: No such file or directory
    1 | #include<cstdio>
      |         ^~~~~~~~
compilation terminated.
Language: C

//Garden Luba thinks about
#include <iostream>  
#include <cstdio>  
using namespace std;  
int a[120];  
int n,k;  
int main(){  
    scanf("%d%d",&n,&k);  
    int i;  
    for(i = 0; i < n; i++)  
        scanf("%d",&a[i]);  
    int minh = 999999;  
    for(i = 0; i < n; i++){  
        if(k%a[i]==0){  
            if(k/a[i]<minh)  
                minh = k/a[i];  
        }  
    }  
    printf("%d\n",minh);  
    return 0;  
}  


Compiler output:
main.c:2:10: fatal error: iostream: No such file or directory
    2 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cctype>
#include <numeric>
using namespace std;

#define rep(i,n) for(int (i)=0; (i)<(int)(n); ++(i))
#define foreach(c,i) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)

int R, C, B[12][10002];

void main2() {
  int ans = 0;
  for (int v = 0; v < (1<<R); ++v) {
    int cnt = 0;
    for (int x = 0; x < C; ++x) {
      int up = 0;
      for (int y = 0; y < R; ++y) {
        bool is_rev = v >> y & 1;
        if ((is_rev && !B[y][x]) || (!is_rev && B[y][x])) ++up;
      }
      cnt += max(up, R - up);
    }
    ans = max(ans, cnt);
  }
  printf("%d\n", ans);
}

int main() {
  while (scanf("%d%d", &R, &C), R | C) {
    rep(i,R) rep(j,C) scanf("%d", B[i]+j);
    main2();
  }
  return 0;
}

Compiler output:
main.c:1:10: fatal error: cstdio: No such file or directory
    1 | #include <cstdio>
      |          ^~~~~~~~
compilation terminated.
Language: C

#include<stdio.h>
#include<stdlib.h>
#define RMAX 10
#define CMAX 10000
int main(void){
	int R,C;
	char *Buffer=NULL;
	int Osenbei[RMAX][CMAX];
	int RSum[RMAX],CSum[CMAX];
	int Count,Count2,GoodSenbei=0;
	int Best=0;
	
	//入力
	
	while(1){
		//行列サイズ入力
		scanf("%d %d%*c",&R,&C);
		if(R==0&&C==0){return 0;}//終了判定
		for(Count=0;Count<R;Count++)RSum[Count]=0;
		for(Count=0;Count<C;Count++)CSum[Count]=0;
		for(Count=0;Count<R;Count++){//一行ずつ入力処理
			int InC=0,Charbuff=0;
			while(Charbuff=getchar()){//一文字ずつ入力
				if(Charbuff=='\n'){
					break;
				}
				else if(Charbuff=='0'){
					Osenbei[Count][InC]=0;
					InC++;
				}
				else if(Charbuff=='1'){
					Osenbei[Count][InC]=1;
					InC++;
				}
			}
			for(InC=0;InC<C;InC++){
				RSum[Count]+=Osenbei[Count][InC];
				CSum[InC]+=Osenbei[Count][InC];
			}
			//for(InC=0;InC<C;InC++){
			//	printf("%d ",Osenbei[Count][InC]);
			//}
		}
		//ここで全探索
		for(Count=0;Count<R;Count++){
			for(Count2=0;Count2<C;Count2++){
				int Ans=2*CSum[Count2]+2*RSum[Count]-C-R-2+4*Osenbei[Count][Count2];
				Best=(Best<Ans)?Ans:Best;
				GoodSenbei+=Osenbei[Count][Count2]
			}			
		}

		printf("%d\n",GoodSenbei+Best);
	}

}

//次回　6/4

Compiler output:
main.c: In function 'main':
main.c:49:67: error: expected ';' before '}' token
   49 |                                 GoodSenbei+=Osenbei[Count][Count2]
      |                                                                   ^
      |                                                                   ;
   50 |                         }
      |                         ~
Language: C

//Osenbei
#include <stdio.h>
#include <string.h>
int A[10001];

int main(){
  int C, R, tmp, mask, ans, a, b, c, i, j;
  while(true){
    scanf("%d %d", &C, &R);
    if((C | R) == 0){
      break;
    }
    memset(A, 0, sizeof(A));
    for(i = 0; i < C; ++i){
      for(j = 0; j < R; ++j){
        scanf("%d", &tmp);
        A[j] += tmp << i;
      }
    }
    for(i = 0; i < R; ++i){
      //printf("%d", A[i]);
    }
    //printf("\n");
    ans = 0;
    for(mask = 0; mask < (1 << C); ++mask){
      //printf("mask = %d \n", mask);
      a = 0;
      for(i = 0; i < R; ++i){
        tmp = A[i] ^ mask;
        //printf("%d", tmp);
        b = 0;
        while(tmp != 0){
          if((tmp & 1) == 1){
            b++;
          }
          tmp = tmp >> 1;
        }
        a += b > C - b ? b : C - b;
      }
      //printf(" a = %d \n", a);
      if(ans < a){
        ans = a;
      }
    }
    printf("%d\n", ans);
  }
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:8:9: error: 'true' undeclared (first use in this function)
    8 |   while(true){
      |         ^~~~
main.c:4:1: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
    3 | #include <string.h>
  +++ |+#include <stdbool.h>
    4 | int A[10001];
main.c:8:9: note: each undeclared identifier is reported only once for each function it appears in
    8 |   while(true){
      |         ^~~~
Language: C++

#include <iostream>

using namespace std;

int main(){
	int R, C;
	static int s[10][10000];
	while(cin >> R >> C){
		for(int i=0;i<R;i++){
			for(int j=0;j<C;j++) cin >> s[i][j];
		}
		int res = 0;
		for(int b=0;b<(1<<R);b++){
			int sum = 0;
			for(int j=0;j<C;j++){
				int cnt = 0;
				for(int i=0;i<R;i++){
					if(b&(1<<i)){
						if(s[i][j] == 0) cnt++;
					} else {
						if(s[i][j] == 1) cnt++;
					}
				}
				sum += max(cnt, R-cnt);
			}
			res = max(sum, res);
		}
		cout << res << endl;
return;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:1: error: return-statement with no value, in function returning 'int' [-fpermissive]
   29 | return;
      | ^~~~~~
Language: C++

#include<iostream>
#define MAX_C 10000
using namespace std;
int r,c;
int senbei[1<<10][MAX_C+1];

int bitCnt(int n){
  int cnt=0;
  while(n>0){
    if(n%2==1)cnt++;
    n/=2;
  }
  if(r-cnt<cnt){
    return r-cnt;
  }else{
    return cnt;
  }
}

int rec(int s,int n){
  if(senbei[s][n]!=-1){
    return senbei[s][n];
  }
  int tmp=s;
  for(int i=0;tmp>0;i++){
    if(tmp%2==1){
      for(int j=0;j<c;j++){
	int bitpos=1<<i;
	senbei[s][j]=rec(s^bitpos,j)^bitpos;
      }
    }
    tmp/=2;
  }
  return senbei[s][n];
}

int minimam(){
  int ans=1<<30;
  int tmp=0;
  for(int i=0;i<1<<r;i++){
    tmp=0;
    cout << "reset" << endl;
    for(int j=0;j<c;j++){
      tmp+=bitCnt(senbei[i][j]);
      cout<<"tmp is "<<tmp<<endl;
    }
    if(ans>tmp)ans=tmp;
  }
  return ans;
}

int main(){
  cin>>r>>c;
  int tmp[c];
  memset(tmp,0,sizeof(tmp));
  memset(senbei,-1,sizeof(senbei));
  for(int i=0;i<r;i++){
    for(int j=0;j<c;j++){
      tmp[j]=tmp[j]<<1;
      int bit;
      cin>>bit;
      if(bit==1){
	tmp[j]=tmp[j]|1;
      }
    }
  }
  for(int i=0;i<c;i++){
    senbei[0][i]=tmp[i];
    //cout << tmp[i] << endl;
  }
  rec((1<<r)-1,0);
  for(int i=0;i<1<<r;i++){
    for(int j=0;j<c;j++){
      cout<<senbei[i][j];
    }
    cout<<endl;
  }
  cout<<r*c-minimam()<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:55:3: error: 'memset' was not declared in this scope
   55 |   memset(tmp,0,sizeof(tmp));
      |   ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include<iostream>
  +++ |+#include <cstring>
    2 | #define MAX_C 10000
Language: C++

#include<iostream>
#include<map>
#define MAX_C 10000
using namespace std;
int r,c;
int senbei[1<<10][MAX_C+1];

int bitCnt(int n){
  int cnt=0;
  while(n>0){
    if(n%2==1)cnt++;
    n/=2;
  }
  if(r-cnt<cnt){
    return r-cnt;
  }else{
    return cnt;
  }
}

int rec(int s,int n){
  if(senbei[s][n]!=-1){
    return senbei[s][n];
  }
  int tmp=s;
  for(int i=0;tmp>0;i++){
    if(tmp%2==1){
      for(int j=0;j<c;j++){
	int bitpos=1<<i;
	senbei[s][j]=rec(s^bitpos,j)^bitpos;
      }
    }
    tmp/=2;
  }
  return senbei[s][n];
}

int minimam(){
  int ans=1<<30;
  int tmp=0;
  for(int i=0;i<1<<r;i++){
    tmp=0;
    cout << "reset" << endl;
    for(int j=0;j<c;j++){
      tmp+=bitCnt(senbei[i][j]);
      cout<<"tmp is "<<tmp<<endl;
    }
    if(ans>tmp)ans=tmp;
  }
  return ans;
}

int main(){
  cin>>r>>c;
  int tmp[c];
  memset(tmp,0,sizeof(tmp));
  memset(senbei,-1,sizeof(senbei));
  for(int i=0;i<r;i++){
    for(int j=0;j<c;j++){
      tmp[j]=tmp[j]<<1;
      int bit;
      cin>>bit;
      if(bit==1){
	tmp[j]=tmp[j]|1;
      }
    }
  }
  for(int i=0;i<c;i++){
    senbei[0][i]=tmp[i];
    //cout << tmp[i] << endl;
  }
  rec((1<<r)-1,0);
  for(int i=0;i<1<<r;i++){
    for(int j=0;j<c;j++){
      cout<<senbei[i][j];
    }
    cout<<endl;
  }
  cout<<r*c-minimam()<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:56:3: error: 'memset' was not declared in this scope
   56 |   memset(tmp,0,sizeof(tmp));
      |   ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include<map>
  +++ |+#include <cstring>
    3 | #define MAX_C 10000
Language: C++

#include<iostream>
#define MAX_C 10000
using namespace std;
int r,c;
int senbei[1<<10][MAX_C+1];

int bitCnt(int n){
  int cnt=0;
  while(n>0){
    if(n%2==1)cnt++;
    n/=2;
  }
  if(r-cnt<cnt){
    return r-cnt;
  }else{
    return cnt;
  }
}

int rec(int s,int n){
  if(senbei[s][n]!=-1){
    return senbei[s][n];
  }
  int tmp=s;
  for(int i=0;tmp>0;i++){
    if(tmp%2==1){
      for(int j=0;j<c;j++){
	int bitpos=1<<i;
	senbei[s][j]=rec(s^bitpos,j)^bitpos;
      }
    }
    tmp/=2;
  }
  return senbei[s][n];
}

int minimam(){
  int ans=1<<30;
  int tmp=0;
  for(int i=0;i<1<<r;i++){
    tmp=0;
    cout << "reset" << endl;
    for(int j=0;j<c;j++){
      tmp+=bitCnt(senbei[i][j]);
      cout<<"tmp is "<<tmp<<endl;
    }
    if(ans>tmp)ans=tmp;
  }
  return ans;
}

int main(){
  while(cin>>r>>c){
    if(c==0)break;
    int tmp[c];
    memset(tmp,0,sizeof(tmp));
    memset(senbei,-1,sizeof(senbei));
    for(int i=0;i<r;i++){
      for(int j=0;j<c;j++){
	tmp[j]=tmp[j]<<1;
	int bit;
	cin>>bit;
	if(bit==1){
	  tmp[j]=tmp[j]|1;
	}
      }
    }
    for(int i=0;i<c;i++){
      senbei[0][i]=tmp[i];
      //cout << tmp[i] << endl;
    }
    rec((1<<r)-1,0);
    for(int i=0;i<1<<r;i++){
      for(int j=0;j<c;j++){
	cout<<senbei[i][j];
      }
      cout<<endl;
    }
    cout<<r*c-minimam()<<endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:56:5: error: 'memset' was not declared in this scope
   56 |     memset(tmp,0,sizeof(tmp));
      |     ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include<iostream>
  +++ |+#include <cstring>
    2 | #define MAX_C 10000
Language: C++

/* AOJ 0525
 *
 * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0525
 *
 */


//include
#include<bits/stdc++.h>

//using
using namespace std;

//define static const typedef
#define FOR(i, s, n) for(int (i) = (s); (i) < (n); (i)++)
#define REP(i, n) FOR((i), 0, (n))
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SORT(a) sort(ALL(a))
#define RSORT(a) sort(RALL(a))
#define DUMP(x) cerr << #x << " = " << x << "\n"
#define DEBUG(x) cerr << #x << " = " << x << " (L:" << __LINE__ << ") " << __FILE__ << "\n"
#define F first
#define S second


typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned long long ULL;

static const int INF = 1 << 25;

//global
static set<vector<vector<char> > > a;
static vector<vector<char> > d;
static int h, w;
static int ans;
//function
static void solve(){
  if(a.count(d)){
    return;
  }
  a.insert(d);
  static int cnt;
  cnt = 0;
  REP(i, h){
    REP(j, w){
      cnt += d[i][j];
    }
  }
  ans = max(cnt, ans);
  REP(i, h){
    REP(j, w){
      d[i][j] = !d[i][j];
    }
    solve(ar);
    REP(j, w){
      d[i][j] = !d[i][j];
    }
  }
  REP(i, w){
    REP(j, h){
      d[j][i] = !d[j][i];
    }
    solve();
    REP(j, h){
      d[j][i] = !d[j][i];
    }
  }
}
int main(){
  while(scanf("%d %d", &h, &w)){
    if(!h && !w){
      break;
    }
    ans = 0;
    d.resize(h, vector<char>(w));
    REP(i, h){
      REP(j, w){
	scanf("%d", &d[i][j]);
      }
    }
    solve();
    printf("%d\n", ans);
    d.resize(0, vector<char>(0));
    a = set<vector<vector<char> > >();
  }
  return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:64:11: error: 'ar' was not declared in this scope; did you mean 'a'?
   64 |     solve(ar);
      |           ^~
      |           a
Language: C++

#include <cstdio>
#include <algorithm>
#include <bitset>

using namespace std;

const int MAX_R = 10;
const int MAX_C = 10000;

//input
int R, C;
bitset<MAX_C> a[MAX_R];

int ans;

void dfs(int k){
    if(k == R){
        //row certain
        int result = 0;            //cur max value
        for(int j = 0; j < C; j ++){
            int upNum = 0;            //up numbers without fliping
            for(int i = 0; i < R; i ++){
                if(a[i][j]) upNum ++;
            }
            result += max(upNum, R - upNum);    
        }
        ans = max(ans, result);
        return;
    }
    //without fliping
    dfs(k + 1);
    //&#183;flip
    a[k].flip();
    dfs(k + 1);

    a[k].flip();
}

void solve(){
    ans = 0;
    dfs(0);
    printf("%d\n", ans);
}

int main(int argc, char const *argv[]){

    while(scanf("%d %d", &R, &C)){
        if(R == 0 && C == 0) break;

        for(int i = 0; i < R; i ++){
            for(int j = 0; j < C; j ++){
                int temp;
                scanf("%d", &tmp);
                a[i][j] = tmp;
            }
        }
        solve();
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:53:30: error: 'tmp' was not declared in this scope; did you mean 'temp'?
   53 |                 scanf("%d", &tmp);
      |                              ^~~
      |                              temp
Language: C++

#include<iostream>
#include<algorithm>

int r, c, res = 0;
int data[11][10001], buf[11][10001];

void reverse(int *ose){
	for (int i = 0; i < c; i++){
		ose[i] = (ose[i] + 1) % 2;
	}
}

int main(){
	while (std::cin >> r >> c, r || c){

		for (int i = 0; i < r; i++){
			for (int j = 0; j < c; j++){
				std::cin >> data[i][j];
			}
		}

		int rev = (1 << 10);
		for (int i = 0; i < rev; i++){
			memcpy(buf, data, sizeof(buf));
			int ans = 0;

			for (int j = 0; j < r; j++){
				if ((i >> j) & 1)reverse(buf[j]);
			}

			for (int j = 0; j < c; j++){
				int count = 0;
				for (int k = 0; k < r; k++)if (buf[k][j] == 1)count++;
				ans += std::max(count, r - count);
			}

			res = std::max(res, ans);
		}

		std::cout << res << std::endl;
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:25: error: 'memcpy' was not declared in this scope
   24 |                         memcpy(buf, data, sizeof(buf));
      |                         ^~~~~~
a.cc:3:1: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include<algorithm>
  +++ |+#include <cstring>
    3 |
Language: C++

#include<iostream>
#include<stdio.h>
#include<math.h>
#include    <iomanip>
#include    <map>
#include    <set>
using namespace std;
#define FR(i,k,N) for(int i=k;    i<N;i++)
#define REP(i,N) for(int i=0;    i<N;i++)
int a,b;

int main(){
    //8bit??§131?????¨???
    
    
    /*    cout<<"b1="<<b1<<endl;
     cout<<"b1="<<(b1 ^= b2)<<endl;
     cout<<"b1="<<(b1 ^= b2)<<endl;
     cout<<"b1="<<(b1 ^= b2)<<endl;
     cout<<"b1="<<(b1 ^= b2)<<endl;
     cout<<"b1="<<(b1 ^= b2)<<endl;
     cout<<"b1="<<(b1 ^= 3)<<endl;
     cout<<"b1="<<(b1 ^= 4)<<endl;
     cout<<"b1="<<(b1 ^= 5)<<endl;
     cout<<"b1="<<(b1 ^= 6)<<endl;*/
    int sen[10][100000];
    auto maa=0;
    while(cin>>a>>b&&a!=0){
        REP(i, a)REP(j, b) cin>>sen[i][j];
        REP(i, pow(2, a)) {
            bitset<10> senbei(i);
            //cout<<i<<" "<<senbei<<endl;
            bitset<10> ichi(1);
            REP(j, a){
                if ((((senbei >> j) & ichi)==1)){
                    REP(k, b) {sen[j][k]=(sen[j][k]+1)%2;}
                }
                auto sum=0;
                REP(jj, b){
                    auto temp=0;
                    REP(ii, a){
                        temp+=(sen[ii][jj]+1)%2;
                    }
                    sum+=max(temp,(a-temp));
                }
                if ((((senbei >> j) & ichi)==1)){
                    REP(k, b) {sen[j][k]=(sen[j][k]+1)%2;}
                }
                maa=(max(maa,sum));
            }
        }
        cout<<maa<<endl;
        //REP(i, a)REP(j, b) cout<<sen[i][j];
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:13: error: 'bitset' was not declared in this scope
   31 |             bitset<10> senbei(i);
      |             ^~~~~~
a.cc:7:1: note: 'std::bitset' is defined in header '<bitset>'; this is probably fixable by adding '#include <bitset>'
    6 | #include    <set>
  +++ |+#include <bitset>
    7 | using namespace std;
a.cc:31:24: error: 'senbei' was not declared in this scope
   31 |             bitset<10> senbei(i);
      |                        ^~~~~~
a.cc:33:24: error: 'ichi' was not declared in this scope
   33 |             bitset<10> ichi(1);
      |                        ^~~~
Language: C++

#include?<iostream>
#include?<bitset>
#include?<algorithm>
?
using?namespace?std;
?
bitset<10000>?cookie[10];
?
int?main()
{
?
????int?R,?C;
????while(cin?>>?R?>>?C?&&?R?>?0)
????{
????????int?i,?j;
????????for?(i?=?0;?i?<?R;?++i)
????????{
????????????for?(j?=?0;?j?<?C;?++j)
????????????{
????????????????bool?upwards;
????????????????cin?>>?upwards;
????????????????cookie[i][j]?=?upwards;
????????????}
????????}
?
????????int?permute_r?=?1?<<?R;
????????int?result?=?0;
????????for?(i?=?0;?i?<?permute_r?;?++i)
????????{
????????????for?(j?=?0;?j?<?R;?++j)
????????????{
????????????????if?(i?&?(1?<<?j))
????????????????{
????????????????????cookie[j].flip();
????????????????}
????????????}
?????????????
?
????????????int?possible_answer?=?0;
????????????for?(j?=?0;?j?<?C;?++j)
????????????{
????????????????int?up_cookie_count?=?0;
????????????????for?(int?k?=?0;?k?<?R;?++k)
????????????????{
????????????????????if?(cookie[k][j])
????????????????????{
????????????????????????++up_cookie_count;
????????????????????}
????????????????}
????????????????possible_answer?+=?max(up_cookie_count,?R?-?up_cookie_count);
????????????}
????????????result?=?max(result,?possible_answer);
?????????????
????????????for?(j?=?0;?j?<?R;?++j)
????????????{
????????????????if?(i?&?(1?<<?j))
????????????????{
????????????????????cookie[j].flip();
????????????????}
????????????}
????????}
????????cout?<<?result?<<?endl;
????}
?
????return?0;
}

Compiler output:
a.cc:1:9: error: #include expects "FILENAME" or <FILENAME>
    1 | #include?<iostream>
      |         ^
a.cc:2:9: error: #include expects "FILENAME" or <FILENAME>
    2 | #include?<bitset>
      |         ^
a.cc:3:9: error: #include expects "FILENAME" or <FILENAME>
    3 | #include?<algorithm>
      |         ^
a.cc:4:1: error: expected unqualified-id before '?' token
    4 | ?
      | ^
a.cc:6:1: error: expected unqualified-id before '?' token
    6 | ?
      | ^
a.cc:8:1: error: expected unqualified-id before '?' token
    8 | ?
      | ^
Language: C++

#include "bits/stdc++.h"
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)

int main(){
  int n,m;
  while(cin>>n>>m){
    if(n==0&&m==0)break;
    int data[11][10010];
    rep(i,n)rep(j,m)cin>>data[i][j];
    
    int ans=0;
    rep(i,1<<n){
      int t=0;
      rep(j,m){
        int a=0;
        rep(k,n)a
          if((i&(1<<k))!=0)a+=!data[k][j];
          else a+=data[k][j];
        t+=max(a,n-a);
      }
      ans=max(ans,t);
    }
    cout<<ans<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:18: error: expected ';' before 'if'
   17 |         rep(k,n)a
      |                  ^
      |                  ;
   18 |           if((i&(1<<k))!=0)a+=!data[k][j];
      |           ~~      
a.cc:19:11: error: 'else' without a previous 'if'
   19 |           else a+=data[k][j];
      |           ^~~~
a.cc:19:24: error: 'k' was not declared in this scope
   19 |           else a+=data[k][j];
      |                        ^
Language: C++

#include"bits/stdc++.h" using namespace std;#define rep(i,n) for(inti=0;i<(int)(n);i++) int main(){int n,m,d[11][10010],r,t,a;while(cin>>n>>m&&n&&m){rep(i,n)rep(j,m)cin>>d[i][j];r=0;rep(i,1<<n){t=0;rep(j,m){a=0;rep(k,n)a+=(d[k][j]+!!(i&(1<<k)))%2;t+=max(a,n-a);}r=max(r,t);}cout<<r<<endl;}}

Compiler output:
a.cc:1:25: warning: extra tokens at end of #include directive
    1 | #include"bits/stdc++.h" using namespace std;#define rep(i,n) for(inti=0;i<(int)(n);i++) int main(){int n,m,d[11][10010],r,t,a;while(cin>>n>>m&&n&&m){rep(i,n)rep(j,m)cin>>d[i][j];r=0;rep(i,1<<n){t=0;rep(j,m){a=0;rep(k,n)a+=(d[k][j]+!!(i&(1<<k)))%2;t+=max(a,n-a);}r=max(r,t);}cout<<r<<endl;}}
      |                         ^~~~~
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#include <cstdio>
#include <algorithm>

using namespace std;

int bd[10][1000];

int main(){
	int r, c;
	scanf_s(" %d %d", &r, &c);
	for (int i = 0; i < r; i++){
		for (int j = 0; j < c; j++){
			scanf_s(" %d", &bd[i][j]);
		}
	}
	int ans = -1;
	int up = (1 << r);
	for (int sl = 0; sl < up; sl++){
		int h = sl;
		for (int i = 0; i < r; i++){
			if (h % 2 == 1){
				for (int j = 0; j < c; j++){
					bd[i][j] = (bd[i][j] == 0) ? 1 : 0;
				}
			}
			h /= 2;
		}

		int cnt = 0;
		for (int j = 0; j < c; j++){
			int sm=0;
			for (int i = 0; i < r; i++){
				sm += bd[i][j];
			}
			cnt += max(r - sm, sm);
		}
		ans = max(cnt, ans);
		h = sl;
		for (int i = 0; i < r; i++){
			if (h % 2 == 1){
				for (int j = 0; j < c; j++){
					bd[i][j] = (bd[i][j] == 0) ? 1 : 0;
				}
			}
			h /= 2;
		}

	}

	printf("%d\n", ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   10 |         scanf_s(" %d %d", &r, &c);
      |         ^~~~~~~
      |         scanf
Language: C++

#include <iostream>
using namespace std;
int r,c;
int max_on;
int row_on[11];
int col_on[10005];
bool grid[11][10005];
bool flip_pattern[11];
int cur_on = 0;
//
void setFlipStatus(unsigned int p){
    for (int i = 0; i<r; ++i) {
        if (p & (1<<i)) {
            flip_pattern[i] = true;
        }
        else
            flip_pattern[i] = false;
    }
}
void flip_rows(){
    for (int i = 0; i<r; ++i){
        if (flip_pattern[i]) {
            for (int j = 0; j<c; ++j) {
                grid[i][j] = !grid[i][j];
                if(grid[i][j])
                    col_on[j]++;
                else
                    col_on[j]--;
            }
            row_on[i] = c - row_on[i];
            cur_on += 2*row_on[i] - c;
        }
    }
}
void find_cur_max(){
    int ori_on = cur_on;
    for (int j = 0; j<c; ++j) {
        if(r-col_on[j]>col_on[j]){
            cur_on += r - 2*col_on[j];
        }
    }
    if (cur_on>max_on)
        max_on = cur_on;
    
    cur_on = ori_on;
}
int main(){
    while (cin>>r>>c && r &&c) {
        max_on = 0;
        cur_on = 0;
        memset(flip_pattern, 0, sizeof(flip_pattern));
        memset(row_on, 0, sizeof(row_on));
        memset(col_on, 0, sizeof(col_on));
        //
        for (int i = 0; i < r; ++i)
            for (int j = 0; j<c ; ++j) {
                cin>>grid[i][j];
                if (grid[i][j]) {
                    cur_on++;
                    row_on[i]++;
                    col_on[j]++;
                }
            }
        max_on = cur_on;
        //
        unsigned int status_size = 1<<r;
        for (unsigned int i=0; i<status_size;++i ) {
            //??¨??????????????¬?????????
            setFlipStatus(i);
            flip_rows();
            find_cur_max();
            flip_rows();
        }
        cout<<max_on<<endl;
    }
    
    
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:51:9: error: 'memset' was not declared in this scope
   51 |         memset(flip_pattern, 0, sizeof(flip_pattern));
      |         ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include <iostream>
  +++ |+#include <cstring>
    2 | using namespace std;
Language: C++

#include <iostream>
using namespace std;
int r,c;
int max_on;
int row_on[11];
int col_on[10005];
bool grid[11][10005];
bool flip_pattern[11];
int cur_on = 0;
//
void setFlipStatus(unsigned int p){
    for (int i = 0; i<r; ++i) {
        if (p & (1<<i)) {
            flip_pattern[i] = true;
        }
        else
            flip_pattern[i] = false;
    }
}
void flip_rows(){
    for (int i = 0; i<r; ++i){
        if (flip_pattern[i]) {
            for (int j = 0; j<c; ++j) {
                grid[i][j] = !grid[i][j];
                if(grid[i][j])
                    col_on[j]++;
                else
                    col_on[j]--;
            }
            row_on[i] = c - row_on[i];
            cur_on += 2*row_on[i] - c;
        }
    }
}
void find_cur_max(){
    int ori_on = cur_on;
    for (int j = 0; j<c; ++j) {
        if(r-col_on[j]>col_on[j]){
            cur_on += r - 2*col_on[j];
        }
    }
    if (cur_on>max_on)
        max_on = cur_on;
    
    cur_on = ori_on;
}
int main(){
    while (cin>>r>>c && r &&c) {
        max_on = 0;
        cur_on = 0;
        memset(flip_pattern, 0, sizeof(flip_pattern));
        memset(row_on, 0, sizeof(row_on));
        memset(col_on, 0, sizeof(col_on));
        //
        for (int i = 0; i < r; ++i)
            for (int j = 0; j<c ; ++j) {
                cin>>grid[i][j];
                if (grid[i][j]) {
                    cur_on++;
                    row_on[i]++;
                    col_on[j]++;
                }
            }
        max_on = cur_on;
        //
        unsigned int status_size = 1<<r;
        for (unsigned int i=0; i<status_size;++i ) {
            //??所有翻?的可能
            setFlipStatus(i);
            flip_rows();
            find_cur_max();
            flip_rows();
        }
        cout<<max_on<<endl;
    }
    
    
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:51:9: error: 'memset' was not declared in this scope
   51 |         memset(flip_pattern, 0, sizeof(flip_pattern));
      |         ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include <iostream>
  +++ |+#include <cstring>
    2 | using namespace std;
Language: C++

#include <iostream>
#include <algorithm>

using namespace::std;

int ans = 0;

void solve(int** osenbei, int i, const int c, const int r, int temp){

  int bef = 0;
  int aft = 0;
  for(int i = 0; i < c; i++){

	int bef = 0;
	int aft = 0;
	for(int j = 0; j < r; j++){//i???????????????
	  if(osenbei[i][j] == 1){
		osenbei[i][j] = 0;
		bef++;//i?????????1?????°????????????
	  }
	  else{
		osenbei[i][j] = 1;
		aft++;//i?????????0?????°????????????
	  }
	}
	if(bef <= aft){
	  temp = temp - bef + aft;
	  ans = max(ans, temp);
	}
	else{
	  for(int j = 0; j < r; j++){//i?????????????????´???
		if(osenbei[i][j] == 1) osenbei[i][j] = 0;
		else osenbei[i][j] = 1;
	  }
	}
  }

  for(int i = 0; i < r; i++){

	int bef = 0;
	int aft = 0;
	for(int j = 0; j < c; j++){//i???????????????
	  if(osenbei[j][i] == 1){
		osenbei[j][i] = 0;
		bef++;//i?????????1?????°????????????
	  }
	  else{
		osenbei[j][i] = 1;
		aft++;//i?????????0?????°????????????
	  }
	}
	if(bef <= aft){
	  temp = temp - bef + aft;
	  ans = max(ans, temp);
	}
	else{
	  for(int j = 0; j < c; j++){//i?????????????????´???
		if(osenbei[j][i] == 1) osenbei[j][i] = 0;
		else osenbei[j][i] = 1;
	  }
	}
  }
}

int main(){

  while(1){

	int temp_c, temp_r;
	cin >> temp_c;//???
	cin >> temp_r;//???

	const int r = temp_r;
	const int c = temp_c;

	if(c == 0 && r == 0) break;	

	int** osenbei = new int*[c];
	int** osenbei = new int*[c];
	for(int i = 0; i < c; i++){
	  osenbei[i] = new int[r];
	  osenbei[i] = new int[r];
	}

	for(int i = 0; i < c; i++){
	  for(int j = 0; j < r; j++){
		osenbei[i][j] = 0;
		osenbei[i][j] = 0;
	  }
	}

	int temp = 0;
	for(int i = 0; i < c; i++){
	  for(int j = 0; j < r; j++){
		cin >> osenbei[i][j];
		if(osenbei[i][j] != 0 && osenbei[i][j] != 1) return 1;
		else if(osenbei[i][j] == 1) temp++;
		osenbei[i][j] = osenbei[i][j];
	  }
	}
	ans = temp;

	//dfs_first(osenbei, 0, c, r, temp);//??±???????????¢?´¢??2
	solve(osenbei, 0, c, r, temp);//??±???????????¢?´¢+????¬????
	cout << ans << endl;

  }

  return 0;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:79:15: error: redeclaration of 'int** osenbei'
   79 |         int** osenbei = new int*[c];
      |               ^~~~~~~
a.cc:78:15: note: 'int** osenbei' previously declared here
   78 |         int** osenbei = new int*[c];
      |               ^~~~~~~
Language: C++

#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
using namespace std;
int sen[10][10000];
int w,h,ans,mai,x;
int main()
{
while(1){
	cin>>h>>w;
if(!h&&!w) return;
ans=0;
	for(int i=0;i<h;i++) for(int j=0;j<w;j++) cin>>sen[i][j];
	for(int i=0; i < 1<<h ; i++){
		mai=0;
		for(int j=0;j<w;j++){
			x=0;
			for(int k=0;k<h;k++){
				if( (i>>k & 1) != (sen[k][j]) ) x++;
			}
			mai+=max(x,h-x);
		}
		ans=max(ans,mai);
	}
	cout<<ans<<endl;
}}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:12: error: return-statement with no value, in function returning 'int' [-fpermissive]
   18 | if(!h&&!w) return;
      |            ^~~~~~
Language: C++

#include "iostream"
#include "algorithm"
using namespace std;

int H, W;
bool status[10][10000];
bool gap[10];
int box;
int num;
int ans;

int main() {
	cin >> H >> W;
	while (H != 0 && W != 0) {
		for (int i = 0; i < H; i++) {
			for (int j = 0; j < W; j++) {
				cin >> status[i][j];
			}
		}
		for (int j = 0; j < W; j++) {
			for(int i=0;i<H;i++){
				if (status[i][j])box++;
			}
			box = max(box, H - box);
			ans += box;
			box = 0;
		}
		for (int n = 1; n < pow(2,H); n++) {
			for (int i = 0; i < H; i++) {
				if (n%(int)pow(2, i + 1) >= pow(2, i))gap[i] = true;
				else gap[i] = false;
			}
			for (int j = 0; j < W; j++) {
				for (int i = 0; i < W; i++) {
					if (status[i][j] ^ gap[i])box++;
				}
				box = max(box, H - box);
				num += box;
				box = 0;
			}
			if (ans < num)ans = num;
			num = 0;
		}
		cout << ans<<"\n";
		ans = 0;
		cin >> H >> W;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:37: error: 'pow' was not declared in this scope
   28 |                 for (int n = 1; n < pow(2,H); n++) {
      |                                     ^~~
Language: C++

#include "iostream"
#include "algorithm"
using namespace std;

int H, W;
bool status[10][10000];
bool gap[10];
int box;
int num;
int ans;

int main() {
	cin >> H >> W;
	while (H != 0 && W != 0) {
		for (int i = 0; i < H; i++) {
			for (int j = 0; j < W; j++) {
				cin >> status[i][j];
			}
		}
		for (int j = 0; j < W; j++) {
			for(int i=0;i<H;i++){
				if (status[i][j])box++;
			}
			box = max(box, H - box);
			ans += box;
			box = 0;
		}
		for (int n = 1; n < pow(2,H); n++) {
			for (int i = 0; i < H; i++) {
				if (n%(int)pow(2, i + 1) >= pow(2, i))gap[i] = true;
				else gap[i] = false;
			}
			for (int j = 0; j < W; j++) {
				for (int i = 0; i < H; i++) {
					if (status[i][j] ^ gap[i])box++;
				}
				box = max(box, H - box);
				num += box;
				box = 0;
			}
			if (ans < num)ans = num;
			num = 0;
		}
		cout << ans<<"\n";
		ans = 0;
		cin >> H >> W;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:37: error: 'pow' was not declared in this scope
   28 |                 for (int n = 1; n < pow(2,H); n++) {
      |                                     ^~~
Language: C++

#include "iostream"
#include "algorithm"
using namespace std;

int H, W;
int status[10][10000];
int gap[10];
int box;
int num;
int ans;

int main() {
	cin >> H >> W;
	while (H != 0 && W != 0) {
		for (int i = 0; i < H; i++) {
			for (int j = 0; j < W; j++) {
				cin >> status[i][j];
			}
		}
		for (int j = 0; j < W; j++) {
			for(int i=0;i<H;i++){
				if (status[i][j])box++;
			}
			box = max(box, H - box);
			ans += box;
			box = 0;
		}
		for (int n = 1; n < pow(2,H); n++) {
			for (int i = 0; i < H; i++) {
				if (n%(int)pow(2, i + 1) >= pow(2, i))gap[i] = true;
				else gap[i] = false;
			}
			for (int j = 0; j < W; j++) {
				for (int i = 0; i < H; i++) {
					if (status[i][j] ^ gap[i])box++;
				}
				box = max(box, H - box);
				num += box;
				box = 0;
			}
			if (ans < num)ans = num;
			num = 0;
		}
		cout << ans<<"\n";
		ans = 0;
		cin >> H >> W;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:37: error: 'pow' was not declared in this scope
   28 |                 for (int n = 1; n < pow(2,H); n++) {
      |                                     ^~~
Language: C++

#include <bits/stdc++>

using namespace std;

using ll=long long;
using  ull=unsigned long long;
const char en='?\n';

int main(){
	int r,c,buf;
	bool st[10][10000];
	
	cin>>r>>c;
	for(int i=0;i<r;i++){
		for(int k=0;k<c;k++){

Compiler output:
a.cc:1:10: fatal error: bits/stdc++: No such file or directory
    1 | #include <bits/stdc++>
      |          ^~~~~~~~~~~~~
compilation terminated.
Language: C++

#include "bits/stdc++.h"

using namespace std;

using ll=long long;
using  ull=unsigned long long;
const char en='?\n';

int main(){
	int r,c,buf;
	bool st[10][10000];
	
	cin>>r>>c;
	for(int i=0;i<r;i++){
		for(int k=0;k<c;k++){
			cin>>buf;
			st[r][c]=buf;
		}
	}
	
	int result=0,count;
	for(knt flag=0;flag<(1<<r);i++){
		count=0;
		for(int j=0;j<r;j++){
			int buft=0,buff=0;
			for(int i=0;i<c;i++){
				bool b=(flag&&(1<<i));
				if(st[i][j]^b)
					buft++;
				else
					buff++;
			}
			count+=max(buft,buff);
		}
		result=max(result,count);
	}
	cout<<result<<en;
}

Compiler output:
a.cc:7:15: warning: multi-character character constant [-Wmultichar]
    7 | const char en='?\n';
      |               ^~~~~
a.cc:7:15: warning: overflow in conversion from 'int' to 'char' changes value from '16138' to '10' [-Woverflow]
a.cc: In function 'int main()':
a.cc:22:13: error: 'knt' was not declared in this scope; did you mean 'int'?
   22 |         for(knt flag=0;flag<(1<<r);i++){
      |             ^~~
      |             int
a.cc:22:24: error: 'flag' was not declared in this scope
   22 |         for(knt flag=0;flag<(1<<r);i++){
      |                        ^~~~
a.cc:22:36: error: 'i' was not declared in this scope
   22 |         for(knt flag=0;flag<(1<<r);i++){
      |                                    ^
Language: C++

#include "bits/stdc++.h"

using namespace std;

using ll=long long;
using  ull=unsigned long long;
const char en='?\n';

int main(){
	int r,c,buf;
	bool st[10][10000];
	
	cin>>r>>c;
	for(int i=0;i<r;i++){
		for(int k=0;k<c;k++){
			cin>>buf;
			st[r][c]=buf;
		}
	}
	
	int result=0,count;
	for(int flag=0;flag<(1<<r);i++){
		count=0;
		for(int j=0;j<r;j++){
			int buft=0,buff=0;
			for(int i=0;i<c;i++){
				bool b=(flag&&(1<<i));
				if(st[i][j]^b)
					buft++;
				else
					buff++;
			}
			count+=max(buft,buff);
		}
		result=max(result,count);
	}
	cout<<result<<en;
}

Compiler output:
a.cc:7:15: warning: multi-character character constant [-Wmultichar]
    7 | const char en='?\n';
      |               ^~~~~
a.cc:7:15: warning: overflow in conversion from 'int' to 'char' changes value from '16138' to '10' [-Woverflow]
a.cc: In function 'int main()':
a.cc:22:36: error: 'i' was not declared in this scope
   22 |         for(int flag=0;flag<(1<<r);i++){
      |                                    ^
Language: C++

#include <iostream>
#include <string>
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
int  s[15][10005];
int m,n;
int maxn=0;
void dfs(int x )
{
    if(x==m+1)
    {
        int term=0;
        for(int i=1; i<=n; i++)
        {
            int sum1=0;
            for(int j=1; j<=m; j++)
            {
                if(s[j][i]==1) sum1++;
            }
            term+=max(sum1,m-sum1);
        }
        maxn=max(term,maxn);

        return ;
    }
    dfs(x+1);
    for(int j=1; j<=n; j++)
    {
        s[x][j]=!s[x][j];
    }
    dfs(x+1);
}
 
 
int main()
{

    while(cin >> m >> n&&m&&n)
    {
        maxn=0;
        int a;
        ans=0;
        for(int i=1; i<=m; i++)
        {
            for(int j=1; j<=n; j++)
            {
                scanf("%d",&a);
                s[i][j]=a;
            }
        }
        dfs(0);
        cout << maxn << endl;
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:44:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   44 |         ans=0;
      |         ^~~
      |         abs
Language: C++

/*
 * AOJ 0525: Osenbei
 * ?¢???????R???C?????????????????????0???1???????¬?????????´????????´????????????????????¬????±??????????????????°????°????0???
 * ?±?????????????????´¢????????????
 * ???????????????10???????????????????????¬????????¨??¨????????????????????¶????????????1????????°???????????¬?????????????°?0???1????????°??¨????±???????
 */


#include <cstdio>
#include <iostream>
#include <string>

using namespace std;

int m, n;
int mat[11][10001];
int one[10001], _one[10001];
int ans;

void solve() {
    ans = 0;
    memset(one, 0, sizeof(one));
    for(int i = 0; i < m; ++i) {
        for(int j = 0; j < n; ++j) {
            cin >> mat[i][j];
            one[j] += mat[i][j];
        }
    }
    for(int no = (1 << m) -1; no >= 0; --no) {
        int _no = no;
        for(int i = 0; i < n; ++i) {
            _one[i] = one[i];
        }
        for(int i = 0; i < m; ++i) {
            if(_no & 1){
                for(int j = 0; j < n; ++j) {
                    _one[j] += mat[i][j] ? -1 : 1;
                }
            }
            _no >>= 1;
        }
        int tmp = 0;
        for(int i = 0; i < n; ++i) {
            tmp += max(_one[i], m - _one[i]);
        }
        ans = max(ans, tmp);
    }

}

int main() {
    while(cin >> m >> n && m > 0 && n > 0) {
        solve();
        cout << ans << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:22:5: error: 'memset' was not declared in this scope
   22 |     memset(one, 0, sizeof(one));
      |     ^~~~~~
a.cc:11:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   10 | #include <iostream>
  +++ |+#include <cstring>
   11 | #include <string>
Language: C++

#include <cstdio>

int R,C;	// (1 <= R <= 10, 1 <= C <= 10 000)
const int MAX_ROW = 10;
const int MAX_COL = 10000;
bool is_flipped[MAX_ROW + 1][MAX_COL + 1];

void flip(int row)
{
	for(int c=0;c<C;c++)
		is_flipped[row][c] = !is_flipped[row][c];
}
int solve()
{
	int min_score = R*C;
	for(int i=0;i<1<<R;i++)
	{
		for(int r=0;r<R;r++)
			if((i>>r)&1) flip(r);
		int score = 0;
		for(int c=0;c<C;c++)
		{
			int column_sum = 0;
			for(int r=0;r<R;r++)
				if(is_flipped[r][c]) column_sum++;
			score += std::min(column_sum, R-column_sum);
		}
		min_score = std::min(min_score,score);
		for(int r=0;r<R;r++)
			if((i>>r)&1) flip(r);
	}
	return R*C-min_score;
}

int main()
{
	scanf("%d %d", &R, &C);
	int input;
	while(C!=0 || R!=0)
	{
        for (int r = 0; r < R; r++)
            for (int c = 0; c < C; c++)
			{
                scanf("%d", &input);
				is_flipped[r][c] = input==1;
			}
        printf("%d\n", solve());
        scanf("%d %d", &R, &C);
    }
	return 0;
}

Compiler output:
a.cc: In function 'int solve()':
a.cc:26:39: error: 'min' is not a member of 'std'
   26 |                         score += std::min(column_sum, R-column_sum);
      |                                       ^~~
a.cc:28:34: error: 'min' is not a member of 'std'
   28 |                 min_score = std::min(min_score,score);
      |                                  ^~~
Language: C++

#include<algorithm>
#include<iostream>
#include<bitset>
using namespace std;
const int MAX_R=10;
const int MAX_C=1000;
int R,C;
bitset<MAX_C> a[MAX_R];
int ans;
void check(int k)
{
	if(k==R)
	{
		int result=0;
		for(int j=0;j<C;j++)
		{
			int num=0;
			for(int i=0;i<R;i++)
				if(a[i][j])
					num++;
		}
		result+=max(num,R-num);
		ans=max(ans,result);
	return;
	}
	check(k+1);
	a[k].flip();
	check(k+1);
	a[k].flip();
}
void solve()
{
	ans=0;
	check(0);
	cout<<ans<<endl;
}
int main()
{
	while(cin>>R>>C&&R!=0&&C!=0)
	{
		for(int i=0;i<R;i++)
		{
			for(int j=0;j<C;j++)
			{
				bool tmp;
				cin>>tmp;
				a[i][j]=tmp;
			}
		}
		solve();
	}
	return 0;
}

Compiler output:
a.cc: In function 'void check(int)':
a.cc:22:29: error: 'num' was not declared in this scope; did you mean 'enum'?
   22 |                 result+=max(num,R-num);
      |                             ^~~
      |                             enum
Language: C++

//??????????¨????????????????????¬¬??????????¢?
//??????????´¢+DFS ??????
#include <iostream>
#define MAX_N 10
#define MAX_M 10000
using namespace std;
bool ex[MAX_N][MAX_M];
int n,m,ans
void Dfs(int x)
{
    if(x==n)
    {
        int sum=0;
        for(int j=0;j<m;j++) {
            int right=0;
            for(int i=0;i<n;i++) {
                if(ex[i][j]) right++;
            }
            sum+=(right>(n-right))?right:(n-right);
        }
        ans=max(ans,sum);
        return;
    }
        //????????¢????????¬
    Dfs(x+1);

        //????????¢?????¬
    for(int i=0;i<m;i++)
        ex[x][i]=!ex[x][i];
    Dfs(x+1);
}

int main()
{
    while(true)
    {
        ans=0;
        cin>>n>>m;
        if(n!=0&&m!=0)
        {
            for(int i=0;i<n;i++)
                for(int j=0;j<m;j++)
                cin>>ex[i][j];
            Dfs(0);
            cout<<ans<<endl;
        }
        else break;
    }
    return 0;
}

Compiler output:
a.cc:9:1: error: expected initializer before 'void'
    9 | void Dfs(int x)
      | ^~~~
a.cc: In function 'int main()':
a.cc:37:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   37 |         ans=0;
      |         ^~~
      |         abs
a.cc:44:13: error: 'Dfs' was not declared in this scope
   44 |             Dfs(0);
      |             ^~~
Language: C++

#include<stdio.h>
int main(void){
    int i, j, k, l, R, C, count0, count1, Count[10], a[10][10000];
    scanf("%d %d", &R, &C);
    while ( 1 ) {
        count0 = count1 = 0;
        for ( i = 0; i < R; i++ ) {
            for ( j = 0; j < C; j++ ) {
                scanf("%d", &a[i][j]);
                Count[i] += a[i][j];
                if ( a[i][j] == 0 ) count0++;
                else if ( a[i][j] == 1) count1++;
            }
        }
        if ( count0 >= count1 ) {
            for ( i = 0; i < R; i++ ) {
                if ( Count[i] >= C / 2 ) {
                    for ( j = 0; j < C; j++ ) {
                        if ( a[i][j] == 0 ) a[i][j] = 1;
                        else a[i][j] = 0;
                    }
                }
            }
        } else {
            for ( i = 0; i < R; i++ ) {
                if ( Count[i] >= C / 2 ) {
                    for ( j = 0; j < C; j++ ) {
                        if ( a[i][j] == 0 ) a[i][j] = 1;
                        else a[i][j] = 0;
                    }
                }
            }            
        }

}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:2: error: expected '}' at end of input
   35 | }
      |  ^
a.cc:2:15: note: to match this '{'
    2 | int main(void){
      |               ^
Language: C++

#include <iostream>
#include <stdio.h>
#include <string.h>
#include <string>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <algorithm>
#include <time.h>
#include <stdlib.h>
#include <math.h>

using namespace std;

int main (void)
{
	long C,c,n,m,a[10000][10000],z[10000],o[10000];
	C = 0;
	c = 0;

	cin >> n >> m;
	c++;
	if (n == 0 && m == 0)
	{
		break;
	}
	if (c > 5)
	{
		break;
	}

	for (long i = 0; i < m; i++)    //?????????
	{
		z[i] = 0;
		o[i] = 0;
	}
	for (long i = 0; i < m; i++)
	{
		for (long j = 0; j < n; j++)
		{
			cin >> a[j][i];
			if (a[j][i] == 0)
			{
				z[i] += 1;
			}
			else
			{
				o[i] += 1;
			}
		}
	}

	for (long i = 0; i < m; i++)
	{
		if (z[i] < o[i])
		{
			for (long j = 0; j < n; j++)
			{
				if (a[j][i] == 0)
				{
					a[j][i] = 0;
					a[j][i] = 1;
				}
				else  if (a[j][i] == 1)
				{
					a[j][i] = 0;
				}
			}
		}
	}

	for (long i = 0; i < m; i++)       //?????????
	{
		z[i] = 0;
		o[i] = 0;
	}

	for (long j = 0; j < n; j++)
	{
		for (long i = 0; i < m; i++)
		{
			if (a[j][i] == 0)
			{
				z[j] += 1;
			}
			else if (a[j][i] == 1)
			{
				o[j] += 1;
			}
		}
	}

	for (long j = 0; j < n; j++)
	{
		if (z[j] < o[j])
		{
			for (long i = 0; i < m; i++)
			{
				if (a[j][i] == 0)
				{
					a[j][i] = 1;
				}
				else if (a[j][i] == 1)
				{
					a[j][i] = 0;
				}
			}
		}
	}

	for (long j = 0; j < n; j++)
	{
		for (long i = 0; i < m; i++)
		{
			if (a[j][i] == 0)
			{
				C += 1;
			}
		}
	}

	cout << C  << endl;
	C = 0;

	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:17: error: break statement not within loop or switch
   26 |                 break;
      |                 ^~~~~
a.cc:30:17: error: break statement not within loop or switch
   30 |                 break;
      |                 ^~~~~
a.cc: At global scope:
a.cc:127:1: error: expected declaration before '}' token
  127 | }
      | ^