Language: C++

#include<iostream>
using namespace std;
int i, j, l;
char a[50][51];
int x[125000], min = 150000;
int n, m, k, cntW, cntB, cntR, cnt = 0;
#define I for(i=0;i<n;i++)
#define Wp cntW++
#define Bp cntB++
#define Rp cntR++
int main(void) {
	cin >> n >> m;
	I{
		x[i] = 0;
	}
		I{
		cin >> a[i];
	}
	for (i = 0; i<n - 2; i++) {
		for (j = i + 1; j<n - 1; j++) {
			for (k = 0; k <= i; k++) {
				cntW = 0;
				for (l = 0; l<m; l++) {
					if (a[k][l] == 'W')Wp;
				}
				x[cnt] += m - cntW;
			}
			for (k = i + 1; k <= j; k++) {
				cntB = 0;
				for (l = 0; l<m; l++) {
					if (a[k][l] == 'B')Bp;
				}
				x[cnt] += m - cntB;
			}
			for (k = j + 1; k<n; k++) {
				cntR = 0;
				for (l = 0; l<m; l++) {
					if (a[k][l] == 'R')Rp;
				}
				x[cnt] += m - cntR;
			}
			cnt++;
		}
	}
	for (i = 0; i<cnt; i++) {
		if (min>x[i]) {
			min = x[i];
		}
	}
	cout << min-1 << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:46:21: error: reference to 'min' is ambiguous
   46 |                 if (min>x[i]) {
      |                     ^~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:                 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
a.cc:5:16: note:                 'int min'
    5 | int x[125000], min = 150000;
      |                ^~~
a.cc:47:25: error: reference to 'min' is ambiguous
   47 |                         min = x[i];
      |                         ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:                 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
a.cc:5:16: note:                 'int min'
    5 | int x[125000], min = 150000;
      |                ^~~
a.cc:50:17: error: reference to 'min' is ambiguous
   50 |         cout << min-1 << endl;
      |                 ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:                 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
a.cc:5:16: note:                 'int min'
    5 | int x[125000], min = 150000;
      |                ^~~