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

#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
#include<stack>
#include<memory>
#include<math.h>

using namespace std;
typedef long long ll;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
typedef pair < int, int> P;
/****Union-Ford-Tree***/
int par[int(0x7ffffff)];//Parent
int Rank[int(0x7ffffff)];//Deep_of_the_Tree

//int a[100] = { 4,2,3,1,5 }, m[100] ={3,2,2};
//int n = 0;
//const ll mod = 1000000007;


//n要素で初期化
void init(int n) {
	for (int i = 0; i < n; i++) {
		par[i] = i;
		Rank[i] = 0;
	}
}
//木の根探し
int find(int x) {
	if (par[x] == x) {
		return x;
	}
	else {
		return par[x] = find(par[x]);
	}
}
//xとyの属する集合を併合
void unite(int x, int y) {
	x = find(x);
	y = find(y);
	if (x == y)return;

	if (Rank[x] < Rank[y]) {
		par[x] = y;
	}
	else {
		par[y] = x;
		if (Rank[x] == Rank[y])Rank[x]++;
	}
}

bool same(int x, int y) {
	return find(x) == find(y);
}
ll dp[1000][1000];
int main()
{
	memset(dp[0], -1,sizeof(dp));
	int n, k;
	cin >> n >> k;
	vector<ll> a(n);
	ll ans = 0;
	ll sum = 0;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		sum += a[i];
	}
	for (int i = 0; i < n; i++) {
		for (int j = i; j < n; j++) {
			if (j == i) {
				dp[i][j] = a[i];
			}
			else {
				dp[i][j] = dp[i][j - 1] + a[j];
			}
		}
	}
	int p = 999, o = 999;
	sort(dp[0], dp[0] + 1000 * 1000);
	//cout << dp[999][991] << endl;
	for (int i = 0; i < k; i++) {
		sum &= dp[p][o];
		
		if (o == 0) {
			p--;
			o = 999;
			continue;
		}
		o--;
	}
	cout << sum << endl;
	

	

}

Compiler output:
a.cc: In function 'int main()':
a.cc:76:9: error: 'memset' was not declared in this scope
   76 |         memset(dp[0], -1,sizeof(dp));
      |         ^~~~~~
a.cc:23:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   22 | #include<math.h>
  +++ |+#include <cstring>
   23 |
Language: Java

function main(input){
    var lines = input.replace('\n',' ');
    lines = lines.split(" ");
    var N = lines[0];
    var K = lines[1];
    lines.splice(0,2);

    var utu=[K];

    for(var i=0;i < K;i++){
    	utu[i]=0;
    }

    var max=0;
    var mem=0;
    for (var i=0;i<N ;i++ ) {
    	var k=i+1;
    	while(N-k>=0){
    		for (var u=i;u<k ;u++ ) {
    			mem+=Number(lines[u]);
    		}
    		k++;
    		if(utu[0]<mem){
    			utu[0]=mem;
    			utu=utu.sort(compareNumbers);
    		}
    		mem=0;
    	}
    }
    max=utu[0];
    for (var i=1;i<K;i++){
    	max&=utu[i];
    }
    console.log(max);
}

function compareNumbers(a, b) {
  return a - b;
}

main(require('fs').readFileSync('/dev/stdin', 'UTF-8'));

Compiler output:
Main.java:8: error: not a statement
    var utu=[K];
             ^
Main.java:1: error: unnamed classes are a preview feature and are disabled by default.
function main(input){
^
  (use --enable-preview to enable unnamed classes)
Main.java:1: error: <identifier> expected
function main(input){
                   ^
Main.java:8: error: illegal start of expression
    var utu=[K];
            ^
Main.java:8: error: ';' expected
    var utu=[K];
              ^
Main.java:37: error: <identifier> expected
function compareNumbers(a, b) {
                         ^
Main.java:37: error: <identifier> expected
function compareNumbers(a, b) {
                            ^
Main.java:41: error: class, interface, enum, or record expected
main(require('fs').readFileSync('/dev/stdin', 'UTF-8'));
^
Main.java:41: error: unclosed character literal
main(require('fs').readFileSync('/dev/stdin', 'UTF-8'));
             ^
Main.java:41: error: unclosed character literal
main(require('fs').readFileSync('/dev/stdin', 'UTF-8'));
                ^
Main.java:41: error: unclosed character literal
main(require('fs').readFileSync('/dev/stdin', 'UTF-8'));
                                ^
Main.java:41: error: unclosed character literal
main(require('fs').readFileSync('/dev/stdin', 'UTF-8'));
                                           ^
Main.java:41: error: unclosed character literal
main(require('fs').readFileSync('/dev/stdin', 'UTF-8'));
                                              ^
Main.java:41: error: unclosed character literal
main(require('fs').readFileSync('/dev/stdin', 'UTF-8'));
                                                    ^
14 errors
Language: Java

function main(input){
    var lines = input.replace('\n',' ');
    lines = lines.split(" ");
    var N = lines[0];
    var K = lines[1];
    lines.splice(0,2);

    var utu=[K];

    for(var i=0;i < K;i++){
    	utu[i]=0;
    }

    var max=0;
    var mem=0;
    for (var i=0;i<N ;i++ ) {
    	var k=i+1;
    	while(N-k>=0){
    		for (var u=i;u<k ;u++ ) {
    			mem+=Number(lines[u]);
    		}
    		k++;
    		if(utu[0]<mem){
    			utu[0]=mem;
    			utu=utu.sort(compareNumbers);
    		}
    		mem=0;
    	}
    }
    max=utu[0];
    for (var i=1;i<K;i++){
    	max&=utu[i];
    }
    console.log(max);
}

main(require('fs').readFileSync('/dev/stdin', 'UTF-8'));
function compareNumbers(a, b) {
  return a - b;
}

Compiler output:
Main.java:8: error: not a statement
    var utu=[K];
             ^
Main.java:1: error: unnamed classes are a preview feature and are disabled by default.
function main(input){
^
  (use --enable-preview to enable unnamed classes)
Main.java:1: error: <identifier> expected
function main(input){
                   ^
Main.java:8: error: illegal start of expression
    var utu=[K];
            ^
Main.java:8: error: ';' expected
    var utu=[K];
              ^
Main.java:37: error: class, interface, enum, or record expected
main(require('fs').readFileSync('/dev/stdin', 'UTF-8'));
^
Main.java:37: error: unclosed character literal
main(require('fs').readFileSync('/dev/stdin', 'UTF-8'));
             ^
Main.java:37: error: unclosed character literal
main(require('fs').readFileSync('/dev/stdin', 'UTF-8'));
                ^
Main.java:37: error: unclosed character literal
main(require('fs').readFileSync('/dev/stdin', 'UTF-8'));
                                ^
Main.java:37: error: unclosed character literal
main(require('fs').readFileSync('/dev/stdin', 'UTF-8'));
                                           ^
Main.java:37: error: unclosed character literal
main(require('fs').readFileSync('/dev/stdin', 'UTF-8'));
                                              ^
Main.java:37: error: unclosed character literal
main(require('fs').readFileSync('/dev/stdin', 'UTF-8'));
                                                    ^
Main.java:38: error: <identifier> expected
function compareNumbers(a, b) {
                         ^
Main.java:38: error: <identifier> expected
function compareNumbers(a, b) {
                            ^
14 errors
Language: C++

#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;

#define ll long long
#define DEBUG(x) cout << "DEBUG>" << #x << ":" << x << endl;
#define REP(i,n) for(ll i=0;i<(n);i++)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}

int main() {
  int N, K;
  cin >> N >> K;
  vector<ll> a(N);
  REP(i, N) {
    cin >> a[i];
  }
  vector<ll> b;
  REP(i, N) {
    REP(j, N - i) {
      ll bv = 0;
      REP(k, i + 1) {
        bv += a[j + k];
      }
      b.push_back(bv);
    }
  }
  ll k;
  sort(b.begin(), b.end());
  REP(i, 64) {
    k = pow(2, i);
    int co = 0;
    REP(i, b.size()) {
      if(b[i] >= k) {
        co++;
      }
    }
    if(co < K) {
      k = pow(2, i - 1);
      break;
    }
  }
  vector<ll> vv;
  REP(i, b.size()) {
    if(b[i] >= k) {
      vv.push_back(b[i]);
    }
  }
  ll ans = 0;
  int bit = vv.size();
  for(int mask = 0; mask < pow(2, bit); mask++) {
    int count = 0;
    vector<ll> v;
    for(int i = 0; i < bit; i++) {
      if(mask >> i & 1) {
        count++;
        v.push_back(vv[i]);
      } else {
      }
      if(count == K) {
        ll anscmp = v[0];
        for(int j = 1; j < v.size(); j++) {
          anscmp = anscmp & v[j];
        }
        ans = max(ans, anscmp);
      }
    }
  }


Compiler output:
a.cc: In function 'int main()':
a.cc:70:4: error: expected '}' at end of input
   70 |   }
      |    ^
a.cc:13:12: note: to match this '{'
   13 | int main() {
      |            ^
Language: C++

#include <cstdio>
#include <vector>
typedef long long int ll;
int a[1005];std::vector<ll> vec;
int main() {
	int n,k;scanf("%d%d",&n,&k);
	for(register int i=0;i<n;++i) scanf("%d",a+i);
	for(register int i=0;i<n;++i) {
		ll now=0;
		for(register int j=i;j<n;++j) {
			now+=a[j];vec.push_back(now);
		}
	}
	std::sort(vec.begin(),vec.end());
	std::reverse(vec.begin(),vec.end());
	ll ans=(1LL<<60)-1;
	for(register int i=0;i<k;++i) ans&=vec[i];
	printf("%lld\n",ans);
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
    7 |         for(register int i=0;i<n;++i) scanf("%d",a+i);
      |                          ^
a.cc:8:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
    8 |         for(register int i=0;i<n;++i) {
      |                          ^
a.cc:10:34: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   10 |                 for(register int j=i;j<n;++j) {
      |                                  ^
a.cc:14:14: error: 'sort' is not a member of 'std'
   14 |         std::sort(vec.begin(),vec.end());
      |              ^~~~
a.cc:15:14: error: 'reverse' is not a member of 'std'
   15 |         std::reverse(vec.begin(),vec.end());
      |              ^~~~~~~
a.cc:17:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   17 |         for(register int i=0;i<k;++i) ans&=vec[i];
      |                          ^
Language: C++

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

int main() {
  int N, K; std::cin >> N >> K;
  std::vector<long long> a(N);
  for (int i = 0; i < N; ++i) {
    std::cin >> a[i];
  }

  long long total = std::accumulate(a.begin(), a.end(), 0);

  std::vector<long long> scores;
  for (int i = 0; i < N; ++i) {
    long long sum = 0;
    for (int j = i; j < N; ++j) {
      sum = sum + a[j];
      scores.push_back(total & sum);
    }
  }

  std::sort(scores.begin(), scores.end(), std::greater<long long>());
  std::cout << scores[K-1] << std::endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:26: error: 'accumulate' is not a member of 'std'
   12 |   long long total = std::accumulate(a.begin(), a.end(), 0);
      |                          ^~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define forx(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) for (int i = 0; i < (n); i++)



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

    int n,k;
    cin >> n>>k;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];

    vector<ll> s;

    rep(i,n){
        ll x = 0;
        forx(j,i,n){
            x += a[j];
            s.push_back(x);
        }
    }
    sort(s.begin(), s.end());
    reverse(s.begin(), s.end());

    ll y = s[k-1];
    while(y>0){
        ll t=0;
        rep(i, n * (n + 1) / 2) if ((y & s[i]) == y) t++;
        if(t>=k)
            break;
        y--;
    }

    cout << y << endl;
    return 0;
}
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define forx(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) for (int i = 0; i < (n); i++)



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

    int n,k;
    cin >> n>>k;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];

    vector<ll> s;

    rep(i,n){
        ll x = 0;
        forx(j,i,n){
            x += a[j];
            s.push_back(x);
        }
    }
    sort(s.begin(), s.end());
    reverse(s.begin(), s.end());

    ll y = s[k-1];
    while(y>0){
        ll t=0;
        rep(i, n * (n + 1) / 2) if ((y & s[i]) == y) t++;
        if(t>=k)
            break;
        y--;
    }

    cout << y << endl;
    return 0;
}


Compiler output:
a.cc:51:5: error: redefinition of 'int main()'
   51 | int main()
      |     ^~~~
a.cc:9:5: note: 'int main()' previously defined here
    9 | int main()
      |     ^~~~
Language: C++

#include <iostream>
#include<vector>
#include<queue>
#include<string>
#include<sstream>
#include<algorithm>
#include<bitset>
#include<list>
using namespace std;

int N,K;
int a[10000000];
bool Nbit[10000000][50];
int main() {
	cin >> N >> K;
	for (int i = 0; i < N; i++) {
		cin >> a[i];
	}
	int countnum = 0;
	for (int i = 0; i < N; i++) {
		long long int num1 = 0;
		for (int j = i; j < N; j++) {
			num1 += a[j];
			long long int num2 = num1;
			for (int k = 0; k < 41; k++) {
				Nbit[countnum][k] = num2 % 2;
				num2 /= 2;
			}
			countnum++;
		}
	}
	long long int ans = 0;
	list<int> v;
	for (int i = 0; i < countnum; i++) {
		v.push_back(i);
	}
	int nowbit = 41;
	while (true) {
		/*
		for (auto itr = v.begin(); itr != v.end(); itr++) {
			cout << *itr << endl;
		}
		*/
		if (nowbit == -1)break;
		int count = 0;
		for (auto itr = v.begin(); itr!=v.end(); itr++) {
			count += Nbit[*itr][nowbit];
		}
		if (count >= K) {
			ans += pow(2, nowbit);
			int vsize = v.size();
			int inum = 0;
			for (list<int>::iterator itr = v.begin(); inum<vsize; itr++) {
				if (Nbit[*itr][nowbit]) {
					v.push_back(*itr);
				}
				inum++;
			}
			for (int i = 0; i < vsize; i++) {
				v.pop_front();
			}
		}
		nowbit--;
	}
	/*
	for (int i = 0; i < N; i++) {
		for(int j=30;j>=0;j--){
			cout << Nbit[i][j];
		}
		cout << endl;
	}
	*/
	cout << ans << endl;
	cin >> N;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:50:32: error: 'pow' was not declared in this scope
   50 |                         ans += pow(2, nowbit);
      |                                ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
struct f {
	double no;
	double f;
};
f t[110];
double tot = 0;
double ans,mini = 1000000;
double doabs(double a) {
	if(a>0) return a;
	else return -a;
}
int main() {
	double n;
	scanf("%d",&n);
	for(int i=0;i<n;i++) {
		scanf("%d",&t[i].f);
		t[i].no = i;
		tot+=(double)t[i].f;
//		cout<<tot<<endl;
	}
//	tot+=0.0000001;
//	cout<<"tot = "<<tot<<endl;
	tot/=(double)n;
//	cout<<"tot = "<<tot<<endl;
//	sort(t,t+n,cmp);
	for(int i=0;i<n;i++)
		if(doabs(((double)t[i].f)-tot)<mini) {
			mini = doabs(((double)t[i].f)-tot);
			ans = t[i].no;
		}
	prdoublef("%d",ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:9: error: 'prdoublef' was not declared in this scope; did you mean 'double'?
   33 |         prdoublef("%d",ans);
      |         ^~~~~~~~~
      |         double
Language: C++

#include <stdio.h>
#include "math.h"
int calc(int a,int b)
{
	int ab[1000];
	int bb[1000];
	int counter=0;
	for (int i=0;i<1000;i++)
	{
		ab[i]=a%2;
		if(a==0)ab[i]=-1;
		a/=2;
		bb[i]=b%2;
		if(b==0)bb[i]=-1;
		b/=2;
		if(a==b&&a==0)break;
	}
	for (int i=0;i<1000;i++)
	{
		if(ab[i]==bb[i])counter+=ab[i]*pow(2,i);
		if(ab[i]==-1)break:
		if(bb[i]==-1)break;
	}
	return counter++;
}
int main(void)
{
	int N,K;
	int a[1000];
	scanf("%d",&N);
	scanf("%d",&K);
	int result[N*(N+1)/2];
	int number=0;
	int max=0;
	for (int i=0;i<N;i++)
	{
		scanf("%d",&a[i]);
	}
	for (int i=0;i<N;i++)
	{
		for (int j=i;j<N;j++)
		{
			for (int k=i;k<j+1;k++)	result[number]+=a[k];
			number++;
		}
	}
	for (int i=0;i<N*(N+1)/2;i++)
	{
		for (int j=i;j<N*(N+1)/2;j++)
		{
			if(calc(result[i],result[j])>max)
			{
				max=calc(result[i],result[j]);
			}	
		}	
	}
}

Compiler output:
a.cc: In function 'int calc(int, int)':
a.cc:21:35: error: expected ';' before ':' token
   21 |                 if(ab[i]==-1)break:
      |                                   ^
      |                                   ;
a.cc:21:35: error: expected primary-expression before ':' token
Language: C++

#include <stdio.h>
#include "math.h"
int calc(int a,int b)
{
	int ab[1000];
	int bb[1000];
	counter=0;
	for (int i=0;i<1000;i++)
	{
		ab[i]=a%2;
		if(a==0)ab[i]=-1;
		a/=2;
		bb[i]=b%2;
		if(b==0)bb[i]=-1;
		b/=2;
		if(a==b&&a==0)break;
	}
	for (int i=0;i<1000;i++)
	{
		if(ab[i]==bb[i])counter+=ab[i]*pow(2,i);
		if(ab[i]==-1)break:
		if(bb[i]==-1)break;
	}
	return counter++;
}
int main(void)
{
	int N,K;
	int a[1000];
	scanf("%d",&N);
	scanf("%d",&K);
	int result[N*(N+1)/2];
	int number=0;
	int max=0;
	for (int i=0;i<N;i++)
	{
		scanf("%d",&a[i]);
	}
	for (int i=0;i<N;i++)
	{
		for (int j=i;j<N;j++)
		{
			for (int k=i;k<j+1;k++)	result[number]+=a[k];
			number++;
		}
	}
	for (int i=0;i<N*(N+1)/2;i++)
	{
		for (int j=i;j<N*(N+1)/2;j++)
		{
			if(calc(result[i],result[j])>max)
			{
				max=calc(result[i],result[j]);
			}	
		}	
	}
}

Compiler output:
a.cc: In function 'int calc(int, int)':
a.cc:7:9: error: 'counter' was not declared in this scope
    7 |         counter=0;
      |         ^~~~~~~
a.cc:21:35: error: expected ';' before ':' token
   21 |                 if(ab[i]==-1)break:
      |                                   ^
      |                                   ;
a.cc:21:35: error: expected primary-expression before ':' token
Language: C++

#include <iostream>
#include <vector>

using namespace std;

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> v;
  for (int i = 0; i < N; ++i) {
    int e;
    cin >> e;
    v.push_back(e);
  }
  // calculate beauty
  vector<int> beauty;
  for (int i = 0; i < N; ++i) {
    int sum = 0;
    for (int j = 0; j < N - i; ++j) {
      sum += v[i + j];
      beauty.push_back(sum);
    }
  }
  // choose largest beauties
  // sort beauty as descending
  sort(beauty.begin(), beauty.end());
  reverse(beauty.begin(), beauty.end());
  int ans = beauty[0];
  for (int i = 1; i < K; ++i) {
    ans = (ans & beauty[i]);
  }
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   26 |   sort(beauty.begin(), beauty.end());
      |   ^~~~
      |   short
a.cc:27:3: error: 'reverse' was not declared in this scope
   27 |   reverse(beauty.begin(), beauty.end());
      |   ^~~~~~~
Language: C++

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

#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;

int main(){
    int i,j;
    int n,k;

    cin>>n>>k;
    ll a[n];

    for(i=0;i<n;i++){
        cin>>a[i];
    }
    ll suma[n+1];
    suma[0]=0;
    for(i=1;i<=n;i++){
        suma[i]=suma[i-1]+a[i-1];
    }

    vector<ll> b;
    for(i=0;i<n;i++){
        for(j=i;j<n;j++){
            b.push_back(suma[j+1]-suma[i]);
        }
    }


    int flag[31];
    for(i=0;i<31;i++) flag[i]=0;
    int rema[b.size()];
    for(i=0;i<b.size();i++) rema[i]=0;

    for(j=30;j>=0;j--){
        int cnt=0; c
        for(i=0;i<b.size();i++){
        if(rema[i]==0&&((b[i]>>j)&1==1)) cnt++;
        }


        if (cnt>=k){
            flag[j]=1;
            for(i=0;i<b.size();i++){
                if(rema[i]==0&&((b[i]>>j)&1==1)) cnt++;
                else rema[i]=1;
            }
        }
    }

    ll ans=0;
    for(j=30;j>=0;j--){
        ans*=2;
        ans+=flag[j];
    }
    cout<<ans<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:20: error: 'c' was not declared in this scope
   40 |         int cnt=0; c
      |                    ^
a.cc:41:31: error: expected ';' before ')' token
   41 |         for(i=0;i<b.size();i++){
      |                               ^
      |                               ;
Language: C++

# include <iostream>
# include <algorithm>
#include <array>
# include <cassert>
#include <cctype>
#include <climits>
#include <numeric>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
#include <stdio.h>
#include<time.h>
#include <stdlib.h>
#include <cstdint>
#include <cfenv>
#include<fstream>
//#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
long long MOD = 1000000000 + 7;
constexpr long long INF = numeric_limits<LL>::max();
const double PI = acos(-1);
#define fir first
#define sec second
#define thi third
#define debug(x) cerr<<#x<<": "<<x<<'\n'
typedef pair<LL, LL> Pll;
typedef pair<double, double> Dll;
typedef pair<LL, pair<LL, LL>> Ppll;
typedef pair<LL, pair<LL, bitset<100001>>> Pbll;
typedef pair<LL, pair<LL, vector<LL>>> Pvll;
typedef pair<LL, LL> Vec2;
struct Tll { LL first, second, third; };
struct Fll { LL first, second, third, fourth; };
typedef pair<LL, Tll> Ptll;
#define rep(i,rept) for(LL i=0;i<rept;i++)
#define Rrep(i,mf) for(LL i=mf-1;i>=0;i--)
LL h, w, n, m, k, t, s, p, q, last, first, cnt,sum, ans , dp, a[400000], b[400000];
string str, ss;
bool f[200][200];
char c;
int di[4][2] = { { 0,1 },{ 1,0 },{ 0,-1 },{ -1,0 } };
struct Edge { LL to, cost; };
struct edge { LL from, to, cost; };
vector<vector<int>>vec;
vector<edge>ed;
vector<LL>v;
map<Pll, LL>ma;
set<LL>st;

void YN(bool f) {
	if (f)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}
void yn(bool f) {
	if (f)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}

int main() {
	cin >> n >> m;
	rep(i, n) {
		cin >> a[i];
	}
	rep(i, n) {
		sum = 0;
		for (int j = i; j < n; j++) {
			sum += a[j];
			v.push_back(sum);
		}
	}
	sort(v.begin(), v.end(), [](LL x, LL y) {return x > y; });
	LL v_size = v.size();
	Rrep(i, 41) {
		bool OK = 0;
		cnt = 0;
		rep(j, v_size) {
			if (v[j] >= ((LL)1 << i)) {
				cnt++;
			}
			else {
				break;
			}
		}
		if (cnt >= m) {
			v_size = j;
			ans += ((LL)1 << i);
			OK = 1;
		}
		rep(k, v_size) {
			if (v[k] >= ((LL)1 << i)) {
				v[k] -= ((LL)1 << i);
			}
		}
		sort(v.begin(), v.begin() + v_size, [](LL x, LL y) {return x > y; });
	}
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:110:34: error: 'j' was not declared in this scope
  110 |                         v_size = j;
      |                                  ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
	cout<<2^5<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:4:18: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
    4 |         cout<<2^5<<endl;
      |                 ~^~~~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

typedef long long lint;

lint sum[1000009];

lint a[1000001];

lint v[1000009][2];
lint n;
lint  k;

lint main()
{
    cin >> n >> k;

    for(lint i = 1; i <= n; i ++)
    {
        cin >> a[i];
        sum[i] = sum[i - 1] + a[i];
    }

    lint i, j;
    lint cr = 0;
    for(i = 1; i <= n; i ++)
    {
        for(lint j = i + 1; j <= n; j ++)
        {
            v[++ cr][0] = sum[j] - sum[i - 1];
        }
    }

    lint rez = 0;
    lint CR = 0;
    lint kant = cr;
    for(lint p = 29; p >= 0; p --)
    {
        lint k2 = 0;
        for(lint i = 1; i <= kant; i ++)
        {
            if((v[i][CR] & (1LL << p)) != 0)
            {
                v[++ k2][1 - CR] = v[i][CR];
            }
        }

       // cout << k2 << " " << k << " < < "\n";

        if(k2 >= k)
        {
            rez += (1 << p);
            CR = 1 - CR;
            kant = k2;
        }
    }

    cout << (rez) << "\n";

    return 0;
}


Compiler output:
a.cc:15:1: error: '::main' must return 'int'
   15 | lint main()
      | ^~~~
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define debug(var) do{cout << #var << " : "; view(var);}while(0)
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
template<class T> void view(T e) {cout << e << endl;}
template<class T> void view(const vector<T> &v) {for(const auto &e : v){cout << e << " ";} cout << endl;}
template<class T> void view(const vector<vector<T>> &vv) {for(const auto &v : vv){view(v);}}
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9+10;
const ll inf_l = 1e18;
const int MAX = 1e5;

int main() {
    int n; cin >> n;
    string s; cin >> s;
    int q; cin >> q;
    vint k(q);
    rep(i,q) cin >> k[i];
    rep(i,q) {
        ll ans = 0;
        int sum_d = 0, sum_m = 0
        ll sum_dm = 0;
        rep(j,n) {
            if (j < k[i]) {
                if (s[j] == 'D') sum_d++;
                if (s[j] == 'M') {
                    sum_m++;
                    sum_dm += sum_d;
                }
                if (s[j] == 'C') ans += sum_dm;
            } else {
                if (s[j] == 'D') sum_d++;
                if (s[j-k[i]] == 'D') {
                    sum_dm -= sum_m;
                    sum_d--;
                }
                if (s[j] == 'M') {
                    sum_m++;
                    sum_dm += sum_d;
                }
                if (s[j-k[i]] == 'M') sum_m--;
                if (s[j] == 'C') ans += sum_dm;
            }
        }
        cout << ans << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:9: error: expected ',' or ';' before 'll'
   32 |         ll sum_dm = 0;
      |         ^~
a.cc:38:21: error: 'sum_dm' was not declared in this scope; did you mean 'sum_m'?
   38 |                     sum_dm += sum_d;
      |                     ^~~~~~
      |                     sum_m
a.cc:40:41: error: 'sum_dm' was not declared in this scope; did you mean 'sum_m'?
   40 |                 if (s[j] == 'C') ans += sum_dm;
      |                                         ^~~~~~
      |                                         sum_m
a.cc:44:21: error: 'sum_dm' was not declared in this scope; did you mean 'sum_m'?
   44 |                     sum_dm -= sum_m;
      |                     ^~~~~~
      |                     sum_m
a.cc:49:21: error: 'sum_dm' was not declared in this scope; did you mean 'sum_m'?
   49 |                     sum_dm += sum_d;
      |                     ^~~~~~
      |                     sum_m
a.cc:52:41: error: 'sum_dm' was not declared in this scope; did you mean 'sum_m'?
   52 |                 if (s[j] == 'C') ans += sum_dm;
      |                                         ^~~~~~
      |                                         sum_m
Language: C++

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        char[] c = sc.next().toCharArray();
        int Q = sc.nextInt();
        for (int i=0;i<Q;i++) {
            int k = sc.nextInt();
            int m_cnt = 0;
            int c_cnt = 0;
            long ans = 0L;
            long tmp = 0L;
            for (int j=0;j<k;j++) {
                if (c[j]=='M') m_cnt++;
                if (c[j]=='C') {
                    c_cnt++;
                    tmp += m_cnt;
                }
            }
            for (int j=0;j<N;j++) {
                if (c[j]=='D') {
                    ans += tmp;
                }
                if (c[j]=='M') {
                    m_cnt--;
                    tmp -= c_cnt;
                }
                if (c[j]=='C') c_cnt--;
                if (j+k<N && c[j+k]=='M') m_cnt++;
                if (j+k<N && c[j+k]=='C') {
                    c_cnt++;
                    tmp += m_cnt;
                }
            }
            System.out.println(ans);
        }
    }
}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.*;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: expected unqualified-id before 'public'
    3 | public class Main {
      | ^~~~~~
Language: C++

#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
typedef vector<vector<P>> vvP;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

ll n, q;
string s;
ll m, c, t;

void add(ll i) {
    if(s[i] == 'M') {
        m++;
    }
    else if(s[i] == 'C') {
        c++;
        t += m;
    }
}

void erase(ll i) {
    if(s[i] == 'M') {
        m--;
        t -= c;
    }
    else if(s[i] == 'C') {
        c--;
    }
}

ll solve(ll k) {
    ll ans = 0;
    m = 0, t = 0;
    ll r = 0;
    rep(l, n) {
        while(r < n && r - l < k) {
            add(r++);
        }
        if(s[l] == 'D') {
            ans += t;
        }
        erse(l++);
    }
    return ans;
}

int main() {
    
    cin >> n >> s >> q;

    rep(i, q) {
        ll k;
        cin >> k;
        out(solve(k));
    }

    re0;
}

Compiler output:
a.cc: In function 'll solve(ll)':
a.cc:67:9: error: 'erse' was not declared in this scope; did you mean 'erase'?
   67 |         erse(l++);
      |         ^~~~
      |         erase
Language: C++


#include<bits/stdc++.h>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }


using namespace std;

int N;
string S;
long long m, c, t;

void add(int i) {
    if (S[i] == 'M') ++m;
    else if (S[i] == 'C') ++c, t += m;
}

void erase(int i) {
    if (S[i] == 'M') --m, t -= c;
    else if (S[i] == 'C') --c;
}

long long solve(int K) {
    long long res = 0;
    m = 0; t = 0;
    int r = 0;
    for (int l = 0; l < N;) {
        while(r < N && r - l <K) add(r++);
        if (S[l] == 'D') res += t;
        erase(l++)
    }
    return res;
}

int main(){
    while (cin >> N >> S) {
        int Q; cin >> Q;
        for (int i = 0; i < Q; ++i) {
            int k; cin >> k;
            cout << solve(k) << endl;
        }
    }
}

Compiler output:
a.cc: In function 'long long int solve(int)':
a.cc:36:19: error: expected ';' before '}' token
   36 |         erase(l++)
      |                   ^
      |                   ;
   37 |     }
      |     ~
Language: C++

#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1010101010;
constexpr lint LINF = 1LL << 60;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (const auto &e : vec) os << e << (&e == &vec.back() ? "\n" : " ");
	return os;
}

#ifdef _DEBUG
template <class T>
void dump(const char* str, T &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

#define int lint

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N;
	cin >> N;

	string S;
	cin >> S;
	vector<int> D, M, C;
	vector<int> C_cnt(N + 1);
	for (int i = 0; i < N; i++) {
		if (S[i] == 'D') D.emplace_back(i);
		if (S[i] == 'M') M.emplace_back(i);
		if (S[i] == 'C') {
			C.emplace_back(i);
			C_cnt[i] = 1;
		}
	}
	for (int i = N - 1; i >= 0; i--) C_cnt[i] += C_cnt[i + 1];
	DMP(C_cnt);
	vector<lint> MC_cnt(M.size());
	for (int i = 0; i < M.size(); i++) MC_cnt[i] = C_cnt[M[i]];
	DMP(MC_cnt);

	DMP(D, M, C);

	auto query = [&](int k) {
		
		lint res = 0;
		queue<pair<int,int>> M_q;
		int M_i = 0;
		lint MC = 0;
		for (int i = 0; i < D.size(); i++) {

			while (M_i < M.size() && D[i] < M[M_i] && D[i] + k > M[M_i]) {
				M_q.emplace(M[M_i], M_i);
				MC += MC_cnt[M_i];
				M_i++;
			}

			while (!M_q.empty() && D[i] > M_q.front().first) {
				MC -= MC_cnt[M_q.front().second];
				M_q.pop();
			}

			res += MC - (lint)M_q.size() * C_cnt[min(D[i] + k, N)];

		}

		return res;

	};

	int Q;
	cin >> Q;

	for (int i = 0; i < Q; i++) {
		int k;
		cin >> k;
		cout << query(k) << "\n";
	}

	return 0;
}

Compiler output:
a.cc:38:13: error: '::main' must return 'int'
   38 | #define int lint
      |             ^~~~
a.cc:40:1: note: in expansion of macro 'int'
   40 | int main() {
      | ^~~
Language: C++

#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <queue>
#include <set>
#include <cstdio>
#include <vector>
#include <cstring>
#include <math.h>
#include <iomanip>
#include <bitset>
#include <map>
#include <stack>
#include <cmath>
#define LL long long 
using namespace std; 
 
char c[1000005]; 
 
int main()
{
	int k,n,q
	long long numm,numd,numc,numdm,nummc,ans;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		cin>>c[i];
	scanf("%d",&q);
	while(q--)
	{
		numm=0,numd=0,numc==0,numdm=0,nummc=0,ans=0;
		scanf("%d",&k);
		for(int i=1;i<=n;i++)
		{
			if(i<=k)
			{
				if(c[i]=='D')
					numd++;
				if(c[i]=='M')
					numm++,numdm+=numd;
				if(c[i]=='C')
					numc++,nummc+=numm,ans+=numdm;
			}
			else
			{
//				cout<<i<<" "<<numd<<" "<<numm<<" "<<numdm<<endl;
				int x=i-k;
				if(c[x]=='D')
					numd--,numdm-=numm;
				if(c[x]=='M')
					numm--,nummc-=numc;
				if(c[x]=='C')
					numc--;
				if(c[i]=='D')
					numd++;
				if(c[i]=='M')
					numm++,numdm+=numd;
				if(c[i]=='C')
					numc++,nummc+=numm,ans+=numdm;
//				cout<<i<<" "<<numd<<" "<<numm<<" "<<numdm<<endl;
			}
		}
		cout<<ans<<endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:9: error: expected initializer before 'long'
   23 |         long long numm,numd,numc,numdm,nummc,ans;
      |         ^~~~
a.cc:27:21: error: 'q' was not declared in this scope
   27 |         scanf("%d",&q);
      |                     ^
a.cc:30:17: error: 'numm' was not declared in this scope
   30 |                 numm=0,numd=0,numc==0,numdm=0,nummc=0,ans=0;
      |                 ^~~~
a.cc:30:24: error: 'numd' was not declared in this scope
   30 |                 numm=0,numd=0,numc==0,numdm=0,nummc=0,ans=0;
      |                        ^~~~
a.cc:30:31: error: 'numc' was not declared in this scope
   30 |                 numm=0,numd=0,numc==0,numdm=0,nummc=0,ans=0;
      |                               ^~~~
a.cc:30:39: error: 'numdm' was not declared in this scope
   30 |                 numm=0,numd=0,numc==0,numdm=0,nummc=0,ans=0;
      |                                       ^~~~~
a.cc:30:47: error: 'nummc' was not declared in this scope
   30 |                 numm=0,numd=0,numc==0,numdm=0,nummc=0,ans=0;
      |                                               ^~~~~
a.cc:30:55: error: 'ans' was not declared in this scope; did you mean 'abs'?
   30 |                 numm=0,numd=0,numc==0,numdm=0,nummc=0,ans=0;
      |                                                       ^~~
      |                                                       abs
Language: C++

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

Compiler output:
a.cc:3:1: error: 'll' does not name a type
    3 | ll n,q,k;
      | ^~
a.cc: In function 'int main()':
a.cc:6:29: error: 'n' was not declared in this scope; did you mean 'yn'?
    6 |         scanf("%lld%s%lld",&n,s,&q);
      |                             ^
      |                             yn
a.cc:6:34: error: 'q' was not declared in this scope
    6 |         scanf("%lld%s%lld",&n,s,&q);
      |                                  ^
a.cc:8:31: error: 'k' was not declared in this scope
    8 |                 scanf("%lld",&k);
      |                               ^
a.cc:9:17: error: 'll' was not declared in this scope
    9 |                 ll D=0,M=0,DM=0,DMC=0;
      |                 ^~
a.cc:10:23: error: expected ';' before 'i'
   10 |                 for(ll i=0;i<n;i++){
      |                       ^~
      |                       ;
a.cc:10:28: error: 'i' was not declared in this scope
   10 |                 for(ll i=0;i<n;i++){
      |                            ^
a.cc:13:41: error: 'DM' was not declared in this scope
   13 |                                         DM-=M;
      |                                         ^~
a.cc:13:45: error: 'M' was not declared in this scope
   13 |                                         DM-=M;
      |                                             ^
a.cc:14:41: error: 'D' was not declared in this scope
   14 |                                         D--;
      |                                         ^
a.cc:17:41: error: 'M' was not declared in this scope
   17 |                                         M--;
      |                                         ^
a.cc:20:33: error: 'D' was not declared in this scope
   20 |                                 D++;
      |                                 ^
a.cc:22:33: error: 'M' was not declared in this scope
   22 |                                 M++;
      |                                 ^
a.cc:23:33: error: 'DM' was not declared in this scope
   23 |                                 DM+=D;
      |                                 ^~
a.cc:23:37: error: 'D' was not declared in this scope
   23 |                                 DM+=D;
      |                                     ^
a.cc:26:33: error: 'DMC' was not declared in this scope
   26 |                                 DMC+=DM;
      |                                 ^~~
a.cc:26:38: error: 'DM' was not declared in this scope
   26 |                                 DMC+=DM;
      |                                      ^~
a.cc:28:33: error: 'DMC' was not declared in this scope
   28 |                 printf("%lld\n",DMC);
      |                                 ^~~
Language: C++

#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define EPS (1e-9)
#define INF (1e17)
#define PI (acos(-1))
#define int long long
//const double PI = acos(-1);
//const double EPS = 1e-15;
//long long INF=(long long)1E17;
#define i_7 (long long)(1e9+7)
//#define i_7 998'244'353
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;

bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd_(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}
  
int main(){
  
  int n;
  cin>>n;
  string s;
  cin>>s;
  int q;
  cin>>q;
  int k[q];
  REP(i,q){
    cin>>k[i];
  }
  int dsum[n] = {};
  int msum[n] = {};
  REP(i,n){
    if(i==0){
      if(s[i] == 'D'){
        dsum[i]++;
      }else if(s[i] == 'M'){
        msum[i]++;
      }else{
        ;
      }
    }else{
      if(s[i] == 'D'){
        dsum[i] = dsum[i-1] + 1;
        msum[i] = msum[i-1];
      }else if(s[i] == 'M'){
        dsum[i] = dsum[i-1];
        msum[i] = msum[i-1] + 1;
      }else{
        dsum[i] = dsum[i-1];
        msum[i] = msum[i-1];
      }
    } 
  }
  REP(i,q){
    int dmnum[n] = {};
    REP(j,k[i]-2){
      if(s[j+1] == 'M'){
        dmnum[j+1] = dmnum[j] + dsum[j];
      }else{
        dmnum[j+1] = dmnum[j];
      }
    }
    for(int j = k[i]-2; j < n-1; j++){
      if(s[j+1] == 'M'){
        if(j-(k[i]-2) >= 1){
          dmnum[j+1] = dmnum[j] + dsum[j] - dsum[j-(k[i]-2)-1];
        }else{
          dmnum[j+1] = dmnum[j] + dsum[j];
        }
      }else{
        dmnum[j+1] = dmnum[j];
      }
      if(s[j-(k[i]-2)] == 'D'){
        dmnum[j+1] -= msum[j+1] - msum[j-(k[i]-2)];
      }else{
        ;
      }
    }
    int res = 0;
    REP(j,n){
      if(s[j] == 'C'){
        if(j==0)continue;
        res += dmnum[j-1];
      }else{
        continue;
      }
    }
    cout<<res<<endl;
  }
  //return 0; 
}


Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define EPS (1e-9)
#define INF (1e17)
#define PI (acos(-1))
#define int long long
//const double PI = acos(-1);
//const double EPS = 1e-15;
//long long INF=(long long)1E17;
#define i_7 (long long)(1e9+7)
//#define i_7 998'244'353
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;

bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd_(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}
  
void main(){
  
  int n;
  cin>>n;
  string s;
  cin>>s;
  int q;
  cin>>q;
  int k[q];
  REP(i,q){
    cin>>k[i];
  }
  int dsum[n] = {};
  int msum[n] = {};
  REP(i,n){
    if(i==0){
      if(s[i] == 'D'){
        dsum[i]++;
      }else if(s[i] == 'M'){
        msum[i]++;
      }else{
        ;
      }
    }else{
      if(s[i] == 'D'){
        dsum[i] = dsum[i-1] + 1;
        msum[i] = msum[i-1];
      }else if(s[i] == 'M'){
        dsum[i] = dsum[i-1];
        msum[i] = msum[i-1] + 1;
      }else{
        dsum[i] = dsum[i-1];
        msum[i] = msum[i-1];
      }
    } 
  }
  REP(i,q){
    int dmnum[n] = {};
    REP(j,k[i]-2){
      if(s[j+1] == 'M'){
        dmnum[j+1] = dmnum[j] + dsum[j];
      }else{
        dmnum[j+1] = dmnum[j];
      }
    }
    for(int j = k[i]-2; j < n-1; j++){
      if(s[j+1] == 'M'){
        if(j-(k[i]-2) >= 1){
          dmnum[j+1] = dmnum[j] + dsum[j] - dsum[j-(k[i]-2)-1];
        }else{
          dmnum[j+1] = dmnum[j] + dsum[j];
        }
      }else{
        dmnum[j+1] = dmnum[j];
      }
      if(s[j-(k[i]-2)] == 'D'){
        dmnum[j+1] -= msum[j+1] - msum[j-(k[i]-2)];
      }else{
        ;
      }
    }
    int res = 0;
    REP(j,n){
      if(s[j] == 'C'){
        if(j==0)continue;
        res += dmnum[j-1];
      }else{
        continue;
      }
    }
    cout<<res<<endl;
  }
  //return 0; 
}


Compiler output:
a.cc:52:1: error: '::main' must return 'int'
   52 | void main(){
      | ^~~~
Language: C++

#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define EPS (1e-9)
#define INF (1e17)
#define PI (acos(-1))
#define int long long
//const double PI = acos(-1);
//const double EPS = 1e-15;
//long long INF=(long long)1E17;
#define i_7 (long long)(1e9+7)
//#define i_7 998'244'353
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;

bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd_(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}
  
int main(){
  
  int n;
  cin>>n;
  string s;
  cin>>s;
  int q;
  cin>>q;
  int k[q];
  REP(i,q){
    cin>>k[i];
  }
  int dsum[n] = {};
  int msum[n] = {};
  REP(i,n){
    if(i==0){
      if(s[i] == 'D'){
        dsum[i]++;
      }else if(s[i] == 'M'){
        msum[i]++;
      }else{
        ;
      }
    }else{
      if(s[i] == 'D'){
        dsum[i] = dsum[i-1] + 1;
        msum[i] = msum[i-1];
      }else if(s[i] == 'M'){
        dsum[i] = dsum[i-1];
        msum[i] = msum[i-1] + 1;
      }else{
        dsum[i] = dsum[i-1];
        msum[i] = msum[i-1];
      }
    } 
  }
  REP(i,q){
    int dmnum[n] = {};
    REP(j,k[i]-2){
      if(s[j+1] == 'M'){
        dmnum[j+1] = dmnum[j] + dsum[j];
      }else{
        dmnum[j+1] = dmnum[j];
      }
    }
    for(int j = k[i]-2; j < n-1; j++){
      if(s[j+1] == 'M'){
        if(j-(k[i]-2) >= 1){
          dmnum[j+1] = dmnum[j] + dsum[j] - dsum[j-(k[i]-2)-1];
        }else{
          dmnum[j+1] = dmnum[j] + dsum[j];
        }
      }else{
        dmnum[j+1] = dmnum[j];
      }
      if(s[j-(k[i]-2)] == 'D'){
        dmnum[j+1] -= msum[j+1] - msum[j-(k[i]-2)];
      }else{
        ;
      }
    }
    int res = 0;
    REP(j,n){
      if(s[j] == 'C'){
        if(j==0)continue;
        res += dmnum[j-1];
      }else{
        continue;
      }
    }
    cout<<res<<endl;
  }
  return 0; 
}


Compiler output:
cc1plus: error: '::main' must return 'int'