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

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

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

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

cout<<f<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:2: error: expected '}' at end of input
   31 | }
      |  ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
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 if{siro=siro+1}
     }
     
     if(kuro>=siro){
     S.at(i+1)='#';
     count=count+1;
     }
   }    
  } 
  if(kuro<siro){
     cout<<siro<<endl;
     }else if{
 cout<<count<<endl;
  }
}

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

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

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

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

cout<<f<<endl;
}


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

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

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

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

cout<<f<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:14: error: conflicting declaration 'std::vector<int> c'
    9 |   vector<int>c(a)
      |              ^
a.cc:5:9: note: previous declaration as 'int c'
    5 |   int a,c,e,f;
      |         ^
a.cc:15:8: error: invalid types 'int[int]' for array subscript
   15 |       c[0]=1;
      |        ^
a.cc:20:6: error: invalid types 'int[int]' for array subscript
   20 |     c[i]=c[i-1]+1;
      |      ^
a.cc:20:11: error: invalid types 'int[int]' for array subscript
   20 |     c[i]=c[i-1]+1;
      |           ^
a.cc:23:8: error: invalid types 'int[int]' for array subscript
   23 |       c[i]=c[i-1];
      |        ^
a.cc:23:13: error: invalid types 'int[int]' for array subscript
   23 |       c[i]=c[i-1];
      |             ^
a.cc:26:12: error: invalid types 'int[int]' for array subscript
   26 | f=min(f,2*c[i]+a-i-1+-c[a-1]);
      |            ^
a.cc:26:24: error: invalid types 'int[int]' for array subscript
   26 | f=min(f,2*c[i]+a-i-1+-c[a-1]);
      |                        ^
a.cc:30:2: error: expected '}' at end of input
   30 | }
      |  ^
a.cc:12:21: note: to match this '{'
   12 | for(int i=0;i<a;i++){
      |                     ^
a.cc:30:2: error: expected '}' at end of input
   30 | }
      |  ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C++

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

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

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

cout<<f<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:14: error: conflicting declaration 'std::vector<int> c'
    9 |   vector<int>c(a)
      |              ^
a.cc:5:9: note: previous declaration as 'int c'
    5 |   int a,c,e,f;
      |         ^
a.cc:15:8: error: invalid types 'int[int]' for array subscript
   15 |       c[0]=1
      |        ^
a.cc:20:6: error: invalid types 'int[int]' for array subscript
   20 |     c[i]=c[i-1]+1;
      |      ^
a.cc:20:11: error: invalid types 'int[int]' for array subscript
   20 |     c[i]=c[i-1]+1;
      |           ^
a.cc:23:8: error: invalid types 'int[int]' for array subscript
   23 |       c[i]=c[i-1];
      |        ^
a.cc:23:13: error: invalid types 'int[int]' for array subscript
   23 |       c[i]=c[i-1];
      |             ^
a.cc:26:12: error: invalid types 'int[int]' for array subscript
   26 | f=min(f,2*c[i]+a-i-1+-c[a-1]);
      |            ^
a.cc:26:24: error: invalid types 'int[int]' for array subscript
   26 | f=min(f,2*c[i]+a-i-1+-c[a-1]);
      |                        ^
a.cc:30:2: error: expected '}' at end of input
   30 | }
      |  ^
a.cc:12:21: note: to match this '{'
   12 | for(int i=0;i<a;i++){
      |                     ^
a.cc:30:2: error: expected '}' at end of input
   30 | }
      |  ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C++

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

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

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

cout<<f<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:14: error: conflicting declaration 'std::vector<int> c'
    9 |   vector<int>c(a)
      |              ^
a.cc:5:9: note: previous declaration as 'int c'
    5 |   int a,c,e,f;
      |         ^
a.cc:15:8: error: invalid types 'int[int]' for array subscript
   15 |       c[0]=1
      |        ^
a.cc:20:6: error: invalid types 'int[int]' for array subscript
   20 |     c[i]=c[i-1]+1;
      |      ^
a.cc:20:11: error: invalid types 'int[int]' for array subscript
   20 |     c[i]=c[i-1]+1;
      |           ^
a.cc:23:8: error: invalid types 'int[int]' for array subscript
   23 |       c[i]=c[i-1];
      |        ^
a.cc:23:13: error: invalid types 'int[int]' for array subscript
   23 |       c[i]=c[i-1];
      |             ^
a.cc:26:12: error: invalid types 'int[int]' for array subscript
   26 | f=min(f,2*c[i]+a-i-1+-c[a-1])
      |            ^
a.cc:26:24: error: invalid types 'int[int]' for array subscript
   26 | f=min(f,2*c[i]+a-i-1+-c[a-1])
      |                        ^
a.cc:30:2: error: expected '}' at end of input
   30 | }
      |  ^
a.cc:12:21: note: to match this '{'
   12 | for(int i=0;i<a;i++){
      |                     ^
a.cc:30:2: error: expected '}' at end of input
   30 | }
      |  ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C++

#include <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 if{siro=siro+1}
    }
     
     if(kuro>=siro){
     S.at(i+1)='#';
     count=count+1;
     }
   }    
  } 
  if(kuro<siro){
     cout<<siro<<endl;
     }else if{
 cout<<count<<endl;
  }
}

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

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

int main() {
    int N;
    string S;
    cin >> N >> S;
    int temp_1 = 0;
    int temp_2 = 1;
    for (int i = 0; i < N; i++){
        if (S[i] == '#' && S[i + 1] == '.') {
            for (int j = i + 1; j < N; j++) {
                if (S[j] == '.') {
                    temp_1++;
                }
            }
            break;
        }
    }
    for (int i = N - 1; 0 <= i; i--){
        if (S[i] == '.' && S[i - 1] == '#') {
            for (int j = i - 1; 0 <= j; j--) {
                if (S[j] == '#') {
                    temp_2++;
                }
            }
            break;
        }
    }
    cout << min(temp_1, temp_2) << endl;
    return 0;

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

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

int main() {
    int N;
    string S;
    cin >> N >> S;
    int temp_1 = 0;
    int temp_2 = 1;
    for (int i = 0; i < N; i++){
        if (S[i] == '#') {
            for (int j = i; j < N; j++) {
                if (S[j] == '.') {
                    temp_1++;
                }
            }
        }
        break;
    }
    for (int i = N - 1; -1 < i; i--){
        if (S[i] == '.') {
            for (int j = i; -1 < j; j--) {
                if (S[j] == '#') {
                    temp_1++;
                }
            }
        }
        break;
    }
    cout << min(temp_1, temp_2) << endl;
    return 0;

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

#include <bits/stdc++.h>

using namespace std;


int main()
{
    long N, c0 = 0, c1 = 0;
    long count1 = 0;
    long sum=0, min = LONG_MAX;
    string str;
 

    cin >> N >> str;

   for (int i = 0; i < N; i++) {
        if (str[i] == '.') {
            count1++;
        }
    }
    sum = count;
    for (int i = 0; i < N; i++) {
        if (str[i] == '#') {
            sum++;
        } else {
            sum--;
        }
        if (sum < min) {
            min = sum;
        }
    }

    cout << min;    
    return 0;   
};




Compiler output:
a.cc: In function 'int main()':
a.cc:21:11: error: cannot resolve overloaded function 'count' based on conversion to type 'long int'
   21 |     sum = count;
      |           ^~~~~
Language: C++

using namespace std;
 
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
 
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
 
	ll N, M, K;
	string S;
 
	cin >> N >> S;
 
	ll W = 0;
	ll B = 0;
 
	rep(i, N) {
		if (S[i] == '.')W++;
		if (S[i] == '#')B++;
	}
 
	ll min = W;
	B = 0;
 
	rep(i, N) {
		if (S[i] == '.')W--;
		if (S[i] == '#')B++;
		if (min > (W + B)) {
			min = (W + B);
		}
	}
 
 
	cout << min << endl;
 
 
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:9: error: 'cin' was not declared in this scope
    6 |         cin.tie(0);
      |         ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:7:9: error: 'ios' has not been declared
    7 |         ios::sync_with_stdio(false);
      |         ^~~
a.cc:9:9: error: 'll' was not declared in this scope
    9 |         ll N, M, K;
      |         ^~
a.cc:10:9: error: 'string' was not declared in this scope
   10 |         string S;
      |         ^~~~~~
a.cc:1:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
  +++ |+#include <string>
    1 | using namespace std;
a.cc:12:16: error: 'N' was not declared in this scope
   12 |         cin >> N >> S;
      |                ^
a.cc:12:21: error: 'S' was not declared in this scope
   12 |         cin >> N >> S;
      |                     ^
a.cc:14:11: error: expected ';' before 'W'
   14 |         ll W = 0;
      |           ^~
      |           ;
a.cc:15:11: error: expected ';' before 'B'
   15 |         ll B = 0;
      |           ^~
      |           ;
a.cc:17:13: error: 'i' was not declared in this scope
   17 |         rep(i, N) {
      |             ^
a.cc:17:9: error: 'rep' was not declared in this scope
   17 |         rep(i, N) {
      |         ^~~
a.cc:22:11: error: expected ';' before 'min'
   22 |         ll min = W;
      |           ^~~~
      |           ;
a.cc:23:9: error: 'B' was not declared in this scope
   23 |         B = 0;
      |         ^
a.cc:34:9: error: 'cout' was not declared in this scope
   34 |         cout << min << endl;
      |         ^~~~
a.cc:34:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:34:17: error: 'min' was not declared in this scope; did you mean 'main'?
   34 |         cout << min << endl;
      |                 ^~~
      |                 main
a.cc:34:24: error: 'endl' was not declared in this scope
   34 |         cout << min << endl;
      |                        ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | using namespace std;
Language: C++

#include <bits/stdc++.h>

using namespace std;


int main()
{
    long N, c0 = 0, c1 = 0;
    long count1;
    long sum=0, min = LONG_MAX;
    string str;
 

    cin >> N >> str;

   for (int i = 0; i < N; i++) {
        if (str[i] == '.') {
            count1++;
        }
    }
    sum = count;
    for (int i = 0; i < N; i++) {
        if (str[i] == '#') {
            sum++;
        } else {
            sum--;
        }
        if (sum < min) {
            min = sum;
        }
    }

    cout << min;    
    return 0;   
};




Compiler output:
a.cc: In function 'int main()':
a.cc:21:11: error: cannot resolve overloaded function 'count' based on conversion to type 'long int'
   21 |     sum = count;
      |           ^~~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;


int main()
{
    long N, c0 = 0, c1 = 0;
    long index;
    long sum=0, min = LONG_MAX;
    string str;
 

    cin >> N >> str;

   for (int i = 0; i < N; i++) {
        if (str[i] == '.') {
            count1++;
        }
    }
    sum = count;
    for (int i = 0; i < N; i++) {
        if (str[i] == '#') {
            sum++;
        } else {
            sum--;
        }
        if (sum < min) {
            min = sum;
        }
    }

    cout << min;    
    return 0;   
};




Compiler output:
a.cc: In function 'int main()':
a.cc:18:13: error: 'count1' was not declared in this scope
   18 |             count1++;
      |             ^~~~~~
a.cc:21:11: error: cannot resolve overloaded function 'count' based on conversion to type 'long int'
   21 |     sum = count;
      |           ^~~~~
Language: C++

#include <bits/stdc++.h>

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

using namespace std;


int main()
{
    long N, c0 = 0, c1 = 0;
    long index;
    long sum=0, min = LONG_MAX;
    string str;
 

    cin >> N >> str;

   for (int i = 0; i < N; i++) {
        if (str[i] == '.') {
            count1++;
        }
    }
    sum = count;
    for (int i = 0; i < N; i++) {
        if (str[i] == '#') {
            sum++;
        } else {
            sum--;
        }
        if (sum < min) {
            min = sum;
        }
    }

    cout << min;    
    return 0;   
};




Compiler output:
a.cc:3:20: error: stray '#' in program
    3 | using namespace std#include <bits/stdc++.h>
      |                    ^
a.cc:3:20: error: expected ';' before 'include'
    3 | using namespace std#include <bits/stdc++.h>
      |                    ^~~~~~~~
      |                    ;
a.cc:3:21: error: 'include' does not name a type
    3 | using namespace std#include <bits/stdc++.h>
      |                     ^~~~~~~
a.cc: In function 'int main()':
a.cc:20:13: error: 'count1' was not declared in this scope
   20 |             count1++;
      |             ^~~~~~
a.cc:23:11: error: cannot resolve overloaded function 'count' based on conversion to type 'long int'
   23 |     sum = count;
      |           ^~~~~
Language: C++

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

long long main(){

  long long N, A=0, B=0, C=0, E=0, ans, num;
  string S;
  cin >> N;
  cin >> S;
  long long D[N], F[N], T[N-1];

  for(long long i=0; i<N; i++){
    if(S[i]=='#'){
      C++;
      D[i]=C;
    }else{
      D[i]=C;
    }
  }


  for(long long i=(N-1); i>=0; --i){
    if(S[i]=='.'){
      E++;
      F[i]=E;
    }else{
      F[i]=E;
    }
  }


  for(long long i=0; i<N; i++){
    if(S[i]=='#') A++;
  }
  for(long long i=0; i<N; i++){
    if(S[i]=='.') B++;
  }

  for(long long i=0; i<N-1; i++){
    T[i] = D[i] + F[i+1];
  }


  sort(T, T+(N-1));

  num = T[0];

  ans = min(A, B);
  ans = min(ans, num);


  cout << ans << endl;

  return 0;
}


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

#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    int N;
    long count,b;
  	string S;
    bool flag = false;
    count = 0;
    cin >> N;
    cin >> S;
    
    for(long i=0;i<N;i++){
        if(flag){
            if (S[i] == '.'){
                count++;
            }
        else if (S[i] == '#') {
          b++;
        }
        else if (S[i] == '#' && S[i+1] == '.') {
            flag = true;
        }
    }
    if (count <= b) {
		cout << count << endl;
    } else {
      	cout << b << endl;
    }
}

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

#include<iostream>
using namespace std;
int main()
{
	int sum=0,n;
	cin>>n;
	string a,b;
	cin>>a;
	b=a;
	for(int i=1;i<=n-1;i++)
	{
		if(a[i]=='#')
		{
			if(a[i+1]=='.')
			{
				sum++;
				a[i+1]='#';
			}
		}
	}
	int sum1=0;
	for(int i=1;i<=n-1s;i++)
	{
		if(b[i]=='.')
		{
			if(b[i-1]=='#')
			{
				sum1++;
				b[i-1]='.';
			}
		}
	}
	cout<<min(sum,sum1);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:26: error: unable to find numeric literal operator 'operator""s'
   22 |         for(int i=1;i<=n-1s;i++)
      |                          ^~
Language: C++

#include<iostream>
using namespace std;
int main()
{
	int sum=0,n;
	cin>>n;
	string a,b;
	cin>>a;
	b=a;
	for(int i=1;i<=n-1;i++)
	{
		if(a[i]=='#')
		{
			if(a[i+1]=='.')
			{
				sum++;
				a[i+1]='#';
			}
		}
	}
	int sum1=0;
	for(int i=1;i<=n-1s;i++)
	{
		if(b[i]=='.')
		{
			if(b[i-1]=='#')
			{
				sum1++;
				b[i-1]='.';
			}
		}
	}
	cout<<min(sum,sum1);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:26: error: unable to find numeric literal operator 'operator""s'
   22 |         for(int i=1;i<=n-1s;i++)
      |                          ^~
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 sum_bw[N+1];
    sum_bw[0] = white;
    
    for (int i = 0; i < N; i++){
        if (S[i] == '.') sum_bw[i+1] = sum_bw[i] - 1;
        else sum_bw[i+1] = sum_bw[i] + 1;
    }
    
    sort(sum_bw, sum_bw+N+1);
 
   cout << sum_bw[0] << endl;
 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:5: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
   24 |     sort(sum_bw, sum_bw+N+1);
      |     ^~~~
      |     sqrt
Language: C

n=int(input())
s=input()
r=S.count(".")
a=r
for i in range(n):
  if s[i]=="#":r+=1
  else:r-=1
  a=min(a,r)
print(a)


Compiler output:
main.c:1:1: warning: data definition has no type or storage class
    1 | n=int(input())
      | ^
main.c:1:1: error: type defaults to 'int' in declaration of 'n' [-Wimplicit-int]
main.c:1:3: error: expected expression before 'int'
    1 | n=int(input())
      |   ^~~
Language: C++

#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    int N;
    long count,b;
  	string S;
    bool flag = false;
    count = 0;
    cin >> N;
    cin >> S;
    
    for(long i=0;i<N;i++){
        if(flag){
            if (S[i] == '.'){
                count++;
            }
        else if (S[i] == '#') {
          b++;
        }
        else if (S[i] == '#' && S[i+1] == '.') {
            flag = true;
        }
    }
    if (coount <= b) {
		cout << count << endl;
    } else {
      	cout << b << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:9: error: 'coount' was not declared in this scope; did you mean 'count'?
   26 |     if (coount <= b) {
      |         ^~~~~~
      |         count
a.cc:31:2: error: expected '}' at end of input
   31 | }
      |  ^
a.cc:4:15: note: to match this '{'
    4 | int main(void){
      |               ^
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <string>
#include <utility>
#include <map>
#include <queue>
#include <list>
#include <functional>
#include <numeric>
#include <stack>
#include <tuple>

using namespace std;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }


int dx[4] = { -1,0,1,0 };
int dy[4] = { 0,1,0,-1 };
const int INF = 100000000;
const long long LINF = 1LL << 60;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-6;
using pii = std::pair<int, int>;
using pLL = std::pair<long long, long long>;
using ll = long long;
#define SORT(v) std::sort(v.begin(), v.end())
#define rSORT(v) std::sort(v.begin(), v.end(),std::greater<int>())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    string s;
    cin >> n;
    cin >> s;
    int ans = 0;
    int count1 = 0, count2 = 0;
    for (int i = 0; i < n; ++i) {
        if (s[i] == '#') count1++;
        else count2++;
    }
    int ans = min(count1, count2);
    int w = 0, b = 0;
    for (int i = 0; i < n-1; ++i) {
        if (s[i] == '#') b++;
        else w++;

        ans = min(ans, b + count1 - w);
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:49:9: error: redeclaration of 'int ans'
   49 |     int ans = min(count1, count2);
      |         ^~~
a.cc:43:9: note: 'int ans' previously declared here
   43 |     int ans = 0;
      |         ^~~
Language: C++

#include<bits/stdc++.h>
#include<queue>
#define RREP(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define REP(i,a) for(int (i)=0; (i)<(a); (i)++)
typedef long long ll;
using namespace std;


int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int N;
  string S;
  cin>>N>>S;
  int blacknumber=0,whitenumber=0;
  REP(i,N){
    if(S[i]=='#'){blacknumber++;}
    else{whitenumber++;}
  }
  int ans=0;
  int answer;
  if(S[0]=='.'){
    answer=whitenumber-1;
  }else{
    answer=whitenumber+1;
  }
  ans=answer;
  RREP(i,1,N){ //i,i-1が境目
    if(S[i]=='#'){answer++1;}
    else{answer=answer--1;}
    if(ans>answer){ans=answer;}
  }
  cout<<ans;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:27: error: expected ';' before numeric constant
   29 |     if(S[i]=='#'){answer++1;}
      |                           ^
      |                           ;
a.cc:30:25: error: expected ';' before numeric constant
   30 |     else{answer=answer--1;}
      |                         ^
      |                         ;
Language: C++

#include<bits/stdc++.h>
#include<queue>
#define RREP(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define REP(i,a) for(int (i)=0; (i)<(a); (i)++)
typedef long long ll;
using namespace std;


int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int N;
  string S;
  cin>>N>>S;
  int blacknumber=0,whitenumber=0;
  REP(i,N){
    if(S[i]=='#'){blacknumber++;}
    else{whitenumber++;}
  }
  int ans=0;
  int answer;
  if(S[0]=='.'){
    answer=whitenumber-1;
  }else{
    answer=whitenumber+1;
  }
  ans=answer;
  RREP(i,1,N){ //i,i-1が境目
    if(S[i]=='#'){answer++1;}
    else{answer[i]=answer--1;}
    if(ans>answer){ans=answer;}
  }
  cout<<ans;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:27: error: expected ';' before numeric constant
   29 |     if(S[i]=='#'){answer++1;}
      |                           ^
      |                           ;
a.cc:30:16: error: invalid types 'int[int]' for array subscript
   30 |     else{answer[i]=answer--1;}
      |                ^
Language: C++

#include "bits/stdc++.h"

using namespace std;

using ll = long long;
using ld = long double;

const double PI = 3.1415926535897932384626433832795;

const int dx[] = { 0, 1, 0, -1 };
const int dy[] = { -1, 0, 1, 0 };

int gcd(int x, int y) { return y ? gcd(y, x % y) : abs(x); }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : abs(x); }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

int n;
string s;

int solve() {
	int left = n - 1;
	for (int i = 0; i < n; i++) {
		if (s[i] == '#') {
			left = i;
			break;
		}
	}

	int ans = 0;
	for (int i = left; i < n; i++) {
		if (s[i] == '#') {
			continue;
		}

		ans++;
	}

	return ans;
}

int solve2() {
	int ans = 0;
	for (auto c : s) {
		if (c == '#') {
			ans++;
		}
	}

	return ans;
}

int solve3() {
	int ans = 0;
	for (auto c : s) {
		if (c == '.') {
			ans++;
		}
	}

	return ans;
}

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

	// #.
	// ↓
	// .#

	cin >> n >> s;

	
	int ans = min(solve(), solve2(), solve3());
	cout << ans << endl;
	return 0;
}


Compiler output:
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: In instantiation of 'constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
a.cc:75:15:   required from here
   75 |         int ans = min(solve(), solve2(), solve3());
      |                   ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:284:17: error: '__comp' cannot be used as a function
  284 |       if (__comp(__b, __a))
      |           ~~~~~~^~~~~~~~~~
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 black=0;
		int white=0;

		int l=0;
		int f=0;

		for(int i=0;i<N;i++) {
			if(S.charAt(i)=='.') continue;
			else{
				f=i;
				break;
			}
		}

		for(int i=N-1;i>=0;i--) {
			if(S.charAt(i)=='#') continue;
			else {
				l=i;
				break;
			}
		}


		for(int i=f;i<Math.min(N, l);i++) {
			if(S.charAt(i)=='.') white++;
			else black++;
		}

		if(white>black) System.out.println(black);
		else System.out.println(white);

		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(){
  long long n;
  string s;
  cint >> n >> s;
  long long w=0;
  long long bl;
  long long wr;
  
  for(long i=0; i<n; i++){
    if(s.at(i) == '.'){
      w++;
    }
  }
  
  bl=0;
  wr=w;
  long long res = bl+wr;
  
  for(long i=0; i<n; i++){
    if(s.at(i) == '.'){
      wr--;
    }else{
      bl++;
    }
    
    res = min(res,wr+bl);
  }
  cout << res << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: 'cint' was not declared in this scope; did you mean 'uint'?
    7 |   cint >> n >> s;
      |   ^~~~
      |   uint
Language: C++

#include <iostream>
#include <string>


int main(int argc, const char *argv[])
{
    int N;
    std::string S;
    std::cin >> N >> S;

    int count1 = 0;
    int i = S.find_first_of('#');
    if (i == std::string::npos) {
        std::cout << 0 << std::endl;
        return 0;
    }
    while (i < N) {
        count1 += (S[i] == '.');
        ++i;
    }

    int count2 = std::count(S.begin(), S.end(), '#');

    std::cout << std::min(count1, count2) << std::endl;
}

Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:22:23: error: 'count' is not a member of 'std'; did you mean 'cout'?
   22 |     int count2 = std::count(S.begin(), S.end(), '#');
      |                       ^~~~~
      |                       cout
Language: C++

N = int(input())
S = input()
dif = 0
ans_i = 0
mem = -1
for i, char in enumerate(S):
    if char == '.':
        dif += 1
    else:
        dif -= 1
    if abs(dif) > mem:
        mem = abs(dif)
        ans_i = i
print(S[:ans_i+1].count('#') + S[ans_i+1:].count('.'))


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

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

int main(){
  int n;
  string s;
  cin >> n;
  cin >> s;
  int zc[n]={0},fc[n]={0},tot[n]={0};
  int zi=0,fi=0;
  bool fl = false;
  for (int i=0; i < n; i++){
    if (s[i]=='#'){
      zi += 1;
      zn[i] = zi;
    }else{
      zn[i] = zi;
    }
  for (int i = n-1; i >= 0; i--){
    if (s[i]=='.'){
      fi += 1;
      fn[i] = fi;
    }else{
      fn[i] = fi;
    }
  }
  tot = fn + zn;
  
  cout << *min_element(tot.begin(),tot.end());
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:7: error: 'zn' was not declared in this scope; did you mean 'zi'?
   17 |       zn[i] = zi;
      |       ^~
      |       zi
a.cc:19:7: error: 'zn' was not declared in this scope; did you mean 'zi'?
   19 |       zn[i] = zi;
      |       ^~
      |       zi
a.cc:24:7: error: 'fn' was not declared in this scope; did you mean 'fl'?
   24 |       fn[i] = fi;
      |       ^~
      |       fl
a.cc:26:7: error: 'fn' was not declared in this scope; did you mean 'fl'?
   26 |       fn[i] = fi;
      |       ^~
      |       fl
a.cc:29:9: error: 'fn' was not declared in this scope; did you mean 'fl'?
   29 |   tot = fn + zn;
      |         ^~
      |         fl
a.cc:29:14: error: 'zn' was not declared in this scope; did you mean 'zi'?
   29 |   tot = fn + zn;
      |              ^~
      |              zi
a.cc:31:28: error: request for member 'begin' in 'tot', which is of non-class type 'int [n]'
   31 |   cout << *min_element(tot.begin(),tot.end());
      |                            ^~~~~
a.cc:31:40: error: request for member 'end' in 'tot', which is of non-class type 'int [n]'
   31 |   cout << *min_element(tot.begin(),tot.end());
      |                                        ^~~
a.cc:32:2: error: expected '}' at end of input
   32 | }
      |  ^
a.cc:6:11: note: to match this '{'
    6 | int main(){
      |           ^
Language: C

#include <stdio.h>
#include <math.h>
int main(void){
    int N;
    scanf("%d",&N);
    char S[N];
    scanf("%s",S);
    int count = 0;
    for(i = 0; i < N; i++){
      if(S[i] == '#'){
        count++;
        break;
      }
    }
    if(count > N/2){
      count = N -count;
    }

    int flag = -1;
    int i = 0;
    for(i = 0; i < N; i++){
      if(S[i] == '#'){
        flag++;
        break;
      }
    }
    for(; i < N; i++){
      if(S[i] == '.'){
        flag++;
      }
    }
    if(flag == -1){
      flag = 0;
    }
    if(flag > count){
      flag = count;
    }
    printf("%d",flag);

    return 0;
}


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

#include<iostream>
#include<stdio.h>
#include<string>
#include<string.h>
using namespace std;

int main() {
	int N;
	cin >> N;
	char a[N];
	cin >> a;
	char b[N]
    strcpy(a, b);
	int cnt = 0;
	int cnta = 0;
	for (int i = N-1; i > 0; i--) {
		if (b[i] == '.') {
			if (b[i-1] == '#' ) {
				b[i - 1] == '.'
					cnta += 1;
			}
			
		}
	}
	for (int i = 0; i < N-1; i++) {
		if (a[i] == '#') {
			if (a[i+1] == '.') {
				a[i+1] = '#';
				cnt += 1;
			}
		}
	}
	if (cnt <= cnta) {
		cout << cnt << endl;
	}
	else
	{
		cout << cnta << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:5: error: expected initializer before 'strcpy'
   13 |     strcpy(a, b);
      |     ^~~~~~
a.cc:17:21: error: 'b' was not declared in this scope
   17 |                 if (b[i] == '.') {
      |                     ^
Language: C

#include<stdio.h>
int main(){
    int n,i,j,q,r;
    scanf("%d%s",&n,s);
    r=n;
    char s[n+1]; 
    for(i=0;i<=n;i++){
        q=0;
        for(j=0;j<n;j++){
            if(j<i&&s[j]=='#')q++;
            if(j>=i&&s[j]=='.')q++;
        }
        if(q<r)r=q;
    }
    printf("%d",r);
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:4:21: error: 's' undeclared (first use in this function)
    4 |     scanf("%d%s",&n,s);
      |                     ^
main.c:4:21: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

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

int main() {
    int N; cin >> N;
    string S1; cin >> S1;
    string S2(S1.c_str(), S1.length());

    int ret1 = 0;
    for(int i = 0; i < N-1; i++) {
        if(S1[i] == '#' && S1[i+1] == '.') {
            S1[i+1] = '#';
            ret1++;
        }
    }
    int ret2 = 0;
    for(int i = N-1; i > 0; i--) {
        if(S2[i] == '.' && S2[i-1] == '#') {
            S2[i-1] = '.';
            ret2++;
        }
    }
    if(S2[0] == '.' && S[1] == '#' ret2++;
//    cout << ret1 << endl;
//    cout << ret2 << endl;
    cout << min(ret1, ret2) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:24: error: 'S' was not declared in this scope; did you mean 'S2'?
   25 |     if(S2[0] == '.' && S[1] == '#' ret2++;
      |                        ^
      |                        S2
a.cc:28:36: error: expected ')' before ';' token
   28 |     cout << min(ret1, ret2) << endl;
      |                                    ^
      |                                    )
a.cc:25:7: note: to match this '('
   25 |     if(S2[0] == '.' && S[1] == '#' ret2++;
      |       ^
Language: C++

#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>
#include <math.h>
#include <bitset>

#define X first
#define Y second
#define vsort(v) sort(v.begin(), v.end())
#define vrev(v) reverse(v.begin(), v.end())
#define vmax_p(v) max_element(v.begin(), v.end())
#define vmin_p(v) min_element(v.begin(), v.end())
#define vmax_idx(v) distance(v.begin(), vmax_p(v))
#define vmin_idx(v) distance(v.begin(), vmin_p(v))
#define vcopy(src, dst) copy(src.begin(), src.end(), back_inserter(dst))
#define P pair

// stoi(s): string to int
// stod(s): string to double

// INT_MAX
// INT_MIN
// LLONG_MAX
// LLONG_MIN
// DBL_MIN
// DBL_MAX
// LDBL_MIN
// LDBL_MAX

// A-Z: 65~90
// a-z: 97~122
// |a-z| = 26

// 2進数変換
// string s = bitset<20>(x).to_string();

using namespace std;
using ll = long long;

void display_vec(vector<int> v)
{
    for (int i = 0; i < v.size(); i++)
    {
        cout << v[i] << endl;
    }
    cout << endl;
}

int main(int argc, const char *argv[])
{
    int n;
    string s;
    cin >> n >> s;

    if (s.find('.') == -1 || s.find('#') == -1)
    {
        cout << 0 << endl;
        return 0;
    }

    int a[n];

    if (s[0] == '.')
    {
        a[0] = 1;
    }
    else
    {
        a[0] = 0;
    }

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

    int min = 1000000, cnt;
    for (int i = 0; i < n; i++)
    {
        cnt = a[n - 1] - a[i] + (i + 1 - a[i]);
        if (cnt < min)
        {
          
            min = cnt;
          if(i == n-1){
            min--;
        }
    }
 
    cout << min << endl;
}


Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:104:2: error: expected '}' at end of input
  104 | }
      |  ^
a.cc:56:1: note: to match this '{'
   56 | {
      | ^
Language: C++

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

int main() {
    int N;
    string S;
    cin >> N >> S;
    string S_1, S_2;
    S_1 = S;
    S_2 = S;
    int temp_1 = 10000000;
    int temp_2 = 10000000;
    for (int i = 0; i < N; i++) {
        if ((S_1[i] == '#' && S_1[i + 1] == '.') && i != N - 1)  {
            S_1[i + 1] = '#';
            temp_2++;
        }

        else{

        }
    }
    for (int i = 0; i < N; i++) {
        if ((S_2[i] == '.' && S_2[i + 1] == '#') && i != N - 1)  {
            S_2[i + 1] = '.';
            temp_2++;
        }

        else{

        }
    }
    if (temp_1 == 0 || temp_2 == 0){
        cout << max(temp_1, temp_2) << endl;
    }
    else if(temp_1 == 0 && temp_2 == 0){
        cout << temp_1;
    }
    else{
        cout << min(tenp_1,temp_2);
    }
        return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:21: error: 'tenp_1' was not declared in this scope; did you mean 'temp_1'?
   40 |         cout << min(tenp_1,temp_2);
      |                     ^~~~~~
      |                     temp_1
Language: C++

#include <iostream>
using namespace std;
int main(void){
    int n,ans=0,ans2=0;
    char s[200100];
   cin >> n >>s;
for(int i=n-1; s[i]=='.';i--)ans2++;
   for(int i=n-1;i>=0;i--){
       if(s[i]=='#'){
           ans++';
       }
   }
   
   cout <<max(min(n-ans2, n-ans),0); 
}


Compiler output:
a.cc:10:17: warning: missing terminating ' character
   10 |            ans++';
      |                 ^
a.cc:10:17: error: missing terminating ' character
   10 |            ans++';
      |                 ^~
a.cc: In function 'int main()':
a.cc:10:17: error: expected ';' before '}' token
   10 |            ans++';
      |                 ^
      |                 ;
   11 |        }
      |        ~
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define is(a, b) a == b
#define len(v) ll(v.size())

const ll mod=1e9+7;

//vector書き出し
template <class T>
void cout_vec(const vector<T> &vec1){
  rep(i,len(vec1)){
    cout<<vec1[i]<<' ';
  }
  cout<<'\n';
}

typedef pair<ll,ll> P;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    string s;
    cin>>n>>s;
    ll ans=0;
    ll cnt1=0;
    ll cnt2=0;
    vector<P> cnt;
    rep(i,n-1){
      if(i<=n-2 && s[i]=='#' && s[i+1]=='.'){
        ll j=i,k=i;
        cnt1++;
        cnt2++;
        while(j-1>=0 && s[j-1]=='#'){
          cnt1++;
          j--;
        }
        while(k+2<=n-1 && s[k+2]=='.'){
          cnt2++;
          k++;
        }
        //cout<<i<<' '<<cnt1<<' '<<cnt2<<'\n';
        cnt.push_back({cnt1,cnt2});
        //ans+=min(cnt1,cnt2);
        i+=min(cnt1,cnt2);
        cnt1=0,cnt2=0;
        /*
        if(cnt1>cnt2 && i+1<=n-1 && s[i+1]=='#'){
          cnt1=cnt2+cnt1;
        }else{
          cnt1=0;
        }
        cnt2=0;
        */
      }
      //cout<<i<<'\n';
    }
    rep(i,len(cnt)){
      //cout<<cnt[i].first<<' '<<cnt[i].second<<'\n';
      if(cnt[i].first<=cnt[i].second){
        ans+=cnt[i].first;
      }else{
        if(i!=len(cnt)-1){
          if(cnt[i].first<cnt[i+1].second && cnt[i].first+cnt[i+1].first>=cnt[i+1].second){
            ans+=cnt[i].first;
          }else{
            ans+=cnt[i].second;
          }
        }else{
        ans+=cnt[i].second;
      }
    }
    cout<<ans<<endl;
}


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

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define is(a, b) a == b
#define len(v) ll(v.size())

const ll mod=1e9+7;

//vector書き出し
template <class T>
void cout_vec(const vector<T> &vec1){
  rep(i,len(vec1)){
    cout<<vec1[i]<<' ';
  }
  cout<<'\n';
}

typedef pair<ll,ll> P;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    string s;
    cin>>n>>s;
    ll ans=0;
    ll cnt1=0;
    ll cnt2=0;
    vector<P> cnt;
    rep(i,n-1){
      if(i<=n-2 && s[i]=='#' && s[i+1]=='.'){
        ll j=i,k=i;
        cnt1++;
        cnt2++;
        while(j-1>=0 && s[j-1]=='#'){
          cnt1++;
          j--;
        }
        while(k+2<=n-1 && s[k+2]=='.'){
          cnt2++;
          k++;
        }
        //cout<<i<<' '<<cnt1<<' '<<cnt2<<'\n';
        cnt.push_back({cnt1,cnt2});
        //ans+=min(cnt1,cnt2);
        i+=min(cnt1,cnt2);
        cnt1=0,cnt2=0;
        /*
        if(cnt1>cnt2 && i+1<=n-1 && s[i+1]=='#'){
          cnt1=cnt2+cnt1;
        }else{
          cnt1=0;
        }
        cnt2=0;
        */
      }
      //cout<<i<<'\n';
    }
    rep(i,len(cnt)){
      //cout<<cnt[i].first<<' '<<cnt[i].second<<'\n';
      if(cnt[i].first<=cnt[i].second){
        ans+=cnt[i].first;
      }else{
        if(i!=len(cnt)-1){
          if(cnt[i].first<cnt[i+1].second && cnt[i].first+cnt[i+1].first>=cnt[i+1].second){
            ans+=cnt[i].first;
          }else{
            ans+=cnt[i].second;
          }
        }
        }else{
        ans+=cnt[i].second;
      }
    }
    cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:74:10: error: 'else' without a previous 'if'
   74 |         }else{
      |          ^~~~
Language: C++

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

int main() {
	long long N;
	int cnt = 0,i = 0;
	char shape = '#',dot = '.';
	string S,tasi;
	cin >> N >> S;
	tasi[0] = S[0];
	for (i = 0; i < N; i++)
	{
		if( i > 0 ){
		if ( tasi[i-1] == shape && S[i] == dot ){
			cnt++;
			tasi[i] =　shape;
		}else{
			tasi[i] = S[i];
		}
	}
	}
		cout << cnt << endl;
		return 0;
	}


Compiler output:
a.cc:19:34: error: extended character 　 is not valid in an identifier
   19 |                         tasi[i] =　shape;
      |                                  ^
a.cc: In function 'int main()':
a.cc:19:34: error: '\U00003000shape' was not declared in this scope; did you mean 'shape'?
   19 |                         tasi[i] =　shape;
      |                                  ^~~~~~~
      |                                  shape
Language: C

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main(){
    int min(int a, int b);
    int n,i;
    int dot_r = -1,sharp_r = -1;
    int dot_n_r=0,sharp_n_r=0;
    int dot_n_l=0,sharp_n_l=0;
    int ans_r;
    char *s;

    scanf("%d", &n);
    s = malloc(sizeof(char)*(n+1));
    scanf("%s", s);

    for(i=n-1;i>=0;i--){
        if(s[i] == '#'){
            sharp_r = i;
            break;
        }else{
            dot_n_r++;
        }
    }
    if(sharp_r == -1){  //全部白
        printf("0\n");
        return 0;
    }

    for(i=sharp_r;i>=0;i--){
        if(s[i] == '.'){
            dot_r = i;
            break;
        }else{
            sharp_n_r++;
        }
    }

    }
    //右側処理ここまで
    for(i=0;i<=dot_r;i++){
        if(s[i] == '.'){
            dot_n_l++;
        }else if(s[i] == '#'){
            sharp_n_l++;
        }
    }
    printf("%d\n",min(dot_n_l, sharp_n_l)+min(dot_n_r, sharp_n_r));


    return 0;

}

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

Compiler output:
main.c:41:5: error: expected identifier or '(' before 'for'
   41 |     for(i=0;i<=dot_r;i++){
      |     ^~~
main.c:41:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<=' token
   41 |     for(i=0;i<=dot_r;i++){
      |              ^~
main.c:41:23: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
   41 |     for(i=0;i<=dot_r;i++){
      |                       ^~
main.c:48:12: error: expected declaration specifiers or '...' before string constant
   48 |     printf("%d\n",min(dot_n_l, sharp_n_l)+min(dot_n_r, sharp_n_r));
      |            ^~~~~~
main.c:48:19: error: unknown type name 'min'
   48 |     printf("%d\n",min(dot_n_l, sharp_n_l)+min(dot_n_r, sharp_n_r));
      |                   ^~~
main.c:51:5: error: expected identifier or '(' before 'return'
   51 |     return 0;
      |     ^~~~~~
main.c:53:1: error: expected identifier or '(' before '}' token
   53 | }
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define is(a, b) a == b
#define len(v) ll(v.size())

const ll mod=1e9+7;

//vector書き出し
template <class T>
void cout_vec(const vector<T> &vec1){
  rep(i,len(vec1)){
    cout<<vec1[i]<<' ';
  }
  cout<<'\n';
}

typedef pair<ll,ll> P;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    string s;
    cin>>n>>s;
    ll ans=0;
    ll cnt1=0;
    ll cnt2=0;
    vector<P> cnt;
    rep(i,n-1){
      if(i<=n-2 && s[i]=='#' && s[i+1]=='.'){
        ll j=i,k=i;
        cnt1++;
        cnt2++;
        while(j-1>=0 && s[j-1]=='#'){
          cnt1++;
          j--;
        }
        while(k+2<=n-1 && s[k+2]=='.'){
          cnt2++;
          k++;
        }
        //cout<<i<<' '<<cnt1<<' '<<cnt2<<'\n';
        cnt.push_back({cnt1,cnt2});
        //ans+=min(cnt1,cnt2);
        i+=min(cnt1,cnt2);
        cnt1=0,cnt2=0;
        /*
        if(cnt1>cnt2 && i+1<=n-1 && s[i+1]=='#'){
          cnt1=cnt2+cnt1;
        }else{
          cnt1=0;
        }
        cnt2=0;
        */
      }
      //cout<<i<<'\n';
    }
    rep(i,len(cnt)){
      //cout<<cnt[i].first<<' '<<cnt[i].second<<'\n';
      if(cnt[i].first<=cnt[i].second){
        ans+=cnt[i].first;
      }else{
        if(i!=len(cnt)-1){
          if(cnt[i].first<cnt[i+1].second && cnt[i].first+cnt[i+1].first>=cnt[i+1].second){
            ans+=cnt[i].first;
          }else{
            ans+=cnt[i].second;
          }
        }
      }else{
        ans+=cnt[i].second;
      }
    }
    cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:74:8: error: 'else' without a previous 'if'
   74 |       }else{
      |        ^~~~
Language: C++

#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <string>

// url: https://atcoder.jp/contests/tenka1-2019-beginner/tasks/tenka1_2019_c
using namespace std;
typedef tuple<int, int, int, int> P;

int N;
string S;
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define all(x) (x).begin(), (x).end()
#define fill(x, y) memset(x, y, sizeof(x))
int main() {
  cin >> N >> S;

  int dot = 0, sharp = 0;
  int ans = 0;

  int j = 0;
  priority_queue<P> que;
  bool done[10000];
  fill(done, 0);

  rep(i, N) {
    if (S[i] == '#') {
      if (dot != 0) {
        que.push(P(min(sharp, dot), sharp, dot, j));
        dot = 0;
        sharp = 0;
        j++;
      }
      sharp++;
    }
    if (S[i] == '.') {
      dot++;
    }
  }
  que.push(P(min(sharp, dot), sharp, dot, j));

  while (!que.empty()) {
    P p = que.top();
    que.pop();

    // cout << get<0>(p) << " " << get<1>(p) << " " << get<2>(p) << endl;
    if (done[get<3>(p)]) {
      ans += get<2>(p);
    } else {
      ans += get<0>(p);
    }
  }

  cout << ans << endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:20: error: 'memset' was not declared in this scope
   15 | #define fill(x, y) memset(x, y, sizeof(x))
      |                    ^~~~~~
a.cc:25:3: note: in expansion of macro 'fill'
   25 |   fill(done, 0);
      |   ^~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include <queue>
  +++ |+#include <cstring>
    5 | #include <string>