Language: C++

#include<iostream>
#include<string>

#define NMAX 1010

using namespace std;

int n;
string sqs[NMAX];
int sqi[NMAX][NMAX];
int c;
int max;


int main(){

    while(1){

        cin>>n;
        if(n==0) break;

        for(int i=0;i<n;i++){
            cin>>sqs[i];
        }

        for(int i=0;i<n;i++){
            sqi[i][0]=1;
	    c=2;
            for(int j=1;j<n;j++){
	      if(sqs[i][j]=='.') sqi[i][j]=c++;
	      else sqi[i][j]=0,c=1;
            }
        }

	max=0;

	for(int i=0;i<n;i++){
	  for(int j=0;j<n;j++){
	    /*(i,j) 左上*/
	    for(int k=0;i+k<n||j+k<n;k++){
	      if(k+1<=max) continue;
	      /*(i+k,j+k) 右下*/
	      bool f=true;
	      for(int l=0;l<=k&&f;l++){
		if(sqs[i+l][j]=='*'||sqs[i+l][j+k]=='*'||sqi[i+l][j]+k!=sqi[i+l][j+k]) f=false;
	      }
	      if(f) max=k+1;
	      else break;
	    }
         }
      }
	cout<<max<<endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:9: error: reference to 'max' is ambiguous
   35 |         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:12:5: note:                 'int max'
   12 | int max;
      |     ^~~
a.cc:41:23: error: reference to 'max' is ambiguous
   41 |               if(k+1<=max) continue;
      |                       ^~~
/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:12:5: note:                 'int max'
   12 | int max;
      |     ^~~
a.cc:47:21: error: reference to 'max' is ambiguous
   47 |               if(f) max=k+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:12:5: note:                 'int max'
   12 | int max;
      |     ^~~
a.cc:52:15: error: reference to 'max' is ambiguous
   52 |         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:12:5: note:                 'int max'
   12 | int max;
      |     ^~~