Language: C++

#include <bits/stdc++.h>

using namespace std;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)

int main()
{
  int h, w; cin >> h >> w;
  vector<vector<char>> a(h, vector<char>(w));
  REP(i, h) {
    REP(j, w) {
      cin >> a.at(i).at(j);
    }
  }

  REP(i, h) {
    int cnt_w = 0;
    REP(j, w) {
      if (a.at(i).at(j) == '.') cnt_w++;
    }
    if (cnt_w == w) a.at(i) = { '0', '0', '0', '0' };
  }

  REP(j, w) {
    int cnt_h = 0;
    REP(i, h) {
      if (a.at(i).at(j) == '.' || a.at(i).at(j) == '0') cnt_h++;
    }
    if (cnt_h == h) {
      REP(i, h) {
        a.at(i).at(j) = '0';
      }
    }
  }

  REP(i, h) {
    REP(j, w) {
      char elem = a.at(i).at(j);
      if (elem == '0') continue;
      cout << elem;
      if (j == w - 1) cout << endl;
    }
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:5:22: error: 'll' was not declared in this scope
    5 | #define REP(i,n) for(ll i=0;i<(ll)(n);i++)
      |                      ^~
a.cc:11:3: note: in expansion of macro 'REP'
   11 |   REP(i, h) {
      |   ^~~
a.cc:11:7: error: 'i' was not declared in this scope
   11 |   REP(i, h) {
      |       ^
a.cc:5:29: note: in definition of macro 'REP'
    5 | #define REP(i,n) for(ll i=0;i<(ll)(n);i++)
      |                             ^
a.cc:12:9: error: expected ';' before 'j'
   12 |     REP(j, w) {
      |         ^
a.cc:5:25: note: in definition of macro 'REP'
    5 | #define REP(i,n) for(ll i=0;i<(ll)(n);i++)
      |                         ^
a.cc:12:9: error: 'j' was not declared in this scope
   12 |     REP(j, w) {
      |         ^
a.cc:5:29: note: in definition of macro 'REP'
    5 | #define REP(i,n) for(ll i=0;i<(ll)(n);i++)
      |                             ^
a.cc:5:22: error: 'll' was not declared in this scope
    5 | #define REP(i,n) for(ll i=0;i<(ll)(n);i++)
      |                      ^~
a.cc:17:3: note: in expansion of macro 'REP'
   17 |   REP(i, h) {
      |   ^~~
a.cc:17:7: error: 'i' was not declared in this scope
   17 |   REP(i, h) {
      |       ^
a.cc:5:29: note: in definition of macro 'REP'
    5 | #define REP(i,n) for(ll i=0;i<(ll)(n);i++)
      |                             ^
a.cc:19:9: error: expected ';' before 'j'
   19 |     REP(j, w) {
      |         ^
a.cc:5:25: note: in definition of macro 'REP'
    5 | #define REP(i,n) for(ll i=0;i<(ll)(n);i++)
      |                         ^
a.cc:19:9: error: 'j' was not declared in this scope
   19 |     REP(j, w) {
      |         ^
a.cc:5:29: note: in definition of macro 'REP'
    5 | #define REP(i,n) for(ll i=0;i<(ll)(n);i++)
      |                             ^
a.cc:5:22: error: 'll' was not declared in this scope
    5 | #define REP(i,n) for(ll i=0;i<(ll)(n);i++)
      |                      ^~
a.cc:25:3: note: in expansion of macro 'REP'
   25 |   REP(j, w) {
      |   ^~~
a.cc:25:7: error: 'j' was not declared in this scope
   25 |   REP(j, w) {
      |       ^
a.cc:5:29: note: in definition of macro 'REP'
    5 | #define REP(i,n) for(ll i=0;i<(ll)(n);i++)
      |                             ^
a.cc:27:9: error: expected ';' before 'i'
   27 |     REP(i, h) {
      |         ^
a.cc:5:25: note: in definition of macro 'REP'
    5 | #define REP(i,n) for(ll i=0;i<(ll)(n);i++)
      |                         ^
a.cc:27:9: error: 'i' was not declared in this scope
   27 |     REP(i, h) {
      |         ^
a.cc:5:29: note: in definition of macro 'REP'
    5 | #define REP(i,n) for(ll i=0;i<(ll)(n);i++)
      |                             ^
a.cc:31:11: error: expected ';' before 'i'
   31 |       REP(i, h) {
      |           ^
a.cc:5:25: note: in definition of macro 'REP'
    5 | #define REP(i,n) for(ll i=0;i<(ll)(n);i++)
      |                         ^
a.cc:31:11: error: 'i' was not declared in this scope
   31 |       REP(i, h) {
      |           ^
a.cc:5:29: note: in definition of macro 'REP'
    5 | #define REP(i,n) for(ll i=0;i<(ll)(n);i++)
      |                             ^
a.cc:5:22: error: 'll' was not declared in this scope
    5 | #define REP(i,n) for(ll i=0;i<(ll)(n);i++)
      |                      ^~
a.cc:37:3: note: in expansion of macro 'REP'
   37 |   REP(i, h) {
      |   ^~~
a.cc:37:7: error: 'i' was not declared in this scope
   37 |   REP(i, h) {
      |       ^
a.cc:5:29: note: in definition of macro 'REP'
    5 | #define REP(i,n) for(ll i=0;i<(ll)(n);i++)
      |                             ^
a.cc:38:9: error: expected ';' before 'j'
   38 |     REP(j, w) {
      |         ^
a.cc:5:25: note: in definition of macro 'REP'
    5 | #define REP(i,n) for(ll i=0;i<(ll)(n);i++)
      |                         ^
a.cc:38:9: error: 'j' was not declared in this scope
   38 |     REP(j, w) {
      |         ^
a.cc:5:29: note: in definition of macro 'REP'
    5 | #define REP(i,n) for(ll i=0;i<(ll)(n);i++)
      |                             ^