Language: C++

//This disgusting code is wriiten by Juruo D0zingbear
//Please don't hack me! 0v0 <3
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <cstring>
#include <climits>
#include <string.h>
#include <stdio.h>
#define LL long long
#define all(x) (x).begin(),(x).end()
#define pii pair<int,int>
#define piii pair<int, pii >
#define REP(i,n) for (int (i)=0;(i)<(n);(i)++)
#define vi vector<int>
#define vpi vector< pii >
#define INF 2147483647
#define big 19260817
#define pb push_back
#define mp make_pair
using namespace std;
const int Maxk=1005;
string mul(string a,string b){
	int res[Maxk];
	memset(res,0,sizeof(res));
	reverse(a.begin(),a.end());
	reverse(b.begin(),b.end());
	for (int i=0;i<a.length();i++){
		for (int j=0;j<b.length();j++){
			res[i+j]+=(a[i]-'0')*(b[j]-'0');
		}
	}
	for (int i=0;i<Maxk;i++){
		if (res[i]>=10) {
			res[i+1]+=(res[i]/10);
			res[i]%=10;
		}
	}
	string ret;
	bool flag=false;
	for (int i=Maxk-1;i>=0;i--){
		if (flag || res[i]){
			flag=true;
			ret=ret+(char)(res[i]+'0');
		}
	}
	if (ret=="") ret="0";
	return ret;
}
string add(string a,string b){
	if (a.length()<b.length()) swap(a,b);
	while (a.length()!=b.length()){
		b='0'+b;
	}
	for (int i=a.length()-1;i>=0;i--){
		a[i]+=(b[i]-'0');
		if (a[i]>'9' && i){
			a[i]-=10;
			a[i-1]++;
		}
	}
	if (a[0]>'9'){
		a[0]-=10;
		a='1'+a;
	}
	return a;
}

// cf IO: I64d
// atcoder IO: ｌｌｄ
inline int read()
{
	int x = 0, f = 1; char ch = getchar();
	while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); }
	while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); }
	return x * f;
}
const int Maxn=2005;
char c[Maxn][Maxn];
long long ha[Maxn][Maxn],hha[Maxn][Maxn];
long long p2[Maxn];
int p[Maxn];
int n,m;
int f(char x){
	if (x=='.') return 0;
	return 1;
}
LL h1(int x,int l,int r){
	return((ha[x][r]-p2[r-l+1]*ha[x][l-1])%mod+mod)%mod;
}
LL h2(int x,int l,int r){
	return((hha[x][r]-p2[r-l+1]*hha[x][l-1])%mod+mod)%mod;
}
int findset(int x){
	return p[x]=(p[x]==x)?x:findset(p[x]);
}
void Union(int x){
	p[x]=x+1;
} 
void _init(){
	for (int i=0;i<Maxn;i++) p[i]=i; 
}
int main(){

	scanf("%d %d",&n,&m);
	p2[0]=1;
	for (int i=1;i<Maxn;i++) p2[i]=p2[i-1]*2,p2[i]%=mod;
	for (int i=1;i<=n;i++){
		scanf("%s",c[i]+1);
		for (int j=1;j<=m;j++){
			ha[i][j]=ha[i][j-1]*2+f(c[i][j]);
			ha[i][j]%=mod;
			hha[i][j]=hha[i][j-1]*2+(1-f(c[i][j]));
			hha[i][j]%=mod;
		}
	}
	int ans=0,cnt=0;
	for (int l=1;l<=m;l++){
		_init();
		for (int r=m;r>=l;r--){
			int Mx=0,now=1,nowtot=0;
			while (1){
				int nxt=findset(now);
				nowtot+=(nxt-now+1);
				if (nxt==n){
					Mx=max(Mx,nowtot);
					break;
				}
				if (h1(nxt,l,r)==h1(nxt+1,l,r) || h1(nxt,l,r)==h2(nxt+1,l,r)){
					Union(nxt);
				}
				else{
					Mx=max(Mx,nowtot);
					nowtot=0;
				}
				now=nxt+1;
				cnt++;
				if (cnt>1e7) throw 3; 
			}
			ans=max(ans,(r-l+1)*Mx);
		}
	}
//	cout<<cnt<<endl;
	printf("%d\n",ans);
	return 0;
}

Compiler output:
a.cc: In function 'long long int h1(int, int, int)':
a.cc:104:48: error: 'mod' was not declared in this scope; did you mean 'modf'?
  104 |         return((ha[x][r]-p2[r-l+1]*ha[x][l-1])%mod+mod)%mod;
      |                                                ^~~
      |                                                modf
a.cc: In function 'long long int h2(int, int, int)':
a.cc:107:50: error: 'mod' was not declared in this scope; did you mean 'modf'?
  107 |         return((hha[x][r]-p2[r-l+1]*hha[x][l-1])%mod+mod)%mod;
      |                                                  ^~~
      |                                                  modf
a.cc: In function 'int main()':
a.cc:122:57: error: 'mod' was not declared in this scope; did you mean 'modf'?
  122 |         for (int i=1;i<Maxn;i++) p2[i]=p2[i-1]*2,p2[i]%=mod;
      |                                                         ^~~
      |                                                         modf
a.cc:127:35: error: 'mod' was not declared in this scope; did you mean 'modf'?
  127 |                         ha[i][j]%=mod;
      |                                   ^~~
      |                                   modf