Language: C++

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


typedef unsigned slong long Hash;
long long mod = 1000000009;
template<class T>

class RollingHash{
public:
	T src;
	vector<Hash> harr,p;
	
	vector<int> suffixArray;
	RollingHash(T src,Hash w=8999):src(src){
		p.resize(src.size()+1);
		Hash sum = 0;
		for(int i = 0 ; i < src.size() ; i++){
			sum = sum * w + src[i];
			//sum %= mod;
			harr.push_back(sum);
		}
		p[0] = 1;
		for(int i = 1 ; i < p.size() ; i++){
			p[i] = p[i-1] * w;
			//p[i] %= mod;
		}
	}
	// [l,r)
	Hash sub(int l,int r) const{
		if( l >= r ) return 0;
		return harr[r-1] - (l?harr[l-1] * p[r-l]:0);
	}
};

int main(){
	string S,T;
	cin >> S >> T;
	RollingHash<string> s(S),t(T);
	int ans = 0;
	for(int i = 0 ; i+T.size() <= S.size() ; i++){
		int l = i, r = i+T.size();
		if( s.sub(l,r) == t.sub(0,T.size()) ) continue;
		
		while( l != r ){
			int m = (l+r)/2;
			if( s.sub(i,m) == t.sub(0,m-l) ){
				l = m+1;
			}else{
				r = m;
			}
		}
		// cout << i << " " << l << " " << S[l] << endl;
		if( s.sub(i,l-1) == t.sub(0,l-i-1) && s.sub(l+1,i+T.size()) == t.sub(l+1-i,T.size()) ) ans++;
	}
	cout << ans << endl;
}

Compiler output:
a.cc:5:24: error: expected initializer before 'long'
    5 | typedef unsigned slong long Hash;
      |                        ^~~~
a.cc:12:16: error: 'Hash' was not declared in this scope
   12 |         vector<Hash> harr,p;
      |                ^~~~
a.cc:12:20: error: template argument 1 is invalid
   12 |         vector<Hash> harr,p;
      |                    ^
a.cc:12:20: error: template argument 2 is invalid
a.cc:15:27: error: 'Hash' has not been declared
   15 |         RollingHash(T src,Hash w=8999):src(src){
      |                           ^~~~
a.cc:30:9: error: 'Hash' does not name a type
   30 |         Hash sub(int l,int r) const{
      |         ^~~~
a.cc: In constructor 'RollingHash<T>::RollingHash(T, int)':
a.cc:16:19: error: request for member 'resize' in '((RollingHash<T>*)this)->RollingHash<T>::p', which is of non-class type 'int'
   16 |                 p.resize(src.size()+1);
      |                   ^~~~~~
a.cc:17:17: error: 'Hash' was not declared in this scope
   17 |                 Hash sum = 0;
      |                 ^~~~
a.cc:19:25: error: 'sum' was not declared in this scope
   19 |                         sum = sum * w + src[i];
      |                         ^~~
a.cc:21:30: error: request for member 'push_back' in '((RollingHash<T>*)this)->RollingHash<T>::harr', which is of non-class type 'int'
   21 |                         harr.push_back(sum);
      |                              ^~~~~~~~~
a.cc:23:18: error: invalid types 'int[int]' for array subscript
   23 |                 p[0] = 1;
      |                  ^
a.cc:24:39: error: request for member 'size' in '((RollingHash<T>*)this)->RollingHash<T>::p', which is of non-class type 'int'
   24 |                 for(int i = 1 ; i < p.size() ; i++){
      |                                       ^~~~
a.cc:25:26: error: invalid types 'int[int]' for array subscript
   25 |                         p[i] = p[i-1] * w;
      |                          ^
a.cc:25:33: error: invalid types 'int[int]' for array subscript
   25 |                         p[i] = p[i-1] * w;
      |                                 ^
a.cc: In function 'int main()':
a.cc:43:23: error: 'class RollingHash<std::__cxx11::basic_string<char> >' has no member named 'sub'
   43 |                 if( s.sub(l,r) == t.sub(0,T.size()) ) continue;
      |                       ^~~
a.cc:43:37: error: 'class RollingHash<std::__cxx11::basic_string<char> >' has no member named 'sub'
   43 |                 if( s.sub(l,r) == t.sub(0,T.size()) ) continue;
      |                                     ^~~
a.cc:47:31: error: 'class RollingHash<std::__cxx11::basic_string<char> >' has no member named 'sub'
   47 |                         if( s.sub(i,m) == t.sub(0,m-l) ){
      |                               ^~~
a.cc:47:45: error: 'class RollingHash<std::__cxx11::basic_string<char> >' has no member named 'sub'
   47 |                         if( s.sub(i,m) == t.sub(0,m-l) ){
      |                                             ^~~
a.cc:54:23: error: 'class RollingHash<std::__cxx11::basic_string<char> >' has no member named 'sub'
   54 |                 if( s.sub(i,l-1) == t.sub(0,l-i-1) && s.sub(l+1,i+T.size()) == t.sub(l+1-i,T.size()) ) ans++;
      |                       ^~~
a.cc:54:39: error: 'class RollingHash<std::__cxx11::basic_string<char> >' has no member named 'sub'
   54 |                 if( s.sub(i,l-1) == t.sub(0,l-i-1) && s.sub(l+1,i+T.size()) == t.sub(l+1-i,T.size()) ) ans++;
      |                                       ^~~
a.cc:54:57: error: 'class RollingHash<std::__cxx11::basic_string<char> >' has no member named 'sub'
   54 |                 if( s.sub(i,l-1) == t.sub(0,l-i-1) && s.sub(l+1,i+T.size()) == t.sub(l+1-i,T.size()) ) ans++;
      |                                                         ^~~
a.cc:54:82: error: 'class RollingHash<std::__cxx11::basic_string<char> >' has no member named 'sub'
   54 |                 if( s.sub(i,l-1) == t.sub(0,l-i-1) && s.sub(l+1,i+T.size()) == t.sub(l+1-i,T.size()) ) ans++;
      |                                                                                  ^~~