Submission details
Task:Coloring cube
Sender:aalto25e_001
Submission time:2025-10-01 16:49:49 +0300
Language:C++ (C++11)
Status:COMPILE ERROR

Compiler report

input/code.cpp: In function 'std::ostream& operator<<(std::ostream&, std::vector<_Tp>)':
input/code.cpp:81:11: error: expected ';' before 'i'
   81 |   FOREACH(i, t) { s << *i << " "; }
      |           ^
input/code.cpp:59:46: note: in definition of macro 'FOREACH'
   59 | #define FOREACH(i, t) for (typeof(t.begin()) i = t.begin(); i != t.end(); ++i)
      |                                              ^
input/code.cpp:81:11: error: 'i' was not declared in this scope
   81 |   FOREACH(i, t) { s << *i << " "; }
      |           ^
input/code.cpp:59:61: note: in definition of macro 'FOREACH'
   59 | #define FOREACH(i, t) for (typeof(t.begin()) i = t.begin(); i != t.end(); ++i)
      |                                                             ^

Code

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

// === Debug macro starts here ===

int recur_depth = 0;
#ifdef DEBUG
#define dbg(x)                                                         \
  {                                                                    \
    ++recur_depth;                                                     \
    auto x_ = x;                                                       \
    --recur_depth;                                                     \
    cerr << string(recur_depth, '\t') << "\e[91m" << __func__ << ":"   \
         << __LINE__ << "\t" << #x << " = " << x_ << "\e[39m" << endl; \
  }
#else
#define dbg(x)
#endif
template <typename Ostream, typename Cont>
typename enable_if<is_same<Ostream, ostream>::value, Ostream&>::type operator<<(
    Ostream& os, const Cont& v) {
  os << "[";
  for (auto& x : v) {
    os << x << ", ";
  }
  return os << "]";
}
template <typename Ostream, typename... Ts>
Ostream& operator<<(Ostream& os, const pair<Ts...>& p) {
  return os << "{" << p.first << ", " << p.second << "}";
}

// === Debug macro ends here ===

// bit-twiddling
#define bit(x, i) ((x) & (1 << (i)))        // select the bit of position i of x
#define setbit(x, i) ((x) | (1 << (i)))     // set the bit of position i of x
#define unsetbit(x, i) ((x) & ~(1 << (i)))  // etc
#define togglebit(x, i) ((x) ^ (1 << (i)))
#define lowbit(x) ((x) & -(x))  // get the lowest bit of x

// general
#define BR "\n"
#define IN(i, l, r) (l < i && i < r)
#define LINR(i, l, r) (l <= i && i <= r)
#define LIN(i, l, r) (l <= i && i < r)
#define INR(i, l, r) (l < i && i <= r)
#define SZ(x) ((int)((x).size()))
#define REMAX(a, b) (a) = max((a), (b));
#define REMIN(a, b) (a) = min((a), (b));
#define IOS                     \
  ios_base::sync_with_stdio(0); \
  cin.tie(0);
#define READ(in) freopen((in), "r", stdin);
#define WRITE(out) freopen((out), "w", stdout);

// iteration
#define all(x) (x).begin(), (x).end()
#define FOREACH(i, t) for (typeof(t.begin()) i = t.begin(); i != t.end(); ++i)

// maps, pairs
#define mp make_pair
#define fi first
#define se second

// vectors
#define pb push_back
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef pair<int, int> ii;

// directions
const int fx[4][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};
const int fxx[8][2] = {{0, 1}, {0, -1}, {1, 0},  {-1, 0},
                       {1, 1}, {1, -1}, {-1, 1}, {-1, -1}};

// print vector
template <typename T>
ostream& operator<<(ostream& s, vector<T> t) {
  FOREACH(i, t) { s << *i << " "; }
  return s;
}

// types
using ll = long long;
using ull = unsigned long long;
using ui = unsigned int;
using us = unsigned short;

const int INF = 1001001001;
const int MAXN = 10000;

int nxt() {
  int x;
  cin >> x;
  return x;
}

int main() {
  IOS;
  // READ("input.txt");

  auto n = nxt();

  string colors = "RGB";
  ll idx = 0;

  if (n % 3 == 0) {
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < n; ++j) {
        for (int k = 0; k < n; ++k) {
          cout << colors[idx % 3];
          idx++;
        }
        idx--;
        cout << BR;
      }
      idx -= (n - 1);
      cout << BR;
    }
  } else {
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < n; ++j) {
        for (int k = 0; k < n; ++k) {
          cout << colors[idx % 3];
          idx++;
        }
        cout << BR;
      }
      cout << BR;
    }
  }

  return 0;
}