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

#include <bits/stdc++.h>
#define M 1e7
using namespace std;
int main(){
	int n,i,b[6];
	while(cin>>n&&n){
		j=n;
		int a[86400]={0},ans=0,c=0;
		while(n--){
			scanf("%d:%d:%d %d:%d:%d",&b[0],&b[1],&b[2],&b[3],&b[4],&b[5]);
			a[b[0]*3600+b[1]*60+b[2]]++;
			a[b[3]*3600+b[4]*60+b[5]]--;
		}
		for(i=0;i<86400;i++){
			c+=a[i];
			ans=max(ans,c);
		}
		cout<<ans<<endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:17: error: 'j' was not declared in this scope
    7 |                 j=n;
      |                 ^
Language: C++

#include<iostream>
#include<cstdio>
using namespace std;
int a[24 * 60 * 60+10];
int main() {
	long long a1, m1, a2, m2, a3, m3;
	int n;
	while (cin >> n&&n != 0) {
		int h1, m1, s1, h2, m2, s2;
		fill(a, a + 60 * 24 * 60+10, 0);
		int sum = 0;
		for (int i = 0; i<n; i++) {
			scanf_s("%d:%d:%d %d:%d:%d", &h1, &m1, &s1, &h2, &m2, &s2);
			if (a[h1 * 3600 + m1 * 60 + s1] == 0) {
				sum++;
				for (int i = 0; i<24 * 60 * 60+10; i++) a[i]++;
			}
			for (int i = h1 * 3600 + m1 * 60 + s1; i<h2 * 3600 + m2 * 60 + s2; i++) {
				a[i]--;
			}
			a[h2 * 3600 + m2 * 60 + s2]++;
		}
		cout << sum << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:25: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   13 |                         scanf_s("%d:%d:%d %d:%d:%d", &h1, &m1, &s1, &h2, &m2, &s2);
      |                         ^~~~~~~
      |                         scanf
Language: C++

#include<iostream>
#include<cstdio>
using namespace std;
int a[24 * 60 * 60+10];
int main() {
	long long a1, m1, a2, m2, a3, m3;
	int n;
	while (cin >> n&&n != 0) {
		int h1, m1, s1, h2, m2, s2;
		fill(a, a + 60 * 24 * 60+10, 0);
		int sum = 0;
		for (int i = 0; i<n; i++) {
			scanf_s("%d:%d:%d %d:%d:%d", &h1, &m1, &s1, &h2, &m2, &s2);
			bool k = false;
			for (int i = h1 * 3600 + m1 * 60 + s1; i<h2 * 3600 + m2 * 60 + s2; i++) {
				a[i]--;
				if (a[i] < 0) {
					sum++;
					for (int i = 0; i < 24 * 60 * 60+10; i++) a[i]++;
				}
			}
		}
		cout << sum << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:25: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   13 |                         scanf_s("%d:%d:%d %d:%d:%d", &h1, &m1, &s1, &h2, &m2, &s2);
      |                         ^~~~~~~
      |                         scanf
Language: C++

#include "bits/stdc++.h"

#define REP(i,n) for(ll i=0;i<n;++i)
#define RREP(i,n) for(ll i=n-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<n;++i)
#define RFOR(i,m,n) for(ll i=n-1;i>=m;--i)
#define ALL(v) (v).begin(),(v).end()
#define PB(a) push_back(a)
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define DUMP(v) REP(aa, (v).size()) { cout << v[a]; if (a != v.size() - 1)cout << " "; else cout << endl; }
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

const int dx[8] = { 1,1,0,-1,-1,-1,0,1 };
const int dy[8] = { 0,1,1,1,0,-1,-1,-1 };


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll max(ll a, int b) { return max(a, ll(b)); }
ll max(int a, ll b) { return max(ll(a), b); }
ll min(ll a, int b) { return min(a, ll(b)); }
ll min(int a, ll b) { return min(ll(a), b); }
///(?´????????`)(?´????????`)(?´????????`)(?´????????`)(?´????????`)(?´????????`)///
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	while (1) {
		int n;
		cin >> n;
		if (!n)break;
		vi v(24 * 60 * 60 + 1, 0);
		REP(i, n) {
			int h, m, s;
			char c;
			cin >> h >> c >> m >> c >> s;
			v[h * 60 * 60 + m * 60 + s]++;
			cin >> h >> c >> m >> c >> s;
			v[h * 60 * 60 + m * 60 + s]--;
		}
		REP(i, 24 * 60 * 60) {
		cout << *max_element(ALL(v)) << endl;
	}
	return 0;
}

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

#include<iostream>
#include<algorithm>
using namespace std;

#define DAY_TIME 86400

//??¢??°(00:00:00??????????§???°?????????)
int timeToNum(char* text) {
	int ans=0;
	//h
	ans += (text[0] - '0') * 60 * 60 * 10;
	ans += (text[1] - '0') * 60 * 60;
	//m
	ans += (text[3] - '0') * 60 * 10;
	ans += (text[4] - '0') * 60;
	//s
	ans += (text[6] - '0') * 10;
	ans += (text[7] - '0');

	return ans;
}

//?????????????????????
int imosu[DAY_TIME];

//??????????????¨??????
int N;

//??????????????¨??°?????????
char timeS[100];
char timeE[100];

//??????
int ans;

int main() {
	while (true) {
		//?????????
		memset(imosu,0,sizeof(int)*DAY_TIME);
		ans=0;

		//??\?????¨???????????¶
		cin>>N;
		if(N==0)break;

		for(int i=0;i<N;i++){
			//??\???
			cin >> timeS;
			cin >> timeE;
			
			//???????????????????????????
			imosu[timeToNum(timeS)]++;
			imosu[timeToNum(timeE)]--;
		}

		//????????????????????????????????????
		for (int i = 0; i < DAY_TIME-1; i++) {
			imosu[i+1]+=imosu[i];
			ans=max(ans,imosu[i+1]);
		}
		//?????§????????????
		cout<<ans<<endl;
	}
	return 0;
}

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

#include <bits/stdc++.h>

using namespace std;

int main(void) {
    int n;
    while (cin >> n, n) {
        int T[86410] = {};
        for (int i = 0; i < n; i++) {
            int h[2], m[2], s[2], t[2];
            for (int j = 0; j < 2; j++) {
                scanf("%d:%d:%d", &h[j], &m[j], &s[j]);
                t[j] = h[j]  3600 + m[j]  60 + s[j];
                if (!j) T[t[j]]++;
                else T[t[j]]--;
            }
        }

        int ans = 0;
        for (int i = 0; i < 86400; i++) {
            if (i) T[i] += T[i - 1];
            ans = max(ans, T[i]);
        }
        
        cout << ans << endl;
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:28: error: expected ';' before numeric constant
   13 |                 t[j] = h[j]  3600 + m[j]  60 + s[j];
      |                            ^ ~~~~
      |                            ;
Language: C++

#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <queue>
#include <vector>
using namespace std;

int main() {
	int n, data[6], x[864001] = { 0 };
	int max_mini = 0;
	while (cin >> n) {
		if (n == 0)break;
		for (int i = 0; i < n; i++) {
			scanf_s("%d:%d:%d %d:%d:%d",&data[0],&data[1],&data[2],&data[3],&data[4],&data[5]);
			x[data[0] * 3600 + data[1] * 60 + data[2]]++;
			x[data[3] * 3600 + data[4] * 60 + data[5]]--;
			if (max_mini < data[3] * 3600 + data[4] * 60 + data[5])
				max_mini = data[3] * 3600 + data[4] * 60 + data[5];
		}
		int ans = 0, cnt = 0;
		for (int i = 0; i <= max_mini; i++) {
			cnt += x[i];
			ans = max(ans, cnt);
		}
		printf("%d\n",ans);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:25: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   15 |                         scanf_s("%d:%d:%d %d:%d:%d",&data[0],&data[1],&data[2],&data[3],&data[4],&data[5]);
      |                         ^~~~~~~
      |                         scanf
Language: C++

#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <queue>
#include <vector>
using namespace std;

int main() {
	int n, data[6];
	int max_mini = 0;
	
	while (cin >> n) {
		if (n == 0)break;
		int x[86401] = { 0 };
		for (int i = 0; i < n; i++) {
			scanf_s("%d:%d:%d %d:%d:%d",&data[0],&data[1],&data[2],&data[3],&data[4],&data[5]);
			x[data[0] * 3600 + data[1] * 60 + data[2]]++;
			x[data[3] * 3600 + data[4] * 60 + data[5]]--;
			if (max_mini < data[3] * 3600 + data[4] * 60 + data[5])
				max_mini = data[3] * 3600 + data[4] * 60 + data[5];
		}
		int ans = 0, cnt = 0;
		for (int i = 0; i <= max_mini; i++) {
			cnt += x[i];
			ans = max(ans, cnt);
		}
		cout << ans << endl;
	}
	return 0;
	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:25: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   17 |                         scanf_s("%d:%d:%d %d:%d:%d",&data[0],&data[1],&data[2],&data[3],&data[4],&data[5]);
      |                         ^~~~~~~
      |                         scanf
Language: C++

import qualified Control.Monad as C
import qualified Data.List     as L
import Control.Applicative ((<$>))

solve :: Int -> IO ()
solve n = do
    rideAndLeftTimes <- concat <$> (C.forM [1..n] $ \_ -> do
        [ride, left] <- map read . words . filter (/= ':') <$> getLine :: IO [Int]
        return [(ride, 1), (left, -1)])
    print . maximum . scanl (+) 0 . map snd . L.sort $ rideAndLeftTimes
    main

main :: IO ()
main = do
    n <- read <$> getLine :: IO Int
    C.when (n /= 0) $ solve n




Compiler output:
a.cc:7:45: error: too many decimal points in number
    7 |     rideAndLeftTimes <- concat <$> (C.forM [1..n] $ \_ -> do
      |                                             ^~~~
a.cc:7:53: error: stray '\' in program
    7 |     rideAndLeftTimes <- concat <$> (C.forM [1..n] $ \_ -> do
      |                                                     ^
a.cc:1:1: error: 'import' does not name a type
    1 | import qualified Control.Monad as C
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

#include <iostream>
#include <cstdio>
#include <vector>
#include <map>
using namespace std;

typedef pair< int, int > iP;

int main() {

    int n;

    while(cin >> n, n) {
        vector< iP > v;
        vector< int > t(24 * 3600, 0);
        for(int i = 0; i < n; i++) {
            int h, m, s, hh, mm, ss;
            scanf("%2d:%2d:%2d %2d:%2d:%2d", &h, &m, &s, &hh, &mm, &ss);
            v.push_back(iP(h * 3600 + m * 60 + s, hh * 3600 + mm * 60 + ss));
            t[v[v.size() - 1].first]++, t[v[v.size() - 1].second]--;
        }

        for(int i = 1; i < 24 * 3600; i++) {
            t[i] += t[i - 1];
        }
        cout << *max_element(t.begin(), t.end()) << endl;
    }
}



Compiler output:
a.cc: In function 'int main()':
a.cc:26:18: error: 'max_element' was not declared in this scope
   26 |         cout << *max_element(t.begin(), t.end()) << endl;
      |                  ^~~~~~~~~~~
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <numeric>
#include <algorithm>
#include <stack>
#include <map>
#include <cstdlib>
using namespace std;
int N;
int t[86400];
int main() {
   while(cin >> N, N){
       int t[86400+1]={0};
       for(int i=0; i<N; ++i){
           int h, m, s;
           int start, end;
            scan_f("%d:%d:%d", &h, &m, &s);
            start = h*3600+m*60+s;
            scan_f("%d:%d:%d", &h, &m, &s);
            end = h*3600 + m*60 + s;
            for(int i=start; i<end; ++i) t[i]++;
           
       }
       int ans = 0;
       for(int i=0; i<86400+1; ++i) ans = max(ans, t[i]);
       cout << ans << endl;
   }
   return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:13: error: 'scan_f' was not declared in this scope; did you mean 'scanf'?
   19 |             scan_f("%d:%d:%d", &h, &m, &s);
      |             ^~~~~~
      |             scanf
Language: C++

#include <iostream>
#include <vector>
#include <queue>
using namespace std;

void read(int& s0, int& s1)
{
  char d;
  int h0, m0, h1, m1;
  cin >> h0 >> d >> m0 >> d >> s0;
  cin >> h1 >> d >> m1 >> d >> s1;
  s0 += 3600*h0 + 60*m0;
  s1 += 3600*h1 + 60*m1;
}

int main()
{
  int n;
  while (cin >> n && n != 0) {
    vector<pair<int,int> > entries(n);
    for (int i = 0; i < n; i++) {
      read(entries[i].first, entries[i].second);
    }
    sort(entries.begin(), entries.end());

    priority_queue<int, vector<int>, greater<int> > q;
    q.push(entries.front().second);
    for (int i = 1; i < n; i++) {
      if (q.top() > entries[i].first) {
        q.push(entries[i].second);
      } else {
        q.pop();
        q.push(entries[i].second);
      }
    }
    cout << q.size() << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   24 |     sort(entries.begin(), entries.end());
      |     ^~~~
      |     short
Language: C++

#include<iostream>
#include<vector>
#include<string>
using namespace std;

int convert(string s){
	int h=(s[0]-'0')*10+(s[1]-'0');
	int m=(s[3]-'0')*10+(s[4]-'0');
	int t=(s[6]-'0')*10+(s[7]-'0');
	return h*3600+m*60+t;
}

class range{
public:
	int left,right;
	range(int left,int right):left(left),right(right){}
	range(){};
};

bool is_connect(range a,range b){
	if(a.right<=b.left || b.right<=a.left) return false;
	return true;
}


int main()
{
	int n;
	while(cin>> n && n!=0){
		vector<range> V(n);
		for(int i=0;i<n;i++){
			string s,t;cin>>s>>t;
			V[i].left=convert(s);
			V[i].right=convert(t);
		}

		int ans[24*3600+60*60+60+1];
		memset(ans,0,sizeof(ans));
		for(int i=0;i<n;i++){
			for(int k=V[i].left;k<V[i].right;k++){
				ans[k]++;
			}
		}

		int res=0;
		for(int i=0;i<=24*3600+60*60+60;i++){
			res=max(res,ans[i]);
		}
		cout<<res<<endl;



	}
	return 0;
}

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

#include<complex>
#include<iostream>
#include<iomanip>
#include<cmath>
#include<vector>
#include<map>
#include<ctime>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cassert>
#include<deque>
#include<queue>
#include<climits>
#include<list>
#include<stack>
#include<ctime>
#define all(n) n.begin(),n.end()
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define insert(a,b,c,d) PP(P(a,b),P(c,d))
#define F first
#define S second
#define pb push_back
#define INF (1<<27)
#define EPS 1e-10
#define equals(a,b) (fabs((a)-(b)) < EPS)
#define MAX_N 1001000
using namespace std;
typedef pair<int,int> P;
typedef pair<P,int> Pp;
typedef pair<P,P> PP;
typedef unsigned long long ull;
typedef long long ll;
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};

int get_time(string s){
  for(int i=0;i<s.length();i++)if(s[i] == ':')s[i] = ' ';
  stringstream ss;
  ss << s;
  int three[3];
  ss >> three[0] >> three[1] >> three[2];
 
  int sum = 0;
  sum += three[0]*60*60 + three[1]*60 + three[2];
  return sum;
}

bool cmp(const P &p,const P &q){
  if(p.F != q.F)return p.F < q.F;
  return p.F < q.S;
}

template <class T>
class RMQ_segment{
private:
  int n;
  T dat[2*MAX_N-1];
public:
  void init(int n_){
    n = 1;
    while(n<n_)n*=2;
    for(int i=0;i<2*n-1;i++)dat[i] = 0;
  }

  void update(int k,T a){
    k += n-1;
    dat[k] = a;
    while(k > 0){
      k = (k-1)/2;
      dat[k] = max(dat[k*2+1],dat[k*2+2]);
    }
  }

  T _query(int a,int b,int k,int l,int r){
    if(r<=a || b<=l)return 0;
    else if(a<=l && r<=b)return dat[k];

    T vl = _query(a,b,k*2+1,l,(l+r)/2);
    T vr = _query(a,b,k*2+2,(l+r)/2,r);
    return max(vl,vr);
  }

  T query(int a,int b){
    return _query(a,b,0,0,n);
  }
};


int main(){
  int n;
  //clock_t start,end;
  //start = clock(); 
  
  while(cin >> n && n){  
    vector<P> vec;
    vector<P> sor;
    rep(i,n){
      string st,ed;
      cin >> st >> ed;
      vec.pb(P(get_time(st),get_time(ed)));
      sor.pb(P(get_time(ed)-get_time(st),i));
    }
    sort(all(sor),cmp);
    //cout<< "---------" << endl;
    //rep(i,n)cout<< vec[i].F << " " << vec[i].S << endl;
    //cout << "--------" << endl;
    RMQ_segment<int> rmq;
    rmq.init(get_time("24:00:01"));
   
    rep(i,n){
      int index = sor[i].S;
      int res = rmq.query(vec[index].F,vec[index].S);
      rmq.update(vec[index].S-1,res+1);
    }
    cout << rmq.query(0,get_time("24:00:01")) << endl;
  }
  //end = clock();
  //cout << setiosflags(ios::fixed) << setprecision(10) << (double)(end-start)/CLOCKS_PER_SEC << endl;
return 0;
}



/*
Way to check the time of processing speed

clock_t start,end;
start = clock();

------function-------

end = clock();
cout << setiosflags(ios::fixed) << setprecision(10) << (double)(end-start)/CLOCKS_PER_SEC << endl;


*/

Compiler output:
a.cc: In function 'int main()':
a.cc:105:5: error: 'sort' was not declared in this scope; did you mean 'sor'?
  105 |     sort(all(sor),cmp);
      |     ^~~~
      |     sor
Language: C++

#include <sstream>
#include <iomanip>
using namespace std;

typedef ostringstream oss;
typedef istringstream iss;

typedef vector<int> vi;
typedef vector< vi > vvi;

typedef long L;
typedef long long LL;

const int SECOND_OF_DAY = 24 * 60 * 60;

LL toSecond(int h, int m, int s) {
	return (LL)h * 60 * 60 + (LL)m * 60 + (LL)s;
}

int main(void) {
	int N;
	while (cin >> N, N) {
		vi time(SECOND_OF_DAY, 0);

		for (int i = 0; i < N; i++) {
			int h, m, s;
			char buf;
			cin >> h >> buf >> m >> buf >> s;
			LL start = toSecond(h, m, s);
			cin >> h >> buf >> m >> buf >> s;
			LL end = toSecond(h, m, s);

			for (LL i = start; i < end; i++) {
				time[i]++;
			}
		}

		cout << *(max_element(time.begin(), time.end())) << endl;
	}

	return 0;
}

Compiler output:
a.cc:8:9: error: 'vector' does not name a type
    8 | typedef vector<int> vi;
      |         ^~~~~~
a.cc:9:9: error: 'vector' does not name a type
    9 | typedef vector< vi > vvi;
      |         ^~~~~~
a.cc: In function 'int main()':
a.cc:22:16: error: 'cin' was not declared in this scope
   22 |         while (cin >> N, N) {
      |                ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include <iomanip>
  +++ |+#include <iostream>
    3 | using namespace std;
a.cc:23:17: error: 'vi' was not declared in this scope
   23 |                 vi time(SECOND_OF_DAY, 0);
      |                 ^~
a.cc:34:39: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   34 |                                 time[i]++;
      |                                       ^
a.cc:34:39: warning: ISO C++ forbids incrementing a pointer of type 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} [-Wpointer-arith]
   34 |                                 time[i]++;
      |                                 ~~~~~~^
a.cc:34:39: error: lvalue required as increment operand
   34 |                                 time[i]++;
      |                                       ^
a.cc:38:17: error: 'cout' was not declared in this scope
   38 |                 cout << *(max_element(time.begin(), time.end())) << endl;
      |                 ^~~~
a.cc:38:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:38:44: error: request for member 'begin' in 'time', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
   38 |                 cout << *(max_element(time.begin(), time.end())) << endl;
      |                                            ^~~~~
a.cc:38:58: error: request for member 'end' in 'time', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
   38 |                 cout << *(max_element(time.begin(), time.end())) << endl;
      |                                                          ^~~
a.cc:38:27: error: 'max_element' was not declared in this scope
   38 |                 cout << *(max_element(time.begin(), time.end())) << endl;
      |                           ^~~~~~~~~~~
Language: C++

#include<iostream>
#include<vector>
#include<utility>
using namespace std;
typedef struct Time{
  int h;
  int m;
  int s;
}Time;
typedef pair<int,int> pii;
int main(){
  int n;
  Time s[10000],e[10000];
  vector<pii>::iterator ite;
  vector<pii> train; 
  while(cin>>n,n){
    train.clear();
    int ans=0,sum=0;
    for(int i = 0;i < n;i++){
      scanf("%d:%d:%d %d:%d:%d",&s[i].h,&s[i].m,&s[i].s,&e[i].h,&e[i].m,&e[i].s);
      train.push_back(pii(s[i].h*3600 + s[i].m*60 + s[i].s,1)); 
      train.push_back(pii(e[i].h*3600 + e[i].m*60 + e[i].s,0));
    }
    sort(train.begin(),train.end());
    ite = train.begin();
    while(ite != train.end()){
      if(ite->second == 1){
	sum++;
	ans=max(ans,sum);
      }else{
	sum--;
      }
      ite++;
    }
    cout<<ans<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   24 |     sort(train.begin(),train.end());
      |     ^~~~
      |     short
Language: C++

#include<iostream>
#include<vector>
#include<utility>
using namespace std;
typedef struct Time{
  int h;
  int m;
  int s;
}Time;
typedef pair<int,int> pii;
int main(){
  int n;
  Time s[10000],e[10000];
  vector<pii>::iterator ite;
  vector<pii> train; 
  while(cin>>n,n){
    train.clear();
    int ans=0,sum=0,i = 0;
    for(i = 0;i < n;i++){
      scanf("%d:%d:%d %d:%d:%d",&s[i].h,&s[i].m,&s[i].s,&e[i].h,&e[i].m,&e[i].s);
      train.push_back(pii(s[i].h*3600 + s[i].m*60 + s[i].s,1)); 
      train.push_back(pii(e[i].h*3600 + e[i].m*60 + e[i].s,0));
    }
    sort(train.begin(),train.end());
    ite = train.begin();
    while(ite != train.end()){
      if(ite->second == 1){
	sum++;
	ans=max(ans,sum);
      }else{
	sum--;
      }
      ite++;
    }
    cout<<ans<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   24 |     sort(train.begin(),train.end());
      |     ^~~~
      |     short
Language: C++

#include<iostream>
#include<vector>
#include<utility>
#include<cstdio>
using namespace std;
typedef struct Time{
  int h;
  int m;
  int s;
}Time;
typedef pair<int,int> pii;
int main(){
  int n;
  Time s[10000],e[10000];
  vector<pii>::iterator ite;
  vector<pii> train; 
  while(cin>>n,n){
    train.clear();
    int ans=0,sum=0,i = 0;
    for(i = 0;i < n;i++){
      scanf("%d:%d:%d %d:%d:%d",&s[i].h,&s[i].m,&s[i].s,&e[i].h,&e[i].m,&e[i].s);
      train.push_back(pii(s[i].h*3600 + s[i].m*60 + s[i].s,1)); 
      train.push_back(pii(e[i].h*3600 + e[i].m*60 + e[i].s,0));
    }
    sort(train.begin(),train.end());
    ite = train.begin();
    while(ite != train.end()){
      if(ite->second == 1){
	sum++;
	ans=max(ans,sum);
      }else{
	sum--;
      }
      ite++;
    }
    cout<<ans<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   25 |     sort(train.begin(),train.end());
      |     ^~~~
      |     short
Language: Java



import java.util.Scanner;

public class Main{
	int nx;
	int ny;
	int[] dx = {0,-1,0,1};
	int[] dy = {1,0,-1,0};
	char[][] map;
	boolean flagW ;
	boolean flagB ;
	int res = 0;


	void dfs(int y, int x){
		int sx;
		int sy;
		map[y][x] = 'X';

		for(int i=0; i<4; i++){
			sy = y + dy[i];
			sx = x + dx[i];
			if(sx < 0 || sy <0 || sx >= nx || sy >= ny) continue;

			if(map[sy][sx] == '.'){
				res++;
				dfs(sy,sx);
			}
			else if(map[sy][sx] == 'W')
				flagW = true;

			else if(map[sy][sx] == 'B')
				flagB = true;
		}

	}


	void run(){
		Scanner sc = new Scanner(System.in);


		while (sc.hasNext()) {
			nx = sc.nextInt();
			ny = sc.nextInt();
			String p = sc.nextLine();

			int cntW = 0;
			int cntB = 0;
			map = new char[ny][];


			for (int i = 0; i < ny; i++) {
				String s = sc.nextLine();
				map[i] = s.toCharArray();
			}



			for (int i = 0; i < ny; i++) {
				for (int j = 0; j < nx; j++) {
					if (map[i][j] != '.')
						continue;

					flagW = false;
					flagB = false;
					res = 1;

					dfs(i, j);

					if (flagW && !flagB)
						cntW += res;
					if (flagB && !flagW)
						cntB += res;

				}
			}

			System.out.println(cntB + " " + cntW);
		}

	}

	public static void main(String[] args) {
		new A3().run();
	}

}

Compiler output:
Main.java:86: error: cannot find symbol
		new A3().run();
		    ^
  symbol:   class A3
  location: class Main
1 error
Language: Java

import java.util.*;

public class Main {

	int w, h, count, cb, cw;
	int[][] map;
	boolean black, white;
	
	public void func(){
		for(int i=0;i<h;i++){
			for(int j=0;j<w;j++){
				if(map[i][j]==0){
					count = 0;
					black = true;
					white = true;
					loop(i, j);
					if(black==false && white==true){
						cb += count;
					}else if(black==true && white==false){
						cw += count;
					}
				}
			}
		}
		System.out.println(cb + " " + cw);
	}
	
	public void loop(int y, int x){
		if(map[y][x]==8){
			black = false;
		}else if(map[y][x]==9){
			white = false;
		}else if(map[y][x]==0){
			map[y][x] = 1;
			count++;
			if(y!=0) loop(y-1,x);
			if(x!=0) loop(y,x-1);
			if(y!=h-1) loop(y+1,x);
			if(x!=w-1) loop(y,x+1);
		}
	}
	
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		while(true){
			AOJ_2014 A = new AOJ_2014();
			A.w = sc.nextInt();
			A.h = sc.nextInt();
			if(A.w==0 && A.h==0)break;
			A.map = new int[A.h][A.w];
			String s = "";
			for(int i=0;i<A.h;i++){
				s = sc.next();
				for(int j=0;j<A.w;j++){
					if(s.codePointAt(j)==66) A.map[i][j]=8;
					else if(s.codePointAt(j)==87) A.map[i][j]=9;
				}
			}
			A.func();
			
		}
	}	
}

Compiler output:
Main.java:48: error: cannot find symbol
			AOJ_2014 A = new AOJ_2014();
			^
  symbol:   class AOJ_2014
  location: class Main
Main.java:48: error: cannot find symbol
			AOJ_2014 A = new AOJ_2014();
			                 ^
  symbol:   class AOJ_2014
  location: class Main
2 errors
Language: C

#include <stdio.h>

char map[50][50]; //map[h][w]
int w,h;

void scanmap(){
	int i;
	for(i=0;i<h;i++){
		scanf("%s",map[i]);
	}
}

void wpaint(int a,int b){
	if(a>0 && map[a-1][b] == '.'){
		map[a-1][b] = 'w';
		wpaint(a-1,b);
	}
	if(b>0 && map[a][b-1] == '.'){
		map[a][b-1] = 'w';
		wpaint(a,b-1);
	}
	if(a<h && map[a+1][b] == '.'){
		map[a+1][b] = 'w';
		wpaint(a+1,b);
	}
	if(b<w && map[a][b+1] == '.'){
		map[a][b+1] = 'w';
		wpaint(a,b+1);
	}
}

void bpaint(int a,int b){
	if(a>0){
		if(map[a-1][b] == '.'){
			map[a-1][b] = 'b';
			bpaint(a-1,b);
		}else if(map[a-1][b] == 'w'){
			map[a-1][b] = 'g';
			bpaint(a-1,b);
		}
	}
	if(b>0){
		if(map[a][b-1] == '.'){
			map[a][b-1] = 'b';
			bpaint(a,b-1);
		}else if(map[a][b-1] == 'w'){
			map[a][b-1] = 'g';
			bpaint(a,b-1);
		}
	}
	if(a<h){
		if(map[a+1][b] == '.'){
			map[a+1][b] = 'b';
			bpaint(a+1,b);
		}else if(map[a+1][b] == 'w'){
			map[a+1][b] = 'g';
			bpaint(a+1,b);
		}
	}
	if(b<w){
		if(map[a][b+1] == '.'){
			map[a][b+1] = 'b';
			bpaint(a,b+1);
		}else if(map[a][b+1] == 'w'){
			map[a][b+1] = 'g';
			bpaint(a,b+1);
		}
	}
}

int bcount(){
	int i,j;
	int count = 0;
	for(i=0;i<h;i++){
		for(j=0;j<w;j++){
			if(map[i][j] == 'b') count++;
		}
	}
	return count;
}

int wcount(){
	int i,j;
	int count = 0;
	for(i=0;i<h;i++){
		for(j=0;j<w;j++){
			if(map[i][j] == 'w') count++;
		}
	}
	return count;
}

void printmap(){
	int i;
	for(i=0;i<h;i++){
		printf("%s\n",map[i]);
	}
}

void area(){
	scanmap();
	int i,j;
	for(i=0;i<h;i++){
		for(j=0;j<w;j++){
			if(map[i][j] == 'W') wpaint(i,j);
		}
	}
	for(i=0;i<h;i++){
		for(j=0;j<w;j++){
			if(map[i][j] == 'B') bpaint(i,j);
		}
	}
	printf("%d %d\n",bcount(),wcount());
//	printmap();
}

int main(){
	while(1){
		scanf("%d %d",&w,&h);
		if(w == 0 && b == 0) break;
		area();
	}
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:120:30: error: 'b' undeclared (first use in this function)
  120 |                 if(w == 0 && b == 0) break;
      |                              ^
main.c:120:30: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <cstdio>
#include <iostream>
#include <string>
using namespace std;
int a[51][51],w,h,c;
bool f;

void visit(int i,int j,int bw){
  a[i][j] = 3;
  c++;
  int di[4] = {1,0,-1,0};
  int dj[4] = {0,1,0,-1};
  for(int t=0;t<4;t++){
    int vi = i + di[t];
    int vj = j + dj[t];
    if(bw == 1){
      if(a[vi][vj] == 2){
	f = false;
      }
      else if(vi >= 0 && vj >= 0 && vi < w && vj < h && !a[vi][vj]){
	visit(vi,vj,1);
      }
    }
    else if(bw == 2){
      if(a[vi][vj] == 1){
	f = false;
      }
      else if(vi >= 0 && vj >= 0 && vi < w && vj < h && !a[vi][vj]){
	visit(vi,vj,2);
      }
    }
  }
}

int main(){
  int i,j,b,wh;
  char str;
  while(1){
    cin >> w >> h;
    if(w == 0 && h == 0) break;
    for(i=0;i<=h;i++){
      for(j=0;j<=w;j++){
	if(i == h || j == w) a[j][i] = 3;
	else{
	  cin >> str;
	  if(str == 'B') a[j][i] = 1;
	  else if(str == 'W') a[j][i] = 2;
	  else a[j][i] = 0;
	}
      }
    }

    b = wh = 0;
    int di[4] = {1,0,-1,0};
    int dj[4] = {0,1,0,-1};
    for(j=0;j<h;j++){
      for(i=0;i<w;i++){
	if(a[i][j] == 1 || a[i][j] == 2){
	  for(int t=0;t<4;t++){
	    int vi = i + di[t];
	    int vj = j + dj[t];
	    if(a[i][j] == 1 && vi >= 0 && vj >= 0 && vi < w && vj < h && !a[vi][vj]){
	      c = 0;
	      f = true;
	      visit(vi,vj,1);
	      if(f) b += c;
	    }
	    else if(a[i][j] == 2 && vi >= 0 && vj >= 0 && vi < w && vj < h && !a[vi][vj]){
	      c = 0;
	      f = true;
	      visit(vi,vj,2);
	      if(f) wh += c;
	    }
	  }
	}
      }
    }
    cout << b <<" " << wh << endl;   
  }
  return 0;
}

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

#include<bits/stdc++.h>
using namespace std;

typedef pair<int,int> P;

int dxy[4] = {-1, 1, 0, 0};
int W, H;
char a[60][60];
int temp[4][60][60];

void huga(int y, int x, int Z){//cout<<y<<" "<<x<<endl;
	int w = 0, b = 0, s = 0, ans=-3, t;
	queue <P> Q;
	
	Q.push(P(y,x));
	
	while(!Q.empty()){
		P p = Q.front();Q.pop();
		int yy = p.first, xx = p.second;//cout<<yy<<" "<<xx<<endl;
		for(int i = 0; i <= 3; i++){
			int nx = xx+dxy[i], ny = yy+dxy[3-i];//cout<<" "<<ny<<" "<<nx<<endl;
			if(a[ny][nx] == '.' && !temp[Z+2][ny][nx]) {
				temp[Z+2][ny][nx] = temp[Z][ny][nx] = 1;
				Q.push(P(ny,nx));
				//cout<<temp[2][ny][nx]<<" "<<temp[Z][ny][nx]<<" AA"<<endl;
			}
			//int fds; cin>>fds;
		}
	}
}

int main(){
	
	while(1){
		int cw=0, cb=0;
		cin>>W>>H;
		
		if(!W&&!H)break;
		
		for(int i = 0; i <= H+1; i++)
			for(int j = 0; j <= W+1; j++)
				temp[0][i][j] = temp[1][i][j] = temp[2][i][j] = temp[3][i][j] = s0;
				
		for(int i = 0; i < 60; i++){
			a[0][i] = a[H+1][i] = 0;
			a[i][0] = a[i][W+1] = 0;
		}
			
		for(int i = 1; i <= H; i++)
			for(int j = 1; j <= W; j++)
				cin>>a[i][j];
		
		for(int i = 1; i <= H; i++){
			for(int j = 1; j <= W; j++){
				//if(temp[2][i][j])continue;
				if(a[i][j] == 'B') huga(i,j,0);
				else if(a[i][j] == 'W') huga(i,j,1);
			}
		}
		
		for(int i = 1; i <= H; i++){
			for(int j = 1; j <= W; j++){
				if(a[i][j] == '.'){
					if(temp[0][i][j] && !temp[1][i][j])cb++;
					else if(!temp[0][i][j] && temp[1][i][j])cw++;
				}
			}
		}
		
		cout<<cb<<" "<<cw<<endl;
	}
	
	
	
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:42:97: error: 's0' was not declared in this scope; did you mean 'y0'?
   42 |                                 temp[0][i][j] = temp[1][i][j] = temp[2][i][j] = temp[3][i][j] = s0;
      |                                                                                                 ^~
      |                                                                                                 y0
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;
int w,h;
char tbl[60][60];
bool f[2][60][60];
int dx[] = {0,1,0,-1};
int dy[] = {1,0,-1,0};
void dfs(int x,int y,int c){
  f[c][y][x]=true;
  for(int i=0;i<4;++i){
    int mx = x+dx[i];
    int my = y+dy[i];
    if(mx<0 || my<0) continue;
    if(mx>=w || my>=h) continue;
    if(f[c][my][mx]) continue;
    if(tbl[my][mx]!='.') continue;
    dfs(mx,my,c);
  }
}

int main(){
  while(cin>>w>>h,w||h){
    memset(f,0,sizeof(f));
    for(int i=0;i<h;++i) cin >> tbl[i];
    for(int i=0;i<h;++i)
      for(int j=0;j<w;++j){
	if(tbl[i][j]=='B'){
	  dfs(j,i,0);
	}
	if(tbl[i][j]=='W'){
	  dfs(j,i,1);
	}
      }
    int B=0,W=0;
    for(int i=0;i<h;++i)
      for(int j=0;j<w;++j){
	if(tbl[i][j]=='.' && f[0][i][j] && !f[1][i][j]) ++B;
	if(tbl[i][j]=='.' && f[1][i][j] && !f[0][i][j]) ++W;
      }
    cout << B << " " << W << endl;
  }
  return 0;
}

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

#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <sstream>
#include <iomanip>
#include <complex>
using namespace std;

#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
#define pi 3.14159265359
#define shosu(X) fixed << setprecision(X)
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int h,w;
char grid[51][51];
bool iswhite[51][51];
bool isblack[51][51];
int dx[4] = {-1,0,1,0};
int dy[4] = {0,-1,0,1};

int dfs(int px, int py,char c){
	int res = 1;
	REP(i,4){
		int nx = px + dx[i]; 
		int ny = py + dy[i];
		if(nx < 0 || ny <0 || nx > h-1 || ny > w-1) continue;
		if(grid[nx][ny] == c) return true;
		else return dfs(nx,ny);
	}
	return false;
}
int main(){
	while(1){
		cin >> w >> h;
		if(w==0&&h==0) break;
		REP(i,h) REP(j,w) cin >> grid[i][j];
		REP(i,h) REP(j,w) iswhite[i][j] = dfs(i,j,'W');
		REP(i,h) REP(j,w) isblack[i][j] = dfs(i,j,'B');
		int white = 0; int black = 0;
		REP(i,h) REP(j,w){
			if(iswhite[i][j] == true && isblack[i][j] == false) white++;
			else is(iswhite[i][j] == false && isblack[i][j] == true) black++;
		}
		cout << white << " " << black << endl;
	}
}

Compiler output:
a.cc: In function 'int dfs(int, int, char)':
a.cc:42:32: error: too few arguments to function 'int dfs(int, int, char)'
   42 |                 else return dfs(nx,ny);
      |                             ~~~^~~~~~~
a.cc:35:5: note: declared here
   35 | int dfs(int px, int py,char c){
      |     ^~~
a.cc: In function 'int main()':
a.cc:56:30: error: 'is' was not declared in this scope; did you mean 'i'?
   56 |                         else is(iswhite[i][j] == false && isblack[i][j] == true) black++;
      |                              ^~
      |                              i
Language: C++

#include <iostream>
using namespace std;
int w,h,c1,c2,b,d;
char a[51][51];
int dfs(int i,int j){
  if(i==h||j==w||i<0||j<0||a[i][j]=='#')return 0;
  if(a[i][j]=='W'){d++;return 0;}
  else if(a[i][j]=='B'){b++;return 0;}
  int s=1;
  a[i][j]='#';
  s+=dfs(i+1,j);
  s+=dfs(i-1,j);
  s+=dfs(i,j+1);
  s+=dfs(i,j-1);
  return s;
}
int main(){
  int i,j,ans;
  while(cin>>w>>h,w&&h){
    c1=c2=0;
    for(i=0;i<h;i++)scanf("%c"&a[i]);
    for(i=0;i<h;i++)for(j=0;j<w;j++)if(a[i][j]=='.'){
      d=b=0;
      ans=dfs(i,j);
      if(b&&d)continue;
      else if(b>d)c1+=ans;
      else if(b<d)c2+=ans;
    }
    cout<<c1<<" "<<c2<<endl;
}}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:31: error: invalid operands of types 'const char [3]' and 'char [51]' to binary 'operator&'
   21 |     for(i=0;i<h;i++)scanf("%c"&a[i]);
      |                           ~~~~^~~~~
      |                           |       |
      |                           |       char [51]
      |                           const char [3]
Language: C++

#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <algorithm>

#define CH(N,A,B) (A<=N&&N<B)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define RREP(i,a,b) for(int i=(b-1);a<=i;i--)

using namespace std;

int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};

int w, h;
int grand[55][55];
string s[55];
bool flag[55][55];

void dfs(int y, int x){
  if(s[y][x] != '.' || !flag[y][x]) return;
  flag[y][x] = false;
  for(int k=0; k<4; k++){
    if(!CH(x + dx[k],0,w) || !CH(y + dy[k],0,h)) continue;
    if(s[y + dy[k]][x + dx[k]] != '.') continue;
    if(grand[y + dy[k]][x + dx[k]] != 3) grand[y + dy[k]][x + dx[k]] = grand[y][x];
  }
  for(int k=0; k<4; k++){
    if(!CH(x + dx[k],0,w) || !CH(y + dy[k],0,h)) continue;
    if(s[y + dy[k]][x + dx[k]] != '.') continue;
    dfs(y + dy[k], x + dx[k]);
  }
}

int main() {

  while(1){
    cin>>w>>h;
    if(w==0 && h==0) break;
    for(int i=0; i<h; i++){
      cin>>s[i];
    }
    memset(grand, 0, sizeof(grand));

    for(int i=0; i<h; i++){
      for(int j=0; j<w; j++){
        if(s[i][j] == '.'){
          for(int k = 0; k<4; k++){
            if(!CH(j + dx[k],0,w) || !CH(i + dy[k],0,h)) continue;
            int posx = j + dx[k], posy = i + dy[k];
            while(1){
              if(!CH(posx,0,w) || !CH(posy,0,h)){
                break;
              }else if(s[posy][posx] == 'W'){
                int tx = posx - dx[k], ty = posy - dy[k];
                while(1){
                  if(grand[ty][tx] == 0 || grand[ty][tx] == 1) grand[ty][tx] = 1;
                  else grand[ty][tx] = 3;
                  if(tx == j && ty == i ) break;
                  tx -= dx[k];
                  ty -= dy[k];
                }
                break;
              }else if(s[posy][posx] == 'B'){
                int tx = posx - dx[k], ty = posy - dy[k];
                while(1){
                  if(grand[ty][tx] == 0 || grand[ty][tx] == 2) grand[ty][tx] = 2;
                  else grand[ty][tx] = 3;
                  if(tx == j && ty == i ) break;
                  tx -= dx[k];
                  ty -= dy[k];
                }
                break;
              }
              posx += dx[k];
              posy += dy[k];
            }
          }
        }
      }
    }

    for(int i=0; i<h; i++){
      for(int j=0; j<w; j++){
        memset(flag, true, sizeof(flag));
        dfs(i, j);
      }
    }

    int wcnt=0, bcnt=0;
    for(int i=0; i<h; i++){
      for(int j=0; j<w; j++){
        if(grand[i][j] == 1) wcnt++;
        if(grand[i][j] == 2) bcnt++;
      }
    }

    cout<<bcnt<<" "<<wcnt<<endl;

  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:47:5: error: 'memset' was not declared in this scope
   47 |     memset(grand, 0, sizeof(grand));
      |     ^~~~~~
a.cc:9:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    8 | #include <algorithm>
  +++ |+#include <cstring>
    9 |
Language: C++

#include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
#include<string>
#include<string.h>
#include<functional>
using namespace std;

#define INF 1<<21
#define DIV 1000000007

typedef pair<int, int>P;


int w, h;
int cnt;
char f[51][51];
int dx[] = { 1,-1,0,0 }, dy[] = { 0,0,1,-1 };

void rec(int x, int y, char c) {
  for (int i = 0; i < 4; i++) {
	int nx = x + dx[i];
	int ny = y + dy[i];
	if (nx <= 0 || w < nx || ny <= 0 || h < ny )continue;

	if (c == 'B') {
	  if (f[ny][nx] == 'w') {
		f[ny][nx] = 'u';
		rec(nx, ny, c);
	  }
	  else if (f[ny][nx] == '.') {
		f[ny][nx] = 'b';
		rec(nx, ny, c);
	  }
	}
	else if (c == 'W') {
	  if (f[ny][nx] == 'b') {
		f[ny][nx] = 'u';
		rec(nx, ny, c);
	  }
	  else if (f[ny][nx] == '.') {
		f[ny][nx] = 'w';
		rec(nx, ny, c);
	  }
	}
  }
}

int main(){
  while (cin >> w >> h, (w || h)) {
	memset(f, 0, sizeof(f));
	for (int y = 1; y <= h; y++) {
	  for (int x = 1; x <= w; x++) {
		cin >> f[y][x];
		}
	  }
	}

	for (int y = 1; y <= h; y++) {
	  for (int x = 1; x <= w; x++) {
		if (f[y][x] == 'W' || f[y][x] == 'B') {
		  rec(x, y, f[y][x]);
		}
	  }
	}


	int blacks = 0, whites = 0;
	for (int y = 1; y<=h; y++) {
	  for (int x = 1; x<=w; x++) {
		cout << f[y][x] << "";
		if (f[y][x] == 'b') {
		  blacks++;
		}
		else if (f[y][x] == 'w') {
		  whites++;
		}
	  }
	  cout << endl;
	}
	cout << blacks << " " << whites << endl;
  }
  return 0;
}

Compiler output:
a.cc:84:3: error: expected unqualified-id before 'return'
   84 |   return 0;
      |   ^~~~~~
a.cc:85:1: error: expected declaration before '}' token
   85 | }
      | ^
Language: C++

#include <iostream>
#include <map>
using namespace std;

int w, h;
char mas[50][50];
int vb[50][50], vw[50][50];

map< char, int > c;

static int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};

void rec(int y, int x, int color) {
    if(!(0 <= x && x < w && 0 <= y && y < h)) return;
    if(color != c[mas[y][x]] && mas[y][x] != '.') return;
    if((!color && vb[y][x]) || (color && vw[y][x])) return;
    if(color) vw[y][x] = 1;
    else vb[y][x] = 1;

    for(int i = 0; i < 4; i++) {
        rec(y + dy[i], x + dx[i], color);
    }
}

int main() {

    c['B'] = 0, c['W'] = 1, c['.'] = -1;

    while(cin >> w >> h, w) {
        memset(vb, 0, sizeof(vb));
        memset(vw, 0, sizeof(vw));
        for(int i = 0; i < h; i++) {
            for(int j = 0; j < w; j++) {
                cin >> mas[i][j];
            }
        }

        for(int i = 0; i < h; i++) {
            for(int j = 0; j < w; j++) {
                if(mas[i][j] == 'B' && !vb[i][j]) rec(i, j, 0);
                if(mas[i][j] == 'W' && !vw[i][j]) rec(i, j, 1);
            }
        }

        int sumb = 0, sumw = 0;
        for(int i = 0; i < h; i++) {
            for(int j = 0; j < w; j++) {
                if(vb[i][j] ^ vw[i][j] && mas[i][j] == '.') {
                    if(vb[i][j]) sumb++;
                    else sumw++;
                }
            }
        }

        cout << sumb << " " << sumw << endl;
    }
}



Compiler output:
a.cc: In function 'int main()':
a.cc:30:9: error: 'memset' was not declared in this scope
   30 |         memset(vb, 0, sizeof(vb));
      |         ^~~~~~
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 | using namespace std;
Language: C++

#include <iostream>
#include <cstdio>
#include <queue>

using namespace std;

char field[52][52];
bool black[52][52];
bool white[52][52];

typedef pair<int, int> p;

int t_x[] = {1, 0, -1, 0};
int t_y[] = {0, 1, 0, -1};

void search(int h, int w)
{
  char c = field[h][w];
  queue<p> que;
  que.push( p(h, w) );
  while ( !que.empty() ) {
    p n_c = que.front();
    //cout << n_c.first << " " << n_c.second << endl;
    que.pop(); 

    for ( int i = 0; i < 4; i++ ) {
      int t_h = n_c.first + t_x[i];
      int t_w = n_c.second + t_y[i];
      if ( field[t_h][t_w] == '#' ) continue;
      if ( field[t_h][t_w] == c || field[t_h][t_w] == '.' ) {
	if ( c == 'W') { 
	  if(!white[t_h][t_w]) {
	    white[t_h][t_w] = true;
	  } else {
	    continue;
	  }
	}
 	if (c == 'B') {
	  if (!black[t_h][t_w]) {
	    black[t_h][t_w] = true;
	  } else {
	    continue;
	  }
	}
	que.push( p(t_h, t_w) );
      }
    }
  }
}


int main()
{
  while ( true ) {
    int width, height;
    cin >> width >> height;

    if ( width == 0 && height == 0 ) break;

    memset(field, '#', sizeof field);
    memset(black, false, sizeof black);
    memset(white, false, sizeof white);

    for ( int i = 1; i <= height; i++ ) {
      for ( int j = 1; j <= width; j++ ) {
	cin >> field[i][j];
      }
    }
    
    for ( int i = 1; i <= height; i++ ) {
      for ( int j = 1; j <= width; j++ ) {
	if ( field[i][j] == 'W' && !white[i][j] || field[i][j] == 'B' && !black[i][j]) {
	  search(i, j);
	}
      }
    }
    for (int i = 1; i <= height; i++) {
      for (int j = 1; j <= width; j++) {
	//cout << ((black[i][j]) ? "B" : ".");
      }
      //cout << endl;
    }
    for (int i = 1; i <= height; i++) {
      for (int j = 1; j <= width; j++) {
	//cout << ((white[i][j]) ? "W" : ".");
      }
      //cout << endl;
    }
    int b_counter = 0, w_counter = 0;
    for (int i = 1; i <= height; i++) {
      for (int j = 1; j <= width; j++) {
	if (field[i][j] != '.') continue;
	if (!black[i][j] && white[i][j]) w_counter++;
	if (black[i][j] && !white[i][j]) b_counter++;
      }
    }
    cout << b_counter << " " << w_counter << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:60:5: error: 'memset' was not declared in this scope
   60 |     memset(field, '#', sizeof field);
      |     ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <queue>
  +++ |+#include <cstring>
    4 |
Language: C++

#include<iostream>
#include<cstdio>

using namespace std;

char d[50][60];
bool w[50][50];
bool b[50][50];

int ww,hh;
const int dx[4] = {1,-1,0,0};
const int dy[4] = {0,0,1,-1};

#define REP(i,n) for(int i = 0; i<(n); i++)

void dfsw(int y, int x){
  w[y][x] == true;
  REP(i,4){
    int xx = x + dx[i];
    int yy = y + dy[i];
    if(xx < 0 || yy < 0) continue;
    if(xx >=ww || yy >=hh) continue;
    if(d[yy][xx] != 'B' && !w[yy][xx]){
      w[yy][xx] = true;
      dfsw(yy,xx);
    }
  }
}
void dfsb(int y, int x){
  b[y][x] == true;
  REP(i,4){
    int xx = x + dx[i];
    int yy = y + dy[i];
    if(xx < 0 || yy < 0) continue;
    if(xx >=ww || yy >=hh) continue;
    if(d[yy][xx] != 'W' && !b[yy][xx]){
      b[yy][xx] = true;
      dfsb(yy,xx);
    }
  }
}

int main(){
  while(scanf("%d%d",&ww,&hh),ww+hh){
    memset(w,0,sizeof(w));
    memset(b,0,sizeof(b));
    REP(i,hh) scanf("%s",d[i]);
    REP(i,hh) REP(j,ww){
      if(d[i][j] == 'W' && !w[i][j])
	dfsw(i,j);
      if(d[i][j] == 'B' && !b[i][j])
	dfsb(i,j);
    }
    int a1 = 0, a2 = 0;
    //REP(i,hh){ REP(j,ww) putchar(w[i][j]?'w':'.'); puts("");}
    //REP(i,hh){ REP(j,ww) putchar(b[i][j]?'b':'.'); puts("");}
    REP(i,hh) REP(j,ww){
      if(d[i][j]=='.' && w[i][j] && !b[i][j]) a2++;
      if(d[i][j]=='.' && !w[i][j] && b[i][j]) a1++;
    }
    printf("%d %d\n",a1,a2);
  }
}

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

#include <string>
#include <cstring>
#include <cstdio>
#include <vector>
using namespace std;

typedef vector<pair<int,int> >vpii;
char m[99][99];

char dfs(int i, int j, vpii&v){
	if(m[i][j]=='B')return 1;
	if(m[i][j]=='W')return 2;
	if(m[i][j]=='X')return 0;
	int ret=0;
	v.push_back(make_pair(i,j));
	if(find(v.begin(),v.end(),make_pair(i-1,j))==v.end())ret|=dfs(i-1,j,v);
	if(find(v.begin(),v.end(),make_pair(i+1,j))==v.end())ret|=dfs(i+1,j,v);
	if(find(v.begin(),v.end(),make_pair(i,j-1))==v.end())ret|=dfs(i,j-1,v);
	if(find(v.begin(),v.end(),make_pair(i,j+1))==v.end())ret|=dfs(i,j+1,v);
	return ret;
}

main(){
	int w,h,i,j,k,r,s;
	for(;scanf("%d%d",&w,&h),w;printf("%d %d\n",r,s)){
		for(memset(m,'X',sizeof(m)),r=s=0,i=1;i<=h;i++)scanf("%s",m[i]+1),m[i][w+1]='X';
		for(i=1;i<=h;i++)for(j=1;j<=w;j++)if(m[i][j]=='.'){
			vpii v;
			char x=dfs(i,j,v);
			for(k=0;k<v.size();k++)
				m[v[k].first][v[k].second]=x;
		}
		for(i=1;i<=h;i++)for(j=1;j<=w;j++)
			if(m[i][j]==1)r++;
			else if(m[i][j]==2)s++;
	}
}

Compiler output:
a.cc: In function 'char dfs(int, int, vpii&)':
a.cc:16:12: error: 'find' was not declared in this scope
   16 |         if(find(v.begin(),v.end(),make_pair(i-1,j))==v.end())ret|=dfs(i-1,j,v);
      |            ^~~~
a.cc:17:12: error: 'find' was not declared in this scope
   17 |         if(find(v.begin(),v.end(),make_pair(i+1,j))==v.end())ret|=dfs(i+1,j,v);
      |            ^~~~
a.cc:18:12: error: 'find' was not declared in this scope
   18 |         if(find(v.begin(),v.end(),make_pair(i,j-1))==v.end())ret|=dfs(i,j-1,v);
      |            ^~~~
a.cc:19:12: error: 'find' was not declared in this scope
   19 |         if(find(v.begin(),v.end(),make_pair(i,j+1))==v.end())ret|=dfs(i,j+1,v);
      |            ^~~~
a.cc: At global scope:
a.cc:23:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   23 | main(){
      | ^~~~