# 6th Place Solution for Google Code Golf Championship Summary Our repository is [here](https://github.com/Yosshi999/ARCGolfVisualizer) . Score contribution is: Golf by hand (955,251) ZLIB compression (+2276) code optimization (~400) Although we didn't share our individual scores on the spreadsheet ( [https://www.kaggle.com/competitions/google-code-golf-2025/discussion/596679)](https://www.kaggle.com/competitions/google-code-golf-2025/discussion/596679)) , we have 5 diamonds and 58 golds. Diamond tasks: task288 85B (-1) task245 94B (-4) task225 122B (-1) task382 123B (-1) task349 163B (-9) Visualizer We created a visualizer using Flask + Jinja2, and managed submissions on github. ![screen](assets/53dc333816fdadd26c18549a.gif) Important Golf Techniques BFS BFS takes much computational cost, but short. Task286 ![](assets/6166b500924c61d314259add.png) Unroll 'rotate left' Sometimes you can unroll the rotating operation, ...for*v,in zip(*g)][::-1] . Task095 ![](assets/bfe1769dc4efab9708cb3fc5.png) Embed non-ascii code You can use b-string to shorten the constant array. Task266🥉 ![](assets/31ea1cdb2a8552f9ce7722d0.png) Loop unrolling and exec Task288💎 ![](assets/935df3a1df733a3d4aa0c42a.png) ZLIB compression Codes longer than 240B can be shortened by ZLIB. We used google/zopfli because it is better than the builtin zlib. In addition we cutout the head and tail to save 3 bytes. ![](assets/039b498231d36080185bb8b4.png) compressed_str = zopfli.zlib.compress(raw_str)[:-] zlib (zlib.decompress((,),-)) ZLIB optimizer Renaming variables gains ~400 pts. It is important to use same variable names and make it more huffman-coding-friendly. We have two approaches: Static Analysis and Simulated Annealing. Static Analysis It takes much computational cost for validating all testcases. So we generate candidates by using Optuna (or QUBO solver in early days of the competition) with the constraint provided by the variable liveness analysis. The constraint is represented as interference graph. ![](assets/54dd1c3100800c9d7b0d0ad1.png) Simulated Annealing As well as Static Analysis, zopfli is optimized as a black box, with byte count as the metric. SA randomly changes the names of some variables to create neighboring states. Each candidate is validated using 10 testcases. ![](assets/1fbfbf133ea7e50aeb39d26b.png) Pros and Cons Static Analysis takes ~3h for all handwritten submissions. It does not need any testcase so it is fast. On the other hand, Simulated Annealing takes ~12h, but it has wide search space and realizes better score. So we used Static Analysis as initial guesses and optimized them by Simulated Annealing.