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

#include <iostream>
#include <string>
#include <cmath>
using namespace std;
 
int N;
string S;
 
int main() {
    cin >> N >> S;
    int white = 0;
    for (int i = 0; i < N; i++) {
        if (S[i] == '.') white++;
    }
 
    int left_w = 0;
    for (int i = 0; i < N; i++){
        if (S[i] == '.') left_w++;
        else break;
    }
 
    int black = 0;
    for (int i = 0; i < N; i++){
        if (S[i] == '#') black++;
    }
    
    int right_b = 0;
    for (int i = 0; i < N; i++){
        if (S[N-1-i] == '#') right_b++;
        else break;
    }

    int left_b = 0;
    for (int i = 0; i < N; i++){
        if (S[i] == '#') left_b++;
        else break;
    }

    int right_w = 0;
    for (int i = 0; i < N; i++){
        if (S[N-1-i] == '.') right_w++;
        else break;
    }
 
    int ans = min(white - left_w, min(black - right_b, left_b + right_w);
 
    cout << ans << endl;
 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:45:73: error: expected ')' before ';' token
   45 |     int ans = min(white - left_w, min(black - right_b, left_b + right_w);
      |                  ~                                                      ^
      |                                                                         )
Language: C++

#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<iostream>
#include <iomanip>
#include<queue>
#include<algorithm>
#include <functional>
#include<vector>
using namespace std;

long long N;
string S;
long long i = 0;
long long cnt_b;
long long cnt_w;
long long ans=0;
long long ans2 = 0;

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

	cnt_b = 0;
	cnt_w = 0;
	while (i < N) {
		while (S[i] == '#'&&i < N) {
			cnt_b++;
			i++;
			if (i == N)break;

			while (S[i] == '.') {
				cnt_w++;
				i++;
				if (i == N)break;
			}
		}
		i++;
	}

	reverse(S.begin(), S.end());
	j == 0;
	while (S[j] == '#'&&j < N) {
		cnt_b--;
		j++;
	}

	cout << min(cnt_b,cnt_w) << endl;
}

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

#include <bits/stdc++.h>
using namespace std;
long long n;
void solve()
{
    string a;
    cin>>a;
    long long i,ans1=0,l=a.length();
    for (i=l-1;i>=0;i--)
        if (a[i]!='#') break;
    l=i;
    for (i=0;i<=l;i++)
        if (a[i]=='.') ans1++;
    cout<<min(ans1,a.length()-ans1)<<endl;
}
int main()
{
    while(cin>>n)
        solve();
    return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:14:14: error: no matching function for call to 'min(long long int&, long long unsigned int)'
   14 |     cout<<min(ans1,a.length()-ans1)<<endl;
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~
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:   template argument deduction/substitution failed:
a.cc:14:14: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long long unsigned int')
   14 |     cout<<min(ans1,a.length()-ans1)<<endl;
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~
/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, 2 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:   candidate expects 1 argument, 2 provided
/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:   template argument deduction/substitution failed:
a.cc:14:14: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   14 |     cout<<min(ans1,a.length()-ans1)<<endl;
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main()
{
	int N;
	string S;
	cin >> N >> S;
	int white = 0, black = 0;
	while(inx < N)
	{
		if(S[inx] =='.') white++;
		else black++;
		inx++;
	}
	cout << min(black, white) << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:15: error: 'inx' was not declared in this scope; did you mean 'int'?
   11 |         while(inx < N)
      |               ^~~
      |               int
Language: C++

#include <iostream>
using namespace std;

int main(void) {
    int N;
    int hcnt=0;
    int bcnt=0
    string S;
    cin >> N >> S;
    for(int i=0; i<=N; ++i) {
      if(S[i]=='#' && S[i+1]=='.') ++bcnt;
      if(s[i]=='.' && s[i+1]=='#') ++hcnt;
    }
    if(hcnt>=bcnt) cout << hcnt << "\n";
    else cout << bcnt << "\n";
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:5: error: expected ',' or ';' before 'string'
    8 |     string S;
      |     ^~~~~~
a.cc:9:17: error: 'S' was not declared in this scope
    9 |     cin >> N >> S;
      |                 ^
a.cc:12:10: error: 's' was not declared in this scope
   12 |       if(s[i]=='.' && s[i+1]=='#') ++hcnt;
      |          ^
Language: C++

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

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

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

    for(int i = 0;i < N;i++){
      //黒の数を数える
      if(str.substr(i,1) == "#"){
        count_black++;
        //初めて黒になったところを調べる
        if(flag == true){
          count_1st = i;
          flag = false;
        }
    }
    }
    //黒が続く回数を調べる
  reverse(str.begin(),str.end());
    for(int i = 0;i < N;i++){
      if(str.substr(i,1) == "#")count_last++;
      else break;
    }

    int count_min = min(N - count_black - count_1st,
                        count_black - count_last,
                        count_black,N - count_black);
    cout << count_min << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:34:24: error: no matching function for call to 'min(int, int, int&, int)'
   34 |     int count_min = min(N - count_black - count_1st,
      |                     ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   35 |                         count_black - count_last,
      |                         ~~~~~~~~~~~~~~~~~~~~~~~~~
   36 |                         count_black,N - count_black);
      |                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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, 4 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, 4 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:   candidate expects 1 argument, 4 provided
/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, 4 provided
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  string s;
  cin >> n >> s ;
int i;
int counter=0;
int flag=0;
for (i=0;i<n;i++)
  if (flag ==0)
    { if (s[i]=="#")flag =1;}
  else 
    {if (s[i] == "*")counter++;}

 cout<<counter<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:15: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   13 |     { if (s[i]=="#")flag =1;}
a.cc:15:15: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   15 |     {if (s[i] == "*")counter++;}
Language: C++

#include <algorithm>
#include <vector>

using namespace std;

int getLastBlackWithoutWhiteIndex(string s) {
    for (int i = s.size() - 1; 0 <= i; --i) {
        if (s[i] == '.') {
            return i;
        }
    }
    return 0;
}

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

    int c = getLastBlackWithoutWhiteIndex(s);
    int b, w;
    for (int i = b = w = 0; i <= c; ++i) {
        if (s[i] == '#') ++b;
        else             ++w;
    }

    cout << min(w, b) << endl;
}


Compiler output:
a.cc:6:35: error: 'string' was not declared in this scope
    6 | int getLastBlackWithoutWhiteIndex(string s) {
      |                                   ^~~~~~
a.cc:3:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
    2 | #include <vector>
  +++ |+#include <string>
    3 | 
a.cc: In function 'int main()':
a.cc:17:5: error: 'string' was not declared in this scope
   17 |     string s;
      |     ^~~~~~
a.cc:17:5: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
a.cc:18:5: error: 'cin' was not declared in this scope
   18 |     cin >> n >> s;
      |     ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include <vector>
  +++ |+#include <iostream>
    3 | 
a.cc:18:17: error: 's' was not declared in this scope
   18 |     cin >> n >> s;
      |                 ^
a.cc:20:42: error: 'getLastBlackWithoutWhiteIndex' cannot be used as a function
   20 |     int c = getLastBlackWithoutWhiteIndex(s);
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
a.cc:27:5: error: 'cout' was not declared in this scope
   27 |     cout << min(w, b) << endl;
      |     ^~~~
a.cc:27:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:27:26: error: 'endl' was not declared in this scope
   27 |     cout << min(w, b) << endl;
      |                          ^~~~
a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    2 | #include <vector>
  +++ |+#include <ostream>
    3 |
Language: C++

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

using namespace std;


int main() {
    int N;
    string S;

    cin >> N >> S;

    // 全部 # にしちゃう
    int allSharpCounter = 0;
    for (int i = 0; i < N; ++i) {
        if (S.substr(i, 1) == ".") {
            ++allSharpCounter;
        }
    }

    // 全部 . にしちゃう
    int allDotCounter = 0;
    for (int i = 0; i < N; ++i) {
        if (S.substr(i, 1) == "#") {
            ++allDotCounter;
        }
    }




    // 逆にする
    reverse(S.begin(), S.end());

    // . の次が # の場合はカウント
    int dotCounter = 0;
    for (int i = 0; i < N - 1; ++i) {
        if (S.substr(i, 1) == "." && S.substr(i + 1, 1) == "#") {
            ++dotCounter;
            S.replace(i + 1, 1, ".");
        }
    }

    int num = min(allSharpCounter, allDotCounter);
    num = min(num, dotCounter);
    cout << num << endl;

    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:34:5: error: 'reverse' was not declared in this scope
   34 |     reverse(S.begin(), S.end());
      |     ^~~~~~~
Language: C

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

#define _CRT_SECURE_NO_WARNINGS
#define TLong long long
#define TBMod 1000000007

int main(int argc, char const *argv[])
{
	int n;
	int b = 0,h = 0;
	char s[200007];
	for (int i = 0; i < n; ++i)
	{
		if(s[i] == '.')	++w;
		else ++b;	
	}
	if(s[0] == '#')	printf("%d\n", (w < b ? w : b));
	else printf("%d\n", abs(w - b));
	return 0;
}


Compiler output:
main.c: In function 'main':
main.c:18:35: error: 'w' undeclared (first use in this function)
   18 |                 if(s[i] == '.') ++w;
      |                                   ^
main.c:18:35: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include <string>
using namespace std;

int main() {
	// your code goes here
	int n, cnt=0,key=1;
	string str;
	
	cin >> n;
	cin >> str;
	
	char log[n] = {};
	
	if(str[0] == '#' && str[1] == '.'){
		//str[0] = '.';
		cnt++;
	}
	while(1) {
		key = str.find(".#.");
		if(key== string::npos) {
			//break;
		} else {
			//str[key+1] = '.';
			//log[key] = '1';
			cnt++;
			//cout << str<< endl;
		}
		
		key = str.find("##.");
		if(key== string::npos) {
			break;
		} else {
			//str[key+2] = '#';
			//log[key] = '1';
			cnt++;
			//cout << str<< endl;
		}
	}
	
	/*
	for(int i=0 ; i<n ; i++) {
		if(log[n] == '1') cnt++;
	}
	*/
	cout << cnt << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:9: error: 'cin' was not declared in this scope
    9 |         cin >> n;
      |         ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include <string>
  +++ |+#include <iostream>
    2 | using namespace std;
a.cc:45:9: error: 'cout' was not declared in this scope
   45 |         cout << cnt << endl;
      |         ^~~~
a.cc:45:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:45:24: error: 'endl' was not declared in this scope
   45 |         cout << cnt << endl;
      |                        ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    1 | #include <string>
  +++ |+#include <ostream>
    2 | using namespace std;
Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF (2e9)
#define EPS (1e-7)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int main() {
    ll n;
    string s;
    cin >> n;
    cin >> s;
    ll fb;
    ll ans;

    for(ll i = 0; i < n; i++) {
        if (s[i] == '#') {
            fb = i;
            break;
        }
        ans = 0;
    }

    ll b = 0;
    ll w = 0;
    for(ll i = m; i < n; i++) {
        if (s[i] == '#') {
            b++;
        } else {
            w++;
        }
    }

    if (b > w) {
        ans = w;
    } else {
        ans = b;
        if (s[n-1] == '#') {
            ans--;
        }
    }
    cout << ans << endl;
}

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

#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N;
    cin >> N;
    string S;
    cin >> S;
    int ans = 0;
    bool check = false;
    for (int i = 0; i < N; i++)
    {
        if (S[i] == '#' and check == false)
        {
            check = true;
        }
        if (check == true)
        {
            if (S[i] == '.')
            {
                ans++;
            }
        }
    }
    bool check = false;
    int tmp = 0;
    for (int i = N - 1; i >= 0; i--)
    {
        if (S[i] == '.' and check == false)
        {
            check = true;
        }
        if (check == true)
        {
            if (S[i] == '#')
            {
                tmp++;
            }
        }
    }
    cout << min(tmp, ans) << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:10: error: redeclaration of 'bool check'
   25 |     bool check = false;
      |          ^~~~~
a.cc:10:10: note: 'bool check' previously declared here
   10 |     bool check = false;
      |          ^~~~~
Language: Java

		int numN = nextInt();
		String sS = next();
		char[] tmp = new char[numN];
		char[] tmp2 = new char[numN];

		for (int i = 0; i < numN; i++) {
			tmp[i] = sS.charAt(i);
			tmp2[i] = sS.charAt(i);
		}
		int res = 0;
		for (int i = 1; i < numN; i++) {
			if (tmp[i] == '.' && tmp[i - 1] == '#') {
				res++;
				tmp[i] = '#';
			}
		}

		int res2 = 0;
		for (int i = 1; i < numN; i++) {
			if (tmp2[i] == '.' && tmp2[i - 1] == '#') {
				res2++;
				tmp2[i - 1] = '.';
			}
		}

		out.println(Integer.min(res, res2));

Compiler output:
Main.java:1: error: unnamed classes are a preview feature and are disabled by default.
		int numN = nextInt();
		^
  (use --enable-preview to enable unnamed classes)
Main.java:6: error: class, interface, enum, or record expected
		for (int i = 0; i < numN; i++) {
		^
Main.java:6: error: class, interface, enum, or record expected
		for (int i = 0; i < numN; i++) {
		                ^
Main.java:6: error: class, interface, enum, or record expected
		for (int i = 0; i < numN; i++) {
		                          ^
Main.java:8: error: class, interface, enum, or record expected
			tmp2[i] = sS.charAt(i);
			^
Main.java:9: error: class, interface, enum, or record expected
		}
		^
Main.java:11: error: class, interface, enum, or record expected
		for (int i = 1; i < numN; i++) {
		^
Main.java:11: error: class, interface, enum, or record expected
		for (int i = 1; i < numN; i++) {
		                ^
Main.java:11: error: class, interface, enum, or record expected
		for (int i = 1; i < numN; i++) {
		                          ^
Main.java:14: error: class, interface, enum, or record expected
				tmp[i] = '#';
				^
Main.java:15: error: class, interface, enum, or record expected
			}
			^
Main.java:19: error: class, interface, enum, or record expected
		for (int i = 1; i < numN; i++) {
		^
Main.java:19: error: class, interface, enum, or record expected
		for (int i = 1; i < numN; i++) {
		                ^
Main.java:19: error: class, interface, enum, or record expected
		for (int i = 1; i < numN; i++) {
		                          ^
Main.java:22: error: class, interface, enum, or record expected
				tmp2[i - 1] = '.';
				^
Main.java:23: error: class, interface, enum, or record expected
			}
			^
16 errors
Language: C++

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

int main()
{
    int n;
    string s;
    cin >> n >> s;
    int black = 0, white = 0;
    for(int i = 0; i < n; ++i)
    {
        if(s[i] == '#') ++black;
        else ++white;
    }

    cout << n - max(black, white) << endl;
}

Compiler output:
a.cc:1:1: error: stray '##' in program
    1 | ##include <bits/stdc++.h>
      | ^~
a.cc:1:3: error: 'include' does not name a type
    1 | ##include <bits/stdc++.h>
      |   ^~~~~~~
a.cc: In function 'int main()':
a.cc:7:5: error: 'string' was not declared in this scope
    7 |     string s;
      |     ^~~~~~
a.cc:8:5: error: 'cin' was not declared in this scope
    8 |     cin >> n >> s;
      |     ^~~
a.cc:8:17: error: 's' was not declared in this scope
    8 |     cin >> n >> s;
      |                 ^
a.cc:16:5: error: 'cout' was not declared in this scope
   16 |     cout << n - max(black, white) << endl;
      |     ^~~~
a.cc:16:17: error: 'max' was not declared in this scope
   16 |     cout << n - max(black, white) << endl;
      |                 ^~~
a.cc:16:38: error: 'endl' was not declared in this scope
   16 |     cout << n - max(black, white) << endl;
      |                                      ^~~~
Language: Java

import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String s = sc.next();
		char before = s.charAt(0);
		int changecnt = 0,blackcnt = 0,whitecnt = 0;
		boolean blackis = false;
		for(int i = 0;i < n;i ++) {
			char c = s.charAt(i);
			if(c == '#') { blackcnt++; blackis = true;}
			if(blackis && c == '.') whitecnt++;
		}
		if(blackcnt < whitecnt) System.out.println(blackcnt);
		else System.out.println(whitecnt);
	}


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

#include<stdio.h>
int main(){
char S[200001];
scanf("%s",S);
int i,cnt=0;
for(i=0;S[i]!='\0';i++){
if(S[i]='#'&&S[i+1]='.') {
S[i+1]='#';
cnt++;
}
printf("%d",cnt);
return 0;
}


Compiler output:
main.c: In function 'main':
main.c:7:20: error: lvalue required as left operand of assignment
    7 | if(S[i]='#'&&S[i+1]='.') {
      |                    ^
main.c:13:1: error: expected declaration or statement at end of input
   13 | }
      | ^
Language: C++

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

int main(){
    int N;    
    string S;
    cin >> N;
    cin >> S;
    int left = -1;
    int count = 0;
    int count2 = 0;
    bool flag=false;
    for(int i=0; i<N; i++){
	if(S[i] == '#' && left == -1){
	    left = i;
	}
	if(left != -1 && S[i] == '.'){
	    flag = true;
	}
	    
	    
    }
    for(int i=left; i<N; i++){
	if(S[i] == '.'){
	    count++;
	}	    
    }
    
    for(int i=0; i<N; i++){
	if(S[i] == '#'){
	    count2++;
	}	    
    }
    cout << count << endl;
    
    cout << count2 << endl;
    count = min(count, count2);
    
 
    if(left == -1 || !flag){
	cout << 0 << endl;
    }
    else{
	
	cout << count << endl;
    }
    

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

#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main() {
  int n,ans=0;
  string s;
  cin >> n >> s;
  for(int i=0; i<n-1; i++) {
    if(s[i]=='#'&&s[i+1]=='.') {
      ans++;
    }
    if(ans>0) {
      if(s[i]=='.'&&s[i+1]=='.') {
        ans++:
      }
    }
  }
    cout << ans << endl;
}

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

#include <iostream>
using namespace std;
//dp[i]:1~iまでの黒の石の数
int B[200001]={0};

int main(){
  int N;
  string str;
  cin >> N >> str;
  for(int i=0;i<N;i++){
    B[i+1]=B[i];
    if(str[i]=='#')B[i+1]++;
  }
  int ans=N+1;
  for(int i=0;i<=N;i++)ans=min(B[i]+(N-i)-(B[N]-B[i]),ans);
  cout << ans << endl;
  retur

Compiler output:
a.cc: In function 'int main()':
a.cc:17:3: error: 'retur' was not declared in this scope
   17 |   retur
      |   ^~~~~
a.cc:17:8: error: expected '}' at end of input
   17 |   retur
      |        ^
a.cc:6:11: note: to match this '{'
    6 | int main(){
      |           ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
    string s;
    int n;
    cin>>n>>s;
    int count11=0,count12=0,count21=0,count22=0;

    for(int i=0;i<n;i++){
        if(count11==0){
            if(s[i]=='#')count=1;
        }
        else{
            if(s[i]=='.')count21++;
        }
        if(count12==0){
            if(s[i]=='.')count=1;
        }
        else{
            if(s[i]=='#')count22++;
        }
    }
    if(count22>count21)cout<<count21<<endl;
    else cout<<count22<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:32: error: overloaded function with no contextual type information
   12 |             if(s[i]=='#')count=1;
      |                                ^
a.cc:18:32: error: overloaded function with no contextual type information
   18 |             if(s[i]=='.')count=1;
      |                                ^
Language: C

#include<stdio.h>
int main(){
int S[200000];
scanf("%s",S);
int i,cnt=0;
for(i=0;S[i]!='\0';i++){
if(S[i]='#'&&S[i+1]='.') {
S[i+1]='#';
cnt++;
}
printf("%d",cnt);
return 0;
}


Compiler output:
main.c: In function 'main':
main.c:7:20: error: lvalue required as left operand of assignment
    7 | if(S[i]='#'&&S[i+1]='.') {
      |                    ^
main.c:13:1: error: expected declaration or statement at end of input
   13 | }
      | ^
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(){
	int c = 0,c2 = 0;
	string str;
	cin >> str;
	for(auto &i : str){
		if(i == '.'){
			c++;
		}else{
			c1++;
		}
	}
	cout << min(c,c1) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:25: error: 'c1' was not declared in this scope; did you mean 'c2'?
   13 |                         c1++;
      |                         ^~
      |                         c2
a.cc:16:23: error: 'c1' was not declared in this scope; did you mean 'c2'?
   16 |         cout << min(c,c1) << endl;
      |                       ^~
      |                       c2
Language: C++

#include <cstdio>
#include <iostream>
#include <algorithm>

#define WHITE '.'
#define BLACK '#'

using namespace std;

int main() {
	int white = 0, black = 0;
	bool white_flag = false;

	int n;
	char c;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> c;
		if (c == WHITE) {
			if (!black_flag) {
				black_flag = true;
			}
			if (white_flag) {
				white++;
			}
		}
		else {
			black++;
		}
	}
	int ans = 0;
	white <= black ? ans = white : ans = black;
	cout <<  ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:30: error: 'black_flag' was not declared in this scope
   20 |                         if (!black_flag) {
      |                              ^~~~~~~~~~
Language: C++

int main() {
	int white = 0, black = 0;
	bool white_flag = false;

	int n;
	char c;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> c;
		if (c == WHITE) {
			if (!black_flag) {
				black_flag = true;
			}
			if (white_flag) {
				white++;
			}
		}
		else {
			black++;
		}
	}
	int ans = 0;
	white <= black ? ans = white : ans = black;
	cout <<  ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: 'cin' was not declared in this scope
    7 |         cin >> n;
      |         ^~~
a.cc:10:26: error: 'WHITE' was not declared in this scope
   10 |                 if (c == WHITE) {
      |                          ^~~~~
a.cc:11:30: error: 'black_flag' was not declared in this scope
   11 |                         if (!black_flag) {
      |                              ^~~~~~~~~~
a.cc:24:9: error: 'cout' was not declared in this scope
   24 |         cout <<  ans << endl;
      |         ^~~~
a.cc:24:25: error: 'endl' was not declared in this scope
   24 |         cout <<  ans << endl;
      |                         ^~~~
Language: C++

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

int main()
{
    int n;
    string s;
    cin >> n >> s;
    int black = 0;
    for(int i = 0; i < n; ++i)
    {
        if(s[i] == '#') ++black;
    }

    cout << min(black, s.size() - black) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:16: error: no matching function for call to 'min(int&, std::__cxx11::basic_string<char>::size_type)'
   15 |     cout << min(black, s.size() - black) << endl;
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~
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:   template argument deduction/substitution failed:
a.cc:15:16: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'})
   15 |     cout << min(black, s.size() - black) << endl;
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/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, 2 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:   candidate expects 1 argument, 2 provided
/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:   template argument deduction/substitution failed:
a.cc:15:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   15 |     cout << min(black, s.size() - black) << endl;
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main() {
  int N, bit=0, bittest=0, bitxor, ans=200000; cin >> N;
  char c;
  for (int i=0; i<N; i++) {
    cin >> c;
    if (c=='#') bit |= 1<<(N-1-i);
  }
  ans = min(ans,__builtin_popcount(bit^0));
  for (int i=0; i=<N; i++) {
    bittest |= 1<<i;
    bitxor = bit^bittest;
    ans = min(ans,__builtin_popcount(bitxor));
  }
  cout << ans << "\n";
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:19: error: expected primary-expression before '<' token
   11 |   for (int i=0; i=<N; i++) {
      |                   ^
Language: C++

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

int main() {
  int n;
  string s, count = 0;
  cin >> n >> s;
  char white = '.', black = '#';

  if (s.at(0) == black) {
    for (int i = 1; i < s.size(); i++) if (s.at(i) == white) count++;
  } else {
    for (int i = 1; i < s.size(); i++) if (s.at(i-1) == black) count++;
  }
  cout << count << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:67: error: no 'operator++(int)' declared for postfix '++' [-fpermissive]
   11 |     for (int i = 1; i < s.size(); i++) if (s.at(i) == white) count++;
      |                                                              ~~~~~^~
a.cc:13:69: error: no 'operator++(int)' declared for postfix '++' [-fpermissive]
   13 |     for (int i = 1; i < s.size(); i++) if (s.at(i-1) == black) count++;
      |                                                                ~~~~~^~
Language: C++

#include <bits/stdc++.h>
using namespace std;
long long n;
void solve()
{
    string a;
    cin>>a;
    long long i,ans=0;
    for (i=1;i<a.length();i++)
        if (a[i]=='.'&&a[i-1]=='#') ans++;
    cout<<min(a.length()-ans,ans)<<endl;
}
int main()
{
    while(cin>>n)
        solve();
    return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:11:14: error: no matching function for call to 'min(long long unsigned int, long long int&)'
   11 |     cout<<min(a.length()-ans,ans)<<endl;
      |           ~~~^~~~~~~~~~~~~~~~~~~~
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:   template argument deduction/substitution failed:
a.cc:11:14: note:   deduced conflicting types for parameter 'const _Tp' ('long long unsigned int' and 'long long int')
   11 |     cout<<min(a.length()-ans,ans)<<endl;
      |           ~~~^~~~~~~~~~~~~~~~~~~~
/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, 2 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:   candidate expects 1 argument, 2 provided
/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:   template argument deduction/substitution failed:
a.cc:11:14: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long unsigned int'
   11 |     cout<<min(a.length()-ans,ans)<<endl;
      |           ~~~^~~~~~~~~~~~~~~~~~~~
Language: Java

import java.util.*;
public class Main {
	public static void main(String[] args){
		char black = '#';
		char white = '.';
		
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String s = sc.next();
		
		char[] chars = s.toCharArray();
		int ans = 0;
		
		for(int i = 0; i < chars.length - 1; i++) {
			if (chars[i] == black && chars[i+1] == white) {
				
				if(i > (chars.length / 2)) {
					//右を黒にする場合
					ans++;
					chars[i+1] = black;
				} else {
					//自分を白にする場合
					ans++;
					chars[i] = white;
					i = 0;
				}
			}
		}
		
		
		String reString = "" + ans;
		System.out.println(reString);
	}

Compiler output:
Main.java:33: error: reached end of file while parsing
	}
	 ^
1 error
Language: C++

# -*- coding: utf-8 -*-

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

maekuro = len(S.split('#')[0])
usirosiro = len(S.split('.')[-1])
print(min(S[maekuro:].count('.'), S[:len(S)-usirosiro].count('#')))

Compiler output:
a.cc:1:3: error: invalid preprocessing directive #-
    1 | # -*- coding: utf-8 -*-
      |   ^
a.cc:3:1: error: 'N' does not name a type
    3 | N = int(input())
      | ^
Language: Java

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

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

        int N = sc.nextInt();
        String S = sc.next();
        // ArrayList<String> result = new ArrayList<>();

        String setchar = "0";
        for (int i=0; i<N-1; i++) {
            if (S.charAt(i) == "#") {
                setchar = S.charAt(i+1);
                if (setchar == ".") {
                    S.replace(".", "#");
                }
            }
        }
        System.out.println(count);
    }
}

Compiler output:
Main.java:14: error: bad operand types for binary operator '=='
            if (S.charAt(i) == "#") {
                            ^
  first type:  char
  second type: String
Main.java:15: error: incompatible types: char cannot be converted to String
                setchar = S.charAt(i+1);
                                  ^
Main.java:21: error: cannot find symbol
        System.out.println(count);
                           ^
  symbol:   variable count
  location: class Main
3 errors
Language: C++

#include<iostream>
using namespace std;

int turn(string s){
  if(s.size()==1){
    return 0;
  }
  if(s.back()=='#'){
    return turn(s.substr(0, s.size()-1));
  }else{
    int sharp = 0;
    for(int i=0;i<s.size();i++){
      if(s[i]=='#')sharp++;
    }
    return min(sharp, 1 + turn(s.substr(0, s.size()-1)));
  }
}

Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <queue>
#include <stack>
#include <math.h>
#include <set>
#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define P pair<int, int>

#define MOD 1000000007
#define INF 2147483647
#define NINF (-2147483647-1)
#define LLINF 9223372036854775807
using ll = long long;
using namespace std;

int main() {
    int N;
    string S;
    cin >> N >> S;
    int cnt1 = 0, cnt2 = 0, cnt3 - 0;
    bool bla = true;
    for (int i = S.length()-1; i >= 0; i--)
    {
        if (S[i] == '.') {
            bla = false;
            cnt1++;
        }
        else if (S[i] == '#') {
            if (!bla) cnt2++;
            cnt3++;
        }
    }
    if (cnt2 == 0) {
        cout << min(cnt1, cnt3) << endl;
    }
    else {
        cout << min(cnt1, cnt2) << endl;
    }
    getchar(); getchar();
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:34: error: expected initializer before '-' token
   25 |     int cnt1 = 0, cnt2 = 0, cnt3 - 0;
      |                                  ^
a.cc:35:13: error: 'cnt3' was not declared in this scope; did you mean 'cnt2'?
   35 |             cnt3++;
      |             ^~~~
      |             cnt2
a.cc:39:27: error: 'cnt3' was not declared in this scope; did you mean 'cnt2'?
   39 |         cout << min(cnt1, cnt3) << endl;
      |                           ^~~~
      |                           cnt2
Language: C++

3
#.##include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const ll LINF = 1e18;
const int MOD = 1e9 + 7;

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

Compiler output:
a.cc:2:2: error: invalid preprocessing directive #.
    2 | #.##include <bits/stdc++.h>
      |  ^
a.cc:1:1: error: expected unqualified-id before numeric constant
    1 | 3
      | ^
a.cc:6:9: error: 'pair' does not name a type
    6 | typedef pair<int, int> P;
      |         ^~~~
a.cc: In function 'int main()':
a.cc:13:3: error: 'string' was not declared in this scope
   13 |   string s;
      |   ^~~~~~
a.cc:14:3: error: 'cin' was not declared in this scope
   14 |   cin >> n >> s;
      |   ^~~
a.cc:14:15: error: 's' was not declared in this scope
   14 |   cin >> n >> s;
      |               ^
a.cc:19:3: error: 'cout' was not declared in this scope
   19 |   cout << ans << endl;
      |   ^~~~
a.cc:19:18: error: 'endl' was not declared in this scope
   19 |   cout << ans << endl;
      |                  ^~~~
Language: C

#include <stdio.h>

int
main(int argc, char *argv[])
{
  int n; char s[400000]; int k = -1;
  scanf("%d%s", &n, s);
  for(int i = 0; i < n; i++){
    if(s[i] == '#'){
      k = i;
      break;
    }
    else if(i == n - 1){
      printf("%d\n", 0);
    }
  }

  int white = 0; int black = 0;

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

    if(black + 1 < white){
      printf("%d\n", black + 1);
    }
    else{
      printf("%d\n", white);
    }
  }
  
  return 0;


Compiler output:
main.c: In function 'main':
main.c:38:3: error: expected declaration or statement at end of input
   38 |   return 0;
      |   ^~~~~~
Language: C++

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

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

  int i, a = 0, counta = 0, b = 0, countb = 0;
  for(i = 0; i < s.size(); i++){
    if(s.at(i) == '#'){
    a = i
    break;
    }
  }

  for(i = a; i < s.size(); i++){
    if(s.at(i) == '.'){
    counta++;
    }
  }

  for(i = s.size() - 1; i >= 0; i--){
    if(s.at(i) == '.'){
    b = i
    break;
    }
  }

  for(i = b; i >= 0; i--){
    if(s.at(i) == '#'){
    countb++;
    }
  }

  int ans;
  ans = min(counta, countb)

  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:10: error: expected ';' before 'break'
   12 |     a = i
      |          ^
      |          ;
   13 |     break;
      |     ~~~~~ 
a.cc:25:10: error: expected ';' before 'break'
   25 |     b = i
      |          ^
      |          ;
   26 |     break;
      |     ~~~~~ 
a.cc:37:28: error: expected ';' before 'cout'
   37 |   ans = min(counta, countb)
      |                            ^
      |                            ;
   38 | 
   39 |   cout << ans << endl;
      |   ~~~~
Language: C++

input1.txt input
4 .##.
input1.txt output
1
3 ms erasped

input2.txt input
5 #.##.
input2.txt output
2
3 ms erasped

input3.txt input
9 ..##..###
input3.txt output
2
3 ms erasped

Exited with status 0


Compiler output:
a.cc:2:4: error: stray '##' in program
    2 | 4 .##.
      |    ^~
a.cc:8:3: error: stray '#' in program
    8 | 5 #.##.
      |   ^
a.cc:8:5: error: stray '##' in program
    8 | 5 #.##.
      |     ^~
a.cc:14:5: error: stray '##' in program
   14 | 9 ..##..###
      |     ^~
a.cc:14:9: error: stray '##' in program
   14 | 9 ..##..###
      |         ^~
a.cc:14:11: error: stray '#' in program
   14 | 9 ..##..###
      |           ^
a.cc:1:1: error: 'input1' does not name a type
    1 | input1.txt input
      | ^~~~~~
Language: C

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

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

int iin() {
    int i;
    scanf("%d", &i);
    return i;
}

long long llin() {
    long long i;
    scanf("%lld", &i);
    return i;
}

double din() {
    double i;
    scanf("%lf", &i);
    return i;
}

char cin() {
    char c;
    scanf("%c", &c);
    return c;
}

void stin(char *s) {
    scanf("%s", s);
}

void iout(int i) {
    printf("%d\n", i);
}

void llout(long long i) {
    printf("%lld\n", i);
}

void dout(double i) {
    printf("%lf\n", i);
}

void cout(char c) {
    printf("%c\n", c);
}

void stout(char *s) {
    printf("%s\n", s);
}

int dfs(int v, int n, int *visited, int table[n][n]) {
    int all_visited = 1, i;

    REP(i,n) {
        if (!visited[i]) {
            all_visited = 0;
            break;
        }
    }

    if (all_visited) {
        return 1;
    }

    int count = 0;

    REP(i,n) {
        if (!table[v][i]) continue;
        if (visited[i]) continue;

        visited[i] = 1;
        count += dfs(i, n, visited, table);
        visited[i] = 0;
    }

    return count;
}

int main() {
    int n = iin();
    char s[n];
    stin(s);
    int i, b = 0, count = 0, fw = 0, lb = 0;
    REP(i,n) {
        if (b) {
            if (s[i] == '.') count++;
        } else {
            if (s[i] == '#') b = 1;
            else fw++;
        }
    }
    int i = n - 1;
    while(1) {
        if (s[i] == '.') break;
        lb++;
        i--;
    }
    iout((n - fw - count - lb > count) ? count : n - fw - count - lb);
    return 0;
}


Compiler output:
main.c: In function 'main':
main.c:98:9: error: redeclaration of 'i' with no linkage
   98 |     int i = n - 1;
      |         ^
main.c:89:9: note: previous declaration of 'i' with type 'int'
   89 |     int i, b = 0, count = 0, fw = 0, lb = 0;
      |         ^
Language: C++

#include<iostream>
#include<cstring>
#include<math.h>
#include<algorithm>

using namespace std;

const int INF = INT_MAX;

int main(){

    long long n;
    string s;
    cin >> n;
    cin >> s;

    long long right = n-1, left = 0;
    long long start = int((right+left)/2);
    if(s[start]=='.'){
        while(start<right && s[start]=='.')start++;
    }else{
        while(start<right && s[start]=='#')start--;
    }
    long long ans = 0;
    long long temp = start;
    while(temp<=right){
        if(s[temp]=='.')ans++;
        temp++;
    }
    temp = start;
    while(temp>=left){
        if(s[temp]=='#')ans++;
        temp--;
    }

    cout << ans-1 << endl;
}


Compiler output:
a.cc:8:17: error: 'INT_MAX' was not declared in this scope
    8 | const int INF = INT_MAX;
      |                 ^~~~~~~
a.cc:5:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    4 | #include<algorithm>
  +++ |+#include <climits>
    5 |
Language: C++

#include<iostream>
using namespace std;

long long int main(){
  long long int N;
  string S; //. white, # black
  bool Flag = false;
  long long int res = 0;
  cin >> N >> S;

  for(long long int i=0; i<N; i++){
    if(!Flag){
      if(S[i] == '#') Flag = true;
    }else if(Flag){
      if(S[i] == '.') res++;
    }
  }

  cout<<res<<endl;
  return 0;
}

Compiler output:
a.cc:4:11: error: '::main' must return 'int'
    4 | long long int main(){
      |           ^~~
Language: C++

#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> Pll;
typedef pair<P,P> PP;
#define rep(i,a,n) for(int i = a;i < n;i++)
#define LINF (ll)1e17
#define INF 1e9
#define MOD 1e9+7
#define sMOD 1e5
#define fs first
#define sc second

ll gcd(ll a,ll b){
	if(!b) return a;
	return gcd(b,a%b);
}


signed main(){
	ll n,cnt = 0,cnt2 = 0;
	string s,t;
	cin >> n >> s;
	
	t = s;
	
	
	rep(i,0,s.size()-1){
		if(s[i] == '#' && s[i+1] == '.'){
			s[i+1] = '#';
			cnt++;
		}
	}
	
	rep(i,0,t.size()-1){
		if(t[t.size()-i-2] == '#' && t[t.size()-i-1] == '.'){
			t[t.size()-i-2] = '.';
			cnt2++;
		}
	}
	
	s.size() - s.size() + 2 - 2
	
	cout << min(cnt,cnt2) << endl;
	return 0;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:43:36: error: expected ';' before 'cout'
   43 |         s.size() - s.size() + 2 - 2
      |                                    ^
      |                                    ;
   44 | 
   45 |         cout << min(cnt,cnt2) << endl;
      |         ~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main() {
  int N, bit=0, bittest=0, bitxor, ans=200000; cin >> N;
  char c;
  for (int i=0; i<N; i++) {
    cin >> c;
    if (c=='#') bit |= 1<<(N-1-i);
  }
  for (int i=0; i<N; i++) {
    bittest |= 1<<i;
    bitxor = bit^bittest;
    ans = min(ans,__builtin_popcount(bitxor));
  }

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

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

int main() {
  int N;
  std::cin >> N;
  std::string str;
  std::cin >> str;
  
  std::vector<int> counts(N+1, 0);
  for (int i=0; i<N; i++) {
    if (str[i] == '.') counts[0]++;
  }
  
  for (int i=0; i<N; i++) {
    if (str[i] == '#') {
      counts[i+1] = counts[i] + 1;
    } else {
      counts[i+1] = counts[i] - 1;
    }
  }
  
  std::cout << *std::min_element(std::begin(counts), std::end(counts)) << std::endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:22: error: 'min_element' is not a member of 'std'; did you mean 'tuple_element'?
   24 |   std::cout << *std::min_element(std::begin(counts), std::end(counts)) << std::endl;
      |                      ^~~~~~~~~~~
      |                      tuple_element
Language: C++

#include<bits/stdc++.h>
#define ll  long long
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define pb push_back
#define Max(x,y,z) max(x,max(y,z))
#define f first
#define s second
#define lbd lower_bound
#define sz(x)       (ll)x.size()
#define pi 3.1415926536
#define mod 1000000007
using namespace std;

void solve()
{
    ll n,m,k,x,y,res=0,l,a=0,b=0,c=0,d=0,cnt=0,sum=0,z;
    string s;
    cin>>n;
    cin>>s;
    bool yup=false;
    rep(i,0,n)
    {   if(s[i]=='#')
           yup=true;
        if(s[i]=='.' && yup==1)
            cnt++;
    }
    cout<<cnt;5
#.##.
}
int main()
{
    ll t;
    //cin>>t;
    t=1;
    while(t--)
        solve();
}


Compiler output:
a.cc:29:2: error: invalid preprocessing directive #.
   29 | #.##.
      |  ^
a.cc: In function 'void solve()':
a.cc:28:16: error: expected ';' before '}' token
   28 |     cout<<cnt;5
      |                ^
      |                ;
   29 | #.##.
   30 | }
      | ~