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

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        char[] s = sc.next().toCharArray();

        int cnt = 0;
        for (int i = s.length-1; i > 0; i--) {
            if (s[i] == 'W') {
                if (s[i-1] == 'B') {
                    s[i] = 'B';
                    s[i-1] = 'W';
                    cnt++;

                    if (i < s.length-3)
                        i+=3;
                }
            }
        }

        System.out.println(cnt);
    }
}


Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.Scanner;
      | ^~~~~~
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 <bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;

int main() {
string s; cin>>s;
  ll bcount=0;
  ll bdis=0;
  rep(i, s.size()){
    if(s[i]=='W'){
      bcount+=1;
      bdis+=i;}
    
    cout<<bcount*(bcount-1)/2-bdis<<endl;
  
  
}

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

#include<iostream>
#include<cmath>
#include<numeric>
#include<string>
#include<algorithm>
#include<vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define int64 long long 
using namespace std;

int main(){
  string pattern;
  cin>>pattern;
  int countwhite=0,whiteposition=0;
  rep(i,pattern.length()){
    if(pattern[i]=='W'){
      countwhite++;
      whiteposition+=i;
    }
    
}

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

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

int main() {
  string s;
  cin >> s;

  int end=0;
  ll ans=0;
  bool flag=false;
  int j;
  for (j=0; i<s.size(); i++) {
    if (s[i]=='B')
      break;
  }
  end=j;    
      
  for (int i=j; i<s.size(); i++) {
    if (s[i]=='B') continue;
    ans+=i-end;
    end++;
  }

  cout<<ans<<endl;
  return 0;
}
 

Compiler output:
a.cc: In function 'int main()':
a.cc:9:3: error: 'll' was not declared in this scope
    9 |   ll ans=0;
      |   ^~
a.cc:12:13: error: 'i' was not declared in this scope
   12 |   for (j=0; i<s.size(); i++) {
      |             ^
a.cc:20:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   20 |     ans+=i-end;
      |     ^~~
      |     abs
a.cc:24:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   24 |   cout<<ans<<endl;
      |         ^~~
      |         abs
Language: C++

#include<iostream>
#include<string>

#define int long long
using namespace std;

int main(){
    string s;
    cin >>s;
    
    int count = 0;
    int total = 0;
    for(int i = 0;i<s.length();i++){
        if(s[i] == 'B'){
            count++;
        }
        else if(s[i] =='W'){
            total += count;
        }
    }
    cout << total <<"\n";
    return 0;
}

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

#include <string>
#include <iostream>
using namespace std;

int main()
{
  string str;
  cin >> str;
  
  int size = str.size();
  
  int count = 0;
  int shift = 0;
  for (int i = 0; i < size;i ++) {
    if (str[i] == "B") {
      count ++;
      shift += (size - i);
    }
  }
  
  cout << (shift  - (count * count + 1) / 2) << endl;
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:16: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   15 |     if (str[i] == "B") {
Language: C++

#include<iostream>
#include<string>

using namespace std;

int main(){
    string s;
    cin >>s;
    
    int count = 0;;
    int total = 0;;
    for(char c:bw){
        if(c == 'B'){
            count++;
        }
        else if(c =='W'){
            total += count;
            //count = 1;
        }
    }
    cout << total <<"\n";
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:16: error: 'bw' was not declared in this scope
   12 |     for(char c:bw){
      |                ^~
Language: C++

#include<bits/stdc++.h>
using ll = long long;
using namespace std;
int main() {
	string S;
  	count
	cin >> S;
	ll ans = 0;
  	ll countb = 0;
  	ll countw = 0;
  	for(int i = 0; i < S.size(); ++i){
      if (S[i] == 'B') countb++;
      if (S[i] == 'W') countw++;
    }
  	for(int i = 0; i < countw; ++i){
      if (S[i] == 'B') ans++;
    }
  	for(int i = countw; i < S.size(); ++i){
      if (S[i] == 'W') ans++;
    }
  	
	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:14: error: expected ';' before 'cin'
    6 |         count
      |              ^
      |              ;
    7 |         cin >> S;
      |         ~~~   
a.cc:7:17: error: statement cannot resolve address of overloaded function
    7 |         cin >> S;
      |                 ^
Language: C

#include<stdio.h>
#include<string.h>
int main(void){
    char S[200000];
    int N,cou;
    scanf("%s",&S);
    N=strlen(S);
    for(i=0;i<N;i++){
        if(S[i]=='B'){
            cou++;
        }else{
            cou--;
        }
    }
    if(cou>=0){
        printf("%d",N-cou);
    }else{
        printf("%d",N+cou);
    }
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:8:9: error: 'i' undeclared (first use in this function)
    8 |     for(i=0;i<N;i++){
      |         ^
main.c:8:9: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <iomanip>
#include <algorithm>
#include <tuple>
#include <queue>
#include <set>
#include <math.h>
#include <array>
#include <list>
#include <set>
const int MOD=1000000007;
const int INF=1000000000;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
string s;
ll ans=0;
int leftblacknum[200005];
int main(int argc,char const* argv[])
{
  memset(leftblacknum,0,sizeof(leftblacknum));
  cin >> s;
  for(int i=0;i<int(s.size());i++)
    {
      if(s[i]=='B') leftblacknum[i]++;
    }
  for(int i=1;i<int(s.size());i++)
    {
      leftblacknum[i]+=leftblacknum[i-1];
    }
  for(int i=0;i<int(s.size());i++)
    {
      if(s[i]=='W')
	{
	  ans+=leftblacknum[i];
	}
    }
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:23:3: error: 'memset' was not declared in this scope
   23 |   memset(leftblacknum,0,sizeof(leftblacknum));
      |   ^~~~~~
a.cc:12:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   11 | #include <list>
  +++ |+#include <cstring>
   12 | #include <set>
Language: C++

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

int main() {
  string s;
  cin>>s;
  long int x,ans;
  x=ans=0;
  for(long int i=0;i<s.size();i++){
    if(s.at(i)=='B')x++;
    if(s.at(i)=='W')ans+=x;
  cout<<ans<<endl;
}


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

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

int main() {
  string s;
  cin>>s;
  int x=0;
  int ans=0;
  
  for(int i=0;i<s.size();i++){
    if(s.at(i)=='B')x++;
    if(s.at(i)=='W')ans+=nyannyan;
  }
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:26: error: 'nyannyan' was not declared in this scope
   12 |     if(s.at(i)=='W')ans+=nyannyan;
      |                          ^~~~~~~~
Language: C++

#include <iostream>
#include <string>
using namespace std;

int main(){
  
  string S;
  cin>>S;
  int pos=0;
  long long ans=0;
  for(int i=0;i<S.size()-1;i+){
    if(S[i]=='W'){
      ans+=i-pos;
      pos++;
    }
  }
  cour<<ans<<endl;
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:30: error: expected primary-expression before ')' token
   11 |   for(int i=0;i<S.size()-1;i+){
      |                              ^
a.cc:17:3: error: 'cour' was not declared in this scope
   17 |   cour<<ans<<endl;
      |   ^~~~
Language: C++

#include <iostream>
#include <string>
using namespace std;

int main(){
  
  string S;
  cin>>S;
  int pos=0;
  long long ans=0;
  for(int i=0;i<S.size()-1;i++){
    if(S[i]=='W'){
      ans+=S[i]-pos;
      pos++;
    }
  }
  cour<<ans<<endl;
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:3: error: 'cour' was not declared in this scope
   17 |   cour<<ans<<endl;
      |   ^~~~
Language: C++

#include <iostream>
#include <string>
using namespace std;

int main(){
  
  string S;
  cin>>S;
  int pos=0;
  long long ans=0;
  for(int i=0;i<S.size()-1;i+){
    if(S[i]=='W'){
      ans+=S[i]-pos;
      pos++;
    }
  }
  cour<<ans<<endl;
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:30: error: expected primary-expression before ')' token
   11 |   for(int i=0;i<S.size()-1;i+){
      |                              ^
a.cc:17:3: error: 'cour' was not declared in this scope
   17 |   cour<<ans<<endl;
      |   ^~~~
Language: C++

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

int main(){
  string s;
  cin>>s;
  int ans=0;
  for(int i=0;i<s.size();i++){
    if(s[i]=='B'&&s[i+1]=='W'){
      ans=ans++;
      i=i-2;
    }
    }
  }
  cout<<ans<<endl;
  return 0;
}


Compiler output:
a.cc:15:3: error: 'cout' does not name a type
   15 |   cout<<ans<<endl;
      |   ^~~~
a.cc:16:3: error: expected unqualified-id before 'return'
   16 |   return 0;
      |   ^~~~~~
a.cc:17:1: error: expected declaration before '}' token
   17 | }
      | ^
Language: C++

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

int main(){
  string s;
  cin>>s;
  int ans=0;
  for(int i=0;i<s.size()i++){
    if(s[i]=='B'&&s[i+1]=='W'){
      ans=ans++;
      i=i-2;
    }
    }
  }
  cout<<ans<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:25: error: expected ';' before 'i'
    8 |   for(int i=0;i<s.size()i++){
      |                         ^
      |                         ;
a.cc: At global scope:
a.cc:15:3: error: 'cout' does not name a type
   15 |   cout<<ans<<endl;
      |   ^~~~
a.cc:16:3: error: expected unqualified-id before 'return'
   16 |   return 0;
      |   ^~~~~~
a.cc:17:1: error: expected declaration before '}' token
   17 | }
      | ^
Language: C++

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

int main(){
  cin>>S;
  int ans=0;
  for(int i=0;i<s.size()i++){
    if(s[i]=='B'&&s[i+1]=='W'){
      ans=ans++;
      i=i-2;
    }
    }
  }
  cout<<ans<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:5:8: error: 'S' was not declared in this scope
    5 |   cin>>S;
      |        ^
a.cc:7:17: error: 's' was not declared in this scope
    7 |   for(int i=0;i<s.size()i++){
      |                 ^
a.cc:7:25: error: expected ';' before 'i'
    7 |   for(int i=0;i<s.size()i++){
      |                         ^
      |                         ;
a.cc: At global scope:
a.cc:14:3: error: 'cout' does not name a type
   14 |   cout<<ans<<endl;
      |   ^~~~
a.cc:15:3: error: expected unqualified-id before 'return'
   15 |   return 0;
      |   ^~~~~~
a.cc:16:1: error: expected declaration before '}' token
   16 | }
      | ^
Language: C

#include<stdio.h>
int main(void){
  char s[2*100000];
  scanf("%s",s);
  int i,j,k;
  i=0;
  j=0;	
  While(s[i+1]!=¥0){
    if(s[i]=='B'&&s[i+1]=='W'){
      j++;
      k=1;
    }
    if(s[i+2]==¥0 && k==1){
      i=-1;
      k=0;
    }
    if(s[i+2]==¥0 && k==0)break;
    i++
  }
  printf("%d",j);
  
  return 0;
}
  

Compiler output:
main.c: In function 'main':
main.c:8:3: error: implicit declaration of function 'While' [-Wimplicit-function-declaration]
    8 |   While(s[i+1]!=¥0){
      |   ^~~~~
main.c:8:17: error: stray '\302' in program
    8 |   While(s[i+1]!=<U+00A5>0){
      |                 ^~~~~~~~
main.c:8:20: error: expected ';' before '{' token
    8 |   While(s[i+1]!=¥0){
      |                    ^
      |                    ;
main.c:13:16: error: stray '\302' in program
   13 |     if(s[i+2]==<U+00A5>0 && k==1){
      |                ^~~~~~~~
main.c:17:16: error: stray '\302' in program
   17 |     if(s[i+2]==<U+00A5>0 && k==0)break;
      |                ^~~~~~~~
Language: C

#include<stdio.h>
int main(void){
  char s[2*100000];
  scanf("%s",s);
  int i,j,k;
  i=0;
  j=0;
  While(s[i+1]!=\0){
    if(s[i]=='B'&&s[i+1]=='W'){
      j++;
      k=1;
    }
    if(s[i+2]==\0 && k==1){
      i=-1;
      k=0;
    }
    if(s[i+2]==\0 && k==0)break;
    i++
  }
  printf("%d",j);
  
  return 0;
}
  

Compiler output:
main.c: In function 'main':
main.c:8:3: error: implicit declaration of function 'While' [-Wimplicit-function-declaration]
    8 |   While(s[i+1]!=\0){
      |   ^~~~~
main.c:8:17: error: stray '\' in program
    8 |   While(s[i+1]!=\0){
      |                 ^
main.c:8:20: error: expected ';' before '{' token
    8 |   While(s[i+1]!=\0){
      |                    ^
      |                    ;
main.c:13:16: error: stray '\' in program
   13 |     if(s[i+2]==\0 && k==1){
      |                ^
main.c:17:16: error: stray '\' in program
   17 |     if(s[i+2]==\0 && k==0)break;
      |                ^
Language: C

#include<stdio.h>
int main(void){
  char s[2*100000];
  scanf("%s",s);
  int i,j,k;
  i=0;j=0;
  While(s[i+1]!=\0){
    if(s[i]=='B'&&s[i+1]=='W'){
      j++;
      k=1;
    }
    if(s[i+2]==\0 && k==1){
      i=-1;
      k=0;
    }
    i++
  }
  printf("%d",j);
  
  return 0;
}
  

Compiler output:
main.c: In function 'main':
main.c:7:3: error: implicit declaration of function 'While' [-Wimplicit-function-declaration]
    7 |   While(s[i+1]!=\0){
      |   ^~~~~
main.c:7:17: error: stray '\' in program
    7 |   While(s[i+1]!=\0){
      |                 ^
main.c:7:20: error: expected ';' before '{' token
    7 |   While(s[i+1]!=\0){
      |                    ^
      |                    ;
main.c:12:16: error: stray '\' in program
   12 |     if(s[i+2]==\0 && k==1){
      |                ^
Language: C++

#include<iostream>
#include<string>
#include<vector>

using namespace std;

int main()
{
    char ch[200001];
    cin >> ch;
    int n = strlen(ch);
    int ans = 0;
    int count = 0;
    for(int i = 0; i < n; i++)
        ch[i] == 'B' ? ++count : ans += count;
    cout << ans << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:13: error: 'strlen' was not declared in this scope
   11 |     int n = strlen(ch);
      |             ^~~~~~
a.cc:4:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include<vector>
  +++ |+#include <cstring>
    4 |
Language: C++

#include<bits/stdc++.h>


using namespace std;

int N;
string str;
int main(){
  cin >> str;
  int ans=0;
  int tmp=0;
  N=str.size();
  whille(1){
    for(int i=0;i!=N;i++){
      if(str[i]=='B'&&str[i+1]=='W'){
        ans++;
        tmp++;
        str[i]='W';
        str[i+1]='B';
      }
    }
    if(tmp==0){
      break;
    }
    else{
      tmp=0;
    }
  }
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:3: error: 'whille' was not declared in this scope
   13 |   whille(1){
      |   ^~~~~~
Language: C++

include<bits/stdc++.h>


using namespace std;

int N;
string str;
int main(){
  cin >> str;
  int ans=0;
  int tmp=0;
  N=str.size();
  whille(1){
    for(int i=0;i!=N;i++){
      if(str[i]=='B'&&str[i+1]=='W'){
        ans++;
        tmp++;
        str[i]='W';
        str[i+1]='B';
      }
    }
    if(tmp==0){
      break;
    }
    else{
      tmp=0;
    }
  }
  cout << ans << endl;
}


Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include<bits/stdc++.h>
      | ^~~~~~~
a.cc:7:1: error: 'string' does not name a type
    7 | string str;
      | ^~~~~~
a.cc: In function 'int main()':
a.cc:9:3: error: 'cin' was not declared in this scope
    9 |   cin >> str;
      |   ^~~
a.cc:9:10: error: 'str' was not declared in this scope; did you mean 'std'?
    9 |   cin >> str;
      |          ^~~
      |          std
a.cc:13:3: error: 'whille' was not declared in this scope
   13 |   whille(1){
      |   ^~~~~~
a.cc:29:3: error: 'cout' was not declared in this scope
   29 |   cout << ans << endl;
      |   ^~~~
a.cc:29:18: error: 'endl' was not declared in this scope
   29 |   cout << ans << endl;
      |                  ^~~~
Language: C++

#include <iostream>
using namespace std;

int main(){
  string s;
  cin >> s;
  int count=0;
  int place=0;
  for(int i=0;i<s.size();i++){
    if(s.at(i)=='W'){
      count++;
      place=place+i+1;
    }
  }
  cout << place-count(count+1)/2 << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:22: error: 'count' cannot be used as a function
   15 |   cout << place-count(count+1)/2 << endl;
      |                 ~~~~~^~~~~~~~~
Language: C++

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

int main() {

    string s;
    cin >> s;
    int w_sum = 0;
    int len = s.length();
    int b_count = 0;
    for (int i = 0 ; i < s.length(); i++) {
        if (s[i] == 'W')  w_sum += b_count;
        else b_count += 1;
    }
    cout << w_sum ;
    return 0;

Compiler output:
a.cc: In function 'int main()':
a.cc:17:14: error: expected '}' at end of input
   17 |     return 0;
      |              ^
a.cc:5:12: note: to match this '{'
    5 | int main() {
      |            ^
Language: Java

public class Main {
    public static void main(String args[]){
        Scanner scanner = new Scanner(System.in);
        String S = scanner.next();
		int count = 0;
        int total = 0;

        for (int index = S.length(); index > 0; index-- ){
            if (S.charAt(index-1) == 'B'){
                total += count;
            }else{
                count++;
            }
        }
        System.out.println(total);
    }

Compiler output:
Main.java:16: error: reached end of file while parsing
    }
     ^
1 error
Language: Java

package atcoder_problem;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Powers_of_two_B {

	public static int solution(int n, int[] nums) {
		
		List<List<Integer>> lists = new ArrayList<List<Integer>>();
		List<Integer> list = new ArrayList<>();
		int count = 0;
		subSet(lists, list, nums, 0);
		for(int i=0; i<lists.size(); i++) {
			List<Integer> tmpList = lists.get(i);
			for(int j=i+1; j<lists.size(); j++) {
				if(tmpList.containsAll(lists.get(j))) {
					lists.remove(j);
				}
			}
		}
		System.out.println(lists);
		for(int i=0; i<lists.size(); i++) {
			List<Integer>  subList = lists.get(i);
			int sum = 0;
			for(int j=0; j<subList.size(); j++) {
				sum += subList.get(j);
			}
			if((sum&(sum-1)) == 0) {
				count += 1;
			}
		}
		return count;
	}

	private static void subSet(List<List<Integer>> lists, List<Integer> list, 
			int[] nums, int start) {
		if(start > 2) {
			return;
		}else if(start == 2) {
			lists.add(new ArrayList<Integer>(list));
		}else {
			for(int i=0; i<nums.length; i++) {
				if(list.contains(nums[i])) {
					continue;
				}
				list.add(nums[i]);
				subSet(lists, list, nums, start+1);
				list.remove(list.size()-1);
			}
		}
	}
	public static void main(String[] args) {
		
		Scanner scanner = new Scanner(System.in);
		int N = Integer.parseInt(scanner.next());
		int[] a = new int[N];
		for(int i=0;i<N;i++)a[i]=Integer.parseInt(scanner.next());
		
		int solution = solution(N, a);
		System.out.println(solution);
	}
}


Compiler output:
Main.java:7: error: class Powers_of_two_B is public, should be declared in a file named Powers_of_two_B.java
public class Powers_of_two_B {
       ^
1 error
Language: Java


	public static int solution(int n, int[] nums) {
		
		List<List<Integer>> lists = new ArrayList<List<Integer>>();
		List<Integer> list = new ArrayList<>();
		int count = 0;
		subSet(lists, list, nums, 0);
		for(int i=0; i<lists.size(); i++) {
			List<Integer> tmpList = lists.get(i);
			for(int j=i+1; j<lists.size(); j++) {
				if(tmpList.containsAll(lists.get(j))) {
					lists.remove(j);
				}
			}
		}
		System.out.println(lists);
		for(int i=0; i<lists.size(); i++) {
			List<Integer>  subList = lists.get(i);
			int sum = 0;
			for(int j=0; j<subList.size(); j++) {
				sum += subList.get(j);
			}
			if((sum&(sum-1)) == 0) {
				count += 1;
			}
		}
		return count;
	}

	private static void subSet(List<List<Integer>> lists, List<Integer> list, 
			int[] nums, int start) {
		if(start > 2) {
			return;
		}else if(start == 2) {
			lists.add(new ArrayList<Integer>(list));
		}else {
			for(int i=0; i<nums.length; i++) {
				if(list.contains(nums[i])) {
					continue;
				}
				list.add(nums[i]);
				subSet(lists, list, nums, start+1);
				list.remove(list.size()-1);
			}
		}
	}
	public static void main(String[] args) {
		
		Scanner scanner = new Scanner(System.in);
		int N = Integer.parseInt(scanner.next());
		int[] a = new int[N];
		for(int i=0;i<N;i++)a[i]=Integer.parseInt(scanner.next());
		
		int solution = solution(N, a);
		System.out.println(solution);
	}


Compiler output:
Main.java:2: error: unnamed classes are a preview feature and are disabled by default.
	public static int solution(int n, int[] nums) {
	              ^
  (use --enable-preview to enable unnamed classes)
1 error
Language: C++

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

int a[1000000];


bool mlog(int n)
{
    bool flag = true;
    if (n > 1 && flag == true)
    {
        if (n % 2 == 0) {
            n /= 2;
        }
        else {
            return false;
        }
    }
    return true;
}

bool cmp(int a, int b)
{
    return a > b;
}

int cnt = 0;

map<int, int> mpow;

int main(int argc, char const *argv[])
{
    int n = 0;
    scanf("%d", &n);
    memset(flag, 0, sizeof(flag));
    
    for (int i = 0; i < n; ++i)
    {
        scanf("%d", &a[i]); 
        ++ mpow[a[i]];
    }
        
    sort( a , a + n , cmp);
/*
    for (int i = 0; i < n; ++i)
        printf("%d ", mpow[ a[i]] );
    printf("\n"); 
*/
    for (int i = 0; i < n; ++i)
    {
        int ran = (int) ( log2( a[i])) + 1;
        int residue = (int)( pow(2, ran)) - a[i];
        if ( (residue != a[i] && mpow[residue] > 0) || (residue == a[i] && mpow[residue] > 1)  )
        {
            mpow[residue] --;
            mpow[a[i]] --;
            cnt ++;
        }   
    }
/*
    for (int i = 0; i < n; ++i)
        printf("%d ", a[i]);
    printf("\n");

    for (int i = 0; i < n; ++i)
        printf("%d ", mpow[a[i]]);
    printf("\n");
*/
    printf("%d", cnt);
    printf("\n");
    return 0;
}



Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:35:12: error: 'flag' was not declared in this scope
   35 |     memset(flag, 0, sizeof(flag));
      |            ^~~~
Language: C++

#include <bits/stdc++.h>

#define rep(i,n) for(auto i=0;i<(n);i++)

using namespace std;


int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    string s;
    cin >> s;

    int n = s.size();
    ll cnt = 0;
    while(true){
        bool ch = false;
        rep(i, n-1){
            if(s[i] == 'B' && s[i+1] == 'W'){
                s[i] = 'W';
                s[i+1] = 'B';
                ch = true;
                cnt++;
            }
        }
        if(!ch) break;
    }

    cout << cnt << endl;
    

    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:16:5: error: 'll' was not declared in this scope
   16 |     ll cnt = 0;
      |     ^~
a.cc:24:17: error: 'cnt' was not declared in this scope; did you mean 'int'?
   24 |                 cnt++;
      |                 ^~~
      |                 int
a.cc:30:13: error: 'cnt' was not declared in this scope; did you mean 'int'?
   30 |     cout << cnt << endl;
      |             ^~~
      |             int
Language: C++

#include<bits/stdc++.h>
using namespace std;
bool cmp(int x,int y) {return x>y;}
int n,ans,a[200005],vis[200005];
int tmp[]={1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,262144,524288,1048576,2097152,4194304,8388608,16777216,33554432,67108864,134217728,268435456,536870912,1073741824};
int main()
{
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
		vis[a[i]]++;
	}
	sort(a,a+n,cmp);
	for(int i=0;i<n;i++)
	{
		int pos=upper_bound(tmp,tmp+30,a[i])-tmp;
		if(k>30) continue;
		int k=tmp[pos]-a[i];
		if(k!=a[i]&&vis[k]||k==a[i]&&vis[k]>1)
		{
			ans++;
			vis[k]--;
			vis[a[i]]--;
		}
	}
	printf("%d\n",ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:20: error: 'k' was not declared in this scope
   18 |                 if(k>30) continue;
      |                    ^
Language: C++

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

int main() {
	string bw;
  	int wcnt = 0;
  	int wplcb = 0;
    int wplca = 0;
  	cin >> bw;

  	for(int i = 0; i < bw.size(); i++) {
    	if(bw.at(i) == `W`) {
          wplca+=wcnt;          
          wcnt++;
          wplcb+=i;
        }
    }
  	cout << wplcb - wplca <<endl;
}

Compiler output:
a.cc:12:24: error: stray '`' in program
   12 |         if(bw.at(i) == `W`) {
      |                        ^
a.cc:12:26: error: stray '`' in program
   12 |         if(bw.at(i) == `W`) {
      |                          ^
a.cc: In function 'int main()':
a.cc:12:25: error: 'W' was not declared in this scope
   12 |         if(bw.at(i) == `W`) {
      |                         ^
Language: Java


public class Main {
    public static void main(String [] args) {
        final Scanner scanner = new Scanner(System.in);
        final String s = scanner.next();
        int count = 0;
        int wIndex = 0;
        for (int i = 0; i < s.length(); ++i) {
            if (s.charAt(i) == 'W') {
                count += i - wIndex;
                ++wIndex;
            }
        }
        System.out.println(count);
    }
}

Compiler output:
Main.java:4: error: cannot find symbol
        final Scanner scanner = new Scanner(System.in);
              ^
  symbol:   class Scanner
  location: class Main
Main.java:4: error: cannot find symbol
        final Scanner scanner = new Scanner(System.in);
                                    ^
  symbol:   class Scanner
  location: class Main
2 errors
Language: C

#include <iostream>
#include <string>
#include <algorithm>
//#define cout std::cout;
//#define cin std::cin;
using namespace std;
int main() {
	string S;
	int N;
	int count = 0;
	cin >> S;
	N = S.length();

	for (;;) {
		int i = S.find("BW");
		if (i >= 0) {
			swap(S[i], S[i + 1]);
			++count;
		}
		else {
			break;
		}
	}

	cout << count << endl;

	system("pause");
}

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

#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int main()
{
  char str1[200000];
  char str2[2] = "BW";
  char* n;
  int num = 0, count = 0;
  scanf("%s", &str1);
  num = strlen(str1);
  for (int i = 0; i < num; i++) {
    for (int j = 0; j < num - 1; j++) {
      if (str1[j] == 'B' && str1[j+1] == 'W') {
        str1[j] = 'W'; str1[j+1] = 'B';
        count += 1;
      }
    }
  }
  printf("%d", count);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:18: error: initializer-string for 'char [2]' is too long [-fpermissive]
    8 |   char str2[2] = "BW";
      |                  ^~~~
Language: C++

#include <iostream>
#include <string>

int main(){
  std::string s;
  std::cin >> s;
  
  int count = 0;
  int Bcount = 0;
  
  for(auto c : s){
    switch(c){
      case 'B':
        Bcount++;
        break;
      default:
        count += Bcount;
        break;
  }
  
  std::cout << count << std::endl;
  return 0;
}

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

#include<bits/stdc++.h>
using namespace std;
char s[200005];
int n,x
long long ans;
int main()
{
	scanf("%s",s+1);
	n=strlen(s+1);
	for(int i=1;i<=n;i++)
		if(s[i]=='W')
		{
			x++;
			ans+=i-x;
		}
	printf("%lld",ans);
}

Compiler output:
a.cc:5:1: error: expected initializer before 'long'
    5 | long long ans;
      | ^~~~
a.cc: In function 'int main()':
a.cc:13:25: error: 'x' was not declared in this scope
   13 |                         x++;
      |                         ^
a.cc:14:25: error: 'ans' was not declared in this scope; did you mean 'abs'?
   14 |                         ans+=i-x;
      |                         ^~~
      |                         abs
a.cc:16:23: error: 'ans' was not declared in this scope; did you mean 'abs'?
   16 |         printf("%lld",ans);
      |                       ^~~
      |                       abs
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<int,int> P;
const LL mod=1000000007;
const LL LINF=1LL<<62;
const LL INF=1<<17;




int main(){
    string s;cin >> s;
    int c=0,ans=0;
    for (int i = s; i < s.length(); i++) {
        if(s[i]=='B') c++;
        else ans+=c;
    }
    cout << ans << endl;
    return 0;
}




Compiler output:
a.cc: In function 'int main()':
a.cc:22:18: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'int' in initialization
   22 |     for (int i = s; i < s.length(); i++) {
      |                  ^
      |                  |
      |                  std::string {aka std::__cxx11::basic_string<char>}
Language: C

#include <stdio.h>

int main () {
    char s;
    int j=0,c=0;

    while() {
        scanf("%c",&s);
        if(s=='B') j++;
        else if(s=='W') c+=j;
        else break;
    }

    printf("%d\n",c);
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:7:11: error: expected expression before ')' token
    7 |     while() {
      |           ^
Language: C++

#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>

#define MAX_N 100
#define rep(i, n) for(int i=0; i<n; ++i)
#define REP(i, s, t) for(int i=s; i<=s; ++i)

using namespace std;

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

    string s;
    cin >> s;

    int count = 0;
    rep(i, s.size())
    {
        int c = 0;
        if(s[i] == 'B' && c > 0)
        {
            count += c;
            c = 0;
        }
        else if(s[i] == 'W') c++;
        else c = 0;
    }

    cout << c << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:13: error: 'c' was not declared in this scope
   34 |     cout << c << endl;
      |             ^
Language: C++

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

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin>>n;
	long long v[210000];
	for(int i=0;i<n;i++)
	cin>>v[i];
	sort(v.begin(),v.end());
	multiset<long long> ssi;
	for(int i=0;i<n;i++)
	{
	    ssi.insert(v[i]);
	}
	int res=0;
	while(!ssi.empty())
	{
	    long long x=*ssi.rbegin();
	   
	   while (!ssi.empty()) {
		long long x = *ssi.rbegin();
		ssi.erase(ssi.find(x));
		long long now = 1;
		while (now <= x)
			now *= 2;
		auto it = ssi.find(now - x);
		if (it == ssi.end())
			continue;
		ssi.erase(it);
		++res;
	}
	}
	cout<<res<<'\n';
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:16: error: request for member 'begin' in 'v', which is of non-class type 'long long int [210000]'
   12 |         sort(v.begin(),v.end());
      |                ^~~~~
a.cc:12:26: error: request for member 'end' in 'v', which is of non-class type 'long long int [210000]'
   12 |         sort(v.begin(),v.end());
      |                          ^~~
Language: C++

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

int main() {
  string s;
  cin >> s;
  int x = 0;
  int j = 0;//黒い石の数
  int y = 0;
  for (int i = 0; i < s.size; i++) {
    if (s.at(i) = 'B') {
      x += s.size() - j;
      j++;
      y += i;
    }
  }
  cout << x - y << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:25: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
   10 |   for (int i = 0; i < s.size; i++) {
      |                       ~~^~~~
      |                             ()
Language: C++

#include <iostream>
#include <string>
using namespace std;

int main() {
  string S;
  cin >> S;
  int N = S.size(), ans = 0, w = 0;
  
  for (int i=0; i<N; ++i) {
    if (S[i] == 'W') {
      // bの数をカウント
      w++;
      // ans += (全要素数) - (現在の位置) - 1
      ans += i + 1:
    }
  }
  
  // bが左に詰まっている分を正しい位置に配置
  ans -= w * (w + 1) / 2;
  
  cout << ans << endl;
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:19: error: expected ';' before ':' token
   15 |       ans += i + 1:
      |                   ^
      |                   ;
Language: C++

#include <iostream>
unsigned long long ans(0);

int main() {
  	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	std::string S;
	std::getline(std::cin,S);
	unsigned long long offset = 0;
	unsigned long long addnum = 0;
	for (auto itr : S) {
		if(itr == 'W'){
			ans += offset;
			ans += addnum;
			offset += addnum;
			addnum = 0;
		}
		if(itr == 'B'){
			addnum ++;
		}
	}
	std::cout << ans << '\n';
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:5:9: error: 'ios_base' has not been declared
    5 |         ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
      |         ^~~~~~~~
a.cc:5:43: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    5 |         ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
      |                                           ^~~
      |                                           std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:5:55: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
    5 |         ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
      |                                                       ^~~~
      |                                                       std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
Language: C

#include <stdio.h>
#include <string.h>

const int N=1e5+5;
char str[N];

int main()
{
    memset(str,'\0',sizeof(str));
    while(scanf("%s",str)!=EOF)
    {   int ans,cnt;
        ans=cnt=0;
        for(int i=0;str[i]!='\0';i++)
        {
            if(str[i]=='B')
                cnt++;
            else
                ans+=cnt;
        }
        printf("%d\n",ans);
        memset(str,'\0',sizeof(str));
    }
    return 0;
}


Compiler output:
main.c:5:6: error: variably modified 'str' at file scope
    5 | char str[N];
      |      ^~~
Language: C++

#include <stdio.h>
#include <string.h>
char str[1e5+5];

int main()
{
    memset(str,'\0',sizeof(str));
    while(scanf("%s",str)!=EOF)
    {   int ans,cnt;
        ans=cnt=0;
        for(int i=0;str[i]!='\0';i++)
        {
            if(str[i]=='B')
                cnt++;
            else
                ans+=cnt;
        }
        printf("%d\n",ans);
        memset(str,'\0',sizeof(str));
    }
    return 0;
}


Compiler output:
a.cc:3:13: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
    3 | char str[1e5+5];
      |          ~~~^~
a.cc:3:13: error: could not convert '(1.0e+5 + (double)5)' from 'double' to 'long unsigned int'
    3 | char str[1e5+5];
      |          ~~~^~
      |             |
      |             double
a.cc:3:13: error: size of array 'str' has non-integral type 'double'
Language: C++

#!/usr/bin/perl -w

chomp ($line=<>);
$count=0;
for(;;){
    $n=index($line,"BW");
    if($n>=0){
        substr($line,$n,2,"WB");
        $count++;
    }else{
        last;
    }

}
print $count;

Compiler output:
a.cc:1:2: error: invalid preprocessing directive #!
    1 | #!/usr/bin/perl -w
      |  ^
a.cc:3:7: error: expected constructor, destructor, or type conversion before '(' token
    3 | chomp ($line=<>);
      |       ^
a.cc:4:1: error: '$count' does not name a type
    4 | $count=0;
      | ^~~~~~
a.cc:5:1: error: expected unqualified-id before 'for'
    5 | for(;;){
      | ^~~
a.cc:5:7: error: expected unqualified-id before ')' token
    5 | for(;;){
      |       ^
a.cc:15:1: error: 'print' does not name a type; did you mean 'int'?
   15 | print $count;
      | ^~~~~
      | int
Language: C++

S = input()[::-1]
find_w = False
w_count = 0
result = 0
 
for i, c in enumerate(S):
    if not find_w:
        if c == "B":
            continue
        else:
            find_w = True
            w_count += 1
    else:
        if c == "B":
            result += w_count
        else:
            w_count += 1
 
print(result)

Compiler output:
a.cc:1:1: error: 'S' does not name a type
    1 | S = input()[::-1]
      | ^
Language: C++

s = list(input())
t=len(s)
count = 0
a = 0
for j in range(t):
    if(s[j]=='W'):
        count += j-a
        a += 1
print(count)

Compiler output:
a.cc:1:1: error: 's' does not name a type
    1 | s = list(input())
      | ^
Language: C

#include <stdio.h>
#include <string.h>

int main(void)
{
  char str[200001];
 unsigned long int Bcount = 0;
 unsigned long int ans = 0;

  scanf("%s", str);

  for ( unsigned long int i = 0; str[i])!='\0'; i++)
  {
    if (str[i] == 'B')
    {
      Bcount++;
    }
    else
    {
      ans += Bcount;
    }
  }
  printf("%d", ans);

  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:12:40: error: expected ';' before ')' token
   12 |   for ( unsigned long int i = 0; str[i])!='\0'; i++)
      |                                        ^
      |                                        ;
main.c:12:41: error: expected expression before '!=' token
   12 |   for ( unsigned long int i = 0; str[i])!='\0'; i++)
      |                                         ^~
main.c:12:49: error: 'i' undeclared (first use in this function)
   12 |   for ( unsigned long int i = 0; str[i])!='\0'; i++)
      |                                                 ^
main.c:12:49: note: each undeclared identifier is reported only once for each function it appears in
main.c:12:52: error: expected ';' before ')' token
   12 |   for ( unsigned long int i = 0; str[i])!='\0'; i++)
      |                                                    ^
      |                                                    ;
main.c:12:52: error: expected statement before ')' token
Language: C++

#include<iostream>
using namespace std;
 
int main(){
  char[200000] s;
  cin >> s;
  int n;
  for(n=0; s[n]!='\0'; n++) int a=0;
  
  int ans=0;
  for(int i=0; i<n-2; i++)
    if(s[i]=='B')
      for(int j=i+1; j<n-1; j++)
        if(s[j]=='W') ans++;
  
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:8: error: expected identifier before numeric constant
    5 |   char[200000] s;
      |        ^~~~~~
a.cc:5:8: error: expected ']' before numeric constant
    5 |   char[200000] s;
      |        ^~~~~~
      |        ]
a.cc:5:7: error: structured binding declaration cannot have type 'char'
    5 |   char[200000] s;
      |       ^
a.cc:5:7: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:5:7: error: empty structured binding declaration
a.cc:5:16: error: expected initializer before 's'
    5 |   char[200000] s;
      |                ^
a.cc:6:10: error: 's' was not declared in this scope
    6 |   cin >> s;
      |          ^
Language: C++

#include<iostream>
using namespace std;
 
int main(){
  char[200000] s;
  cin >> s;
  int n;
  for(n=0; s[n]!='\0'; n++);
  
  int ans=0;
  for(int i=0; i<n-2; i++)
    if(s[i]=='B')
      for(int j=i+1; j<n-1; j++)
        if(s[j]=='W') ans++;
  
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:8: error: expected identifier before numeric constant
    5 |   char[200000] s;
      |        ^~~~~~
a.cc:5:8: error: expected ']' before numeric constant
    5 |   char[200000] s;
      |        ^~~~~~
      |        ]
a.cc:5:7: error: structured binding declaration cannot have type 'char'
    5 |   char[200000] s;
      |       ^
a.cc:5:7: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:5:7: error: empty structured binding declaration
a.cc:5:16: error: expected initializer before 's'
    5 |   char[200000] s;
      |                ^
a.cc:6:10: error: 's' was not declared in this scope
    6 |   cin >> s;
      |          ^
Language: C++

#include<iostream>
#include<cstring>
using namespace std;
 
int main(){
  string s;
  cin >> s;
  int n=s.length;
  
  int ans=0;
  for(int i=0; i<n-2; i++)
    if(s[i]=='B')
      for(int j=i+1; j<n-1; j++)
        if(s[j]=='W') ans++;
  
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:11: error: cannot convert 'std::__cxx11::basic_string<char>::length' from type 'std::__cxx11::basic_string<char>::size_type (std::__cxx11::basic_string<char>::)() const noexcept' {aka 'long unsigned int (std::__cxx11::basic_string<char>::)() const noexcept'} to type 'int'
    8 |   int n=s.length;
      |           ^~~~~~
Language: C++

#include<iostream>
using namespace std;
 
int main(){
  string s;
  cin >> s;
  int n=s.length;
  
  int ans=0;
  for(int i=0; i<n-2; i++)
    if(s[i]=='B')
      for(int j=i+1; j<n-1; j++)
        if(s[j]=='W') ans++;
  
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:11: error: cannot convert 'std::__cxx11::basic_string<char>::length' from type 'std::__cxx11::basic_string<char>::size_type (std::__cxx11::basic_string<char>::)() const noexcept' {aka 'long unsigned int (std::__cxx11::basic_string<char>::)() const noexcept'} to type 'int'
    7 |   int n=s.length;
      |           ^~~~~~
Language: C++

#include<iostream>
using namespace std;

int main(){
  char s[200000];
  cin >> s;
  int n=s.length;
  
  int ans=0;
  for(int i=0; i<n-2; i++)
    if(s[i]=='B')
      for(int j=i+1; j<n-1; j++)
        if(s[j]=='W') ans++;
  
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:11: error: request for member 'length' in 's', which is of non-class type 'char [200000]'
    7 |   int n=s.length;
      |           ^~~~~~
Language: C

#include <stdio.h>
#include <string.h>

int main(){
  int i,j;
  char s[2000001];
  
  scanf("%s", s);
  
  size_t les = strles(s);
  int a,b=0,num=les,lap=0;
  
  for(i=les-1;i>=0;i-=1){
	if(s[i]=='W'){
		a=(num-i-1)*lap;
      	b+=a;
      	lap++;
      	num=i;
    }
  }
  
  printf("%d", b+num*lap);
}


Compiler output:
main.c: In function 'main':
main.c:10:16: error: implicit declaration of function 'strles'; did you mean 'strlen'? [-Wimplicit-function-declaration]
   10 |   size_t les = strles(s);
      |                ^~~~~~
      |                strlen
Language: C

#include <stdio.h>
#include <string.h>

int main(){
  int i,j;
  char s[2000001];
  
  scanf("%s", s);
  
  int les = strles(s);
  int a,b=0,num=les,lap=0;
  
  for(i=les-1;i>=0;i-=1){
	if(s[i]=='W'){
		a=(num-i-1)*lap;
      	b+=a;
      	lap++;
      	num=i;
    }
  }
  
  printf("%d", b+num*lap);
}

Compiler output:
main.c: In function 'main':
main.c:10:13: error: implicit declaration of function 'strles'; did you mean 'strlen'? [-Wimplicit-function-declaration]
   10 |   int les = strles(s);
      |             ^~~~~~
      |             strlen
Language: C++

#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>

using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e9;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)
#define Yes(condition) if(condition){ cout << "Yes" << '\n'; }else{ cout << "No" << '\n'; }
#define YES(condition) if(condition){ cout << "YES" << '\n'; }else{ cout << "NO" << '\n'; }
#define yes(condition) if(condition){ cout << "yes" << '\n'; }else{ cout << "no" << '\n'; }


#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>

using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e9;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)
#define Yes(condition) if(condition){ cout << "Yes" << '\n'; }else{ cout << "No" << '\n'; }
#define YES(condition) if(condition){ cout << "YES" << '\n'; }else{ cout << "NO" << '\n'; }
#define yes(condition) if(condition){ cout << "yes" << '\n'; }else{ cout << "no" << '\n'; }





int main() {
    char s[100005];
    scanf("%s", &s);
    int ans = 0, p = 0;
    for(int i = 0; s[i] != '\0'; i++){
        if(s[i] == 'W'){
            ans += i - p++;
        }
    }
    printf("%d\n", ans);
}



int main() {
    char s[100005];
    scanf("%s", &s);
    int ans = 0, p = 0;
    for(int i = 0; s[i] != '\0'; i++){
        if(s[i] == 'W'){
            ans += i - p++;
        }
    }
    printf("%d\n", ans);
}


Compiler output:
a.cc:56:10: error: redefinition of 'const ll INF'
   56 | const ll INF = 1e9;
      |          ^~~
a.cc:24:10: note: 'const ll INF' previously defined here
   24 | const ll INF = 1e9;
      |          ^~~
a.cc:57:10: error: redefinition of 'const ll MOD'
   57 | const ll MOD = 1e9 + 7;
      |          ^~~
a.cc:25:10: note: 'const ll MOD' previously defined here
   25 | const ll MOD = 1e9 + 7;
      |          ^~~
a.cc:82:5: error: redefinition of 'int main()'
   82 | int main() {
      |     ^~~~
a.cc:68:5: note: 'int main()' previously defined here
   68 | int main() {
      |     ^~~~
Language: Java

import java.util.Scanner;

public class Scratch {
    private static Scanner scan = new Scanner(System.in);
    public static void main(String[] args) {
        String S = scan.next();
        long count = 0;
        long x = 0;
        for (int i = 0; i < S.length(); i++) {
            if(S.charAt(i) == 'W'){
                count+=x;
            }else{
                x++;
            }
        }
        System.out.println(count);
    }
}

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