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(tot);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:13: error: array must be initialized with a brace-enclosed initializer
   11 |   int zc[n]=0,fc[n]=0,tot[n]=0;
      |             ^
a.cc:11:21: error: array must be initialized with a brace-enclosed initializer
   11 |   int zc[n]=0,fc[n]=0,tot[n]=0;
      |                     ^
a.cc:11:30: error: array must be initialized with a brace-enclosed initializer
   11 |   int zc[n]=0,fc[n]=0,tot[n]=0;
      |                              ^
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:14: error: no matching function for call to 'min(int [n])'
   31 |   cout << min(tot);
      |           ~~~^~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   template argument deduction/substitution failed:
a.cc:31:14: note:   mismatched types 'std::initializer_list<_Tp>' and 'int*'
   31 |   cout << min(tot);
      |           ~~~^~~~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   candidate expects 2 arguments, 1 provided
a.cc:32:2: error: expected '}' at end of input
   32 | }
      |  ^
a.cc:6:11: note: to match this '{'
    6 | int main(){
      |           ^