Language: C++

using namespace std;

int main(){
    int H=0;
    int W=0;
    
    cin>>H;
    cin>>W;
    char hougan[H][W];
    char aka[H][W];
    char ao[H][W];
    for (int i=0; i<H; i++) {
        for (int j=0; j<W; j++) {
            aka[i][j]='.';
            ao[i][j]='.';
        }
    }
    for (int i=0; i<H; i++) {
        for (int j=0; j<W; j++) {
            cin>>hougan[i][j];
        }
        cout<<endl;
    }
    for (int k=0; k<H; k+=2) {
        for (int l=0; l<W-1; l++) {
            aka[k][l]='#';
        }
    }
    for (int k=0; k<H; k++) {
        aka[k][0]='#';
    }
    for (int k=1; k<H; k+=2) {
        for (int l=1; l<W; l++) {
            ao[k][l]='#';
        }
    }
    for (int k=1; k<H; k++) {
        ao[W][k]='#';
    }
    for (int i=0; i<H; i++) {
        for (int j=0; j<W; j++) {
            if (hougan[i][j]=='#' && i%2==0) {
                ao[i][j]='#';
            }
            else if (hougan[i][j]=='#' && i%2==1){
                aka[i][j]='#';
            }
        }
    }
    for (int i=0; i<H; i++) {
        for (int j=0; j<W; j++) {
            cout<<aka[i][j];
        }
        cout<<endl;
    }
    cout<<endl;
    for (int i=0; i<H; i++) {
        for (int j=0; j<W; j++) {
            cout<<ao[i][j];
        }
        cout<<endl;
    }

}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:5: error: 'cin' was not declared in this scope
    7 |     cin>>H;
      |     ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:22:9: error: 'cout' was not declared in this scope
   22 |         cout<<endl;
      |         ^~~~
a.cc:22:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:22:15: error: 'endl' was not declared in this scope
   22 |         cout<<endl;
      |               ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | using namespace std;
a.cc:52:13: error: 'cout' was not declared in this scope
   52 |             cout<<aka[i][j];
      |             ^~~~
a.cc:52:13: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:54:9: error: 'cout' was not declared in this scope
   54 |         cout<<endl;
      |         ^~~~
a.cc:54:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:54:15: error: 'endl' was not declared in this scope
   54 |         cout<<endl;
      |               ^~~~
a.cc:54:15: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
a.cc:56:5: error: 'cout' was not declared in this scope
   56 |     cout<<endl;
      |     ^~~~
a.cc:56:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:56:11: error: 'endl' was not declared in this scope
   56 |     cout<<endl;
      |           ^~~~
a.cc:56:11: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'