Language: C++

#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n;string s;
	int q;
	cin>>n;
	cin>>s;
	cin>>q;
	while(q--)
	{
		ll d=0,m=0,dm=0,dmc=0;
		int k;
		scanf("%d",&k);
		for(int i=0;i<k;i++)
		{
			if(s[i]=='D')
			{
				d++;
			}
			else if(s[i]=='M')
			{
				dm+=d;m++;
			}
			else if(s[i]=='C')
			{
				dmc+=dm;
			}
		}
		for(int i=k;i<n;i++)
		{
			if(s[i-k]=='D')
			{
				d--;dm-=m;
			}
			else if(s[i-k]=='M')
			{
				m--;
			}
			if(s[i]=='D')
			{
				d++;
			}
			else if(s[i]=='M')
			{
				dm+=d;m++;
			}
			else if(s[i]=='C')
			{
				dmc+=dm;
			}
		}
		printf("%lld\n",dmc);
	}
 } 


Compiler output:
a.cc: In function 'int main()':
a.cc:12:17: error: 'll' was not declared in this scope
   12 |                 ll d=0,m=0,dm=0,dmc=0;
      |                 ^~
a.cc:19:33: error: 'd' was not declared in this scope
   19 |                                 d++;
      |                                 ^
a.cc:23:33: error: 'dm' was not declared in this scope; did you mean 'tm'?
   23 |                                 dm+=d;m++;
      |                                 ^~
      |                                 tm
a.cc:23:37: error: 'd' was not declared in this scope
   23 |                                 dm+=d;m++;
      |                                     ^
a.cc:23:39: error: 'm' was not declared in this scope
   23 |                                 dm+=d;m++;
      |                                       ^
a.cc:27:33: error: 'dmc' was not declared in this scope
   27 |                                 dmc+=dm;
      |                                 ^~~
a.cc:27:38: error: 'dm' was not declared in this scope; did you mean 'tm'?
   27 |                                 dmc+=dm;
      |                                      ^~
      |                                      tm
a.cc:34:33: error: 'd' was not declared in this scope
   34 |                                 d--;dm-=m;
      |                                 ^
a.cc:34:37: error: 'dm' was not declared in this scope; did you mean 'tm'?
   34 |                                 d--;dm-=m;
      |                                     ^~
      |                                     tm
a.cc:34:41: error: 'm' was not declared in this scope
   34 |                                 d--;dm-=m;
      |                                         ^
a.cc:38:33: error: 'm' was not declared in this scope
   38 |                                 m--;
      |                                 ^
a.cc:42:33: error: 'd' was not declared in this scope
   42 |                                 d++;
      |                                 ^
a.cc:46:33: error: 'dm' was not declared in this scope; did you mean 'tm'?
   46 |                                 dm+=d;m++;
      |                                 ^~
      |                                 tm
a.cc:46:37: error: 'd' was not declared in this scope
   46 |                                 dm+=d;m++;
      |                                     ^
a.cc:46:39: error: 'm' was not declared in this scope
   46 |                                 dm+=d;m++;
      |                                       ^
a.cc:50:33: error: 'dmc' was not declared in this scope
   50 |                                 dmc+=dm;
      |                                 ^~~
a.cc:50:38: error: 'dm' was not declared in this scope; did you mean 'tm'?
   50 |                                 dmc+=dm;
      |                                      ^~
      |                                      tm
a.cc:53:33: error: 'dmc' was not declared in this scope
   53 |                 printf("%lld\n",dmc);
      |                                 ^~~