Language: C++

#include <bits/stdc++.h>
using namespace std;

void remove(std::vector<T>& vector, unsigned int index){
	vector.erase(vector.begin() + index);
}
 
int main() {
  int H, W;
  cin >> H >> W;
  vector<vector<int>> square(H,vector<int>(W));
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
       char a;
      cin >> a;
      if(a == '#'){
      	square.at(i).at(j) = 1;
      }
      else{
      	square.at(i).at(j) = 0;
      }
    }
  }
  
  for(int i=0; i < H ; i++){
  	for(int j=0; j < W-1 ;j++){
    	if(square.at(i).at(j) == 1) break;
      	if(j==W-1) {
          remove(square, i);
        }
    }
  }
  for(int i=0; i < W ; i++){
  	for(int j=0; j < H-1; j++){
    	if(square.at(j).at(i) == 1) break;
      	if(j == H-1){
        	for(int k=0; k < H; k++){
            	remove(square.at(j), i);
            }
        }
    }
  }
  
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
      if(square.at(i).at(j) == 0){
      	cout << '.' << endl;
      }
      else{
      	cout << '#' << endl;
      }
    }
    cout << endl;
  }
}


Compiler output:
a.cc:4:25: error: 'T' was not declared in this scope
    4 | void remove(std::vector<T>& vector, unsigned int index){
      |                         ^
a.cc:4:26: error: template argument 1 is invalid
    4 | void remove(std::vector<T>& vector, unsigned int index){
      |                          ^
a.cc:4:26: error: template argument 2 is invalid
a.cc: In function 'void remove(int&, unsigned int)':
a.cc:5:16: error: request for member 'erase' in 'vector', which is of non-class type 'int'
    5 |         vector.erase(vector.begin() + index);
      |                ^~~~~
a.cc:5:29: error: request for member 'begin' in 'vector', which is of non-class type 'int'
    5 |         vector.erase(vector.begin() + index);
      |                             ^~~~~
a.cc: In function 'int main()':
a.cc:29:17: error: no matching function for call to 'remove(std::vector<std::vector<int> >&, int&)'
   29 |           remove(square, i);
      |           ~~~~~~^~~~~~~~~~~
a.cc:4:6: note: candidate: 'void remove(int&, unsigned int)'
    4 | void remove(std::vector<T>& vector, unsigned int index){
      |      ^~~~~~
a.cc:4:29: note:   no known conversion for argument 1 from 'std::vector<std::vector<int> >' to 'int&'
    4 | void remove(std::vector<T>& vector, unsigned int index){
      |             ~~~~~~~~~~~~~~~~^~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:788:5: note: candidate: 'template<class _FIter, class _Tp> _FIter std::remove(_FIter, _FIter, const _Tp&)'
  788 |     remove(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~
/usr/include/c++/14/bits/stl_algo.h:788:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:224:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator> std::remove(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
  224 | remove(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:224:1: note:   candidate expects 4 arguments, 2 provided
In file included from /usr/include/c++/14/cstdio:42,
                 from /usr/include/c++/14/ext/string_conversions.h:45,
                 from /usr/include/c++/14/bits/basic_string.h:4154,
                 from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/stdio.h:158:12: note: candidate: 'int remove(const char*)'
  158 | extern int remove (const char *__filename) __THROW;
      |            ^~~~~~
/usr/include/stdio.h:158:12: note:   candidate expects 1 argument, 2 provided
a.cc:38:23: error: no matching function for call to 'remove(__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type&, int&)'
   38 |                 remove(square.at(j), i);
      |                 ~~~~~~^~~~~~~~~~~~~~~~~
a.cc:4:6: note: candidate: 'void remove(int&, unsigned int)'
    4 | void remove(std::vector<T>& vector, unsigned int index){
      |      ^~~~~~
a.cc:4:29: note:   no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} to 'int&'
    4 | void remove(std::vector<T>& vector, unsigned int index){
      |             ~~~~~~~~~~~~~~~~^~~~~~
/usr/include/c++/14/bits/stl_algo.h:788:5: note: candidate: 'template<class _FIter, class _Tp> _FIter std::remove(_FIter, _FIter, const _Tp&)'
  788 |     remove(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~
/usr/include/c++/14/bits/stl_algo.h:788:5: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/14/pstl/glue_algorithm_defs.h:224:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator> std::remove(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
  224 | remove(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:224:1: note:   candidate expects 4 arguments, 2 provided
/usr/include/stdio.h:158:12: note: candidate: 'int remove(const char*)'
  158 | extern int remove (const char *__filename) __THROW;
      |            ^~~~~~
/usr/include/stdio.h:158:12: note:   candidate expects 1 argument, 2 provided