criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=2e5+5;
int n,cur,pas,b[N],endz[N*25][30],aft[N*25][30],k,ans;
string s[N];
bool  ss(string s1,string s2){
return s1.size()<s2.size();}
int get(){
	int u=0,pas=0;
	b[0]=1<<(s[k][0]-'a');
	for(int i=1;i<s[k].size();i++){
		b[i]=b[i-1]|(1<<(s[k][i]-'a'));
	}
	//cout<<s[k].size()<<endl;
	for(int i=s[k].size()-1;i>=0;i--){
		
		
		if(i==0) break;
		for(int j=0;j<=25;j++){
			if(b[i]&(1<<j)) pas+=endz[u][j];
		}if(!aft[u][s[k][i]-'a']) break;
	u=aft[u][s[k][i]-'a'];}
	return pas;
}
void add(){
	int u=0;
	for(int i=s[k].size()-1;i>=1;i--){
		if(!aft[u][s[k][i]-'a']){
			cur++;
			aft[u][s[k][i]-'a']=cur;
		}
		u=aft[u][s[k][i]-'a'];
	}
	endz[u][s[k][0]-'a']++;
}
 main(){
	cin>>n;
	for(k=1;k<=n;k++){
		cin>>s[k];
	}
	sort(s+1,s+n+1,ss);
	
	for(k=1;k<=n;k++){
		ans+=get();
		add();
	}
	cout<<ans;
} 

Compiler output:
a.cc:37:2: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   37 |  main(){
      |  ^~~~
/tmp/ccb2ywDc.o: in function `get()':
a.cc:(.text+0x54): relocation truncated to fit: R_X86_64_PC32 against symbol `k' defined in .bss section in /tmp/ccb2ywDc.o
a.cc:(.text+0x62): relocation truncated to fit: R_X86_64_PC32 against symbol `s[abi:cxx11]' defined in .bss section in /tmp/ccb2ywDc.o
a.cc:(.text+0xbb): relocation truncated to fit: R_X86_64_PC32 against symbol `k' defined in .bss section in /tmp/ccb2ywDc.o
a.cc:(.text+0xc9): relocation truncated to fit: R_X86_64_PC32 against symbol `s[abi:cxx11]' defined in .bss section in /tmp/ccb2ywDc.o
a.cc:(.text+0x11a): relocation truncated to fit: R_X86_64_PC32 against symbol `k' defined in .bss section in /tmp/ccb2ywDc.o
a.cc:(.text+0x128): relocation truncated to fit: R_X86_64_PC32 against symbol `s[abi:cxx11]' defined in .bss section in /tmp/ccb2ywDc.o
a.cc:(.text+0x14c): relocation truncated to fit: R_X86_64_PC32 against symbol `k' defined in .bss section in /tmp/ccb2ywDc.o
a.cc:(.text+0x15a): relocation truncated to fit: R_X86_64_PC32 against symbol `s[abi:cxx11]' defined in .bss section in /tmp/ccb2ywDc.o
a.cc:(.text+0x1f9): relocation truncated to fit: R_X86_64_PC32 against symbol `k' defined in .bss section in /tmp/ccb2ywDc.o
a.cc:(.text+0x207): relocation truncated to fit: R_X86_64_PC32 against symbol `s[abi:cxx11]' defined in .bss section in /tmp/ccb2ywDc.o
a.cc:(.text+0x25d): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include<bits/stdc++.h>
using namespace std;
const int N=2e5+5;
int n,cur,pas,b[N],endz[N*50][30],aft[N*50][30],k,ans;
string s[N];
bool  ss(string s1,string s2){
return s1.size()<s2.size();}
int get(){
	int u=0,pas=0;
	b[0]=1<<(s[k][0]-'a');
	for(int i=1;i<s[k].size();i++){
		b[i]=b[i-1]|(1<<(s[k][i]-'a'));
	}
	//cout<<s[k].size()<<endl;
	for(int i=s[k].size()-1;i>=0;i--){
		
		
		if(i==0) break;
		for(int j=0;j<=25;j++){
			if(b[i]&(1<<j)) pas+=endz[u][j];
		}if(!aft[u][s[k][i]-'a']) break;
	u=aft[u][s[k][i]-'a'];}
	return pas;
}
void add(){
	int u=0;
	for(int i=s[k].size()-1;i>=1;i--){
		if(!aft[u][s[k][i]-'a']){
			cur++;
			aft[u][s[k][i]-'a']=cur;
		}
		u=aft[u][s[k][i]-'a'];
	}
	endz[u][s[k][0]-'a']++;
}
int main(){
	cin>>n;
	for(k=1;k<=n;k++){
		cin>>s[k];
	}
	sort(s+1,s+n+1,ss);
	
	for(k=1;k<=n;k++){
		ans+=get();
		add();
	}
	cout<<ans;
} 

Compiler output:
/tmp/ccASgcU1.o: in function `get()':
a.cc:(.text+0x51): relocation truncated to fit: R_X86_64_PC32 against symbol `k' defined in .bss section in /tmp/ccASgcU1.o
a.cc:(.text+0x61): relocation truncated to fit: R_X86_64_PC32 against symbol `s[abi:cxx11]' defined in .bss section in /tmp/ccASgcU1.o
a.cc:(.text+0xb4): relocation truncated to fit: R_X86_64_PC32 against symbol `k' defined in .bss section in /tmp/ccASgcU1.o
a.cc:(.text+0xc4): relocation truncated to fit: R_X86_64_PC32 against symbol `s[abi:cxx11]' defined in .bss section in /tmp/ccASgcU1.o
a.cc:(.text+0x116): relocation truncated to fit: R_X86_64_PC32 against symbol `k' defined in .bss section in /tmp/ccASgcU1.o
a.cc:(.text+0x126): relocation truncated to fit: R_X86_64_PC32 against symbol `s[abi:cxx11]' defined in .bss section in /tmp/ccASgcU1.o
a.cc:(.text+0x145): relocation truncated to fit: R_X86_64_PC32 against symbol `k' defined in .bss section in /tmp/ccASgcU1.o
a.cc:(.text+0x155): relocation truncated to fit: R_X86_64_PC32 against symbol `s[abi:cxx11]' defined in .bss section in /tmp/ccASgcU1.o
a.cc:(.text+0x1e6): relocation truncated to fit: R_X86_64_PC32 against symbol `k' defined in .bss section in /tmp/ccASgcU1.o
a.cc:(.text+0x1f6): relocation truncated to fit: R_X86_64_PC32 against symbol `s[abi:cxx11]' defined in .bss section in /tmp/ccASgcU1.o
a.cc:(.text+0x24c): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N=1e6+5;
int num[N*26],nex[N*26][26],sum[N][26],cnt=1;
ll ans;
string s[N/5+5];
void add(int x){
    int n=s[x].length();
    int now=1;
    for(int i=0;i<n;i++){
        for(int j=0;j<26;j++){
            if(s[x][i]-'a'==j)sum[i][j]=sum[i-1][j]+1;
            else sum[i][j]=sum[i-1][j];
        }
    }
    for(int i=n-1;~i;i--){
        for(int j=0;j<26;j++){
            if(sum[i][j]){
                if(!nex[now][j])
                    nex[now][j]=++cnt;
                num[nex[now][j]]++;
            }
        }
        now=nex[now][s[x][i]-'a'];
    }
}
void finds(int x){
    int n=s[x].length();
    int now=1;
    for(int i=n-1;~i;i--)
        now=nex[now][s[x][i]-'a'];
    ans+=num[now]-1;
}
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        cin>>s[i];
        add(i);
    }
    for(int i=1;i<=n;i++)
        finds(i);
    printf("%lld\n",ans);
    return 0;
}


Compiler output:
/tmp/cc3j7Bt0.o: in function `add(int)':
a.cc:(.text+0x1a): relocation truncated to fit: R_X86_64_PC32 against symbol `s[abi:cxx11]' defined in .bss section in /tmp/cc3j7Bt0.o
a.cc:(.text+0x5a): relocation truncated to fit: R_X86_64_PC32 against symbol `s[abi:cxx11]' defined in .bss section in /tmp/cc3j7Bt0.o
a.cc:(.text+0xb4): relocation truncated to fit: R_X86_64_PC32 against symbol `sum' defined in .bss section in /tmp/cc3j7Bt0.o
a.cc:(.text+0xeb): relocation truncated to fit: R_X86_64_PC32 against symbol `sum' defined in .bss section in /tmp/cc3j7Bt0.o
a.cc:(.text+0x124): relocation truncated to fit: R_X86_64_PC32 against symbol `sum' defined in .bss section in /tmp/cc3j7Bt0.o
a.cc:(.text+0x158): relocation truncated to fit: R_X86_64_PC32 against symbol `sum' defined in .bss section in /tmp/cc3j7Bt0.o
a.cc:(.text+0x1c4): relocation truncated to fit: R_X86_64_PC32 against symbol `sum' defined in .bss section in /tmp/cc3j7Bt0.o
a.cc:(.text+0x2d1): relocation truncated to fit: R_X86_64_PC32 against symbol `s[abi:cxx11]' defined in .bss section in /tmp/cc3j7Bt0.o
/tmp/cc3j7Bt0.o: in function `finds(int)':
a.cc:(.text+0x351): relocation truncated to fit: R_X86_64_PC32 against symbol `s[abi:cxx11]' defined in .bss section in /tmp/cc3j7Bt0.o
a.cc:(.text+0x384): relocation truncated to fit: R_X86_64_PC32 against symbol `s[abi:cxx11]' defined in .bss section in /tmp/cc3j7Bt0.o
a.cc:(.text+0x402): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include<bits/stdc++.h>
using namespace std;


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;

string s[200200];
li n;

unordered_map<string, li> cnt[26];

int main() {
    cin >> n;
    rin{
        cin >> s[i];
    }
    sort(s, s + n, [](const string & a, const string & b) {
        if (sz(a) != sz(b)) {
            return sz(a) < sz(b);
        }
        return a < b;
    });

    li res = 0;
    rin{
        set<li> st;
        rep(j, sz(s[i])) {
            st.insert(s[i][j] - 'a');
            string& rest = s[i].substr(j + 1);
            for (auto v : st) {
                if (cnt[v].count(rest) > 0) {
                    res += cnt[v][rest];
                }
            }
        }
        cnt[s[i][0] - 'a'][s[i].substr(1)]++;
    }
    cout << res << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:73:39: error: cannot bind non-const lvalue reference of type 'std::string&' {aka 'std::__cxx11::basic_string<char>&'} to an rvalue of type 'std::__cxx11::basic_string<char>'
   73 |             string& rest = s[i].substr(j + 1);
      |                            ~~~~~~~~~~~^~~~~~~
Language: C++

#include<iostream>
#include<string>
#include<vector>

using namespace std;

bool sortbylen(string a, string b)
{
	return a.length() < b.length();
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    int n;
    cin >> n;

    vector<string> s;
    s.resize(n);

    for (int i = 0; i < n; i++)
		cin >> s[i];

    sort(s.begin(), s.end(), sortbylen);

    int c = 0;
    for (int i = 0; i < n; i++)
	{
        for (int j = i + 1; j < n; j++)
        {
			int x, y;
			x = s[i].length() - 1;
			y = s[j].length() - 1;
			while (x >= 0)
			{
				if (iy >= 0 && (s[i][x] == s[j][y])
					|| iy > 0 && (s[i][x] == s[j][--y]))
					--x, --y;
				else
					continue;
			}
			c++;
		}    
	}
    cout << c;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   26 |     sort(s.begin(), s.end(), sortbylen);
      |     ^~~~
      |     short
a.cc:38:37: error: 'iy' was not declared in this scope; did you mean 'y'?
   38 |                                 if (iy >= 0 && (s[i][x] == s[j][y])
      |                                     ^~
      |                                     y
Language: C++

#include <iostream>
#include <vector>
#include <string>

using namespace std;

bool check(string sx, string sy)
{
  int ix = x.length()-1, iy = y.length()-1;
  while (ix >= 0)
  {
	if (iy >= 0 && sx[ix] == sy[iy] || iy > 0 && sx[ix] == sy[--iy])
	  ix--, iy--;
	else
	  return false;
  }
  return true;
}

bool sortlen(const string a, const string b)
{
  return a.length() < b.length;
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  
  int n;
  cin >> n;
  
  vector<string> a;
  a.resize(n);
  
  for (auto &s: a)
	cin >> s;  
  
  sort(a.begin(), a.end(), sortlen);
  
  int c = 0;
  for (int i = 0; i < n; i++)
	for (int j = i; j < n; j++)
	  check(a[i], a[j]) && c++;
			
  cout << c;
  
  return 0;
}

Compiler output:
a.cc: In function 'bool check(std::string, std::string)':
a.cc:9:12: error: 'x' was not declared in this scope; did you mean 'ix'?
    9 |   int ix = x.length()-1, iy = y.length()-1;
      |            ^
      |            ix
a.cc:12:13: error: 'iy' was not declared in this scope; did you mean 'ix'?
   12 |         if (iy >= 0 && sx[ix] == sy[iy] || iy > 0 && sx[ix] == sy[--iy])
      |             ^~
      |             ix
a.cc: In function 'bool sortlen(std::string, std::string)':
a.cc:22:25: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::length() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
   22 |   return a.length() < b.length;
      |                       ~~^~~~~~
      |                               ()
a.cc: In function 'int main()':
a.cc:40:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   40 |   sort(a.begin(), a.end(), sortlen);
      |   ^~~~
      |   short
Language: C++

#include <iostream>
#include <vector>
#include <string>

using namespace std;

bool check(string sx, string sy)
{
  int ix = x.length()-1, iy = y.length()-1;
  while (ix >= 0)
  {
	if (sx[ix] == sy[iy] || sx[ix] == sy[--iy])
	  ix--, iy--;
	else
	  return false;
  }
  return true;
}


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  
  int n;
  cin >> n;
  
  vector<string> a;
  a.resize(n);
  
  for (auto &s: a)
	cin >> s;  
  
  int c = 0;
  for (int i = 0; i < n; i++)
	for (int j = i; j < n; j++)
		if (a[i].length() <= a[j].length())
			check(a[i], a[j]) && c++;
		else
			check(a[j], a[i]) && c++;
			
  cout << c;
  
  return 0;
}

Compiler output:
a.cc: In function 'bool check(std::string, std::string)':
a.cc:9:12: error: 'x' was not declared in this scope; did you mean 'ix'?
    9 |   int ix = x.length()-1, iy = y.length()-1;
      |            ^
      |            ix
a.cc:12:26: error: 'iy' was not declared in this scope; did you mean 'ix'?
   12 |         if (sx[ix] == sy[iy] || sx[ix] == sy[--iy])
      |                          ^~
      |                          ix
Language: C++

#include <iostream>
#include <vector>
#include <string>

using namespace std;

bool check(string sx, string sy)
{
  int ix = length(x)-1, iy = length(y)-1;
  while (ix >= 0)
  {
	if (sx[ix] == sy[iy] || sx[ix] == sy[--iy])
	  ix--, iy--;
	else
	  return false;
  }
  return true;
}


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  
  int n;
  cin >> n;
  
  vector<string> a;
  a.resize(n);
  
  for (auto &s: a)
	cin >> s;  
  
  int c = 0;
  for (int i = 0; i < n; i++)
	for (int j = i; j < n; j++)
		if (length(a[i]) <= length(a[j]))
			check(a[i], a[j]) && c++;
		else
			check(a[j], a[i]) && c++;
			
  cout << c;
  
  return 0;
}

Compiler output:
a.cc: In function 'bool check(std::string, std::string)':
a.cc:9:19: error: 'x' was not declared in this scope; did you mean 'ix'?
    9 |   int ix = length(x)-1, iy = length(y)-1;
      |                   ^
      |                   ix
a.cc:9:12: error: 'length' was not declared in this scope
    9 |   int ix = length(x)-1, iy = length(y)-1;
      |            ^~~~~~
a.cc:12:26: error: 'iy' was not declared in this scope; did you mean 'ix'?
   12 |         if (sx[ix] == sy[iy] || sx[ix] == sy[--iy])
      |                          ^~
      |                          ix
a.cc: In function 'int main()':
a.cc:39:21: error: 'length' was not declared in this scope
   39 |                 if (length(a[i]) <= length(a[j]))
      |                     ^~~~~~
Language: C++

#include <iostream>
#include <vector>
#include <string>

using namespace std;

bool check(string sx, string sy)
{
  int ix = length(x)-1, length(y)-1;
  while (ix >= 0)
  {
	if (sx[ix] == sy[iy] || sx[ix] == sy[--iy])
	  ix--, iy--;
	else
	  return false;
  }
  return true;
}


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  
  int n;
  cin >> n;
  
  vector<string> a;
  a.resize(n);
  
  for (auto &s: a)
	cin >> s;  
  
  int c = 0;
  for (int i = 0; i < n; i++)
	for (int j = i; j < n; j++)
		if (length(a[i]) <= length(a[j]))
			check(a[i], a[j]) && c++;
		else
			check(a[j], a[i]) && c++;
			
  cout << c;
  
  return 0;
}

Compiler output:
a.cc: In function 'bool check(std::string, std::string)':
a.cc:9:19: error: 'x' was not declared in this scope; did you mean 'ix'?
    9 |   int ix = length(x)-1, length(y)-1;
      |                   ^
      |                   ix
a.cc:9:12: error: 'length' was not declared in this scope
    9 |   int ix = length(x)-1, length(y)-1;
      |            ^~~~~~
a.cc:12:26: error: 'iy' was not declared in this scope; did you mean 'ix'?
   12 |         if (sx[ix] == sy[iy] || sx[ix] == sy[--iy])
      |                          ^~
      |                          ix
a.cc: In function 'int main()':
a.cc:39:21: error: 'length' was not declared in this scope
   39 |                 if (length(a[i]) <= length(a[j]))
      |                     ^~~~~~
Language: C++

#include<bits/stdc++.h>
#define ll long long
#define mod 1000000007ll
#define bs 101ll
#define push_back emplace_back
using namespace std;
map<ll, int>mp;
typedef pair<int, string>pi;
vector<pi>vec;
bool freq[27];
ll hs[1000006], pwr[1000006];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    pwr[0]= 1;
    for(int i=1; i<=1000000; i++)
    pwr[i]= (pwr[i-1]*bs)%mod;
    int n;
    cin>>n;
    while(n--)
    {
        string str;
        cin>>str;
        vec.push_back({str.size(), str});
    }
    sort(vec.begin(), vec.end());
    ll res= 0;
    for(int i=0; i<vec.size(); i++)
    {
        for(int j=1; j<=26; j++)freq[j]= 0;
        string str= vec[i].second;
        n= str.size();
        for(int j=0; j<n; j++)
        hs[j+1]= (hs[j]*bs + (str[j]-'a'+1))%mod;
        for(int j=1; j<=n; j++)
        {
            freq[ str[j-1]-'a'+1 ]= 1;
            ll suf= ((hs[n]-(hs[j]*pwr[n-j]))%mod+mod)%mod;
            for(int k=1; k<=26; k++)
            if(freq[k])
            {
                ll x= (k*pwr[n-j]+suf)%mod;
                if(mp.find(x)!=mp.end())res+= mp[x];
            }
        }
        mp[ hs[n] ]++;
    }
    cout<<res<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:22: error: no matching function for call to 'std::vector<std::pair<int, std::__cxx11::basic_string<char> > >::emplace_back(<brace-enclosed initializer list>)'
   25 |         vec.push_back({str.size(), str});
      |         ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/vector:72,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/vector.tcc:111:7: note: candidate: 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::emplace_back(_Args&& ...) [with _Args = {}; _Tp = std::pair<int, std::__cxx11::basic_string<char> >; _Alloc = std::allocator<std::pair<int, std::__cxx11::basic_string<char> > >; reference = std::pair<int, std::__cxx11::basic_string<char> >&]'
  111 |       vector<_Tp, _Alloc>::
      |       ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/vector.tcc:111:7: note:   candidate expects 0 arguments, 1 provided
Language: C++

#include <bits/stdc++.h>
using namespace std;

const int N = 1e5 + 10;

char str[N];
int L[N], R[N];

namespace Trie
{
	const int SIZE = 3e6 + 10;
	int ch[SIZE][26], sz;
	int val[SIZE];

	void insert(char *str, int len)
	{
		int u = 0;
		for (int i = 0; i < len; i++)
		{
			int c = str[i] - 'a';
			if (!ch[u][c]) ch[u][c] = ++sz;
			u = ch[u][c];
		}
		val[u]++;
	}
}

int n;

int main()
{
	cin >> n;
	for (int i = 1; i <= n; i++)
	{
		scanf("%s", str + R[i-1] + 1);
		int len = strlen(str + R[i-1] + 1);
		L[i] = R[i-1] + 1;
		R[i] = L[i] + len - 1;
		Trie::insert(str + L[i], len);
	}
	
	LL Ans = 0;
	int u = 0;
	for (int i = 1; i <= n; i++)
	{
		static int cnt[27];
		memset(cnt, 0, sizeof(cnt));
		for (int j = L[i]; j <= R[i]; j++) cnt[str[i] - 'a']++;
		for (int j = L[i]; j <= R[i]; j++)
		{
			for (int k = 0; k < 26; k++)
				if (cnt[k] && Trie::ch[u][k])
					Ans += Trie::val[Trie::ch[u][k]];
			cnt[str[i] - 'a']--;
			u = Trie::ch[u][str[i] - 'a'];
		}
	}
	cout << Ans << endl;
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:42:9: error: 'LL' was not declared in this scope; did you mean 'L'?
   42 |         LL Ans = 0;
      |         ^~
      |         L
a.cc:53:41: error: 'Ans' was not declared in this scope
   53 |                                         Ans += Trie::val[Trie::ch[u][k]];
      |                                         ^~~
a.cc:58:17: error: 'Ans' was not declared in this scope
   58 |         cout << Ans << endl;
      |                 ^~~
Language: C++

#include<bits/stdc++.h>
using namespace::std;
#define all(n) (n).begin(),(n).end()

int64_t mod_pow(int64_t x,int64_t y,int64_t mod){
    int64_t ret=1;
    while(y){
        if(y&1)(ret*=x)%=mod;
        (x*=x)%=mod;
        y>>=1;
    }
    return ret;
}
auto meld(tuple<int64_t,int64_t,int64_t,int> s,tuple<int64_t,int64_t,int64_t,int> t){
    constexpr int64_t base=10007;
    constexpr int64_t mod[3]={1000000007LL,999999937LL,998244353LL};
    int64_t a[3]={};
    a[0]=(get<0>(s)*basemod[0]+get<0>(t))%mod[0];
    a[1]=(get<1>(s)*base%mod[1]+get<1>(t))%mod[1];
    a[2]=(get<2>(s)*base%mod[2]+get<2>(t))%mod[2];
    return make_tuple(a[0],a[1],a[2],get<3>(s)+get<3>(t));
}
auto make(char c){
    return make_tuple(int64_t(c),int64_t(c),int64_t(c),1);
}
auto empty(){
	return make_tuple(0LL,0LL,0LL,1);
}

int main(){
	map<tuple<int64_t,int64_t,int64_t,int>,int>m;
	int n;
	cin>>n;
	vector<string>s(n);
	for(int i=0;i<n;++i)cin>>s[i];
	for(int i=0;i<n;++i)reverse(all(s[i]));
	vector<tuple<int64_t,int64_t,int64_t,int>>v(n,empty());
	for(int i=0;i<n;++i){
		vector<int>cnt(26,0);
		for(int j=0;j<(int)s[i].size();++j)cnt[s[i][j]-'a']++;
		bitset<26>b;
		for(int j=0;j<26;++j)if(cnt[j])b[j]=1;
		for(int j=0;j<(int)s[i].size();++j){
			for(int k=b._Find_first();k<26;k=b._Find_next(k)){
				m[meld(v[i],make(k+'a'))]++;
			}
			v[i]=meld(v[i],make(s[i][j]));
			cnt[s[i][j]-'a']--;
			if(!cnt[s[i][j]-'a'])b[s[i][j]-'a']=0;
		}
	}
	int64_t ans=0;
	for(int i=0;i<n;++i){
		ans+=m[v[i]]-1;
	}
	cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'auto meld(std::tuple<long int, long int, long int, int>, std::tuple<long int, long int, long int, int>)':
a.cc:18:21: error: 'basemod' was not declared in this scope; did you mean 'base'?
   18 |     a[0]=(get<0>(s)*basemod[0]+get<0>(t))%mod[0];
      |                     ^~~~~~~
      |                     base
Language: C++

#include <algorithm>
#include <string>
#include <iostream>
#include <vector>

using namespace std;

using ll = long long;
#define REP(i, n) for(int (i) = 0;(i) < (n);(i)++)
#define all(x) (x).begin(),(x).end()
struct Trie{
  struct Node{
      int c;
      bool accept;
      vector<int> nextid;
      Node(int c):c(c),accept(false){
        nextid.assign(26,-1);
      }
  };
  vector<Node> g;
  Trie(){
    g.emplace_back(0);
  }
  bool match(int tmp,int c){
    assert(tmp < g.size());
    return (g[tmp].nextid[c] != -1) && g[g[tmp].nextid[c]].accept;
  }
  void insert(string& s){
    int tmp = 0;
    for(int i = 0;i < s.size();i++){
      int& nid = g[tmp].nextid[s[i] - 'a'];
      if(nid == -1){
        nid = g.size();
        g.emplace_back(s[i] - 'a');
      }
      tmp = nid;
    }
    g[tmp].accept = true;
  }
};

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);

  int n;
  cin >> n;
  vector<string> a(n);
  for(int i = 0;i < n;i++){
    cin >> a[i];
    reverse(all(a[i]));
  }
  sort(a.begin(),a.end(),[](string& s,string& t){
    return s.size() < t.size();
  });

  Trie trie;
  ll ans = 0;
  for(int i = 0;i < n;i++){
    string s = a[i];
    int sz = s.size();
    vector<int> last(26,-1);
    for(int j = sz - 1;j >= 0;j--) {
      if(last[s[j] - 'a'] == -1){
        last[s[j] - 'a'] = j;
      }
    }
    int tmp = 0;
    for(int j = 0;j < sz;j++){
      for(int c = 0;c < 26;c++){
        if(j <= last[c] && trie.match(tmp,c)){
          ans++;
        }
      }
      int nid = trie.g[tmp].nextid[s[j] - 'a'];
      if(nid == -1) break;
      else tmp = nid;
    }
    trie.insert(s);
  }
  cout << ans << '\n';
  return 0;
}


Compiler output:
a.cc: In member function 'bool Trie::match(int, int)':
a.cc:25:5: error: 'assert' was not declared in this scope
   25 |     assert(tmp < g.size());
      |     ^~~~~~
a.cc:5:1: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>'
    4 | #include <vector>
  +++ |+#include <cassert>
    5 |
Language: C++

#include<iostream>
#include<vector>
#include<set>
#include<queue>
#include<map>
#include<algorithm>
#include<cstring>
#include<string>
#include<cassert>
#include<cmath>
#include<climits>
#include<iomanip>
#include<stack>
#include<unordered_map>
#include<bitset>
#include<limits>
#include<complex>
#include<array>
#include<numeric>
#include<functional>
#include<random>

using namespace std;
#define ll long long
#define ull unsigned long long
#define rrep(i,m,n) for(ll (i)=(ll)(m);(i)>=(ll)(n);(i)--)
#define rep(i,m,n) for(ll (i)=(ll)(m);i<(ll)(n);i++)
#define REP(i,n) rep(i,0,n)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define all(hoge) (hoge).begin(),(hoge).end()
typedef pair<ll, ll> P;
constexpr long double m_pi = 3.1415926535897932L;
constexpr ll MOD = 1000000007;
constexpr ll INF = 1LL << 61;
constexpr long double EPS = 1e-10;
template<typename T> using vector2 = vector<vector<T>>;
template<typename T> using vector3 = vector<vector2<T>>;
typedef vector<ll> Array;
typedef vector<Array> Matrix;
string operator*(const string& s, int k) {
	if (k == 0) return "";
	string p = (s + s) * (k / 2);
	if (k % 2 == 1) p += s;
	return p;
}

template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

class AhoCorasick {
private:
	vector2<int> nxt;//現在のノードにchを追加した場合のノード　存在しなければsuffix linkを辿る
	vector<int> fail, end;//suffix link,そのノードに存在する文字列の数
	int root;
	int p;//ノードの数
	int maxn;//文字の合計サイズ
	vector2<int> type;
public:
	AhoCorasick(int maxn) :maxn(maxn), nxt(maxn, vector<int>(26, -1)), fail(maxn), end(maxn, 0), p(1), root(0),type(maxn,vector<int>(26,0)) {}

	inline void insert(const string& s) {
        Array cnt(26, 0);
      	for(auto ch:s ) cnt[ch-'a']++;
		int now = root;
		REP(i, 26) {
			if (cnt[i] != 0)type[now][i]++;
		}
		for (int i = 0; i < s.size(); i++) {
			if (nxt[now][s[i] - 'a'] == -1) nxt[now][s[i] - 'a'] = p++;
			now = nxt[now][s[i] - 'a'];
			cnt[s[i] - 'a']--;
			REP(j, 26) {
				if (cnt[j] != 0)type[now][j]++;
			}
		}
		end[now]++;
	}
	
	inline int solve(const string& s) {
		int now = root;
		for (int i = 0; i < s.size() - 1; i++) {
			now = nxt[now][s[i] - 'a'];
		}
		return type[now][s.back() - 'a'] - 1;
	}
};

int main() {
	ios::sync_with_stdio(false);
	std::cin.tie(0);
	std::cout.tie(0);

	ll n;
	cin >> n;
	vector<string> s(n);
	map<pair<string, char>, ll> mp;
	REP(i, n)cin >> s[i];
	sort(all(s), [](string a, string b) {return a.size() < b.size(); });
	AhoCorasick ac(1010101);
	REP(i, n) {
		reverse(all(s[i]));
		ac.insert(s[i], cnt);
	}
	ll ans = 0;
	REP(i, n) {
		ans += ac.solve(s[i]);
	}
	cout << ans << "\n";
	
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:114:33: error: 'cnt' was not declared in this scope; did you mean 'int'?
  114 |                 ac.insert(s[i], cnt);
      |                                 ^~~
      |                                 int
Language: C++

#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ar array

int n;
string s;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);

    cin >> n >> s;
    for(int i=0; i<n; ++i) {
        sort n-2;
        for(int j=0; j<n; ++i) {
            cin >> s[i] >> s[j];
        }

        sort s[i] ≠ s[j];
        sort i ≠ j;
    }
    printf("s[i], s[j]")
    print(_get_printf_count_output("s[i], s[j]"));
    cout << printf;
    return 0;
}

Compiler output:
a.cc:21:19: error: extended character ≠ is not valid in an identifier
   21 |         sort s[i] ≠ s[j];
      |                   ^
a.cc:22:16: error: extended character ≠ is not valid in an identifier
   22 |         sort i ≠ j;
      |                ^
a.cc: In function 'int main()':
a.cc:16:13: error: expected ';' before 'n'
   16 |         sort n-2;
      |             ^~
      |             ;
a.cc:16:17: error: statement cannot resolve address of overloaded function
   16 |         sort n-2;
      |                 ^
a.cc:21:13: error: expected ';' before 's'
   21 |         sort s[i] ≠ s[j];
      |             ^~
      |             ;
a.cc:21:25: error: statement cannot resolve address of overloaded function
   21 |         sort s[i] ≠ s[j];
      |                         ^
a.cc:22:13: error: expected ';' before 'i'
   22 |         sort i ≠ j;
      |             ^~
      |             ;
a.cc:22:19: error: statement cannot resolve address of overloaded function
   22 |         sort i ≠ j;
      |                   ^
a.cc:24:25: error: expected ';' before 'print'
   24 |     printf("s[i], s[j]")
      |                         ^
      |                         ;
   25 |     print(_get_printf_count_output("s[i], s[j]"));
      |     ~~~~~
Language: C++

#pragma GCC target ("avx2")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize ("O3")
#include "bits/stdc++.h"
#include <unordered_set>
#include <unordered_map>
#include <random>
using namespace std;
typedef long long ll;
const ll MOD = /*1'000'000'007LL;*/ 998'244'353LL;
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int (i)=0; (i)<(n); (i)++)
const int dx[4]={ 1,0,-1,0 };
const int dy[4]={ 0,1,0,-1 };

template<int sigma, int a>
struct Trie{
private:
    struct Node{
        int chi[sigma];
        int siz = 0;
        Node(){
            memset(chi, -1, sizeof(chi));
        }
    };
    vector<Node> nodes;
public:
    Trie(){
        nodes.push_back(Node());
    }
    void add_node(int n, int c){
        nodes[n].chi[c] = nodes.size();
        nodes.push_back(Node());
    }
    void add(string &s){
        int n = 0;
        nodes[n].siz++;
        for(int i=0; i<s.size(); i++){
            if(nodes[n].chi[s[i]-a] == -1) add_node(n, s[i]-a);
            n = nodes[n].chi[s[i]-a];
            nodes[n].siz++;
        }
    }
    int count_prefix(string &s){
        int n = 0;
        for(int i=0; i<s.size(); i++){
            if(nodes[n].chi[s[i]-a] == -1) return 0;
            n = nodes[n].chi[s[i]-a];
        }
        return nodes[n].siz;
    }
};

int N;
vector<string> S[200001];

Trie<26, 'a'> trie[26];
vector<pair<int,string>> query[200001];

signed main(){
    cin >> N;
    rep(i, N){
        string s;
        cin >> s;
        reverse(all(s));
        S[s.size()].pb(s);
    }

    ll ans = 0;

    int k = 200000;
    for(int i=200000; i>=1; i--){
        while(k >= i-1){
            rep(j, query[k].size()){
                trie[query[k][j].first].add(query[k][j].second);
            }
            k--;
        }
        rep(j, S[i].size()){
            ans += trie[S[i][j].back()-'a'].count_prefix(S[i][j].substr(0, S[i][j].size()-1));
            int p[26];
            memset(p, -1, sizeof(p));
            rep(l, S[i][j].size()){
                p[S[i][j][l]-'a'] = l;
            }
            rep(l, 26){
                if(p[l] == i-1) trie[l].add(S[i][j]);
                else if(p[l] != -1) query[p[l]].pb({ l,S[i][j] });
            }
        }
    }

    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:82:72: error: cannot bind non-const lvalue reference of type 'std::string&' {aka 'std::__cxx11::basic_string<char>&'} to an rvalue of type 'std::__cxx11::basic_string<char>'
   82 |             ans += trie[S[i][j].back()-'a'].count_prefix(S[i][j].substr(0, S[i][j].size()-1));
      |                                                          ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
a.cc:46:30: note:   initializing argument 1 of 'int Trie<sigma, a>::count_prefix(std::string&) [with int sigma = 26; int a = 97; std::string = std::__cxx11::basic_string<char>]'
   46 |     int count_prefix(string &s){
      |                      ~~~~~~~~^
Language: C++

#pragma GCC target ("avx2")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize ("O3")
#include "bits/stdc++.h"
#include <unordered_set>
#include <unordered_map>
#include <random>
using namespace std;
typedef long long ll;
const ll MOD = /*1'000'000'007LL;*/ 998'244'353LL;
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int (i)=0; (i)<(n); (i)++)
const int dx[4]={ 1,0,-1,0 };
const int dy[4]={ 0,1,0,-1 };

template<int sigma, int a>
struct Trie{
private:
    template<int sigma>
    struct Node{
        int chi[sigma];
        int siz = 0;
        Node(){
            memset(chi, -1, sizeof(chi));
        }
    };
    vector<Node<sigma>> nodes;
public:
    Trie(){
        nodes.push_back(Node<sigma>());
    }
    void add_node(int n, int c){
        nodes[n].chi[c] = nodes.size();
        nodes.push_back(Node<sigma>());
    }
    void add(string s){
        int n = 0;
        nodes[n].siz++;
        for(int i=0; i<s.size(); i++){
            if(nodes[n].chi[s[i]-a] == -1) add_node(n, s[i]-a);
            n = nodes[n].chi[s[i]-a];
            nodes[n].siz++;
        }
    }
    int count_prefix(string s){
        int n = 0;
        for(int i=0; i<s.size(); i++){
            if(nodes[n].chi[s[i]-a] == -1) return 0;
            n = nodes[n].chi[s[i]-a];
        }
        return nodes[n].siz;
    }
};

int N;
vector<string> S[200001];

Trie<26, 'a'> trie[26];
vector<pair<int,string>> query[200001];

signed main(){
    cin >> N;
    rep(i, N){
        string s;
        cin >> s;
        reverse(all(s));
        S[s.size()].pb(s);
    }

    ll ans = 0;

    int k = 200000;
    for(int i=200000; i>=1; i--){
        while(k >= i-1){
            rep(j, query[k].size()){
                trie[query[k][j].first].add(query[k][j].second);
            }
            k--;
        }
        rep(j, S[i].size()){
            ans += trie[S[i][j].back()-'a'].count_prefix(S[i][j].substr(0, S[i][j].size()-1));
            int p[26];
            memset(p, -1, sizeof(p));
            rep(l, S[i][j].size()){
                p[S[i][j][l]-'a'] = l;
            }
            rep(l, 26){
                if(p[l] == i-1) trie[l].add(S[i][j]);
                else if(p[l] != -1) query[p[l]].pb({ l,S[i][j] });
            }
        }
    }

    cout << ans << endl;
}

Compiler output:
a.cc:21:14: error: declaration of template parameter 'sigma' shadows template parameter
   21 |     template<int sigma>
      |              ^~~
a.cc:18:10: note: template parameter 'sigma' declared here
   18 | template<int sigma, int a>
      |          ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long 
const int maxn = 2e3 + 10;
const int maxL = 3e7 + 1000;
char s[maxL], tmp[maxL];
vector<char>book[maxn];
int sum[maxL], son[maxL][26], letsum[maxn];
int cnt = 27;
class Trie{
public:
	int ROOT;
	void Insert(char *s) {
		int p = ROOT;
		int len = strlen(s);
		for (int i = 0; i < len; ++i) {
			sum[p]++;
			if (!son[p][s[i] - 'a']) son[p][s[i] - 'a'] = ++cnt;
			p = son[p][s[i] - 'a'];
		}
		sum[p]++;
	}
	int Search(char *s) {
		int p = ROOT;
		int len = strlen(s);
		for (int i = 0; i < len; ++i) {
			if (!son[p][s[i] - 'a']) return 0;	
			p = son[p][s[i] - 'a'];
		}
		return sum[p];
	}
	void Solve(char *s) {
		int len = strlen(s);
		int c = 0;
		for (int i = len - 1; ~i; --i) tmp[c++] = s[i];
		tmp[c] = '\0';
		Insert(tmp);
	}	
	int Ask(char *s) {
		int len = strlen(s);
		int c = 0;
		for (int i = len - 1; ~i; --i) tmp[c++] = s[i];
		tmp[c] = '\0';
		return Search(tmp);
	}
}T[26];
int read() {
	int x;
	scanf("%d", &x); 
	return x;
}
int main() {
	#ifdef LOCAL
		freopen("1.in", "r", stdin);
	#endif
	int n = read();
	ll ans = 0;
	for (int i = 0; i < 26; ++i) T[i].ROOT = i;
	for (int Tas = 1; Tas <= n; ++Tas) {
		scanf("%s", s + 1);
		int len = strlen(s + 1);
		for (int i = 1; i <= len; ++i) {
			book[Tas].push_back(s[i]);	
		}
		if (len == 1) {
			letsum[s[1] - 'a']++;
		}
		else {
			int h[31];
			for (int i = 0; i <= 30; ++i) h[i] = 0;
			for (int i = 1; i <= len; ++i) {
				if (!h[s[i] - 'a']) { 
					h[s[i] - 'a'] = 1;
					T[s[i] - 'a'].Solve(s + i + 1);
				}
			}
			for (int i = 0; i < 25; ++i) if (h[i] != 0) letsum[i]++;
		}
	}
	for (int Tas = 1; Tas <= n; ++Tas) {
		int len = book[Tas].size();
		for (int i = 1; i <= len; ++i) s[i] = book[Tas][i - 1];
		s[len + 1] = '\0';
		if (len == 1) {
			ans += letsum[s[1] - 'a'] - 1;
		}
		else {
			ans += T[s[1] - 'a'].Ask(s + 2) - 1;
		}
	}
	cout << ans << endl;
	return 0;	
}

Compiler output:
/tmp/ccuNxYTV.o: in function `main':
a.cc:(.text+0x5c): relocation truncated to fit: R_X86_64_PC32 against symbol `T' defined in .bss section in /tmp/ccuNxYTV.o
a.cc:(.text+0x11a): relocation truncated to fit: R_X86_64_PC32 against symbol `letsum' defined in .bss section in /tmp/ccuNxYTV.o
a.cc:(.text+0x131): relocation truncated to fit: R_X86_64_PC32 against symbol `letsum' defined in .bss section in /tmp/ccuNxYTV.o
a.cc:(.text+0x1d5): relocation truncated to fit: R_X86_64_PC32 against symbol `T' defined in .bss section in /tmp/ccuNxYTV.o
a.cc:(.text+0x234): relocation truncated to fit: R_X86_64_PC32 against symbol `letsum' defined in .bss section in /tmp/ccuNxYTV.o
a.cc:(.text+0x24e): relocation truncated to fit: R_X86_64_PC32 against symbol `letsum' defined in .bss section in /tmp/ccuNxYTV.o
a.cc:(.text+0x32d): relocation truncated to fit: R_X86_64_PC32 against symbol `letsum' defined in .bss section in /tmp/ccuNxYTV.o
a.cc:(.text+0x359): relocation truncated to fit: R_X86_64_PC32 against symbol `T' defined in .bss section in /tmp/ccuNxYTV.o
collect2: error: ld returned 1 exit status
Language: C++

#include<bits/stdc++.h>
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/detail/standard_policies.hpp>
// using namespace __gnu_pbds;

#pragma GCC optimize("O3")
#ifdef LOCAL
#include "/Users/lbjlc/Desktop/coding/debug_utils.h"
#else
#define print(...) ;
#define printn(...) ;
#define printg(...) ;
#define fprint(...) ;
#define fprintn(...) ;
#endif

#define rep(i, a, b) for(auto i = (a); i < (b); i++)
#define rrep(i, a, b) for(auto i = (a); i > (b); i--)
#define all(v) (v).begin(), (v).end()
#define pb push_back
// #define mp make_pair
#define fi first
#define se second
#define maxi(x, y) x = max(x, y)
#define mini(x, y) x = min(x, y)
// long long fact(long long n) { if(!n) return 1; return n*fact(n-1); }
// #define endl '\n'
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define solve_testcase int T;cin>>T;for(int t=1;t<=T;t++){solve(t);}


typedef unsigned long long ull;
typedef long long ll;
 
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<pdd> vpdd;
typedef vector<long long> vll;
#define bd(type,op,val) bind(op<type>(), std::placeholders::_1, val)

template<class T>
void make_unique(T & v) {
    sort(v.begin(), v.end()); v.erase(unique(v.begin(), v.end()), v.end());
}
int geti() { int x; cin >> x; return x; }
long long getll() { long long x; cin >> x; return x; }
double getd() { double x; cin >> x; return x; }
// pair<int, int> a(geti(), geti()) does not work
// pair<int, int> a({geti(), geti()}) works, since it uses initializer.

const int MAXN = 5e6+500;


int nxt[2][MAXN][26]

void solve(int tt) {
    cout<<"Case #"<<tt<<": ";
}

// int n;
// string s[20010];

int main(int argc, char * argv[]) {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    // solve_testcase;



    return 0;
}




















Compiler output:
a.cc:64:1: error: expected initializer before 'void'
   64 | void solve(int tt) {
      | ^~~~
Language: Java

import codejam.y2019.round1a.C;

import javax.swing.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

	static PrintWriter out;

	public static void main(String[] args) throws IOException {
		MyScanner sc = new MyScanner();
		out = new PrintWriter(System.out);
		int N = sc.nextInt();
		char[][] words = new char[N][];
		root = new Node();
		for (int i = 0; i < N; i++) {
			words[i] = sc.next().toCharArray();
			insert(words[i], root, words[i].length - 1);
		}
		//print(root, "\t");
		long ans = 0;
		for (int i = 0; i < N; i++) {
			ans += calc(words[i]);
		}
		out.println(ans);
		
		out.flush();
	}

	static Node root;

	static class Node {
		Node[] children;
		int[] count;

		public Node() {
			children = new Node[26];
			count = new int[26];
		}
	}

	static int insert(char[] word, Node node, int pos) {
		if (pos == -1) return 0;
		int idx = word[pos] - 'a';
		Node child = node.children[idx];
		if (child == null) {
			node.children[idx] = child = new Node();
		}
		int ret = insert(word, child, pos - 1) | (1 << idx);
		for (int i = 0; i < 26; i++) if (contains(ret, i)) {
			node.count[i]++;
		}
		return ret | (1 << idx);
	}

	static int calc(char[] word) {
		Node cur = root;
		for (int i = word.length - 1; i >= 1; i--) {
			cur = cur.children[word[i] - 'a'];
		}
		//System.err.println(new String(word) + " => " + cur.count[word[0] - 'a']);
		return cur.count[word[0] - 'a'] - 1;
	}

	static void print(Node node, String tab) {
		if (node == null) throw new RuntimeException();
		for (int i = 0; i < 26; i++) {
			if (node.count[i] > 0) {
				System.err.print(tab + " count= " + (char) (i + 'a') + " => " + node.count[i]);
			}
		}
		System.err.println();
		for (int i = 0; i < 26; i++) {
			if (node.children[i] != null) {
				print(node.children[i], tab + (char) (i + 'a'));
			}
		}
	}

	static boolean contains(int mask, int pos) {
		return (mask & (1<<pos)) != 0;
	}

	static class MyScanner {
		private BufferedReader br;
		private StringTokenizer tokenizer;
		
		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		
		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}
		
		public int nextInt() {
			return Integer.parseInt(next());
		}
		
		public long nextLong() {
			return Long.parseLong(next());
		}
	}
}


Compiler output:
Main.java:1: error: package codejam.y2019.round1a does not exist
import codejam.y2019.round1a.C;
                            ^
1 error
Language: C++

#include <bits/stdc++.h>
#include <bits/extc++.h>
using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<ll, ll> hashVal;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int K = 26;
const ll mod1 = 1e9 + 7;
const ll mod2 = 1e9 + 9;

inline hashVal operator+(hashVal a, hashVal b){
	ll x = a.first + b.first; if(x >= mod1)x -= mod1;
	ll y = a.second + b.second; if(y >= mod2)y -= mod2;
	return {x, y};
}

inline hashVal operator-(hashVal a, hashVal b){
	ll x = a.first - b.first; if(x < 0)x += mod1;
	ll y = a.second - b.second; if(y < 0)y += mod2;
	return {x, y};
}

inline hashVal operator*(hashVal a, hashVal b){
	return {a.first*b.first%mod1, a.second*b.second%mod2};
}

inline hashVal operator*(hashVal a, ll k){
	return {a.first*k%mod1, a.second*k%mod2};
}

inline hashVal operator*(ll k, hashVal a){
	return {a.first*k%mod1, a.second*k%mod2};
}

hashVal base, val[K];

void pre(){
	base = {0, 0};
	while(base.first == 0 || base.second == 0){
		base = {rng()%mod1, rng()%mod2};
	}
	for(int i = 0; i < K; i++){
		val[i] = {0, 0};
		while(val[i].first == 0 || val[i].second == 0){
			val[i] = {rng()%mod1, rng()%mod2};
			for(int j = 0; j < i; j++){
				if(val[i].first == val[j].first || val[i].second == val[j].second){
					val[i] = {0, 0};
					break;
				}
			}
			if(val[i].first == base.first || val[i].second == base.second){
				val[i] = {0, 0};
			}
		}
	}
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout<<setprecision(32);

	pre();
	int n; cin>>n;
	vector<string> v(n);
	for(auto &x : v){
		cin>>x;
	}
	sort(v.begin(), v.end(), [](string &a, string &b){
		return a.size() < b.size();
	});
	gp_hash_table<hashVal, int> mp;
	ll ans = 0;
	for(int i = 0; i < n; i++){
		reverse(v[i].begin(), v[i].end());
		vector<int> f(K);
		for(auto ch : v[i]){
			f[ch - 'a']++;
		}
		int sz = v[i].size();
		hashVal hv = {0, 0};
		for(int j = 0; j < sz; j++){
			for(int k = 0; k < K; k++){
				if(f[k]){
					hashVal tmp = hv*base + val[k];
					auto it = mp.find(tmp);
					if(it != mp.end())ans += it->second;
				}
			}
			f[v[i][j] - 'a']--;
			hv = hv*base + val[v[i][j] - 'a'];
		}
		mp[hv]++;
	}
	cout<<ans;


	return 0;
}

Compiler output:
/usr/bin/ld: /tmp/ccAjRJZ6.o: in function `__gnu_pbds::detail::ranged_probe_fn<std::pair<long long, long long>, std::tr1::hash<std::pair<long long, long long> >, std::allocator<char>, __gnu_pbds::direct_mask_range_hashing<unsigned long>, __gnu_pbds::linear_probe_fn<unsigned long>, false>::operator()(std::pair<long long, long long> const&) const':
a.cc:(.text._ZNK10__gnu_pbds6detail15ranged_probe_fnISt4pairIxxENSt3tr14hashIS3_EESaIcENS_25direct_mask_range_hashingImEENS_15linear_probe_fnImEELb0EEclERKS3_[_ZNK10__gnu_pbds6detail15ranged_probe_fnISt4pairIxxENSt3tr14hashIS3_EESaIcENS_25direct_mask_range_hashingImEENS_15linear_probe_fnImEELb0EEclERKS3_]+0x2b): undefined reference to `std::tr1::hash<std::pair<long long, long long> >::operator()(std::pair<long long, long long>) const'
collect2: error: ld returned 1 exit status