Language: C++

#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <cstdio>
#include <numeric>
#include <utility>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <stack>
#include <functional>
#include <ctime>
#include <queue>
#include <string>
#include <map>
#include <sstream>
#define MAX_U   10
#define MIN_U   0
#define rep(i,n) for(int i=0;i<n;i++)
#define pb push_back
#define form(i,a,b) for(int i=(a);i<(b);i++)
#define sz(x) ((int)(x).size())
#define CLR(a) memset((a), 0 ,sizeof(a))
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<char> vc;
typedef vector<string> vs;
typedef queue<int> qi;
const int INF=numeric_limits<int>::infinity();
void printa(){cout<<"\n";}
template<class T, class... A>void printa(const T&first,const A&... rest){cout<<first;printa(rest...);}
template<class... A>void printa(const A&... rest){printa(rest...);}
void prints(){cout<<" ";}
template<class T, class... A>void prints(const T&first,const A&... rest){cout<<first;prints(rest...);}
template<class... A>void prints(const A&... rest){prints(rest...);}
/*int factorial(int x){int f=1;for(int i=1;i<x+1;i++)f=f*i;return f;}
int sigma(int x){int s;for(int i=1;i<x+1;i++)s=s+i;return s;}
int middle(int x){if(x%2==0)return x/2;else return x/2+1;}
double heron(int a,int b,int c){double s;s=(a+b+c)/2;return sqrt(s*(s-a)*(s-b)*(s-c));}
double trapezium(int a,int b,int h){return (a+b)*h/2;}
double triangle(int a,int h){return a*h/2;}
void sorm(vector<int> vec){sort(vec.begin(),vec.end());}
void sorg(vector<int> vec){sort(vec.begin(),vec.end(),greater<int>());}
int cmp( const void *p, const void *q ) {if( ＊(double＊)p > ＊(double＊)q ) return 1;if( ＊(double＊)p < ＊(double＊)q ) return -1;return 0;}
*/
int main(void){
   cin.tie(0);
   ios::sync_with_stdio(false);
   //unsigned long a,b,c,d,e;
   int ad,bd;
   //unsigned long f=0;
   //string st,tt,nt;
   //vi ad,bd,cd,dd;
   //vs A,W,B;
   //int X=0;
   //vs as,bs,cs,ds;
   vector<char> A;
   string a;
   int flag=0,nfl,ta,tb;
   cin>>ad>>bd;
   ta=ad;
   tb=bd;
   int newf=0;
   for(int F=0;F<ad;F++){
        cin>>a;
        for(int i=0;i<bd;i++){
            A.push_back(a[i]);
        }
   }

   for(int i=0;i<bd-1;i++){
       for(int n=0;n<ad*bd;n=n+bd){
        if(A[i]==A[i+n])nfl++;
       }
        if(nfl==bd){
            newf = 1;
            }
        }
    }
if(newf==1){
    for(int i=0;i<bd-1;i++){
       for(int n=0;n<ad*bd;n=n+bd){
        if(A[i]==A[i+n])nfl++;
       }
        if(nfl==bd){
            tb--;
            for(int n=0;n<ad*bd;n=n+bd){
                A.push_back(i+n);
            }
        }
        nfl=0;
    }

   for(int F=0;F<ad;F++){
       for(int i=0;i<tb;i++){
           A.push_back(a[i]);
           if(a[i+(F*5)]=='.')flag++;
       }
       if(flag==tb){
            ta--;
            for(int i=0;i<tb;i++)A.pop_back();
        }
        flag = 0;
   }
}
else if(newf==0){
for(int F=0;F<ad;F++){
       for(int i=0;i<bd;i++){
           A.push_back(a[i]);
           if(a[i+(F*5)]=='.')flag++;
       }
       if(flag==bd){
            ta--;
            for(int i=0;i<tb;i++)A.pop_back();
        }
        flag = 0;
   }
}
   for(int F=1;F<(ta*tb)+1;F++){
        cout<<A[F-1];
        if(F%tb==0)printa();
   }
   return 0;
}

Compiler output:
a.cc:85:1: error: expected unqualified-id before 'if'
   85 | if(newf==1){
      | ^~
a.cc:111:1: error: expected unqualified-id before 'else'
  111 | else if(newf==0){
      | ^~~~
a.cc:124:4: error: expected unqualified-id before 'for'
  124 |    for(int F=1;F<(ta*tb)+1;F++){
      |    ^~~
a.cc:124:16: error: 'F' does not name a type
  124 |    for(int F=1;F<(ta*tb)+1;F++){
      |                ^
a.cc:124:28: error: 'F' does not name a type
  124 |    for(int F=1;F<(ta*tb)+1;F++){
      |                            ^
a.cc:128:4: error: expected unqualified-id before 'return'
  128 |    return 0;
      |    ^~~~~~
a.cc:129:1: error: expected declaration before '}' token
  129 | }
      | ^