Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, start, size) for (int i = start; i < size; i++)
#define FORR(i, start, size) for (int i = start; i > start-size; i--)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define ull unsigned long long
#define pb(a) push_back(a)
#define INF 999999999
typedef vector<int> vint;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int dy[] = {0, 0, 1, -1};
int dx[] = {1, -1, 0, 0};

int main(){
    int h,w;
    cin >> h >> w;
	vector<string> hw(h);
	for(int i=0;i<h;i++) cin>>hw[i];
    vector<vector<int>> L(h, vector<int>(w, 0));
    vector<vector<int>> R(h, vector<int>(w, 0));
    vector<vector<int>> U(h, vector<int>(w, 0));
    vector<vector<int>> D(h, vector<int>(w, 0));

    FOR(i,0,h){
        FOR(j,0,w){
            if (hw[i][j]!='#'){
                if (j==0){
                    L[i][j] = 1;
                }else{
                    L[i][j] = L[i][j-1] + 1;
                }
            }
        }
    }
    
    FOR(i,0,h){
        FORR(j,w-1,w){
            if (hw[i][j]!='#'){
                if (j==w-1){
                    R[i][j] = 1;
                }else{
                    R[i][j] = R[i][j+1] + 1;
                }
            }
        }
    }

    FOR(i,0,h){
        FOR(j,0,w){
            if (hw[i][j]!='#'){
                if (i==0){
                    U[i][j] = 1;
                }else{
                    U[i][j] = U[i-1][j] + 1;
                }
            }
        }
    }

    FORR(i,h-1,h){
        FOR(j,0,w){
            if (hw[i][j]!='#'){
                if (i==h-1){
                    D[i][j] = 1;
                }else{
                    D[i][j] = D[i+1][j] + 1;
                }
            }
        }
    }

    int ans = 0;

    FOR(i,0,h){
        FOR(j,0,w){
            ans = max(ans,L[i][j]+R[i][j]+U[i][j]+D[i][j]-3);
        }
    }

	cout << ans << endl;

}

#73

Compiler output:
a.cc:12:9: error: 'vector' does not name a type
   12 | typedef vector<int> vint;
      |         ^~~~~~
a.cc:13:9: error: 'pair' does not name a type
   13 | typedef pair<int, int> P;
      |         ^~~~
a.cc:14:9: error: 'pair' does not name a type
   14 | typedef pair<ll, ll> LP;
      |         ^~~~
a.cc:15:9: error: 'pair' does not name a type
   15 | typedef pair<int, P> PP;
      |         ^~~~
a.cc:16:9: error: 'pair' does not name a type
   16 | typedef pair<ll, LP> LPP;
      |         ^~~~
a.cc: In function 'int main()':
a.cc:23:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   23 |     cin >> h >> w;
      |     ^~~
      |     std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:24:9: error: 'vector' was not declared in this scope
   24 |         vector<string> hw(h);
      |         ^~~~~~
a.cc:24:9: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53:
/usr/include/c++/14/bits/stl_vector.h:428:11: note:   'std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
/usr/include/c++/14/vector:93:13: note:   'std::pmr::vector'
   93 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
a.cc:24:16: error: 'string' was not declared in this scope
   24 |         vector<string> hw(h);
      |                ^~~~~~
a.cc:24:16: note: suggested alternatives:
In file included from /usr/include/c++/14/string:41,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/bits/stringfwd.h:77:33: note:   'std::string'
   77 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
/usr/include/c++/14/string:76:11: note:   'std::pmr::string'
   76 |     using string    = basic_string<char>;
      |           ^~~~~~
a.cc:24:24: error: 'hw' was not declared in this scope; did you mean 'w'?
   24 |         vector<string> hw(h);
      |                        ^~
      |                        w
a.cc:26:19: error: expected primary-expression before 'int'
   26 |     vector<vector<int>> L(h, vector<int>(w, 0));
      |                   ^~~
a.cc:27:19: error: expected primary-expression before 'int'
   27 |     vector<vector<int>> R(h, vector<int>(w, 0));
      |                   ^~~
a.cc:28:19: error: expected primary-expression before 'int'
   28 |     vector<vector<int>> U(h, vector<int>(w, 0));
      |                   ^~~
a.cc:29:19: error: expected primary-expression before 'int'
   29 |     vector<vector<int>> D(h, vector<int>(w, 0));
      |                   ^~~
a.cc:35:21: error: 'L' was not declared in this scope
   35 |                     L[i][j] = 1;
      |                     ^
a.cc:37:21: error: 'L' was not declared in this scope
   37 |                     L[i][j] = L[i][j-1] + 1;
      |                     ^
a.cc:47:21: error: 'R' was not declared in this scope
   47 |                     R[i][j] = 1;
      |                     ^
a.cc:49:21: error: 'R' was not declared in this scope
   49 |                     R[i][j] = R[i][j+1] + 1;
      |                     ^
a.cc:59:21: error: 'U' was not declared in this scope
   59 |                     U[i][j] = 1;
      |                     ^
a.cc:61:21: error: 'U' was not declared in this scope
   61 |                     U[i][j] = U[i-1][j] + 1;
      |                     ^
a.cc:71:21: error: 'D' was not declared in this scope
   71 |                     D[i][j] = 1;
      |                     ^
a.cc:73:21: error: 'D' was not declared in this scope
   73 |                     D[i][j] = D[i+1][j] + 1;
      |                     ^
a.cc:83:27: error: 'L' was not declared in this scope
   83 |             ans = max(ans,L[i][j]+R[i][j]+U[i][j]+D[i][j]-3);
      |                           ^
a.cc:83:35: error: 'R' was not declared in this scope
   83 |             ans = max(ans,L[i][j]+R[i][j]+U[i][j]+D[i][j]-3);
      |                                   ^
a.cc:83:43: error: 'U' was not declared in this scope
   83 |             ans = max(ans,L[i][j]+R[i][j]+U[i][j]+D[i][j]-3);
      |                                           ^
a.cc:83:51: error: 'D' was not declared in this scope
   83 |             ans = max(ans,L[i][j]+R[i][j]+U[i][j]+D[i][j]-3);
      |                                                   ^
a.cc:83:19: error: 'max' was not declared in this scope; did you mean 'std::max'?
   83 |             ans = max(ans,L[i][j]+R[i][j]+U[i][j]+D[i][j]-3);
      |                   ^~~
      |                   std::max
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: 'std::max' declared here
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
a.cc:87:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   87 |         cout << ans << endl;
      |         ^~~~
      |         std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:87:24: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   87 |         cout << ans << endl;
      |                        ^~~~
      |                        std::endl
In file included from /usr/include/c++/14/istream:41,
                 from /usr/include/c++/14/sstream:40,
                 from /usr/include/c++/14/complex:45,
                 from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~