Language: C++

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TenkaPBC2019C2
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());//石の数Ｎ個
            string S = Console.ReadLine();//文字列　．白　＃黒
            List<int> ans_List = new List<int>();
            int counter0 = 0;
            int counter1 = S.Replace("#", "").Length;//.の数を数えてみる
            if ((counter1 == 0) || (counter1 == N))//.がひとつもない、または全部.なら何もしなくてよい。
            {
                Console.WriteLine(0);
            }
            else
            {
                for (int i = 0; i < N; i++)
                {
                    if (S.Substring(i, 1) == "#")
                    {
                        counter0++;
                    }
                    else
                    {
                        counter1--;
                    }
                    ans_List.Add(counter0 + counter1);
                }
                Console.WriteLine(ans_List.Min());
            }
        }
    }
}


Compiler output:
a.cc:1:7: error: expected nested-name-specifier before 'System'
    1 | using System;
      |       ^~~~~~
a.cc:2:7: error: expected nested-name-specifier before 'System'
    2 | using System.Collections.Generic;
      |       ^~~~~~
a.cc:3:7: error: expected nested-name-specifier before 'System'
    3 | using System.Linq;
      |       ^~~~~~
a.cc:4:7: error: expected nested-name-specifier before 'System'
    4 | using System.Text;
      |       ^~~~~~
a.cc:5:7: error: expected nested-name-specifier before 'System'
    5 | using System.Threading.Tasks;
      |       ^~~~~~
a.cc:11:26: error: 'string' has not been declared
   11 |         static void Main(string[] args)
      |                          ^~~~~~
a.cc:11:35: error: expected ',' or '...' before 'args'
   11 |         static void Main(string[] args)
      |                                   ^~~~
a.cc:39:6: error: expected ';' after class definition
   39 |     }
      |      ^
      |      ;
a.cc: In static member function 'static void TenkaPBC2019C2::Program::Main(int*)':
a.cc:13:21: error: expected primary-expression before 'int'
   13 |             int N = int.Parse(Console.ReadLine());//石の数Ｎ個
      |                     ^~~
a.cc:14:13: error: 'string' was not declared in this scope
   14 |             string S = Console.ReadLine();//文字列　．白　＃黒
      |             ^~~~~~
a.cc:15:13: error: 'List' was not declared in this scope
   15 |             List<int> ans_List = new List<int>();
      |             ^~~~
a.cc:15:18: error: expected primary-expression before 'int'
   15 |             List<int> ans_List = new List<int>();
      |                  ^~~
a.cc:17:28: error: 'S' was not declared in this scope
   17 |             int counter1 = S.Replace("#", "").Length;//.の数を数えてみる
      |                            ^
a.cc:20:17: error: 'Console' was not declared in this scope
   20 |                 Console.WriteLine(0);
      |                 ^~~~~~~
a.cc:34:21: error: 'ans_List' was not declared in this scope
   34 |                     ans_List.Add(counter0 + counter1);
      |                     ^~~~~~~~
a.cc:36:17: error: 'Console' was not declared in this scope
   36 |                 Console.WriteLine(ans_List.Min());
      |                 ^~~~~~~
a.cc:36:35: error: 'ans_List' was not declared in this scope
   36 |                 Console.WriteLine(ans_List.Min());
      |                                   ^~~~~~~~