Language: C++

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

#define inf_ll (int64)1e18
#define inf (int32)1e9
#define rep(i, n) for(int64 i = 0;i < (n);i++)
#define for(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using pii = pair<int32, int32>;
using pll = pair<int64, int64>;

const double eps = 1e-10;

template<typename a, typename b>inline void chmin(a &a, b b){if(a > b) a = b;}
template<typename a, typename b>inline void chmax(a &a, b b){if(a < b) a = b;}

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int32 n;
	cin >> n;
	vector<string> s(n*2);
	rep(i, n){
		cin >> s[i];
		s[i] += s[i];
		s[n+i] = s[i];
	}
	vector<vector<int32>> r(2*n, vector<int32>(2*n, 0));
	rep(i, 2*n){
		rep(j, 2*n){
			int32 cnt = 0;
			for(int32 k = 0;i+k < 2*n && j+k < 2*n;k++){
				if(s[i][j+k] == s[j][i+k]) cnt++;
				else break;
			}
			r[i][j] = cnt;
		}
	}
	int64 res = 0;
	REP(i, N){
		REP(j, N){
//			deque<PLL> deq;
//			deq.push_front(PLL(0, 2*N-max(i, j)));
			int64 mini = INF;
			for(int32 k = N-1;k >= 0;k--){
				int64 x = r[i+k][j+k];
				mini = min(mini, x+(int64)k);
				/*
				while(deq.size() && deq.front().sc-k > N-1) deq.pop_front();
				while(deq.size() && deq.back().fs+(deq.back().sc-k) > x) deq.pop_back();
				deq.push_back(PLL(x, k));
				cout << "(" << deq.front().fs << " " << deq.front().sc << " " << k << ") ";
				if(deq.front().fs+deq.front().sc-k >= N) res++;
				*/
			}
			if(mini >= N) res++;
		}
	}
	cout << res << endl;
}


Compiler output:
a.cc:30:17: error: macro "for" requires 3 arguments, but only 1 given
   30 |         rep(i, n){
      |                 ^
a.cc:7:9: note: macro "for" defined here
    7 | #define for(i, a, b) for(int64 i = (a);i < (b);i++)
      |         ^~~
a.cc:36:19: error: macro "for" requires 3 arguments, but only 1 given
   36 |         rep(i, 2*n){
      |                   ^
a.cc:7:9: note: macro "for" defined here
    7 | #define for(i, a, b) for(int64 i = (a);i < (b);i++)
      |         ^~~
a.cc:37:27: error: macro "for" requires 3 arguments, but only 1 given
   37 |                 rep(j, 2*n){
      |                           ^
a.cc:7:9: note: macro "for" defined here
    7 | #define for(i, a, b) for(int64 i = (a);i < (b);i++)
      |         ^~~
a.cc:39:67: error: macro "for" requires 3 arguments, but only 1 given
   39 |                         for(int32 k = 0;i+k < 2*n && j+k < 2*n;k++){
      |                                                                   ^
a.cc:7:9: note: macro "for" defined here
    7 | #define for(i, a, b) for(int64 i = (a);i < (b);i++)
      |         ^~~
a.cc:52:53: error: macro "for" requires 3 arguments, but only 1 given
   52 |                         for(int32 k = N-1;k >= 0;k--){
      |                                                     ^
a.cc:7:9: note: macro "for" defined here
    7 | #define for(i, a, b) for(int64 i = (a);i < (b);i++)
      |         ^~~
a.cc:21:54: error: declaration of 'a& a' shadows template parameter
   21 | template<typename a, typename b>inline void chmin(a &a, b b){if(a > b) a = b;}
      |                                                   ~~~^
a.cc:21:10: note: template parameter 'a' declared here
   21 | template<typename a, typename b>inline void chmin(a &a, b b){if(a > b) a = b;}
      |          ^~~~~~~~
a.cc:21:59: error: declaration of 'b b' shadows template parameter
   21 | template<typename a, typename b>inline void chmin(a &a, b b){if(a > b) a = b;}
      |                                                         ~~^
a.cc:21:22: note: template parameter 'b' declared here
   21 | template<typename a, typename b>inline void chmin(a &a, b b){if(a > b) a = b;}
      |                      ^~~~~~~~
a.cc: In function 'void chmin(a&, b)':
a.cc:21:59: error: declaration of 'b b' shadows template parameter
   21 | template<typename a, typename b>inline void chmin(a &a, b b){if(a > b) a = b;}
      |                                                         ~~^
a.cc:21:22: note: template parameter 'b' declared here
   21 | template<typename a, typename b>inline void chmin(a &a, b b){if(a > b) a = b;}
      |                      ^~~~~~~~
a.cc:21:54: error: declaration of 'a& a' shadows template parameter
   21 | template<typename a, typename b>inline void chmin(a &a, b b){if(a > b) a = b;}
      |                                                   ~~~^
a.cc:21:10: note: template parameter 'a' declared here
   21 | template<typename a, typename b>inline void chmin(a &a, b b){if(a > b) a = b;}
      |          ^~~~~~~~
a.cc: At global scope:
a.cc:22:54: error: declaration of 'a& a' shadows template parameter
   22 | template<typename a, typename b>inline void chmax(a &a, b b){if(a < b) a = b;}
      |                                                   ~~~^
a.cc:22:10: note: template parameter 'a' declared here
   22 | template<typename a, typename b>inline void chmax(a &a, b b){if(a < b) a = b;}
      |          ^~~~~~~~
a.cc:22:59: error: declaration of 'b b' shadows template parameter
   22 | template<typename a, typename b>inline void chmax(a &a, b b){if(a < b) a = b;}
      |                                                         ~~^
a.cc:22:22: note: template parameter 'b' declared here
   22 | template<typename a, typename b>inline void chmax(a &a, b b){if(a < b) a = b;}
      |                      ^~~~~~~~
a.cc: In function 'void chmax(a&, b)':
a.cc:22:59: error: declaration of 'b b' shadows template parameter
   22 | template<typename a, typename b>inline void chmax(a &a, b b){if(a < b) a = b;}
      |                                                         ~~^
a.cc:22:22: note: template parameter 'b' declared here
   22 | template<typename a, typename b>inline void chmax(a &a, b b){if(a < b) a = b;}
      |                      ^~~~~~~~
a.cc:22:54: error: declaration of 'a& a' shadows template parameter
   22 | template<typename a, typename b>inline void chmax(a &a, b b){if(a < b) a = b;}
      |                                                   ~~~^
a.cc:22:10: note: template parameter 'a' declared here
   22 | template<typename a, typename b>inline void chmax(a &a, b b){if(a < b) a = b;}
      |          ^~~~~~~~
a.cc: In function 'int main()':
a.cc:30:18: error: expected '(' before '{' token
   30 |         rep(i, n){
      |                  ^
      |                  (
a.cc:30:18: error: expected primary-expression before '{' token
a.cc:35:32: error: expected initializer before '(' token
   35 |         vector<vector<int32>> r(2*n, vector<int32>(2*n, 0));
      |                                ^
a.cc:35:32: error: could not convert 'r' from 'std::vector<std::vector<long int> >' to 'bool'
   35 |         vector<vector<int32>> r(2*n, vector<int32>(2*n, 0));
      |                                ^
      |                                |
      |                                std::vector<std::vector<long int> >
a.cc:35:32: error: expected ';' before '(' token
   35 |         vector<vector<int32>> r(2*n, vector<int32>(2*n, 0));
      |                                ^
      |                                ;
a.cc:35:60: error: expected ')' before ';' token
   35 |         vector<vector<int32>> r(2*n, vector<int32>(2*n, 0));
      |                                                            ^
      |                                                            )
a.cc:30:18: note: to match this '('
   30 |         rep(i, n){
      |                  ^
a.cc:36:20: error: expected '(' before '{' token
   36 |         rep(i, 2*n){
      |                    ^
      |                    (
a.cc:36:20: error: expected primary-expression before '{' token
a.cc:47:13: error: 'i' was not declared in this scope
   47 |         REP(i, N){
      |             ^
a.cc:47:16: error: 'N' was not declared in this scope
   47 |         REP(i, N){
      |                ^
a.cc:47:9: error: 'REP' was not declared in this scope
   47 |         REP(i, N){
      |         ^~~
a.cc:47:18: error: expected ')' before '{' token
   47 |         REP(i, N){
      |                  ^
      |                  )
a.cc:36:20: note: to match this '('
   36 |         rep(i, 2*n){
      |                    ^
a.cc:48:21: error: 'j' was not declared in this scope
   48 |                 REP(j, N){
      |                     ^
a.cc:66:17: error: 'res' was not declared in this scope; did you mean 'rep'?
   66 |         cout << res << endl;
      |                 ^~~
      |                 rep