# Compilation Error > _“Your source code compiled to ... bytes which is too big, too thick, too long for us..”_ ---- ## Symptoms - Submission fails at compilation with “Compiled file is too large … maximal allowed size is 33,554,432 bytes.” - You often see this when using templates that declare large global arrays of structs with default member values (e.g., segment tree / lazy propagation templates). ---- ## Why it happens -- ### The .data vs .bss story -- - Initialized static/global objects (including globals with non-zero defaults) go into the executable’s .data segment — those bytes are stored in the binary. If you initialize millions of elements, the compiler may materialize megabytes of data in the output file. - Uninitialized (or zero-initialized) static/global objects can live in the .bss segment — only their size is recorded; no bytes are stored in the file, so the executable stays small. The loader zero-fills them at program start. - In C++, if a struct has default member initializers, each array element of that struct is initialized from those defaults, i.e., as initialized data (not bss). That is exactly what triggers the big .data section. -- ### Minimal example ```cpp // Problematic: a huge global array with non-zero defaults struct Node { int val = 1; // non-zero default -> initialized data int lazy = -1; // non-zero default -> initialized data } Node seg[4 * MAXN]; // may inflate the binary massively ``` Why bad? Each element’s initial bytes must be embedded into the executable’s .data section. ---- ## Fixes -- ### 1. Move initialization to runtime Keep the global array uninitialized (or zero), then set values in `main()`: ```cpp struct Node { int val, lazy; }; Node seg[4 * MAXN]; // bss — doesn't bloat the binary int main() { for (int i = 0; i < 4 * MAXN; ++i) { seg[i].val = 1; seg[i].lazy = -1; } } ``` This keeps the executable small because the array itself isn’t stored in `.data`. -- ### 2. Use a constructor Do work at startup, not in the file. ```cpp struct Node { int val, lazy; Node(int v = 1, int l = -1) : val(v), lazy(l) {} }; Node seg[4 * MAXN]; // constructed at startup; no giant .data blob ``` Using a constructor avoids materializing all bytes in the binary; initialization happens at program start.  -- ### 3. Use std::vector ```cpp struct Node { int val, lazy; }; std::vector<Node> seg; int main() { seg.assign(4 * MAXN, Node{1, -1}); // allocated/filled at runtime } ``` Dynamic storage is allocated at runtime, so the executable size stays small. ---- ## Checklist before submitting - Do you have huge global arrays (size ~10^6 or more)? - Do their elements have non-zero defaults (default member initializers)? - If yes, remove the defaults and initialize at runtime (loop/fill/constructor), or switch to std::vector. ---- ## Notes on Codeforces limits - The compiled file size hard-limit frequently seen in reports is 33,554,432 bytes (32 MiB). If your program’s binary exceeds this during compilation, you’ll get the error cited above. ---- ## References - [Compilation Error: "Compiled file is too large" and A way to deal with it – Codeforces](https://codeforces.com/blog/entry/67156) - [Getting "Compiled file is too large" error in Facebook Hackercup Round 1 problem – Codeforces](https://codeforces.com/blog/entry/17256?#comment-220516) - [Compiled file is too large [202493852 bytes] error from on-line submission – StackOverflow](https://stackoverflow.com/questions/67585913/compiled-file-is-too-large-202493852-bytes-error-from-on-line-submission) - [Data segment — initialized static data stored in the executable. – Wikipedia](https://en.wikipedia.org/wiki/Data_segment) - [.bss — uninitialized or zero-initialized static data; not stored in the file; zero-filled on load. – Wikipedia](https://en.wikipedia.org/wiki/.bss) - [Aggregate initialization — elements with default member initializers are initialized from those defaults (hence “initialized data”).– cppreference](https://en.cppreference.com/w/cpp/language/aggregate_initialization.html)