Language: C++

#include<iostream>
#include<string>
using namespace std;

int litten_area_in_line(int i, const int* l){
		int sum = 0;
		//check left
		int tmp=i-1;
		while(tmp >= 0){
			if(l[tmp] == 0){
				sum++;
				tmp--;
			}else{
				break;
			}
		}
		//check right
		int tmp = i+1;
		while(tmp < len(l)){
			if(l[tmp] == 0){
				sum++;
				tmp++;
			}else{
				break;
			}
		}
		return sum;
	}
	int litten_area_in_row(int i, int j,const int** obstacle){
		int[] line = obstacle[i];
		return litten_area_in_line(j,line);	
	}
	int litten_area_in_column(int i, int j, const int ** obstacle){
		int[] line = new int[h];
		for(int k = 0;k<h;k++) line[k] = obstacle[k][j];
		return litten_area_in_line(i,line);
	}
int main(){
	int h,w;
	cin >> h >> w;
	int** obstacle = new int*[h];
	for(int i=0;i<h;i++){
		obstacle[i] = new int[w];
	}
	string tmp_str;
	for(int i=0;i<h;i++){
		cin >> tmp_str;
		for(int j = 0;j<w;j++){
			if(tmp_str[j] == '#') obstacle[i][j] = 1;
			else if(tmp_str[j] == '.') obstacle[i][j] = 0;
		}
	}
	
	
	int max_litten = 0;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			int tmp_litten = 0;
			//if you can't put light there
			if(obstacle[i][j] == 1) continue;
			else tmp_litten = 1;
			//check the column
			tmp_litten += litten_area_in_column(i,j,obstacle);
			//check the row
			tmp_litten += litten_area_in_row(i,j,obstacle);
			if(tmp_litten > max_litten) max_litten = tmp_litten;			}
	}
	cout << max_litten_endl;
	return 0;
}


Compiler output:
a.cc: In function 'int litten_area_in_line(int, const int*)':
a.cc:18:21: error: redeclaration of 'int tmp'
   18 |                 int tmp = i+1;
      |                     ^~~
a.cc:8:21: note: 'int tmp' previously declared here
    8 |                 int tmp=i-1;
      |                     ^~~
a.cc:19:29: error: 'len' was not declared in this scope
   19 |                 while(tmp < len(l)){
      |                             ^~~
a.cc: In function 'int litten_area_in_row(int, int, const int**)':
a.cc:30:20: error: structured binding declaration cannot have type 'int'
   30 |                 int[] line = obstacle[i];
      |                    ^~
a.cc:30:20: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:30:20: error: empty structured binding declaration
a.cc:30:23: error: expected initializer before 'line'
   30 |                 int[] line = obstacle[i];
      |                       ^~~~
a.cc:31:46: error: 'line' was not declared in this scope
   31 |                 return litten_area_in_line(j,line);
      |                                              ^~~~
a.cc: In function 'int litten_area_in_column(int, int, const int**)':
a.cc:34:20: error: structured binding declaration cannot have type 'int'
   34 |                 int[] line = new int[h];
      |                    ^~
a.cc:34:20: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:34:20: error: empty structured binding declaration
a.cc:34:23: error: expected initializer before 'line'
   34 |                 int[] line = new int[h];
      |                       ^~~~
a.cc:35:33: error: 'h' was not declared in this scope
   35 |                 for(int k = 0;k<h;k++) line[k] = obstacle[k][j];
      |                                 ^
a.cc:35:40: error: 'line' was not declared in this scope
   35 |                 for(int k = 0;k<h;k++) line[k] = obstacle[k][j];
      |                                        ^~~~
a.cc:36:46: error: 'line' was not declared in this scope
   36 |                 return litten_area_in_line(i,line);
      |                                              ^~~~
a.cc: In function 'int main()':
a.cc:63:65: error: invalid conversion from 'int**' to 'const int**' [-fpermissive]
   63 |                         tmp_litten += litten_area_in_column(i,j,obstacle);
      |                                                                 ^~~~~~~~
      |                                                                 |
      |                                                                 int**
a.cc:33:62: note:   initializing argument 3 of 'int litten_area_in_column(int, int, const int**)'
   33 |         int litten_area_in_column(int i, int j, const int ** obstacle){
      |                                                 ~~~~~~~~~~~~~^~~~~~~~
a.cc:65:62: error: invalid conversion from 'int**' to 'const int**' [-fpermissive]
   65 |                         tmp_litten += litten_area_in_row(i,j,obstacle);
      |                                                              ^~~~~~~~
      |                                                              |
      |                                                              int**
a.cc:29:57: note:   initializing argument 3 of 'int litten_area_in_row(int, int, const int**)'
   29 |         int litten_area_in_row(int i, int j,const int** obstacle){
      |                                             ~~~~~~~~~~~~^~~~~~~~
a.cc:68:17: error: 'max_litten_endl' was not declared in this scope; did you mean 'max_litten'?
   68 |         cout << max_litten_endl;
      |                 ^~~~~~~~~~~~~~~
      |                 max_litten