Language: C++

#include <bits/stdc++.h>
typedef (unsigned __int128) ull;
using namespace std;

const ull B = 100000007;

ull Rev(ull a) {
	ull res = 1;
	for (ull i = 0; i < 0x80; i++) {
		res *= a;
		a *= a;
	}
	return res;
}

ull Pow(ull a, ull b) {
	ull res = 1;
	for (ull i = 0; i < 0x80;i++) {
		if (b & (1ull << i)) {
			res *= a;
		}
		a *= a;
	}
	return res;
}

int main()
{
	ull n, m, l = 0, r = 0;
	ull hash;
	string S, cmd;
	set<ull> hass;
	cin.sync_with_stdio(false);
	cin >> n >> m >> S;
	hash = S[0];
	while (m--) {
		cin >> cmd;
		if (cmd == "L++") {
			hash -= Pow(B, r - l) * S[l];
			l++;
		}
		else if (cmd == "L--") {
			l--;
			hash += Pow(B, r - l) * S[l];
		}
		else if (cmd == "R++") {
			r++;
			hash = hash * B + S[r];
		}
		else if (cmd == "R--") {
			hash = (hash - S[r]) * Rev(B);
			r--;
		}
		hass.insert(hash);
	}
	cout << hass.size() << endl;
	return 0;
}

Compiler output:
a.cc:2:10: error: expected unqualified-id before 'unsigned'
    2 | typedef (unsigned __int128) ull;
      |          ^~~~~~~~
a.cc:2:10: error: expected ')' before 'unsigned'
    2 | typedef (unsigned __int128) ull;
      |         ~^~~~~~~~
      |          )
a.cc:5:7: error: 'ull' does not name a type
    5 | const ull B = 100000007;
      |       ^~~
a.cc:7:1: error: 'ull' does not name a type
    7 | ull Rev(ull a) {
      | ^~~
a.cc:16:1: error: 'ull' does not name a type
   16 | ull Pow(ull a, ull b) {
      | ^~~
a.cc: In function 'int main()':
a.cc:29:9: error: 'ull' was not declared in this scope
   29 |         ull n, m, l = 0, r = 0;
      |         ^~~
a.cc:30:12: error: expected ';' before 'hash'
   30 |         ull hash;
      |            ^~~~~
      |            ;
a.cc:32:16: error: template argument 2 is invalid
   32 |         set<ull> hass;
      |                ^
a.cc:32:16: error: template argument 3 is invalid
a.cc:34:16: error: 'n' was not declared in this scope
   34 |         cin >> n >> m >> S;
      |                ^
a.cc:34:21: error: 'm' was not declared in this scope
   34 |         cin >> n >> m >> S;
      |                     ^
a.cc:35:14: error: expected unqualified-id before '=' token
   35 |         hash = S[0];
      |              ^
a.cc:39:30: error: expected unqualified-id before '-=' token
   39 |                         hash -= Pow(B, r - l) * S[l];
      |                              ^~
a.cc:40:25: error: 'l' was not declared in this scope
   40 |                         l++;
      |                         ^
a.cc:43:25: error: 'l' was not declared in this scope
   43 |                         l--;
      |                         ^
a.cc:44:30: error: expected unqualified-id before '+=' token
   44 |                         hash += Pow(B, r - l) * S[l];
      |                              ^~
a.cc:47:25: error: 'r' was not declared in this scope
   47 |                         r++;
      |                         ^
a.cc:48:30: error: expected unqualified-id before '=' token
   48 |                         hash = hash * B + S[r];
      |                              ^
a.cc:51:30: error: expected unqualified-id before '=' token
   51 |                         hash = (hash - S[r]) * Rev(B);
      |                              ^
a.cc:52:25: error: 'r' was not declared in this scope
   52 |                         r--;
      |                         ^
a.cc:54:22: error: request for member 'insert' in 'hass', which is of non-class type 'int'
   54 |                 hass.insert(hash);
      |                      ^~~~~~
a.cc:54:33: error: missing template arguments before ')' token
   54 |                 hass.insert(hash);
      |                                 ^
a.cc:56:22: error: request for member 'size' in 'hass', which is of non-class type 'int'
   56 |         cout << hass.size() << endl;
      |                      ^~~~