Language: C++

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

int main() {
  int n;
  cin >> n;
  vector<vector<char>> (v, vector<char>(n)), a, b, c;
  a = {{'a','a','a','a','a'},{'a','a','a','.','a'},{'a','.','.','a','a'},{'a','.','.','a','a'},{'a','a','a','a','a'}};
  b = {{'.','.','a','a','a','a'},{'.','.','a','a','a','a'},{'a','a','.','.','a','a'},{'a','a','.','.','a','a'},{'a','a','a','a','.','.'},{'a','a','a','a','.','.'}};
  c = {{'a','a','a','a','a','a','.'},{'a','a','.','a','a','.','a'},{'.','.','a','.','.','a','a'},{'.','.','a','.','.','a','a'},{'a','a','.','a','a','.','a'},{'.','.','a','.','.','a','a'},{'.','.','a','.','.','a','a'}};
  if(n == 2) cout << -1 << endl;
  else{
    if(n == 3) v = {{'a', 'a', '.'},{'.', '.', 'a'},{'.','.', 'a'}};
    else{
      for(int i = 0; i < n - 4 - (n % 4); ++i){
        for(int j = 0; j < n; ++j){
          if(i / 4 == j / 4) v.at(i).at(j) = 'a';
          else v.at(i).at(j) = '.';
        }
      }
      if(n % 4 == 0){
      for(int i = n - 4; i < n; ++i){
        for(int j = 0; j < n; ++j){
          if(i / 4 == j / 4) v.at(i).at(j) = 'a';
          else v.at(i).at(j) = '.';
          }
        }
      }
      else if(n % 4  == 1){
        for(int i = n - 5; i < n; ++i){
          for(int j = 0; j < n; ++j){
            if(j < n - 5) v.at(i).at(j) = '.';
            else v.at(i).at(j) = a.at(i - n + 5).at(j - n + 5);
          }
        }
      }
      else if(n % 4  == 2){
        for(int i = n - 6; i < n; ++i){
          for(int j = 0; j < n; ++j){
            if(j < n - 6) v.at(i).at(j) = '.';
            else v.at(i).at(j) = b.at(i - n + 6).at(j - n + 6);
          }
        }
      }
      else if(n % 4  == 3){
        for(int i = n - 7; i < n; ++i){
          for(int j = 0; j < n; ++j){
            if(j < n - 7) v.at(i).at(j) = '.';
            else v.at(i).at(j) = c.at(i - n + 7).at(j - n + 7);
          }
        }
      }
    for(int i = 0; i < n; ++i){
      for(int j < 0; j < n; ++j) cout << v.at(i).at(j);
      cout << endl;
    }
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:25: error: 'v' was not declared in this scope
    7 |   vector<vector<char>> (v, vector<char>(n)), a, b, c;
      |                         ^
a.cc:7:46: error: 'a' was not declared in this scope
    7 |   vector<vector<char>> (v, vector<char>(n)), a, b, c;
      |                                              ^
a.cc:7:49: error: 'b' was not declared in this scope
    7 |   vector<vector<char>> (v, vector<char>(n)), a, b, c;
      |                                                 ^
a.cc:7:52: error: 'c' was not declared in this scope
    7 |   vector<vector<char>> (v, vector<char>(n)), a, b, c;
      |                                                    ^
a.cc:54:16: error: expected ';' before '<' token
   54 |       for(int j < 0; j < n; ++j) cout << v.at(i).at(j);
      |                ^~
      |                ;
a.cc:54:17: error: expected primary-expression before '<' token
   54 |       for(int j < 0; j < n; ++j) cout << v.at(i).at(j);
      |                 ^
a.cc:54:27: error: expected ')' before ';' token
   54 |       for(int j < 0; j < n; ++j) cout << v.at(i).at(j);
      |          ~                ^
      |                           )
a.cc:54:31: error: 'j' was not declared in this scope
   54 |       for(int j < 0; j < n; ++j) cout << v.at(i).at(j);
      |                               ^
a.cc:58:2: error: expected '}' at end of input
   58 | }
      |  ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^