Language: C++

using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text.RegularExpressions;
using System.Diagnostics;
using static System.Math;

//var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
namespace AtCoderSolve
{

    class Solve
    {
        const int mod = 1000000007;
        const int INF = 2147483647;
        const long SINF = 9223372036854775807;

        static int H, W;
        static string[] S;

        public static void Input()
        {
            var cin = new Solve();
            var input = cin.SplitReader();
            H = input[0];
            W = input[1];
            S = new string[H];
            for (var i = 0; i < H; i++)
            {
                S[i] = Console.ReadLine();
            }
        }

        static void Main(string[] args)
        {
            Input();
            //var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            //Console.SetOut(sw);
            

            string ans = "Yes";
            for(var i = 0; i < H; i++)
            {
                for(var j = 0; j < W; j++)
                {
                    if (S[i][j] == '.') { continue; }
                    ans = "No";
                    if ((i > 0 && S[i - 1][j] == '#') || (i < H - 1 && S[i + 1][j] == '#') || (j > 0 && S[i][j - 1] == '#') || (j < W - 1 && S[i][j + 1] == '#'))
                    {
                        ans = "Yes";
                    }
                    else { break; }
                    
                }
            }
            Console.WriteLine(ans);
            
            
            //Console.Out.Flush();
        }

        public int[] SplitReader()
        {
            int[] array = Console.ReadLine().Split().Select(int.Parse).ToArray();
            return array;
        }
        public long[] SplitReaderL()
        {
            long[] array = Console.ReadLine().Split().Select(long.Parse).ToArray();
            return array;
        }

    }
}

    



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.IO;
      |       ^~~~~~
a.cc:5:7: error: expected nested-name-specifier before 'System'
    5 | using System.Text.RegularExpressions;
      |       ^~~~~~
a.cc:6:7: error: expected nested-name-specifier before 'System'
    6 | using System.Diagnostics;
      |       ^~~~~~
a.cc:7:7: error: expected nested-name-specifier before 'static'
    7 | using static System.Math;
      |       ^~~~~~
a.cc:20:16: error: 'string' does not name a type
   20 |         static string[] S;
      |                ^~~~~~
a.cc:22:15: error: expected ':' before 'static'
   22 |         public static void Input()
      |               ^~~~~~~
      |               :
a.cc:35:26: error: 'string' has not been declared
   35 |         static void Main(string[] args)
      |                          ^~~~~~
a.cc:35:35: error: expected ',' or '...' before 'args'
   35 |         static void Main(string[] args)
      |                                   ^~~~
a.cc:63:15: error: expected ':' before 'int'
   63 |         public int[] SplitReader()
      |               ^~~~
      |               :
a.cc:63:19: error: expected unqualified-id before '[' token
   63 |         public int[] SplitReader()
      |                   ^
a.cc:68:15: error: expected ':' before 'long'
   68 |         public long[] SplitReaderL()
      |               ^~~~~
      |               :
a.cc:68:20: error: expected unqualified-id before '[' token
   68 |         public long[] SplitReaderL()
      |                    ^
a.cc:74:6: error: expected ';' after class definition
   74 |     }
      |      ^
      |      ;
a.cc: In static member function 'static void AtCoderSolve::Solve::Input()':
a.cc:24:13: error: 'var' was not declared in this scope
   24 |             var cin = new Solve();
      |             ^~~
a.cc:25:17: error: expected ';' before 'input'
   25 |             var input = cin.SplitReader();
      |                 ^~~~~
a.cc:26:17: error: 'input' was not declared in this scope; did you mean 'Input'?
   26 |             H = input[0];
      |                 ^~~~~
      |                 Input
a.cc:28:13: error: 'S' was not declared in this scope
   28 |             S = new string[H];
      |             ^
a.cc:28:21: error: 'string' does not name a type
   28 |             S = new string[H];
      |                     ^~~~~~
a.cc:29:22: error: expected ';' before 'i'
   29 |             for (var i = 0; i < H; i++)
      |                      ^
a.cc:29:29: error: 'i' was not declared in this scope
   29 |             for (var i = 0; i < H; i++)
      |                             ^
a.cc:31:24: error: 'Console' was not declared in this scope
   31 |                 S[i] = Console.ReadLine();
      |                        ^~~~~~~
a.cc: In static member function 'static void AtCoderSolve::Solve::Main(int*)':
a.cc:42:13: error: 'string' was not declared in this scope
   42 |             string ans = "Yes";
      |             ^~~~~~
a.cc:43:17: error: 'var' was not declared in this scope
   43 |             for(var i = 0; i < H; i++)
      |                 ^~~
a.cc:43:28: error: 'i' was not declared in this scope
   43 |             for(var i = 0; i < H; i++)
      |                            ^
a.cc:45:25: error: expected ';' before 'j'
   45 |                 for(var j = 0; j < W; j++)
      |                         ^
a.cc:45:32: error: 'j' was not declared in this scope
   45 |                 for(var j = 0; j < W; j++)
      |                                ^
a.cc:47:25: error: 'S' was not declared in this scope
   47 |                     if (S[i][j] == '.') { continue; }
      |                         ^
a.cc:48:21: error: 'ans' was not declared in this scope
   48 |                     ans = "No";
      |                     ^~~
a.cc:49:35: error: 'S' was not declared in this scope
   49 |                     if ((i > 0 && S[i - 1][j] == '#') || (i < H - 1 && S[i + 1][j] == '#') || (j > 0 && S[i][j - 1] == '#') || (j < W - 1 && S[i][j + 1] == '#'))
      |                                   ^
a.cc:57:13: error: 'Console' was not declared in this scope
   57 |             Console.WriteLine(ans);
      |             ^~~~~~~
a.cc:57:31: error: 'ans' was not declared in this scope
   57 |             Console.WriteLine(ans);
      |                               ^~~