Language: C++

int main() {
	uint64_t n;
	string s;
	cin >> n;
	cin >> s;
	vector<pair<uint64_t,char > > count;
	vector<pair<uint64_t,uint64_t> > sumv;
	uint64_t i = 0;
	char prevc= s[0];
	for (auto c : s) {
		if (c == prevc) {
			++i;
		}
		else {
			count.emplace_back (i,prevc);
			i = 0; prevc = c;
		}
	}
	uint64_t b = 0, w = 0;
	for (auto & p : count) {
		if (p.second == '#') {
			b += p.first;
		}
		else {
			w += p.first;
		}
		sumv.emplace_back(b, w);
	}
	uint64_t bsum = 0, wsum = 0; vector< uint64_t >result;
	result.reserve(n+2);
	result.push_back(sumv.back().second);
	for (auto ite = sumv.begin(); ite != sumv.end(); ++ite) {
		result.push_back(ite->first + sumv.back().second -ite->second);
	}
	cout << *std::min_element(result.begin(), result.end())<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:2:9: error: 'uint64_t' was not declared in this scope
    2 |         uint64_t n;
      |         ^~~~~~~~
a.cc:1:1: note: 'uint64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
  +++ |+#include <cstdint>
    1 | int main() {
a.cc:3:9: error: 'string' was not declared in this scope
    3 |         string s;
      |         ^~~~~~
a.cc:4:9: error: 'cin' was not declared in this scope
    4 |         cin >> n;
      |         ^~~
a.cc:4:16: error: 'n' was not declared in this scope
    4 |         cin >> n;
      |                ^
a.cc:5:16: error: 's' was not declared in this scope
    5 |         cin >> s;
      |                ^
a.cc:6:9: error: 'vector' was not declared in this scope
    6 |         vector<pair<uint64_t,char > > count;
      |         ^~~~~~
a.cc:6:16: error: 'pair' was not declared in this scope
    6 |         vector<pair<uint64_t,char > > count;
      |                ^~~~
a.cc:6:30: error: expected primary-expression before 'char'
    6 |         vector<pair<uint64_t,char > > count;
      |                              ^~~~
a.cc:7:40: error: expected primary-expression before '>' token
    7 |         vector<pair<uint64_t,uint64_t> > sumv;
      |                                        ^
a.cc:7:42: error: 'sumv' was not declared in this scope
    7 |         vector<pair<uint64_t,uint64_t> > sumv;
      |                                          ^~~~
a.cc:8:17: error: expected ';' before 'i'
    8 |         uint64_t i = 0;
      |                 ^~
      |                 ;
a.cc:12:27: error: 'i' was not declared in this scope
   12 |                         ++i;
      |                           ^
a.cc:15:25: error: 'count' was not declared in this scope
   15 |                         count.emplace_back (i,prevc);
      |                         ^~~~~
a.cc:15:45: error: 'i' was not declared in this scope
   15 |                         count.emplace_back (i,prevc);
      |                                             ^
a.cc:19:17: error: expected ';' before 'b'
   19 |         uint64_t b = 0, w = 0;
      |                 ^~
      |                 ;
a.cc:20:25: error: 'count' was not declared in this scope
   20 |         for (auto & p : count) {
      |                         ^~~~~
a.cc:22:25: error: 'b' was not declared in this scope
   22 |                         b += p.first;
      |                         ^
a.cc:25:25: error: 'w' was not declared in this scope
   25 |                         w += p.first;
      |                         ^
a.cc:27:35: error: 'b' was not declared in this scope
   27 |                 sumv.emplace_back(b, w);
      |                                   ^
a.cc:27:38: error: 'w' was not declared in this scope
   27 |                 sumv.emplace_back(b, w);
      |                                      ^
a.cc:29:17: error: expected ';' before 'bsum'
   29 |         uint64_t bsum = 0, wsum = 0; vector< uint64_t >result;
      |                 ^~~~~
      |                 ;
a.cc:29:56: error: 'result' was not declared in this scope
   29 |         uint64_t bsum = 0, wsum = 0; vector< uint64_t >result;
      |                                                        ^~~~~~
a.cc:35:9: error: 'cout' was not declared in this scope
   35 |         cout << *std::min_element(result.begin(), result.end())<<endl;
      |         ^~~~
a.cc:35:23: error: 'min_element' is not a member of 'std'
   35 |         cout << *std::min_element(result.begin(), result.end())<<endl;
      |                       ^~~~~~~~~~~
a.cc:35:66: error: 'endl' was not declared in this scope
   35 |         cout << *std::min_element(result.begin(), result.end())<<endl;
      |                                                                  ^~~~