Language: C++

#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#define _USE_MATH_DEFINES
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
ll inf = llmax / 2;

int H, W;
char s[12][12];
char nowmap[12][12];
bool usedline[12];
int lineperm[30000][12];
int dblfact[13];

void lineset(int start, int rem) {
    if (rem >= 2) {
        int fir;
        for (int i = 0; i < H; i++) {
            if (!usedline[i]) {
                fir = i;
                usedline[i] = true;
                break;
            }
        }
        for (int i = start; i < start + dblfact[rem]; i++) {
            lineperm[i][H - rem] = fir;
        }
        int num = start;
        for (int i = 0; i < H; i++) {
            if (!usedline[i]) {
                usedline[i] = true;
                for (int j = num; j < num + dblfact[rem - 2]; j++) {
                    lineperm[j][rem - 1] = i;
                }
                lineset(num, rem - 2);
                usedline[i] = false;
                num += dblfact[rem - 2];
            }
        }
        usedline[fir] = false;
    } else if (rem == 1) {
        for (int i = 0; i < H; i++) {
            if (!usedline[i]) {
                lineperm[start][H / 2] = i;
            }
        }
    }
}

int main() {
    cin >> H >> W;
    for (int i = 0; i < H; i++) {
        string str;
        cin >> str;
        for (int j = 0; j < W; j++) {
            s[i][j] = str[j];
        }
    }
    dblfact[0] = 1;
    dblfact[1] = 1;
    dblfact[2] = 1;
    for (int i = 3; i <= 12; i++) {
        dblfact[i] = dblfact[i - 2] * (i - 1);
    }
    bool ok = false;
    fill(usedline, usedline + H, false);
    lineset(0, H);
    for (int i = 0; i < dblfact[H]; i++) {
        for (int j = 0; j < H; j++) {
            for (int k = 0; k < W; k++) {
                nowmap[j][k] = s[lineperm[i][j]][k];
            }
        }
        int rem = W;
        bool wid[W];
        bool comp = true;
        fill(wid, wid + W, false);
        bool center = false;
        while (true) {
            if (rem >= 2) {
                int fir;
                for (int j = 0; j < W; j++) {
                    if (!wid[j]) {
                        fir = j;
                        break;
                    }
                }
                wid[fir] = true;
                bool b = false;
                for (int j = 0; j < W; j++) {
                    if (!wid[j]) {
                        bool bb = true;
                        for (int k = 0; k < H; k++) {
                            if (nowmap[k][j] != nowmap[H - 1 - k][fir]) {
                                bb = false;
                            }
                        }
                        if (bb) {
                            b = true;
                            wid[j] = true;
                            break;
                        }
                    }
                }
                if (!b) {
                    bool bb = true;
                    for (int j = 0; j < H; j++) {
                        if (nowmap[j][fir] != nowmap[H - 1 - j][fir]) {
                            bb = false;
                            break;
                        }
                    }
                    if (!bb || center) {
                        comp = false;
                        break;
                    } else {
                        center = true;
                    }
                }
                if (b) {
                    rem -= 2;
                } else {
                    rem--;
                }
            } else if (rem == 1) {
                sleep(100);
                int fir;
                for (int j = 0; j < W; j++) {
                    if (!wid[j]) {
                        fir = j;
                        break;
                    }
                }
                bool bb = true;
                for (int j = 0; j < H; j++) {
                    if (nowmap[j][fir] != nowmap[H - 1 - j][fir]) {
                        bb = false;
                        break;
                    }
                }
                if (!bb || center) {
                    comp = false;
                    break;
                } else {
                    center = true;
                    break;
                }
            } else {
                break;
            }
        }
        if (comp) {
            ok = true;
            break;
        }
    }
    if (ok) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:149:17: error: 'sleep' was not declared in this scope
  149 |                 sleep(100);
      |                 ^~~~~