Language: C++

#include <cstdio>
#include <iostream>
#include <string.h>
#include <string> 
#include <unordered_map>
#include <queue>
#include <vector>
#include <set>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <bitset>
#define mem0(a) memset(a,0,sizeof(a))
#define meminf(a) memset(a,0x3f,sizeof(a))
using namespace std;
typedef unsigned long long ull;
typedef long double ld;
const int maxn=5005,inf=0x3f3f3f3f;
char s[maxn],t[maxn];
int a[26];

ull seed1=130,seed2=124635737;

ull hash(int *a) {
	ull sum=seed1;
	for (int i=0;i<26;i++) {
		sum*=seed2;
		sum+=*(a+i);
	}
}

int main() {
	unordered_map<ull,int> HashTable;
	scanf("%s%s",s+1,t+1);
	int lena,lenb,i,j,k,ans;
	lena=strlen(s),lenb=strlen(t);
	int len=min(lena,lenb);
	ans=0;
	for (i=1;i<=len;i++) {
		HashTable.clear();
		mem0(a);
		for (j=1;j<=i;j++) a[s[j]-'a']++;
		for (j=1;j<=len-i;j++) {
			HashTable[hash(a)]++;
			a[s[j]-'a']--;
			a[s[j+i]-'a']++;
		}
		HashTable[hash(a)]++;
		mem0(a);
		for (j=1;j<=i;j++) a[t[j]-'a']++;
		for (j=1;j<=len-i;j++) {
			if (HashTable[hash(a)]) ans=max(ans,i);
			a[t[j]-'a']--;
			a[t[j+i]-'a']++;
		}
		if (HashTable[hash(a)]) ans=max(ans,i);
	}
	printf("%d\n",ans);
	return 0;
}

Compiler output:
a.cc: In function 'ull hash(int*)':
a.cc:30:1: warning: no return statement in function returning non-void [-Wreturn-type]
   30 | }
      | ^
a.cc: In function 'int main()':
a.cc:44:35: error: reference to 'hash' is ambiguous
   44 |                         HashTable[hash(a)]++;
      |                                   ^~~~
In file included from /usr/include/c++/14/string_view:50,
                 from /usr/include/c++/14/bits/basic_string.h:47,
                 from /usr/include/c++/14/string:54,
                 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:2:
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
   59 |     struct hash;
      |            ^~~~
a.cc:24:5: note:                 'ull hash(int*)'
   24 | ull hash(int *a) {
      |     ^~~~
a.cc:48:27: error: reference to 'hash' is ambiguous
   48 |                 HashTable[hash(a)]++;
      |                           ^~~~
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
   59 |     struct hash;
      |            ^~~~
a.cc:24:5: note:                 'ull hash(int*)'
   24 | ull hash(int *a) {
      |     ^~~~
a.cc:52:39: error: reference to 'hash' is ambiguous
   52 |                         if (HashTable[hash(a)]) ans=max(ans,i);
      |                                       ^~~~
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
   59 |     struct hash;
      |            ^~~~
a.cc:24:5: note:                 'ull hash(int*)'
   24 | ull hash(int *a) {
      |     ^~~~
a.cc:56:31: error: reference to 'hash' is ambiguous
   56 |                 if (HashTable[hash(a)]) ans=max(ans,i);
      |                               ^~~~
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
   59 |     struct hash;
      |            ^~~~
a.cc:24:5: note:                 'ull hash(int*)'
   24 | ull hash(int *a) {
      |     ^~~~