Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define all(x)    (x).begin(),(x).end()
typedef long long ll;
const int MOD = (int)1e9 + 7;

int main(){
  int h,w;
  cin>>h>>w;
  vector<string> grid(h);
  rep(i,h) cin>>grid[i];

  vector<h,vector<int>> L(w);
  vector<h,vector<int>> R(w);
  vector<h,vector<int>> U(w);
  vector<h,vector<int>> D(w);

  rep(i,h) rep(j,w){
    if(j==0){
      L[i][j] = 1;
      continue;
    }
    L[i][j] = grid[i][j] = '#' ? 0 : L[i][j-1] + 1;
  }

    rep(i,h) rep(j,w){
    if(j==0){
      R[i][w-j-1] = 1;
      continue;
    }
    R[i][j] = grid[i][j] = '#' ? 0 : R[i][w-j] + 1;
  }

  rep(i,h) rep(j,w){
    if(i==0){
      U[i][j] = 1;
      continue;
    }
    U[i][j] = grid[i][j] = '#' ? 0 : U[i-1][j] + 1;
  }

  rep(i,h) rep(j,w){
    if(i==0){
      D[h-i-1][j] = 1;
      continue;
    }
    D[i][j] = grid[i][j] = '#' ? 0 : D[h-i][j] + 1;
  }

  int ans = 0;
  rep(i,h) rep(j,w){
    int buf =  L[i][j] + R[i][j] + U [i][j] + D[i][j] -3;
    if (buf > ans) ans = buf;
  }

  cout<<ans<<endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:14:22: error: type/value mismatch at argument 1 in template parameter list for 'template<class _Tp, class _Alloc> class std::vector'
   14 |   vector<h,vector<int>> L(w);
      |                      ^~
a.cc:14:22: note:   expected a type, got 'h'
a.cc:15:22: error: type/value mismatch at argument 1 in template parameter list for 'template<class _Tp, class _Alloc> class std::vector'
   15 |   vector<h,vector<int>> R(w);
      |                      ^~
a.cc:15:22: note:   expected a type, got 'h'
a.cc:16:22: error: type/value mismatch at argument 1 in template parameter list for 'template<class _Tp, class _Alloc> class std::vector'
   16 |   vector<h,vector<int>> U(w);
      |                      ^~
a.cc:16:22: note:   expected a type, got 'h'
a.cc:17:22: error: type/value mismatch at argument 1 in template parameter list for 'template<class _Tp, class _Alloc> class std::vector'
   17 |   vector<h,vector<int>> D(w);
      |                      ^~
a.cc:17:22: note:   expected a type, got 'h'
a.cc:21:8: error: invalid types 'int[int]' for array subscript
   21 |       L[i][j] = 1;
      |        ^
a.cc:24:6: error: invalid types 'int[int]' for array subscript
   24 |     L[i][j] = grid[i][j] = '#' ? 0 : L[i][j-1] + 1;
      |      ^
a.cc:24:39: error: invalid types 'int[int]' for array subscript
   24 |     L[i][j] = grid[i][j] = '#' ? 0 : L[i][j-1] + 1;
      |                                       ^
a.cc:29:8: error: invalid types 'int[int]' for array subscript
   29 |       R[i][w-j-1] = 1;
      |        ^
a.cc:32:6: error: invalid types 'int[int]' for array subscript
   32 |     R[i][j] = grid[i][j] = '#' ? 0 : R[i][w-j] + 1;
      |      ^
a.cc:32:39: error: invalid types 'int[int]' for array subscript
   32 |     R[i][j] = grid[i][j] = '#' ? 0 : R[i][w-j] + 1;
      |                                       ^
a.cc:37:8: error: invalid types 'int[int]' for array subscript
   37 |       U[i][j] = 1;
      |        ^
a.cc:40:6: error: invalid types 'int[int]' for array subscript
   40 |     U[i][j] = grid[i][j] = '#' ? 0 : U[i-1][j] + 1;
      |      ^
a.cc:40:39: error: invalid types 'int[int]' for array subscript
   40 |     U[i][j] = grid[i][j] = '#' ? 0 : U[i-1][j] + 1;
      |                                       ^
a.cc:45:8: error: invalid types 'int[int]' for array subscript
   45 |       D[h-i-1][j] = 1;
      |        ^
a.cc:48:6: error: invalid types 'int[int]' for array subscript
   48 |     D[i][j] = grid[i][j] = '#' ? 0 : D[h-i][j] + 1;
      |      ^
a.cc:48:39: error: invalid types 'int[int]' for array subscript
   48 |     D[i][j] = grid[i][j] = '#' ? 0 : D[h-i][j] + 1;
      |                                       ^
a.cc:53:17: error: invalid types 'int[int]' for array subscript
   53 |     int buf =  L[i][j] + R[i][j] + U [i][j] + D[i][j] -3;
      |                 ^
a.cc:53:27: error: invalid types 'int[int]' for array subscript
   53 |     int buf =  L[i][j] + R[i][j] + U [i][j] + D[i][j] -3;
      |                           ^
a.cc:53:38: error: invalid types 'int[int]' for array subscript
   53 |     int buf =  L[i][j] + R[i][j] + U [i][j] + D[i][j] -3;
      |                                      ^
a.cc:53:48: error: invalid types 'int[int]' for array subscript
   53 |     int buf =  L[i][j] + R[i][j] + U [i][j] + D[i][j] -3;
      |                                                ^