Language: C++

#pragma GCC optimize("Ofast")
#include <cstdio>
#include <cstdlib>
#include <string>
#include <algorithm>
#include <iostream>
#include <queue>
#include <vector>
#include <bitset>
#include <cmath>
#include <limits>
#include <iostream>
#include <map>
#include <set>
#include <tuple>
using namespace std;
#define INF 1LL << 61
#define MAX 100000
#define MOD 1000000007
typedef long long ll;
//typedef pair<int,int> P;
//typedef pair<pair<int,int>,int> p;
#define bit(n, k) ((n >> k) & 1) /*nのk bit目*/
#define rad_to_deg(rad) (((rad) / 2 / M_PI) * 360)
struct edge
{
    ll to, cost, val;
};
template <class T, class U>
bool chmin(T &a, const U &b)
{
    if (a <= b)
        return false;
    a = b;
    return true;
}
template <class T, class U>
bool chmax(T &a, const U &b)
{
    if (a >= b)
        return false;
    a = b;
    return true;
}
//__builtin_popcount(S);
//C.erase(unique(C.begin(),C.end()),C.end());
//#define int ll


signed main(void)
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    #pragma GCC optimize("Ofast")
#include <cstdio>
#include <cstdlib>
#include <string>
#include <algorithm>
#include <iostream>
#include <queue>
#include <vector>
#include <bitset>
#include <cmath>
#include <limits>
#include <iostream>
#include <map>
#include <set>
#include <tuple>
using namespace std;
#define INF 1LL << 61
#define MAX 100000
#define MOD 1000000007
typedef long long ll;
typedef pair<int,int> P;
//typedef pair<pair<int,int>,int> p;
#define bit(n, k) ((n >> k) & 1) /*nのk bit目*/
#define rad_to_deg(rad) (((rad) / 2 / M_PI) * 360)
struct edge
{
    ll to, cost, val;
};
template <class T, class U>
bool chmin(T &a, const U &b)
{
    if (a <= b)
        return false;
    a = b;
    return true;
}
template <class T, class U>
bool chmax(T &a, const U &b)
{
    if (a >= b)
        return false;
    a = b;
    return true;
}
//__builtin_popcount(S);
//C.erase(unique(C.begin(),C.end()),C.end());
//#define int ll

int num[1100][1100];
P sum[1100][1100];


signed main(void)
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N;
    cin>>N;
    if(N==2 || N==5){
        cout<<-1<<endl;
        return 0;
    }
    return 1;
    string s4[4]=
    {"abcc",
     "abdd",
     "ggef",
     "hhef"
     };
     string s3[3]=
     {"aa.",
      "..b",
      "..b"
     };
     char ans[1100][1100];
     int count3=0,count4=0;
     int n=N;
     while(n%3!=0){
         n-=4;
         count4++;
     }
     count3=n/3;
     for(int i=0;i<count3+count4;i++){
         int t3=count3,t4=count4;
         for(int j=0;j<count3;j++){
             num[i][(j+i)%(count3+count4)]=3;
         }
         for(int j=0;j<count3+count4;j++){
             if(num[i][j]==0) num[i][j]=4;
         }
     }
     for(int i=0;i<count3+count4;i++){
         for(int j=0;j<count3+count4;j++){
             if(i==0 && j==0){
                 sum[i][j].first=0;
                 sum[i][j].second=0;
             }else if(j==0){
                 sum[i][j].first=sum[i-1][j].first+num[i-1][j];
                 sum[i][j].second=0;
             }else if(i==0){
                 sum[i][j].first=0;
                 sum[i][j].second=sum[i][j-1].second+num[i][j-1];
             }else{
                 sum[i][j].first=sum[i-1][j].first+num[i-1][j];
                 sum[i][j].second=sum[i][j-1].second+num[i][j-1];
             }
         }
     }
     for(int i=0;i<count3+count4;i++){
         for(int j=0;j<count3+count4;j++){
             int x=sum[i][j].first;
             int y=sum[i][j].second;
             if(num[i][j]==4){
                 for(int k=0;k<4;k++){
                     for(int l=0;l<4;l++){
                         ans[x+k][y+l]=s4[k][l];
                     }
                 }
             }else{
                 for(int k=0;k<3;k++){
                     for(int l=0;l<3;l++){
                         ans[x+k][y+l]=s3[k][l];
                     }
                 }

             }
         }
     }
     for(int i=0;i<N;i++){
         for(int j=0;j<N;j++){
             cout<<ans[i][j];
         }
         cout<<endl;
     }

}

}


Compiler output:
a.cc: In function 'int main()':
a.cc:54:13: error: '#pragma GCC optimize' is not allowed inside functions
   54 |     #pragma GCC optimize("Ofast")
      |             ^~~
a.cc:82:1: error: a template declaration cannot appear at block scope
   82 | template <class T, class U>
      | ^~~~~~~~
a.cc:107:1: error: a function-definition is not allowed here before '{' token
  107 | {
      | ^