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

#include<iostream>
#include<vector>
#include<string>
#include<set>
#include<algorithm>

#define pb push_back
#define pf push_front

using namespace std;	
typedef long long int lli;

lli n,k,l,m,t,a,b,r,c,temp1,temp2,x,y,temp,q,d,mod=1e9+7,w;

long double dist(lli a,lli b)
{
	return sqrt(a*a +b*b);
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    cin>>k;
    lli cnt=1;
    if(k%2==0)cout<<-1<<endl;
    else
    {
    	lli temp=7;
    	bool yes=false;
    	while(1)
    	{
    		if(temp%k==0)
    		{
    			yes=true;
    			break;
    		}
    		else
    		{
    			cnt++;
    			temp=temp*10 +7;
    		}
    		
    		if(temp>1e8)break;
    	}
    	
    	if(yes)cout<<cnt<<endl;
    	else cout<<-1<<endl;
    }
}

Compiler output:
a.cc: In function 'long double dist(lli, lli)':
a.cc:17:16: error: 'sqrt' was not declared in this scope
   17 |         return sqrt(a*a +b*b);
      |                ^~~~
Language: C++

    #include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define MOD 1000000007ll 
#define pb push_back
#define vl vector<ll>
#define pll pair<ll,ll>
#define mp make_pair
using namespace std;
#define pi (long double)3.14159265358979323846 
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
 struct sch{
  ll s,e,t;
};
bool sortinrev(const struct sch &a, const struct sch &b) 
{ 
    return (a.s < b.s); 
}
ll gcd(ll a, ll b) 
{ 
    if (b == 0) 
        return a; 
    return gcd(b, a % b);  
      
}
ll lcm(ll a,ll b)
{
  return a*b/gcd(a,b);
}
ll power(ll x, ll y, ll p) 
{ 
    ll res = 1; 
    x = x % p;  
    while (y > 0) 
    {
        if (y & 1) 
            res = (res*x) % p; 
        y = y>>1; // y = y/2 
        x = (x*x) % p; 
    } 
    return res; 
}
int main()
{
    ll x;
    cin>>x;
    if(x%2==0)
    {
        cout<<-1<<endl;
        return 0;
    }
    ll ans = 0;
    ll rem = 0;
    while(1)
    {
        rem *= 10;
        rem += 7;
        ans++;
        if(rem%x==0)
            break;
        rem = rem%x;
        if(ans>1000000)
        {
            cout<<-1<<endl
            return 0;
        }
    }
    cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:64:27: error: expected ';' before 'return'
   64 |             cout<<-1<<endl
      |                           ^
      |                           ;
   65 |             return 0;
      |             ~~~~~~
Language: Java

import java.util.*;
import java.io.*;

public class C174 {
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();
        PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
        int k = sc.nextInt();
        if ((k & (k - 1)) == 0) {
            out.println(-1);
        } else if (k == 7) {
            out.println(1);
        } else {
            long pow = 10;
            for (int i = 1; i <= k; i++) {
                long minus = (pow - 1) % k;
                if (minus < 0) minus += k;
                if ((minus * inv(9, k)) % k == 0) {
                    out.println(i);
                    out.close();
                    return;
                }
                pow = (pow * 10) % k;
            }
        }
        out.close();
    }

    static int pow(long b, int e, int mod) {
        long ans = 1;
        while (e > 0) {
            if (e % 2 == 1)
                ans = ans * b % mod;
            e >>= 1;
            b = b * b % mod;
        }
        return (int) ans;
    }

    static int inv(int x, int mod) {
        return pow(x, mod - 2, mod);
    }


    //-----------MyScanner class for faster input----------
    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }


    }

}

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

#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define ll long long
#define endl '\n'
#define inf 9223372036854775807
#define maxn 3000001
#define mod (ll)(1e9+7)
#define int ll
 
using namespace std;
 
void io(){
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
}

int t,n,d,l,r,k;
int vis[maxn];


int32_t main(){
io();
IOS;    
		cin>>k;
		int num=0;
		int ans=-1;
		while(1){
			num*=10;
			num+=7;
			num%=mod;
			ans++;
			if(num%k==0){
				cout<<ans<<endl;
				return ;
			}else if(vis[num%k]){
				cout<<-1<<endl;
				return;
			}
		}

       



        

        


        
    
        
        
                


 
        
 
 
 
        
 
 
 
 
        
        
 
        
        
 
    
    
    
    
 
 
       
 
 
 
 
      
   
 
 
 
 
}

Compiler output:
a.cc: In function 'int32_t main()':
a.cc:38:33: error: return-statement with no value, in function returning 'int32_t' {aka 'int'} [-fpermissive]
   38 |                                 return ;
      |                                 ^~~~~~
a.cc:41:33: error: return-statement with no value, in function returning 'int32_t' {aka 'int'} [-fpermissive]
   41 |                                 return;
      |                                 ^~~~~~
Language: Java

//Created by Aminul on 8/2/2020.

import java.io.*;
import java.util.*;

import static java.lang.Math.*;

public class C {
    public static void main(String[] args) throws Exception {
        Scanner in = new Scanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        int k = in.nextInt();
        pw.println(solve(k));
        pw.close();
    }

    static int solve(int k) {
        int cnt = 1, val = 7 % k;
        while (val != 0 && cnt < 2e6) {
            val = ((val * 10) + 7) % k;
            cnt++;
        }
        return val == 0 ? cnt : -1;
    }

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

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

#include "../../../library/other/template.hpp"
int main(){
	int k;
	std::cin>>k;
	lint sum=0;
	rep(i,k+10){
		sum+=modpow(10,i,k)*7%k;
		sum%=k;
		if(sum==0){
			std::cout<<i+1<<std::endl;
			return 0;
		}
	}
	puts("-1");
	return 0;
}

Compiler output:
a.cc:1:10: fatal error: ../../../library/other/template.hpp: No such file or directory
    1 | #include "../../../library/other/template.hpp"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: Java

import java.util.*;
import java.io.*;

public class C {
    public static int max = 2000001;
    public static void main(String[] args) throws IOException{
        BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        long k = Long.parseLong(f.readLine());
        long val = 7;
        boolean found = false;
        for(int i = 1; i <= max; i++){
            if(val % k == 0){
                out.println(i);
                found = true;
                break;
            }
            else{
                val = (10*val+7)%k;
            }
        }
        if(!found) out.println(-1);




        out.close();
    }
}


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

#include <bits/stdc++.h>
#include <bits/extc++.h>
using namespace std;
using namespace __gnu_pbds;
using vi  = vector<int>;
using ii  = pair<int,int>;
using vii = vector<ii>;
using ll  = long long;

typedef tree<int, null_type, less<int>, rb_tree_tag,
tree_order_statistics_node_update> ordered_set;

#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) int((x).size())
#define REP(i, a, b) for (auto (i) = (a); (i) <= (b); (i)++)
#define PER(i, a, b) for (auto (i) = (a); (i) >= (b); (i)--)
#define ITR(i, x) for (auto (i) = (x).begin(); (i) != (x).end(); (i)++)

signed main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);

	int n;
	cin >> n;
	if (n % 2 == 0 or n % 5 == 0) {
		cout << "-1\n";
	} else {
		int idx = 1;
		ll num = 7 % k;
		ll add = 70 % k;
		while (num != 0) {
			num = (num + add) % k;
			add = (add * 10) % k;
			idx++;
		}
		cout << idx << '\n';
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:30: error: 'k' was not declared in this scope
   34 |                 ll num = 7 % k;
      |                              ^
Language: C++

#include<iostream>
using namespace std;
int main() {
  int K;
  cin >> K;
  int i;
  int a = 7;
  for(i=0;i<K;i++) {
    if(a % K == 0) {
      cout << i+1 << endl;
      return ;
    }
    a = (a*10+7)%K;
  }
  cout << -1 << endl;
}

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

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

int main(){
  int n,r=0;
  cin>>n;
  string s;
  cin>>s;
  for(int i=0;i<n;i++){
    if(s[i]=='R') r++;
    }
  int c=0;
  for(int i=0;i<r;i++)
    if(s[i]=='W') c++;
    }
cout<<c;
  
  return 0;
  }

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

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

int main() {
  int N;
  cin >> N;
  string S;
  cin >> S;
  int r = 0;//右にあり取り換えておくもの,あらかじめ数える
  int w = 0;//左にあるのを見つけたらカウント
  int ans = 200001;
  
  for(int i = 0; i < S.size(); i++){
    if(S.at(i) == 'R'){
      r++;
    }
  }
  if(ans > max(r,w)) ans = max(r,w)
 
  for(int i = 0; i < S.size(); i++){
    if(S.at(i) == 'R'){
      r--;
    }
    else w++;
    
    if(ans > max(r,w)) ans = max(r,w);
  }
  
  cout << ans << endl;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:36: error: expected ';' before 'for'
   18 |   if(ans > max(r,w)) ans = max(r,w)
      |                                    ^
      |                                    ;
   19 | 
   20 |   for(int i = 0; i < S.size(); i++){
      |   ~~~                               
a.cc:20:18: error: 'i' was not declared in this scope
   20 |   for(int i = 0; i < S.size(); i++){
      |                  ^
Language: C++

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

int main()
{
	ios::syn_with_stdio(false);
  	cin.tie(nullptr);
  	int n; string s;
  	cin >> n >> s;
  	int a = 0, b = n - 1, ans = 0;
  	while (a < b) {
    	if (s[a] == 'R') { a++; continue; }
      	if (s[b] == 'W') { b--; continue; }
      	ans++;
      	a++;
      	b--;
    }
  	cout << ans << "\n";
  	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:14: error: 'syn_with_stdio' is not a member of 'std::ios' {aka 'std::basic_ios<char>'}
    6 |         ios::syn_with_stdio(false);
      |              ^~~~~~~~~~~~~~
Language: C++

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

int main(){
    
    int i, j, N, flag_r, flag_w, count;
    cin >> N;
  vector< long long int > L( n, 0 );
    flag_r = 0;
    flag_w = 0;
    count = 0;

    string S;
    cin >> S;
    
    for (i = 0; i < N; i++){
        if (S.at(i) == 'R'){
            L[i] = 1;
            flag_r = 1;
            
        } else {
            L[i] = 0;
            flag_w = 1;
        }
    }
        
    if (flag_r == 0 || flag_w == 0){
        cout << "0" << "\n";
        return 0;
    }
    
    i = 0;
    j = N - 1;
    
    while(1){
        
        while(L[i] == 1){
            i++;
        }

        while(L[j] == 0){
            j--;
        }
        
        if (i > j) break;
        
        L[i] = 1;
        L[j] = 0;
        count++;
    }
    
    cout << count << "\n";

    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:11:30: error: 'n' was not declared in this scope
   11 |   vector< long long int > L( n, 0 );
      |                              ^
Language: C++

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

int main(){
    
    int i, j, N, flag_r, flag_w, count;
    cin >> N;
  vector< long long int > l( n, 0 );
    flag_r = 0;
    flag_w = 0;
    count = 0;

    string S;
    cin >> S;
    
    for (i = 0; i < N; i++){
        if (S.at(i) == 'R'){
            L[i] = 1;
            flag_r = 1;
            
        } else {
            L[i] = 0;
            flag_w = 1;
        }
    }
        
    if (flag_r == 0 || flag_w == 0){
        cout << "0" << "\n";
        return 0;
    }
    
    i = 0;
    j = N - 1;
    
    while(1){
        
        while(L[i] == 1){
            i++;
        }

        while(L[j] == 0){
            j--;
        }
        
        if (i > j) break;
        
        L[i] = 1;
        L[j] = 0;
        count++;
    }
    
    cout << count << "\n";

    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:10:3: error: 'vector' was not declared in this scope
   10 |   vector< long long int > l( n, 0 );
      |   ^~~~~~
a.cc:4:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    3 | #include <cmath>
  +++ |+#include <vector>
    4 | using namespace std;
a.cc:10:11: error: expected primary-expression before 'long'
   10 |   vector< long long int > l( n, 0 );
      |           ^~~~
a.cc:20:13: error: 'L' was not declared in this scope
   20 |             L[i] = 1;
      |             ^
a.cc:24:13: error: 'L' was not declared in this scope
   24 |             L[i] = 0;
      |             ^
a.cc:39:15: error: 'L' was not declared in this scope
   39 |         while(L[i] == 1){
      |               ^
a.cc:43:15: error: 'L' was not declared in this scope
   43 |         while(L[j] == 0){
      |               ^
a.cc:49:9: error: 'L' was not declared in this scope
   49 |         L[i] = 1;
      |         ^
Language: Java

import java.util.Scanner;

public class Altar {

	public static void main(String[] args) {
		Scanner sc  = new Scanner(System.in);
		int N = sc.nextInt();
		StringBuffer input = new StringBuffer(sc.next());
	
		int count = 0;
		int iter = N - 1;
		for(int i=0;i<iter;i++) {
			if(i == iter) {
				break;
			}
			if(input.charAt(i)== 'W') {
				int index = input.lastIndexOf("R");
				if(index == -1) {
					break;
				}
				if(index!= -1) {
					input.setCharAt(i, 'R');
					input.setCharAt(index, 'W');
					count = count + 1;
					iter = iter - 1;
				}
				
				
			}
		}
		System.out.println(count);
		

	}

}


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

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

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

	//並びをチェック
	for(int i=1;i<n;i++){
		if(s[i-1]=='W' && s[i]=='R'){
			break;
		}
		if(i==n-1){
			cout << 0 << endl:
			return 0;
	}
	int ans=0;
	int red_right=n-1,white_left=0;
	while(1){
		//右端の赤を探す
		for(int r=red_right;r>0;r--){
			if(r==white_left){
				cout << ans << endl;
				return 0;
			}else if(s[r]=='R'){
				red_right=r;
				break;
			}
		}

		//左端を探す
		for(int l=white_left;l<n;l++){
			if(l==red_right){
				cout << ans << endl;
				return 0;
			}else if(s[l]=='W'){
				white_left=l;
				break;
			}
		}

		s[red_right]='W';
		s[white_left]='R';
		ans++;
	}


	cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:42: error: expected ';' before ':' token
   17 |                         cout << 0 << endl:
      |                                          ^
      |                                          ;
a.cc:52:2: error: expected '}' at end of input
   52 | }
      |  ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C

#define DIN freopen("input.txt","r",stdin);
#define DOUT freopen("output.txt","w",stdout);
#include <bits/stdc++.h>
#include <cstdio>
#define mem(a,b) memset(a,b,sizeof(a))
#define REP(i,a,b) for(int i=(a);i<=(int)(b);i++)
#define REP_(i,a,b) for(int i=(a);i>=(b);i--)
#define pb push_back
using namespace std;
typedef long long LL;
typedef vector<int> VI;
typedef pair<LL,LL> P;
int read()
{
    int x=0,flag=1; char c=getchar();
    while((c>'9' || c<'0') && c!='-') c=getchar();
    if(c=='-') flag=0,c=getchar();
    while(c<='9' && c>='0') {x=(x<<3)+(x<<1)+c-'0';c=getchar();}
    return flag?x:-x;
}

const int maxn=2e5+5;
char s[maxn];
int l,r;

int main()
{
    int n=read();
    scanf("%s",s+1);
    l=1,r=n;
    int ans=0;
    while(l<=r)
    {
        while(l<=n && s[l]=='R') l++;
        while(r>=1 && s[r]=='W') r--;
        if(l<r) swap(s[l],s[r]),ans++;
    }
    cout<<ans;

    return 0;
}


Compiler output:
main.c:3:10: fatal error: bits/stdc++.h: No such file or directory
    3 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include<iostream>
#include<algorithm>

using namespace std;

int main(){
	int n;
     cin>>n;
     string s;
     cin>>s;
     int ans = 0;
     int l=1,r=n;
     while(l<=r){
     	while(l<=n && s[l]=='R') l++;
     	while(r>=1 &&　s[r] == 'W') r--;
     	if(l < r) swap(s[l],s[r]),ans++;
	 }
	 cout<<ans;
}

Compiler output:
a.cc:15:22: error: extended character 　 is not valid in an identifier
   15 |         while(r>=1 &&　s[r] == 'W') r--;
      |                      ^
a.cc: In function 'int main()':
a.cc:15:22: error: '\U00003000s' was not declared in this scope
   15 |         while(r>=1 &&　s[r] == 'W') r--;
      |                      ^~~
Language: C

#include <stdio.h>

int min(int a, int b) {
    if(a < b) return a;
    else return b;
}

int main(void) {

    int N; scanf("%d", &N);
    char c[N];
    for(int i = 0; i < N; i++) scanf("%c", &c[i])


    //RRR....RWW...WWW にする
    int ans = N;
    int w, r;
    for(int i = 0; i < N+1; i++) {
        w = 0; r = 0;
        for(int j = 0; j < N; j++) {
            if(j <= i-1 && c[j] == 'W') w++;
            if(j >  i-1 && c[j] == 'R') r++;
        }

        if(w == N || r == N) {
            ans = 0; break;
        }else{
            if(w <= r) ans = min(ans, r);
            if(w >  r) ans = min(ans, w);
        }
    }
    
    printf("%d\n", ans);

    return 0;
}


Compiler output:
main.c: In function 'main':
main.c:12:50: error: expected ';' before 'int'
   12 |     for(int i = 0; i < N; i++) scanf("%c", &c[i])
      |                                                  ^
      |                                                  ;
......
   16 |     int ans = N;
      |     ~~~                                           
main.c:26:13: error: 'ans' undeclared (first use in this function)
   26 |             ans = 0; break;
      |             ^~~
main.c:26:13: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    int nr = 0;
    vector<int> ad;
    int ans = 0;
    for(int i = 0; i < n; i++){
        if(s[i] == 'R'){
            nr++;
            ad.push_back(i);
        }
    }
    int nw = n - nr;
    for(int i = 0; i < nr; i++){
        if(s[i] == 'W'){
            s[i] = 'R';
            int a = ad.pop_back();
            s[a] = 'W';
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:32: error: void value not ignored as it ought to be
   23 |             int a = ad.pop_back();
      |                     ~~~~~~~~~~~^~
Language: C++


#include <bits/stdc++.h>
#include <string.h>
#include <vector>
//s#define rep(i, n) for (int i = 0; i < (n); i++)
#define MAX 10000

using namespace std;

#define inf    0x3f3f3f3f
#define ll long long
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define rep(i,a,n) for(int i=a; i<n; i++)
typedef vector<int>      vi;
typedef vector<bool>     vb;
#define INF (int)1e15
#define MOD 1000000007

#define access(i) a[i/3][i%3]
//#define random_shuffle(r...)random_shuffle(r,[](int _){return my_rand()%_;})

  int main(){

   int n; cin>>n;
   string s; cin>>s;

   ll r=0,cnt=0;

   for(int i=0;i,n;i++){
      if(s[i] == 'R')
            r++;
   }

   for(int j=0;j<r;j++){
      if(s[i] == 'W')
      cnt++; }

    cout<<cnt<<endl;

  return 0;
  }

Compiler output:
a.cc: In function 'int main()':
a.cc:37:12: error: 'i' was not declared in this scope
   37 |       if(s[i] == 'W')
      |            ^
Language: C++

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

#define REP(i,n) for(int i=0;i<(n);++i)
#define COUT(x) cout<<(x)<<"\n"

int main(){
    int n;string s;
    cin >> n >> s;
    int r=0,w=0;
    REP(i,n){
        if(s[i]=='R')r++;
        else w++;
    }
    int r2=r;
    REP(i,r){
        if(s[i]=='R'){
            r2--;
        }
    }
    COUT(min({count_r,count_w,count_r2}));
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:15: error: 'count_r' was not declared in this scope
   21 |     COUT(min({count_r,count_w,count_r2}));
      |               ^~~~~~~
a.cc:5:24: note: in definition of macro 'COUT'
    5 | #define COUT(x) cout<<(x)<<"\n"
      |                        ^
a.cc:21:23: error: 'count_w' was not declared in this scope
   21 |     COUT(min({count_r,count_w,count_r2}));
      |                       ^~~~~~~
a.cc:5:24: note: in definition of macro 'COUT'
    5 | #define COUT(x) cout<<(x)<<"\n"
      |                        ^
a.cc:21:31: error: 'count_r2' was not declared in this scope
   21 |     COUT(min({count_r,count_w,count_r2}));
      |                               ^~~~~~~~
a.cc:5:24: note: in definition of macro 'COUT'
    5 | #define COUT(x) cout<<(x)<<"\n"
      |                        ^
a.cc:21:13: error: no matching function for call to 'min(<brace-enclosed initializer list>)'
   21 |     COUT(min({count_r,count_w,count_r2}));
      |          ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:5:24: note: in definition of macro 'COUT'
    5 | #define COUT(x) cout<<(x)<<"\n"
      |                        ^
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   candidate expects 2 arguments, 1 provided
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using st = string;
using P = pair<int, int>;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define chmax(x, y) { x = max(x, y); }
#define chmin(x, y) { x = min(x, y); }
#define INF 1e7

int main() {
    int n;
    cin >> n;
    st c;
    cin >> c;
    int rsum = 0;
    rep(i, n){
        if(c.at(i) == 'R'){
            rsum++;
        }
    }
    int ans = 0;
    rep(i, rsum){
        if(c.at(i) == 'W')[
            ans++;
        ]
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:16: error: expected ',' before '++' token
   25 |             ans++;
      |                ^~
      |                ,
a.cc:25:16: error: expected identifier before '++' token
   25 |             ans++;
      |                ^~
a.cc:25:18: error: expected ']' before ';' token
   25 |             ans++;
      |                  ^
      |                  ]
a.cc: In lambda function:
a.cc:25:18: error: expected '{' before ';' token
a.cc: In function 'int main()':
a.cc:26:9: error: expected primary-expression before ']' token
   26 |         ]
      |         ^
Language: C++

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

int main(){
	long long N,W,R,ans=0;
	cin>>N;
	string c;
	cin>>c;
	for(int i=0; i<N ; i++){
		p[i]=c[i]=='R';
	} 
	for(int i=0;i<N;i++){
		if(c[i]=='W'){
			W=i;
			for(int j=N-1;i<j;j--){
				if(c[j]=='R'){
					R=j;
					c[W]='R';
					c[R]='W';
					ans++;
					break;
				}
			}
		}
	}
	cout<<ans<<endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:17: error: 'p' was not declared in this scope
   11 |                 p[i]=c[i]=='R';
      |                 ^
Language: C++

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

signed main(){
  int n;cin>>n;
  string s;cin>>s;
  int tmp=0;
  for(char p:s)tmp+=p=='R';
  int ans=0;
  for(int i=0;i<tmp;i++)ans+=p=='W';
  cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:30: error: 'p' was not declared in this scope
   10 |   for(int i=0;i<tmp;i++)ans+=p=='W';
      |                              ^
Language: Java

import java.util.Scanner;

public class D {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        sc.nextLine();
        char[] chars = sc.nextLine().toCharArray();
        int count = 0;
        int backIndex = n - 1;
        for (int i = 0 ; i < n ; i++){
            if (chars[i] == 'W'){
                for (int j = backIndex; j > i ; j--){
                    if (chars[j] == 'R'){
                        chars[j] = 'W';
                        chars[i] = 'R';
                        backIndex = j;
                        count++;
                        break;
                    }
                }
            }
        }
        System.out.println(count);
    }
}


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

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        sc.nextLine();
        char[] chars = sc.nextLine().toCharArray();
        int count = 0;
        int backIndex = n - 1;
        for (int i = 0 ; i < n ; i++){
            if (chars[i] == 'W'){
                for (int j = backIndex; j > i ; j--){
                    if (chars[j] == 'R'){
                        chars[j] = 'W';
                        chars[i] = 'R';
                        backIndex = j;
                        count++;
                        break;
                    }
                }
            }
        }
        System.out.println(count);
    }
}


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

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        sc.nextLine();
        char[] chars = new char[n];
        String str = sc.nextLine();
        for (int i = 0 ; i < n ; i++){
            chars[i] = str.charAt(i);
        }
        int count = 0;
        for (int i = 0 ; i < n ; i++){
            if (chars[i] == 'W'){
                for (int j = n-1; j > i ; j--){
                    if (chars[j] == 'R'){
                        chars[j] = 'W';
                        chars[i] = 'R';
                        count++;
                        break;
                    }
                }
            }
        }
        System.out.println(count);
    }
}


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

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

int main(){
  int n;
  cin >> n;
  string s;
  cin >> s;
  ll i=0, j=n-1, ans=0;
  while(1){
    while(i<j and s[i]=='R')
      	++i;
    while(i<j and s[i]=='W')
      	++j;
    if(i==j)
      break;
    swap(s[i],s[j]);
    ans++;
  }
  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 i=0, j=n-1, ans=0;
      |   ^~
a.cc:11:11: error: 'i' was not declared in this scope
   11 |     while(i<j and s[i]=='R')
      |           ^
a.cc:11:13: error: 'j' was not declared in this scope
   11 |     while(i<j and s[i]=='R')
      |             ^
a.cc:13:11: error: 'i' was not declared in this scope
   13 |     while(i<j and s[i]=='W')
      |           ^
a.cc:13:13: error: 'j' was not declared in this scope
   13 |     while(i<j and s[i]=='W')
      |             ^
a.cc:15:8: error: 'i' was not declared in this scope
   15 |     if(i==j)
      |        ^
a.cc:15:11: error: 'j' was not declared in this scope
   15 |     if(i==j)
      |           ^
a.cc:17:12: error: 'i' was not declared in this scope
   17 |     swap(s[i],s[j]);
      |            ^
a.cc:17:17: error: 'j' was not declared in this scope
   17 |     swap(s[i],s[j]);
      |                 ^
a.cc:18:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   18 |     ans++;
      |     ^~~
      |     abs
a.cc:20:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   20 |   cout << ans << endl;
      |           ^~~
      |           abs
Language: C++

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

int main(){
  int n;
  cin>>n;
  vector<char> a(n);
  for(int i=0;i<n;i++)cin>>a[i];
  int c=0;
  for(int i=0;i<n;i++){
    if(a[i]=='W')c++;
    if(c==n){
	cout<<"1";return 0;}
  }c=0;
  int l=0,r=n-1;
  while(l<r){
    
    while(a[l]!='W'&&l<r){
      l++;
    }
    while(a[r]!='R'&&l<r){
      r--;
    }
   if(a[l]=='W'&&a[r]=='R'){
    swap(a[l],a[r]);c++;}
  }
    cout<<c;
}
    
  
  #include<bits/stdc++.h>
using namespace std;

int main(){
  int n;
  cin>>n;
  vector<char> a(n);
  for(int i=0;i<n;i++)cin>>a[i];
  int c=0;
  for(int i=0;i<n;i++){
    if(a[i]=='W')c++;
    if(c==n){
	cout<<"1";return 0;}
  }c=0;
  int l=0,r=n-1;
  while(l<r){
    
    while(a[l]!='W'&&l<r){
      l++;
    }
    while(a[r]!='R'&&l<r){
      r--;
    }
   if(a[l]=='W'&&a[r]=='R'){
    swap(a[l],a[r]);c++;}
  }
    cout<<c;
}
    
  
  

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

#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n, d;
    cin >> n >> d;
    int ans = 0;
    for (int i = 0; i < n; i++)
    {
        int a, b;
        cin >> a >> b;
        ans += (calc(a, b) <= d ? 1 : 0);
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:17: error: 'calc' was not declared in this scope
   12 |         ans += (calc(a, b) <= d ? 1 : 0);
      |                 ^~~~
Language: C

#include<stdio.h>
#include<math.h>




int main(void){
	int i, n;
	char c[200001];
	int count, ans;
	int d;
	double dist;

	scanf("%d", &n);
	count=0;
	ans=0;
	for(i=0; i<n; i++){
		scanf("%c", c[i]);
		if(c[i]=='R') count++;
	}
	for(i=0; i<count; i++){
		if(c[i]="W") ans++;
	}

	printf("%d", ans);
}

	

	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:22:24: error: assignment to 'char' from 'char *' makes integer from pointer without a cast [-Wint-conversion]
   22 |                 if(c[i]="W") ans++;
      |                        ^
main.c: At top level:
main.c:30:9: error: expected identifier or '(' before 'return'
   30 |         return 0;
      |         ^~~~~~
main.c:31:1: error: expected identifier or '(' before '}' token
   31 | }
      | ^
Language: C++

#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
#define double long double
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef vector<pii> VP;
typedef vector<string> VS;
typedef priority_queue<int> PQ;
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; }
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
#define eps 1e-12 
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int N, S; cin >> N >> S;
	int cnt = 0;
	REP(i, N)if (S[i] == 'R')cnt++;
	REP(i, cnt)if (S[i] == 'R')cnt--;
	cout << cnt << endl;



	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:44:23: error: invalid types 'long long int[long long int]' for array subscript
   44 |         REP(i, N)if (S[i] == 'R')cnt++;
      |                       ^
a.cc:45:25: error: invalid types 'long long int[long long int]' for array subscript
   45 |         REP(i, cnt)if (S[i] == 'R')cnt--;
      |                         ^
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repbit(bit,n) for (int bit = 0; bit < (1<<n); bit++)
using namespace std;
typedef long long ll;

const int INF = 1001001001;
//const ll INF = 1000000000000000000;

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

	int left_w = 0, right_r = 0;
	rep(i,s.size()) {
		if (s[i] == 'R') right_r++;
	}
	int ans = max(left_w, right_r);
	rep(i,s.size()) {
		if (s.[i] == 'W') left_w++;
		else right_r--;
		ans = min(ans, max(left_w, right_r));
	}
	cout << ans << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:23: error: expected unqualified-id before '[' token
   21 |                 if (s.[i] == 'W') left_w++;
      |                       ^
Language: Java

n = int(input())
c = input()
count = 0

while "wr" in c:
    c = c.replace("w", "r", 1)
    c = c.replace("wr", "ww", 1)
    count += 1
print(count)

Compiler output:
Main.java:1: error: class, interface, enum, or record expected
n = int(input())
^
1 error
Language: C++

#include<bits/stdc++.h>
#define ll long long
#define all(a) a.begin(),a.end()
#define sz(a) a.size()
#define re return 
#define MP make_pair
#define pb push_back
#define pii pair<int,int>
#define se second
#define fi first
using namespace std;
int n,cnt,ans;
char c[200005];
signed main(){
	ios_base::sync_with_stdio(0);
	cin>>n;
	gets(c);
	for(int i=0;i<n;i++) if(c[i]=='W') cnt++;
	for(int i=0;i<cnt;i++) if(c[i]=='W') ans++;
	cout<<ans;
	re 0;
}

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

#include <bits/stdc++.h>

using namespace std
  
int main() {
	int n;
  	cin >> n;
  	string s;
  	cin >> s;
  
  	int count = 0;
  	for (int i = 0; i < s.size() - 1; ++i) {
    	if (s[i] == 'W' && s[i + 1] == 'R') {
        	s[i] = 'R';
          	s[i + 1] = 'W';
          	++count;
        }
    }
  
  	cout << count << endl;
  
  	return 0;
      
}

Compiler output:
a.cc:3:20: error: expected ';' before 'int'
    3 | using namespace std
      |                    ^
      |                    ;
    4 | 
    5 | int main() {
      | ~~~
Language: C++

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

int main(){
 int N, countR, countA;
  countR = 0;
  countA = 0;
  cin >> N;
 string str;
  cin >> str;
  vector<char> a(str.begin(), str.end());
  for(int i = 0; i < N; i++){
    if(a.at(i) == 'R' )
      countR++;
  }
  for(int i = 0; i < countR; i++){
  if(a.at(i) == 'W' )
    countA++;
  }
  if(countA % 2 == 0)
    cout << countA / 2 << endl;#include <bits/stdc++.h>
using namespace std;

int main(){
 int N, countR, countA;
  countR = 0;
  countA = 0;
  cin >> N;
 string str;
  cin >> str;
  vector<char> a(str.begin(), str.end());
  for(int i = 0; i < N; i++){
    if(a.at(i) == 'R' )
      countR++;
  }
  for(int i = 0; i < countR; i++){
  if(a.at(i) == 'W' )
    countA++;
  }
cout << countA << endl;
}
  
  else
    cout << countA / 2 +1 << endl;
}
  

Compiler output:
a.cc:21:32: error: stray '#' in program
   21 |     cout << countA / 2 << endl;#include <bits/stdc++.h>
      |                                ^
a.cc: In function 'int main()':
a.cc:21:33: error: 'include' was not declared in this scope
   21 |     cout << countA / 2 << endl;#include <bits/stdc++.h>
      |                                 ^~~~~~~
a.cc:21:42: error: 'bits' was not declared in this scope
   21 |     cout << countA / 2 << endl;#include <bits/stdc++.h>
      |                                          ^~~~
a.cc:21:47: error: 'stdc' was not declared in this scope; did you mean 'std'?
   21 |     cout << countA / 2 << endl;#include <bits/stdc++.h>
      |                                               ^~~~
      |                                               std
a.cc:22:1: error: expected primary-expression before 'using'
   22 | using namespace std;
      | ^~~~~
a.cc:24:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   24 | int main(){
      |         ^~
a.cc:24:9: note: remove parentheses to default-initialize a variable
   24 | int main(){
      |         ^~
      |         --
a.cc:24:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:24:11: error: a function-definition is not allowed here before '{' token
   24 | int main(){
      |           ^
a.cc:43:3: error: 'else' without a previous 'if'
   43 |   else
      |   ^~~~
Language: C++

#include<bits/stdc++.h>
using namespaec std;
const int N = 200010;
char s[N];
int main() {
  int n; scanf("%d", &n);
  scanf("%s", s + 1);
  int cnt = 0, c1 = 0;
  for (int i = 1; i <= n; i++) {
    if (s[i] == 'R') {
      cnt++;
    }
  }
  for (int i = 1; i <= cnt; i++) {
    if(s[i] == 'R') c1++;
  }
  printf("%d", cnt - c1);
  return 0;
}

Compiler output:
a.cc:2:7: error: expected nested-name-specifier before 'namespaec'
    2 | using namespaec std;
      |       ^~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
 
int main(){
 
  int n;
  cin>>n;
  
  string g;
  cin>>g;
  
  int r=0,w=0;
  
  for(auto x:g)
    r+=(x=='R');
  
  for(int i=0;i<r;i++)
    w+=(g[i]=='W')
  
  cout<<w<<endl;
  
}
#include<bits/stdc++.h>
using namespace std;

int main(){
 
  int n;
  cin>>n;
  
  string g;
  cin>>g;
  
  int r=0,w=0;
  
  for(auto x:g)
    r+=(x=='R');
  
  for(int i=0;i<r;i++)
    w+=(g[i]=='W');
  
  cout<<w<<endl;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:19: error: expected ';' before 'cout'
   18 |     w+=(g[i]=='W')
      |                   ^
      |                   ;
   19 | 
   20 |   cout<<w<<endl;
      |   ~~~~             
a.cc: At global scope:
a.cc:26:5: error: redefinition of 'int main()'
   26 | int main(){
      |     ^~~~
a.cc:4:5: note: 'int main()' previously defined here
    4 | int main(){
      |     ^~~~
Language: C++

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

int main(){
 
  int n;
  cin>>n;
  
  string g;
  cin>>g;
  
  int r=0,w=0;
  
  for(auto x:g)
    r+=(x=='R');
  
  for(int i=0;i<r;i++)
    w+=(g[i]=='W')
  
  cout<<w<<endl;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:19: error: expected ';' before 'cout'
   18 |     w+=(g[i]=='W')
      |                   ^
      |                   ;
   19 | 
   20 |   cout<<w<<endl;
      |   ~~~~
Language: C++

#include <iostream>
#include <vector>
using namespace std;
int main(){
	int N;
	string S;
	vector<int> f,b;
	cin >> N;
	cin >> S;
	for (int i = 0; i < N; ++i)
	{
		if(S[i] == 'W') f.push_back(i);
		else b.push_back(i);
	}
	sort(b.begin(), b.end(),greater<int>());
	if(f.empty() || b.empty()){
		cout << "0" << endl;
		return 0;
	}
	for(int i = 0; i < min(f.size(),b.size()); i++){
		if(f[i] > b[i]){
			cout << i << endl;
			return 0;
		}
	}
	cout << min(f.size(),b.size()) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   15 |         sort(b.begin(), b.end(),greater<int>());
      |         ^~~~
      |         short
Language: C++

string s = "WWRRRWRRWRR";
int n = 11;
int l = 0;
int r = n - 1;
while (l < r) {
  while (s[l] == 'R') l ++;
  // when it stops s[l] == 'L'
  while (s[r] == 'W') r --;
  // same
  if (l >= r) break;
  swap(s[l], s[r]);
}

Compiler output:
a.cc:1:1: error: 'string' does not name a type
    1 | string s = "WWRRRWRRWRR";
      | ^~~~~~
a.cc:5:1: error: expected unqualified-id before 'while'
    5 | while (l < r) {
      | ^~~~~
Language: C

#include<stdio.h>
int N;
char stone[200000];
int Rn[20000];
int R=0;
int count=0;
/*Rの出た場所を記録してRが出た回数に対して、各Rが出てる位置(i=0スタート)が大きくなければそのRを交換しなくてよい
逆にこの条件をみたさないRはすべて交換する。
　これをソースコードで記述することができなかった。*/
void swap(int a, int b){
  if(a==b)return;
  char w = stone[a];
  stone[a]=stone[b];
  stone[b]=w;
  count++;
}

void change(int a){
  if(stone[a]=='W')
    stone[a]='R';
  else
    stone[a]='W';
}

int mymax(int a, int b){
  if(a>b)
    return a;
  else
    return b;
}

int main(void){
  int c;
  int i;
  int j;
  int k;
  scanf("%d",&N);
  i=0;j=0;
  c=getchar();
  while(c!=EOF){
    if( c=='R' || c=='W'){
      stone[i]=c;
      if(c=='R'){
        R++;
        Rn[j++]=i;
      }
      i++;
    }
    c=getchar();
  }
  stone[i]='\0';
  k=j; j=0;
  for(i=0;i<R;i++){
    if(stone[i]=='R')
      j++;
  }
  for(i=0;i<N;i++){
    if(stone[i]='W' && R!=0){
      swap(i,Rn[j++]);
    }
    if(j==k)break;
  }
  printf("%d\n",count);


Compiler output:
main.c: In function 'main':
main.c:63:3: error: expected declaration or statement at end of input
   63 |   printf("%d\n",count);
      |   ^~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
  	cin>>n;
  	string c;
  	cin>>c;
  	int i=0, j=n-1, ans=0;
  	while(i<j)
    {
    	while(c[i]!='W' && i<n)
          	++i;
      	while(c[i]!='R' && j>=0)
          	--j;
      	if(i<j)
        {
        	++ans;
          	temp= c[j];
          	c[j]=c[i];
          	c[i]=temp;
          	++i;
          	++j;
        }
      	
    }
  	cout<<ans;
  	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:17: error: 'temp' was not declared in this scope; did you mean 'tm'?
   19 |                 temp= c[j];
      |                 ^~~~
      |                 tm
Language: C++

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

int main(){
  int n; string s; cin >> n >> s;
  int a = 0, b = 0;
  rep(i, n) if (s[i] == 'R') ++a;
  int ans = max(a,b);
  rep(i, n){
    if (s[i] == 'R') --a;
    else ++b;
    int now = max(a,b);
  }
  ans = min(ans, now);
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:18: error: 'now' was not declared in this scope; did you mean 'pow'?
   17 |   ans = min(ans, now);
      |                  ^~~
      |                  pow
Language: C++

#include <bits/stdc++.h>
#define ll long long
#define rep(i,a,b) for(long long i=a; i<b; i+=1)
#define repr(i,a,b) for(long long i=a; i<=b; i+=1)
#define vec vector<ll>
#define map map<char,int>
#define repa(p,A) for(auto p:A)
#define pb push_back
#define sort(a) sort(a.begin(),a.end())
#define reverse(a) reverse(a.begin(),a.end())
const double PI=acos(-1);
const ll INF=1000000;
using namespace std;

int main() {
    ll N;
    cin>>N;
    string A;
    cin>>A;
    map B,C;
    rep(i,0,N) {
        B[A[i]]+=1;
    }
    rep(i,0,B['R']+1) {
        C[A[i]]+=1;
    }
    cout<<C['W']<<endl;
    

Compiler output:
a.cc: In function 'int main()':
a.cc:27:24: error: expected '}' at end of input
   27 |     cout<<C['W']<<endl;
      |                        ^
a.cc:15:12: note: to match this '{'
   15 | int main() {
      |            ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int n; string s;
int main()
{
    cin >> n >> s;
    int r = 0;
    for(int i=0; i<n; i++)
    {
        if(s[i]=='R')
        {
            r++;
        }
    }
  	int c=0;
    for(i=r;i<n;i++)
    {
      if(s[i]=='R')
        c++;
    }
  cout<<c;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:9: error: 'i' was not declared in this scope
   16 |     for(i=r;i<n;i++)
      |         ^
Language: C

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

int n;

int main(){
    cin >> n;
    char c[n]; 
    int w=0;
    int r=0;
    for(int i=0; i<n; i++){
        cin >> c[i];
        if(c[i]=='R') r++;
    }
    //cout << "r = " << r << "\n";
    int ans=max(w,r);
    for(int i=0; i<n; i++){
        if(c[i]=='W'){
            w++;
        }else{
            r--;
        }
        //cout << "r = " << r << "\n";
        //cout << "w = " << w << "\n";
        int cur_ans = max(w,r);
        ans = min(ans, cur_ans);
    }

    cout << ans << "\n";
    return 0;
}

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