Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int w,h,i=0,j=0;
	char c[1001][1001]
	cin>>w>>h;
	for (int a=1;a<=w;a++)
	{
		for (int b=1;b<=h;b++)
		{
			cin>>c[a][b];
		}
	}
	for (i=1;i<=w;i++)
	{
		for (j=1;j<=h;j++)
		{
			if (i==1 && j==1)
			{
				if (c[1][2]=='.' && c[2][1]=='.')
				{
					cout<<"No"<<endl;
					return 0;
				}
			}
			if (i==1 && j==h)
			{
				if (c[1][h-1]=='.' && c[2][h]=='.')
				{
					cout<<"No"<<endl;
					return 0;
				}
			}
			if (i==w && j==1)
			{
				if (c[w-1][1]=='.' && c[w][2]=='.')
				{
					cout<<"No"<<endl;
					return 0;
				}
			}
			if (i==w && j==h)
			{
				if (c[w-1][h]=='.' && c[w][h-1]=='.')
				{
					cout<<"No"<<endl;
					return 0;
				}
			}
			if (i==1 && j!=1 && j!=h)
			{
				if (c[1][j-1]=='.' && c[1][j+1]=='.' && c[2][j]=='.')
				{
					cout<<"No"<<endl;
					return 0;
				}
			}
			if (i==w && j!=1 && j!=h)
			{
				if (c[w][j-1]=='.' && c[w][j+1]=='.' && c[w-1][j]=='.')
				{
					cout<<"No"<<endl;
					return 0;
				}
			}
			if (j==1 && i!=1 && i!=w)
			{
				if (c[i+1][1]=='.' && c[i-1][1]=='.' && c[i][2]=='.')
				{
					cout<<"No"<<endl;
					return 0;
				}
			}
			if (j==h && i!=1 && i!=w)
			{
				if (c[i+1][h]=='.' && c[i-1][h]=='.' && c[i][h-1]=='.')
				{
					cout<<"No"<<endl;
					return 0;
				}
			}
			if (i!=1 && i!=w && j!=1 && j!=h)
			{
				if (c[i-1][j]=='.' && c[i+1][j]=='.' && c[i][j-1]=='.' && c[i][j+1]=='.')
				{
					cout<<"No"<<endl;
					return 0;
				}
			}
		}
	}
	cout<<"Yes"<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: expected initializer before 'cin'
    7 |         cin>>w>>h;
      |         ^~~
a.cc:12:30: error: 'c' was not declared in this scope
   12 |                         cin>>c[a][b];
      |                              ^
a.cc:21:37: error: 'c' was not declared in this scope
   21 |                                 if (c[1][2]=='.' && c[2][1]=='.')
      |                                     ^
a.cc:29:37: error: 'c' was not declared in this scope
   29 |                                 if (c[1][h-1]=='.' && c[2][h]=='.')
      |                                     ^
a.cc:37:37: error: 'c' was not declared in this scope
   37 |                                 if (c[w-1][1]=='.' && c[w][2]=='.')
      |                                     ^
a.cc:45:37: error: 'c' was not declared in this scope
   45 |                                 if (c[w-1][h]=='.' && c[w][h-1]=='.')
      |                                     ^
a.cc:53:37: error: 'c' was not declared in this scope
   53 |                                 if (c[1][j-1]=='.' && c[1][j+1]=='.' && c[2][j]=='.')
      |                                     ^
a.cc:61:37: error: 'c' was not declared in this scope
   61 |                                 if (c[w][j-1]=='.' && c[w][j+1]=='.' && c[w-1][j]=='.')
      |                                     ^
a.cc:69:37: error: 'c' was not declared in this scope
   69 |                                 if (c[i+1][1]=='.' && c[i-1][1]=='.' && c[i][2]=='.')
      |                                     ^
a.cc:77:37: error: 'c' was not declared in this scope
   77 |                                 if (c[i+1][h]=='.' && c[i-1][h]=='.' && c[i][h-1]=='.')
      |                                     ^
a.cc:85:37: error: 'c' was not declared in this scope
   85 |                                 if (c[i-1][j]=='.' && c[i+1][j]=='.' && c[i][j-1]=='.' && c[i][j+1]=='.')
      |                                     ^