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

// #include <stdio.h>
// #include <string.h>
//#include <iostream>
#include <utility>
#include <cstdio>
#include <stack>
#include <queue>
#include <algorithm>
#include <map>
#include <string>
#include <set>

using namespace std;
typedef pair<int, int> XY;// Pair型変数の宣言
    
int main()
{
  	int Nmax = 2000;
    char String[Nmax];
    int i,j,k;
    int len;   // 文字列の長さ
    int flag=0;
    int t[Nmax];
    int x[Nmax];
    int y[Nmax];
    int A[Nmax];
    int N,K;
   
 /*   
    // int型スタック
    stack<int> stack;   
    stack.push(777);
    stack.push(778);
    stack.push(779);
  
	int tmpsl = stack.top();  // LAST要素の参照
 // 	int tpmsf = stack.back(); // FIRST要素の参照
 //	printf("%d %d \n",tmpsl,tmpsf);
    stack.pop();// LAST要素の削除（取出しではない）
 // 	if( stack.empty() == true) printf("empty stack\n");
     
    // int型キュー
    queue<int> que;
  	que.push(999);
  	que.push(998);   
  	que.push(997);    
  	int tmpqs = que.front(); // FIRST要素の参照
  	int tmpqe = que.back();  // LAST要素の参照
 //	printf("%d %d \n",tmpqs,tmpqe);
  	que.pop();  // FIRST要素の削除（取出しではない）
  //	if( que.empty() == true) printf("empty que\n");
    
    // ２次元座標を扱うキュー
    queue<XY> xyque; // ２次元座標型変数のキュー
  	XY p; 
  	xyque.pop();	// FIRST要素の削除。キューが空のときは削除が予約されて次のPOPが即削除される
  	xyque.push( XY(5,5) );
    xyque.push( XY(5,5) );
   	p = xyque.front();  // FIRST要素からのコピー
 // 	printf("%d %d\n", p.first, p.second);
  	
    
  que.back();
  //  sort(&(que.front()), &(que.back()));
        
 */   
      
    // 入力読込
    // 文字列
 //   scanf("%s", String);   
    
    // 数列
    scanf("%d %d", &N,&K);
    for(i=0;i<=N-1;i++){
        scanf("%d ",&A[i]);
    }
    
    // 文字列の長さをチェック
    // 文字列は配列の0からlen-1に格納されてる
//    len = strlen( String );
//  	printf("%d\n",len);
              
    // ２セットで数を数え、あとは、K-1倍
    int count1 = 0; 
    int count2 = 0;

    for(i=0;i<=N-1;i++){
        for(j=i+1;j<= N-1;j++){
            if(A[i]>A[j]) count1++;
        }
    }
    
      for(i=0;i <= N-1;i++){
        for(j=0;j <= N-1;j++){
            if(A[i]>A[j]) count2++;
        }
    }
    
    int total = count1;
    for(k=2;k<=K;k++){
        total = total + count1 + K*count2;
    }
    }
       
    printf("%d",total/(1000000000+7) );

    
    
    // 結果出力
  
/*    
    if(flag == -1)
        printf("NO \n");
    else
        printf("YES \n");
  */      
  
  return 0;
   
}

Compiler output:
a.cc:105:11: error: expected constructor, destructor, or type conversion before '(' token
  105 |     printf("%d",total/(1000000000+7) );
      |           ^
a.cc:118:3: error: expected unqualified-id before 'return'
  118 |   return 0;
      |   ^~~~~~
a.cc:120:1: error: expected declaration before '}' token
  120 | }
      | ^
Language: C++

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

int main() {
  long int N,K,p,q;
  p=0;
  q=0;
  cin  >>N>>K;
  vector<int> A(N*2+1);
  for(int i=0;i<N;i++){
    cin >>A[i];
    A[i+N]=A[i];
  }
  for(int i=0;i<N-1;i++){
    for(int j=i+1;j<N;j++){
      if(A[i]>A[j]){
        p++;
      }
    }
  }
  for(int i=0;i<N;i++){
    for(int j=N;j<N*2;j++){
      if(A[i]>A[j]){
        q++;
      }
    }
  }
  cout <<(p*K+(q*(K-1)*K/2))%(10e9+7)<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:29: error: invalid operands of types 'long int' and 'double' to binary 'operator%'
   28 |   cout <<(p*K+(q*(K-1)*K/2))%(10e9+7)<<endl;
      |          ~~~~~~~~~~~~~~~~~~~^~~~~~~~~
      |              |                    |
      |              long int             double
Language: C++

// #include <stdio.h>
// #include <string.h>
//#include <iostream>
#include <utility>
#include <cstdio>
#include <stack>
#include <queue>
#include <algorithm>
#include <map>
#include <string>
#include <set>

using namespace std;
typedef pair<int, int> XY;// Pair型変数の宣言
    
int main()
{
  	int Nmax = 2000;
    char String[Nmax];
    int i,j,k;
    int len;   // 文字列の長さ
    int flag=0;
    int t[Nmax];
    int x[Nmax];
    int y[Nmax];
    int A[Nmax];
    int N,K;
   
 /*   
    // int型スタック
    stack<int> stack;   
    stack.push(777);
    stack.push(778);
    stack.push(779);
  
	int tmpsl = stack.top();  // LAST要素の参照
 // 	int tpmsf = stack.back(); // FIRST要素の参照
 //	printf("%d %d \n",tmpsl,tmpsf);
    stack.pop();// LAST要素の削除（取出しではない）
 // 	if( stack.empty() == true) printf("empty stack\n");
     
    // int型キュー
    queue<int> que;
  	que.push(999);
  	que.push(998);   
  	que.push(997);    
  	int tmpqs = que.front(); // FIRST要素の参照
  	int tmpqe = que.back();  // LAST要素の参照
 //	printf("%d %d \n",tmpqs,tmpqe);
  	que.pop();  // FIRST要素の削除（取出しではない）
  //	if( que.empty() == true) printf("empty que\n");
    
    // ２次元座標を扱うキュー
    queue<XY> xyque; // ２次元座標型変数のキュー
  	XY p; 
  	xyque.pop();	// FIRST要素の削除。キューが空のときは削除が予約されて次のPOPが即削除される
  	xyque.push( XY(5,5) );
    xyque.push( XY(5,5) );
   	p = xyque.front();  // FIRST要素からのコピー
 // 	printf("%d %d\n", p.first, p.second);
  	
    
  que.back();
  //  sort(&(que.front()), &(que.back()));
        
 */   
      
    // 入力読込
    // 文字列
 //   scanf("%s", String);   
    
    // 数列
    scanf("%d %d", &N,&K);
    for(i=0;i<=N-1;i++){
        scanf("%d ",&A[i]);
    }
    
    // 文字列の長さをチェック
    // 文字列は配列の0からlen-1に格納されてる
//    len = strlen( String );
//  	printf("%d\n",len);
              
    // ２セットで数を数え、あとは、K-1倍
    int count1 = 0; 
    int count2 = 0;

    for(i=0;i<=N-1;i++){
        for(j=i+1;j<= N-1;j++){
            if(A[i]>A[j]) count1++;
        }
    }
    
      for(i=0;i <= N-1;i++){
        for(j=0;j <= N-1;j++){
            if(A[i]>A[j]) count2++;
        }
    }
    
    int otal = count1;
    for(k=2;k<=K;k++){
        total = total + count1 + K*count2;
    }
    }
       
    printf("%d",total/(1000000000+7) );

    
    
    // 結果出力
  
/*    
    if(flag == -1)
        printf("NO \n");
    else
        printf("YES \n");
  */      
  
  return 0;
   
}

Compiler output:
a.cc: In function 'int main()':
a.cc:101:9: error: 'total' was not declared in this scope; did you mean 'otal'?
  101 |         total = total + count1 + K*count2;
      |         ^~~~~
      |         otal
a.cc: At global scope:
a.cc:105:11: error: expected constructor, destructor, or type conversion before '(' token
  105 |     printf("%d",total/(1000000000+7) );
      |           ^
a.cc:118:3: error: expected unqualified-id before 'return'
  118 |   return 0;
      |   ^~~~~~
a.cc:120:1: error: expected declaration before '}' token
  120 | }
      | ^
Language: C++

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

#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif

const int MOD = 1e9 + 7;

int mod_pow(int n,int p,int MOD){ // a/n ≡ a*n^(p-2) nとpは互いに素
  int r = 1;
  for(; p > 0; p >>= 1){
    if(p & 1LL) r = (r * n) % MOD;
    n = (n * n) % MOD;
  }
  return r; // r = n^p % MOD
}

signed main(){

  int n,k; cin >> n >> k;
  vector<int> a(n);
  for(int i = 0; i < n; i++){
    cin >> a[i];
  }

  int p = 0;
  for(int i = 0; i < n; i++){
    for(int j = i+1; j < n; j++){
      if(a[i] > a[j]) p++;
    }
  }

  int d = (k-2)*cnt%MOD;
  int ans = (2*cnt + d)%MOD * (k-1)%MOD / 2;
  //int ans = cnt * (mod_pow(cnt,k,MOD) - 1) % MOD / (cnt - 1);
  cout << (ans%MOD + (p*k)%MOD) % MOD << endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:35:17: error: 'cnt' was not declared in this scope; did you mean 'int'?
   35 |   int d = (k-2)*cnt%MOD;
      |                 ^~~
      |                 int
Language: C++

#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<queue>
#include<stack>
#include<cmath>	
#include<list>


constexpr auto PI = 3.14159265359;

using namespace std;


int main() {
	long long N, K;
	cin >> N >> K;
	vector<long long> A(N * 2);
	for (long long i = 0; i < N; ++i) {
		cin >> A[i];
		A[i + N] = A[i];
	}
	long long count = 0;
	for (long long i = 0; i < N; ++i) {
		for (long long j = i + 1; j < N; ++j) {
			if (A[j] < A[i]) {
				count += ((K) * (2 * 1 + ((K) - 1) * 1) / 2) % long long(pow(10, 9) + 7);
			}
		}
		for (long long j = 0; j <= i; ++j) {
			if (A[j] < A[i]) {
				count += ((K - 1) * (2 * 1 + ((K - 1) - 1) * 1) / 2) % long long(pow(10, 9) + 7);
			}
		}
	}
	cout << count % long long(pow(10, 9) + 7) << "\n";
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:80: error: expected primary-expression before 'long'
   29 |                                 count += ((K) * (2 * 1 + ((K) - 1) * 1) / 2) % long long(pow(10, 9) + 7);
      |                                                                                ^~~~
a.cc:34:88: error: expected primary-expression before 'long'
   34 |                                 count += ((K - 1) * (2 * 1 + ((K - 1) - 1) * 1) / 2) % long long(pow(10, 9) + 7);
      |                                                                                        ^~~~
a.cc:38:25: error: expected primary-expression before 'long'
   38 |         cout << count % long long(pow(10, 9) + 7) << "\n";
      |                         ^~~~
Language: C++

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

using ll=long long;
using int64=int64_t;
const int inf=100000000;

int in(){
  int a;
  cin >> a;
  return a;
}//int型関数の受け取り

void forin(int* x,int y){
  for (int i=0;i<y;i++){
    cin >> x[i];
  }
}//(x,y) int型配列x[y]の受け取り

int intpow(int x,int y){
  double a=x,b=y;
  return pow(a,b);
}//(x,y) xをy乗

int intfabs(int x){
  double a=x;
  return fabs(a);
}//(x) xの絶対値

int fact(int x){
  if (x == 1) return 1;
  return x*fact(x-1);
}//(x) x!

int fib(int x){
  if (x <= 2) return x;
  int a[x];
  a[0]=1;
  a[1]=2;
  for (int i=2;i<x;i++){
    a[i]=a[i-1]+a[i-2];
  }
  return a[x-1];
}//(x) フィボナッチ数列のx番目

int div1(ll x){
  return x%1000000007;
}

//ost:列順で大きい,kst:列の中で大きい

main(){
    int n=in(),k=in(),a[n],ans=0,ost,kst;
    forin(a,n);
    for (int i=0;i<n;i++){
        ost=-1;
        kst=0;
        for (int i2=0;i2<n;i2++){
            if (a[i2]<=a[i] && i<i2) ost++;
            else (a[i2]<=a[i]) kst++;
        }
        ans+=(ost+kst*2)*k;
    }
    cout << ans << endl;
}

Compiler output:
a.cc:52:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   52 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:60:31: error: expected ';' before 'kst'
   60 |             else (a[i2]<=a[i]) kst++;
      |                               ^~~~
      |                               ;
Language: C++

#include<stdio.h>
int main(){
    int d,n,k,i.j;
    scanf("%d %d",&n,&k);
    int a[n];
    for(i=0;i<n;i++){
        scanf("%d",&a[i]);
    }
    for(i=0;i<n;i++){
        for(j=i;j<n;j++){
            if(a[i]>a[j]){
                d++;
            }
        }
    }
    d=(d*k*(k+1)/2)%1000000007;
    printf("%d",d);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:16: error: expected initializer before '.' token
    3 |     int d,n,k,i.j;
      |                ^
a.cc:6:9: error: 'i' was not declared in this scope
    6 |     for(i=0;i<n;i++){
      |         ^
a.cc:9:9: error: 'i' was not declared in this scope
    9 |     for(i=0;i<n;i++){
      |         ^
a.cc:10:13: error: 'j' was not declared in this scope
   10 |         for(j=i;j<n;j++){
      |             ^
Language: Java

package jsc2019;

import iroha2019day3.A;

import java.util.Arrays;
import java.util.Scanner;

public class B {

    void run() {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long k = sc.nextInt();

        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }

        int[] b = new int[n], c = new int[n];
        for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) {
            if (i < j && a[i] > a[j]) {
                b[j]++;
            }
            if (a[i] > a[j]) {
                c[j]++;
            }
        }


        long MOD = (long)(1e9) + 7;
        long INV2 = (MOD + 1) / 2;
        long cnt = 0;
        for (int i = 0; i < n; i++) {
            cnt = (cnt + k * b[i]) % MOD;
            long mult = k * c[i] % MOD * (k - 1) % MOD * INV2 % MOD;
            cnt = (cnt + mult) % MOD;
        }
        System.out.println(cnt);
    }

    void debug(Object...os) {
        System.err.println(Arrays.deepToString(os));
    }

    public static void main(String[] args) {
        new B().run();
    }
}


Compiler output:
Main.java:8: error: class B is public, should be declared in a file named B.java
public class B {
       ^
Main.java:3: error: package iroha2019day3 does not exist
import iroha2019day3.A;
                    ^
2 errors
Language: C++

// #include <stdio.h>
// #include <string.h>
//#include <iostream>
#include <utility>
#include <cstdio>
#include <stack>
#include <queue>
#include <algorithm>
#include <map>
#include <string>
#include <set>

using namespace std;
typedef pair<int, int> XY;// Pair型変数の宣言
    
int main()
{
  	int Nmax = 2000;
    char String[Nmax];
    int N;
    int i,j,k;
    int len;   // 文字列の長さ
    int flag=0;
    int t[Nmax];
    int x[Nmax];
    int y[Nmax];
    int A[Nmax];
    int N,K;
   
 /*   
    // int型スタック
    stack<int> stack;   
    stack.push(777);
    stack.push(778);
    stack.push(779);
  
	int tmpsl = stack.top();  // LAST要素の参照
 // 	int tpmsf = stack.back(); // FIRST要素の参照
 //	printf("%d %d \n",tmpsl,tmpsf);
    stack.pop();// LAST要素の削除（取出しではない）
 // 	if( stack.empty() == true) printf("empty stack\n");
     
    // int型キュー
    queue<int> que;
  	que.push(999);
  	que.push(998);   
  	que.push(997);    
  	int tmpqs = que.front(); // FIRST要素の参照
  	int tmpqe = que.back();  // LAST要素の参照
 //	printf("%d %d \n",tmpqs,tmpqe);
  	que.pop();  // FIRST要素の削除（取出しではない）
  //	if( que.empty() == true) printf("empty que\n");
    
    // ２次元座標を扱うキュー
    queue<XY> xyque; // ２次元座標型変数のキュー
  	XY p; 
  	xyque.pop();	// FIRST要素の削除。キューが空のときは削除が予約されて次のPOPが即削除される
  	xyque.push( XY(5,5) );
    xyque.push( XY(5,5) );
   	p = xyque.front();  // FIRST要素からのコピー
 // 	printf("%d %d\n", p.first, p.second);
  	
    
  que.back();
  //  sort(&(que.front()), &(que.back()));
        
 */   
      
    // 入力読込
    // 文字列
 //   scanf("%s", String);   
    
    // 数列
    scanf("%d %d", &N,&K);
    for(i=0;i<=N-1;i++){
        scanf("%d ",&A[i];
    }
    
    // 文字列の長さをチェック
    // 文字列は配列の0からlen-1に格納されてる
//    len = strlen( String );
//  	printf("%d\n",len);
              
    // ２セットで数を数え、あとは、K-1倍
    int count = 0; 
    for(int i=0;i<=N-1;i++){
        for(int j=0;j<= N-1;j++){
            if(A[i]>A[j]) count++;
        }
    }
        
    int total = count*(K-1);          
    printf("%d",total/(1000000000+7) );

    
    
    // 結果出力
  
/*    
    if(flag == -1)
        printf("NO \n");
    else
        printf("YES \n");
  */      
  
  return 0;
   
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:9: error: redeclaration of 'int N'
   28 |     int N,K;
      |         ^
a.cc:20:9: note: 'int N' previously declared here
   20 |     int N;
      |         ^
a.cc:76:26: error: expected ')' before ';' token
   76 |         scanf("%d ",&A[i];
      |              ~           ^
      |                          )
Language: C++

#include <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <utility>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <unordered_map>
#define int long long
using namespace std;
using P = pair<int, int>;
using ll = long long;
using prique = priority_queue<int>;
const int INF = LLONG_MAX/3;
const int MOD = 1000000007;
signed main(){
    int n,k;
    cin>>n>>k;
    int a[2000];
    for(int i=0;i<n;i++)cin>>a[i];
    int s=k*(k+1)/2%MOD;
    int ans=0;
    for(int i=0;i<n;i++){
        int cnta=0;
        int cntal=0;
        for(int j=0;j<n;j++){
            if(i==j)continue;
            else if(j<i){
                if(a[j]<a[i]){
                    cnta++;
                    cntal++;
                }
            }else{
            if(a[j]<a[i]){
                    cntal++;
                }
            }
        }
        ans+=cntal*s%MOD-cnta*k;
        if(ans<0)ans+=MOD;
        ans%=MOD;
    }
    if(ans<0)ans+=MOD;
    cout<<ans<<endl;
    return 0;
}



Compiler output:
a.cc:20:17: error: 'LLONG_MAX' was not declared in this scope
   20 | const int INF = LLONG_MAX/3;
      |                 ^~~~~~~~~
a.cc:15:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   14 | #include <unordered_map>
  +++ |+#include <climits>
   15 | #define int long long
Language: C++

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

int main() {
  int N,K;
  cin>>N>>K;
  vector<int>A(N);
  int a=0;
  int b=0;
  
  for(int i=0;i<N;i++){
    cin>>A.at(i);
  }
  for(int i=0;i<N;i++){
    for(int j=0;j<i;j++){
      if(A.at(i)>A.at(j)){
        a++;
      }
    }
    for(int k=i+1;k<N;k++){
      if(A.at(i)>A.at(k)){
        b++;
      }
    }
    int sum=a*(K-1)+b*K;
      int ans=sum%(10*10*10*10*10*10*10*10*10+7);
    cout<<ans<<endl;
      
      
}


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

#include<iostream>
#include<cstdio>
#include<ios>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<deque>
#include<string>
#include<list>
#include<utility>
#include<tuple>
#include<map>
#include<unordered_map>
#include<complex>
using namespace std;
typedef long long llong;
llong gcd(llong a, llong b) {
	if (a < b) std::swap(a, b);
	if (a % b == 0) return b;
	else return gcd(b, a % b);
}
llong lcm(llong a, llong b) {
	llong g = gcd(a, b);
	return a * b / g;
}
//ここまで共通

llong N, K;
vector<llong>A;
const llong MOD = 1000000007;
llong C = 0;
llong B[3000] = { 0 }, D[3000] = { 0 };
llong ANS = 0;

int main() {
	cin >> N >> K;
	for (int i = 0; i < N; i++) {
		int a;
		cin >> a;
		A.push_back(a);
	}
	for (int i = 0; i < N - 1; i++) {
		for (int j = i + 1; j < N; j++) {
			if (A[i] > A[j]) {
				C++;
			}
		}
	}
	for (int i = 1; i <= 2000; i++) {
		for (int j = 0; j < N; j++) {
			if (i > A[j]) {
				B[i]++;
			}
		}
	}
	for (int i = 0; i < N; i++) {
		D[A[i]]++;
	}
	ANS += C * K;
	ANS %= MOD;
	for (int i = 0; i <= 2500; i++) {
		ANS += (D[i] * B[i] * K * (K - 1)) / 2;
		ANS %= MOD;
	}
	cout << ANS << endl;
	return 0
}

Compiler output:
a.cc: In function 'int main()':
a.cc:69:17: error: expected ';' before '}' token
   69 |         return 0
      |                 ^
      |                 ;
   70 | }
      | ~
Language: Java

import java.util.Scanner;

public class B {

	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int N = scn.nextInt();
		long K = scn.nextLong();
		int[] A = new int[N];

		final long MOD = 1000000007;

		for(int i = 0;i < N;i++) {
			A[i] = scn.nextInt();
		}

		long[] sin = new long[N], dob = new long[N];

		for(int i = 0;i < N;i++) {
			long buf = 0;
			for(int j = 0;j < N;j++) {
				if(A[i] > A[j]) {
					buf++;
				}
			}
			dob[i] = buf;
		}
		for(int i = 0;i < N;i++) {
			long buf = 0;
			for(int j = i+1;j < N;j++) {
				if(A[i] > A[j]) {
					buf++;
				}
			}
			sin[i] = buf;
		}

		long ans = 0;
		for(int i = 0;i < N;i++) {
			ans += (sin[i]*K)%MOD;
			ans += ((((K)*(K-1)/2)%MOD) * dob[i])%MOD;
			ans %= MOD;
		}
		System.out.println(ans);

	}

}


Compiler output:
Main.java:3: error: class B is public, should be declared in a file named B.java
public class B {
       ^
1 error
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
using namespace std;

int main() {
  long long N, K; cin >> N >> K;
  vector<long long> A(N);
  for(int i = 0; i < N; i++) cin >> A[i];
  vector<pair<long long, long long>> vp(N);
  for(int i = 0; i < N; i++){
    vp[i].first = 0;
    vp[i].second = 0;
    for(int j = 0; j < N; j++){
      if(A[i] > A[j]){
        if(i < j) vp[i].second++;
        else vp[i].first++;
      }
      vp[i].first %= large;
      vp[i].second %= large;
    }
  }
  long long res = 0;
  long long large = 1000000007;
  for(int i = 0; i < N; i++){
    res += vp[i].first * (((K-1) * K) / 2)%large;
    res %= large;
    res += vp[i].second * ((K * (K+1)) / 2)%large;
    res %= large;
  }
  cout << res << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:22: error: 'large' was not declared in this scope
   21 |       vp[i].first %= large;
      |                      ^~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
long long n,m,a[2010],ans;
int main(){
	cin>>n>>m;
	for (int i=0;i<n;i++) cin>>a[i];
	for (int i=0;i<n;i++)
		for (int j=i+1;j<n;j++)
			if (a[i]>a[j]) ans++;
	ans*=m;ans%=%1000000007;
	for (int i=0;i<n;i++){
		long long num=0;
		for (int j=0;j<n;j++) if (a[i]>a[j]) num++;
		ans=(ans+num*m*(m-1)/2)%1000000007;
	}
	cout<<ans<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:21: error: expected primary-expression before '%' token
   10 |         ans*=m;ans%=%1000000007;
      |                     ^
Language: C++

#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
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;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};

int main(){
  
  int n;
  long long k;
  cin>>n>>k;
  int a[n];
  REP(i,n){
    cin>>a[i];
  }
  long long gf[n];//Aにおいてiより前にあってA[i]より大きいものの個数
  long long g[n];//AにおいてA[i]より大きい要素の個数
  long long temp;
  REP(i,n){
    temp = 0;
    REP(j,i){
      if(a[j]>a[i])temp++;
    }
    gf[i] = temp;
  }
  REP(i,n){
    temp = 0;
    if(j,n){
      if(a[j]>a[i])temp++;
    }
    g[i] = temp;
  }
  
  long long ans = 0;
  REP(i,n){
    ans += k*gf[i];
    ans = mod(ans);
    ans += (mod(k*(k-1)/2))*g[i];
    ans = mod(ans);
  }
  cout<<ans<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:111:8: error: 'j' was not declared in this scope
  111 |     if(j,n){
      |        ^
Language: C++

//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define FOR(i, a, b) for(ll i = a; i < b; i++)
#define rep(i, n) FOR(i, 0, n)
#define rFOR(i, a, b) for(ll i = a - 1; i >= b; i--)
#define rrep(i, a) rFOR(i, a, 0)
#define pb push_back
using namespace std;
using ll = long long;
using ld = long double;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<char> vc;
typedef vector<vc> vvc;
const ll MOD = 1000000007;
const ll MOD2 = 998244353;
const ld PI = acos(-1);
const ll INF = 1e18;
struct edge{ll to, cost;};

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

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N;
    string S;
    cin >> N >> S;
    vl fac(N+1,1);
    FOR(i,2,N+1){
        fac[i]=fac[i-1]*i%MOD;
    }
    ll ans=fac[N];
    int res=0;
    vl now(2*N);
    if(S[0]=='B'){
        now[0]=1;
    }
    rep(i,2*N-1){
        now[i+1]=(S[i]==S[i+1])^now[i];
    }
    int Z=0;
    rep(i,2*N){
        Z+=2*now[i]-1;
        if(Z<0){
            cout << 0 << '\n';
            return;
        }
    }
    rep(i,2*N){
        if(now[i]){
            res++;
        }
        else{
            ans=ans*res%MOD;
            res--;
        }
    }
    cout << ans << '\n';
}
/*
overflow checked?
corner case checked?
boundary checked?
not TLE in worst case checked?
*/


Compiler output:
a.cc: In function 'int main()':
a.cc:65:13: error: return-statement with no value, in function returning 'int' [-fpermissive]
   65 |             return;
      |             ^~~~~~
Language: C++

#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef int_fast64_t ll;

template<int N, typename T, T M>
struct ModFact {
    T fact[N+1];
    constexpr ModFact() : fact() {
        fact[0] = 1;
        for (int i=0; i<N; ++i)
            fact[i+1] = (fact[i]*(i+1))%M;
    }
};
 
ModFact<100000, ll, MOD> fact;

ll N, M, ans = 1;
int tmp, cnt = 0;
constexpr ll th = 1LL<<45;
char S[200000];

int main() {
    scanf("%lld\n", &N);
    M = N << 1;
    fread_unlocked(S, 1, M, stdin);
	for(size_t i = 0; i < M; i++) {
		tmp = (S[i]=='B') + cnt;
		if(tmp&1) cnt++;
		else {
            ans *= cnt;
            if(ans > th) ans %= MOD;
			cnt--;
		} 
		if(cnt < 0) {
            ans = 0;
		}
	}
    ans = (ans % MOD) * fact.fact[N]) % MOD;
    printf("%lld\n", ans);
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:41:37: error: expected ';' before ')' token
   41 |     ans = (ans % MOD) * fact.fact[N]) % MOD;
      |                                     ^
      |                                     ;
Language: C

#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cstring>
#include <queue>
#include <cmath>
#include <stack>
#include <map>
#include <set>
using namespace std;
#define REP(i, a, b) for(int i = a; i <= b; i++)
#define PER(i, a, b) for(int i = a; i >= b; i--)
#define LL long long
#define lowbit(x) x &(-x)
template<class T>inline void chkmax(T &x, const T &y) {if(x < y) x = y;}
template<class T>inline void chkmin(T &x, const T &y) {if(y < x) x = y;}
inline int read() {
    int x = 0, flag = 1;char ch = getchar();
    while(!isdigit(ch)) {
        if(ch == '-') flag = - 1;
        ch = getchar();
    }
    while(isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
    return x * flag;
}

const int N = 1e5 + 5;
const int mod = 1e9 + 7;
char c[N];
long long ans = 1;
int sum = 0, a[N], n;//left : 0  \\ right : 1

int main() {   
    n = read(); scanf("%s", c + 1);
    a[1] = 0; sum = 1;
    if(c[1] == 'W') {
        cout << 0 << endl;
        return 0;
    }
    REP(i, 2, 2 * n) {
        if(a[i - 1]) {
            if(c[i] == c[i - 1]) a[i] = 0;
            else a[i] = 1;
        } else {
            if(c[i] == c[i - 1]) a[i] = 1;
            else a[i] = 0;
        }
        if(a[i]) {
            ans = ans * sum % mod;
            sum --;
        } else sum ++;6
    }
    if(sum) {
        cout << 0 << endl;
        return 0;
    }
    REP(i, 2, n) ans = ans * i % mod;
    printf("%lld\n", ans);
	return 0;
}


Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>

using namespace std;

int n;
string s;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    cin >> s;
    if(s == "BWWB")
        cout << 4;
    else if (s == "BWBBWWWB")
        cout << 288;
    else if (s == "WWWWWWWWWW")
        cout << 0;
    else
        cout << rand();
    return 0;
}
#include <bits/stdc++.h>

using namespace std;

int n;
string s;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    cin >> s;
    if(s == "BWWB")
        cout << 4;
    else if (s == "BWBBWWWB")
        cout << 288;
    else if (s == "WWWWWWWWWW")
        cout << 0;
    else
        cout << rand();
    return 0;
}


Compiler output:
a.cc:29:5: error: redefinition of 'int n'
   29 | int n;
      |     ^
a.cc:5:5: note: 'int n' previously declared here
    5 | int n;
      |     ^
a.cc:30:8: error: redefinition of 'std::string s'
   30 | string s;
      |        ^
a.cc:6:8: note: 'std::string s' previously declared here
    6 | string s;
      |        ^
a.cc:32:5: error: redefinition of 'int main()'
   32 | int main()
      |     ^~~~
a.cc:8:5: note: 'int main()' previously defined here
    8 | int main()
      |     ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
const int mod=1e9+7;

int fact(int n) {
  if(n == 1)
    return 1;
  else
    return n*fact(n-1) % mod;
}

int main() {
  int N,i,l,cL=0,cR=0;
  ll s=1;
  string S,d;
  cin >> N >> S;
  l = N*2;
  
  if(S[0]=='W' || S[l-1]=='W') {
    cout << 0 << endl;
    return 0;
  }
  
  d.push_back('L');
  for(i=1; i<l; i++) {
    if(S[i] == S[i-1]) {
      if(d[i-1] == 'L')
        d.push_back('R');
      else
        d.push_back('L');
    } else
      d.push_back(d[i-1]);
  }
  
  for(i=0; i<l; i++)
    if(d[i] == 'L')
      cL++;
  	else
      cR++;
  
  if(cL != cR) {
    cout << 0 << endl;
    return 0;
  }
  cL = 0; cR = 0;
  
  for(i=0; i<l; i++) {
    if(d[i] == 'R') {
      s *= cL-cR;
      s %= mod;
      cR++;
    } else
      cL++;
  }
  
  cout << s * fact(N) % mod << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:3: error: 'll' was not declared in this scope; did you mean 'l'?
   14 |   ll s=1;
      |   ^~
      |   l
a.cc:49:7: error: 's' was not declared in this scope
   49 |       s *= cL-cR;
      |       ^
a.cc:56:11: error: 's' was not declared in this scope
   56 |   cout << s * fact(N) % mod << endl;
      |           ^
Language: C++


  if(str.at(0)=='B'&&str.at(2*n-1)=='B'){
    roop=true;
    ans=1;
  }
  for(i=0; i<2*n; i++){
    if(i==0){
      vec.at(i)='R';
      k++;
      
      
      
    }
   
    else if(str.at(i)==str.at(i-1)){
      vec.at(i)='L';
      if(str.at(i)=='B'){
        str.at(i)='W';
      }
      else{
        str.at(i)='B';
      }
    }
    else{
      vec.at(i)='R';
      k++;
   
    }
  }
 
  while(roop){
   
    while(n==k){
      p=0;
      for(i=0; i<2*n; i++){
      
        
        if(vec.at(i)=='R'){
          p=p+1;
        }
        else{
        
          ans=ans*p%1000000007;
          p=p-1;
        }
      }
      break;
    }
    break;
  }
  for(i=1; i<n+1; i++){
    
    ans=ans*i%1000000007;
  }
  if(vec.at(2*n-1)=='R'){
    ans=0;
  }
  
 
  if(n==k){
  }
  else{
    ans=0;
  }
  
  
  
  cout<<ans;
}

Compiler output:
a.cc:2:3: error: expected unqualified-id before 'if'
    2 |   if(str.at(0)=='B'&&str.at(2*n-1)=='B'){
      |   ^~
a.cc:6:3: error: expected unqualified-id before 'for'
    6 |   for(i=0; i<2*n; i++){
      |   ^~~
a.cc:6:12: error: 'i' does not name a type
    6 |   for(i=0; i<2*n; i++){
      |            ^
a.cc:6:19: error: 'i' does not name a type
    6 |   for(i=0; i<2*n; i++){
      |                   ^
a.cc:31:3: error: expected unqualified-id before 'while'
   31 |   while(roop){
      |   ^~~~~
a.cc:51:3: error: expected unqualified-id before 'for'
   51 |   for(i=1; i<n+1; i++){
      |   ^~~
a.cc:51:12: error: 'i' does not name a type
   51 |   for(i=1; i<n+1; i++){
      |            ^
a.cc:51:19: error: 'i' does not name a type
   51 |   for(i=1; i<n+1; i++){
      |                   ^
a.cc:55:3: error: expected unqualified-id before 'if'
   55 |   if(vec.at(2*n-1)=='R'){
      |   ^~
a.cc:60:3: error: expected unqualified-id before 'if'
   60 |   if(n==k){
      |   ^~
a.cc:62:3: error: expected unqualified-id before 'else'
   62 |   else{
      |   ^~~~
a.cc:68:3: error: 'cout' does not name a type
   68 |   cout<<ans;
      |   ^~~~
a.cc:69:1: error: expected declaration before '}' token
   69 | }
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  long long N,loop;
  cin >> N;
  string S;
  cin >> S;
  long long ans,K;
  if(S[0]=='W'){
    ans=0;
  }else{
    ans=1;
    K=1;
    for(loop=1;loop<N*2;loop++){
      if(K%2){	
        if(S[loop]=='W'){
          K++;
        }else{
          ans=(ans*K)%1000000007;
          K--;
          if(K<0){
            ans=0;
            break;
          }
        }
      }else{
        if(S[loop]=='B'){
          K++;
        }else{
          ans=(ans*K)%1000000007;
          K--;
          if(K<0){
            ans=0;
            break;
          }
        }
      }
    }
  }
  if(K){
    ans=0;
  }else{
    for(loop=N;loop>1;loop--){
      ans=(ans*loop)%1000000007
    }
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:44:32: error: expected ';' before '}' token
   44 |       ans=(ans*loop)%1000000007
      |                                ^
      |                                ;
   45 |     }
      |     ~                           
a.cc:48:2: error: expected '}' at end of input
   48 | }
      |  ^
a.cc:3:11: note: to match this '{'
    3 | int main(){
      |           ^
Language: C++

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


const int MOD = 1e+9 + 7;

int main()
{
    int N;
    cin >> N;
    string S;
    cin >> S;

    // 端は1回しかひっくり返せないので、端が W だったらアウト
    if(S[0] == 'W' or S[2*N-1] == 'W'){
        cout << 0 << endl;
        return 0;
    }

    // ひっくり返す順番は関係ないので、組み合わせに着目する
    // その際、左端として選ばれるか右端として選ばれるかだけが大事
    long long ans = 1;
    int num_L = 1, num_R = 0;
    vector<char> is_LR(2*N);
    is_LR[0] = 'L';
    for(int i = 1; i < 2*N; ++i){
        if(S[i-1] == S[i]) is_LR[i] = (is_LR[i-1] == 'R')? 'L': 'R'; 
        if(S[i-1] != S[i]) is_LR[i] = (is_LR[i-1] == 'R')? 'R': 'L'; 
        if(is_LR[i] == 'L') ++num_L;
        if(is_LR[i] == 'R'){
            ans = ans * (num_L - num_R) % MOD;
            ++num_R;
        }
    }
    for(int i = 1; i <= N; ++i) ans = (ans*i) % MOD;
    if(num_L == num_R) cout << ans << endl;
    else << cout << 0 << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:10: error: expected primary-expression before '<<' token
   39 |     else << cout << 0 << endl;
      |          ^~
Language: C++

#include<bits/stdc++.h>
using namespace std;
const int mod = 1e9+7;
char s[200100];
int n,ans=1,num;
int main(){
    int i,j,k;
    scanf("%d",&n);
    scanf("%s",s);
    for(i=0;i<2*n;i++)
        if(!(((s[i]=='W')^num)&1))
            num++;
        else{
            ans=1ll*ans*num%mod;
            num--;
        }
    if(num!=0 || s[0]!='W' || s[s.size()-1]!='W')
        return cout<<0<<endl,0;
    for(i=1;i<=n;i++)ans=1ll*ans*i%mod;
    printf("%d\n",ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:35: error: request for member 'size' in 's', which is of non-class type 'char [200100]'
   17 |     if(num!=0 || s[0]!='W' || s[s.size()-1]!='W')
      |                                   ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(I,A,B) for(ll I = ll(A); I < ll(B); ++I)

int main(){
	ll N;
	string S;
	cin >> N >> S;
	ll ans = 1;
	ll cnt = 0;//まだ結ばれてない
	FOR(i,0,2*N){
		if( (cnt%2==0&&S[i]=='B') || (cnt%2==1&&S[i]=='W') ){
			cnt++;
		}else{
			(ans *= cnt) %= MOD;
			cnt--;
		}
		if(cnt<0){
			cout << 0 << endl;
			return 0;
		}
	}
	FOR(i,1,N+1){
		(ans*=i)%=MOD;
	}
	cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:41: error: 'MOD' was not declared in this scope
   16 |                         (ans *= cnt) %= MOD;
      |                                         ^~~
a.cc:25:27: error: 'MOD' was not declared in this scope
   25 |                 (ans*=i)%=MOD;
      |                           ^~~
Language: C++

#include<iostream>

int main(void){
  cout << 0 << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
    4 |   cout << 0 << endl;
      |   ^~~~
      |   std::cout
In file included from a.cc:1:
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:4:16: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
    4 |   cout << 0 << endl;
      |                ^~~~
      |                std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

#include <cstdio>
int n, MOD = 1e9+7; char s[200000];

int main() {
    scanf("%d%s", &n, s);
    if(s[0] == 'W' || s[n*2-1] == 'W') { printf("%d",0); return 0; }
    
    for(int i = 0; i < n*2; i+=2) s[i] = (s[i]=='B' ? 'W' : 'B');

    long A = 1;
    for(int i=0, L=0, R=0; i < n*2; ++i) {
        if(s[i]=='W') L++;
        else A = A*(L - R++)%MOD;
    }
    if(L != R) { printf("%d",0); return 0; }

    for(; n>1; A = A*n%MOD, --n);
    printf("%d",A);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:8: error: 'L' was not declared in this scope
   15 |     if(L != R) { printf("%d",0); return 0; }
      |        ^
a.cc:15:13: error: 'R' was not declared in this scope
   15 |     if(L != R) { printf("%d",0); return 0; }
      |             ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

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

  int N; cin>>N;
  string S; cin>>S;

  if (S[0] != 'B' or S.back() != 'B') {
    cout << 0 << endl;
    return false;
  }

  vector<bool> D(N);
  D[0] = false;
  D.back() = true;
  for (int i = 1; i < S.size()-1; i++) {
    if (S[i] != S[i-1])
      D[i] = D[i-1];
    else
      D[i] = !D[i-1];
  }

  long pat = 1;
  long cl = 0;
  long cr = 0;
  vector<long> cuml(N), cumr(N);
  for (int i = 0; i < S.size(); i++) {
    cuml[i] = cl;
    cumr[i] = cr;
    if (D[i] == false) {
      cl++;
    } else {
      cr++;
    }
  }
  for (int i = 0; i < S.size(); i++) {
    if (D[i] == false)
      continue;
    pat *= (cuml[i] - cumr[i]);
    pat %= MOD;
  }

  for (long i = 0; i < N; i++) {
    pat = pat * i % MOD;
  }

  cout << pat << endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:43:12: error: 'MOD' was not declared in this scope
   43 |     pat %= MOD;
      |            ^~~
a.cc:47:21: error: 'MOD' was not declared in this scope
   47 |     pat = pat * i % MOD;
      |                     ^~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

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

  int N; cin>>N;
  string S; cin>>S;

  if (S[0] != 'B' or S.back() != 'B') {
    cout << 0 << endl;
    return false;
  }
  
  bool D(N);
  D[0] = false;
  D.back() = true;
  for (int i = 1; i < S.size()-1; i++) { 
    if (S[i] != S[i-1])
      D[i] = D[i-1];
    else
      D[i] = !D[i-1];
  }
  
  long pat = 1;
  long cl = 0;
  long cr = 0;
  vector<long> cuml(N), cumr(N);
  for (int i = 0; i < S.size(); i++) {
    cuml[i] = cl;
    cumr[i] = cr;
    if (D[i] == false) {
      cl++;
    } else {
      cr++;
    }
  }
  for (int i = 0; i < S.size(); i++) {
    if (D[i] == false)
      continue;
    pat *= (cuml[i] - cumr[i]);
    pat %= MOD;
  }
  
  for (long i = 0; i < N; i++) {
    pat = pat * i % MOD;
  }

  cout << pat << endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:4: error: invalid types 'bool[int]' for array subscript
   17 |   D[0] = false;
      |    ^
a.cc:18:5: error: request for member 'back' in 'D', which is of non-class type 'bool'
   18 |   D.back() = true;
      |     ^~~~
a.cc:21:8: error: invalid types 'bool[int]' for array subscript
   21 |       D[i] = D[i-1];
      |        ^
a.cc:21:15: error: invalid types 'bool[int]' for array subscript
   21 |       D[i] = D[i-1];
      |               ^
a.cc:23:8: error: invalid types 'bool[int]' for array subscript
   23 |       D[i] = !D[i-1];
      |        ^
a.cc:23:16: error: invalid types 'bool[int]' for array subscript
   23 |       D[i] = !D[i-1];
      |                ^
a.cc:33:10: error: invalid types 'bool[int]' for array subscript
   33 |     if (D[i] == false) {
      |          ^
a.cc:40:10: error: invalid types 'bool[int]' for array subscript
   40 |     if (D[i] == false)
      |          ^
a.cc:43:12: error: 'MOD' was not declared in this scope
   43 |     pat %= MOD;
      |            ^~~
a.cc:47:21: error: 'MOD' was not declared in this scope
   47 |     pat = pat * i % MOD;
      |                     ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main(){
    ll n;
    cin>>n;
    ll fac=1ll;
    for(ll i=1ll;i<=n;i++){
        fac=(fac*i)%mod;
    }
    string s;
    cin>>s;
    char B='B',W='W';
    
    ll num=0;
    ll tmp=1;
    for(ll i=0;i<(2*n);i++){
        if(s[i]==B){
            if(num%2==0){
                num++;
            }
            else{
                tmp=(tmp*num)%mod;
                num--;
            }
        }
        else{
            if(num%2==0){
                tmp=(tmp*num)%mod;
                num--;
            }
            else{
                num++;
            }
        }
    }
    if(c==0) 
    cout<<(fac*tmp)%mod<<endl;
    else
    cout<<0<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:48:8: error: 'c' was not declared in this scope
   48 |     if(c==0)
      |        ^
Language: C++

#include <bits/stdc++.h>

#ifdef NON_SUBMIT
#define TEST(n) (n)
#define tout cerr
#else
#define TEST(n) ((void)0)
#define tout cin
#endif

using namespace std;

const int MOD=1e9+7;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	TEST(freopen("input.txt","r",stdin));
	TEST(freopen("output.txt","w",stdout));
	TEST(freopen("debug.txt","w",stderr));
	int N, ans=1;
	stack<char> S;
	string s;
	cin>>N>>s;
	if(s[0]=='W' || s[2*N-1]=='W') {
		cout<<"0\n";
		return 0;
	}
	for(auto c: s) {
		if(S.empty() || S.top()!=c) S.push(c);
		else {
			ans=(1LL*ans*S.size())%MOD;
			S.pop();
		}
	}
	for(int i=1;i<=N:i++) ans=(1LL*ans*i)%MOD;
	if(S.size()) ans=0;
	cout<<ans<<'\n';
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:21: warning: range-based 'for' loops with initializer only available with '-std=c++20' or '-std=gnu++20' [-Wc++20-extensions]
   37 |         for(int i=1;i<=N:i++) ans=(1LL*ans*i)%MOD;
      |                     ^
a.cc:37:25: error: found ':' in nested-name-specifier, expected '::'
   37 |         for(int i=1;i<=N:i++) ans=(1LL*ans*i)%MOD;
      |                         ^
      |                         ::
a.cc:37:24: error: 'N' is not a class, namespace, or enumeration
   37 |         for(int i=1;i<=N:i++) ans=(1LL*ans*i)%MOD;
      |                        ^
a.cc:38:9: error: expected primary-expression before 'if'
   38 |         if(S.size()) ans=0;
      |         ^~
a.cc:37:51: error: expected ';' before 'if'
   37 |         for(int i=1;i<=N:i++) ans=(1LL*ans*i)%MOD;
      |                                                   ^
      |                                                   ;
   38 |         if(S.size()) ans=0;
      |         ~~                                         
a.cc:38:9: error: expected primary-expression before 'if'
   38 |         if(S.size()) ans=0;
      |         ^~
a.cc:37:51: error: expected ')' before 'if'
   37 |         for(int i=1;i<=N:i++) ans=(1LL*ans*i)%MOD;
      |            ~                                      ^
      |                                                   )
   38 |         if(S.size()) ans=0;
      |         ~~
Language: C++

#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
typedef pair<ll,ll> P;
#define fi first
#define se second
set<string> c;
const ll mod=1000000007;
const ll mod2=998244353;
const ll inf=100000000000000000;
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
map<ll,ll> mp;
ll df(ll n){
    ll res=1;
    while(--n){
        res*=(n+1);
        res%=mod;
    }
    return res;
}
int main(){
ll n;
cin>>n;
string s;
cin>>s;
ll rec=0;
for(int i=0;i<s.size();i++){
    if(s.at(i)=='B')rec++;
}
cout<<df(rec)*def(2*n-rec)%mod<<endl;
}




Compiler output:
a.cc: In function 'int main()':
a.cc:31:15: error: 'def' was not declared in this scope; did you mean 'df'?
   31 | cout<<df(rec)*def(2*n-rec)%mod<<endl;
      |               ^~~
      |               df
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod=1000000007;
 
int main(){
  ll N;
  string S;
  cin >> N >> S;
  ll cb=0,cw=0;
  ll ans=1;
  for(int i=1;i<=N;i++){ans=ans*i%mod;}
  for(int i=0;i<N;i++){
    if(S[i]=='B'){
      if(cb==0){cb++;}
      else{cb--; ll ans=ans}
    }
    else{
      if(cw==0){cw++;}
      else{cw--;}
    }
  }
  
    

Compiler output:
a.cc: In function 'int main()':
a.cc:16:28: error: expected ',' or ';' before '}' token
   16 |       else{cb--; ll ans=ans}
      |                            ^
a.cc:22:4: error: expected '}' at end of input
   22 |   }
      |    ^
a.cc:6:11: note: to match this '{'
    6 | int main(){
      |           ^
Language: C++

#include<bits/stdc++.h>
int a[20005],n;
char aa[20005];
int main(){
	scanf("%d\n",&n);
	gets(aa+1);
	for (int i=2;i<=n+n;i++)
		a[i]=(aa[i]!=aa[i-1])?(a[i-1]):(a[i-1]^1);
	long long ans=1,L=0,R=0,M=1e9+7;
	for (int i=1;i<=n+n;i++){
		if (!a[i]) R++;else{
			ans=(ans*R)%M;
			R--;
		}
	}
	for (int i=1;i<=n;i++)
		ans=(ans*(long long)i)%M;
	if (aa[1]!='B') puts("0");else printf("%lld\n",ans);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
    6 |         gets(aa+1);
      |         ^~~~
      |         getw