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

#include <bits/stdc++.h>
#include <vector>
#include <string>
#include <cmath>

using namespace std;

int main(){

	int n, lw, lb=0, rw=0, rb=0, mi, flag=0;
	string s;
	vector<int> fb, v;

	cin>> n;
	cin>> s;

	for(int i=0;i<n;i++){
		if(s[i]=='#'){
			rb++;
			if(flag!=1) fb.emplace_back(i);
			flag=1;
		}else{
			rw++;
			if(flag!=0) fb.emplace_back(i);
			flag=0;
		}
	}

	mi=min(rb, rw);
	lw=fb[0];
	rw-=lw;

	for(int i=0;i<fb.size()-1;i++){
		if(i%2==0){
			rb-=fb[i+1]-fb[i];
			lb+=fb[i+1]-fb[i];
		}else{
			
			rw-=fw[i+1]-fw[i];
			lw+=fw[i+1]-fw[i];
		}
		v.emplace_back(lb+rw);
	}

	for(int i=0;i<v.size();i++){
		mi=min(mi, v[i]);
	}

	cout<< mi << endl;


}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:29: error: 'fw' was not declared in this scope; did you mean 'fb'?
   39 |                         rw-=fw[i+1]-fw[i];
      |                             ^~
      |                             fb
Language: C++

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

using namespace std;

int main() {
    int n;
    string s;
    vector<int> turn;

    cin >> n;
    cin >> s;

    int l=n-1,m=0;
    for(int i = 0; i < n; i++)
    {
        if(s[i] == '#') {
            l = i;
            break;
        }
    }
    if(l == n-1){
        cout << 0 << endl;
        return 0;
    }
    for(int i = n-1; i > 0; i--)
    {
        if(s[i] == '.')
        {
            m = i;
            break;
        }
    }
    for(int i = l; i <= m; i++)
    {
        int a = 0;
        for(int j = l; j <= m; j++)
        {
            if((j < i && s[j] == '#') || (j > i && s[j] == '.'))
            {
                a++;
            }
        }
        turn.push_back(a);
    }
    cout << turn[*min_element(turn.begin(),turn.end())] << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:47:19: error: 'min_element' was not declared in this scope
   47 |     cout << turn[*min_element(turn.begin(),turn.end())] << endl;
      |                   ^~~~~~~~~~~
Language: Java

/* package whatever; // don't place package name! */

import java.util.*;
import java.util.Scanner; 
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
  Scanner s = new Scanner(System.in);
   int l = s.nextInt();
   s.nextLine();
  String wrd = s.nextLine();
  int count =0;
  for(int i=0; i<l-1; i++){
  	if(wrd.charAt(i) =='#' && wrd.charAt(i+1) =='.'){
  		count++;
  	}
  }
  
  System.out.print(count);

	}
}


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

#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
using namespace std;
#define MAX 1000000007
typedef long long ll;

int main(){
  ll count=0,B[210000],W[210000];
  int N,S;
  cin>>N>>S;
  B[0]=0;

  for(int i=0;i<N;i++){
    if(i!=0) B[i]=count;
    if(S[i]=='#') count++;
  }
  count=0;

  for(int i=N-1;i>=0;i--){
    if(S[i]=='.') count++;
    W[i]=count;
  }
  ll ans=210000;
  for(int i=0;i<N;i++){
    ans=min(ans,B[i]+W[i]);
  }
  cout<<ans<<endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:20:9: error: invalid types 'int[int]' for array subscript
   20 |     if(S[i]=='#') count++;
      |         ^
a.cc:25:9: error: invalid types 'int[int]' for array subscript
   25 |     if(S[i]=='.') count++;
      |         ^
Language: C++

#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main(){
  int n,i,a=0,b,c=0;
  string s;
  cin >> n >> s;
  while(n>0 && s[0]=='.'){
    s.erase(0,1);
    n-;
  }
  while(n>0 && s[n-1]=='*'){
    s.erase(n-1,1);
    n--;
  }
  for(i=0;i<n;i++) if(s[i]=='.') a++;
  b = a;
  for(i=0;i<n;i++){
    if(s[i]=='*'){
      if(i!=0 && s[i-1]=='.'){
        b = b + c;
        a = min(a,b);
        c = 0;
      }
      c++;
    }else c--;
  }
  cout << a << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:7: error: expected primary-expression before ';' token
   13 |     n-;
      |       ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

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

Compiler output:
a.cc:5:5: error: cannot declare '::main' to be a global variable
    5 | int main(
      |     ^~~~
a.cc:7:9: error: expected primary-expression before 'int'
    7 |         int n;
      |         ^~~
a.cc:7:9: error: expected '}' before 'int'
a.cc:6:3: note: to match this '{'
    6 |   {
      |   ^
a.cc:6:4: error: expected ')' before 'int'
    6 |   {
      |    ^
      |    )
    7 |         int n;
      |         ~~~
a.cc:5:9: note: to match this '('
    5 | int main(
      |         ^
a.cc:8:5: error: 'cin' does not name a type
    8 |     cin>>n;
      |     ^~~
a.cc:10:5: error: 'cin' does not name a type
   10 |     cin>>s;
      |     ^~~
a.cc:12:5: error: expected unqualified-id before 'for'
   12 |     for(int i=0; i<s.size()-1; i++)
      |     ^~~
a.cc:12:18: error: 'i' does not name a type
   12 |     for(int i=0; i<s.size()-1; i++)
      |                  ^
a.cc:12:32: error: 'i' does not name a type
   12 |     for(int i=0; i<s.size()-1; i++)
      |                                ^
a.cc:20:5: error: 'cout' does not name a type
   20 |     cout<<cnt<<endl;
      |     ^~~~
a.cc:21:5: error: expected unqualified-id before 'return'
   21 |     return 0;
      |     ^~~~~~
a.cc:22:3: error: expected declaration before '}' token
   22 |   }
      |   ^
Language: C++

#include <iosteam>
#include <string>
#include <algorithm>

using namespace std;

int main(){
  int n,i,a=0,b,c=0;
  string s;
  cin >> n >> s;
  while(n>0 && s[0]=='.'){
    s.erase(0,1);
    n-;
  }
  while(n>0 && s[n-1]=='*'){
    s.erase(n-1,1);
    n--;
  }
  for(i=0;i<n;i++) if(s[i]=='.') a++;
  b = a;
  for(i=0;i<n;i++){
    if(s[i]=='*'){
      if(i!=0 && s[i-1]=='.'){
        b = b + c;
        a = min(a,b);
        c = 0;
      }
      c++;
    }else c--;
  }
  cout << a << endl;
  return 0;
}

Compiler output:
a.cc:1:10: fatal error: iosteam: No such file or directory
    1 | #include <iosteam>
      |          ^~~~~~~~~
compilation terminated.
Language: C

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

int main(){
	int N,count1=0,count2=0;
	char S[200001],s1[200001],s2[200001];
	scanf("%d",&N);
	scanf("%s",S);
	
	for(i=0;i<N;i++){
		if(S[i]=='#'){
			count1++;
		}else{
			count2++;
		}
	}
	for(int i=0;i<N;i++){
		if(S[i] == '#')break;
		count2--;
	}
	if(count2>count1){
		printf("%d\n",count1);
	}else{
		printf("%d\n",count2);
	}
	return 0;
}

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

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

int main(){
	int N,count1=0,count2=0;
	char S[200001],s1[200001],s2[200001];
	scanf("%d",&N);
	scanf("%s",S);
	
	for(i=0;i<N;i++){
		if(S[i]=='#'){
			count1++;
		}else{
			count2++;
		}
	}
	for(int i=0;i<N;i++){
		if(S[i] == '#')break;
		count2--;
	}
	if(count2>count1){
		printf("%d\n",count1);
	}else{
		printf("%d\n",count2);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:13: error: 'i' was not declared in this scope
   10 |         for(i=0;i<N;i++){
      |             ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long int llint;
typedef long int lint;
typedef vector<char> vchar;
typedef vector<int> vint;
typedef vector<vector<int>> vvint;
typedef vector<vector<char>> vvchar;
#define vsort(v) sort((v).begin(), (v).end())
#define vreverse(v) reverse((v).begin(), (v).end())
#define pb(a) push_back(a)
#define INF 1000000007
#define MOD 1e9+7
int main(){
  //input
long long n,i;cin>>n;char s;vint ps(n);
for(i=0;i<n;i++){
  cin>>s;
  if(s =='.'){ps[i]=0;}else{ps[i]=1;}
}
  lint cntt;vint d(0);i=0;
  while(i<n){
    cntt=0;
    if(ps[i]==0){
      while((ps[i]==0)&&(i<n)){i++;cntt++;}
    }else{
      while((ps[i]==1)&&(i<n)){i++;cntt++;}
    }
    d.pb(cntt);
  }
  d.resize();
  long long a,b;a=0;b=0;
  if(ps[0]==1){
    for(i=0;i+1<d.size();i+=2){a+=d[i];b+=d[i+1];}
  }
  else{
  for(i=1;i+1<d.size();i+=2){a+=d[i];b+=d[i+1];}
  }
  if(a>b){cout<<b<<endl;}else{cout<<a<<endl;}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:11: error: no matching function for call to 'std::vector<int>::resize()'
   31 |   d.resize();
      |   ~~~~~~~~^~
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:1013:7: note: candidate: 'void std::vector<_Tp, _Alloc>::resize(size_type) [with _Tp = int; _Alloc = std::allocator<int>; size_type = long unsigned int]'
 1013 |       resize(size_type __new_size)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:1013:7: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_vector.h:1034:7: note: candidate: 'void std::vector<_Tp, _Alloc>::resize(size_type, const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; size_type = long unsigned int; value_type = int]'
 1034 |       resize(size_type __new_size, const value_type& __x)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:1034:7: note:   candidate expects 2 arguments, 0 provided
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
typedef vector<pii> vii;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define rep(i,n) for(int i=0;i<((int)n);i++)
#define rep1(i,n) for(int i=1;i<=((int)n);i++)
#define pb push_back
#define mp(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}

//}}}
const ll maxn= 200005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const double PI=acos(-1);
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;

		b>>=1;
	}
	return res;
}

ll dp[maxn][maxn][maxn],n,t;
int main()
{
	//IOS;
    string s;
    int white[maxn],black[maxn];
    while(cin>>n>>s)
    {
        memset(black,0,sizeof(black));
        memset(white,0,sizeof(white));
        rep(i,n)
        {
            if(i) {black[i]+=black[i-1];white[i]+=white[i-1];}
            if(s[i]=='#') black[i]++;
            else white[i]++;
        }
        int minchange=white[n-1];
        rep(i,n)
        {
            minchange=min(minchange,black[i]+white[n-1]-white[i]);
        }
        cout<<minchange<<"\n";
    }
	return 0;
}


Compiler output:
/tmp/ccOH7Hjm.o: in function `main':
a.cc:(.text+0x1da): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccOH7Hjm.o
a.cc:(.text+0x1ea): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccOH7Hjm.o
a.cc:(.text+0x217): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccOH7Hjm.o
a.cc:(.text+0x25e): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccOH7Hjm.o
a.cc:(.text+0x296): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccOH7Hjm.o
collect2: error: ld returned 1 exit status
Language: Java

import java.util.Scanner;

public class CorrectAnswer {

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		String S = scanner.next();
		scanner.close();

		char[] c = S.toCharArray();

		int[] sumBlack = new int[N+1];
		int[] sumWhite = new int[N+1];

		 // We add value to sumBlack and sumWhite, so all sumValue of each color is the time when "N".
		 // And shoule think Last time.
		for (int i = 0; i <= N; i++) {
			sumBlack[i+1] = sumBlack[i] + (c[i] == '#' ? 1: 0);
			sumWhite[i+1] = sumWhite[i] + (c[i] == '.' ? 1: 0);
		}

		// this code is learned by : https://atcoder.jp/contests/tenka1-2019-beginner/submissions/5069772
		// take max value of Integer 
		int min = Integer.MAX_VALUE;
		for (int j = 0; j < N; j++) {
			// add value to sumBlack and sumWhite, so all sumValue of each color is the time when "N".
			min = Math.min(min, (sumBlack[j] + (sumWhite[N] - sumWhite[j])));
		}

		System.out.println(min);

	}

}


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

#include <iostream>
#include <iomanip>
// std::cout << std::setprecision(2) << 3.141; // "3.1"
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <map>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;

static const int giga = pow(10,9);
// double pi = 3.141592653589793238463;
int n;
string input;

bool judge(int);

int main(void){
  cin >> n >> input;

  int ans = 0;
  for(int i = 1; i < n; i++){
    if(input[i-1] == '#' && input[i] == '.'){
      int left = 0;
      int right = 0;
      do{
	left++;
	if(input[i+1] == '.'){
	  right++;
	} else {
	  break;
	}
      } while(input[i-left] == '#' || input[i+right] == '.' || left == i || right == n-1-i);
    }
    
    int temp = 0;
    temp = min(right, left);
    ans += temp;
  }

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

Compiler output:
a.cc: In function 'int main()':
a.cc:46:15: error: invalid conversion from 'std::ios_base& (*)(std::ios_base&)' to 'int' [-fpermissive]
   46 |     temp = min(right, left);
      |            ~~~^~~~~~~~~~~~~
      |               |
      |               std::ios_base& (*)(std::ios_base&)
Language: C++

#include <iostream>
#include <iomanip>
// std::cout << std::setprecision(2) << 3.141; // "3.1"
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <map>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;

static const int giga = pow(10,9);
// double pi = 3.141592653589793238463;
int n;
string input;

bool judge(int);

int main(void){
  cin >> n >> input;

  int ans = 0;
  for(int i = 1; i < n; i++){
    if(input[i-1] == '#' && input[i] == '.'){
      int left = 0;
      int right = 0;
      do{
	left++;
	if(input[i+1] == '.'){
	  right++;
	} else {
	  break;
	}
      } while(input[i-left] == '#' || input[i+right] == '.' || left == i || right == n-1-i);
    }
    
    int temp = min(left, right);
    ans += temp;
  }

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

Compiler output:
a.cc: In function 'int main()':
a.cc:45:31: error: invalid conversion from 'std::ios_base& (*)(std::ios_base&)' to 'int' [-fpermissive]
   45 |     int temp = min(left, right);
      |                               ^
      |                               |
      |                               std::ios_base& (*)(std::ios_base&)
Language: C++

#include <iostream>
#include <iomanip>
// std::cout << std::setprecision(2) << 3.141; // "3.1"
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <map>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;

static const int giga = pow(10,9);
// double pi = 3.141592653589793238463;
int n;
string input;

bool judge(int);

int main(void){
  cin >> n >> input;

  int ans = 0;
  for(int i = 1; i < n; i++){
    if(input[i-1] == '#' && input[i] == '.'){
      int left = 0;
      int right = 0;
      do{
	left++;
	if(input[i+1] == '.'){
	  right++;
	} else {
	  break;
	}
      } while(input[i-left] == '#' || input[i+right] == '.' || left == i || right == n-1-i);
    }

    ans += min(left, right);
  }

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

Compiler output:
a.cc: In function 'int main()':
a.cc:45:9: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   45 |     ans += min(left, right);
      |     ~~~~^~~~~~~~~~~~~~~~~~~
a.cc:45:27: error: invalid conversion from 'std::ios_base& (*)(std::ios_base&)' to 'int' [-fpermissive]
   45 |     ans += min(left, right);
      |                           ^
      |                           |
      |                           std::ios_base& (*)(std::ios_base&)
Language: C++

#include <iostream>
#include <iomanip>
// std::cout << std::setprecision(2) << 3.141; // "3.1"
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <map>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;

static const int giga = pow(10,9);
// double pi = 3.141592653589793238463;
int n;
string input;

bool judge(int);

int main(void){
  cin >> n >> input;

  int ans = 0;
  for(int i = 1; i < n; i++){
    if(input[i-1] == '#' && input[i] == '.'){
      int left = 0;
      int right = 0;
      do{
	left++;
	if(input[i+1] == '.'){
	  right++;
	} else {
	  break;
	}
      } while(input[i-left] == '#' || input[i+right] == '.' || left == i || right == n-1-i)
	}

    ans += min(left, right);
  }

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

Compiler output:
a.cc: In function 'int main()':
a.cc:42:92: error: expected ';' before '}' token
   42 |       } while(input[i-left] == '#' || input[i+right] == '.' || left == i || right == n-1-i)
      |                                                                                            ^
      |                                                                                            ;
   43 |         }
      |         ~                                                                                   
a.cc:45:9: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   45 |     ans += min(left, right);
      |     ~~~~^~~~~~~~~~~~~~~~~~~
a.cc:45:27: error: invalid conversion from 'std::ios_base& (*)(std::ios_base&)' to 'int' [-fpermissive]
   45 |     ans += min(left, right);
      |                           ^
      |                           |
      |                           std::ios_base& (*)(std::ios_base&)
Language: C++

#include <iostream>
#include <iomanip>
// std::cout << std::setprecision(2) << 3.141; // "3.1"
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <map>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;

static const int giga = pow(10,9);
// double pi = 3.141592653589793238463;
int n;
string input;

bool judge(int);

int main(void){
  cin >> n >> input;

  int ans = 0;
  for(int i = 1; i < n; i++){
    if(input[i-1] == '#' && input[i] == '.'){
      int left = 0;
      int right = 0;
      do{
	left++;
	if(input[i+1] == '.'){
	  right++;
	} else {
	  break;
	}
      } while(input[i-left] == '#' || input[i+right] == '.' || left == i || right == n-1-j)
	}

    ans += min(left, right);
  }

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

Compiler output:
a.cc: In function 'int main()':
a.cc:42:90: error: 'j' was not declared in this scope
   42 |       } while(input[i-left] == '#' || input[i+right] == '.' || left == i || right == n-1-j)
      |                                                                                          ^
a.cc:42:92: error: expected ';' before '}' token
   42 |       } while(input[i-left] == '#' || input[i+right] == '.' || left == i || right == n-1-j)
      |                                                                                            ^
      |                                                                                            ;
   43 |         }
      |         ~                                                                                   
a.cc:45:9: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   45 |     ans += min(left, right);
      |     ~~~~^~~~~~~~~~~~~~~~~~~
a.cc:45:27: error: invalid conversion from 'std::ios_base& (*)(std::ios_base&)' to 'int' [-fpermissive]
   45 |     ans += min(left, right);
      |                           ^
      |                           |
      |                           std::ios_base& (*)(std::ios_base&)
Language: Java

import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    String a = sc.next();
    int ans =0;
    String w = "#.";
    
    for(int i=0;i<N-1;i++){
      char b = a.charAt(i+1);
      char c = a.charAt(i+2);
      if((b+c)==w){
        ans++;
      }
    }
    System.out.println(ans);
  }
}


Compiler output:
Main.java:14: error: bad operand types for binary operator '=='
      if((b+c)==w){
              ^
  first type:  int
  second type: String
1 error
Language: Java

import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    String a = sc.next();
    int ans = 0;
    
    for(int i=1;i<=N-1;i++){
      char b = a.charAt(i);
      char c = a.charAt(i+1);
      if( (b+c).equals("#.") ){
        ans++;
      }
    }
    System.out.println(ans);
  }
}


Compiler output:
Main.java:13: error: int cannot be dereferenced
      if( (b+c).equals("#.") ){
               ^
1 error
Language: Java

import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    String a = sc.next();
    int ans =0;
    
    for(int i=1;i<=N-1;i++){
      char b = a.charAt(i);
      char c = a.charAt(i+1);
      if( (b+c) == "#." ){
        ans++;
      }
    }
    System.out.println(ans);
  }
}


Compiler output:
Main.java:13: error: bad operand types for binary operator '=='
      if( (b+c) == "#." ){
                ^
  first type:  int
  second type: String
1 error
Language: Java

import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    String a = sc.next();
    int ans =0;
    
    for(int i=1;i<=N-1;i++){
      if( ( a.charAt(i,i+1) ) == "#." ){
        ans++;
      }
    }
    System.out.println(ans);
  }
}

Compiler output:
Main.java:11: error: method charAt in class String cannot be applied to given types;
      if( ( a.charAt(i,i+1) ) == "#." ){
             ^
  required: int
  found:    int,int
  reason: actual and formal argument lists differ in length
1 error
Language: C++

#include <iostream>
#include <string>

int b[200005], w[200005]; // i番目までの黒, 白の個数
int N;
string S;

int main() {
  
  cin >> N >> S;
  
  b[0] = 0;
  w[0] = 0;
  for(int i=0;i<N;++i) {
    b[i+1] = b[i] + (S[i] == '.' ? 1 : 0);
    w[i+1] = w[i] + (S[i] == '#' ? 1 : 0);
  }
  
  int ans = N;
  for(int i=0;i<=N;++i) {
    if(w[i]+(b[N]-b[i]) < ans) ans = b[i]+(w[N]-w[i]);
  }
  cout << ans << endl;
}

Compiler output:
a.cc:6:1: error: 'string' does not name a type; did you mean 'stdin'?
    6 | string S;
      | ^~~~~~
      | stdin
a.cc: In function 'int main()':
a.cc:10:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   10 |   cin >> N >> S;
      |   ^~~
      |   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:10:15: error: 'S' was not declared in this scope
   10 |   cin >> N >> S;
      |               ^
a.cc:23:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   23 |   cout << ans << endl;
      |   ^~~~
      |   std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:23:18: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   23 |   cout << ans << endl;
      |                  ^~~~
      |                  std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: Java

import java.util.Scanner;

public class C {

	public static void main(String[] args) {

		Scanner sc=new Scanner(System.in);

		int N=sc.nextInt();
		String S=sc.next();

		int[] white=new int[N+1];
		int[] black=new int[N+1];

		white[0]=black[0]=0;

		for(int i=0;i<N;i++) {
			if(S.charAt(i)=='.') {
				white[i+1]=white[i]+1;
				black[i+1]=black[i];
			}else {
				white[i+1]=white[i];
				black[i+1]=black[i]+1;
			}
		}

		int ans=N;

		for(int i=0;i<N+1;i++) {
			int temp=(white[N]-white[i])+black[i];
			ans=Math.min(ans, temp);
		}

		System.out.println(ans);

		sc.close();
	}

}


Compiler output:
Main.java:3: 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>
using namespace std;

int main(void){
  int N;
  string SS;
  cin >> N >> S;
  int cntMin = INT_MAX;
  for (int border = 0; border <= N; border++) {
    int cnt = 0;
    for (int i = 0; i < N; i++) {
      if (i < border) {
        if (S[i] == '#') { cnt++; }
      } else {
        if (S[i] == '.') { cnt++; }
      }
      if (cnt >= cntMin) { break; }
    }
    cntMin = cnt;
  }
  cout << cntMin;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:15: error: 'S' was not declared in this scope; did you mean 'SS'?
    7 |   cin >> N >> S;
      |               ^
      |               SS
Language: C++

#include<iostream>
using namespace std;
int n,b,w,cnt[200002],minf=1e9;
string s;
main(){
    cin>>n>>s;
    for(int i=0;i<n;i++){
        if(s[i]==".")w++;
    }
    for(int i=0;i<=n;i++){
        if(i==0){
            if(s[i]=='.')w--;
            cnt[0]=w;
            continue;
        }
        if(s[i-1]=="#")b++;
        else w--;
        cnt[i]=w+b;
        if(minf>cnt[i])minf=cnt[i];
    }
    cout<<(minf>=cnt[0]?cnt[0]:minf)<<endl;
}

Compiler output:
a.cc:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    5 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:8:16: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    8 |         if(s[i]==".")w++;
a.cc:16:18: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   16 |         if(s[i-1]=="#")b++;
Language: C++

n = input()
s = input()

# s_list = list(s)
result = n
sum_cnt= n
for i in range(len(s)+1):
    sum_cnt = s[:i].count("#") + s[i:].count(".")
    result = min(sum_cnt,result)
print(result)

Compiler output:
a.cc:4:3: error: invalid preprocessing directive #s_list
    4 | # s_list = list(s)
      |   ^~~~~~
a.cc:1:1: error: 'n' does not name a type
    1 | n = input()
      | ^
Language: C++

from itertools import accumulate

N=int(input())
S=input()

black=[0]*N
white=[0]*N

for i,s in enumerate(S):
    if s=='#':
        black[i]=1
    else:
        white[i]=1

black=[0]+black
black=list(accumulate(black))
white=[0]+white[::-1]
white=list(accumulate(white))[::-1]

ans=[]

for i in range(N+1):
    ans.append(black[i]+white[i])

print(min(ans))

Compiler output:
a.cc:1:1: error: 'from' does not name a type
    1 | from itertools import accumulate
      | ^~~~
Language: C++

n = int(input())
s = list(input())

black = s.count('#')
if black == 0 or black == n:
    print(0)
else:
    for i in range(n):
        if s[i]=='#':
            bloc = i
            break
    
    ans = min(black, n-black-bloc)
    print(ans)


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

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

using namespace std;

int nx[]={0,1,0,-1};
int ny[]={0,1,0,-1};
//*****************************************


int main(void){

    int a,b,c;
    scanf("%d",&a);
    scanf("%d",&b);
    scanf("%d",&c);
#include <iostream>
#include <string>

//最終形は
//あるところから右は全て黒、左は白という形にしかならない
//問題はどこを境界にするか
//したがって、N個の境界(1個めの左から)について、その左側の黒と右側の黒の個数の合計を調べる=その境界を基準としたとき色変えする個数
//全ての白の個数をあらかじめもっておけば、for文1回で各境界でのchange回数がわかる。あとは保存するなり毎回比較するなりすればOK
using namespace std;
int main(){
  int n; cin >> n;
  string s; cin >> s;
  
  int now_white = 0;
  for (int i=0; i<n; i++) if (s.at(i) == '.') now_white++;
  int now_white_right=now_white, now_black_left=0, min_change=now_white;
  for (int i=0; i<n; i++) {
    if (s.at(i) == '.') now_white_right--;
    else now_black_left++;
    min_change = min(now_white_right+now_black_left, min_change);
  }
  cout << min_change << endl;
}

    if((a>c && b<c) || (a<c && b>c))
    {

        cout << "Yes"<<endl;
    }
    else
    {
        cout << "No"<<endl;
    }


    return 0;
}





Compiler output:
a.cc: In function 'int main()':
a.cc:31:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   31 | int main(){
      |         ^~
a.cc:31:9: note: remove parentheses to default-initialize a variable
   31 | int main(){
      |         ^~
      |         --
a.cc:31:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:31:11: error: a function-definition is not allowed here before '{' token
   31 | int main(){
      |           ^
Language: C++

#include <iostream>
using namespace std;
int main(void){
    int N;
    cin >> N;
    string S;
    cin >> S;
    int count = 0;
    for(int i = 0;i < N - 1;i++){
        if(S[i] == ' #' && S[i + 1] == '.'){
            count+++;
        }
    }
    cout << count << endl;
    
}


Compiler output:
a.cc:10:20: warning: multi-character character constant [-Wmultichar]
   10 |         if(S[i] == ' #' && S[i + 1] == '.'){
      |                    ^~~~
a.cc: In function 'int main()':
a.cc:11:21: error: expected primary-expression before ';' token
   11 |             count+++;
      |                     ^
Language: C

#include <stdio.h>

int main(void){
    int N;
    scanf("%d", &N);
    char s[N+1];
    scanf("%s", s);
    int countw[N];
    int countb[N];
    int min = N;
    countw[0] = (s[0] == '.');
    countb[0] = (s[0] == '#');
    int count = 0;
    for(int i = 1; i<N; i++){
        countw[i] = countw[i-1] + (s[i] == '.');
        countb[i] = countb[i-1] + (s[i] == '#');
    }
    //iをblack
    if((countb[N-1] == N) || (countw[N-1] == N){
        min = 0;
    }
    for(int i = 1; i<N; i++){
        count = countb[i-1] + (countw[N-1] - countw[i]);
        if(count < min){
            min = count;
        }
    }

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

Compiler output:
main.c: In function 'main':
main.c:19:48: error: expected ')' before '{' token
   19 |     if((countb[N-1] == N) || (countw[N-1] == N){
      |       ~                                        ^
      |                                                )
main.c:31:1: error: expected expression before '}' token
   31 | }
      | ^
Language: C++

#include <iostream>
#include <string>

using namespace std;

int count_black_chank(string& s, int index)

int main(int argc, char* argv[]){
    int N;
    string S;

    cin >> N;
    cin >> S;

    // ....##.... -> 中を白にする
    //
    // .#.##.##..##.　-> 
    // ####...###....####.... 白を黒にする 11
    //....####...###....### 
    // #.#  例外　黒の数 > 白の数の場合　白を黒に

    // #..## // 左側の黒の数が右ブロックの白の数より小さい時
    // #..##. // 今のアルゴリズムだと3を返す
    // #..####
    // なんパターン
    // 塗りつぶしor 左白右側黒
    
    bool firstblack= false;
    int wCount = 0;
    int bCount = 0;
    int first_bCount = 0;

    for(int i = 0; i < N; i++){
            if(S[i] == '.' && firstblack == true){
                wCount++;
            }
            if(S[i] == '#'){
                if(firstblack == false){
                    firstblack = true;
                    first_bCount = count_black_chank(S,i);
                }
                bCount++;
            }
    }

    // cout << "w: " << wCount << endl;
    // cout << "b: " << bCount << endl;
        if(bCount > wCount){
            cout <<  wCount << endl;
            }else {
            cout << bCount << endl;
            }

    return 0;
}

int count_black_chank(string& s, int index){
    int count = 1;
    for (int i = 0; i < s.size(); i++){
        if(s[index+1] == '#')count++;
        else return count;
    }
}

int count_white_chank(string& s, int index){
    int count = 1;
    for (int i = 0; i < s.size(); i++){
        if(s[index+1] == '.')count++;
        else return count;
    }
}


Compiler output:
a.cc:8:1: error: expected initializer before 'int'
    8 | int main(int argc, char* argv[]){
      | ^~~
a.cc: In function 'int count_black_chank(std::string&, int)':
a.cc:63:1: warning: control reaches end of non-void function [-Wreturn-type]
   63 | }
      | ^
a.cc: In function 'int count_white_chank(std::string&, int)':
a.cc:71:1: warning: control reaches end of non-void function [-Wreturn-type]
   71 | }
      | ^
Language: C++

#include <iostream>

using namespace std;

int main(){
  int N;
  std::string S;
  cin >> N >> S;
  int ed_min = N;
  int dot_num_right = count(S.begin(), S.end(), '.');
  int shp_num_left = 0;
  for (int index = 0; index< N+1; index++){
    //std::string last = std::string(index, '.') + std::string(N-index, '#');
    if (index>0){
      if(S[index-1] == '.'){
        dot_num_right--;
      }
      else{
        shp_num_left++;
      }
    }
    int ed = shp_num_left + dot_num_right;
    
    if(ed < ed_min){
      ed_min = ed;
    }
  }
  std::cout << ed_min << std::endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:23: error: 'count' was not declared in this scope
   10 |   int dot_num_right = count(S.begin(), S.end(), '.');
      |                       ^~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
int N;string S;int count;int kuro;int siro;int j;int n;
  cin>>N; cin>>S;
  kuro=0;
  
   for (int i = 0; i < N; i++) {  
   if(S.at(i)=='#'){
     j=i;
     n=i;
      while( j < N) {
     if(S.at(j)=='#'){kuro=kuro+1;
                      j++;}
   }
     break;}
   }
}
  if(kuro=0){
  cout<<0<<endl;
  }
 else{ siro=N-(n+1+kuro);
  
   if(kuro<siro){
     cout<<kuro<<endl;
    }else{
     cout<<siro<<endl;
     }
  }
}
  


Compiler output:
a.cc:20:3: error: expected unqualified-id before 'if'
   20 |   if(kuro=0){
      |   ^~
a.cc:23:2: error: expected unqualified-id before 'else'
   23 |  else{ siro=N-(n+1+kuro);
      |  ^~~~
a.cc:31:1: error: expected declaration before '}' token
   31 | }
      | ^
Language: C++

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

int main()
{
    int N, C = 0;
    string S;
    cin >> N >> S;
    for (int i = 0; i < N; i++)
    {
        if (S.at(i) == '#')
        {
            for (int i++; i < N; i++)
            {
                if (S.at(i) == '.')
                {
                    C++;
                }
            }
        }
        else if (S.at(i) == '.')
        {
            continue;
        }
    }
    cout << C << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:23: error: expected ';' before '++' token
   13 |             for (int i++; i < N; i++)
      |                       ^~
      |                       ;
a.cc:13:25: error: expected primary-expression before ';' token
   13 |             for (int i++; i < N; i++)
      |                         ^
a.cc:13:32: error: expected ')' before ';' token
   13 |             for (int i++; i < N; i++)
      |                 ~              ^
      |                                )
a.cc:13:37: error: expected ';' before ')' token
   13 |             for (int i++; i < N; i++)
      |                                     ^
      |                                     ;
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define bug cout<<"AIkahne aise"<<endl
ll A[5000001];
vector<ll>v;
vector<pair<ll,ll> >v2;
/void sieve()
{
    for(ll i=3; i<=2000; i+=2)
    {
        for(ll j=ii; j<=4000000; j+=i)
            A[j]=1;
    }
    v.push_back(2);
    for(ll i=3; i<=4000000; i+=2)
        if(A[i]==0)
            v.push_back(i);
}*/
int main()
{
    ll n,k,white=0,black=0,ans=9999999999,nblack=0,nwhite=0;
 string s;
 cin>>n;
 cin>>s;
  for(int i=0;i<s.size();i++)
 {
     if(s[i]=='#')
        black++;
     else
        white++;
 
 }
 ans=white;
  for(int i=0;i<s.size();i++)
  {
      if(s[i]=='#')
        nblack++;
      else
        nwhite++;
      ans=min(ans,nblack+white-nwhite);
  }
  cout<<ans<<endl;
return 0;
}

Compiler output:
a.cc:8:1: error: expected unqualified-id before '/' token
    8 | /void sieve()
      | ^
a.cc:19:3: error: expected unqualified-id before '/' token
   19 | }*/
      |   ^
Language: C++

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

int main() {

	int n, tmp=0, min, cnt,ans;
	string s;

	cin >> n >> s;

	for (int i = 0; i < n; i++) {
		if (s[i] == '.')
			tmp++;
	}	//白の個数を計算

	min = tmp;

	for (int i = 0; i < n; i++) {
		if (s[i] == '.')
			tmp--;
		else
			tmp++;
		if (tmp < min)
			min = tmp;
	}

	cout << min ;


	return 0;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include<iostream>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:8:9: error: 'string' was not declared in this scope
    8 |         string s;
      |         ^~~~~~
a.cc:10:9: error: 'cin' was not declared in this scope; did you mean 'min'?
   10 |         cin >> n >> s;
      |         ^~~
      |         min
a.cc:10:21: error: 's' was not declared in this scope
   10 |         cin >> n >> s;
      |                     ^
a.cc:28:9: error: 'cout' was not declared in this scope
   28 |         cout << min ;
      |         ^~~~
Language: C

#include <stdio.h>

int main(void){
	int n;
	scanf("%d",&n);
	char s[n+1];
	scanf("%s",s);
	int lw = 0,rb = 0;
	for(int i = 0;(s[i] == '.')&&(i < n);i++){lw++;}
	for(int i = n-1;(s[i] == '#')$$(i >= 0);i--){rb++;}
	int w = 0,b = 0;
	for(int i = lw;i < (n - rb);i++){
		if(s[i] == '.'){w++;}
		else{b++;}
	}
	if(w < b){printf("%d",w);}
	else{printf("%d",b);}
	
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:10:38: error: expected ';' before '$$'
   10 |         for(int i = n-1;(s[i] == '#')$$(i >= 0);i--){rb++;}
      |                                      ^~
      |                                      ;
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
int N;string S;int count;int kuro;int siro;int j;int n;
  cin>>N; cin>>S;
  kuro=0;
  
   for (int i = 0; i < N; i++) {  
   if(S.at(i)=='#'){
     j=i;
     n=i;
      while( j < N) {
     if(S.at(j)=='#'){kuro=kuro+1;
                      j++;}
   }
     break;}
   }
  
  if(kuro=0){
  cout<<0<<endl
  }
 else{ siro=N-(n+kuro);
  
   if(kuro<siro){
     cout<<kuro<<endl;
     }else{
     cout<<siro<<endl;}
     }
}
  


Compiler output:
a.cc: In function 'int main()':
a.cc:21:16: error: expected ';' before '}' token
   21 |   cout<<0<<endl
      |                ^
      |                ;
   22 |   }
      |   ~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
int N;string S;int count;int kuro;int siro;int j;
  cin>>N; cin >>S;
  count=0;kuro=0;
  
   for (int i = 0; i < N; i++) {  
   if(S.at(i)=='#'){
     j=i;
     break;}
     else{cout<<0<<endl;}
   }
  
   while( j < N) {
     if(S.at(j)=='#'){kuro=kuro+1;
                      j++;}
   }
  
  siro=N-(i+kuro);
  
   if(kuro<siro){
     cout<<kuro<<endl;
     }else{
     cout<<siro<<endl;}
}
  


Compiler output:
a.cc: In function 'int main()':
a.cc:21:11: error: 'i' was not declared in this scope
   21 |   siro=N-(i+kuro);
      |           ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
int N;string S;int count;int kuro;int siro;
  cin>>N; cin >>S;
  count=0;kuro=0;
  
   for (int i = 0; i < N; i++) {  
   if(S.at(i)=='#'){break;}
     else{cout<<0<<endl;}
   }
  
  int j;
  j=i;
   while( j < N) {
     if(S.at(j)=='#'){kuro=kuro+1;
                      j++;}
   }
  
  siro=N-(i+kuro);
  
   if(kuro<siro){
     cout<<kuro<<endl;
     }else{
     cout<<siro<<endl;}
}
  

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

#include <iostream>

using namespace std;

int main(){
  int N;
  int ham;
  std::string S;
  cin >> N >> S;
  int ham_min = N;
  std::string last = "";
  for (int index = 0; index< N+1; index++){
    for (int j=0;j<N;j++){
      if(index <= j){
        last[j] += "#";
      }
      else{
        last[j] += ".";
      }
    }
    ham = 0;
    for(int i=0; i<N; i++){
      if (S[i] != last[i]){
        ham++;
      }
    }
    if(ham < ham_min){
      ham_min = ham;
    }
  }
  std::cout << ham_min << std::endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:17: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive]
   15 |         last[j] += "#";
a.cc:18:17: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive]
   18 |         last[j] += ".";
Language: C

#include <stdio.h>
// '.' is 白  '#' is black
int main(void) {
    int N; char S[200000];
    scanf("%d%s", &N, S);
    int cnt = 0;
    for (int i=0; i<N; i++) {
        if (S[i] == '#'){
            if (S[i+1] == '.'){
                S[i+1] == '#' cnt ++;
            }
        }
    }
    printf("%d\n", cnt);
}

Compiler output:
main.c: In function 'main':
main.c:10:30: error: expected ';' before 'cnt'
   10 |                 S[i+1] == '#' cnt ++;
      |                              ^~~~
      |                              ;
Language: C++

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

int main() {
  int a,e,f;
  string b;

  cin>>a>>b;
  vector<int>c(a+1),d(a+1);
  c[0]=0;
  d[0]=0;
  f=a;
  for(int i=0;i<a;i++){
      if(b[i]=='#'){
        c[i+1]=c[i]+1;
        d[i+1]=d[i];
      }
      else{
        c[i+1]=c[i];
        d[i+1]=d[i]+1;
      }
    }
  }
 for(int i=0;i<a;i++){
f=min(f,c[i+1]+d[a]-d[i+1]);
 }

cout<<f<<endl;
}


Compiler output:
a.cc:24:2: error: expected unqualified-id before 'for'
   24 |  for(int i=0;i<a;i++){
      |  ^~~
a.cc:24:14: error: 'i' does not name a type
   24 |  for(int i=0;i<a;i++){
      |              ^
a.cc:24:18: error: 'i' does not name a type
   24 |  for(int i=0;i<a;i++){
      |                  ^
a.cc:28:1: error: 'cout' does not name a type
   28 | cout<<f<<endl;
      | ^~~~
a.cc:29:1: error: expected declaration before '}' token
   29 | }
      | ^
Language: C++

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

int main(){
    long N;
    string str;
    cin >> N >> str;

    long count_black = 0;
    long count_1st = 0;
    long count_last = 0;
    bool flag = true;


    //黒が続く回数を調べる
  reverse(str.begin(),str.end());
    for(long i = 0;i < N;i++){
      if(str.substr(i,1) == "#"){
        count_black++;
        count_last = i;
        }
    }

    if(count_ black > 0)count_last++;

    //lastまでの白と黒の数を比較する
    long count_min = min(count_last - count_black,count_black);
     
    cout << count_min << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:8: error: 'count_' was not declared in this scope; did you mean 'count_1st'?
   26 |     if(count_ black > 0)count_last++;
      |        ^~~~~~
      |        count_1st
a.cc:26:14: error: expected ')' before 'black'
   26 |     if(count_ black > 0)count_last++;
      |       ~      ^~~~~~
      |              )
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int N, ans = 0, tmp = 0;
	string S;
	cin >> N >> S;
	for (int i = 0; i < N; ++i) {
		if (S[i] == '#') ++tmp;
		else {
			if (tmp) {
				++ans;
				--tmp;
			}
		}
	}
	/*for (int i = 0; i < N - 1; ++i) {
		if (S[i] == '#' && S[i + 1] == '.') ++ans;
	}*/
	cout << ans;
}
#include <bits/stdc++.h>
using namespace std;

int main() {
	int N, ans = 0, tmp = 0;
	string S;
	cin >> N >> S;
	for (int i = 0; i < N; ++i) {
		if (S[i] == '#') ++tmp;
		else {
			if (tmp) {
				++ans;
				--tmp;
			}
		}
	}
	/*for (int i = 0; i < N - 1; ++i) {
		if (S[i] == '#' && S[i + 1] == '.') ++ans;
	}*/
	cout << ans;
}

Compiler output:
a.cc:25:5: error: redefinition of 'int main()'
   25 | 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(void){
    int N;
    string S;
    cin>>N;
    cin>>S;
    int blaL = 0;
    int whiR = 0;
    for(int i = 0; i<N; i++){
        if(S[i]=='.'){
          whiR++;
        }
    }
    int ans = delR;
    for(int i = 0; i<N; i++){
        if(S[i]=='.'){
            whiR--;
        }else{
            blaL++;
        }
        ans = min(ans,whiR+blaL);
    }
    cout<<ans<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:15: error: 'delR' was not declared in this scope
   16 |     int ans = delR;
      |               ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
int N;string S;int count;int kuro;int siro;
  cin>>N; cin >>S;
  count=0;kuro=0;siro=0;
  
  for (int i = 0; i < N-1; i++) {  
   if(S.at(i)=='#'){
     
     for (int i = 0; i < N-i; i++) {
     if(S.at(i)=='#'){kuro=kuro+1;}
       else{siro=siro+1}
     }
     
     if(kuro>=siro){
     S.at(i+1)='#';
     count=count+1;
     }
   }    
  } 
  if(kuro<siro){
     cout<<siro<<endl;
     }else{
 cout<<count<<endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:24: error: expected ';' before '}' token
   14 |        else{siro=siro+1}
      |                        ^
      |                        ;
Language: C++

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

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MOD 1000000007

typedef long long ll;
typedef pair<int, int> p;


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

  int n;
  string s;
  cin >> n >> s;
  int white_num = 0;
  int black_num = 0;
  for (int i = 0; i < n; i++) {
    if(s[i] == '.') white_num++;
    else black_num++;
  }
  if(white_num == 0 || black_num == 0){
    cout << 0 << endl;
    return 0;
  }

  vector<int> black(n+1, 0);
  vector<int> white(n+1, white_num);

  for (int i = 0; i < n; i++) {
    if(s[i] == '#'){
      black[i+1] = black[i] + 1;
      white[i+1] = white[i];
    }else{
      white[i+1] = white[i] - 1;
      black[i+1] = black[i];
    }
  }


  print(black);
  print(white);
  // int black_num = black[n];
  int res = INT_MAX;

  for (int i = 1; i < n+1; i++) {
    res = min(res, black[i] + white[i]);
  }
  cout << res << endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:48:3: error: 'print' was not declared in this scope; did you mean 'rint'?
   48 |   print(black);
      |   ^~~~~
      |   rint