Language: C++

#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { INIT(){
  cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;


signed main() {
  int H, W; 
  cin >> H >> W;

  vector<string> s(H);
  REP(i, H) cin >> s[i];

  vector<vector<int>> A(H, vector<int>(W, 0));
  vector<vector<int>> B(H, vector<int>(W, 0));

  REP(i, H) REP(j, W){
    if(s[i][j] == '#') continue;
    A[i][j]++;
    if(i != 0) A[i][j] += A[i-1][j];

    B[i][j]++;
    if(j != 0) B[i][j] += B[i][j-1];
  }

  RREP(i, H-1) REP(j, W){
    if(s[i][j] == '#') continue;
    chmax(A[i][j], A[i+1][j]);
  }

  REP(i, H) RREP(j, W-1){
    if(s[i][j] == '#') continue;
    chmax(B[i][j], B[i][j+1]);
  }


  int ans = 0;
  REP(i, H) REP(j, W){
    chmax(ans, A[i][j]+B[i][j]-1);
  }

  cout << ans << "\n";

  return 0;
}#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { INIT(){
  cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;


signed main() {
  int H, W; 
  cin >> H >> W;

  vector<string> s(H);
  REP(i, H) cin >> s[i];

  vector<vector<int>> A(H, vector<int>(W, 0));
  vector<vector<int>> B(H, vector<int>(W, 0));

  REP(i, H) REP(j, W){
    if(s[i][j] == '#') continue;
    A[i][j]++;
    if(i != 0) A[i][j] += A[i-1][j];

    B[i][j]++;
    if(j != 0) B[i][j] += B[i][j-1];
  }

  RREP(i, H-1) REP(j, W){
    if(s[i][j] == '#') continue;
    chmax(A[i][j], A[i+1][j]);
  }

  REP(i, H) RREP(j, W-1){
    if(s[i][j] == '#') continue;
    chmax(B[i][j], B[i][j+1]);
  }


  int ans = 0;
  REP(i, H) REP(j, W){
    chmax(ans, A[i][j]+B[i][j]-1);
  }

  cout << ans << "\n";

  return 0;
}

Compiler output:
a.cc:90:2: error: stray '#' in program
   90 | }#include <iostream>
      |  ^
a.cc:90:3: error: 'include' does not name a type
   90 | }#include <iostream>
      |   ^~~~~~~
a.cc:122:28: error: redefinition of 'template<class T> T chmin(T&, T)'
  122 | template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }
      |                            ^~~~~
a.cc:33:28: note: 'template<class T> T chmin(T&, T)' previously declared here
   33 | template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }
      |                            ^~~~~
a.cc:129:11: error: redefinition of 'const ll MOD'
  129 | const int MOD = 1000000007;
      |           ^~~
a.cc:40:11: note: 'const ll MOD' previously defined here
   40 | const int MOD = 1000000007;
      |           ^~~
a.cc:131:11: error: redefinition of 'const ll INF'
  131 | const int INF = 1e18;
      |           ^~~
a.cc:42:11: note: 'const ll INF' previously defined here
   42 | const int INF = 1e18;
      |           ^~~
a.cc:132:14: error: redefinition of 'const double PI'
  132 | const double PI = acos(-1);
      |              ^~
a.cc:43:14: note: 'const double PI' previously defined here
   43 | const double PI = acos(-1);
      |              ^~
a.cc:135:8: error: redefinition of 'struct INIT'
  135 | struct INIT { INIT(){
      |        ^~~~
a.cc:46:8: note: previous definition of 'struct INIT'
   46 | struct INIT { INIT(){
      |        ^~~~
a.cc:138:3: error: conflicting declaration 'int INIT'
  138 | }}INIT;
      |   ^~~~
a.cc:49:3: note: previous declaration as 'INIT INIT'
   49 | }}INIT;
      |   ^~~~
a.cc:141:8: error: redefinition of 'int main()'
  141 | signed main() {
      |        ^~~~
a.cc:52:8: note: 'int main()' previously defined here
   52 | signed main() {
      |        ^~~~