Language: C++

#include<iostream>
using namespace std;
int r[200001], n;
int max =0;
int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> r[i];
	}
	for (int i = 0; i < n - 1; i++) {
		for (int j = i+1; j < n; j++) {
			if (max == 0) {
				max = r[j] - r[i];
				continue;
			}
			if (r[j] - r[i] > max) {
				max = r[j] - r[i];
			}
		}
	}
	cout << max << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:29: error: reference to 'max' is ambiguous
   12 |                         if (max == 0) {
      |                             ^~~
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:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:                 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
a.cc:4:5: note:                 'int max'
    4 | int max =0;
      |     ^~~
a.cc:13:33: error: reference to 'max' is ambiguous
   13 |                                 max = r[j] - r[i];
      |                                 ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:                 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
a.cc:4:5: note:                 'int max'
    4 | int max =0;
      |     ^~~
a.cc:16:43: error: reference to 'max' is ambiguous
   16 |                         if (r[j] - r[i] > max) {
      |                                           ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:                 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
a.cc:4:5: note:                 'int max'
    4 | int max =0;
      |     ^~~
a.cc:17:33: error: reference to 'max' is ambiguous
   17 |                                 max = r[j] - r[i];
      |                                 ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:                 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
a.cc:4:5: note:                 'int max'
    4 | int max =0;
      |     ^~~
a.cc:21:17: error: reference to 'max' is ambiguous
   21 |         cout << max << endl;
      |                 ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:                 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
a.cc:4:5: note:                 'int max'
    4 | int max =0;
      |     ^~~