Language: C++

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

struct NUM
{
	int color;
	int num;
};

NUM array[1000000];

int main()
{
	 int n;
	 int m = 0;
	 int maxi = 0;
	 while (scanf("%d", &n), n){
	 	memset(array, 0, sizeof(array));
		
	 	for (int i = 0; i < n; i++){
			int a;
			scanf("%d", &a);
			
			bool f = false;
			for (int j = 0; j < m; j++){
				if (array[j].color == a){
					array[j].num++;
					if (array[maxi].num < array[j].num){
						maxi = j;
					}
					f = true;
					break;
				}
			}
			
			if (f == false){
				array[m].color = a;
				array[m].num = 1;
				m++;
			}
	 	}
		
		if (array[maxi].num > n / 2){
			printf("%d\n", array[maxi].color);
		}
		else {
			puts("NO COLOR");
		}
			
	 }
	 
	 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:24: error: reference to 'array' is ambiguous
   19 |                 memset(array, 0, sizeof(array));
      |                        ^~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/algorithm:60,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array'
   99 |     struct array;
      |            ^~~~~
a.cc:11:5: note:                 'NUM array [1000000]'
   11 | NUM array[1000000];
      |     ^~~~~
a.cc:19:41: error: reference to 'array' is ambiguous
   19 |                 memset(array, 0, sizeof(array));
      |                                         ^~~~~
/usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array'
   99 |     struct array;
      |            ^~~~~
a.cc:11:5: note:                 'NUM array [1000000]'
   11 | NUM array[1000000];
      |     ^~~~~
a.cc:19:17: error: 'memset' was not declared in this scope
   19 |                 memset(array, 0, sizeof(array));
      |                 ^~~~~~
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;
a.cc:27:37: error: reference to 'array' is ambiguous
   27 |                                 if (array[j].color == a){
      |                                     ^~~~~
/usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array'
   99 |     struct array;
      |            ^~~~~
a.cc:11:5: note:                 'NUM array [1000000]'
   11 | NUM array[1000000];
      |     ^~~~~
a.cc:28:41: error: reference to 'array' is ambiguous
   28 |                                         array[j].num++;
      |                                         ^~~~~
/usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array'
   99 |     struct array;
      |            ^~~~~
a.cc:11:5: note:                 'NUM array [1000000]'
   11 | NUM array[1000000];
      |     ^~~~~
a.cc:29:45: error: reference to 'array' is ambiguous
   29 |                                         if (array[maxi].num < array[j].num){
      |                                             ^~~~~
/usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array'
   99 |     struct array;
      |            ^~~~~
a.cc:11:5: note:                 'NUM array [1000000]'
   11 | NUM array[1000000];
      |     ^~~~~
a.cc:29:63: error: reference to 'array' is ambiguous
   29 |                                         if (array[maxi].num < array[j].num){
      |                                                               ^~~~~
/usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array'
   99 |     struct array;
      |            ^~~~~
a.cc:11:5: note:                 'NUM array [1000000]'
   11 | NUM array[1000000];
      |     ^~~~~
a.cc:38:33: error: reference to 'array' is ambiguous
   38 |                                 array[m].color = a;
      |                                 ^~~~~
/usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array'
   99 |     struct array;
      |            ^~~~~
a.cc:11:5: note:                 'NUM array [1000000]'
   11 | NUM array[1000000];
      |     ^~~~~
a.cc:39:33: error: reference to 'array' is ambiguous
   39 |                                 array[m].num = 1;
      |                                 ^~~~~
/usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array'
   99 |     struct array;
      |            ^~~~~
a.cc:11:5: note:                 'NUM array [1000000]'
   11 | NUM array[1000000];
      |     ^~~~~
a.cc:44:21: error: reference to 'array' is ambiguous
   44 |                 if (array[maxi].num > n / 2){
      |                     ^~~~~
/usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array'
   99 |     struct array;
      |            ^~~~~
a.cc:11:5: note:                 'NUM array [1000000]'
   11 | NUM array[1000000];
      |     ^~~~~
a.cc:45:40: error: reference to 'array' is ambiguous
   45 |                         printf("%d\n", array[maxi].color);
      |                                        ^~~~~
/usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array'
   99 |     struct array;
      |            ^~~~~
a.cc:11:5: note:                 'NUM array [1000000]'
   11 | NUM array[1000000];
      |     ^~~~~